-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Delay throwing when CHOLMOD factorizations fail #22345
Conversation
c0468be
to
c100131
Compare
base/linalg/cholesky.jl
Outdated
@@ -462,7 +467,7 @@ function A_ldiv_B!(C::CholeskyPivoted, B::StridedMatrix) | |||
end | |||
|
|||
function det(C::Cholesky) | |||
C.info == 0 || throw(PosDefException(C.info)) | |||
issuccess(C) || throw(PosDefException(C.info)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps clearer to check isposdef
since we throw an PosDefException
here? (eg. #22245 )? same below
[1.0 0.0; 0.0 -1.0] | ||
successful: false | ||
``` | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be attached to something
base/sparse/cholmod.jl
Outdated
if s.is_ll == 1 | ||
return true | ||
else | ||
return :maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't it be better for this to be type stable if possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It is WIP. I need to figure out the best way to test if an LDLt Factor
is PD.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahk. that branch is covered in tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure it is but a lot of stuff was still broken so there was many test failures. I'll take a look at the coverage when tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the tests such that all branches are now covered.
2c76212
to
3d9121c
Compare
base/linalg/factorization.jl
Outdated
@@ -16,6 +16,26 @@ macro assertnonsingular(A, info) | |||
:($(esc(info)) == 0 ? $(esc(A)) : throw(SingularException($(esc(info))))) | |||
end | |||
|
|||
""" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no blank line at the start of docstrings
I like the approach. I wonder if it's too much of a pun to dispatch this on the existing |
3d9121c
to
92e56d1
Compare
I'm fine with overloading |
@@ -1750,17 +1760,27 @@ end | |||
|
|||
det(L::Factor) = exp(logdet(L)) | |||
|
|||
function isposdef(A::SparseMatrixCSC{<:VTypes,SuiteSparse_long}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the fallback work for this now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes and I believe that https://github.com/JuliaLang/julia/pull/22345/files#diff-f75d450eb1491e3f787ed1ae6b40424fR378 should be exercising that.
Introduce issuccess function to test if a Factorization succeeded. Fixes #22335
92e56d1
to
164aaaf
Compare
Introduce issuccess function to test if a Factorization succeeded. Fixes #22335
issuccess(B::BunchKaufman) = B.info == 0 | ||
|
||
function Base.show(io::IO, F::BunchKaufman) | ||
println(io, summary(F)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should show the factor as done for lu and cholesky
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that is useful for sparse factorizations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Too fast. The problem here is that constructing the factor is a mess and not that useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's pedagogically useful - isn't there a helper function in lapack for this?
Introduce
issuccess
function to test if aFactorization
succeeded.Fixes JuliaLang/LinearAlgebra.jl#437