[SciPy-user] in-place add for sparse.lil_eye
Tony S Yu
Thu Aug 28 16:25:58 CDT 2008
I'm not sure if this is a closed bug or not, but in-place adding for
sparse.lil_eye *sometimes* raises:
AttributeError: 'numpy.ndarray' object has no attribute 'append'
In the code below, the error doesn't occur unless the sparse matrix is
multiplied by some number (`a` below) AND the added matrix
(`A_offdiag` below) has entries off the main diagonal. Normal adding
I noticed the 0.7.0 changes noted "numerous bug fixes" for the sparse
module, so this problem may already be fixed (possibly with the
closing of Ticket#680); I just wanted to bring it up in case it hadn't.
import numpy as np
import scipy.sparse as sparse
N = 15
a = 2.
A_offdiag = sparse.lil_diags([np.ones(N)], , (N, N))
A_eye = a * sparse.lil_eye((N, N))
A_eye += A_offdiag
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user