Skip to content

Commit bf8aae8

Browse files
authored
suggest calling cholesky(Hermitian(A)) for slightly non-Hermitian matrices (#35320)
1 parent afb9ad4 commit bf8aae8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stdlib/LinearAlgebra/src/cholesky.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ The triangular Cholesky factor can be obtained from the factorization `F` with:
301301
The following functions are available for `Cholesky` objects: [`size`](@ref), [`\\`](@ref),
302302
[`inv`](@ref), [`det`](@ref), [`logdet`](@ref) and [`isposdef`](@ref).
303303
304+
If you have a matrix `A` that is slightly non-Hermitian due to roundoff errors in its construction,
305+
wrap it in `Hermitian(A)` before passing it to `cholesky` in order to treat it as perfectly Hermitian.
306+
304307
When `check = true`, an error is thrown if the decomposition fails.
305308
When `check = false`, responsibility for checking the decomposition's
306309
validity (via [`issuccess`](@ref)) lies with the user.
@@ -354,6 +357,9 @@ The following functions are available for `CholeskyPivoted` objects:
354357
The argument `tol` determines the tolerance for determining the rank.
355358
For negative values, the tolerance is the machine precision.
356359
360+
If you have a matrix `A` that is slightly non-Hermitian due to roundoff errors in its construction,
361+
wrap it in `Hermitian(A)` before passing it to `cholesky` in order to treat it as perfectly Hermitian.
362+
357363
When `check = true`, an error is thrown if the decomposition fails.
358364
When `check = false`, responsibility for checking the decomposition's
359365
validity (via [`issuccess`](@ref)) lies with the user.

0 commit comments

Comments
 (0)