Re: [Numpy-discussion] I hate for loops

2007-06-08 Thread Charles R Harris
On 6/8/07, Charles R Harris <[EMAIL PROTECTED]> wrote: On 6/8/07, Mathew Yeates <[EMAIL PROTECTED]> wrote: > > Hi > 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] +

Re: [Numpy-discussion] I hate for loops

2007-06-08 Thread Charles R Harris
On 6/8/07, Mathew Yeates <[EMAIL PROTECTED]> wrote: Hi 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] If the initial values of the recursion are i

[Numpy-discussion] I hate for loops

2007-06-08 Thread Mathew Yeates
Hi 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? Mathew ___