[Numpy-discussion] how do I speed up this?

Giorgio F. Gilestro giorgio@gilestro...
Tue Nov 27 12:38:27 CST 2007


Hello everyone,

ma and new_ma are bi-dimensional array with shape (a1, a2) on which I am 
performing the following iteration:

for fd in range(a1):
     new_ma[fd] = [( ma[fd][i-5:i+5].sum() == 0 )*1 for i in range (a2)]

Is there any faster more elegant way to do that with numpy?

Thanks a lot!
Giorgio

-- 
giorgio@gilestro.tk
http://www.cafelamarck.it




More information about the Numpy-discussion mailing list