|
| FourierTransform () |
| constructor More...
|
|
virtual | ~FourierTransform () |
| destructor More...
|
|
void | FFT_Real2Complex (MArray< T, N > &A, MArray< complex< T >, N > &FFT_A) |
| Real to complex (forward) fourier transform. Plan and execute the transform. Output array is not normalized. More...
|
|
void | FFT_Complex2Real (MArray< complex< T >, N > &FFT_A, MArray< T, N > &A) |
| Complex to real (inverse) fourier transform. Plan and execute the transform. Output array is not normalized. More...
|
|
void | reset () |
| dispose plan and call fftw_cleanup() . More...
|
|
|
void | FFT (MArray< complex< T >, N > &A, MArray< complex< T >, N > &FFT_A) |
| Forward and inverse fourier transform. Plan and execute the transform. Output array is not normalized. More...
|
|
void | iFFT (MArray< complex< T >, N > &FFT_A, MArray< complex< T >, N > &A) |
|
|
void | normalize (MArray< complex< T >, N > &A) |
| normalize the array by dividing by the number of elements. More...
|
|
void | normalize (MArray< T, N > &A) |
|
|
MArray< T, N > | shiftDC (MArray< T, N > &A) |
| shift DC component to center of MArray . More...
|
|
MArray< complex< T >, N > | shiftDC (MArray< complex< T >, N > &A) |
|
template<typename T, int N>
class ltl::FourierTransform< T, N >
FourierTransform class
Interface to fftw3 FFT library. Currently, each call to one of the FFT methods causes a new plan to be generated. This is highly inefficient, but safe. It guarantees that pointers to the data strorage of MArray
do not escape by being stored in a plan that might survive the MArray
object.
All transforms leave the output array un-normalized. To normalize (divide by number of elements) call normalize()
.
* #include <ltl/fftw.h>
*
*
* MArray<double, 1> in(size);
* MArray<std::complex<double>, 1> out(size);
* FourierTransform<double,1>
FFT;
*
* in = 10.0 +
* 20.0 * sin(
indexPosDbl(in,1) /
double(size) * 2.0 * M_PI * 3.0) +
* 30.0 * cos(
indexPosDbl(in,1) /
double(size) * 2.0 * M_PI * 4.0);
* FFT.FFT_Real2Complex(in,out);
* FFT.normalize(out);
* out = merge(real(out * conj(out)) > 1e-9, out, 0);
* std::cout << out << std::endl;
*