[Scipy-svn] r3699 - trunk/scipy/sparse

scipy-svn at scipy.org scipy-svn at scipy.org
Sun Dec 23 16:07:04 EST 2007


Author: wnbell
Date: 2007-12-23 15:07:00 -0600 (Sun, 23 Dec 2007)
New Revision: 3699

Modified:
   trunk/scipy/sparse/dok.py
Log:
fixed bug with negative indices


Modified: trunk/scipy/sparse/dok.py
===================================================================
--- trunk/scipy/sparse/dok.py	2007-12-23 19:17:49 UTC (rev 3698)
+++ trunk/scipy/sparse/dok.py	2007-12-23 21:07:00 UTC (rev 3699)
@@ -217,7 +217,7 @@
                 # Ensure value is a single element, not a sequence
                 if isinstance(value, float) or isintlike(value) or \
                         isinstance(value, complex):
-                    dict.__setitem__(self, key, self.dtype.type(value))
+                    dict.__setitem__(self, (i,j), self.dtype.type(value))
                     newrows = max(self.shape[0], int(key[0])+1)
                     newcols = max(self.shape[1], int(key[1])+1)
                     self.shape = (newrows, newcols)
@@ -558,7 +558,7 @@
         return self.tocoo().tocsc()
 
     def toarray(self):
-        return self.tocsr().toarray()
+        return self.tocoo().toarray()
 
     def resize(self, shape):
         """ Resize the matrix to dimensions given by 'shape', removing any




More information about the Scipy-svn mailing list