How do I apply a function to every 2D plane of a 3D gpuArray?

1 回表示 (過去 30 日間)
Matthew Suttinger
Matthew Suttinger 2016 年 4 月 2 日
回答済み: Walter Roberson 2016 年 4 月 2 日
I have a gpuArray, A, of dimensions (Nx,Ny,Nz). I would like to apply a function on every (x,y) slice. Essentially:
for z = 1:Nz
E[:,:,z] = f(E[:,:,z]);
end
I would also like to perform functions along the z dimension:
for x = 1:Nx
for y = 1:Ny
E[x,y,:] = g(E[x,y,:]);
end
end
What is the most computationally efficient way of handling this problem? Is this vectorizable?

採用された回答

Walter Roberson
Walter Roberson 2016 年 4 月 2 日

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by