metromc
Markov chain Monte Carlo (MCMC) sampling using the Independence Metropolis-Hastings algorithm with uniform transition kernel.
Uses the tinyrand RNG to sample at a rate of ~50M samples/sec.
Supports the following distributions:
It is easy to add more univariate distributions by supplying an implementation of a PDF or wrapping one from the excellent statrs crate.
Example
Draw samples from the Gaussian distribution using MCMC.
use RangeInclusive;
use Wyrand;
use Gaussian;
use ;
// sample from Gaussian with µ=0.0 and σ=1.0, in the interval [-5.0, 5.0]
let sampler = new;
// take 1,000 samples after dropping the first 10
for sample in sampler.skip.take