  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 faster and is more efficient than Gibbs sampling. The runtime depends on
the number and shape of the constraints but the algorithm is highly
parallelizable. In many cases, we can exploit special structure in the
covariance matrices of the untruncated Gaussian to further speed up the
runtime. A simple extension of the algorithm permits sampling from
distributions whose log-density is piecewise quadratic, as in the "Bayesian
Lasso" model.
