This C++ code does radix 2 and 3 multi-dimension (any) complex FFT and its inverse. Array dimensions with sizes that are not 2^m 3^n are automatically zero-padded to the nearest larger size integer of the form 2^m 3^n. The new array has the original data centered, except when a dimension size is increased by an odd number, the zero padding on the left is one less than the zero padding on the right. This code is entirely in the RADIX2AND3FFT_NS namespace and is entirely in the two files radix2and3fft.cpp and radix2and3fft.h. These two files contain all that is needed. There is a separate test program implemented in the two files test_radix2and3fft.cpp and test_radix2and3fft.h. There are five bash .sh build scripts. These build scripts either build everything together or build just the static library or dynamic link library, or build the test program either statically or dynamically linked. STL libraries such as std::complex, std::vector, and std::string are used.

Features

  • The FFT is mixed radix 2 and 3, multi-dimension, and complex with double precision
  • The code is entirely C++ with one .cpp file and one .h file
  • The code can easily be included in other C++ projects
  • There is a C++ test program which in Unix uses gnuplot to plot curves and surfaces In particular, it first displays a 2D line plot or a 3D surface plot of the original data, then computes and displays the the FFT, then computes and displays the IFFT of the FFT, which is the same as the original plot or image.
  • In the test program, gnuplot is used by first writing the data text file and the script text file and then doing system(unix command line). The script text file has a plot or splot command. The unix command line is "gnuplot quoted_script_filename".
  • Although the C++ test program is Unix only, the FFT source code is not and can be used on any platform. The test program is in a .cpp file and a .h file and the FFT source code is in another .cpp file and another .h file. Everything for the FFT is in its own namespace. The testing code is completely separate from the FFT code. The FFT code can be made into a library.
  • There is a C++ Complex Calculator (c-complex-calculator) SourceForge project that makes it easy to use this FFT,.
  • This C++ Complex Calculator has been used for verification of this FFT.. The continuous Fourier transform should agree with the FFT in the limit of large numbers of points over a range much larger than the function span. This requires the function to be centered with wrap around on the element with zero subscript. This shouldn't be done if there is to be zero padding.
  • A real symmetric function centered on the center element will result in the FFT being real but to have alternating signs between adjacent elements.

Project Samples

Project Activity

See All Activity >

Follow C++ FFT

C++ FFT Web Site

Other Useful Business Software
Our Free Plans just got better! | Auth0 Icon
Our Free Plans just got better! | Auth0

With up to 25k MAUs and unlimited Okta connections, our Free Plan lets you focus on what you do best—building great apps.

You asked, we delivered! Auth0 is excited to expand our Free and Paid plans to include more options so you can focus on building, deploying, and scaling applications without having to worry about your security. Auth0 now, thank yourself later.
Try free now
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of C++ FFT!

Additional Project Details

Registered

2025-06-02