[Numpy-discussion] FFTW bindings now implement numpy.fft interface

Neal Becker ndbecker2@gmail....
Sun Feb 17 11:38:24 CST 2013

Henry Gomersall wrote:

> Some of you may be interested in the latest release of my FFTW bindings.
> It can now serve as a drop in replacement* for numpy.fft and
> scipy.fftpack.
> This means you can get most of the speed-up of FFTW with a one line code
> change or monkey patch existing libraries.
> Lots of other goodness too of course.
> Source here: https://github.com/hgomersall/pyFFTW
> pypi here: http://pypi.python.org/pypi/pyFFTW
> docs here: http://hgomersall.github.com/pyFFTW/
> It's GPL3 due to license restrictions on FFTW. Get in touch if you want
> a different license and I'm sure we can reach an agreement ;)
> Cheers,
> Henry
> *In the case where the input array is not a numpy array, it doesn't
> work. This was an oversight and will be fixed in the next release. That
> said, if you're converting from a list on every transform, you have
> better optimisations than using FFTW. One other small caveat in a corner
> case to do with repeated axes - described in the docs.

The 1st example says:
>>> import pyfftw
>>> import numpy
>>> a = pyfftw.n_byte_align_empty(128, 16, 'complex128')
>>> a[:] = numpy.random.randn(128) + 1j*numpy.random.randn(128)
>>> b = pyfftw.interfaces.numpy_fft.fft(a)

I don't see why I need to specify the alignment.  The fftw library has a 
function to allocate aligned arrays that are allocated optimally.  Why doesn't 
pyfft.n_byte_align_empty just align things correctly without me having to tell 
it the alignment?

More information about the NumPy-Discussion mailing list