EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::Hybrid< Component_, ModeSpace_, Allocator_ > Class Template Reference

The density of a hybrid state, a checked view of its HybridParams (decisions.md [params-and-density], [view-stamp]): \( p(x, m) = P(m) \, p_m(x) \), with \( P(m) = w_m / \sum_n w_n \). More...

#include <EmrysFilter/Distributions/Hybrid.h>

Public Types

using ParamsType = HybridParams<Component_, ModeSpace_, Allocator_>
 the parameters it reads
using ComponentType = typename ParamsType::ComponentType
 the component given one mode
using Scalar = typename ParamsType::Scalar
 the scalar type
using SpaceType = typename ParamsType::SpaceType
 the continuous state space
using ModeSpaceType = ModeSpace_
 the discrete mode space
using ModesType = typename ParamsType::ModesType
 the weights of the modes
using MomentsType = typename ParamsType::MomentsType
 a mean and covariance together
using allocator_type = Allocator_
 the parameters' allocator

Public Member Functions

SpaceType const & space () const
ModeSpace_ const & modeSpace () const
Eigen::Index size () const
Eigen::Index valueDimension () const
Eigen::Index differenceDimension () const
allocator_type get_allocator () const
ModesType const & modes () const
ComponentType const & conditional (Eigen::Index mode) const
template<typename Derived>
Scalar logDensity (Eigen::MatrixBase< Derived > const &x) const
template<typename Derived>
Scalar density (Eigen::MatrixBase< Derived > const &x) const
MomentsType moments () const
ComponentType collapsed () const
template<typename P>
auto collapse () const

Static Public Attributes

static constexpr int ValueDimensionAtCompileTime = ParamsType::ValueDimensionAtCompileTime
 the length of a value, or Eigen::Dynamic
static constexpr int MaxValueDimensionAtCompileTime = ParamsType::MaxValueDimensionAtCompileTime
 a bound on the length of a value, or Eigen::Dynamic
static constexpr int DifferenceDimensionAtCompileTime = ParamsType::DifferenceDimensionAtCompileTime
 the length of a difference and the rows of a covariance, or Eigen::Dynamic
static constexpr int MaxDifferenceDimensionAtCompileTime = ParamsType::MaxDifferenceDimensionAtCompileTime
 a bound on the length of a difference, or Eigen::Dynamic
static constexpr bool IsParams = false
 a view: it checks its parameters

Detailed Description

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
class Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >

The density of a hybrid state, a checked view of its HybridParams (decisions.md [params-and-density], [view-stamp]): \( p(x, m) = P(m) \, p_m(x) \), with \( P(m) = w_m / \sum_n w_n \).

HybridParams::toDensity() makes one after checking the mode weights and factorizing every component, so the log-density, the moments, and the collapses below read components that are distributions. A hybrid is a component (see Component) by this name, as a Gaussian is by Gaussian: MixtureParams<HybridGaussian<State, Mode>> stores HybridGaussianParams.

auto const density = x.toDensity(); // x a HybridGaussianParams<State, Mode>
density->logDensity(value); // log p(value), summed over the modes
density->moments(); // the mean and covariance over every mode
density->collapsed(); // one GaussianParams, moment-matched over the modes
density->collapse<Maneuver>(); // HybridGaussianParams<State, Maneuver>, grouped by maneuver
Scalar density(Eigen::MatrixBase< Derived > const &x) const
Definition Hybrid.h:623
Template Parameters
Component_the component given a mode (see Component)
ModeSpace_the discrete mode space (see Discrete spaces)
Allocator_the parameters' allocator (see Allocation)
See also
class HybridParams, HybridGaussian

Member Function Documentation

◆ collapse()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
template<typename P>
auto Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::collapse ( ) const
inlinenodiscard
Returns
the hybrid state over the mode axis named by the path P (a tag or a TagPath) alone, as parameters: its marginal weights, and for each of its values, the components of the modes with that value moment-matched into one. This is collapse grouped by mode. It has the parameters' allocator.

◆ collapsed()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
ComponentType Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::collapsed ( ) const
inlinenodiscard
Returns
the state as one component, moment-matched over the modes (see ComponentTraits)

◆ conditional()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
ComponentType const & Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::conditional ( Eigen::Index mode) const
inlinenodiscard
Returns
the component given the mode with flat index mode, factorized

◆ density()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
template<typename Derived>
Scalar Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::density ( Eigen::MatrixBase< Derived > const & x) const
inlinenodiscard
Returns
the density at x, the exponential of logDensity()

◆ differenceDimension()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
Eigen::Index Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::differenceDimension ( ) const
inlinenodiscard
Returns
the number of rows and columns of every component's covariance (see Spaces)

◆ get_allocator()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
allocator_type Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::get_allocator ( ) const
inlinenodiscard
Returns
the parameters' allocator

◆ logDensity()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
template<typename Derived>
Scalar Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::logDensity ( Eigen::MatrixBase< Derived > const & x) const
inlinenodiscard
Returns
the log of the density at x, \( \log \sum_m P(m) \, p_m(x) \), over the modes: read from the components' factorizations under this view's check (see ComponentTraits)

◆ modes()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
ModesType const & Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::modes ( ) const
inlinenodiscard
Returns
the weights of the modes, which define a distribution

◆ modeSpace()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
ModeSpace_ const & Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::modeSpace ( ) const
inlinenodiscard
Returns
the discrete mode space

◆ moments()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
MomentsType Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::moments ( ) const
inlinenodiscard
Returns
the mean and covariance of the state, over every mode: a tangent-space mean, and the modes' covariances plus the spread of their means

◆ size()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
Eigen::Index Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::size ( ) const
inlinenodiscard
Returns
the number of modes

◆ space()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
SpaceType const & Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::space ( ) const
inlinenodiscard
Returns
the continuous state space

◆ valueDimension()

template<internal::ComponentOrInfoForm Component_, DiscreteSpace ModeSpace_, typename Allocator_>
Eigen::Index Emrys::Hybrid< Component_, ModeSpace_, Allocator_ >::valueDimension ( ) const
inlinenodiscard
Returns
the number of coordinates of every component's mean (see Spaces)

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