[SciPy-User] SPARSE matrix dtypes, upcasting, sum function

Dinesh B Vadhia dineshbvadhia@hotmail....
Thu Sep 8 07:35:15 CDT 2011

We have:

I > 250000, J > 250000, nnz>10000000

data = scipy.ones(nnz, dtype=numpy.uint8)
A = sparse.csr_matrix((data, (xrow, xcolumn)), shape=(I,J))

where xrow and xcolumn are int vectors of length nnz 

The row and column sums are:
rowsum = A.sum(0)
columnsum = A.sum(1)

The max value given for each by Scipy are:
rowsum .max() = 255
columnsum .max() = 255

But, the real values are:
rowsum .max() = 41190 
columnsum .max() = 1080

Can someone see what we are doing wrong?  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110908/72a68d79/attachment.html 

More information about the SciPy-User mailing list