[SciPy-User] MATLAB accumarray equivalent ?

eat e.antero.tammi@gmail....
Wed Mar 31 16:12:21 CDT 2010

Hi all,

Warren Weckesser <warren.weckesser <at> enthought.com> writes:

> I've added an accumarray-like function to the Cookbook:
>     http://www.scipy.org/Cookbook/AccumarrayLike
> Warren
Excellent accumulator!
Would it be possible to add support for sparse arrays as well?

Along the lines:
def accum(..., dtype=None):
=> def accum(..., dtype=None, sparse= False):

# Create the output array.
out= np.empty(size, dtype=dtype)
=> # Create the output array.
if sparse:
    out= sparse(size, dtype=dtype) # just an idea, caller may provide more 
    out= np.empty(size, dtype=dtype)


More information about the SciPy-User mailing list