9 Feb 17:12
Efficiently applying a function over a large array
Jose Gomez-Dans <jgomezdans <at> gmail.com>
2010-02-09 16:12:55 GMT
2010-02-09 16:12:55 GMT
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
_______________________________________________ SciPy-User mailing list SciPy-User <at> scipy.org http://mail.scipy.org/mailman/listinfo/scipy-user
RSS Feed