EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::Innovation< Space, Scalar > Class Template Reference

The innovation of an update: the residual \( r \) of the observation from the predicted output, normalized in the output space, and its covariance \( S \), from which the update's statistics follow (decisions.md [innovation-statistics]). More...

#include <EmrysFilter/Models/Linearization.h>

Public Types

using VectorType = typename GaussianParams<Space, Scalar>::DifferenceVectorType
 the residual's type
using MatrixType = typename GaussianParams<Space, Scalar>::MatrixType
 the covariance's type

Public Member Functions

template<MatrixExpression Residual, MatrixExpression Cov>
 Innovation (Residual &&residual, Cov &&cov, std::optional< internal::InnovationStatistics< Scalar > > statistics=std::nullopt)
 The innovation with residual residual and covariance cov, moving either one passed as an rvalue of the stored type, and the statistics statistics if the caller has them.
template<MatrixExpression Residual, typename MakeCov, typename Condition>
 Innovation (internal::InnovationInPlace, Residual &&residual, MakeCov const &makeCov, Condition const &condition)
 The innovation with residual residual and the covariance makeCov returns, made where the innovation keeps it, and the statistics condition returns when called with the two as kept: an update conditions on the innovation it returns without copying \( S \) (decisions.md [borrowed-intermediates]), and may replace \( S \) there with the matrix it repaired it to (decisions.md [innovation-cholesky]).
VectorType const & residual () const
MatrixType const & covarianceLower () const
Eigen::Index differenceDimension () const
Scalar nis () const
Scalar logLikelihood () const

Detailed Description

template<typename Space, typename Scalar = double>
class Emrys::Innovation< Space, Scalar >

The innovation of an update: the residual \( r \) of the observation from the predicted output, normalized in the output space, and its covariance \( S \), from which the update's statistics follow (decisions.md [innovation-statistics]).

nis() and logLikelihood() are computed from a Cholesky factorization of \( S \) the first time either is asked for, and kept, unless the update that made the innovation had them already from the factorization that gave its gain, as every update that weights branches by them, or whose filter's policy reads them, does (decisions.md [innovation-statistics]). \( S \) must be positive definite, as the covariance of every innovation an update returns is (decisions.md [innovation-cholesky]). Only the lower triangle of \( S \) is read.

Keeping the statistics writes through const, so the first call to either function is not safe on one innovation from two threads at once. To share an innovation between threads, call nis() or logLikelihood() on it once first; after that, both only read.

Template Parameters
Spacethe output's space, whose differences the residual is in

Constructor & Destructor Documentation

◆ Innovation()

template<typename Space, typename Scalar = double>
template<MatrixExpression Residual, typename MakeCov, typename Condition>
Emrys::Innovation< Space, Scalar >::Innovation ( internal::InnovationInPlace ,
Residual && residual,
MakeCov const & makeCov,
Condition const & condition )
inline

The innovation with residual residual and the covariance makeCov returns, made where the innovation keeps it, and the statistics condition returns when called with the two as kept: an update conditions on the innovation it returns without copying \( S \) (decisions.md [borrowed-intermediates]), and may replace \( S \) there with the matrix it repaired it to (decisions.md [innovation-cholesky]).

For the library's updates; condition returns std::optional<InnovationStatistics<Scalar>>.

Member Function Documentation

◆ covarianceLower()

template<typename Space, typename Scalar = double>
MatrixType const & Emrys::Innovation< Space, Scalar >::covarianceLower ( ) const
inlinenodiscard
Returns
the covariance \( S \); only its lower triangle is guaranteed to be read

◆ differenceDimension()

template<typename Space, typename Scalar = double>
Eigen::Index Emrys::Innovation< Space, Scalar >::differenceDimension ( ) const
inlinenodiscard
Returns
the number of coordinates of the residual, the degrees of freedom of the NIS

◆ logLikelihood()

template<typename Space, typename Scalar = double>
Scalar Emrys::Innovation< Space, Scalar >::logLikelihood ( ) const
inlinenodiscard
Returns
the log-likelihood of the observation, \( \log \mathcal{N}(r; 0, S) \)

◆ nis()

template<typename Space, typename Scalar = double>
Scalar Emrys::Innovation< Space, Scalar >::nis ( ) const
inlinenodiscard
Returns
the normalized innovation squared \( r^T S^{-1} r \), chi-squared with differenceDimension() degrees of freedom for a consistent filter

◆ residual()

template<typename Space, typename Scalar = double>
VectorType const & Emrys::Innovation< Space, Scalar >::residual ( ) const
inlinenodiscard
Returns
the residual \( r \)

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