ldas-tools-filters  2.6.5
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
Filters::Window Class Referenceabstract

An abstract base class for window functions. More...

#include <Window.hh>

Inheritance diagram for Filters::Window:
Filters::HannWindow Filters::HannWindow Filters::HannWindow Filters::KaiserWindow Filters::KaiserWindow Filters::KaiserWindow Filters::RectangularWindow Filters::RectangularWindow Filters::RectangularWindow

Public Member Functions

 Window ()
 Default constructor More...
 
virtual ~Window ()
 Destructor. More...
 
const Windowoperator= (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 WindowClone () const =0
 Clone a window. More...
 
 Window ()
 Default constructor More...
 
virtual ~Window ()
 Destructor. More...
 
const Windowoperator= (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 WindowClone () const =0
 Clone a window. More...
 
 Window ()
 Default constructor More...
 
virtual ~Window ()
 Destructor. More...
 
const Windowoperator= (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 WindowClone () 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...
 

Detailed Description

An abstract base class for window functions.

Constructor & Destructor Documentation

◆ Window() [1/3]

Filters::Window::Window ( )

Default constructor

◆ ~Window() [1/3]

Filters::Window::~Window ( )
virtual

Destructor.

◆ Window() [2/3]

Filters::Window::Window ( )

Default constructor

◆ ~Window() [2/3]

virtual Filters::Window::~Window ( )
virtual

Destructor.

◆ Window() [3/3]

Filters::Window::Window ( )

Default constructor

◆ ~Window() [3/3]

virtual Filters::Window::~Window ( )
virtual

Destructor.

Member Function Documentation

◆ apply() [1/6]

template<class T >
void Filters::Window::apply ( std::valarray< T > &  x)

Apply a window to the data in-place.

Parameters
[in,out]xinput/output sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [2/6]

template<class T >
void Filters::Window::apply ( std::valarray< T > &  x)

Apply a window to the data in-place.

Parameters
[in,out]xinput/output sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [3/6]

template<class T >
void Filters::Window::apply ( std::valarray< T > &  x)

Apply a window to the data in-place.

Parameters
[in,out]xinput/output sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [4/6]

template<class TOut , class TIn >
void Filters::Window::apply ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)

Apply a window to the data out-of-place.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [5/6]

template<class TOut , class TIn >
void Filters::Window::apply ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)

Apply a window to the data out-of-place.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ apply() [6/6]

template<class TOut , class TIn >
void Filters::Window::apply ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)

Apply a window to the data out-of-place.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ Clone() [1/3]

virtual Window* Filters::Window::Clone ( ) const
pure virtual

◆ Clone() [2/3]

virtual Window* Filters::Window::Clone ( ) const
pure virtual

◆ Clone() [3/3]

virtual Window* Filters::Window::Clone ( ) const
pure virtual

◆ element() [1/3]

virtual double Filters::Window::element ( const size_t  i) const
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.

Parameters

Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::HannWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::RectangularWindow, and Filters::RectangularWindow.

◆ element() [2/3]

virtual double Filters::Window::element ( const size_t  i) const
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.

Parameters

Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::HannWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::RectangularWindow, and Filters::RectangularWindow.

◆ element() [3/3]

virtual double Filters::Window::element ( const size_t  i) const
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.

Parameters

Implemented in Filters::KaiserWindow, Filters::KaiserWindow, Filters::KaiserWindow, Filters::HannWindow, Filters::HannWindow, Filters::HannWindow, Filters::RectangularWindow, Filters::RectangularWindow, and Filters::RectangularWindow.

◆ mean() [1/3]

double Filters::Window::mean ( ) const
inline

Return mean value of window.

Returns
mean value of window elements

◆ mean() [2/3]

double Filters::Window::mean ( ) const

Return mean value of window.

Returns
mean value of window elements

◆ mean() [3/3]

double Filters::Window::mean ( ) const

Return mean value of window.

Returns
mean value of window elements

◆ multiply_by_window() [1/12]

void Filters::Window::multiply_by_window ( std::valarray< float > &  out)
private

Multiply a sequence of floats by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [2/12]

void Filters::Window::multiply_by_window ( std::valarray< float > &  out)
private

Multiply a sequence of floats by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [3/12]

void Filters::Window::multiply_by_window ( std::valarray< float > &  out)
private

Multiply a sequence of floats by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [4/12]

void Filters::Window::multiply_by_window ( std::valarray< double > &  out)
private

Multiply a sequence of doubles by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [5/12]

void Filters::Window::multiply_by_window ( std::valarray< double > &  out)
private

Multiply a sequence of doubles by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [6/12]

void Filters::Window::multiply_by_window ( std::valarray< double > &  out)
private

Multiply a sequence of doubles by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [7/12]

void Filters::Window::multiply_by_window ( std::valarray< std::complex< float > > &  out)
private

Multiply a sequence of complex floats by the window.

Parameters
[in,out]input(and output) sequence

◆ multiply_by_window() [8/12]

void Filters::Window::multiply_by_window ( std::valarray< std::complex< float > > &  out)
private

Multiply a sequence of complex floats by the window.

Parameters
[in,out]input(and output) sequence

◆ multiply_by_window() [9/12]

void Filters::Window::multiply_by_window ( std::valarray< std::complex< float > > &  out)
private

Multiply a sequence of complex floats by the window.

Parameters
[in,out]input(and output) sequence

◆ multiply_by_window() [10/12]

void Filters::Window::multiply_by_window ( std::valarray< std::complex< double > > &  out)
private

Multiply a sequence of complex doubles by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [11/12]

void Filters::Window::multiply_by_window ( std::valarray< std::complex< double > > &  out)
private

Multiply a sequence of complex doubles by the window.

Parameters
[in,out]outinput (and output) sequence

◆ multiply_by_window() [12/12]

void Filters::Window::multiply_by_window ( std::valarray< std::complex< double > > &  out)
private

Multiply a sequence of complex doubles by the window.

Parameters
[in,out]outinput (and output) sequence

◆ name() [1/3]

virtual std::string Filters::Window::name ( ) const
pure virtual

◆ name() [2/3]

virtual std::string Filters::Window::name ( ) const
pure virtual

◆ name() [3/3]

virtual std::string Filters::Window::name ( ) const
pure virtual

◆ operator()() [1/3]

template<class TOut , class TIn >
void Filters::Window::operator() ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)

Synonym for apply.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ operator()() [2/3]

template<class TOut , class TIn >
void Filters::Window::operator() ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)

Synonym for apply.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ operator()() [3/3]

template<class TOut , class TIn >
void Filters::Window::operator() ( std::valarray< TOut > &  out,
const std::valarray< TIn > &  in 
)

Synonym for apply.

Parameters
[out]outwindowed sequence
[in]ininput sequence
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for window

◆ operator=() [1/3]

const Window & Filters::Window::operator= ( const Window r)

Copy assignment.

Parameters
[in]rWindow that is copied
Returns
This object

◆ operator=() [2/3]

const Window& Filters::Window::operator= ( const Window r)

Copy assignment.

Parameters
[in]rWindow that is copied
Returns
This object

◆ operator=() [3/3]

const Window& Filters::Window::operator= ( const Window r)

Copy assignment.

Parameters
[in]rWindow that is copied
Returns
This object

◆ param() [1/3]

virtual double Filters::Window::param ( ) const
pure virtual

◆ param() [2/3]

virtual double Filters::Window::param ( ) const
pure virtual

◆ param() [3/3]

virtual double Filters::Window::param ( ) const
pure virtual

◆ populate() [1/3]

void Filters::Window::populate ( )
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.

◆ populate() [2/3]

void Filters::Window::populate ( )
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.

◆ populate() [3/3]

void Filters::Window::populate ( )
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.

◆ resize() [1/3]

void Filters::Window::resize ( const size_t  n)

Change the size of the window.

Parameters
[in]ndesired length of window
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for the window

◆ resize() [2/3]

void Filters::Window::resize ( const size_t  n)

Change the size of the window.

Parameters
[in]ndesired length of window
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for the window

◆ resize() [3/3]

void Filters::Window::resize ( const size_t  n)

Change the size of the window.

Parameters
[in]ndesired length of window
Exceptions
std::length_errorthrown if desired window length is greater than maximum allowed value
std::bad_allocthrown if not able to allocate memory for the window

◆ rms() [1/3]

double Filters::Window::rms ( ) const
inline

Return RMS value of window.

Returns
root mean square value of window elements

◆ rms() [2/3]

double Filters::Window::rms ( ) const

Return RMS value of window.

Returns
root mean square value of window elements

◆ rms() [3/3]

double Filters::Window::rms ( ) const

Return RMS value of window.

Returns
root mean square value of window elements

◆ size() [1/3]

size_t Filters::Window::size ( ) const

Return window length.

Returns
length of window

◆ size() [2/3]

size_t Filters::Window::size ( ) const
inline

Return window length.

Returns
length of window

◆ size() [3/3]

size_t Filters::Window::size ( ) const

Return window length.

Returns
length of window

Member Data Documentation

◆ m_d_window

std::valarray< double > Filters::Window::m_d_window
private

a sequence for holding a window of doubles

◆ m_f_window

std::valarray< float > Filters::Window::m_f_window
private

a sequence for holding a window of floats

◆ m_is_float

bool Filters::Window::m_is_float
private

true if window elements are floats

◆ m_mean

double Filters::Window::m_mean
private

mean value of window elements

◆ m_rms

double Filters::Window::m_rms
private

rms value of window elements


The documentation for this class was generated from the following files: