[Scipy-tickets] [SciPy] #1427: Scalar multiplication of a lil_matrix return a 2-dimensional array instead of a 1-dimensional array of list

SciPy Trac scipy-tickets@scipy....
Fri Apr 22 07:28:52 CDT 2011


#1427: Scalar multiplication of a lil_matrix return a 2-dimensional array instead
of a 1-dimensional array of list
--------------------+-------------------------------------------------------
 Reporter:  eti     |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:          
Component:  Other   |     Version:  0.9.0   
 Keywords:          |  
--------------------+-------------------------------------------------------
 Exemple :
 {{{
 from scipy import sparse
 a = sparse.lil_matrix(ones((3,3)))
 a *= 2.
 a[0,:]=0
 }}}
 This brings the following error :

 {{{
     self._setitem_setrow(row, data, j, xrow, xdata, xcols)
   File "C:\Python27\lib\site-packages\scipy\sparse\lil.py", line 276, in
 _setitem_setrow
     self._insertat2(row, data, jj,val)
   File "C:\Python27\lib\site-packages\scipy\sparse\lil.py", line 257, in
 _insertat2
     del data[pos]
 ValueError: cannot delete array elements
 }}}

 The error comes from "a *= 2." wich change the definition of the
 lil_matrix.
 Before the multiplication a.data[0] returns a list, after it returns an
 array (which is incompatible with the del instruction).

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1427>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list