EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::roots::WithFallbacks< Head, Fallbacks > Struct Template Reference

Axes that can fail, followed by their fallbacks, tried in order (decisions.md [sigma-point-axes]): a repair, which retries Head on the covariance it repairs, or other axes, which take the root themselves. More...

#include <EmrysFilter/Distributions/Roots.h>

Public Types

template<typename Scalar>
using Report = std::variant<internal::ReportOfT<Head, Scalar>, internal::ReportOfT<Fallbacks, Scalar>...>
 The report of the entry that succeeded, at its index.
template<typename Scalar>
using FailureReport
 The report of every entry, on failure.

Public Member Functions

template<typename Derived>
internal::RootResult< canFail, internal::SquareMatrixOf< Derived > > root (Eigen::MatrixBase< Derived > const &cov) const
template<typename Derived, typename Sink>
internal::RootResult< canFail, internal::SquareMatrixOf< Derived > > root (Eigen::MatrixBase< Derived > const &cov, Sink &&sink) const
template<typename Derived>
internal::RootResult< canFail, internal::SquareMatrixOf< Derived > > rootFromFactor (Eigen::MatrixBase< Derived > const &factor) const

Public Attributes

Head head
 the axes tried first
std::tuple< Fallbacks... > fallbacks
 the entries tried after it, in order

Static Public Attributes

static constexpr bool canFail
 Whether the list can fail: whether its last entry can.

Detailed Description

template<typename Head, typename... Fallbacks>
struct Emrys::roots::WithFallbacks< Head, Fallbacks >

Axes that can fail, followed by their fallbacks, tried in order (decisions.md [sigma-point-axes]): a repair, which retries Head on the covariance it repairs, or other axes, which take the root themselves.

The first entry that succeeds gives the root; the list fails, with the last entry's error, only when every entry does, so it can fail exactly when its last entry can. Made by the factories of axes that can fail, given their fallbacks: cholesky(ridge(), pivoted()).

Refused at compile time, each with a message: a fallback after axes that cannot fail; an entry that is neither axes nor a repair; a fallback after an entry that cannot fail, which is never reached; and a list as an entry, since the list is flat.

From a factor, Head and each axes after it take their root from the factor; a repair works on the covariance formed from it.

Its report, for roots::squareRootWithReport(), is a std::variant of the entries' reports whose index is the entry that succeeded, and on failure a std::tuple of each entry's report.

Template Parameters
Headaxes that can fail
Fallbacksrepairs and axes, the last of which may or may not fail

Member Typedef Documentation

◆ FailureReport

template<typename Head, typename... Fallbacks>
template<typename Scalar>
using Emrys::roots::WithFallbacks< Head, Fallbacks >::FailureReport
Initial value:
std::tuple<
std::optional<internal::ReportOfT<Head, Scalar>>,
std::optional<internal::ReportOfT<Fallbacks, Scalar>>...>

The report of every entry, on failure.

Member Function Documentation

◆ root() [1/2]

template<typename Head, typename... Fallbacks>
template<typename Derived>
internal::RootResult< canFail, internal::SquareMatrixOf< Derived > > Emrys::roots::WithFallbacks< Head, Fallbacks >::root ( Eigen::MatrixBase< Derived > const & cov) const
inlinenodiscard
Returns
the root of cov, of which only the lower triangle is read, by the first entry that succeeds

◆ root() [2/2]

template<typename Head, typename... Fallbacks>
template<typename Derived, typename Sink>
internal::RootResult< canFail, internal::SquareMatrixOf< Derived > > Emrys::roots::WithFallbacks< Head, Fallbacks >::root ( Eigen::MatrixBase< Derived > const & cov,
Sink && sink ) const
inlinenodiscard
Returns
the root of cov by the first entry that succeeds, calling sink with the Report, or on failure with the FailureReport

◆ rootFromFactor()

template<typename Head, typename... Fallbacks>
template<typename Derived>
internal::RootResult< canFail, internal::SquareMatrixOf< Derived > > Emrys::roots::WithFallbacks< Head, Fallbacks >::rootFromFactor ( Eigen::MatrixBase< Derived > const & factor) const
inlinenodiscard
Returns
the root of \( F F^T \) for factor by the first entry that succeeds

Member Data Documentation

◆ canFail

template<typename Head, typename... Fallbacks>
bool Emrys::roots::WithFallbacks< Head, Fallbacks >::canFail
staticconstexpr
Initial value:
=
internal::entryCanFail<std::tuple_element_t<sizeof...(Fallbacks) - 1, std::tuple<Fallbacks...>>>()

Whether the list can fail: whether its last entry can.


The documentation for this struct was generated from the following file:
  • EmrysFilter/Distributions/Roots.h