[Numpy-discussion] I hate for loops

Mathew Yeates mathewww at charter.net
Fri Jun 8 20:47:48 EDT 2007

I'm looking for a more elegant way of setting my array elements
Using "for" loops it would be
for i in range(rows):
    for j in range(cols):
       N[i,j] = N[i-1][j] + N[i][j-1] - N[i-1][j-1]

It's sort of a combined 2d accumulate.
Any ideas?

More information about the NumPy-Discussion mailing list