Three fast Fourier transform (FFT) servers are included in the Math.h++ class library:
Class DComplexFFTServer transforms an RWMathVec<DComplex> vector into an RWMathVec<DComplex> and back;
Class DoubleFFTServer transforms a real RWMathVec<double> into a complex conjugate-even vector and back;
Class DComplexFFT2DServer transforms an RWGenMat<DComplex> matrix into an RWGenMat<DComplex> and back.
In addition, a fast sine/cosine transform server is included:
Class DoubleCosineServer can take the sine or cosine transform of a real RWMathVec<double> into a real RWMathVec<double> and back.
The only restriction on the length of a vector that can be transformed is that a real RWMathVec<double> must have an even number of points. In particular, vector lengths need not be a power of 2, although the transform is more efficient if they are1.
At any given moment, a server is configured to transform a vector of a specified length. The appropriate weights, which are actually the roots of one of the prime factors, are stored internally. This length can be set:
At construction time;
By using the member function setOrder(); or
Dynamically from a vector length, as shown in the following code:
// Will transform vectors 10 points long: DComplexFFTServer aserv(10); aserv.setOrder(20); // Now set for 20 points RWMathVec<DComplex> b(30, rwUninitialized); . . . // Forward FFT of b: RWMathVec<DComplex> btrans = aserv.fourier(b); //aserv would now be set for vectors 30 pts long.
Because reconfiguring for a new vector length is a relatively expensive process, if more than one vector length must be transformed within a program, it is better to build several servers rather than to keep reconfiguring one. This means it is possible to transform efficiently and conveniently more than one vector length within a stretch of code, something that is difficult to do with conventional Fortran-based FFT functions.
See the Class Reference for a description of the exact transforms that are calculated.
>©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.