Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::FFT< Real >::SOSFilter Class Reference

Stateful cascade of second-order sections. More...

#include <fft.H>

Collaboration diagram for Aleph::FFT< Real >::SOSFilter:
[legend]

Public Member Functions

 SOSFilter ()=default
 Default constructor for an unconfigured SOSFilter.
 
 SOSFilter (const Array< BiquadSection > &sections)
 Construct a cascade of second-order sections (SOS).
 
template<typename SectionsContainer >
requires Is_Biquad_Container<SectionsContainer>
 SOSFilter (const SectionsContainer &sections)
 Construct a cascade of SOS from any biquad container.
 
 SOSFilter (const SOSFilter &other)=default
 Copy the sections and the states of another cascade.
 
 SOSFilter (SOSFilter &&other) noexcept
 Take the sections and the states of another cascade, which is left unconfigured, as built by default.
 
SOSFilter & operator= (const SOSFilter &other)=default
 Copy the sections and the states of another cascade.
 
SOSFilter & operator= (SOSFilter &&other) noexcept
 Exchange this cascade with another, which is left with the previous sections and states of this one.
 
void swap (SOSFilter &other) noexcept
 Exchange in O(1) the sections and the states of this cascade and another.
 
size_t num_sections () const noexcept
 Returns the number of sections in the cascade.
 
bool configured () const noexcept
 Returns whether the filter has been configured.
 
const Array< Real > & state (const size_t index) const
 Returns the current delay-line state of section index.
 
void reset ()
 Resets all internal delay lines to zero.
 
Array< Real > filter (const Array< Real > &signal)
 Processes a signal block through the stateful SOS cascade.
 
template<typename Container >
requires Is_Real_Container<Container>
Array< Real > filter (const Container &signal)
 Processes a real-valued container through the stateful SOS cascade.
 

Private Member Functions

void require_configured (const char *ctx) const
 
void initialize_states ()
 

Private Attributes

Array< BiquadSection > sections_
 
Array< IIRCoefficients > coeffs_
 
Array< Array< Real > > states_
 
bool configured_ = false
 

Detailed Description

template<std::floating_point Real = double>
class Aleph::FFT< Real >::SOSFilter

Stateful cascade of second-order sections.

Definition at line 11904 of file fft.H.

Constructor & Destructor Documentation

◆ SOSFilter() [1/5]

template<std::floating_point Real = double>
Aleph::FFT< Real >::SOSFilter::SOSFilter ( )
default

Default constructor for an unconfigured SOSFilter.

◆ SOSFilter() [2/5]

template<std::floating_point Real = double>
Aleph::FFT< Real >::SOSFilter::SOSFilter ( const Array< BiquadSection > &  sections)
inlineexplicit

Construct a cascade of second-order sections (SOS).

Parameters
sectionsArray of biquad sections.

Definition at line 11938 of file fft.H.

References ah_invalid_argument_if, Aleph::FFT< Real >::SOSFilter::coeffs_, Aleph::FFT< Real >::SOSFilter::initialize_states(), Aleph::FFT< Real >::normalize_iir_coefficients(), and Aleph::FFT< Real >::SOSFilter::sections_.

◆ SOSFilter() [3/5]

template<std::floating_point Real = double>
template<typename SectionsContainer >
requires Is_Biquad_Container<SectionsContainer>
Aleph::FFT< Real >::SOSFilter::SOSFilter ( const SectionsContainer &  sections)
inlineexplicit

Construct a cascade of SOS from any biquad container.

Template Parameters
SectionsContainerContainer of BiquadSection.
Parameters
sectionsBiquad sections.

Definition at line 11958 of file fft.H.

◆ SOSFilter() [4/5]

template<std::floating_point Real = double>
Aleph::FFT< Real >::SOSFilter::SOSFilter ( const SOSFilter &  other)
default

Copy the sections and the states of another cascade.

Parameters
[in]othercascade to copy.
Exceptions
std::bad_allocif the arrays cannot be allocated.

◆ SOSFilter() [5/5]

template<std::floating_point Real = double>
Aleph::FFT< Real >::SOSFilter::SOSFilter ( SOSFilter &&  other)
inlinenoexcept

Take the sections and the states of another cascade, which is left unconfigured, as built by default.

The implicit move took the sections but copied the configured flag: the moved-from cascade then said that it was configured, and filter() returned its input unchanged, through no section.

Parameters
[in,out]othercascade to move from.
Note
Complexity: O(1).

Definition at line 11978 of file fft.H.

Member Function Documentation

◆ configured()

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::SOSFilter::configured ( ) const
inlinenoexcept

Returns whether the filter has been configured.

Definition at line 12023 of file fft.H.

References Aleph::FFT< Real >::SOSFilter::configured_.

◆ filter() [1/2]

template<std::floating_point Real = double>
Array< Real > Aleph::FFT< Real >::SOSFilter::filter ( const Array< Real > &  signal)
inline

◆ filter() [2/2]

template<std::floating_point Real = double>
template<typename Container >
requires Is_Real_Container<Container>
Array< Real > Aleph::FFT< Real >::SOSFilter::filter ( const Container &  signal)
inline

Processes a real-valued container through the stateful SOS cascade.

Definition at line 12071 of file fft.H.

References Aleph::FFT< Real >::build_real_input(), and Aleph::FFT< Real >::SOSFilter::filter().

◆ initialize_states()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::SOSFilter::initialize_states ( )
inlineprivate

◆ num_sections()

template<std::floating_point Real = double>
size_t Aleph::FFT< Real >::SOSFilter::num_sections ( ) const
inlinenoexcept

Returns the number of sections in the cascade.

Definition at line 12017 of file fft.H.

References Aleph::FFT< Real >::SOSFilter::sections_.

◆ operator=() [1/2]

template<std::floating_point Real = double>
SOSFilter & Aleph::FFT< Real >::SOSFilter::operator= ( const SOSFilter &  other)
default

Copy the sections and the states of another cascade.

Parameters
[in]othercascade to copy.
Returns
this cascade.
Exceptions
std::bad_allocif the arrays cannot be allocated.

◆ operator=() [2/2]

template<std::floating_point Real = double>
SOSFilter & Aleph::FFT< Real >::SOSFilter::operator= ( SOSFilter &&  other)
inlinenoexcept

Exchange this cascade with another, which is left with the previous sections and states of this one.

Parameters
[in,out]othercascade to move from.
Returns
this cascade.
Note
Complexity: O(1).

Definition at line 11998 of file fft.H.

References Aleph::FFT< Real >::SOSFilter::swap().

◆ require_configured()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::SOSFilter::require_configured ( const char *  ctx) const
inlineprivate

◆ reset()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::SOSFilter::reset ( )
inline

Resets all internal delay lines to zero.

Definition at line 12039 of file fft.H.

References Aleph::FFT< Real >::SOSFilter::require_configured(), and Aleph::FFT< Real >::SOSFilter::states_.

◆ state()

template<std::floating_point Real = double>
const Array< Real > & Aleph::FFT< Real >::SOSFilter::state ( const size_t  index) const
inline

Returns the current delay-line state of section index.

Definition at line 12030 of file fft.H.

References ah_out_of_range_error_if, Aleph::Array< T >::size(), and Aleph::FFT< Real >::SOSFilter::states_.

Referenced by Aleph::FFT< Real >::SOSFilter::initialize_states().

◆ swap()

template<std::floating_point Real = double>
void Aleph::FFT< Real >::SOSFilter::swap ( SOSFilter &  other)
inlinenoexcept

Exchange in O(1) the sections and the states of this cascade and another.

Parameters
[in,out]othercascade to exchange with.

Definition at line 12008 of file fft.H.

References Aleph::FFT< Real >::SOSFilter::coeffs_, Aleph::FFT< Real >::SOSFilter::configured_, Aleph::FFT< Real >::SOSFilter::sections_, and Aleph::FFT< Real >::SOSFilter::states_.

Referenced by Aleph::FFT< Real >::SOSFilter::operator=().

Member Data Documentation

◆ coeffs_

template<std::floating_point Real = double>
Array<IIRCoefficients> Aleph::FFT< Real >::SOSFilter::coeffs_
private

◆ configured_

template<std::floating_point Real = double>
bool Aleph::FFT< Real >::SOSFilter::configured_ = false
private

◆ sections_

template<std::floating_point Real = double>
Array<BiquadSection> Aleph::FFT< Real >::SOSFilter::sections_
private

◆ states_


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