[SciPy-user] in-place add for sparse.lil_eye

Tony S Yu tonyyu@mit....
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  
works fine.

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)], [1], (N, N))
A_eye = a * sparse.lil_eye((N, N))
A_eye += A_offdiag

scipy 0.6.0
numpy 1.1.1
python 2.5.1
os.x 10.5.3

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20080828/978daaf4/attachment.html 

More information about the SciPy-user mailing list