library of assembled shared sources

http://lass.cocamware.com

lass::num::IirFilter< T, InputIterator, OutputIterator > Class Template Reference
[Filters]

Infinite Impulse Response filter. More...

#include <filters.h>

Inheritance diagram for lass::num::IirFilter< T, InputIterator, OutputIterator >:

Inheritance graph
[legend]
Collaboration diagram for lass::num::IirFilter< T, InputIterator, OutputIterator >:

Collaboration graph
[legend]

Public Types

typedef Filter< T,
InputIterator, OutputIterator >
::TValue 
TValue
typedef Filter< T,
InputIterator, OutputIterator >
::TParam 
TParam
typedef Filter< T,
InputIterator, OutputIterator >
::TReference 
TReference
typedef Filter< T,
InputIterator, OutputIterator >
::TConstReference 
TConstReference
typedef Filter< T,
InputIterator, OutputIterator >
::TInputIterator 
TInputIterator
typedef Filter< T,
InputIterator, OutputIterator >
::TOutputIterator 
TOutputIterator
typedef Filter< T,
InputIterator, OutputIterator >
::TNumTraits 
TNumTraits
typedef std::vector< T > TValues
typedef std::pair< TValues,
TValues
TValuesPair

Public Member Functions

 IirFilter (const TValues &numerator, const TValues &denominator)
 construct IIR filter
 IirFilter (const TValuesPair &coefficients)
 construct IIR filter
TOutputIterator operator() (TInputIterator first, TInputIterator last, TOutputIterator output)
void reset ()

Static Public Member Functions

static IirFilter makeLaplace (const TValues &nominator, const TValues &denominator, TParam samplingFrequency)
static IirFilter makeButterworthLowPass (unsigned order, TParam cutoffAngularFrequency, TParam gain, TParam samplingFrequency)
 make an IIR filter implementing a low-pass butterworth filter.
static IirFilter makeButterworthHighPass (unsigned order, TParam cutoffAngularFrequency, TParam gain, TParam samplingFrequency)
 make an IIR filter implementing a high-pass butterworth filter.
static IirFilter makeRlcLowPass (TParam qFactor, TParam cutoffAngularFrequency, TParam gain, TParam samplingFrequency)
 make an IIR filter implementing an low-pass RLC circuit.
static IirFilter makeRlcHighPass (TParam qFactor, TParam cutoffAngularFrequency, TParam gain, TParam samplingFrequency)
 make an IIR filter implementing an high-pass RLC circuit.
static IirFilter makeRlcBandPass (TParam qFactor, TParam centerAngularFrequency, TParam gain, TParam samplingFrequency)
 make an IIR filter implementing an band-pass RLC circuit.
static IirFilter makeRlcNotch (TParam qFactor, TParam centerAngularFrequency, TParam gain, TParam samplingFrequency)
 make an IIR filter implementing an notch RLC circuit.
static IirFilter makeIntegrator (TParam gain, TParam samplingFrequency)
 make an IIR filter implementing a perfect integrator
static IirFilter makeDifferentiator (TParam gain, TParam samplingFrequency)
 make an IIR filter implementing a perfect differentiator
static IirFilter makeAWeighting (TParam samplingFrequency)
 make an A weighting filter

Private Types

typedef std::vector< size_t > TIndexTable

Private Member Functions

TOutputIterator doFilter (TInputIterator first, TInputIterator last, TOutputIterator output)
void doReset ()
void init (const TValues &numerator, const TValues &denominator)

Static Private Member Functions

template<typename FwdIt1 , typename FwdIt2 >
static IirFilter doMakeLaplace (FwdIt1 numFirst, FwdIt1 numLast, FwdIt2 denFirst, FwdIt2 denLast, TParam sampleFrequency)
 little private helper
static IirFilter doMakeLaplace (const TValuesPair &coefficients, TParam sampleFrequency)
 little private helper

Private Attributes

TValues xTaps_
TValues yTaps_
TValues xBuffer_
TValues yBuffer_
TIndexTable xNextIndex_
TIndexTable yNextIndex_
size_t xTapSize_
size_t yTapSize_
size_t xBufferIndex_
size_t yBufferIndex_

Detailed Description

template<typename T, typename InputIterator = const T*, typename OutputIterator = T*>
class lass::num::IirFilter< T, InputIterator, OutputIterator >

Infinite Impulse Response filter.

Definition at line 119 of file filters.h.


Member Typedef Documentation

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TValue lass::num::IirFilter< T, InputIterator, OutputIterator >::TValue

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 122 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TParam lass::num::IirFilter< T, InputIterator, OutputIterator >::TParam

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 123 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TReference lass::num::IirFilter< T, InputIterator, OutputIterator >::TReference

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 124 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TConstReference lass::num::IirFilter< T, InputIterator, OutputIterator >::TConstReference

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 125 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TInputIterator lass::num::IirFilter< T, InputIterator, OutputIterator >::TInputIterator

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 126 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TOutputIterator lass::num::IirFilter< T, InputIterator, OutputIterator >::TOutputIterator

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 127 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef Filter<T, InputIterator, OutputIterator>::TNumTraits lass::num::IirFilter< T, InputIterator, OutputIterator >::TNumTraits

Reimplemented from lass::num::Filter< T, InputIterator, OutputIterator >.

Definition at line 128 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef std::vector<T> lass::num::IirFilter< T, InputIterator, OutputIterator >::TValues

Definition at line 130 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef std::pair<TValues, TValues> lass::num::IirFilter< T, InputIterator, OutputIterator >::TValuesPair

Definition at line 131 of file filters.h.

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
typedef std::vector<size_t> lass::num::IirFilter< T, InputIterator, OutputIterator >::TIndexTable [private]

Definition at line 148 of file filters.h.


Constructor & Destructor Documentation

template<typename T , typename InIt , typename OutIt >
lass::num::IirFilter< T, InIt, OutIt >::IirFilter ( const TValues numerator,
const TValues denominator 
) [inline]

construct IIR filter

        a[0] + a[1] * z^-1 + a[2] * z^-2 + ... + a[m-1] * z^-(m-1)
 H(z) = ----------------------------------------------------------
        b[0] + b[1] * z^-1 + b[2] * z^-2 + ... + b[m-1] * z^-(m-1)

Parameters:
numerator [in] coefficients a[i] of transfer function H(z).
denominator [in] coefficients b[i] of transfer function H(z).

Definition at line 200 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::init(), and lass::num::Filter< T, InputIterator, OutputIterator >::reset().

template<typename T , typename InIt , typename OutIt >
lass::num::IirFilter< T, InIt, OutIt >::IirFilter ( const TValuesPair coefficients  )  [inline]

construct IIR filter

Parameters:
coefficients [in] numerator (=first) and denominator (=second) of transfer function H(z).

Definition at line 213 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::init(), and lass::num::Filter< T, InputIterator, OutputIterator >::reset().


Member Function Documentation

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeLaplace ( const TValues nominator,
const TValues denominator,
TParam  samplingFrequency 
) [inline, static]

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeButterworthLowPass ( unsigned  order,
TParam  cutoffAngularFrequency,
TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing a low-pass butterworth filter.

Parameters:
order [in] order of filter. filter rolls of at (order * 6) dB per decade.
cutoffAngularFrequency [in] cutoff frequency measured in radians per sec (w = 2 pi f).
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 250 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), and lass::num::impl::laplaceButterworthLowPass().

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeButterworthHighPass ( unsigned  order,
TParam  cutoffAngularFrequency,
TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing a high-pass butterworth filter.

Parameters:
order [in] order of filter. filter rolls of at (order * 6) dB per decade.
cutoffAngularFrequency [in] cutoff frequency measured in radians per sec (w = 2 pi f).
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 266 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), and lass::num::impl::laplaceButterworthHighPass().

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeRlcLowPass ( TParam  qFactor,
TParam  cutoffAngularFrequency,
TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing an low-pass RLC circuit.

     o---[R]---[sL]---*-----o
                      |
    Vin            [1/sC]  Vout
                      |
     o----------------*-----o

Parameters:
qFactor [in] quality factor Q = sqrt(L/C)/R (Q > 1 for resonance peak, Q = 1/sqrt(2) for 2nd order butterworth).
cutoffAngularFrequency [in] cutoff frequency measured in radians per sec (w = 2 pi f = 1 / sqrt(LC))
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 290 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), lass::num::inv(), lass::num::NumTraits< C >::one, and lass::num::sqr().

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeRlcHighPass ( TParam  qFactor,
TParam  cutoffAngularFrequency,
TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing an high-pass RLC circuit.

     o---[R]---[1/sC]---*----o
                        |
    Vin               [sL]  Vout
                        |
     o------------------*----o

Parameters:
qFactor [in] quality factor Q = sqrt(L/C)/R (Q > 1 for resonance peak, Q = 1/sqrt(2) for 2nd order butterworth).
cutoffAngularFrequency [in] cutoff frequency measured in radians per sec (w = 2 pi f = 1 / sqrt(LC))
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 316 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), lass::num::inv(), lass::num::NumTraits< C >::one, and lass::num::sqr().

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeRlcBandPass ( TParam  qFactor,
TParam  centerAngularFrequency,
TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing an band-pass RLC circuit.

     o---[sL]---[1/sC]---*----o
                         |
    Vin                 [R]  Vout
                         |
     o-------------------*----o

Parameters:
qFactor [in] quality factor Q = sqrt(L/C)/R (greater Q is more narrow stop band).
centerAngularFrequency [in] frequency to be filter out, measured in radians per sec (w = 2 pi f = 1 / sqrt(LC))
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 342 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), lass::num::inv(), lass::num::NumTraits< C >::one, lass::num::sqr(), and lass::num::NumTraits< C >::zero.

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeRlcNotch ( TParam  qFactor,
TParam  centerAngularFrequency,
TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing an notch RLC circuit.

     o---[R]---*----o
               |
             [sL]
    Vin        |   Vout
            [1/sC]
               |
     o---------*----o

Parameters:
qFactor [in] quality factor Q = sqrt(L/C)/R (greater Q is more narrow stop band).
centerAngularFrequency [in] frequency to be filter out, measured in radians per sec (w = 2 pi f = 1 / sqrt(LC))
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 370 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), lass::num::inv(), lass::num::NumTraits< C >::one, lass::num::sqr(), and lass::num::NumTraits< C >::zero.

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeIntegrator ( TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing a perfect integrator

Parameters:
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 386 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeDifferentiator ( TParam  gain,
TParam  samplingFrequency 
) [inline, static]

make an IIR filter implementing a perfect differentiator

Parameters:
gain [in] DC gain
samplingFrequency [in] sampling frequency of digital signal

Definition at line 401 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace(), lass::num::NumTraits< C >::one, and lass::num::NumTraits< C >::zero.

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::makeAWeighting ( TParam  samplingFrequency  )  [inline, static]

make an A weighting filter

Parameters:
samplingFrequency [in] sampling frequency of digital signal

Definition at line 415 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace().

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt >::TOutputIterator lass::num::IirFilter< T, InIt, OutIt >::doFilter ( TInputIterator  first,
TInputIterator  last,
TOutputIterator  output 
) [inline, private]

template<typename T , typename InIt , typename OutIt >
void lass::num::IirFilter< T, InIt, OutIt >::doReset (  )  [inline, private, virtual]

template<typename T , typename InIt , typename OutIt >
void lass::num::IirFilter< T, InIt, OutIt >::init ( const TValues numerator,
const TValues denominator 
) [inline, private]

template<typename T , typename InIt , typename OutIt >
template<typename FwdIt1 , typename FwdIt2 >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::doMakeLaplace ( FwdIt1  numFirst,
FwdIt1  numLast,
FwdIt2  denFirst,
FwdIt2  denLast,
TParam  sampleFrequency 
) [inline, static, private]

template<typename T , typename InIt , typename OutIt >
IirFilter< T, InIt, OutIt > lass::num::IirFilter< T, InIt, OutIt >::doMakeLaplace ( const TValuesPair coefficients,
TParam  sampleFrequency 
) [inline, static, private]

little private helper

Definition at line 528 of file filters.inl.

References lass::num::IirFilter< T, InputIterator, OutputIterator >::doMakeLaplace().

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TOutputIterator lass::num::Filter< T, InputIterator, OutputIterator >::operator() ( TInputIterator  first,
TInputIterator  last,
TOutputIterator  output 
) [inline, inherited]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
void lass::num::Filter< T, InputIterator, OutputIterator >::reset (  )  [inline, inherited]


Field Documentation

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TValues lass::num::IirFilter< T, InputIterator, OutputIterator >::xTaps_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TValues lass::num::IirFilter< T, InputIterator, OutputIterator >::yTaps_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TValues lass::num::IirFilter< T, InputIterator, OutputIterator >::xBuffer_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TValues lass::num::IirFilter< T, InputIterator, OutputIterator >::yBuffer_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TIndexTable lass::num::IirFilter< T, InputIterator, OutputIterator >::xNextIndex_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
TIndexTable lass::num::IirFilter< T, InputIterator, OutputIterator >::yNextIndex_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
size_t lass::num::IirFilter< T, InputIterator, OutputIterator >::xTapSize_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
size_t lass::num::IirFilter< T, InputIterator, OutputIterator >::yTapSize_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
size_t lass::num::IirFilter< T, InputIterator, OutputIterator >::xBufferIndex_ [private]

template<typename T , typename InputIterator = const T*, typename OutputIterator = T*>
size_t lass::num::IirFilter< T, InputIterator, OutputIterator >::yBufferIndex_ [private]


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

Generated on Mon Nov 10 14:22:10 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo