EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::GaussianMarginal< Source, Selection, SubSpace > Class Template Reference

Read-only view of a subset of the entries of a GaussianParams or Gaussian. More...

#include <EmrysFilter/Distributions/Gaussian.h>

Public Types

using Scalar = typename Source::Scalar
 the scalar type
using Index = Eigen::Index
 Eigen's index type.
using SpaceType = SubSpace
 the selected block's space
using ParamsType = GaussianParams<SubSpace, Scalar>
 what copy() returns
using MomentsType = typename ParamsType::MomentsType
 the mean and covariance together
using VectorType = typename ParamsType::VectorType
 a value, such as the mean
using MatrixType = typename ParamsType::MatrixType
 a matrix over differences
using ResolvedType = typename internal::SelectionHolder<Source, Selection, SubSpace>::ResolvedType
 the selection, resolved
using IndexVectorType = decltype(ResolvedType::indices)
 The selected mean entries' indices.
using DifferenceIndexVectorType = decltype(ResolvedType::differenceIndices)
 The selected covariance rows' indices.

Public Member Functions

 GaussianMarginal (Source const &source, Selection const &selection, SubSpace space)
 Selects selection's coordinates, which form space.
 GaussianMarginal (Source const &source, Selection shared)
 Selects the coordinates of source that shared resolved, borrowing them.
Index valueDimension () const
Index differenceDimension () const
SubSpace const & space () const
IndexVectorType const & indices () const
DifferenceIndexVectorType const & differenceIndices () const
auto mean () const
auto covarianceLower () const
MomentsType moments () const
ParamsType copy () const
std::expected< MatrixType, GaussianError > covariance () const
std::expected< MatrixType, GaussianError > precision () const
std::expected< MatrixType, GaussianError > covarianceRoot () const
std::expected< MatrixType, GaussianError > precisionRoot () const

Static Public Attributes

static constexpr int ValueDimensionAtCompileTime = valueDimensionAtCompileTime<SubSpace>
 the length of a value, or Eigen::Dynamic
static constexpr int MaxValueDimensionAtCompileTime = maxValueDimensionAtCompileTime<SubSpace>
 a bound on the length of a value, or Eigen::Dynamic
static constexpr int DifferenceDimensionAtCompileTime = valueDimensionAtCompileTime<DifferenceSpace<SubSpace>>
 the length of a difference and the rows of the covariance, or Eigen::Dynamic
static constexpr int MaxDifferenceDimensionAtCompileTime
 a bound on the length of a difference, or Eigen::Dynamic
static constexpr bool IsInfoForm = false
 a block of the covariance, not of the precision [gaussian-forms]
static constexpr bool IsSqrtForm = false
 a block of the covariance whole, not of a factor [gaussian-forms]

Detailed Description

template<typename Source, typename Selection, typename SubSpace>
class Emrys::GaussianMarginal< Source, Selection, SubSpace >

Read-only view of a subset of the entries of a GaussianParams or Gaussian.

Obtained from GaussianParams::marginal() or Gaussian::marginal(), and held by auto: its Selection is internal, so its type is never spelled, and a function that takes one takes it as a template parameter. Of GaussianParams it checks their shape (values may change underneath it, size may not); of a Gaussian it holds a copy of the view, and so the view's check. A marginal of a mixture or a hybrid gives one per component, which borrows the selection that marginal resolved once, and must not outlive it.

mean() and covarianceLower() return lazy Eigen expressions that must not outlive the marginal. covarianceLower() reads only the source's lower triangle. The dimensions are known at compile time when the selected block's sizes are. It is a GaussianForm, with the four fallible accessors of every form, so code generic over the forms takes it as it takes the other forms' marginals, which are parameters (decisions.md [form-densities]).

Template Parameters
SourceGaussianParams or Gaussian
Selectionan internal::Coordinates of the index sets of the selected block, from idx() for the mean and diffIdx() for the covariance, or an internal::SharedSelection of a selection resolved already
SubSpacespace of the selected block

Member Function Documentation

◆ copy()

template<typename Source, typename Selection, typename SubSpace>
ParamsType Emrys::GaussianMarginal< Source, Selection, SubSpace >::copy ( ) const
inlinenodiscard
Returns
an independent Gaussian holding this marginal, in its space

◆ covariance()

template<typename Source, typename Selection, typename SubSpace>
std::expected< MatrixType, GaussianError > Emrys::GaussianMarginal< Source, Selection, SubSpace >::covariance ( ) const
inlinenodiscard
Returns
the selected block of the covariance, evaluated. Never fails: it returns std::expected, as GaussianParams::covariance() does, so that a marginal is a GaussianForm (decisions.md [form-densities]).

◆ covarianceLower()

template<typename Source, typename Selection, typename SubSpace>
auto Emrys::GaussianMarginal< Source, Selection, SubSpace >::covarianceLower ( ) const
inlinenodiscard
Returns
the selected block of the source's covariance, read from its lower triangle, as a lazy expression

◆ covarianceRoot()

template<typename Source, typename Selection, typename SubSpace>
std::expected< MatrixType, GaussianError > Emrys::GaussianMarginal< Source, Selection, SubSpace >::covarianceRoot ( ) const
inlinenodiscard
Returns
the lower-triangular Cholesky factor \( L \) of the selected block's covariance, as GaussianParams::covarianceRoot() gives it, or the GaussianError of its factorization

◆ differenceDimension()

template<typename Source, typename Selection, typename SubSpace>
Index Emrys::GaussianMarginal< Source, Selection, SubSpace >::differenceDimension ( ) const
inlinenodiscard
Returns
the number of selected covariance rows

◆ differenceIndices()

template<typename Source, typename Selection, typename SubSpace>
DifferenceIndexVectorType const & Emrys::GaussianMarginal< Source, Selection, SubSpace >::differenceIndices ( ) const
inlinenodiscard
Returns
the source's covariance rows this marginal selects

◆ indices()

template<typename Source, typename Selection, typename SubSpace>
IndexVectorType const & Emrys::GaussianMarginal< Source, Selection, SubSpace >::indices ( ) const
inlinenodiscard
Returns
the source's mean entries this marginal selects

◆ mean()

template<typename Source, typename Selection, typename SubSpace>
auto Emrys::GaussianMarginal< Source, Selection, SubSpace >::mean ( ) const
inlinenodiscard
Returns
the selected entries of the source's mean, as a lazy expression

◆ moments()

template<typename Source, typename Selection, typename SubSpace>
MomentsType Emrys::GaussianMarginal< Source, Selection, SubSpace >::moments ( ) const
inlinenodiscard
Returns
the selected mean and covariance, evaluated

◆ precision()

template<typename Source, typename Selection, typename SubSpace>
std::expected< MatrixType, GaussianError > Emrys::GaussianMarginal< Source, Selection, SubSpace >::precision ( ) const
inlinenodiscard
Returns
the precision of the selected block, the inverse of its covariance, or the GaussianError of its factorization, which a view does not cache (decisions.md [view-stamp]) and so makes on each call

◆ precisionRoot()

template<typename Source, typename Selection, typename SubSpace>
std::expected< MatrixType, GaussianError > Emrys::GaussianMarginal< Source, Selection, SubSpace >::precisionRoot ( ) const
inlinenodiscard
Returns
\( L^{-1} \), lower triangular, as GaussianParams::precisionRoot() gives it, or the GaussianError of the factorization

◆ space()

template<typename Source, typename Selection, typename SubSpace>
SubSpace const & Emrys::GaussianMarginal< Source, Selection, SubSpace >::space ( ) const
inlinenodiscard
Returns
the selected block's space, with its parameters and size

◆ valueDimension()

template<typename Source, typename Selection, typename SubSpace>
Index Emrys::GaussianMarginal< Source, Selection, SubSpace >::valueDimension ( ) const
inlinenodiscard
Returns
the number of selected mean entries

Member Data Documentation

◆ MaxDifferenceDimensionAtCompileTime

template<typename Source, typename Selection, typename SubSpace>
int Emrys::GaussianMarginal< Source, Selection, SubSpace >::MaxDifferenceDimensionAtCompileTime
staticconstexpr
Initial value:
=
constexpr int maxValueDimensionAtCompileTime
The largest valid value dimension of Space, or Eigen::Dynamic if it is unbounded.
Definition Space.h:258

a bound on the length of a difference, or Eigen::Dynamic


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