>>> I propose the name 'gather()' for the helper function that does this.
>>
>> I don't think "gather" is an obvious name to search for.
>
> "gather" is the name that the GPGPU community uses to describe this
> kind of operation. Not just for summation but for any kind of indexed
> reducing operati
On Thu, Sep 30, 2010 at 11:11 AM, wrote:
>> bincount only works for gathering/accumulating scalars. Even the
>> 'weights' parameter is limited to scalars.
>
> Do you mean that bincount only works with 1d arrays? I also think that
> this is a major limitation of it.
>>> from numpy import *
>>> a
On Thu, Sep 30, 2010 at 3:28 AM, Robert Kern wrote:
> On Wed, Sep 29, 2010 at 12:00, Pauli Virtanen wrote:
>> Wed, 29 Sep 2010 11:15:08 -0500, Robert Kern wrote:
>> [clip: inplace addition with duplicates]
>>> Use numpy.bincount() instead.
>>
>> It might be worthwhile to add a separate helper fun
lets say i have arrays:
a = array((1,2,3,4,5))
indices = array((1,1,1,1))
and i perform operation:
a[indices] += 1
the result is
array([1, 3, 3, 4, 5])
in other words, the duplicates inĀ indicesĀ are ignored
if I wanted the duplicates not to be ignored, resulting in:
array([1, 6, 3, 4, 5])
h