9. Using this Software with the FFTW Libraries.

The contents of the header file "vm_fftw.h" provide two wrapper classes for using the FFTW one-dimensional Fourier transforms with the Vector<T> classes. These classes serve only as wrappers, and should incur no performance penalty over directly using the functions.

The FFTWPlan class can also take care of conversion from the std::complex<T> classes to the fftw_complex structure. This is done by explicitely casting the pointers to the vector data to type fftw_complex *. As long as the same storage scheme is used for both the fftw_complex structure, and the std::complex<fftw_real> class, this should work. This means that your implementation of the std::complex template classes must contain only two data members, and the real part must be listed first, followed by the imaginary part. If this storage scheme is not used, this will not work.

The advantage of using these conversions is to both allow you to make use of the extensive built in functionality of the complex template classes, and to allow full usage of vectors composed of these types. You can also call the FFTWPlan routines with vectors of fftw_complex values, if the above conversions do not work on your implememntation.

The documentation lists the fourier() and ifourier() member functions as taking arguments of types Vec_REAL for the real transforms, and Vec_CPLX_REAL or Vec_FFTW_CPLX for the complex transforms. These types depend on whether you have compiled the FFTW for single or double precision. The VecMat software will automatically expect the same precision that FFTW was compiled for. That means that if the libraries were compiled for single precision, then the types Vec_REAL and Vec_CPLX_REAL will be synonyms for Vec_SP and Vec_CPLX_SP, respectively. If it is complied for double precision, then they will be synonyms for Vec_DP and Vec_CPLX_DP. Vec_FFTW_CPLX is a synonym for Vector<fftw_complex>.

Note that these classes only provide access to a small subset of the functionality of the FFTW software. I hope to add more functionality in the future. For specific information on how the FFTW software works, see the online documentation on their website: http://www.fftw.org.

Next Section

Back to Index