I want to re-arrange a two dimensions frequency domain x,y to p=sqrt(x^2+y^2) on GPU. I can do so with the code below. However, it it is pretty slow for my application (2 seconds). I have read about arrayfun but could not make it work for my purpose. Any help is much appreciated.
loik= (G(:,1)>=(bin*(ii-1)) & G(:,1)<(bin*(ii)));
Any help is appreciated.