[python-dtcwt] 147/497: opencl: fix coldfilt when given 2d vector filters

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/sid
in repository python-dtcwt.

commit 485b887cb518da1713a804c28e264fb43bff922c
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date:   Thu Nov 7 13:47:36 2013 +0000

    opencl: fix coldfilt when given 2d vector filters
    
    The np.dot call complains about the vectors being mis-aligned. Use the
    flat iterator to fix this.
---
 dtcwt/opencl/lowlevel.py    | 2 +-
 tests/testopenclcoldfilt.py | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dtcwt/opencl/lowlevel.py b/dtcwt/opencl/lowlevel.py
index 59bad0a..0ed155e 100644
--- a/dtcwt/opencl/lowlevel.py
+++ b/dtcwt/opencl/lowlevel.py
@@ -301,7 +301,7 @@ def axis_convolve_dfilter(X, h, axis=0, queue=None, output=None):
         output_shape[axis] >>= 1
         output = cl_array.zeros(queue, output_shape, np.float32)
 
-    flip_output = np.dot(h, h[::-1]) > 0
+    flip_output = np.dot(h.flat, h.flat[::-1]) > 0
 
     return _apply_kernel(X, h, kern, output, axis=axis, elementstep=2, extra_kernel_args=[np.int32(flip_output),])
 
diff --git a/tests/testopenclcoldfilt.py b/tests/testopenclcoldfilt.py
index c60764e..a4d0a73 100644
--- a/tests/testopenclcoldfilt.py
+++ b/tests/testopenclcoldfilt.py
@@ -3,6 +3,7 @@ import os
 import numpy as np
 from dtcwt.lowlevel import coldfilt as coldfilt_gold
 from dtcwt.opencl.lowlevel import coldfilt
+from dtcwt.coeffs import biort, qshift
 
 from nose.tools import raises
 
@@ -30,6 +31,12 @@ def test_different_size():
 def test_bad_input_size():
     coldfilt(lena[:511,:], (-1,1), (1,-1))
 
+def test_real_wavelet():
+    h0a, h0b, g0a, g0b, h1a, h1b, g1a, g1b = qshift('qshift_d')
+    A = coldfilt(lena[:,:511], h1b, h1a)
+    B = coldfilt_gold(lena[:,:511], h1b, h1a)
+    assert_almost_equal(A, B)
+
 def test_good_input_size():
     A = coldfilt(lena[:,:511], (-1,1), (1,-1))
     B = coldfilt_gold(lena[:,:511], (-1,1), (1,-1))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-dtcwt.git



More information about the debian-science-commits mailing list