Skip to content

Commit

Permalink
Merged with the fossil version 0.27.6
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlei committed Jul 26, 2016
1 parent 818a6cd commit e4cea6e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 54 deletions.
4 changes: 2 additions & 2 deletions smop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions smop/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions smop/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down
98 changes: 49 additions & 49 deletions smop/mybench.m
Original file line number Diff line number Diff line change
Expand Up @@ -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),...
Expand Down

0 comments on commit e4cea6e

Please sign in to comment.