Struct sample_base_fn

Inheritance Relationships

Derived Type

Struct Documentation

struct sample_base_fn

Implementation detail for a sample algorithm.

Subclassed by beluga::views::detail::sample_fn

Protected Functions

template<class Range, class Weights, class URNG>
inline constexpr auto sample_from_range(Range &&range, Weights &&weights, URNG &engine) const

Sample from weighted ranges.

template<class Range, class URNG>
inline constexpr auto sample_from_range(Range &&range, URNG &engine) const

Sample from any range.

If the input range is a particle range, it will extract the weights and treat it as a weighted range. The new particles will all have a weight equal to 1, since, after resampling, the probability will be represented by the number of particles rather than their individual weight.

If the input range is not a particle range, it will assume a uniform distribution.

template<class Distribution, class URNG>
inline constexpr auto sample_from_distribution(Distribution distribution, URNG &engine) const

Sample from random distributions.