Variable beluga::views::sample

Variable Documentation

constexpr ranges::views::view_closure<detail::sample_fn> beluga::views::sample

Range adaptor object that will randomly sample with replacement from an input range. Unlike std::views::sample, this does not require a size parameter and the samples will be taken from the population with replacement, making the sample values independent. To use this, the input range must model the random_access_range and sized_range concepts.

This view implements multinomial resampling for a given range of particles. The core idea is to draw random indices / iterators to the input particle range from a multinomial distribution parameterized after particle weights (and assumed uniform for non-weighted particle ranges).

This view can also be used to convert any random distribution (a callable that takes a URNG as an input argument) into an infinite view that generates values from that distribution.

This view is not cheap to copy, so care must be taken when moving it around. Range-v3 does not support move-only views at the time of this implementation.