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.

Run

python setup_fftpack.py install

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

Run

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)

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

dfftw_info: FOUND: libraries = ['drfftw', 'dfftw'] library_dirs = ['/path/to/lib'] define_macros = [('SCIPY_DFFTW_H', None)] include_dirs = ['/path/to/include'] djbfft_info: FOUND: 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.

Follow the instructions in

http://www.fftw.org/doc/fftw_6.html

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

Follow the installation instructions in

http://cr.yp.to/djbfft/install.html

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

Functions rfft and irfft accept and return only real sequences. So, the corresponding functions real_fft, inverse_real_fft from FFT are not equivalent with rfft and irfft. The difference is in the storage of data, see the definitions of corresponding functions for details.

PROPOSAL: When calling ifft with forced truncation or zero-padding then I would like to propose that the corresponding action is applied to the middle of data. For example, ifft([1,2,3,4,5,6],n=8) is equivalent to ifft([1,2,3,4,0,0,5,6]), that is, the Fourier terms with higher frequencies and zero coefficients are introduced. In the Numeric.FFT case, the example above would be equivalent to ifft([1,2,3,4,5,6,0,0],n=8), which would mean that Fourier coefficients [5,6] become the coefficients of higher frequency terms and the original terms are zerod.

Note that this proposal is

**not implemented**because it needs to be discussed. For instance, Matlab uses the same convention as FFT and this change would be confusing for Matlab users. On the other hand, FFT or Matlab's conventions change the spectrum of the original signal and I don't see any sense in this behaviour (if you don't agree then please provide an example). Namely, one of the applications of the argument n would be to compose a new signal with a more dense or sparse grid than the original one by usingnew_signal = ifft(fft(signal),n)

Note that the new_signal would have the same Fourier spectrum as original signal. With Matlab/FFT convention this is not true. Any thoughts?

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.

- basic.py
- Optimize
`fftn()`for real input. - Implement
`rfftn()`and`irfftn()`. - Implement discrete cosine/sine transforms

- Optimize
- pseudo_diffs.py
- Optimize functions for complex input.

- src/convolve.c
- See if convolve could use convolution function from DJBFFT.

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