Re: [Numpy-discussion] Fwd: Advanced selection, duplicate indices, and augmented assignment

2007-01-06 Thread A. M. Archibald
On 06/01/07, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > Do we have to revisit that thread? I seem to recall it getting kind of > cranky. To avoid reliving that, I will attempt dredge up the relevant issue: > > "a[indx]+=b" should be the same as "a[indx]=a[indx]+b". All else follow from > that.

Re: [Numpy-discussion] Fwd: Advanced selection, duplicate indices, and augmented assignment

2007-01-06 Thread Timothy Hochberg
On 1/6/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: Timothy Hochberg wrote: > > > > On 1/6/07, *Robert Kern* < [EMAIL PROTECTED] > > wrote: > > Sean R. Lynch wrote: > > x = zeros((3,)) > x[array([0, 1, 1])] += array([1, 1, 1]) > x >

Re: [Numpy-discussion] Fwd: Advanced selection, duplicate indices, and augmented assignment

2007-01-06 Thread Travis Oliphant
Timothy Hochberg wrote: > > > > On 1/6/07, *Robert Kern* < [EMAIL PROTECTED] > > wrote: > > Sean R. Lynch wrote: > > x = zeros((3,)) > x[array([0, 1, 1])] += array([1, 1, 1]) > x > > array([ 1., 1., 0.]) > > > > If this worked

[Numpy-discussion] Fwd: Advanced selection, duplicate indices, and augmented assignment

2007-01-06 Thread Timothy Hochberg
On 1/6/07, Robert Kern <[EMAIL PROTECTED]> wrote: Sean R. Lynch wrote: x = zeros((3,)) x[array([0, 1, 1])] += array([1, 1, 1]) x > array([ 1., 1., 0.]) > > If this worked the way I was hoping, the output would be [1 2 0] because > it would add to element 1 twice due to its dup

Re: [Numpy-discussion] Latest Array-Interface PEP

2007-01-06 Thread Travis Oliphant
Tim Hochberg wrote: > Christopher Barker wrote: > > [SNIP] > >> I think the PEP has far more chances of success if it's seen as a >> request from a variety of package developers, not just the numpy crowd >> (which, after all, already has numpy >> > This seems eminently sensible. Getting a

[Numpy-discussion] Installing numpy from rpm

2007-01-06 Thread Satyendra Tomar
Hi, I'm entirely new to Python. I just used "rpm -Uvh numpy-1.0.1-1.src.rpm" to install numpy from the rpm package, running under SuSE 10.1, 2.6.16.21, python 2.4.2, GCC 4.1.0 but python can't still find the numpy module. What I only find is /usr/src/packages/SPECS/numpy.spec /usr/src/packages/

Re: [Numpy-discussion] Advanced selection, duplicate indices, and augmented assignment

2007-01-06 Thread Robert Kern
Sean R. Lynch wrote: x = zeros((3,)) x[array([0, 1, 1])] += array([1, 1, 1]) x > array([ 1., 1., 0.]) > > If this worked the way I was hoping, the output would be [1 2 0] because > it would add to element 1 twice due to its duplication in the advanced > selection array. > > Is t

Re: [Numpy-discussion] x[None] changes x.shape

2007-01-06 Thread Vincent Nijs
Ah ... I did not make the link between newaxis and None. While the proposed solution works I found an alternative that gave me exactly what I was looking for: def foo(x, sel=()) return x[sel] I.e., passing an empty tuple returns the entire array without changing x.shape or making a copy. Vi

[Numpy-discussion] Advanced selection, duplicate indices, and augmented assignment

2007-01-06 Thread Sean R. Lynch
I have an array of vertices and an array of indices that make a list of triangles. I'd like to calculate the normals for each vertex as a (pseudo-)average of the normals of each triangle that contains it, so I get smooth lighting in OpenGL. I'd also like to avoid looping in Python because the verte