Efficient sampling from a multivariate normal distribution subject to linear equality and inequality constraints

Matthew Adams, Gloria M. Monsalve-Bravo, Lucy G. Dowdell, Scott A. Sisson, Christopher DrovandiarXiv 2025 · DOI

Abstract

Sampling from multivariate normal distributions, subjected to a variety of restrictions, is a problem that is recurrent in statistics and computing. In the present work, we demonstrate a general framework to efficiently sample a multivariate normal distribution subject to any set of linear inequality constraints and/or linear equality constraints simultaneously. In the approach we detail, sampling a multivariate random variable from the domain formed by the intersection of linear constraints proceeds via a combination of elliptical slice sampling to address the inequality constraints, and linear mapping to address the equality constraints. We also detail a linear programming method for finding an initial sample on the linearly constrained domain; such a method is critical for sampling problems where the domain has small probability. We demonstrate the validity of our methods on an arbitrarily chosen four-dimensional multivariate normal distribution subject to five inequality constraints and/or two equality constraints. Our approach compares favourably to direct sampling and/or accept-reject sampling methods; the latter methods vary widely in their efficiency, whereas the methods in the present work are rejection-free. Where practical we compare predictions of probability density functions between our sampling methods and analytical computation. For all simulations we demonstrate that our methods yield accurate computation of the mean and covariance of the multivariate normal distributions restricted by the imposed linear constraints.

Introduction

Sampling from restricted multivariate normal distributions (MNDs) is a fundamental task in statistics, machine learning, and computational science. While existing algorithms can handle either linear equality constraints or linear inequality constraints individually, many real-world problems require satisfying both simultaneously. Furthermore, when the constrained domain represents a "rare event"—a tiny sliver of the total probability space—traditional Markov chain Monte Carlo (MCMC) methods often fail because they cannot find a valid starting point. This paper introduces a unified, rejection-free framework to address these challenges.

Methodology

The proposed framework combines three distinct techniques into a cohesive pipeline:

  1. Linear Mapping for Equalities: The authors utilize a coordinate transformation to satisfy linear equality constraints. This step effectively reduces the dimensionality of the problem and shifts the distribution to a zero-mean latent space, simplifying subsequent sampling steps.
  2. Linear Programming for Initialization: To overcome the "cold start" problem in MCMC, the search for an initial valid sample is framed as a linear programming optimization problem. This ensures that a valid starting point is found rapidly, even in domains with microscopic probability mass.
  3. Linear Elliptical Slice Sampling (LIN-ESS): Once initialized, the method employs LIN-ESS, a specialized MCMC technique designed for domains truncated by linear inequalities. Crucially, this method is rejection-free, meaning every generated sample is valid.

Results and Validation

The framework was validated using a synthetic 4-dimensional MND subject to five linear inequality constraints and two linear equality constraints. The results demonstrate that the method is both highly accurate and computationally efficient.

Comparison of mean (a) and covariance (b) estimates between the proposed method and traditional sampling techniques.

As shown in Figure 1, the mean vectors and covariance matrices computed via the proposed method perfectly match those obtained through analytical computation and brute-force accept-reject sampling. In scenarios where standard accept-reject sampling had an acceptance rate as low as 0.005%, the rejection-free nature of this framework provided a massive efficiency gain.

Visual comparison between the kernel density estimate of the PDF generated by the proposed sampling method (a) and the analytical PDF (b).

Furthermore, Figure 2 illustrates that the kernel density estimates of the probability density functions (PDFs) generated by the sampling method are visually and mathematically indistinguishable from the analytical ground truth.

Discussion and Conclusion

A key insight of this work is the treatment of initialization as an optimization problem, which bypasses the common failure mode of MCMC in rare-event simulations. By decoupling equality and inequality constraints through linear mapping, the authors provide a general-purpose tool for complex sampling problems. While the LIN-ESS method produces autocorrelated samples, the efficiency gains in highly constrained spaces are substantial. This framework is particularly valuable for fields requiring rare event simulation where traditional methods are computationally prohibitive.

Summary updated

BibTeX
@misc{adams2025efficient,
  author = {Matthew Adams and Gloria M. Monsalve-Bravo and Lucy G. Dowdell and Scott A. Sisson and Christopher Drovandi},
  title = {{Efficient sampling from a multivariate normal distribution subject to linear equality and inequality constraints}},
  year = {2025},
  eprint = {2508.15292},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2508.15292},
  howpublished = {arXiv},
}
Figure