[SciPy-user] scipy.sparse: coo_matrix ignores sum_duplicates=False

James Philbin philbinj@gmail....
Mon Oct 13 09:04:32 CDT 2008


I've filed this as trac #754, repeated here for visibility.

---
Running scipy version 0.7.0.dev4763

coo_matrix.tocsr + tocsc both ignore the sum_duplicates parameter:

In [1]: from numpy import *
In [2]: from scipy.sparse import *
In [3]: data = array([1,1,1,1,1,1,1])
In [4]: row  = array([0,0,1,3,1,0,0])
In [5]: col  = array([0,2,1,3,1,0,0])
In [6]: A = coo_matrix( (data,(row,col)), shape=(4,4))
In [8]: A.tocsr(sum_duplicates=False).todense()
Out[8]:
matrix([[3, 0, 1, 0],
        [0, 2, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 1]])
In [9]: A.tocsc(sum_duplicates=False).todense()
Out[9]:
matrix([[3, 0, 1, 0],
        [0, 2, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 1]])
---

Thanks,
James


More information about the SciPy-user mailing list