Need a break? Support the development by playing Polarity Puzzles

See more details about the FourierTransform in the API

Fast Fourier transform

The FourierTransform can calculate the one-, two- and three-dimensional Fourier transform. This is a wrapper class for the FFTW3 library, which implements an optimized version of the fast Fourier transform (FFT).

Basic interface

The three-dimensional Fourier transform and inverse Fourier transform can be calculated using

FourierTransform::forward(in, out, {SIZE_X, SIZE_Y, SIZE_Z});
FourierTransform::inverse(in, out, {SIZE_X, SIZE_Y, SIZE_Z});

Here in and out are c-arrays of type std::complex<double> with size \(SIZE\_X\times SIZE\_Y\times SIZE\_Z\). The normalization factor for each call is \(\sqrt{SIZE\_X\times SIZE\_Y\times SIZE\_Z}\). The transform for other dimensions is done by supplying a different number of size arguments.

Advanced interface

When executing multiple similar transforms, it is possible to avoid some overhead by using the advanced interface. This is done by first setting up a plan.

FourierTransform::ForwardPlan<complex<double>> plan(

Plans for different dimensionality are obtained by supplying a different number of size arguments. A corresponding plan for the inverse transform can be created by replacing ForwardPlan by InversePlan.

It is also possible to specify a custom normalization factor. If the value is set to 1, the calculation will be avoided completely.


By refilling in with new data between each call, multiple transforms can now be calculated using


Next: Array