[Scipy-svn] r3763 - trunk/scipy/io

scipy-svn@scip... scipy-svn@scip...
Tue Jan 1 23:41:06 CST 2008


Author: wnbell
Date: 2008-01-01 23:41:05 -0600 (Tue, 01 Jan 2008)
New Revision: 3763

Modified:
   trunk/scipy/io/mmio.py
Log:
slight change to mmio sparse writing


Modified: trunk/scipy/io/mmio.py
===================================================================
--- trunk/scipy/io/mmio.py	2008-01-02 05:37:17 UTC (rev 3762)
+++ trunk/scipy/io/mmio.py	2008-01-02 05:41:05 UTC (rev 3763)
@@ -546,13 +546,14 @@
             if symm != self.SYMMETRY_GENERAL:
                 raise ValueError, 'symmetric matrices incompatible with sparse format'
 
+            coo = a.tocoo() # convert to COOrdinate format
+
             # write shape spec
-            stream.write('%i %i %i\n' % (rows,cols,entries))
+            stream.write('%i %i %i\n' % (rows,cols,coo.nnz))
 
             # line template
             template = '%i %i ' + template
 
-            coo = a.tocoo() # convert to COOrdinate format
             I,J,V = coo.row + 1, coo.col + 1, coo.data # change base 0 -> base 1
 
             if field in (self.FIELD_REAL, self.FIELD_INTEGER):



More information about the Scipy-svn mailing list