fftpack - Discrete Fourier Transform package

Author: Pearu Peterson <pearu@cens.ioc.ee>
Last changed:2004-01-04
Revision: 1.32
Discussions to:scipy-dev@scipy.org


To build fftpack, you'll need F2PY version 2.23.190-1367 or higher.


python setup_fftpack.py install


To test fftpack, you'll need scipy_test package installed (this is provided by scipy_core package).


python tests/test_basic.py 10
python tests/test_pseudo_diffs.py 10
python tests/test_helper.py 10

or from python

>>> import fftpack
>>> fftpack.test(10)

Building with high-performance FFT libraries

fftpack uses optimal combination of FFT libraries for different jobs. Currently, Fortran FFTPACK, FFTW, and DJBFFT libraries are supported. The last two are optional and used only if scipy_core/scipy_distutils/system_info.py detects them. If they are available, then the output of

python scipy_core/scipy_distutils/system_info.py

should show, for example

    libraries = ['drfftw', 'dfftw']
    library_dirs = ['/path/to/lib']
    define_macros = [('SCIPY_DFFTW_H', None)]
    include_dirs = ['/path/to/include']

    extra_objects = ['/path/to/lib/djbfft.a']
    define_macros = [('SCIPY_DJBFFT_H', None)]
    include_dirs = ['/path/to/include']

Note that when using fftw libraries provided by a Linux distribution then fftw-dev (or fftw-devel or similar) must be installed as well, otherwise system_info.py won't detect fftw libraries.

DJBFFT library is fastest for power-of-two (<=8192) Fourier transforms. FFTW is superior for non-power-of-two transforms and multi-dimensional transforms.

Building notes for FFTW

Follow the instructions in


Note that fftpack uses double-precision FFTW. So, if you build libfftw.a, then it is assumed that it contains double-precision code.

Building notes for DJBFFT

Follow the installation instructions in


If djbfft is installed under these instructions then scipy_distutils picks up it for fftpack automatically.

Differences between fftpack and FFT from Numeric

Nyquist mode

Pseudo-differential and differential operators of odd order assume that the Nyquist mode is zero that reduces the amplification of numerical noise from the aliasing effect.

To do

  • Optimize fftn() for real input.
  • Implement rfftn() and irfftn().
  • Implement discrete cosine/sine transforms
  • Optimize functions for complex input.
  • See if convolve could use convolution function from DJBFFT.

If you have any comments, please send them to scipy-dev@scipy.org.