cisst-saw
Loading...
Searching...
No Matches
nmrLinearRegressionWindowSolver< _elementType > Class Template Reference

#include <nmrLinearRegression.h>

Inheritance diagram for nmrLinearRegressionWindowSolver< _elementType >:
nmrLinearRegressionSolver< _elementType > nmrLinearRegressionWindowRecursiveSolver< _elementType >

Public Member Functions

 nmrLinearRegressionWindowSolver (size_t length)
 ~nmrLinearRegressionWindowSolver ()
virtual size_t WindowLength () const
bool Sample (const _elementType &x, const _elementType &y)
bool Sample (const vctDynamicVector< _elementType > &CMN_UNUSED(x), const vctDynamicVector< _elementType > &CMN_UNUSED(y))
bool Sample (const vctDynamicConstVectorRef< _elementType > &CMN_UNUSED(x), const vctDynamicConstVectorRef< _elementType > &CMN_UNUSED(y))
bool Sample (const std::vector< _elementType > &CMN_UNUSED(x), const std::vector< _elementType > &CMN_UNUSED(y))
virtual bool Recalculate ()
bool EstimateAsFractions (SummationType &slope_num, SummationType &yint_num, SummationType &denom, SummationType *tse_num=0)
Public Member Functions inherited from nmrLinearRegressionSolver< _elementType >
 nmrLinearRegressionSolver (_elementType tol=cmnTypeTraits< _elementType >::DefaultTolerance)
virtual ~nmrLinearRegressionSolver ()
size_t NumPoints () const
_elementType GetTolerance () const
void SetTolerance (_elementType tol)
virtual void Clear ()
virtual bool Sample (const vctFixedSizeVector< _elementType, 2 > &in)
virtual bool Sample (const vctFixedSizeConstVectorRef< _elementType, 2, 1 > &in)
virtual bool Sample (const vctDynamicVector< _elementType > &x, const vctDynamicVector< _elementType > &y)
virtual bool Sample (const vctDynamicConstVectorRef< _elementType > &x, const vctDynamicConstVectorRef< _elementType > &y)
virtual bool Sample (const std::vector< _elementType > &x, const std::vector< _elementType > &y)
virtual bool Estimate (_elementType &slope, _elementType &yint, _elementType *mse=0)

Protected Types

typedef nmrLinearRegressionSolver< _elementType > BaseClass
typedef BaseClass::SummationType SummationType
typedef std::vector< vctFixedSizeVector< _elementType, 2 > > WindowType
typedef std::vector< vctFixedSizeVector< _elementType, 2 > >::iterator WindowTypeIterator

Protected Attributes

WindowType window
WindowTypeIterator iter
Protected Attributes inherited from nmrLinearRegressionSolver< _elementType >
size_t numpts
SummationType Sx
SummationType Sy
SummationType Sxx
SummationType Sxy
SummationType Syy
SummationType tolerance

Additional Inherited Members

Public Types inherited from nmrLinearRegressionSolver< _elementType >
typedef _elementType ElementType
typedef cmnTypeTraits< _elementType >::VaArgPromotion SummationType
Protected Member Functions inherited from nmrLinearRegressionSolver< _elementType >
virtual bool ComputeSums (const _elementType &x, const _elementType &y)
template<class _vectorOwnerType>
bool SampleVector (const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &x, const vctDynamicConstVectorBase< _vectorOwnerType, _elementType > &y)

Detailed Description

template<class _elementType>
class nmrLinearRegressionWindowSolver< _elementType >

This class provides a moving window linear regression solver using a least-squares solution. The window size is specified in the constructor. This implementation recomputes the intermediate sums each time the Estimate or EstimateAsFractions method is called; for a more efficient recursive implementation, use the nmrLinearRegressionWindowRecursive solver. But, note that for floating point types, there is a chance for accumulation of round-off error with the recursive solver.

Member Typedef Documentation

◆ BaseClass

template<class _elementType>
typedef nmrLinearRegressionSolver<_elementType> nmrLinearRegressionWindowSolver< _elementType >::BaseClass
protected

◆ SummationType

template<class _elementType>
typedef BaseClass::SummationType nmrLinearRegressionWindowSolver< _elementType >::SummationType
protected

◆ WindowType

template<class _elementType>
typedef std::vector<vctFixedSizeVector<_elementType, 2> > nmrLinearRegressionWindowSolver< _elementType >::WindowType
protected

◆ WindowTypeIterator

template<class _elementType>
typedef std::vector<vctFixedSizeVector<_elementType,2>>::iterator nmrLinearRegressionWindowSolver< _elementType >::WindowTypeIterator
protected

Constructor & Destructor Documentation

◆ nmrLinearRegressionWindowSolver()

template<class _elementType>
nmrLinearRegressionWindowSolver< _elementType >::nmrLinearRegressionWindowSolver ( size_t length)
inline

◆ ~nmrLinearRegressionWindowSolver()

template<class _elementType>
nmrLinearRegressionWindowSolver< _elementType >::~nmrLinearRegressionWindowSolver ( )
inline

Member Function Documentation

◆ EstimateAsFractions()

template<class _elementType>
bool nmrLinearRegressionWindowSolver< _elementType >::EstimateAsFractions ( SummationType & slope_num,
SummationType & yint_num,
SummationType & denom,
SummationType * tse_num = 0 )
inlinevirtual

Estimate the slope and y intercept as fractions: slope = slope_num/denom yint = yint_num/denom tse = tse_num/denom (total square error, divide by numpts to get mse)

Reimplemented from nmrLinearRegressionSolver< _elementType >.

◆ Recalculate()

template<class _elementType>
virtual bool nmrLinearRegressionWindowSolver< _elementType >::Recalculate ( )
inlinevirtual

Recalculate the intermediate sums

◆ Sample() [1/4]

template<class _elementType>
bool nmrLinearRegressionWindowSolver< _elementType >::Sample ( const _elementType & x,
const _elementType & y )
inlinevirtual

Sample the specified x,y pair. Always returns true, but derived classes could return false (e.g., if checking for overflow)

Reimplemented from nmrLinearRegressionSolver< _elementType >.

◆ Sample() [2/4]

template<class _elementType>
bool nmrLinearRegressionWindowSolver< _elementType >::Sample ( const std::vector< _elementType > & CMN_UNUSEDx,
const std::vector< _elementType > & CMN_UNUSEDy )
inline

◆ Sample() [3/4]

template<class _elementType>
bool nmrLinearRegressionWindowSolver< _elementType >::Sample ( const vctDynamicConstVectorRef< _elementType > & CMN_UNUSEDx,
const vctDynamicConstVectorRef< _elementType > & CMN_UNUSEDy )
inline

◆ Sample() [4/4]

template<class _elementType>
bool nmrLinearRegressionWindowSolver< _elementType >::Sample ( const vctDynamicVector< _elementType > & CMN_UNUSEDx,
const vctDynamicVector< _elementType > & CMN_UNUSEDy )
inline

◆ WindowLength()

template<class _elementType>
virtual size_t nmrLinearRegressionWindowSolver< _elementType >::WindowLength ( ) const
inlinevirtual

Member Data Documentation

◆ iter

template<class _elementType>
WindowTypeIterator nmrLinearRegressionWindowSolver< _elementType >::iter
protected

◆ window

template<class _elementType>
WindowType nmrLinearRegressionWindowSolver< _elementType >::window
protected

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