Bayes toolbox is a C++14 header-only library for high-performance Bayesian inference that enables low-level optimizations.
Data types are kept as simple as possible (e.g. structs with raw double
members) but the library provides powerful polymorphic operations on those datatypes.
Polymorphism is obtained at compile-time with template metaprogramming to minimize runtime overhead.
Here is a small example of what can be done with the library:
// simple graphical model
auto alpha = make_node<exponential>(1.0);
auto mu = make_node<exponential>(1.0);
auto lambda = make_node_array<gamma_ss>(5, n_to_one(alpha), n_to_one(mu)); //node array
auto gen = make_generator(); // random generator
draw(alpha, gen); // draw in distribution
draw(mu, gen);
draw(lambda, gen); // draws whole array
double my_logprob = logprob(alpha) + logprob(mu) + logprob(lambda);
More detail about library usage can be found in the documentation.
Bayes' toolbox uses the following header-only libraries:
- tagged_tuple - github repo - CeCill-C license
- doctest - github repo - MIT license