2

I want a C++ library which would allow me to dynamically construct a distribution, from a wide selection of distribution families, with its appropriate parameters, based on configuration data read from disk or from console (rather than deciding which distribution it is at compile-time, i.e. not just selection via template parameters). I need to be able to use this constructed distribution to (relatively) efficiently generate large amounts of data.

Requirements:

  • Libre
  • Gratis
  • Available for Linux and Windows
  • Ability to create composed distributions from existing ones (e.g. the application of some f: R^2->R to pairs of random variables with known distributions).

Desirable:

  • Support for explicitly-specified distributions over small finite domains
  • Support for distributions over complex numbers
  • Support for distributions over more complicated types (variants, tuples, optionals etc.)
  • C++17, or at least C++11
  • Known to work with many compilers, including clang, gcc and msvc
  • No Boost dependencies
  • Used in more than toy projects
  • Actively maintained
  • Plays nice with the standard library distributions

Don't care:

  • Compiled or header-only
  • Pseudorandom or using hardware entropy sources
0

C++11 includes a number of statistical distributions without a Boost requirement:

https://en.cppreference.com/w/cpp/numeric/random

For composing or mixing distributions, see this example:

https://stackoverflow.com/questions/37320025/mixture-of-gaussian-distribution-in-c

This should be all that you need. If not, there is a header-only library containing a number of other useful statistical distributions here:

https://github.com/kthohr/stats

The same author also has C++ MCMC and optimization libraries.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.