# Random draws of multivariate normal with positive semi-definite covariance matrix

**URL:** https://discourse.julialang.org/t/random-draws-of-multivariate-normal-with-positive-semi-definite-covariance-matrix/78493
**Category:** Statistics
**Tags:** linearalgebra
**Created:** [March 25, 2022, 10:46pm UTC](https://discourse.julialang.org/t/random-draws-of-multivariate-normal-with-positive-semi-definite-covariance-matrix/78493 "2022-03-25T22:46:32Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [March 26, 2022, 2:00am UTC](https://discourse.julialang.org/t/random-draws-of-multivariate-normal-with-positive-semi-definite-covariance-matrix/78493/2 "2022-03-26T02:00:09Z")

</div>

See here: [Cholesky decomposition of low-rank positive-semidefinite matrix - #3 by stevengj](https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397/3)

The problem is that you may get slightly negative pivots due to roundoff errors, in which case LAPACK may terminate the factorization prematurely.

Ideally there would be a way to specify some tolerance so that slightly negative pivots could be treated as zeros, but I don’t know of any API for this?

---

_[View the full topic](https://discourse.julialang.org/t/random-draws-of-multivariate-normal-with-positive-semi-definite-covariance-matrix/78493)._
