[Scipy-svn] r4523 - trunk/scipy/sandbox/mkufunc/examples

scipy-svn@scip... scipy-svn@scip...
Wed Jul 2 13:33:52 CDT 2008


Author: ilan
Date: 2008-07-02 13:33:52 -0500 (Wed, 02 Jul 2008)
New Revision: 4523

Modified:
   trunk/scipy/sandbox/mkufunc/examples/benchmark.py
   trunk/scipy/sandbox/mkufunc/examples/primes.py
Log:
Primes imports from local directory

Modified: trunk/scipy/sandbox/mkufunc/examples/benchmark.py
===================================================================
--- trunk/scipy/sandbox/mkufunc/examples/benchmark.py	2008-07-02 18:21:39 UTC (rev 4522)
+++ trunk/scipy/sandbox/mkufunc/examples/benchmark.py	2008-07-02 18:33:52 UTC (rev 4523)
@@ -2,7 +2,7 @@
 from math import sin, cos
 import time, hashlib
 
-from numpy import arange, vectorize, allclose, empty_like
+from numpy import linspace, vectorize, allclose, empty_like
 from scipy import weave
 
 from mkufunc.api import mkufunc
@@ -72,7 +72,7 @@
 #############################################################
 
 
-x = arange(0, 1000, 0.0001)    #print "x =", x, x.dtype
+x = linspace(0, 1, 10000*1000)
 
 start_time = time.time()
 b_y = empty_like(x)

Modified: trunk/scipy/sandbox/mkufunc/examples/primes.py
===================================================================
--- trunk/scipy/sandbox/mkufunc/examples/primes.py	2008-07-02 18:21:39 UTC (rev 4522)
+++ trunk/scipy/sandbox/mkufunc/examples/primes.py	2008-07-02 18:33:52 UTC (rev 4523)
@@ -1,8 +1,11 @@
 #!/usr/bin/env python
+import sys
+sys.path.append('../mkufunc')
+
 from math import sqrt
 import time
 
-from mkufunc.api import mkufunc
+from api import mkufunc
 
 
 def count_primes(N):
@@ -17,13 +20,13 @@
 
 
 start_time = time.time()
-assert count_primes(1000000) == 78498
+print count_primes(100000)
 print 'Python: %.6f sec' % (time.time() - start_time)
 
 
-count_primes = mkufunc(int)(count_primes)
+count_primes = mkufunc(int, src=len(sys.argv)-1)(count_primes)
 
 
 start_time = time.time()
-assert count_primes(1000000) == 78498
+print count_primes(100000)
 print 'Compiled: %.6f sec' % (time.time() - start_time)



More information about the Scipy-svn mailing list