diff --git a/smop/Makefile b/smop/Makefile index 567c6855..41987aa6 100644 --- a/smop/Makefile +++ b/smop/Makefile @@ -15,7 +15,7 @@ ALL = \*.m all: mybench.py $(PYTHON) -c "import mybench ; mybench.mybench()" -octave.py: primes.m interp2.m meshgrid.m repmat.m +octave.py: primes.m interp2.m meshgrid.m repmat.m magic.m $(PYTHON) main.py $^ -r core -o $@ #octave.py: @@ -35,7 +35,7 @@ clean: rm -f a.* *.pyc solver.so solver.py octave.so solver.py: solver.m r8_random.m - $(PYTHON) main.py $^ -o $@ + $(PYTHON) main.py $^ -o $@ -r core check: $(PYTHON) octave.py diff --git a/smop/core.py b/smop/core.py index 29c4acc9..38118cc9 100644 --- a/smop/core.py +++ b/smop/core.py @@ -6,7 +6,9 @@ import __builtin__ import numpy -from numpy import sqrt +from sparsearray import sparsearray as sparse +from magic import magic +from numpy import sqrt,eye from numpy.fft import fft2 from numpy.linalg import inv from numpy.linalg import qr as _qr @@ -365,8 +367,7 @@ def cell(*args): args += args return cellarray(np.zeros(args,dtype=object,order="F")) -def clc(): - pass +clc = 0 def copy(a): return matlabarray(np.asanyarray(a).copy(order="F")) diff --git a/smop/main.py b/smop/main.py index b8a4b953..71d2906e 100644 --- a/smop/main.py +++ b/smop/main.py @@ -149,6 +149,7 @@ def main(): for a in runtime: print >> fp, "from %s import *" % a + print >> fp, "clc=0" #FIXME for pattern in args: for filename in glob.glob(os.path.expanduser(pattern)): if not filename.endswith(".m"): diff --git a/smop/mybench.m b/smop/mybench.m index 735df9dd..17bd53d8 100644 --- a/smop/mybench.m +++ b/smop/mybench.m @@ -242,68 +242,68 @@ s={}; - s{end+1}=struct('name','interp2','test', @(x) interp2(x,2,'spline'),... - 'input', @()rand(600),'goldResult',4.20); + %s{end+1}=struct('name','interp2','test', @(x) interp2(x,2,'spline'),... + % 'input', @()rand(600),'goldResult',4.20); - s{end+1}=struct(... - 'name','rand',... - 'test', @(x) rand(x),... - 'input', @()4000,... - 'goldResult',1.12); - - s{end+1}=struct(... - 'name','randn',... - 'test', @(x) randn(x),... - 'input', @()4000,... - 'goldResult',0.58); - - s{end+1}=struct('name','primes','test', @(x) primes(x), 'input', @() 1e7,... - 'goldResult',0.74); - - s{end+1}=struct('name','fft2','test', @(x) fft2(x), 'input', @()rand(3000),... - 'goldResult',2.28); +% s{end+1}=struct(... +% 'name','rand',... +% 'test', @(x) rand(x),... +% 'input', @()4000,... +% 'goldResult',1.12); + +% s{end+1}=struct(... +% 'name','randn',... +% 'test', @(x) randn(x),... +% 'input', @()4000,... +% 'goldResult',0.58); + +% s{end+1}=struct('name','primes','test', @(x) primes(x), 'input', @() 1e7,... +% 'goldResult',0.74); + +% s{end+1}=struct('name','fft2','test', @(x) fft2(x), 'input', @()rand(3000),... +% 'goldResult',2.28); % s{end+1}=struct('name','ifft2','test', @(x) ifft2(x), 'input', @()rand(3000),... % 'goldResult',2.979296); - s{end+1}=struct('name','square','test', @(x) x^2, 'input', @()rand(1000),... - 'goldResult',1.35); +% s{end+1}=struct('name','square','test', @(x) x^2, 'input', @()rand(1000),... +% 'goldResult',1.35); - s{end+1}=struct('name','inv','test', @(x) inv(x), 'input', @()rand(1000),... - 'goldResult',0.87); +% s{end+1}=struct('name','inv','test', @(x) inv(x), 'input', @()rand(1000),... +% 'goldResult',0.87); - s{end+1}=struct('name','eig','test', @(x) eig(x), 'input', @()rand(1000),... - 'goldResult',9.45); +% s{end+1}=struct('name','eig','test', @(x) eig(x), 'input', @()rand(1000),... +% 'goldResult',9.45); - s{end+1}=struct('name','qr','test', @(x) qr(x), 'input', @()rand(1000),... - 'goldResult',0.79); +% s{end+1}=struct('name','qr','test', @(x) qr(x), 'input', @()rand(1000),... +% 'goldResult',0.79); - s{end+1}=struct('name','schur','test', @(x) schur(x), 'input', @()rand(600),... - 'goldResult',2.67); +% s{end+1}=struct('name','schur','test', @(x) schur(x), 'input', @()rand(600),... +% 'goldResult',2.67); - s{end+1}=struct('name','roots','test', @(x) roots(x), 'input', ... - @()rand(600,1),'goldResult',2.08); +% s{end+1}=struct('name','roots','test', @(x) roots(x), 'input', ... +% @()rand(600,1),'goldResult',2.08); - s{end+1}=struct('name','binary',... - 'test', @(x) eye(x)<1,... - 'input', @() 5000 ,... - 'goldResult',0.51); +% s{end+1}=struct('name','binary',... +% 'test', @(x) eye(x)<1,... +% 'input', @() 5000 ,... +% 'goldResult',0.51); - s{end+1}=struct('name','forLoop',... - 'test', @(x)forLoop(x),... - 'input', @() 200 ,... - 'goldResult',0.06); - - s{end+1}=struct('name','makeSparse',... - 'test', @(x) sparse(x),... - 'input', @() eye(5000) ,... - 'goldResult',0.49); - - s{end+1}=struct('name','multiplySparse',... - 'test', @(x) sparse(x)*sparse(x),... - 'input', @() eye(5000)*rand(1) ,... - 'goldResult',0.98); +% s{end+1}=struct('name','forLoop',... +% 'test', @(x)forLoop(x),... +% 'input', @() 200 ,... +% 'goldResult',0.06); + +% s{end+1}=struct('name','makeSparse',... +% 'test', @(x) sparse(x),... +% 'input', @() eye(500) ,... +% 'goldResult',0.49); + +% s{end+1}=struct('name','multiplySparse',... +% 'test', @(x) sparse(x)*sparse(x),... +% 'input', @() eye(500)*rand(1) ,... +% 'goldResult',0.98); s{end+1}=struct('name','sLinearEq',... 'test', @(x) magic(x)/rand(1,x),...