#include <FourierTransform.h>
Public Types | |
typedef std::vector < std::complex< double > >::size_type | size_type |
typedef std::vector < std::complex< double > >::iterator | iterator |
The type of a non-const iterator of (complex) transform samples. | |
typedef std::vector < std::complex< double > >::const_iterator | const_iterator |
The type of a const iterator of (complex) transform samples. | |
Public Member Functions | |
FourierTransform (size_type len) | |
FourierTransform (const FourierTransform &rhs) | |
~FourierTransform (void) | |
Free the resources associated with this FourierTransform. | |
FourierTransform & | operator= (const FourierTransform &rhs) |
std::complex< double > & | operator[] (size_type index) |
const std::complex< double > & | operator[] (size_type index) const |
iterator | begin (void) |
iterator | end (void) |
const_iterator | begin (void) const |
const_iterator | end (void) const |
void | transform (void) |
size_type | size (void) const |
FourierTransform provides a simplified interface to the FFTW library (www.fftw.org). Loris uses the FFTW library to perform efficient Fourier transforms of arbitrary length. Clients store and access the in-place transform data as a sequence of std::complex< double >. Samples are stored in the FourierTransform instance using subscript or iterator access, the transform is computed by the transform member, and the transformed samples replace the input samples, and are accessed by subscript or iterator. FourierTransform computes a complex transform, so it can be used to invert a transform of real samples as well. Uses the standard library complex class, which implements arithmetic operations.
Supports FFTW versions 2 and 3. Does not make use of FFTW "wisdom" to speed up transform computation.
If FFTW is unavailable, uses instead the General Purpose FFT package by Takuya OOURA, http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html defined in fftsg.c for power-of-two transforms, and a very slow direct DFT implementation for non-PO2 transforms.
typedef std::vector< std::complex< double > >::size_type Loris::FourierTransform::size_type |
An unsigned integral type large enough to represent the length of any transform.
Loris::FourierTransform::FourierTransform | ( | size_type | len | ) |
Initialize a new FourierTransform of the specified size.
len | is the length of the transform in samples (the number of samples in the transform) |
RuntimeError | if the necessary buffers cannot be allocated, or there is an error configuring FFTW. |
Loris::FourierTransform::FourierTransform | ( | const FourierTransform & | rhs | ) |
Initialize a new FourierTransform that is a copy of another, having the same size and the same buffer contents.
rhs | is the instance to copy |
RuntimeError | if the necessary buffers cannot be allocated, or there is an error configuring FFTW. |
const_iterator Loris::FourierTransform::begin | ( | void | ) | const [inline] |
Return a const iterator refering to the beginning of the sequence of complex samples in the transform buffer.
iterator Loris::FourierTransform::begin | ( | void | ) | [inline] |
Return an iterator refering to the beginning of the sequence of complex samples in the transform buffer.
const_iterator Loris::FourierTransform::end | ( | void | ) | const [inline] |
Return a const iterator refering to the end of the sequence of complex samples in the transform buffer.
iterator Loris::FourierTransform::end | ( | void | ) | [inline] |
Return an iterator refering to the end of the sequence of complex samples in the transform buffer.
FourierTransform& Loris::FourierTransform::operator= | ( | const FourierTransform & | rhs | ) |
Make this FourierTransform a copy of another, having the same size and buffer contents.
rhs | is the instance to copy |
RuntimeError | if the necessary buffers cannot be allocated, or there is an error configuring FFTW. |
const std::complex< double >& Loris::FourierTransform::operator[] | ( | size_type | index | ) | const [inline] |
Access (read-only) a transform sample by index. Use this member to fill the transform buffer before computing the transform, and to access the samples after computing the transform. (inlined for speed)
index | is the index or rank of the complex transform sample to access. Zero is the first position in the buffer. |
std::complex< double >& Loris::FourierTransform::operator[] | ( | size_type | index | ) | [inline] |
Access (read/write) a transform sample by index. Use this member to fill the transform buffer before computing the transform, and to access the samples after computing the transform. (inlined for speed)
index | is the index or rank of the complex transform sample to access. Zero is the first position in the buffer. |
size_type Loris::FourierTransform::size | ( | void | ) | const |
Return the length of the transform (in samples).
void Loris::FourierTransform::transform | ( | void | ) |
Compute the Fourier transform of the samples stored in the transform buffer. The samples stored in the transform buffer (accessed by index or by iterator) are replaced by the transformed samples, in-place.