Member Functions | ||
fourier() ifourier() |
operator=() order() |
setOrder() |
#include <rw/dfft.h> DoubleFFTServer dffts;
Class DoubleFFTServer performs double precision complex fast Fourier transforms (FFTs) of a real vector.
At any given moment, the server is configured to transform a real vector of a specified length. This length can be set one of three ways:
At construction time
With the function setOrder()
By the server from a supplied vector length.
If you use the last method, the server automatically reconfigures to the new length if the vector length changes. This is an expensive calculation. Hence, it is most efficient to call this method repeatedly for series of the same length. Different FFT servers may be constructed to handle different lengths.
The real vector must have an even number of points.
Let V(j), j=0, 1, ..., 2N-1 be a 2N point long real sequence. Its transform is a complex conjugate-even sequence, that is:
C(n) = conj[(C(-n)]
or:
C(n) = conj[C(2N-n)].
The function fourier() returns the lower half of this complex conjugate-even sequence, that is, C(n), n=0, ..., N. The upper half can be recovered from the relationship C(n) = conj[C(2N-n)]. Note that the returned complex conjugate-even sequence C(n) has N+1 complex points, or a total of 2N+2 numbers. The two extra numbers are the imaginary parts of C(0) and C(N), which are always 0.
The forward transform calculated is:
The inverse Fourier transform calculated is:
where V is real and C is complex. Note that only points C(n), n=0, ..., N should be given. Also note that the sum is not normalized; a call to fourier() followed by a call to ifourier() results in the original series multiplied by 2N.
DoubleFFTServer();
Constructs a double precision FFT server for a vector of unspecified length. This length is initialized when the server is used.
DoubleFFTServer(unsigned oforder);
Constructs a complex FFT server designed to transform a vector of length oforder.
DoubleFFTServer(const DoubleFFTServer&);
Copy constructor. The new server references the old server's data.
RWMathVec<DComplex> fourier(const RWMathVec<double>&);
Returns the FFT of a real vector of 2N points. The expression:
DoubleFFTServer f; RWMathVec<DComplex> v; cout << f.fourier(v);
prints the Fourier transform of v as a complex conjugate-even sequence of N+1 complex numbers.
RWMathVec<double> ifourier(const RWMathVec<DComplex>& v);
Returns the inverse FFT of a complex conjugate-even sequence of N+1 complex numbers as a real sequence of 2N points. The expression
DoubleFFTServer f; RWMathVec<DComplex> v; cout << f.ifourier(v);
prints the inverse Fourier transform of v as an RWMathVec<double> vector.
unsigned order() const;
Returns the order of an FFT server, that is, the vector length it is currently configured to transform.
void setOrder(unsigned N);
Resets the order of an FFT server to N.
void operator=(const DoubleFFTServer& v);
Sets self to the same order as v.
expandConjugateEven expandConjugateOdd expandEven expandOdd rootsOfOne
See the Global Function Reference for the function prototypes and descriptions of these functions.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.