queso-0.57.1
|
Class for a Fast Fourier Transform (FFT) algorithm. More...
#include <Fft.h>
Public Member Functions | |
template<> | |
void | forward (const std::vector< std::complex< double > > &data, unsigned int fftSize, std::vector< std::complex< double > > &forwardResult) |
template<> | |
void | inverse (const std::vector< std::complex< double > > &data, unsigned int fftSize, std::vector< std::complex< double > > &inverseResult) |
template<> | |
void | forward (const std::vector< double > &data, unsigned int fftSize, std::vector< std::complex< double > > &forwardResult) |
template<> | |
void | inverse (const std::vector< double > &data, unsigned int fftSize, std::vector< std::complex< double > > &inverseResult) |
Constructor/Destructor methods | |
Fft (const BaseEnvironment &env) | |
Default Constructor. More... | |
~Fft () | |
Destructor. More... | |
Mathematical methods | |
void | forward (const std::vector< T > &data, unsigned int fftSize, std::vector< std::complex< double > > &result) |
Calculates the forward Fourier transform (for real data. TODO: complex data). More... | |
void | inverse (const std::vector< T > &data, unsigned int fftSize, std::vector< std::complex< double > > &result) |
Calculates the inverse Fourier transform for real and complex data. More... | |
Private Attributes | |
const BaseEnvironment & | m_env |
Class for a Fast Fourier Transform (FFT) algorithm.
This class implements a Fast Fourier Transform (FFT) algorithm. Fast Fourier Transforms are efficient algorithms for calculating the discrete Fourier transform (DFT),
\[ x_j = \sum_{k=0}^{N-1} z_k \exp(-2\pi i j k / N) \]
and its inverse. The DFT usually arises as an approximation to the continuous Fourier transform when functions are sampled at discrete intervals in space or time. The naive evaluation of the discrete Fourier transform is a matrix-vector multiplication \( Ab \). A general matrix-vector multiplication takes \( O(N^2)\) operations for \( N \) data-points. Fast Fourier transform algorithms use a divide-and-conquer strategy to factorize the matrix \( A \) into smaller sub-matrices, corresponding to the integer factors of the length \( N \). If \( N \) can be factorized into a product of integers \( f_1 f_2 ... f_n \) then the DFT can be computed in \( O(N \sum f_i) \) operations. For a radix-2 FFT this gives an operation count of \( O(N \log_2 N)\).
QUESO::Fft< T >::Fft | ( | const BaseEnvironment & | env | ) |
Default Constructor.
QUESO::Fft< T >::~Fft | ( | ) |
void QUESO::Fft< std::complex< double > >::forward | ( | const std::vector< std::complex< double > > & | data, |
unsigned int | fftSize, | ||
std::vector< std::complex< double > > & | forwardResult | ||
) |
Definition at line 32 of file ComplexFft.C.
void QUESO::Fft< double >::forward | ( | const std::vector< double > & | data, |
unsigned int | fftSize, | ||
std::vector< std::complex< double > > & | forwardResult | ||
) |
void QUESO::Fft< T >::forward | ( | const std::vector< T > & | data, |
unsigned int | fftSize, | ||
std::vector< std::complex< double > > & | result | ||
) |
Calculates the forward Fourier transform (for real data. TODO: complex data).
This function uses GSL function 'gsl_fft_real_transform' to compute the FFT of data
, a real array (of time-ordered real data) of length fftSize
, using a mixed radix decimation-in-frequency algorithm. There is no restriction on the length fftSize
. Efficient modules are provided for subtransforms of length 2, 3, 4 and 5. Any remaining factors are computed with a slow, \( O(\c fftSize ^2) \), general- fftSize
module. The caller must supply a wavetable containing trigonometric lookup tables and a workspace work.
The definition of the forward Fourier transform, \( x = FFT(z) \) of size \( N \) is:
\[ x_j = \sum_{k=0}^{N-1} z_k \exp(-2\pi i j k / N). \]
Referenced by QUESO::ScalarSequence< T >::autoCorrViaFft(), and QUESO::ScalarSequence< T >::psd().
void QUESO::Fft< std::complex< double > >::inverse | ( | const std::vector< std::complex< double > > & | data, |
unsigned int | fftSize, | ||
std::vector< std::complex< double > > & | inverseResult | ||
) |
Definition at line 94 of file ComplexFft.C.
void QUESO::Fft< double >::inverse | ( | const std::vector< double > & | data, |
unsigned int | fftSize, | ||
std::vector< std::complex< double > > & | inverseResult | ||
) |
void QUESO::Fft< T >::inverse | ( | const std::vector< T > & | data, |
unsigned int | fftSize, | ||
std::vector< std::complex< double > > & | result | ||
) |
Calculates the inverse Fourier transform for real and complex data.
This function uses GSL function 'gsl_fft_complex_inverse' to compute the FFT of data
, a real array (of time-ordered real data) of length fftSize
, using a mixed radix decimation-in-frequency algorithm. There is no restriction on the length fftSize
. Efficient modules are provided for subtransforms of length 2, 3, 4 and 5. Any remaining factors are computed with a slow, \( O(fftSize^2) \), general- fftSize
module. The caller must supply a wavetable containing trigonometric lookup tables and a workspace work.
The definition of the inverse Fourier transform, \( x = IFFT(z)\) of size \( N \) is:
\[ z_j = {1 \over N} \sum_{k=0}^{N-1} x_k \exp(2\pi i j k / N).\]
The factor of \( 1/N \) makes this a true inverse.
Referenced by QUESO::ScalarSequence< T >::autoCorrViaFft(), and QUESO::BaseVectorSequence< V, M >::computeBMM().
|
private |