You maybe want the “pivoted Cholesky” factorization, via cholesky(A, Val(true))
, probably passing check=false
. (Under the hood, this calls LAPACK’s dpstrf.)
The central complication is that a positive-semidefinite matrix can easily become indefinite (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.