Skip to content

Commit d509a2b

Browse files
paldaysimeonschaub
authored andcommitted
add issuccess for CholeskyPivoted (JuliaLang#36002)
* add issuccess for CholeskyPivoted * add tests, NEWS and compat
1 parent e936dea commit d509a2b

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

NEWS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Standard library changes
4747
* All `AbstractUnitRange{<:Integer}`s now work with `SubString`, `view`, `@view` and `@views` on strings ([#35879]).
4848

4949
#### LinearAlgebra
50-
50+
* New method `LinearAlgebra.issuccess(::CholeskyPivoted)` for checking whether pivoted Cholesky factorization was successful ([#36002]).
5151

5252
#### Markdown
5353

stdlib/LinearAlgebra/src/cholesky.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ end
447447
Base.propertynames(F::CholeskyPivoted, private::Bool=false) =
448448
(:U, :L, :p, :P, (private ? fieldnames(typeof(F)) : ())...)
449449

450-
issuccess(C::Cholesky) = C.info == 0
450+
issuccess(C::Union{Cholesky,CholeskyPivoted}) = C.info == 0
451451

452452
function show(io::IO, mime::MIME{Symbol("text/plain")}, C::Cholesky{<:Any,<:AbstractMatrix})
453453
if issuccess(C)

stdlib/LinearAlgebra/src/factorization.jl

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ checknonsingular(info) = checknonsingular(info, Val{true}())
2525
2626
Test that a factorization of a matrix succeeded.
2727
28+
!!! compat "Julia 1.6"
29+
`issuccess(::CholeskyPivoted)` requires Julia 1.6 or later.
30+
2831
```jldoctest
2932
julia> F = cholesky([1 0; 0 1]);
3033

stdlib/LinearAlgebra/test/cholesky.jl

+2
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,8 @@ end
266266
@test_throws RankDeficientException cholesky!(copy(M), Val(true))
267267
@test_throws RankDeficientException cholesky(M, Val(true); check = true)
268268
@test_throws RankDeficientException cholesky!(copy(M), Val(true); check = true)
269+
@test !LinearAlgebra.issuccess(cholesky(M, Val(true); check = false))
270+
@test !LinearAlgebra.issuccess(cholesky!(copy(M), Val(true); check = false))
269271
C = cholesky(M, Val(true); check = false)
270272
@test_throws RankDeficientException chkfullrank(C)
271273
C = cholesky!(copy(M), Val(true); check = false)

0 commit comments

Comments
 (0)