ldas-tools-filters
2.6.4
|
An abstract base class for window functions. More...
#include <Window.hh>
Public Member Functions | |
Window () | |
Default constructor More... | |
virtual | ~Window () |
Destructor. More... | |
const Window & | operator= (const Window &r) |
Copy assignment. More... | |
size_t | size () const |
Return window length. More... | |
double | mean () const |
Return mean value of window. More... | |
double | rms () const |
Return RMS value of window. More... | |
virtual std::string | name () const =0 |
Return window name. More... | |
virtual double | param () const =0 |
Return window parameter. More... | |
void | resize (const size_t n) |
Change the size of the window. More... | |
template<class T > | |
void | apply (std::valarray< T > &x) |
Apply a window to the data in-place. More... | |
template<class TOut , class TIn > | |
void | apply (std::valarray< TOut > &out, const std::valarray< TIn > &in) |
Apply a window to the data out-of-place. More... | |
template<class TOut , class TIn > | |
void | operator() (std::valarray< TOut > &out, const std::valarray< TIn > &in) |
Synonym for apply. More... | |
virtual Window * | Clone () const =0 |
Clone a window. More... | |
Window () | |
Default constructor More... | |
virtual | ~Window () |
Destructor. More... | |
const Window & | operator= (const Window &r) |
Copy assignment. More... | |
size_t | size () const |
Return window length. More... | |
double | mean () const |
Return mean value of window. More... | |
double | rms () const |
Return RMS value of window. More... | |
virtual std::string | name () const =0 |
Return window name. More... | |
virtual double | param () const =0 |
Return window parameter. More... | |
void | resize (const size_t n) |
Change the size of the window. More... | |
template<class T > | |
void | apply (std::valarray< T > &x) |
Apply a window to the data in-place. More... | |
template<class TOut , class TIn > | |
void | apply (std::valarray< TOut > &out, const std::valarray< TIn > &in) |
Apply a window to the data out-of-place. More... | |
template<class TOut , class TIn > | |
void | operator() (std::valarray< TOut > &out, const std::valarray< TIn > &in) |
Synonym for apply. More... | |
virtual Window * | Clone () const =0 |
Clone a window. More... | |
Window () | |
Default constructor More... | |
virtual | ~Window () |
Destructor. More... | |
const Window & | operator= (const Window &r) |
Copy assignment. More... | |
size_t | size () const |
Return window length. More... | |
double | mean () const |
Return mean value of window. More... | |
double | rms () const |
Return RMS value of window. More... | |
virtual std::string | name () const =0 |
Return window name. More... | |
virtual double | param () const =0 |
Return window parameter. More... | |
void | resize (const size_t n) |
Change the size of the window. More... | |
template<class T > | |
void | apply (std::valarray< T > &x) |
Apply a window to the data in-place. More... | |
template<class TOut , class TIn > | |
void | apply (std::valarray< TOut > &out, const std::valarray< TIn > &in) |
Apply a window to the data out-of-place. More... | |
template<class TOut , class TIn > | |
void | operator() (std::valarray< TOut > &out, const std::valarray< TIn > &in) |
Synonym for apply. More... | |
virtual Window * | Clone () const =0 |
Clone a window. More... | |
Protected Member Functions | |
void | populate () |
Populate the elements of the window. More... | |
void | populate () |
Populate the elements of the window. More... | |
void | populate () |
Populate the elements of the window. More... | |
Private Member Functions | |
virtual double | element (const size_t i) const =0 |
Get the ith element of the window. More... | |
void | multiply_by_window (std::valarray< float > &out) |
Multiply a sequence of floats by the window. More... | |
void | multiply_by_window (std::valarray< double > &out) |
Multiply a sequence of doubles by the window. More... | |
void | multiply_by_window (std::valarray< std::complex< float > > &out) |
Multiply a sequence of complex floats by the window. More... | |
void | multiply_by_window (std::valarray< std::complex< double > > &out) |
Multiply a sequence of complex doubles by the window. More... | |
virtual double | element (const size_t i) const =0 |
Get the ith element of the window. More... | |
void | multiply_by_window (std::valarray< float > &out) |
Multiply a sequence of floats by the window. More... | |
void | multiply_by_window (std::valarray< double > &out) |
Multiply a sequence of doubles by the window. More... | |
void | multiply_by_window (std::valarray< std::complex< float > > &out) |
Multiply a sequence of complex floats by the window. More... | |
void | multiply_by_window (std::valarray< std::complex< double > > &out) |
Multiply a sequence of complex doubles by the window. More... | |
virtual double | element (const size_t i) const =0 |
Get the ith element of the window. More... | |
void | multiply_by_window (std::valarray< float > &out) |
Multiply a sequence of floats by the window. More... | |
void | multiply_by_window (std::valarray< double > &out) |
Multiply a sequence of doubles by the window. More... | |
void | multiply_by_window (std::valarray< std::complex< float > > &out) |
Multiply a sequence of complex floats by the window. More... | |
void | multiply_by_window (std::valarray< std::complex< double > > &out) |
Multiply a sequence of complex doubles by the window. More... | |
Private Attributes | |
std::valarray< float > | m_f_window |
a sequence for holding a window of floats More... | |
std::valarray< double > | m_d_window |
a sequence for holding a window of doubles More... | |
double | m_mean |
mean value of window elements More... | |
double | m_rms |
rms value of window elements More... | |
bool | m_is_float |
true if window elements are floats More... | |
An abstract base class for window functions.
Filters::Window::Window | ( | ) |
Default constructor
|
virtual |
Destructor.
Filters::Window::Window | ( | ) |
Default constructor
|
virtual |
Destructor.
Filters::Window::Window | ( | ) |
Default constructor
|
virtual |
Destructor.
void Filters::Window::apply | ( | std::valarray< T > & | x | ) |
Apply a window to the data in-place.
[in,out] | x | input/output sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::apply | ( | std::valarray< T > & | x | ) |
Apply a window to the data in-place.
[in,out] | x | input/output sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::apply | ( | std::valarray< T > & | x | ) |
Apply a window to the data in-place.
[in,out] | x | input/output sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::apply | ( | std::valarray< TOut > & | out, |
const std::valarray< TIn > & | in | ||
) |
Apply a window to the data out-of-place.
[out] | out | windowed sequence |
[in] | in | input sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::apply | ( | std::valarray< TOut > & | out, |
const std::valarray< TIn > & | in | ||
) |
Apply a window to the data out-of-place.
[out] | out | windowed sequence |
[in] | in | input sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::apply | ( | std::valarray< TOut > & | out, |
const std::valarray< TIn > & | in | ||
) |
Apply a window to the data out-of-place.
[out] | out | windowed sequence |
[in] | in | input sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
|
pure virtual |
Clone a window.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
pure virtual |
Clone a window.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
pure virtual |
Clone a window.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
privatepure virtual |
Get the ith element of the window.
This function returns the value corresponding to the ith position in the window. It is the window function evaluated at x = i/N where N is the length of the window.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::HannWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::RectangularWindow, and Filters::RectangularWindow.
|
privatepure virtual |
Get the ith element of the window.
This function returns the value corresponding to the ith position in the window. It is the window function evaluated at x = i/N where N is the length of the window.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::HannWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::RectangularWindow, and Filters::RectangularWindow.
|
privatepure virtual |
Get the ith element of the window.
This function returns the value corresponding to the ith position in the window. It is the window function evaluated at x = i/N where N is the length of the window.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::HannWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::RectangularWindow, and Filters::RectangularWindow.
|
inline |
Return mean value of window.
double Filters::Window::mean | ( | ) | const |
Return mean value of window.
double Filters::Window::mean | ( | ) | const |
Return mean value of window.
|
private |
Multiply a sequence of floats by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of floats by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of floats by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of doubles by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of doubles by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of doubles by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of complex floats by the window.
[in,out] | input | (and output) sequence |
|
private |
Multiply a sequence of complex floats by the window.
[in,out] | input | (and output) sequence |
|
private |
Multiply a sequence of complex floats by the window.
[in,out] | input | (and output) sequence |
|
private |
Multiply a sequence of complex doubles by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of complex doubles by the window.
[in,out] | out | input (and output) sequence |
|
private |
Multiply a sequence of complex doubles by the window.
[in,out] | out | input (and output) sequence |
|
pure virtual |
Return window name.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
pure virtual |
Return window name.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
pure virtual |
Return window name.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
void Filters::Window::operator() | ( | std::valarray< TOut > & | out, |
const std::valarray< TIn > & | in | ||
) |
Synonym for apply.
[out] | out | windowed sequence |
[in] | in | input sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::operator() | ( | std::valarray< TOut > & | out, |
const std::valarray< TIn > & | in | ||
) |
Synonym for apply.
[out] | out | windowed sequence |
[in] | in | input sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
void Filters::Window::operator() | ( | std::valarray< TOut > & | out, |
const std::valarray< TIn > & | in | ||
) |
Synonym for apply.
[out] | out | windowed sequence |
[in] | in | input sequence |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for window |
|
pure virtual |
Return window parameter.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
pure virtual |
Return window parameter.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
pure virtual |
Return window parameter.
Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::HannWindow, and Filters::RectangularWindow.
|
protected |
Populate the elements of the window.
This function will usually need to be called by a derived class whenever the the window is changed in any way which affects the element() function, such as when some window parameter is altered.
|
protected |
Populate the elements of the window.
This function will usually need to be called by a derived class whenever the the window is changed in any way which affects the element() function, such as when some window parameter is altered.
|
protected |
Populate the elements of the window.
This function will usually need to be called by a derived class whenever the the window is changed in any way which affects the element() function, such as when some window parameter is altered.
void Filters::Window::resize | ( | const size_t | n | ) |
Change the size of the window.
[in] | n | desired length of window |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for the window |
void Filters::Window::resize | ( | const size_t | n | ) |
Change the size of the window.
[in] | n | desired length of window |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for the window |
void Filters::Window::resize | ( | const size_t | n | ) |
Change the size of the window.
[in] | n | desired length of window |
std::length_error | thrown if desired window length is greater than maximum allowed value |
std::bad_alloc | thrown if not able to allocate memory for the window |
|
inline |
Return RMS value of window.
double Filters::Window::rms | ( | ) | const |
Return RMS value of window.
double Filters::Window::rms | ( | ) | const |
Return RMS value of window.
size_t Filters::Window::size | ( | ) | const |
Return window length.
|
inline |
Return window length.
size_t Filters::Window::size | ( | ) | const |
Return window length.
|
private |
a sequence for holding a window of doubles
|
private |
a sequence for holding a window of floats
|
private |
true if window elements are floats
|
private |
mean value of window elements
|
private |
rms value of window elements