[Scipy-svn] r3105 - trunk/Lib/io

scipy-svn@scip... scipy-svn@scip...
Wed Jun 13 18:44:05 CDT 2007


Author: wnbell
Date: 2007-06-13 18:44:04 -0500 (Wed, 13 Jun 2007)
New Revision: 3105

Modified:
   trunk/Lib/io/mmio.py
Log:
fixed bug in MM io for non-COO sparse formats



Modified: trunk/Lib/io/mmio.py
===================================================================
--- trunk/Lib/io/mmio.py	2007-06-13 23:26:47 UTC (rev 3104)
+++ trunk/Lib/io/mmio.py	2007-06-13 23:44:04 UTC (rev 3105)
@@ -333,10 +333,10 @@
         assert symm=='general',`symm`
         if field in ['real','integer']:
             for i in range(entries):
-                target.write(format % (a.row[i]+1,a.col[i]+1,a.data[i]))
+                target.write(format % (a.rowcol(i)[0] + 1,a.rowcol(i)[1] + 1,a.getdata(i))) #convert base 0 to base 1
         elif field=='complex':
             for i in range(entries):
-                target.write(format % (a.row[i]+1,a.col[i]+1,reak(a.data[i]),imag(a.data[i])))
+                target.write(format % (a.rowcol(i)[0] + 1,a.rowcol(i)[1] + 1,real(a.getdata(i)),imag(a.getdata(i))))
         elif field=='pattern':
             raise NotImplementedError,`field`
         else:



More information about the Scipy-svn mailing list