GammaLib
2.1.0.dev
|
Lookup table class for Fast Fourier Transformation. More...
#include <GFftWavetable.hpp>
Public Member Functions | |
GFftWavetable (void) | |
Void constructor. More... | |
GFftWavetable (const int &size) | |
Wave table constructor. More... | |
GFftWavetable (const GFftWavetable &wavetable) | |
Copy constructor. More... | |
virtual | ~GFftWavetable (void) |
Destructor. More... | |
GFftWavetable & | operator= (const GFftWavetable &wavetable) |
Assignment operator. More... | |
std::complex< double > & | operator[] (const int &index) |
Return reference to trigonometric coefficient. More... | |
const std::complex< double > & | operator[] (const int &index) const |
Return reference to trigonometric coefficient (const version) More... | |
void | clear (void) |
Clear lookup table for Fast Fourier Transform. More... | |
GFftWavetable * | clone (void) const |
Clone lookup table for Fast Fourier Transform. More... | |
std::string | classname (void) const |
Return class name. More... | |
int | size (void) const |
Return number of trigonometric coefficients. More... | |
const int & | index (const int &factor) const |
Return start index for a given factor. More... | |
int | factors (void) const |
Return number of factorisation factors. More... | |
int | factor (const int &index) const |
Return factorisation factor. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print lookup table for Fast Fourier Transform information. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GFftWavetable &wavetable) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | set_members (const int &n) |
Set wavetable. More... | |
void | set_factors (const int &n) |
Compute FFT factorisation. More... | |
Protected Attributes | |
std::vector< int > | m_factors |
Wavetable factors. More... | |
std::vector< int > | m_twiddle |
Start index of factors. More... | |
std::vector< std::complex < double > > | m_trig |
Trigonometric coefficients. More... | |
Lookup table class for Fast Fourier Transformation.
Definition at line 44 of file GFftWavetable.hpp.
GFftWavetable::GFftWavetable | ( | void | ) |
Void constructor.
Definition at line 52 of file GFftWavetable.cpp.
References init_members().
Referenced by clone().
|
explicit |
Wave table constructor.
[in] | size | Array size. |
Constructs the lookup table for Fast Fourier Transformation for a given array size
.
Definition at line 70 of file GFftWavetable.cpp.
References init_members(), and set_members().
GFftWavetable::GFftWavetable | ( | const GFftWavetable & | wavetable | ) |
Copy constructor.
[in] | wavetable | Lookup table for Fast Fourier Transform. |
Definition at line 88 of file GFftWavetable.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 89 of file GFftWavetable.hpp.
|
virtual |
Clear lookup table for Fast Fourier Transform.
Implements GBase.
Definition at line 156 of file GFftWavetable.cpp.
References free_members(), and init_members().
|
virtual |
Clone lookup table for Fast Fourier Transform.
Implements GBase.
Definition at line 174 of file GFftWavetable.cpp.
References GFftWavetable().
|
protected |
Copy class members.
[in] | wavetable | Lookup table for Fast Fourier Transform. |
Definition at line 272 of file GFftWavetable.cpp.
References m_factors, m_trig, and m_twiddle.
Referenced by GFftWavetable(), and operator=().
int GFftWavetable::factor | ( | const int & | index | ) | const |
Return factorisation factor.
[in] | index | Factorisation index [0,...,factors()-1]. |
GException::out_of_range | Index is outside valid range. |
Returns factorisation factor.
Definition at line 192 of file GFftWavetable.cpp.
References factors(), G_FACTOR, and m_factors.
Referenced by print(), set_factors(), and GFft::transform().
|
inline |
Return number of factorisation factors.
Definition at line 158 of file GFftWavetable.hpp.
References m_factors.
Referenced by factor(), print(), and GFft::transform().
|
protected |
Delete class members.
Definition at line 287 of file GFftWavetable.cpp.
Referenced by clear(), operator=(), and ~GFftWavetable().
|
inline |
Return start index for a given factor.
[in] | factor | Factor index [0,...,factors()-1]. |
Returns the index of the first trigonometric coefficient for a given factor
.
Definition at line 134 of file GFftWavetable.hpp.
References m_twiddle.
Referenced by GFft::transform().
|
protected |
Initialise class members.
Definition at line 255 of file GFftWavetable.cpp.
References m_factors, m_trig, and m_twiddle.
Referenced by clear(), GFftWavetable(), operator=(), and set_members().
GFftWavetable & GFftWavetable::operator= | ( | const GFftWavetable & | wavetable | ) |
Assignment operator.
[in] | wavetable | Lookup table for Fast Fourier Transform. |
Definition at line 126 of file GFftWavetable.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Return reference to trigonometric coefficient.
[in] | index | Trigonometric coefficient index [0,...,size()-1]. |
Returns a reference to the trigonometric coefficient with the specified index
.
Definition at line 104 of file GFftWavetable.hpp.
References m_trig.
|
inline |
Return reference to trigonometric coefficient (const version)
[in] | index | Trigonometric coefficient index [0,...,size()-1]. |
Returns a const reference to the trigonometric coefficient with the specified index
.
Definition at line 119 of file GFftWavetable.hpp.
References m_trig.
Print lookup table for Fast Fourier Transform information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 212 of file GFftWavetable.cpp.
References factor(), factors(), gammalib::parformat(), SILENT, size(), and gammalib::str().
|
protected |
Compute FFT factorisation.
[in] | n | Length of array to be transformed. |
GException::invalid_argument | Non positive array length specified |
GException::invalid_value | Product of factorisation factors are not equal to array length |
Computes the factorisation
\[ n = \prod_i p_i \]
of an array of length n
.
The method is a C++ implementation of the fft_complex_factorize() and the fft_factorize() functions of the GSL library (version 2.2.1), defined in the file fft/factorize.c.
Definition at line 401 of file GFftWavetable.cpp.
References factor(), G_SET_FACTORS, m_factors, and gammalib::str().
Referenced by set_members().
|
protected |
Set wavetable.
[in] | n | Length. |
Computes the coefficients
\[ \frac{-i 2 \pi j k}{n} \]
of the discrete Fourier transformation
\[ x_j = \sum_{k=0}^{n-1} z_k \exp \left( \frac{-i 2 \pi j k}{n} \right) \]
The method is a C++ implementation of the gsl_fft_complex_wavetable_alloc() function of the GSL library (version 2.2.1), defined in the file fft/c_init.c.
Definition at line 315 of file GFftWavetable.cpp.
References cos(), G_SET_MEMBERS, init_members(), m_factors, m_trig, m_twiddle, set_factors(), sin(), gammalib::str(), and gammalib::twopi.
Referenced by GFftWavetable().
|
inline |
Return number of trigonometric coefficients.
Definition at line 146 of file GFftWavetable.hpp.
References m_trig.
Referenced by print().
|
protected |
Wavetable factors.
Definition at line 77 of file GFftWavetable.hpp.
Referenced by copy_members(), factor(), factors(), init_members(), set_factors(), and set_members().
|
protected |
Trigonometric coefficients.
Definition at line 79 of file GFftWavetable.hpp.
Referenced by copy_members(), init_members(), operator[](), set_members(), and size().
|
protected |
Start index of factors.
Definition at line 78 of file GFftWavetable.hpp.
Referenced by copy_members(), index(), init_members(), and set_members().