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,:]); endend
What is the most computationally efficient way of handling this problem? Is this vectorizable?
Best Answer