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

A weighting of a space's differences, built by tag path: the ground metric of wasserstein(). More...

#include <EmrysFilter/Distributions/Divergence.h>

Public Types

using SpaceType = Space_
 the space whose differences are measured
using Scalar = Scalar_
 the scalar type
using Index = Eigen::Index
 Eigen's index type.
using MatrixType = typename Moments<Space_, Scalar_>::MatrixType
 \( W \)'s type, square over differences

Public Member Functions

 GroundMetric (Space_ space)
 The identity on space: each difference measured by its Euclidean norm.
template<typename Path>
void scale (Scalar factor)
 Multiplies the measured coordinates of the block named by Path (a tag or a TagPath) by factor.
template<typename Into, typename From>
void combine (Scalar factor)
 Adds factor times the measured coordinates of the block named by From to those of Into, coordinate by coordinate: Into then measures \( \delta_{\mathrm{Into}} + \mathrm{factor} \, \delta_{\mathrm{From}} \).
MatrixType const & matrix () const
Space_ const & space () const

Detailed Description

template<Space Space_, RealScalar Scalar_ = double>
class Emrys::GroundMetric< Space_, Scalar_ >

A weighting of a space's differences, built by tag path: the ground metric of wasserstein().

A matrix \( W \) with a row and a column per difference coordinate measures a difference \( \delta \) as \( \|W \delta\| \). It starts as the identity, and each call applies a map to the measured coordinates, so the calls compose in the order they are made: scale() multiplies a block's rows, and combine() adds a multiple of one block's rows to another's.

Weighting expresses what an error costs, in units chosen by the caller, where a covariance says how uncertain it is. To value every state by the error in position it causes over a look-ahead time \( T \):

auto metric = GroundMetric{State{}};
metric.combine<Position, Velocity>(T); // position T seconds ahead
metric.combine<Position, AccelerometerBias>(T * T / 2);
metric.scale<Velocity>(0); // measured only through position
metric.scale<AccelerometerBias>(0);
double const distance = wasserstein(p.toDensity().value(), q.toDensity().value(), metric);
GroundMetric(Space_ space)
The identity on space: each difference measured by its Euclidean norm.
Definition Divergence.h:200
P::Scalar wasserstein(P const &p, Q const &q)
Definition Divergence.h:1198

Any matrix with a column per difference coordinate serves as well; this builds the square ones by name.

Template Parameters
Space_the space whose differences are measured
Scalar_scalar type, double by default

Member Function Documentation

◆ combine()

template<Space Space_, RealScalar Scalar_ = double>
template<typename Into, typename From>
void Emrys::GroundMetric< Space_, Scalar_ >::combine ( Scalar factor)
inline

Adds factor times the measured coordinates of the block named by From to those of Into, coordinate by coordinate: Into then measures \( \delta_{\mathrm{Into}} + \mathrm{factor} \, \delta_{\mathrm{From}} \).

The two blocks must have the same difference dimension.

◆ matrix()

template<Space Space_, RealScalar Scalar_ = double>
MatrixType const & Emrys::GroundMetric< Space_, Scalar_ >::matrix ( ) const
inlinenodiscard
Returns
\( W \)

◆ scale()

template<Space Space_, RealScalar Scalar_ = double>
template<typename Path>
void Emrys::GroundMetric< Space_, Scalar_ >::scale ( Scalar factor)
inline

Multiplies the measured coordinates of the block named by Path (a tag or a TagPath) by factor.

A factor of zero leaves the block measured only through what has been combined into other blocks.

◆ space()

template<Space Space_, RealScalar Scalar_ = double>
Space_ const & Emrys::GroundMetric< Space_, Scalar_ >::space ( ) const
inlinenodiscard
Returns
the space whose differences are measured

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