Action that resamples a set in proportion to its weights, drawing from the generator G with the resampler Resampler_ (systematic by default) under the execution policy Policy_ (sequential by default), to a given size if one is given and to the set's size otherwise.
More...
|
|
constexpr | Resample (G &generator, Resampler_ resampler={}, std::optional< Eigen::Index > size=std::nullopt, Policy_ policy={}) |
| | Draws from generator with resampler under policy, to size particles if one is given and to the state's size otherwise.
|
template<typename State>
requires internal::ResamplableBy<State, G, Resampler_, Policy_> |
| std::expected< bool, WeightError > | operator() (State &state) const |
| | Resamples state.
|
| constexpr G & | generator () const noexcept |
| constexpr Resampler_ const & | resampler () const noexcept |
| constexpr std::optional< Eigen::Index > | size () const noexcept |
| constexpr Policy_ const & | policy () const noexcept |
template<std::uniform_random_bit_generator G, typename Resampler_ = resamplers::Systematic, ExecutionPolicy Policy_ = execution::Sequential>
class Emrys::upkeep::Resample< G, Resampler_, Policy_ >
Action that resamples a set in proportion to its weights, drawing from the generator G with the resampler Resampler_ (systematic by default) under the execution policy Policy_ (sequential by default), to a given size if one is given and to the set's size otherwise.
The state is anything with resample(rng, newSize, resampler) and size(), or under a policy other than execution::sequential resample(policy, rng, newSize, resampler), such as a ParticleSet or a ParticleGaussianParams; its weights become equal. A size lets upkeep change the particle count. A caller computing the count from the state, as KLD sampling does, makes the action at each step, since an action is a small value. The action holds a reference to the generator, which must outlive it, and draws from it at each call; a generator made in the call to resample() does not compile.
- See also
- WhenEss, Resamplers