[Scipy-svn] r3626 - trunk/scipy/sparse/tests

scipy-svn@scip... scipy-svn@scip...
Sun Dec 9 01:01:06 CST 2007


Author: wnbell
Date: 2007-12-09 01:00:42 -0600 (Sun, 09 Dec 2007)
New Revision: 3626

Modified:
   trunk/scipy/sparse/tests/test_sparse.py
Log:
revised unittest benchmark


Modified: trunk/scipy/sparse/tests/test_sparse.py
===================================================================
--- trunk/scipy/sparse/tests/test_sparse.py	2007-12-08 21:57:23 UTC (rev 3625)
+++ trunk/scipy/sparse/tests/test_sparse.py	2007-12-09 07:00:42 UTC (rev 3626)
@@ -1297,7 +1297,7 @@
 
             print fmt % (A.format,name,shape,A.nnz,MFLOPs)
             
-    def bench_matvec(self,level=5):
+    def bench_construction(self,level=5):
         """build matrices by inserting single values"""
         matrices = []
         matrices.append( ('Empty',csr_matrix((10000,10000))) )
@@ -1333,19 +1333,18 @@
 
 
     def bench_conversion(self,level=5):
-        A = poisson2d(30).todense()
+        A = poisson2d(80)
 
         formats = ['csr','csc','coo','lil','dok']
        
         print
-        print '                    Sparse Matrix Conversion'
-        print '===================================================================='
-        print ' format |  tocsr()  |  tocsc()  |  tocoo()  |  tolil()  |  todok()  '
-        print '--------------------------------------------------------------------'
+        print '                Sparse Matrix Conversion'
+        print '=========================================================='
+        print ' format | tocsr() | tocsc() | tocoo() | tolil() | todok() '
+        print '----------------------------------------------------------'
         
         for fromfmt in formats:
-            #base = getattr(A,'to' + fromfmt)()
-            base = eval(fromfmt + '_matrix')(A)
+            base = getattr(A,'to' + fromfmt)()
  
             times = []
 
@@ -1357,7 +1356,7 @@
                 else:
                     start = time.clock()
                     iter = 0
-                    while time.clock() < start + 0.1:
+                    while time.clock() < start + 0.2:
                         x = fn()
                         iter += 1
                     end = time.clock()
@@ -1369,7 +1368,7 @@
                 if t is None:
                     output += '|    n/a    '
                 else:
-                    output += '| %9.7f ' % t 
+                    output += '| %7.5f ' % t 
             print output
 
                 



More information about the Scipy-svn mailing list