Monado OpenXR Runtime
xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar > Struct Template Reference

The shared implementation (between vector and scalar versions) of an integer IIR/exponential low-pass filter. More...

#include <math/m_lowpass_integer.hpp>

Collaboration diagram for xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar >:

Public Member Functions

 IntegerLowPassIIR (math::Rational< Scalar > alpha_, Value const &val)
 Constructor. More...
 
void reset (Value const &val) noexcept
 Reset the filter to newly-created state. More...
 
void addSample (Value const &sample, math::Rational< Scalar > weight=math::Rational< Scalar >::simplestUnity())
 Filter a sample, with an optional weight. More...
 

Data Fields

Value state
 
math::Rational< Scalaralpha
 
bool initialized {false}
 

Detailed Description

template<typename Value, typename Scalar>
struct xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar >

The shared implementation (between vector and scalar versions) of an integer IIR/exponential low-pass filter.

Constructor & Destructor Documentation

◆ IntegerLowPassIIR()

template<typename Value , typename Scalar >
xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar >::IntegerLowPassIIR ( math::Rational< Scalar alpha_,
Value const &  val 
)
inlineexplicit

Constructor.

Parameters
alpha_The alpha value used to blend between new input and existing state. Larger values mean more influence from new input. alpha_.isBetweenZeroAndOne() must be true.
valThe value to initialize the filter with. Does not affect the filter itself: only seen if you get the state before initializing the filter with the first sample.

Member Function Documentation

◆ addSample()

template<typename Value , typename Scalar >
void xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar >::addSample ( Value const &  sample,
math::Rational< Scalar weight = math::Rational<Scalar>::simplestUnity() 
)
inline

Filter a sample, with an optional weight.

Parameters
sampleThe value to filter
weightAn optional value between 0 and 1. The smaller this value, the less the current sample influences the filter state. For the first call, this is always assumed to be 1.

◆ reset()

template<typename Value , typename Scalar >
void xrt::auxiliary::math::detail::IntegerLowPassIIR< Value, Scalar >::reset ( Value const &  val)
inlinenoexcept

Reset the filter to newly-created state.

Referenced by xrt::auxiliary::math::IntegerLowPassIIRFilter< Scalar >::reset().


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