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

Action that removes every point whose normalized probability is below probability, renormalizing the rest; the most probable point is always kept. More...

#include <EmrysFilter/Distributions/Upkeep.h>

Public Member Functions

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

Public Attributes

Scalar_ probability
 points less probable than this are removed

Detailed Description

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

Action that removes every point whose normalized probability is below probability, renormalizing the rest; the most probable point is always kept.

The state is anything with pruneBelow(logThreshold) returning the log of the weight removed, or a std::expected of it with a WeightError: a ParticleSet or a ParticleGaussianParams, a MixtureParams, the state of a MixtureFilter, which fails as logTotalWeight() does, or a GridGaussianParams, the state of an RbPointMassFilter, whose prune can't fail. The threshold is absolute, the same whatever the number of points; a caller who wants it relative to something, such as the cell size of a grid that subdivide() refines, adjusts it. It doesn't bound the probability removed, which on \( N \) points can reach \( (N - 1) \) times the threshold: pruneBelow(1e-6) on a flat distribution over two million cells keeps only the most probable. Under subdivide(k) in \( d \) dimensions each child holds \( 1/k^d \) of its parent, so the same threshold cuts a density \( k^d \) times higher after each refinement; a caller who wants the same cut divides the threshold by \( k^d \). PruneTail bounds the total. Scalar_ is the type of probability, deduced from the one given (upkeep::pruneBelow(1e-4f) holds a float).

See also
PruneTail, PruneToSize

Member Function Documentation

◆ operator()()

template<RealScalar Scalar_ = double>
template<typename State>
requires requires(State & state, typename State::Scalar logThreshold) { state.pruneBelow(logThreshold); }
std::expected< bool, WeightError > Emrys::upkeep::PruneBelow< 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: