EmrysFilter 0.1.0
State estimation utilities in C++23 using Eigen
Loading...
Searching...
No Matches
Emrys::upkeep::PruneTail< Scalar_ > Struct Template Reference

Action that removes the least probable points, as many as can be while their combined probability stays below fraction, renormalizing the rest. More...

#include <EmrysFilter/Distributions/Upkeep.h>

Public Member Functions

template<typename State>
requires requires(State & state, typename State::Scalar logFraction) { state.pruneTail(logFraction); }
std::expected< bool, WeightError > operator() (State &state) const
 Prunes state.

Public Attributes

Scalar_ fraction
 the probability the points removed stay below

Detailed Description

template<RealScalar Scalar_ = double>
struct Emrys::upkeep::PruneTail< Scalar_ >

Action that removes the least probable points, as many as can be while their combined probability stays below fraction, renormalizing the rest.

The state is anything with pruneTail(logFraction), as for PruneBelow. Unlike a threshold on each point, the fraction bounds the probability removed, and so the change in the distribution in total variation, however many points there are, and it removes about the same light tail before a subdivide() as after it. It can remove a whole mode lighter than the fraction, which PruneBelow would keep if each of the mode's points were above its threshold. Scalar_ is the type of fraction, deduced from the one given (upkeep::pruneTail(1e-3f) holds a float).

See also
PruneBelow, PruneToSize

Member Function Documentation

◆ operator()()

template<RealScalar Scalar_ = double>
template<typename State>
requires requires(State & state, typename State::Scalar logFraction) { state.pruneTail(logFraction); }
std::expected< bool, WeightError > Emrys::upkeep::PruneTail< Scalar_ >::operator() ( State & state) const
inlinenodiscard

Prunes state.

Returns
whether any point was removed, or the WeightError of the state's weights

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