[SciPy-user] Unexpected typecasting when adding sparse.lil_matrix
Tony S Yu
Thu Sep 11 10:03:06 CDT 2008
This may be expected behavior, but I found it surprising. Addition (or
any other simple operation) of two lil sparse matrices returns a csc
sparse matrix. The scipy website suggests that csc and csr matrices
are more efficient than lil matrices for multiplication and inversion
(and I guess for addition too), but this typecasting is still a little
surprising. I was just curious if this is intentional.
In : import scipy.sparse as sparse
In : A = sparse.lil_eye([3, 3])
In : A + A
<3x3 sparse matrix of type '<type 'numpy.float64'>'
with 3 stored elements (space for 3)
in Compressed Sparse Column format>
More information about the SciPy-user