[python-dtcwt] 09/497: remove non-optimisations for Python
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:42 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 e7e36fe2c70257d1753ceae87ed199f682521736
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Tue Aug 6 16:57:40 2013 +0100
remove non-optimisations for Python
---
dtcwt/lowlevel.py | 15 ++++++---------
dtcwt/transform2d.py | 19 +++++++++----------
2 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/dtcwt/lowlevel.py b/dtcwt/lowlevel.py
index baba922..6dde05b 100644
--- a/dtcwt/lowlevel.py
+++ b/dtcwt/lowlevel.py
@@ -54,16 +54,13 @@ def colfilter(X, h):
m = h.shape[0]
m2 = np.fix(m*0.5)
- if np.any(np.nonzero(X[:])[0]):
- # Symmetrically extend with repeat of end samples.
- # Use 'reflect' so r < m2 works OK.
- xe = reflect(np.arange(-m2, r+m2, dtype=np.int), -0.5, r-0.5)
+ # Symmetrically extend with repeat of end samples.
+ # Use 'reflect' so r < m2 works OK.
+ xe = reflect(np.arange(-m2, r+m2, dtype=np.int), -0.5, r-0.5)
- # Perform filtering on the columns of the extended matrix X(xe,:), keeping
- # only the 'valid' output samples, so Y is the same size as X if m is odd.
- Y = convolve2d(X[xe,:], h, 'valid')
- else:
- Y = np.zeros((r+1-(m%2), c))
+ # Perform filtering on the columns of the extended matrix X(xe,:), keeping
+ # only the 'valid' output samples, so Y is the same size as X if m is odd.
+ Y = convolve2d(X[xe,:], h, 'valid')
return Y
diff --git a/dtcwt/transform2d.py b/dtcwt/transform2d.py
index fdc5673..4b706d9 100644
--- a/dtcwt/transform2d.py
+++ b/dtcwt/transform2d.py
@@ -315,16 +315,15 @@ def c2q(w,gain):
sw = w.shape
x = np.zeros((w.shape[0]*2, w.shape[1]*2))
- if np.any(w[:] != 0) and np.any(gain[:] != 0):
- sc = np.sqrt(0.5) * gain
- P = w[:,:,0]*sc[0] + w[:,:,1]*sc[1]
- Q = w[:,:,0]*sc[0] - w[:,:,1]*sc[1]
-
- # Recover each of the 4 corners of the quads.
- x[0::2, 0::2] = np.real(P) # a = (A+C)*sc
- x[0::2, 1::2] = np.imag(P) # b = (B+D)*sc
- x[1::2, 0::2] = np.imag(Q) # c = (B-D)*sc
- x[1::2, 1::2] = -np.real(Q) # d = (C-A)*sc
+ sc = np.sqrt(0.5) * gain
+ P = w[:,:,0]*sc[0] + w[:,:,1]*sc[1]
+ Q = w[:,:,0]*sc[0] - w[:,:,1]*sc[1]
+
+ # Recover each of the 4 corners of the quads.
+ x[0::2, 0::2] = np.real(P) # a = (A+C)*sc
+ x[0::2, 1::2] = np.imag(P) # b = (B+D)*sc
+ x[1::2, 0::2] = np.imag(Q) # c = (B-D)*sc
+ x[1::2, 1::2] = -np.real(Q) # d = (C-A)*sc
return x
--
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