EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::Composition< Models > Class Template Reference

Process models side by side, as compose() puts them (decisions.md [model-policies], [model-placement]): one model whose reads are the union of the parts', gathered once, whose writes are the parts' together, which must write every block of the state once, whose noise is block-diagonal, and whose affine set is the names every part reading them declares affine. More...

#include <EmrysFilter/Models/ProcessModel.h>

Public Types

using Scalar = typename internal::FirstScalarOr<internal::DeclaredScalarsOf<Models...>>::type
 the scalar type: the one its parts state, or double where none states one
using FunctionType = Composition
 the function: the composition itself
using ReadsPolicy = typename internal::ReadUnionOf<AllItems>::type
 The reads() of the whole: the union of the parts', in order of first appearance.
using WritesPolicy = typename internal::WritesOfTuple<AllPaths, AllNames>::type
 The writes() of the whole: the parts', in order.
using AffinePolicy = typename internal::AffineOf<ReadsPolicy, std::tuple<Models...>>::type
 The affineIn() of the whole.
template<internal::PolicyKind K>
using Policy
 The policy of kind K, or internal::NoPolicy.
using WritePaths = typename WritesPolicy::PathList
 The paths of the blocks written, a TagPaths.
using OutputSpace = typename WritesPolicy::OutputSpace
 The output space: the Composite of the blocks written, in order.
using MarkType = internal::NoJacobians
 The whole writes no Jacobian in a batch: a method that needs one differentiates it.

Public Member Functions

 Composition (Models... models)
 The composition of models.
Composition const & function () const
template<internal::PolicyKind K>
Policy< K > const & policy () const
std::tuple< Models... > const & parts () const
template<typename In, typename Out, typename X, typename TimeScalar>
requires MatrixExpression<X>
auto operator() (In const &in, Out const &out, X const &x, TimeScalar dt) const
template<typename In, typename Out, typename X, typename TimeScalar, typename Y>
requires TakesBatches
void operator() (In const &in, Out const &out, X const &x, TimeScalar dt, Y &y) const
 Writes into y the whole's step of a batch x, a column per point in the input space in, into the output space out over dt: each batched part called once over its columns, and each other part at each column (internal::stepPartsBatch()).
template<typename Scalar, typename Out>
Moments< Out, Scalar >::MatrixType noiseOver (Out const &out, Scalar dt) const
template<typename Space>
bool partitions (Space const &space) const

Static Public Member Functions

template<typename Space>
static consteval internal::StaticPartition staticPartition ()

Static Public Attributes

static constexpr bool IsModel = true
 a model, for internal::isModel
static constexpr bool HasFunction = true
 a process model always has a function
template<internal::PolicyKind K>
static constexpr bool has
 Whether the policy of kind K is one the whole has: reads(), writes(), and affineIn().
static constexpr bool TakesBatches = internal::anyTakesBatches<Models...>
 whether the whole takes a batch: a part's function does (decisions.md [batched-functions])

Detailed Description

template<typename... Models>
class Emrys::Composition< Models >

Process models side by side, as compose() puts them (decisions.md [model-policies], [model-placement]): one model whose reads are the union of the parts', gathered once, whose writes are the parts' together, which must write every block of the state once, whose noise is block-diagonal, and whose affine set is the names every part reading them declares affine.

Each part's function is called on its own input, gathered from the whole's by name, and its result is written into the whole's output by block. When every part returns its Jacobian the composition does too, assembled from theirs; otherwise the whole is differentiated. The parts that state a scalar, as the built-in models do, state the same one, which is the composition's; a composition of parts that state none, such as Constant, has double.

Template Parameters
Modelsthe parts, each a ProcessModel
See also
compose(), processModel()

Member Typedef Documentation

◆ Policy

template<typename... Models>
template<internal::PolicyKind K>
using Emrys::Composition< Models >::Policy
Initial value:
std::conditional_t<
K == internal::PolicyKind::reads,
std::conditional_t<
K == internal::PolicyKind::writes,
std::conditional_t<K == internal::PolicyKind::affineIn, AffinePolicy, internal::NoPolicy>>>
typename internal::ReadUnionOf< AllItems >::type ReadsPolicy
The reads() of the whole: the union of the parts', in order of first appearance.
Definition ProcessModel.h:1836
typename internal::WritesOfTuple< AllPaths, AllNames >::type WritesPolicy
The writes() of the whole: the parts', in order.
Definition ProcessModel.h:1839

The policy of kind K, or internal::NoPolicy.

Member Function Documentation

◆ function()

template<typename... Models>
Composition const & Emrys::Composition< Models >::function ( ) const
inlinenodiscard
Returns
the function: the composition itself

◆ noiseOver()

template<typename... Models>
template<typename Scalar, typename Out>
Moments< Out, Scalar >::MatrixType Emrys::Composition< Models >::noiseOver ( Out const & out,
Scalar dt ) const
inlinenodiscard
Returns
the process noise \( Q \) over dt, over the differences of the output space instance out: block-diagonal, each part's over its own blocks

◆ operator()()

template<typename... Models>
template<typename In, typename Out, typename X, typename TimeScalar>
requires MatrixExpression<X>
auto Emrys::Composition< Models >::operator() ( In const & in,
Out const & out,
X const & x,
TimeScalar dt ) const
inlinenodiscard
Returns
the whole's step of x, a vector in the input space in, into the output space out over dt: each part's function on its own input, its result written by block, and the Jacobian assembled from the parts' when every part returns one

◆ partitions()

template<typename... Models>
template<typename Space>
bool Emrys::Composition< Models >::partitions ( Space const & space) const
inlinenodiscard
Returns
whether the whole writes every coordinate of space exactly once

◆ parts()

template<typename... Models>
std::tuple< Models... > const & Emrys::Composition< Models >::parts ( ) const
inlinenodiscard
Returns
the parts, in order

◆ policy()

template<typename... Models>
template<internal::PolicyKind K>
Policy< K > const & Emrys::Composition< Models >::policy ( ) const
inlinenodiscard
Returns
the policy of kind K, which the whole must have

◆ staticPartition()

template<typename... Models>
template<typename Space>
consteval internal::StaticPartition Emrys::Composition< Models >::staticPartition ( )
inlinestaticnodiscardconsteval
Returns
what the types say about whether the whole writes every coordinate of Space exactly once (internal::StaticPartition)

Member Data Documentation

◆ has

template<typename... Models>
template<internal::PolicyKind K>
bool Emrys::Composition< Models >::has
staticconstexpr
Initial value:
=
K == internal::PolicyKind::reads || K == internal::PolicyKind::writes || K == internal::PolicyKind::affineIn

Whether the policy of kind K is one the whole has: reads(), writes(), and affineIn().


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