[SciPy-User] MATLAB accumarray equivalent ?

eat e.antero.tammi at gmail.com
Wed Mar 31 17:12:21 EDT 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 
details
    ...
else:
    out= np.empty(size, dtype=dtype)
    ...


Regards,
eat





More information about the SciPy-User mailing list