[Scipy-tickets] [SciPy] #1160: scipy.sparse.dok_matrix.__setitem__ does not filter zeros

SciPy Trac scipy-tickets@scipy....
Wed Apr 21 03:40:35 CDT 2010


#1160: scipy.sparse.dok_matrix.__setitem__ does not filter zeros
--------------------------+-------------------------------------------------
 Reporter:  derPhil       |       Owner:  wnbell
     Type:  defect        |      Status:  new   
 Priority:  normal        |   Milestone:  0.7.2 
Component:  scipy.sparse  |     Version:  devel 
 Keywords:  dok_matrix    |  
--------------------------+-------------------------------------------------
 scipy/sparse/dok.py, line 221 reads:

 {{{
 221 if value==0 and self.has_key((i,j)):
 222     del self[(i,j)]
 }}}

 This has the effect of adding zeros to the dok_matrix when the key (i,j)
 is not existing yet. In my opinion it should be:


 {{{
 221 if value==0:
 222     if self.has_key((i,j)):
 223         del self[(i,j)]
 }}}

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


More information about the Scipy-tickets mailing list