diff options
author | Jarrod Millman <millman@berkeley.edu> | 2008-09-02 20:32:38 +0000 |
---|---|---|
committer | Jarrod Millman <millman@berkeley.edu> | 2008-09-02 20:32:38 +0000 |
commit | d29107a248130bbb68ecac58d6720d716529141c (patch) | |
tree | 9e1408025c80d63fe9fa6151343a7b265ec3f654 /doc/numpybook/comparison | |
parent | a4a7966cf7191c28a7054127fd3717d6c760d556 (diff) | |
download | numpy-d29107a248130bbb68ecac58d6720d716529141c.tar.gz |
reindenting prior to release
Diffstat (limited to 'doc/numpybook/comparison')
-rw-r--r-- | doc/numpybook/comparison/ctypes/filter.py | 3 | ||||
-rw-r--r-- | doc/numpybook/comparison/ctypes/interface.py | 7 | ||||
-rw-r--r-- | doc/numpybook/comparison/pyrex/setup.py | 4 | ||||
-rw-r--r-- | doc/numpybook/comparison/timing.py | 18 | ||||
-rw-r--r-- | doc/numpybook/comparison/weave/filter.py | 11 | ||||
-rw-r--r-- | doc/numpybook/comparison/weave/inline.py | 10 |
6 files changed, 22 insertions, 31 deletions
diff --git a/doc/numpybook/comparison/ctypes/filter.py b/doc/numpybook/comparison/ctypes/filter.py index e92aa5eab..1b322aca3 100644 --- a/doc/numpybook/comparison/ctypes/filter.py +++ b/doc/numpybook/comparison/ctypes/filter.py @@ -21,6 +21,3 @@ def filter2d(a): b = N.zeros_like(a) lib.dfilter2d(a, b, a.ctypes.strides, a.ctypes.shape) return b - - - diff --git a/doc/numpybook/comparison/ctypes/interface.py b/doc/numpybook/comparison/ctypes/interface.py index 06c12aef3..e237f8ded 100644 --- a/doc/numpybook/comparison/ctypes/interface.py +++ b/doc/numpybook/comparison/ctypes/interface.py @@ -27,7 +27,7 @@ lib.dfilter2d.argtypes = [N.ctypeslib.ndpointer(float, ndim=2, flags='aligned, contiguous,'\ 'writeable'), ctypes.POINTER(N.ctypeslib.c_intp), - ctypes.POINTER(N.ctypeslib.c_intp)] + ctypes.POINTER(N.ctypeslib.c_intp)] def select(dtype): if dtype.char in ['?bBhHf']: @@ -49,12 +49,9 @@ def add(a, b): c = N.empty_like(a) func(a,b,c,a.size) return c - + def filter2d(a): a = N.require(a, float, ['ALIGNED']) b = N.zeros_like(a) lib.dfilter2d(a, b, a.ctypes.strides, a.ctypes.shape) return b - - - diff --git a/doc/numpybook/comparison/pyrex/setup.py b/doc/numpybook/comparison/pyrex/setup.py index 64cf12bc8..695639d9e 100644 --- a/doc/numpybook/comparison/pyrex/setup.py +++ b/doc/numpybook/comparison/pyrex/setup.py @@ -16,8 +16,8 @@ pyx_ext = Extension('add', include_dirs = [numpy.get_include()]) pyx_ext2 = Extension('blur', - ['blur.pyx'], - include_dirs = [numpy.get_include()]) + ['blur.pyx'], + include_dirs = [numpy.get_include()]) # Call the routine which does the real work diff --git a/doc/numpybook/comparison/timing.py b/doc/numpybook/comparison/timing.py index 14841d7cb..92f6a50d2 100644 --- a/doc/numpybook/comparison/timing.py +++ b/doc/numpybook/comparison/timing.py @@ -51,13 +51,11 @@ import sys path = sys.path for kind in ['f2py']:#['ctypes', 'pyrex', 'weave', 'f2py']: - res[kind] = [] - sys.path = ['/Users/oliphant/numpybook/%s' % (kind,)] + path - print sys.path - for n in N: - print "%s - %d" % (kind, n) - t = timeit.Timer(eval('%s_run'%kind), eval('%s_pre %% (%d,%d)'%(kind,n,n))) - mytime = min(t.repeat(3,100)) - res[kind].append(mytime) - - + res[kind] = [] + sys.path = ['/Users/oliphant/numpybook/%s' % (kind,)] + path + print sys.path + for n in N: + print "%s - %d" % (kind, n) + t = timeit.Timer(eval('%s_run'%kind), eval('%s_pre %% (%d,%d)'%(kind,n,n))) + mytime = min(t.repeat(3,100)) + res[kind].append(mytime) diff --git a/doc/numpybook/comparison/weave/filter.py b/doc/numpybook/comparison/weave/filter.py index b2fdb277e..6fc16c79f 100644 --- a/doc/numpybook/comparison/weave/filter.py +++ b/doc/numpybook/comparison/weave/filter.py @@ -8,11 +8,11 @@ def filter(a): for(i=1;i<Na[0]-1;i++) { for(j=1;j<Na[1]-1;j++) { B2(i,j) = A2(i,j) + (A2(i-1,j) + - A2(i+1,j) + A2(i,j-1) - + A2(i,j+1))*0.5 - + (A2(i-1,j-1) - + A2(i-1,j+1) - + A2(i+1,j-1) + A2(i+1,j) + A2(i,j-1) + + A2(i,j+1))*0.5 + + (A2(i-1,j-1) + + A2(i-1,j+1) + + A2(i+1,j-1) + A2(i+1,j+1))*0.25; } } @@ -20,4 +20,3 @@ def filter(a): b = zeros_like(a) weave.inline(code,['a','b']) return b - diff --git a/doc/numpybook/comparison/weave/inline.py b/doc/numpybook/comparison/weave/inline.py index 31499213e..bfac588aa 100644 --- a/doc/numpybook/comparison/weave/inline.py +++ b/doc/numpybook/comparison/weave/inline.py @@ -24,11 +24,11 @@ def arr(a): for(i=1;i<Na[0]-1;i++) { for(j=1;j<Na[1]-1;j++) { B2(i,j) = A2(i,j) + A2(i-1,j)*0.5 + - A2(i+1,j)*0.5 + A2(i,j-1)*0.5 - + A2(i,j+1)*0.5 - + A2(i-1,j-1)*0.25 - + A2(i-1,j+1)*0.25 - + A2(i+1,j-1)*0.25 + A2(i+1,j)*0.5 + A2(i,j-1)*0.5 + + A2(i,j+1)*0.5 + + A2(i-1,j-1)*0.25 + + A2(i-1,j+1)*0.25 + + A2(i+1,j-1)*0.25 + A2(i+1,j+1)*0.25; } } |