[SciPy-User] Efficiently applying a function over a large array
Jose Gomez-Dans
jgomezdans@gmail....
Tue Feb 9 10:12:55 CST 2010
Hi!
I have a function that does some fairly involved linear algebra using some
vectors that are defined over 2D arrays. You can think of it as the 3rd
dimension of a 3D array. For each "pixel" in the 2D array, I want to appy my
function to [i,j,:]. Now, that's all very easy to do in theory using a loop,
eg
for i in ny:
for j in nx:
Out[i,j] = MyFunc ( arr1[i,j,:], arr2[i,j,:], arr3[i,j,:] )
but the array size is quite large (>1000x1000 elements), so I would like to
know what the most efficient way of doing this would be. I came accross
numpy.apply_along_axis, but also about the fact that is probably quite slow
for these large arrays?
Thanks!
Jose
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100209/ce9399b5/attachment.html
More information about the SciPy-User
mailing list