On Thu, Sep 30, 2010 at 11:11 AM, <[email protected]> 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 = array((1,2,2,3,3)) >>> w = array(((1,2),(3,4),(5,6),(7,8),(9,10))) >>> bincount(a,weights=w) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: object too deep for desired array >>> w0 = array((1,2,3,4,5)) >>> bincount(a,weights=w0) array([ 0., 1., 5., 9.]) >> 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 operation. _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
