ltl::FourierTransform< T, N > Class Template Reference
[FFTW3 interface for MArrays]
List of all members.
Public Member Functions
- FourierTransform ()
- constructor
- virtual ~FourierTransform ()
- destructor
- 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.
- 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.
- void reset ()
- dispose plan and call
fftw_cleanup()
.
|
|
- 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.
- 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.
- void normalize (MArray< T, N > &A)
- MArray< T, N > shiftDC (MArray< T, N > &A)
- shift DC component to center of
MArray
.
- MArray< complex< T >, N > shiftDC (MArray< complex< T >, N > &A)
Protected Member Functions
Protected Attributes
Detailed Description
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;
Constructor & Destructor Documentation
template<typename T , int N>
template<typename T , int N>
Member Function Documentation
template<typename T , int N>
Forward and inverse fourier transform. Plan and execute the transform. Output array is not normalized.
template<typename T , int N>
template<typename T , int N>
Real to complex (forward) fourier transform. Plan and execute the transform. Output array is not normalized.
template<typename T , int N>
Complex to real (inverse) fourier transform. Plan and execute the transform. Output array is not normalized.
template<typename T , int N>
normalize the array by dividing by the number of elements.
template<typename T , int N>
template<typename T , int N>
shift DC component to center of MArray
.
template<typename T , int N>
template<typename T , int N>
template<typename T , int N>
Member Data Documentation
template<typename T , int N>
template<typename T , int N>