[Scipy-tickets] [SciPy] #316: adding sparse matrices sometimes gives wrong result

SciPy scipy-tickets at scipy.net
Sun Nov 26 16:14:04 CST 2006


#316: adding sparse matrices sometimes gives wrong result
-----------------------------+----------------------------------------------
 Reporter:  martin_wiechert  |       Owner:  somebody           
     Type:  defect           |      Status:  new                
 Priority:  normal           |   Milestone:                     
Component:  scipy.sparse     |     Version:  devel              
 Severity:  critical         |    Keywords:  sparse, wrong value
-----------------------------+----------------------------------------------
 In certain circumstances adding a csr to a csc matrix gives a wrong
 result:
 {{{
 Python 2.4.3 (#1, May 12 2006, 05:35:54)
 [GCC 4.1.0 (SUSE Linux)] on linux2
 Type "help", "copyright", "credits" or "license" for more information.
 >>> from scipy import *
 >>> a = sparse.spidentity (4)
 >>> a [3, 0] = -1
 >>> (a + a.T).todense ()
 matrix([[ 1.,  0.,  0., -1.],
         [ 0.,  2.,  0.,  0.],
         [ 0.,  0.,  2.,  0.],
         [-1.,  0.,  0.,  2.]])
 >>>
 >>> import scipy
 >>> scipy.version.version
 '0.5.2.dev2331'
 }}}
 First diagonal element in the sum should be 2, not 1.

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


More information about the Scipy-tickets mailing list