Boost logo

Boost :

Subject: Re: [boost] Request to contribute boost::FFT
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2013-05-29 05:38:45


On 29/05/13 00:12, Nathan Bliss wrote:
> Dear Boost Community Members,
> I am writing to ask if I could contribute a C++ FFT implementation to the boost library. I noticed that there is a boost::CRC so I thought it would be a good addition to have boost::FFT as well. MIT have an existing open-source FFTW library, but it is GPL-licensed which is much more restrictive than the Boost license. I should imagine a commercial FFTW license would be very expensive.
> I have working FFT code which I have tested on Ubuntu Linux GNU gcc and also Visual Studio Express 2012 (MS VC++) for Windows. My code, when run as a 2048-point FFT, agrees with the MIT FFTW one to a max error margin of 6 parts per million.
> It is implemented using templates in a .hpp file and is very easy to use:
> ------------------------------------------------------------------------------------------------------------[fft.hpp]
> template<class FLOAT_TYPE, int FFT_SIZE, int NUM_THREADS>class FFT;///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[Invocation example]
> typedef double My_type;FFT<My_type, 2048, 4> user_fft;user_fft.initialise_FFT();get_input_samples(*user_fft.input_value_array, user_fft.m_fft_size);user_fft.execute_FFT();print_output_csv(user_fft.output_value_array, 2048);------------------------------------------------------------------------------------------------------------
> It's uniqueness compared to other FFT implementations is that it fully utilises the boost::thread library, to the extent that the user can give the number of threads they want to use as a parameter to the class template (above case is for 4 parallel threads).
> It is structured and organised so that users could customise/optimise it to specific processor architectures.
> I've also tried to develop it in the spirit of Boost in that all class members which users should not access are private, only making public what is necessary to the API. My code is a decimation-in-time radix-2 FFT, and users could in theory use the existing API as a basis to extend it to more complex implementations such as the Reverse/Inverse FFT, bit-reversal of inputs/outputs and multi-dimensional FFTs.
> I look forward to your reply.
> Kind regards,Nathan Bliss

You may want to give a look to the FFT functions bundled with NT2
courtesy of Domagoj Saric.

They also generate a FFT for a given compile-time size and use
Boost.SIMD for vectorization (but no threads). Unfortunately the code is
not so generic that it can work with arbitrary vector sizes, so it
limits portability somewhat.

<https://github.com/MetaScale/nt2/blob/master/modules/core/signal/include/nt2/signal/static_fft.hpp>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk