We present a Hamiltonian Monte Carlo algorithm to sample from multivariate Gaussian distributions in which the target space is constrained by linear and quadratic inequalities or products thereof. The Hamiltonian equations of motion can be integrated exactly and there are no parameters to tune. The algorithm mixes fast and outperforms Gibbs sampling for constraint geometries that impose strong correlations among the variables. The runtime scales linearly with the number of constraints but the algorithm is highly parallelizable. A simple extension of the algorithm permits sampling from distributions whose log-density is piecewise quadratic, as in the "Bayesian lasso" model.
View on arXiv