Skip to content
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

Merged
merged 1 commit into from
Jun 24, 2017

Conversation

andreasnoack
Copy link
Member

Introduce issuccess function to test if a Factorization succeeded.

Fixes #22335

@@ -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))
Copy link
Member

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

@andreasnoack andreasnoack changed the title Delay throwing when CHOLMOD factorizations fail WIP: Delay throwing when CHOLMOD factorizations fail Jun 13, 2017
[1.0 0.0; 0.0 -1.0]
successful: false
```
"""
Copy link
Contributor

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

if s.is_ll == 1
return true
else
return :maybe
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member Author

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.

@andreasnoack andreasnoack force-pushed the anj/sparsesolve branch 2 times, most recently from 2c76212 to 3d9121c Compare June 13, 2017 15:09
@andreasnoack andreasnoack changed the title WIP: Delay throwing when CHOLMOD factorizations fail RFC: Delay throwing when CHOLMOD factorizations fail Jun 13, 2017
@@ -16,6 +16,26 @@ macro assertnonsingular(A, info)
:($(esc(info)) == 0 ? $(esc(A)) : throw(SingularException($(esc(info)))))
end

"""

Copy link
Contributor

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

@tkelman
Copy link
Contributor

tkelman commented Jun 13, 2017

I like the approach. I wonder if it's too much of a pun to dispatch this on the existing success function.

@andreasnoack
Copy link
Member Author

andreasnoack commented Jun 14, 2017

I'm fine with overloading success. I don't see how it could cause confusion. The only minor issue is the missing is that most other of our testing functions have and that success(Cmd) is mainly about side effects whereas success(Factorization) would just be checking a state.

@@ -1750,17 +1760,27 @@ end

det(L::Factor) = exp(logdet(L))

function isposdef(A::SparseMatrixCSC{<:VTypes,SuiteSparse_long})
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduce issuccess function to test if a Factorization succeeded.

Fixes #22335
@kshyatt kshyatt added the error handling Handling of exceptions by Julia or the user label Jun 21, 2017
@andreasnoack andreasnoack merged commit 1509716 into master Jun 24, 2017
@andreasnoack andreasnoack deleted the anj/sparsesolve branch June 24, 2017 19:18
DrTodd13 pushed a commit to IntelLabs/julia that referenced this pull request Jun 26, 2017
Introduce issuccess function to test if a Factorization succeeded.

Fixes JuliaLang#22335
issuccess(B::BunchKaufman) = B.info == 0

function Base.show(io::IO, F::BunchKaufman)
println(io, summary(F))
Copy link
Contributor

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

Copy link
Member Author

@andreasnoack andreasnoack Jun 27, 2017

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.

Copy link
Member Author

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.

Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error handling Handling of exceptions by Julia or the user linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants