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

Read-only view of a subset of the coordinates of every component of a mixture or a hybrid, which iterates the components and gives each one's marginal in turn (decisions.md [element-marginals]). More...

#include <EmrysFilter/Distributions/Mixture.h>

Classes

struct  Element
 One component's log-weight, as in the source, and its marginal. More...

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 allocator_type = typename Source::allocator_type
 the source's allocator
using ComponentType = typename Source::ComponentType
 a component of the source
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.
using ComponentMarginalType
 The marginal of one component, which borrows this view's selection.
using value_type = Element
 an element, made when read
using const_iterator = internal::ElementIterator<MixtureMarginal>
 iterates the elements
using iterator = const_iterator
 iterates the elements; they are read-only
using ParamsType
 what copy() returns: the container of the components' marginals, as parameters

Public Member Functions

 MixtureMarginal (Source const &source, Selection const &selection, SubSpace space)
 Selects selection's coordinates, which form space.
 MixtureMarginal (Source const &source, Selection shared)
 Selects the coordinates of source that shared resolved, borrowing them.
SubSpace const & space () const
allocator_type get_allocator () const
Index size () const
Index valueDimension () const
Index differenceDimension () const
IndexVectorType const & indices () const
DifferenceIndexVectorType const & differenceIndices () const
Element operator[] (Index i) const
const_iterator begin () const
const_iterator end () const
ParamsType copy () const
ParamsType copy (allocator_type const &allocator) const
 copy() with storage from allocator.

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 a covariance, or Eigen::Dynamic
static constexpr int MaxDifferenceDimensionAtCompileTime
 a bound on the length of a difference, or Eigen::Dynamic

Detailed Description

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

Read-only view of a subset of the coordinates of every component of a mixture or a hybrid, which iterates the components and gives each one's marginal in turn (decisions.md [element-marginals]).

Obtained from marginal() of MixtureParams, Mixture, or Hybrid, 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. It is a random-access range whose elements, made when read, hold a component's log-weight and the marginal of the component, as the entries of a mixture hold its log-weight and the component: a GaussianMarginal for a Gaussian, and a MixtureMarginal of the modes for a Hybrid. Nothing is copied, and nothing allocates: the selected coordinates are resolved once, here, and every component's marginal borrows them, so an element must not outlive this view. Of parameters it checks their shape, each time an element is made; of a Mixture it holds a copy of the view, and so the view's check. Weights are those of the source.

for (auto const & [logWeight, position] : mixture.marginal<Position>())
{
position.mean(); // the component's mean position, read in place
}
Template Parameters
Sourcea MixtureParams, a Mixture, or a Hybrid
Selectionan internal::Coordinates of the index sets of the selected block, from idx() for the means and diffIdx() for the covariances, or an internal::SharedSelection of a selection resolved already
SubSpacespace of the selected block

Member Typedef Documentation

◆ ComponentMarginalType

template<typename Source, typename Selection, typename SubSpace>
using Emrys::MixtureMarginal< Source, Selection, SubSpace >::ComponentMarginalType
Initial value:
typename ComponentTraits<
ComponentType>::template MarginalType<internal::SharedSelection<ResolvedType>, SubSpace>
typename Source::ComponentType ComponentType
a component of the source
Definition Mixture.h:2444
What a container does with a component beyond the component's own members (decisions....
Definition Component.h:104

The marginal of one component, which borrows this view's selection.

◆ ParamsType

template<typename Source, typename Selection, typename SubSpace>
using Emrys::MixtureMarginal< Source, Selection, SubSpace >::ParamsType
Initial value:
typename internal::ElementsOf<Source>::template CopyType<typename ComponentMarginalType::ParamsType>

what copy() returns: the container of the components' marginals, as parameters

Member Function Documentation

◆ begin()

template<typename Source, typename Selection, typename SubSpace>
const_iterator Emrys::MixtureMarginal< Source, Selection, SubSpace >::begin ( ) const
inlinenodiscard
Returns
an iterator to the first component's element

◆ copy()

template<typename Source, typename Selection, typename SubSpace>
ParamsType Emrys::MixtureMarginal< Source, Selection, SubSpace >::copy ( ) const
inlinenodiscard
Returns
an independent container of the parameters of each component's marginal: a MixtureParams with the source's weights, or a Hybrid with its modes, with the source's allocator

◆ differenceDimension()

template<typename Source, typename Selection, typename SubSpace>
Index Emrys::MixtureMarginal< Source, Selection, SubSpace >::differenceDimension ( ) const
inlinenodiscard
Returns
the number of rows and columns of every marginal component's covariance

◆ differenceIndices()

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

◆ end()

template<typename Source, typename Selection, typename SubSpace>
const_iterator Emrys::MixtureMarginal< Source, Selection, SubSpace >::end ( ) const
inlinenodiscard
Returns
an iterator past the last component's element

◆ get_allocator()

template<typename Source, typename Selection, typename SubSpace>
allocator_type Emrys::MixtureMarginal< Source, Selection, SubSpace >::get_allocator ( ) const
inlinenodiscard
Returns
the source's allocator

◆ indices()

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

◆ operator[]()

template<typename Source, typename Selection, typename SubSpace>
Element Emrys::MixtureMarginal< Source, Selection, SubSpace >::operator[] ( Index i) const
inlinenodiscard
Returns
component i's log-weight and marginal, which must not outlive this view

◆ size()

template<typename Source, typename Selection, typename SubSpace>
Index Emrys::MixtureMarginal< Source, Selection, SubSpace >::size ( ) const
inlinenodiscard
Returns
the number of components

◆ space()

template<typename Source, typename Selection, typename SubSpace>
SubSpace const & Emrys::MixtureMarginal< 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::MixtureMarginal< Source, Selection, SubSpace >::valueDimension ( ) const
inlinenodiscard
Returns
the number of coordinates of every marginal component's mean

Member Data Documentation

◆ MaxDifferenceDimensionAtCompileTime

template<typename Source, typename Selection, typename SubSpace>
int Emrys::MixtureMarginal< 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: