In [4]:
from scipy.sparse import *
from scipy import *
row = array([0,0,1,2,2,2])
col = array([0,2,2,0,1,2])
data = array([1,2,3,4,5,6])
A=csr_matrix( (data,(row,col)), shape=(3,3) )
In [7]:
print A.todense()
lumped = A.sum(1)
In [9]:
lumped.A
Out[9]: