[python-dtcwt] 15/497: abstract FFT implementation
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Tue Jul 21 18:05:44 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 b8dfa9d11f9c7040df74a8a8f6c73af4ac87baa7
Author: Rich Wareham <rjw57 at cam.ac.uk>
Date: Wed Aug 7 13:39:27 2013 +0100
abstract FFT implementation
---
dtcwt/lowlevel.py | 10 +++++++---
setup.py | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dtcwt/lowlevel.py b/dtcwt/lowlevel.py
index d52fa50..072672d 100644
--- a/dtcwt/lowlevel.py
+++ b/dtcwt/lowlevel.py
@@ -19,6 +19,10 @@ def _centered(arr, newsize):
myslice = [slice(startind[k], endind[k]) for k in range(len(endind))]
return arr[tuple(myslice)]
+# This is to allow easy replacement of these later with, possibly, GPU versions
+_rfft = np.fft.rfft
+_irfft = np.fft.irfft
+
def _column_convolve(X, h):
"""Convolve the columns of X with h returning only the 'valid' section,
i.e. those values unaffected by zero padding.
@@ -36,16 +40,16 @@ def _column_convolve(X, h):
fsize = 2 ** np.ceil(np.log2(full_size)).astype(int)
# Take FFT down columns
- Xfft = np.fft.rfft(X, n=fsize, axis=0)
+ Xfft = _rfft(X, n=fsize, axis=0)
# Take FFT of input vector
- hfft = np.fft.rfft(h, n=fsize)
+ hfft = _rfft(h, n=fsize, axis=0)
# Column-wise multiply. I.e. scale rows of Xfft by hfft
Xfft = Xfft * hfft[:,np.newaxis]
# Invert
- Xconv = np.fft.irfft(Xfft, n=fsize, axis=0)[:full_size,:].real
+ Xconv = _irfft(Xfft, n=fsize, axis=0)[:full_size,:].real
Xvalid = _centered(Xconv, (abs(X.shape[0] - h_size) + 1, X.shape[1]))
return Xvalid
diff --git a/setup.py b/setup.py
index 12f8abb..91da016 100644
--- a/setup.py
+++ b/setup.py
@@ -28,5 +28,5 @@ setup(
setup_requires=['nose>=1.0',],
- install_requires=['numpy','scipy',],
+ install_requires=['numpy','scipy','reikna',],
)
--
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