Get fftw++ at SourceForge.net. Fast, secure and Free Open Source software downloads

FFTW++: Fast Fourier Transform C++ Header/MPI Transpose for FFTW3


FFTW++ is a C++ header/MPI transpose for Version 3 of the highly optimized FFTW Fourier Transform library. Version 3.02 of FFTW++ is now available for download. See recent download statistics.

FFTW++ provides a simple interface for 1D, 2D, and 3D complex-to-complex, real-to-complex, and complex-to-real Fast Fourier Transforms that takes care of the technical aspects of memory allocation, alignment, planning, wisdom, and communication on both serial and parallel (OpenMP/MPI) architectures. Wrappers for multiple 1D transforms are also provided. As with the FFTW3 library, in-place and out-of-place multithreaded transforms of arbitrary size are supported.

Hybrid dealiasing of standard and centered Hermitian convolutions is also implemented: in 2D and 3D implicit zero-padding substantially reduces memory usage and computation time. See Efficient Dealiased Convolutions without Padding by John C. Bowman and Malcolm Roberts, SIAM Journal on Scientific Computing, 33:1, 386-406 (2011), Multithreaded Implicitly Dealiased Convolutions by Malcolm Roberts and John C. Bowman, Journal of Computational Physics 356, 98-114 (2017), and Hybrid Dealiasing of Complex Convolutions, by Noel Murasko and John C. Bowman, SIAM Journal on Scientific Computing (2024), in press.

On distributed memory architectures, FFTW++ relies on the adaptive OpenMP/MPI transpose routine described in Adaptive Matrix Transpose Algorithms for Distributed Multicore Processors, John C. Bowman and Malcolm Roberts, Interdisciplinary Topics in Applied Mathematics, Modeling and Computational Science, Springer Proceedings in Mathematics & Statistics 117, 97-103 (2015).

Convenient optional shift routines that place the Fourier origin in the logical center of the domain are provided for centered complex-to-real transforms in 2D and 3D; see fftw++.h for details.

FFTW++ can also exploit the high-performance Array class (version 1.58 or higher), designed for scientific computing. The arrays in that package do memory bounds checking in debugging mode, but can be optimized by specifying the -DNDEBUG compilation option (1D arrays optimize completely to pointer operations).

FFTW++ includes interfaces and examples for calling FFTW++ from C++, C, Python, and Fortran.

Detailed documentation is provided before each class in the fftw++.h header file. The included examples illustrate how easy it is to use FFTW in C++ with the FFTW++ header class. Use of the Array class is optional, but encouraged. If for some reason the Array class is not used, memory should be allocated with ComplexAlign (or doubleAlign) to ensure that the data is optimally aligned to sizeof(Complex), to enable the SIMD extensions. The optional alignment check in fftw++.h can be disabled with the -DNO_CHECK_ALIGN compiler option.

Examples using ComplexAlign allocator:

1D complex 1D real-to-complex

Examples using Array class:

1D complex 1D real-to-complex

2D complex 2D real-to-complex

3D complex 3D real-to-complex

Hybrid dealiased convolutions:

1D complex convolution example
1D Hermitian convolution example
1D real convolution example

2D complex convolution example
2D Hermitian convolution example
2D real convolution example

3D complex convolution example
3D Hermitian convolution example
3D real convolution example


  • High-performance multi-dimensional C++ Array class (as fast as Fortran)
  • The latest git developmental source code for fftw++ is available from https://github.com/dealias/fftwpp
  • All source files in the FFTW++ project, unless explicitly noted otherwise, are released under version 3 (or later) of the GNU Lesser General Public License (see the files LICENSE.LESSER and LICENSE in the top-level source directory).