[Numpy-discussion] vectorizing loops

Gael Varoquaux gael.varoquaux at normalesup.org
Fri Oct 26 02:36:19 EDT 2007


On Thu, Oct 25, 2007 at 04:16:06PM -0700, Mathew Yeates wrote:
> Anybody know of any tricks for handling something like

> z[0]=1.0
> for i in range(100):
>     out[i]=func1(z[i])
>     z[i+1]=func2(out[i])

Something like:

z[0] = 1.
out = func1(z)
z[1:] = func2(out[:-1])

HTH,

Gaël



More information about the NumPy-Discussion mailing list