SourcePro C++ 12.0 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Performs double precision complex fast Fourier transforms (FFTs) of a real vector. More...
#include <rw/dfft.h>
Public Member Functions | |
DoubleFFTServer () | |
DoubleFFTServer (size_t oforder) | |
DoubleFFTServer (const DoubleFFTServer &) | |
void | operator= (const DoubleFFTServer &v) |
size_t | order () const |
void | setOrder (size_t N) |
RWMathVec< DComplex > | fourier (const RWMathVec< double > &v) |
RWMathVec< double > | ifourier (const RWMathVec< DComplex > &v) |
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:
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
.
#include <rw/dfft.h> DoubleFFTServer dffts;
DoubleFFTServer::DoubleFFTServer | ( | ) |
Constructs a double precision FFT server for a vector of unspecified length. This length is initialized when the server is used.
DoubleFFTServer::DoubleFFTServer | ( | size_t | oforder | ) |
Constructs a double precision FFT server designed to transform a vector of length oforder.
DoubleFFTServer::DoubleFFTServer | ( | const DoubleFFTServer & | ) |
Copy constructor. The new server references the old server's data.
Returns the FFT of a real vector of 2N
points. The expression:
DoubleFFTServer f; RWMathVec<DComplex> v; std::cout << f.fourier(v);
prints the Fourier transform of v as a complex conjugate-even sequence of N+1
complex numbers.
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; std::cout << f.fourier(v);
prints the inverse Fourier transform of v as an RWMathVec<double> vector.
Reimplemented from DComplexFFTServer.
void DoubleFFTServer::operator= | ( | const DoubleFFTServer & | v | ) |
Sets self to the same order as v.
size_t DoubleFFTServer::order | ( | ) | const [inline] |
Returns the order of an FFT server, that is, the vector length it is currently configured to transform.
Reimplemented from DComplexFFTServer.
Reimplemented in DoubleCosineServer.
void DoubleFFTServer::setOrder | ( | size_t | N | ) |
Resets the order of an FFT server to N.
Reimplemented from DComplexFFTServer.
Reimplemented in DoubleCosineServer.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.