#mcmc #sampler #ensemble #emcee

hammer-and-sample

Simplistic MCMC ensemble sampler based on emcee, the MCMC hammer

8 releases

0.3.1 Feb 17, 2025
0.3.0 Feb 17, 2025
0.2.0 Mar 29, 2023
0.1.4 Mar 17, 2022
0.1.2 Dec 21, 2021

#430 in Math


Used in cosmology

MIT/Apache

17KB
246 lines

hammer-and-sample

crates.io docs.rs github.com

A simplistic MCMC sampler implementing the affine-invariant ensemble sampling of emcee with serial execution and optionally with parallel execution based on Rayon.

The implementation is relatively efficient, for example computing 1000 iterations of 100 walkers using the hierarchical model from hierarchical.rs takes approximately 1 min using emcee and multiprocessing versus 50 ms using this crate and Rayon, running on 8 hardware threads in both cases.

Dependencies

~1–1.5MB
~22K SLoC