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

The interacting multiple model (IMM) filter's steps over a hybrid state, without the state: a switching process model, the method that predicts the modes whose models carry none of their own, and the scratch the modes are mixed and updated into, acting on a Hybrid passed in (decisions.md [filters-and-recursions]). More...

#include <EmrysFilter/Filters/ImmFilter.h>

Classes

struct  UpdateTypeOf
 UpdateType<M>, named without being formed (see internal::UnlessGivenBlock). More...

Public Types

using Scalar = typename Params<Component_>::Scalar
 the scalar type
using SpaceType = typename Params<Component_>::SpaceType
 the state space
using ModelType = Model_
 the switching model
using MethodType = Method_
 the prediction method
using ModeSpaceType = typename Model_::ModeSpaceType
 the discrete mode space
using ComponentType = Params<Component_>
 one mode's component
using StateType = HybridParams<Component_, ModeSpaceType, Allocator_>
 the state the steps act on
using allocator_type = Allocator_
 the scratch's allocator
using JointType = HybridPredictedJoint<SpaceType, ModeSpaceType, Scalar, Allocator_>
 what predictJoint() records
template<Measurement M>
using MeasuredType = typename internal::ImmMeasured<ComponentType, M>::type
 The MeasurementUpdate of M on one mode's component, or, for a square-root form, the FilterUpdate of its one branch.
template<Measurement M>
using ResultType
 What update() with M fills when given a result: one branch per mode for noise by mode axis, every noise component's branch otherwise.
template<Measurement M>
using UpdateType = std::expected<ResultType<M>, NumericError>
 What update() with M returns: the ResultType in a std::expected (decisions.md [innovation-cholesky]).
template<typename S>
using SwitchingResultType = ResultType<typename S::template MeasurementType<0>>
 What update() with the SwitchingMeasurement S fills when given a result: the ResultType of its first measurement, which every one of its measurements shares.
template<typename S>
using SwitchingUpdateType = std::expected<SwitchingResultType<S>, NumericError>
 What update() with the SwitchingMeasurement S returns: the SwitchingResultType in a std::expected.
template<Measurement M, typename Space, typename P>
using GivenMeasuredType
 The MeasurementUpdate of M on one mode's Gaussian, with the block named by the path P of a state in Space given (see update(state, measurement, pinned, policy)).
template<Measurement M, typename Space, typename P>
using GivenResultType
 What update(state, measurement, pinned, policy) with M fills when given a result: one branch per mode for noise by mode axis, as ResultType has.
template<Measurement M, typename Space, typename P>
using GivenUpdateType = std::expected<GivenResultType<M, Space, P>, NumericError>
 What update(state, measurement, pinned, policy) with M returns.

Public Member Functions

 ImmRecursion (Model_ model, MethodFor< Model_, Method_ > method={}, Allocator_ const &allocator={})
 The recursion with switching model model and prediction method method, which the modes whose models carry none of their own predict by, with scratch for every mode from allocator.
allocator_type get_allocator () const
void resetScratch (Allocator_ const &allocator)
 Replaces the scratch with storage from allocator, when a state from another allocator arrives.
Model_ const & model () const
Model_ & model ()
Method_ const & method () const
ModeSpaceType const & modeSpace () const
bool partitions (SpaceType const &space) const
template<typename... Inputs>
requires (!isFixedStep<Model_>)
auto predict (StateType &state, TimeStep< Scalar > auto const &dt, Inputs const &... inputs)
 Mixes state's components through the chain, moves each by dt, any TimeStep (see Time steps), through its mode's process model, with inputs passed as in Emrys::predict(), and moves the mode probabilities one step of the chain.
template<typename... Inputs>
requires isFixedStep<Model_>
auto predict (StateType &state, Inputs const &... inputs)
 Mixes state's components through the chain, moves each by its mode's fixed-step model's step, by that model's method, with inputs passed as in Emrys::predict(), and moves the mode probabilities one step of the chain, returning as predict(state, dt, inputs...) does.
template<typename... Inputs>
requires (!isFixedStep<Model_> && !IsForm)
JointType predictJoint (StateType &state, TimeStep< Scalar > auto const &dt, Inputs const &... inputs)
 Moves state forward as predict(state, dt, inputs...) does.
template<typename JointAllocator, typename... Inputs>
requires (!isFixedStep<Model_> && !IsForm)
void predictJoint (StateType &state, TimeStep< Scalar > auto const &dt, HybridPredictedJoint< SpaceType, ModeSpaceType, Scalar, JointAllocator > &joint, Inputs const &... inputs)
 As predictJoint(state, dt, inputs...), but into joint, whose storage is reused: with the same joint at every step, recording allocates nothing once it has been filled.
template<typename... Inputs>
requires (isFixedStep<Model_> && !IsForm)
JointType predictJoint (StateType &state, Inputs const &... inputs)
 Moves state forward as predict(state, inputs...) does with fixed-step models.
template<typename JointAllocator, typename... Inputs>
requires (isFixedStep<Model_> && !IsForm)
void predictJoint (StateType &state, HybridPredictedJoint< SpaceType, ModeSpaceType, Scalar, JointAllocator > &joint, Inputs const &... inputs)
 As predictJoint(state, inputs...), but into joint, whose storage is reused.
template<Measurement M, typename Policy = reductions::Collapse>
requires (!internal::isGivenBlock<Policy>)
internal::UnlessGivenBlock< UpdateTypeOf< M >, Policy >::type update (StateType &state, M const &measurement, Policy const &policy={})
 Conditions each of state's components on measurement, by the measurement's own method, reduces its branches with policy (Collapse, Select, or a Gate), and multiplies each mode's probability by \( p(z \mid m) \).
template<Measurement M, typename Policy, typename ModeUpdate, typename ResultAllocator>
std::expected< void, NumericError > update (StateType &state, M const &measurement, Policy const &policy, ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > &result)
 As update(state, measurement, policy), but into result, whose storage is reused: with the same result at every step, an update allocates nothing once it has been as large.
template<typename P, Measurement... Ms, typename Policy = reductions::Collapse>
SwitchingUpdateType< SwitchingMeasurement< P, Ms... > > update (StateType &state, SwitchingMeasurement< P, Ms... > const &measurement, Policy const &policy={})
 As update(state, measurement, policy), but with a measurement per value of the mode axis that measurement names (see SwitchingMeasurement): each mode is updated by the measurement that its value in that axis selects, and its own likelihood \( p(z \mid m) \) reweights it.
template<typename P, Measurement... Ms, typename Policy, typename ModeUpdate, typename ResultAllocator>
std::expected< void, NumericError > update (StateType &state, SwitchingMeasurement< P, Ms... > const &measurement, Policy const &policy, ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > &result)
 As update(state, measurement, policy) with a SwitchingMeasurement, but into result, whose storage is reused.
template<Measurement M, typename Space, typename P, typename Value, typename Policy = reductions::Collapse>
requires (!IsForm)
GivenUpdateType< M, Space, P > update (StateType &state, M const &measurement, GivenBlock< Space, P, Value > const &pinned, Policy const &policy={})
 As update(state, measurement, policy), but with state a hybrid over the rest of a state and the block that pinned names given separately, as given() makes it: each mode's Gaussian is conditioned as update(prior, measurement, given) conditions one.
template<Measurement M, typename Space, typename P, typename Value, typename Policy, typename ModeUpdate, typename ResultAllocator>
requires (!IsForm)
std::expected< void, NumericError > update (StateType &state, M const &measurement, GivenBlock< Space, P, Value > const &pinned, Policy const &policy, ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > &result)
 As update(state, measurement, pinned, policy), but into result, whose storage is reused.
template<typename Space, typename P, typename M, typename Value, typename Policy, typename ModeUpdate, typename ResultAllocator>
requires (!IsForm && !internal::isByMode<M>)
std::expected< void, NumericError > updateGiven (StateType &state, internal::PinnedMeasurement< Space, P, M > const &f, Value const &value, Policy const &policy, ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > &result)
 As update(state, measurement, pinned, policy, result), with the measurement over the rest and the given block already resolved as f and the block's value value: a caller that updates many hybrids, each given its own value, resolves the measurement once.
template<Measurement M>
ResultType< M > emptyUpdate (Allocator_ const &allocator, Eigen::Index modes) const
template<Measurement M, typename Space, typename P>
GivenResultType< M, Space, P > emptyGivenUpdate (Allocator_ const &allocator, Eigen::Index modes) const
JointType emptyJoint (StateType const &state) const

Static Public Attributes

static constexpr bool Reentrant = false
 the steps write the scratch, so they run one at a time

Detailed Description

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
class Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >

The interacting multiple model (IMM) filter's steps over a hybrid state, without the state: a switching process model, the method that predicts the modes whose models carry none of their own, and the scratch the modes are mixed and updated into, acting on a Hybrid passed in (decisions.md [filters-and-recursions]).

predict() first mixes: the component that mode j starts from is the collapse of every mode's component, weighted by the probability \( \mu_{i \mid j} \propto \Pi_{ij} \mu_i \) that the target was in mode i given that it is now in j. Each mixed component is then predicted through its mode's process model, by the model's own method where it carries one (withMethod(), FixedStepModel) and by the recursion's otherwise [switching-models], and the mode probabilities move one step of the chain. When the chain is the identity, the mixing would give each mode its own component, so predict() moves each as it is and leaves the probabilities. update() updates each mode's component as a KalmanRecursion would and multiplies each mode's probability by \( p(z \mid m) \).

The components may be in square-root form (decisions.md [gaussian-forms]): the mixing collapses factors by triangularization (see ComponentTraits), each mode predicts and updates in place as a KalmanRecursion over the form does, so predict() returns a std::expected, and the policy is Collapse alone, the form's update having one branch. predictJoint() is the covariance form's.

The interacting multiple model algorithm of Blom and Bar-Shalom (1988), as given in Hashimzade et al. (2024), ยง2.2.3, Algorithm 2 with one lag: mixing, mode-matched filtering, mode probability update, and the combined estimate as the state's collapsed().

ImmFilter owns a hybrid and runs this on it; MixtureFilter runs it on each hybrid of a mixture of hybrids, in order, since the scratch is one per recursion (not Reentrant). The scratch comes from the allocator the recursion is given, which must equal the hybrids' (see Allocation).

Template Parameters
Component_the component given one mode (see Component), such as a Gaussian
Model_a SwitchingModel over the mode space, of process models whose blocks partition the state space; with fixed-step models, predict() takes no time step
Method_the prediction method of every mode whose model carries none of its own (see withMethod()); ModelsMethod with fixed-step models, which all carry one
Allocator_the hybrid's allocator (see Allocation)
See also
ImmFilter, class Hybrid

Member Typedef Documentation

◆ GivenMeasuredType

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Space, typename P>
using Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::GivenMeasuredType
Initial value:
typename decltype(internal::updateBranchesWith<true>(
std::declval<ComponentType const &>(),
std::declval<internal::PinnedMeasurement<Space, P, M> const &>(),
std::declval<typename Moments<internal::PathTag<P>, Scalar>::VectorType const &>()
))::value_type
typename Params< Component_ >::Scalar Scalar
the scalar type
Definition ImmFilter.h:326
First and second moments (mean and covariance) of a distribution.
Definition Moments.h:55

The MeasurementUpdate of M on one mode's Gaussian, with the block named by the path P of a state in Space given (see update(state, measurement, pinned, policy)).

◆ GivenResultType

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Space, typename P>
using Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::GivenResultType
Initial value:
std::conditional_t<
internal::isByMode<M>,
internal::FilterUpdateWithScratch<
Allocator_>>,
Allocator_>
typename Params< Component_ >::SpaceType SpaceType
the state space
Definition ImmFilter.h:327
typename decltype(internal::updateBranchesWith< true >( std::declval< ComponentType const & >(), std::declval< internal::PinnedMeasurement< Space, P, M > const & >(), std::declval< typename Moments< internal::PathTag< P >, Scalar >::VectorType const & >()))::value_type GivenMeasuredType
The MeasurementUpdate of M on one mode's Gaussian, with the block named by the path P of a state in S...
Definition ImmFilter.h:393
What a filter's update did: the branches of the update before reduction, with their weights and innov...
Definition MeasurementUpdate.h:251
What an IMM filter's update did: each mode's update before reduction, the observation's log-likelihoo...
Definition ImmFilter.h:63

What update(state, measurement, pinned, policy) with M fills when given a result: one branch per mode for noise by mode axis, as ResultType has.

◆ ResultType

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M>
using Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::ResultType
Initial value:
std::conditional_t<
internal::isByMode<M>,
std::conditional_t<
IsForm,
internal::FilterUpdateWithScratch<
Allocator_>>>,
Allocator_>
typename internal::ImmMeasured< ComponentType, M >::type MeasuredType
The MeasurementUpdate of M on one mode's component, or, for a square-root form, the FilterUpdate of i...
Definition ImmFilter.h:344

What update() with M fills when given a result: one branch per mode for noise by mode axis, every noise component's branch otherwise.

Constructor & Destructor Documentation

◆ ImmRecursion()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::ImmRecursion ( Model_ model,
MethodFor< Model_, Method_ > method = {},
Allocator_ const & allocator = {} )
inlineexplicit

The recursion with switching model model and prediction method method, which the modes whose models carry none of their own predict by, with scratch for every mode from allocator.

Fixed-step models carry their own method, so there is none to give.

Member Function Documentation

◆ emptyGivenUpdate()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Space, typename P>
GivenResultType< M, Space, P > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::emptyGivenUpdate ( Allocator_ const & allocator,
Eigen::Index modes ) const
inlinenodiscard
Returns
an empty GivenResultType with room for modes modes, from allocator, for update(state, measurement, pinned, policy, result) to fill

◆ emptyJoint()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
JointType Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::emptyJoint ( StateType const & state) const
inlinenodiscard
Returns
an empty joint with room for every mode of state, from the state's allocator

◆ emptyUpdate()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M>
ResultType< M > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::emptyUpdate ( Allocator_ const & allocator,
Eigen::Index modes ) const
inlinenodiscard
Returns
an empty ResultType<M> with room for modes modes, from allocator, for update() to fill

◆ get_allocator()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
allocator_type Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::get_allocator ( ) const
inlinenodiscard
Returns
the allocator of the scratch

◆ method()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
Method_ const & Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::method ( ) const
inlinenodiscard
Returns
the prediction method of the modes whose models carry none of their own; ModelsMethod with fixed-step models

◆ model() [1/2]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
Model_ & Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::model ( )
inlinenodiscard
Returns
the switching model, to change its chain or its models' parameters

◆ model() [2/2]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
Model_ const & Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::model ( ) const
inlinenodiscard
Returns
the switching model

◆ modeSpace()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
ModeSpaceType const & Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::modeSpace ( ) const
inlinenodiscard
Returns
the discrete mode space

◆ partitions()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
bool Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::partitions ( SpaceType const & space) const
inlinenodiscard
Returns
whether every model's writes partition space, which a state must be in

◆ predict()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<typename... Inputs>
requires (!isFixedStep<Model_>)
auto Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::predict ( StateType & state,
TimeStep< Scalar > auto const & dt,
Inputs const &... inputs )
inlinenodiscard

Mixes state's components through the chain, moves each by dt, any TimeStep (see Time steps), through its mode's process model, with inputs passed as in Emrys::predict(), and moves the mode probabilities one step of the chain.

Returns
nothing for Gaussians; for a square-root form, a std::expected with the error of the first mode that could not take the step (see KalmanRecursion::predict()), which keeps the component it was to move from while the others move

◆ predictJoint() [1/2]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<typename... Inputs>
requires (isFixedStep<Model_> && !IsForm)
JointType Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::predictJoint ( StateType & state,
Inputs const &... inputs )
inlinenodiscard

Moves state forward as predict(state, inputs...) does with fixed-step models.

Returns
the step as a HybridPredictedJoint, as predictJoint(state, dt, inputs...) does

◆ predictJoint() [2/2]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<typename... Inputs>
requires (!isFixedStep<Model_> && !IsForm)
JointType Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::predictJoint ( StateType & state,
TimeStep< Scalar > auto const & dt,
Inputs const &... inputs )
inlinenodiscard

Moves state forward as predict(state, dt, inputs...) does.

Returns
the step as a HybridPredictedJoint, from the state's allocator, for a HybridGaussianHistory to record

◆ update() [1/6]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Space, typename P, typename Value, typename Policy, typename ModeUpdate, typename ResultAllocator>
requires (!IsForm)
std::expected< void, NumericError > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::update ( StateType & state,
M const & measurement,
GivenBlock< Space, P, Value > const & pinned,
Policy const & policy,
ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > & result )
inlinenodiscard

As update(state, measurement, pinned, policy), but into result, whose storage is reused.

Returns
nothing, or the error update(state, measurement, pinned, policy) would return

◆ update() [2/6]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Space, typename P, typename Value, typename Policy = reductions::Collapse>
requires (!IsForm)
GivenUpdateType< M, Space, P > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::update ( StateType & state,
M const & measurement,
GivenBlock< Space, P, Value > const & pinned,
Policy const & policy = {} )
inlinenodiscard

As update(state, measurement, policy), but with state a hybrid over the rest of a state and the block that pinned names given separately, as given() makes it: each mode's Gaussian is conditioned as update(prior, measurement, given) conditions one.

This is the step of a Rao-Blackwellized point-mass filter whose cells each hold a hybrid (RbPointMassFilter), each cell's center given.

Returns
as update(state, measurement, policy) does

◆ update() [3/6]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Policy, typename ModeUpdate, typename ResultAllocator>
std::expected< void, NumericError > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::update ( StateType & state,
M const & measurement,
Policy const & policy,
ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > & result )
inlinenodiscard

As update(state, measurement, policy), but into result, whose storage is reused: with the same result at every step, an update allocates nothing once it has been as large.

Returns
nothing, or the error update(state, measurement, policy) would return, with state unchanged and result unspecified

◆ update() [4/6]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<Measurement M, typename Policy = reductions::Collapse>
requires (!internal::isGivenBlock<Policy>)
internal::UnlessGivenBlock< UpdateTypeOf< M >, Policy >::type Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::update ( StateType & state,
M const & measurement,
Policy const & policy = {} )
inlinenodiscard

Conditions each of state's components on measurement, by the measurement's own method, reduces its branches with policy (Collapse, Select, or a Gate), and multiplies each mode's probability by \( p(z \mid m) \).

When the measurement's noise is by mode axis, additiveNoise(mixture).byMode<Axis>() (see ModeNoise), its components are the values of the mode axis Axis: in each mode, only the component that the mode's value in that axis names is used, and its own likelihood reweights the mode. The components' weights are not used; the chain gives the probabilities instead. The mode space must have the axis, and the noise one component per value of it.

Returns
each mode's update before reduction, the observation's log-likelihood, and whether it was accepted (see ImmFilterUpdate), with the modes' updates from the scratch's allocator; or, if any mode's update failed, as one whose innovation covariance is not positive definite does, its error, with state unchanged (decisions.md [innovation-cholesky])

◆ update() [5/6]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<typename P, Measurement... Ms, typename Policy, typename ModeUpdate, typename ResultAllocator>
std::expected< void, NumericError > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::update ( StateType & state,
SwitchingMeasurement< P, Ms... > const & measurement,
Policy const & policy,
ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > & result )
inlinenodiscard

As update(state, measurement, policy) with a SwitchingMeasurement, but into result, whose storage is reused.

Returns
nothing, or the error update(state, measurement, policy) would return

◆ update() [6/6]

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<typename P, Measurement... Ms, typename Policy = reductions::Collapse>
SwitchingUpdateType< SwitchingMeasurement< P, Ms... > > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::update ( StateType & state,
SwitchingMeasurement< P, Ms... > const & measurement,
Policy const & policy = {} )
inlinenodiscard

As update(state, measurement, policy), but with a measurement per value of the mode axis that measurement names (see SwitchingMeasurement): each mode is updated by the measurement that its value in that axis selects, and its own likelihood \( p(z \mid m) \) reweights it.

The measurements need one ResultType, so that every mode's update has one type.

◆ updateGiven()

template<Component Component_, typename Model_, typename Method_ = DefaultMethodFor<Model_>, typename Allocator_ = DefaultAllocator>
template<typename Space, typename P, typename M, typename Value, typename Policy, typename ModeUpdate, typename ResultAllocator>
requires (!IsForm && !internal::isByMode<M>)
std::expected< void, NumericError > Emrys::ImmRecursion< Component_, Model_, Method_, Allocator_ >::updateGiven ( StateType & state,
internal::PinnedMeasurement< Space, P, M > const & f,
Value const & value,
Policy const & policy,
ImmFilterUpdate< ModeUpdate, Scalar, ResultAllocator > & result )
inlinenodiscard

As update(state, measurement, pinned, policy, result), with the measurement over the rest and the given block already resolved as f and the block's value value: a caller that updates many hybrids, each given its own value, resolves the measurement once.

A measurement whose noise is by mode axis takes update(state, measurement, pinned, policy, result), which resolves each mode's component.


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