[Scipy-tickets] [SciPy] #324: scipy.sparse, setdiag, off-diagonal elements

SciPy scipy-tickets at scipy.net
Thu Nov 30 07:57:35 CST 2006

#324: scipy.sparse, setdiag, off-diagonal elements
 Reporter:  MarkHoffmann  |       Owner:  somebody       
     Type:  defect        |      Status:  new            
 Priority:  normal        |   Milestone:                 
Component:  Other         |     Version:                 
 Severity:  normal        |    Keywords:  sparse, setdiag
 In working with the scipy.sparse format the following problem occured. If
 off-diagonal elements are set using the "setdiag(self, values, k=0)"
 method it results in an error if k is negative, i.e. off-diagonals below
 the main. By looking at the "setdiag" code from "sparse.py" it says:

 for i, v in enumerate(values):
             self[i, i+k] = v

 If k is negative it will try to access a column with a negative index,
 however, it should do something like "self[i-k,i] = v" instead.

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

More information about the Scipy-tickets mailing list