18 #ifndef itkKalmanLinearEstimator_h
19 #define itkKalmanLinearEstimator_h
23 #include "vnl/vnl_vector_fixed.h"
24 #include "vnl/vnl_matrix_fixed.h"
41 template<
typename T,
unsigned int VEstimatorDimension >
47 static constexpr
unsigned int Dimension = VEstimatorDimension;
51 using VectorType = vnl_vector_fixed< T, VEstimatorDimension >;
55 using MatrixType = vnl_matrix_fixed< T, VEstimatorDimension, VEstimatorDimension >;
134 template<
typename T,
unsigned int VEstimatorDimension >
140 ValueType measurePrediction = dot_product(newPredictor, m_Estimator);
142 ValueType errorMeasurePrediction = newMeasure - measurePrediction;
144 VectorType Corrector = m_Variance * newPredictor;
146 for (
unsigned int j = 0; j < VEstimatorDimension; j++ )
148 m_Estimator(j) += Corrector(j) * errorMeasurePrediction;
151 UpdateVariance(newPredictor);
154 template<
typename T,
unsigned int VEstimatorDimension >
161 ValueType denominator = 1.0 / ( 1.0 + dot_product(aux, newPredictor) );
163 for (
unsigned int col = 0; col < VEstimatorDimension; col++ )
165 for (
unsigned int row = 0; row < VEstimatorDimension; row++ )
167 m_Variance(col, row) -= aux(col) * aux(row) * denominator;
void UpdateWithNewMeasure(const ValueType &newMeasure, const VectorType &newPredictor)
const MatrixType & GetVariance() const
vnl_vector_fixed< T, VEstimatorDimension > VectorType
Implement a linear recursive estimator.
const VectorType & GetEstimator() const
void SetVariance(const MatrixType &m)
static constexpr unsigned int Dimension
void UpdateVariance(const VectorType &)
void SetVariance(const ValueType &var=1.0)
vnl_matrix_fixed< T, VEstimatorDimension, VEstimatorDimension > MatrixType