MCMCLib

optim Build Coverage Status

Watch Star Fork


MCMCLib is a C++ library of Markov Chain Monte Carlo methods.


Features

  • C++11 implementations of several well-known MCMC methods, including:
    • Random Walk Metropolis-Hastings (RWMH);
    • Metropolis-adjusted Langevin algorithm (MALA);
    • Hamiltonian Monte Carlo (HMC); and
    • Riemannian Manifold HMC.
  • Samplers designed for multi-modal distributions:
    • Equi-Energy sampling; and
    • Differential Evolution
  • Built on the Armadillo C++ linear algebra library for fast and efficient matrix-based computation.
  • OpenMP-accelerated samplers for parallel computation.
  • Straightforward linking with parallelized BLAS libraries, such as OpenBLAS.
  • Released under a permissive, non-GPL license.

Author: Keith O'Hara

License


Download and Installation

  • The source code is available on GitHub.

The library can be installed on Unix-alike systems via the standard ./configure && make method:

# clone MCMCLib into the current directory
git clone https://github.com/kthohr/mcmc ./mcmc
# build and install
cd ./mcmc
./configure -i "/usr/local" -p
make
make install

The last line will install MCMCLib to /usr/local

Configuration options: (see ./configure -h)

    Primary
  • -h print help
  • -i install path; default: the build directory
            example: -i "/usr/local"
  • -m specify the BLAS and Lapack libraries to link against;
            examples: -m "-lopenblas" or -m "-framework Accelerate"
  • -o compiler optimization options;
            default: -O3 -march=native -ffp-contract=fast -flto -DARMA_NO_DEBUG
  • -p enable OpenMP parallelization features (recommended)
  • Secondary
  • -c a coverage build (used with Codecov)
  • -d a 'development' build
  • -g a debugging build (optimization flags set to -O0 -g)

Armadillo

MCMCLib is built on the Armadillo C++ linear algebra library. The configure script will search for Armadillo files in the standard locations: /usr/include, /usr/local/include, /opt/include, /opt/local/include. If the Armadillo header files are installed elsewhere, set the following environment variable before running configure:
export ARMA_INCLUDE_PATH=/path/to/armadillo
Otherwise the build script will download the required files from the Armadillo GitLab repository.