# Cholesky decomposition of low-rank positive-semidefinite matrix

**URL:** https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397
**Category:** General Usage
**Tags:** linearalgebra, numerics
**Created:** [October 26, 2021, 10:47am UTC](https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397 "2021-10-26T10:47:20Z")
**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: [October 26, 2021, 12:20pm UTC](https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397/2 "2021-10-26T12:20:51Z")

</div>

You maybe want the [“pivoted Cholesky” factorization](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.cholesky), via `cholesky(A, Val(true))`, probably passing `check=false`. (Under the hood, this calls LAPACK’s [dpstrf](http://www.netlib.org/lapack/explore-html/da/dba/group__double_o_t_h_e_rcomputational_ga31cdc13a7f4ad687f4aefebff870e1cc.html).)

**The central complication** is that a positive-semidefinite matrix can easily become _in_definite (slightly negative eigenvalues or pivots) due to roundoff errors. You can combat this to some extent with pivoted Cholesky by passing a `tol` argument or a `check=false` argument to control what the algorithm does when a negative pivot is encountered. See the `dpstrf` LAPACK documentation for more detail — the `cholesky(A, Val(true))` documentation currently isn’t so clear.

---

_[View the full topic](https://discourse.julialang.org/t/cholesky-decomposition-of-low-rank-positive-semidefinite-matrix/70397)._
