Nicolas Rougier | 11 Feb 11:52 2012

fftconvolve speedup / non powers of two


FFTW documentation ( 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).


Here is the code:

Attachment ( text/x-python-script, 2358 bytes
SciPy-Dev mailing list
SciPy-Dev <at>