FilteredNumber Class Template Reference

#include <C:/Work/specialnumbers_svn/NumberLib/NumbersLib/FilteredNumber.h>

Inheritance diagram for FilteredNumber:

AbstractFilteredNumber

List of all members.


Detailed Description

template<class T, unsigned int sampleCount, unsigned int maxOrder>
class FilteredNumber< T, sampleCount, maxOrder >

A filtered number is a presentation of a value as a weighted sum of past values.

This weighted sum is also maintained as a FilteredNumber (with maxOrder one less), making it possible to use this class to implement an integrator (by setting all weights equal to 1).

\[ y_n = \Psi x_n = \frac{\sum_{i= n - m + 1}^n w_{n - i}x_{n}t_{n}}{\sum_{i = n - m + 1}^nw_{n - i}t_n} \]

Definition at line 21 of file FilteredNumber.h.


Public Member Functions

 FilteredNumber (T initialValue, T weights[])
 Constructs a new filtered number.
getSample (int i) const
 Used for debugging and testing only!
getValue (unsigned int order=1) const
 Gets the filtered value of the given order.
getWeight (int i) const
 Used for debugging and testing only!
void setValue (T value, float elapsedTime=TIME_UNIT)
 Sets the last sample for this filtered number.

Private Attributes

CyclicNumber< int > mCurrentIndex
mCurrentValue
FilteredNumber< T, sampleCount,
maxOrder-1 > 
mFilteredValue
mInitialValue
mSamples [sampleCount]
mTimeSamples [sampleCount]
mWeights [sampleCount]

Constructor & Destructor Documentation

FilteredNumber ( initialValue,
weights[] 
) [inline]

Constructs a new filtered number.

Parameters:
initialValue A zero of type T.
weights The weights with which samples will be multiplied. The size of the array must be sampleCount.

Definition at line 72 of file FilteredNumber.h.

References mSamples, mTimeSamples, and mWeights.


Member Function Documentation

T getSample ( int  i  )  const [inline]

Used for debugging and testing only!

Definition at line 131 of file FilteredNumber.h.

References mSamples.

T getValue ( unsigned int  order = 1  )  const [inline]

Gets the filtered value of the given order.

Definition at line 112 of file FilteredNumber.h.

References mCurrentValue, mFilteredValue, and mInitialValue.

T getWeight ( int  i  )  const [inline]

Used for debugging and testing only!

Definition at line 137 of file FilteredNumber.h.

References mWeights.

void setValue ( value,
float  elapsedTime = TIME_UNIT 
) [inline]

Sets the last sample for this filtered number.

This is the value returned by getValue(0) (that is, when the order is 0).

Parameters:
value The last sample value.
elapsedTime The time elapsed since the last sample was set.

Definition at line 88 of file FilteredNumber.h.

References mCurrentIndex, mCurrentValue, mFilteredValue, mInitialValue, mSamples, mTimeSamples, and mWeights.


Member Data Documentation

CyclicNumber<int> mCurrentIndex [private]

Definition at line 30 of file FilteredNumber.h.

Referenced by FilteredNumber< T, sampleCount, 1 >::setValue(), and setValue().

T mCurrentValue [private]

FilteredNumber<T, sampleCount, maxOrder - 1> mFilteredValue [private]

T mInitialValue [private]

T mSamples[sampleCount] [private]

T mTimeSamples[sampleCount] [private]

T mWeights[sampleCount] [private]


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

Generated on Sun Sep 21 20:49:08 2008 for Numbers by  doxygen 1.5.6