JuliaLang / JuliaLang/LinearAlgebra.jl

Error by default for pivoted Cholesky of semidefinte matrix

Open
#720 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
77
Forks
65
Avg merge
3d 23h
Merged PRs (30d)
10

Description

I tried to get the pivoted Cholesky factorization of a positive semidefinite matrix using
```
C = cholesky(diagm([1, 0]), Val(true))
```
However this throws `RankDeficientException(1)`, even though it seems like the matrix was factorized alright?!

It took some time for me to figure out that the following works.
```
C = cholesky(diagm([1, 0]), Val(true). check=false)
```
To me it seems non-intuitive having to turn off the check for something that should work.

According to the docs one should also be able check `issuccess(C)`, however this throws
`ERROR: MethodError: no method matching issuccess(::CholeskyPivoted{Float64,Array{Float64,2}})`

Here are the docs:

```
cholesky(A, Val(true); tol = 0.0, check = true) -> CholeskyPivoted

Compute the pivoted Cholesky factorization of a dense symmetric positive
semi-definite matrix A and return a CholeskyPivoted factorization. The
matrix A can either be a Symmetric or Hermitian StridedMatrix or a perfectly
symmetric or Hermitian StridedMatrix. The triangular Cholesky factor can be
obtained from the factorization F with: F.L and F.U. The following functions
are available for CholeskyPivoted objects: size, \, inv, det, and rank. The
argument tol determines the tolerance for determining the rank. For negative
values, the tolerance is the machine precision.

When check = true, an error is thrown if the decomposition fails. When check
= false, responsibility for checking the decomposition's validity (via
issuccess) lies with the user.
```

Another inconsistency is that the docs for `LAPACK.pstrf!` says that it works for positive-definite matrices while the [LAPACK docs](https://software.intel.com/en-us/mkl-developer-reference-c-pstrf) says that it works for positive semidefinite matrices. If it's not a typo, a remark in the docs could be in order.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.