[SciPy-user] lil_matrix

Giovanni Samaey Giovanni.Samaey@cs.kuleuven...
Fri Nov 30 11:26:50 CST 2007


Hello all,

I have a basic question concerning lil_matrix slice assignments.
The following code does not behave as intended :

import scipy.sparse as S

A = S.lil_matrix((5,5))
A.setdiag(ones(5))
B = S.lil_matrix((6,6))
B[:5,:5]=A
B.getnnz()

This returns 0 instead of the expected 5.  Am I using the code  
incorrectly ?

Giovanni


More information about the SciPy-user mailing list