[SciPy-Dev] fftconvolve speedup / non powers of two
Nicolas Rougier
Nicolas.Rougier at inria.fr
Sat Feb 11 05:52:21 EST 2012
Hi,
FFTW documentation (http://www.fftw.org/fftw2_doc/fftw_3.html) states that:
"FFTW is best at handling sizes of the form 2^a*3^b*5^c*7^d*11^e*13^f, where e+f is either 0 or 1."
But the code from fftconvolve is only using (internally) sizes that are power of two, is there a specific reason ?
I tried a naive implementation handling size of the above form and it seems to speedup things a bit:
In [1]: from fftconvolve import *
In [2]: %timeit fftconvolve(Z,K,'full')
10 loops, best of 3: 57.3 ms per loop
In [3]: %timeit fftconvolve2(Z,K,'full')
100 loops, best of 3: 13.2 ms per loop
This is for the worst case where the internal size is 257. fftconvolve uses a size of 512 while fftconvolve2 uses 260. For powers of two, it should not change performances (only the time to compute best fft shape that may be probably improved).
Nicolas
Here is the code:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fftconvolve.py
Type: text/x-python-script
Size: 2358 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20120211/91901516/attachment.bin>
More information about the SciPy-Dev
mailing list