Function bayes_estimate::estimators::sir::standard_resampler [−][src]
pub fn standard_resampler(
w: &mut Likelihoods,
rng: &mut dyn RngCore
) -> Result<(Resamples, u32, f32), &'static str>
Expand description
Standard resampler from [1]. Algorithm: A sample is chosen once for each time its cumulative likelihood intersects with a uniform random draw. Complexity is that of Vec::sort, O(n * log(n)) worst-case. This complexity is required to sort the uniform random draws made, this allows comparing of the two ordered lists w(cumulative) and ur (the sorted random draws).
Returns: number of times this particle should be resampled, number of unqiue particles (number of non zeros in resamples), conditioning of the likelihoods (min likelihood / sum likelihoods)
Side effects: ‘l’ becomes a normalised cumulative sum, Draws are made from ‘rng’ for each likelihood