Re: [Numpy-discussion] nonuniform scatter operations

2008-09-29 Thread Nathan Bell
On Sun, Sep 28, 2008 at 4:15 PM, Geoffrey Irving <[EMAIL PROTECTED]> wrote: > > Thanks. That works great. A slightly cleaner version is > >X += coo_matrix((Y, (K, zeros_like(K.sum(axis=1) > > The next question is: is there a similar way that generalizes to the > case where X is n by 3 and

Re: [Numpy-discussion] nonuniform scatter operations

2008-09-28 Thread Geoffrey Irving
On Sat, Sep 27, 2008 at 10:01 PM, Nathan Bell <[EMAIL PROTECTED]> wrote: > On Sun, Sep 28, 2008 at 12:34 AM, Geoffrey Irving <[EMAIL PROTECTED]> wrote: >> >> Is there an efficient way to implement a nonuniform gather operation >> in numpy? Specifically, I want to do something like >> >> n,m = 100,

Re: [Numpy-discussion] nonuniform scatter operations

2008-09-27 Thread Anne Archibald
2008/9/28 Geoffrey Irving <[EMAIL PROTECTED]>: > Is there an efficient way to implement a nonuniform gather operation > in numpy? Specifically, I want to do something like > > n,m = 100,1000 > X = random.uniform(size=n) > K = random.randint(n, size=m) > Y = random.uniform(size=m) > > for k,y in z

Re: [Numpy-discussion] nonuniform scatter operations

2008-09-27 Thread Nathan Bell
On Sun, Sep 28, 2008 at 12:34 AM, Geoffrey Irving <[EMAIL PROTECTED]> wrote: > > Is there an efficient way to implement a nonuniform gather operation > in numpy? Specifically, I want to do something like > > n,m = 100,1000 > X = random.uniform(size=n) > K = random.randint(n, size=m) > Y = random.u

[Numpy-discussion] nonuniform scatter operations

2008-09-27 Thread Geoffrey Irving
Hello, Is there an efficient way to implement a nonuniform gather operation in numpy? Specifically, I want to do something like n,m = 100,1000 X = random.uniform(size=n) K = random.randint(n, size=m) Y = random.uniform(size=m) for k,y in zip(K,Y): X[k] += y but I want it to be fast. The n