[SciPy-User] Efficiently applying a function over a large array
Tue Feb 9 10:12:55 CST 2010
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,
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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User