Re: [Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Anne Archibald
2009/4/29 Dan Goodman : > Robert Kern wrote: >> On Wed, Apr 29, 2009 at 16:19, Dan Goodman wrote: >>> Robert Kern wrote: On Wed, Apr 29, 2009 at 08:03, Daniel Yarlett wrote: > As you can see, Current is different in the two cases. Any ideas how I > can recreate the behavio

Re: [Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Dan Goodman
Robert Kern wrote: > On Wed, Apr 29, 2009 at 16:19, Dan Goodman wrote: >> Robert Kern wrote: >>> On Wed, Apr 29, 2009 at 08:03, Daniel Yarlett >>> wrote: >>> As you can see, Current is different in the two cases. Any ideas how I can recreate the behavior of the iterative process in a m

Re: [Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Robert Kern
On Wed, Apr 29, 2009 at 16:19, Dan Goodman wrote: > Robert Kern wrote: >> On Wed, Apr 29, 2009 at 08:03, Daniel Yarlett >> wrote: >> >>> As you can see, Current is different in the two cases. Any ideas how I >>> can recreate the behavior of the iterative process in a more numpy- >>> friendly, ve

Re: [Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Dan Goodman
Robert Kern wrote: > On Wed, Apr 29, 2009 at 08:03, Daniel Yarlett > wrote: > >> As you can see, Current is different in the two cases. Any ideas how I >> can recreate the behavior of the iterative process in a more numpy- >> friendly, vectorized (and hopefully quicker) way? > > Use bincount().

Re: [Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Robert Kern
On Wed, Apr 29, 2009 at 08:03, Daniel Yarlett wrote: > As you can see, Current is different in the two cases. Any ideas how I > can recreate the behavior of the iterative process in a more numpy- > friendly, vectorized (and hopefully quicker) way? Use bincount(). > And possibly also > about why

Re: [Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Dan Goodman
> As you can see, Current is different in the two cases. Any ideas how I > can recreate the behavior of the iterative process in a more numpy- > friendly, vectorized (and hopefully quicker) way? And possibly also > about why my intuitions concerning the semantics of the vectorized > code are

[Numpy-discussion] Vectorizing array updates

2009-04-29 Thread Daniel Yarlett
Hi All, I'm coding an iterative algorithm which needs to update a results array on each iteration. I have several (one-dimensional) arrays, and currently I have the following non-vectorized code which gets called at the end of each iteration (Inds, Current, and Update are all one- dimension