[SciPy-user] [Sparse matrix library] csr_matrix and column sum

Nathan Bell wnbell@gmail....
Mon Apr 28 11:43:26 CDT 2008

On Mon, Apr 28, 2008 at 11:06 AM, Robert Kern <robert.kern@gmail.com> wrote:
>  ndarray.sum() accepts a dtype= argument to specify the type of the
>  accumulator. You might consider implementing the same thing for sparse
>  arrays. Also, ndarray.sum() defaults to int32 (on 32-bit systems,
>  int64 on 64-bit systems) as the accumulator dtype for all smaller
>  integer types.

I wasn't aware of that feature until now.  I've tried to keep the
behavior of scipy.sparse as close to that of numpy matrices, so we
should support user-defined accumulator types.

I've created a ticket for this issue;

It won't require much work to implement, but I can't say when I'll
have the time to carry it out.  I think the "right" way is to support
matvec operations y = A*x with different dtypes for A and x/y.  This
would allow one to compute A*x for integer A and floating point x
without upcasting A's data array.

Nathan Bell wnbell@gmail.com

More information about the SciPy-user mailing list