Skip to content

Conversation

ChrisRackauckas
Copy link
Member

@YingboMa do you have ideas for other dispatches that would be good? Should there be a fallback?

Copy link
Contributor

@YingboMa YingboMa left a comment

Choose a reason for hiding this comment

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

It would be good to have UpperTriangular, LowerTriangular, Symmetric, and Hermitian, too. For the Hermitian type we can use isposdef, and Symmetric can use bunchkaufman.

Also, could you add some tests?

@ChrisRackauckas
Copy link
Member Author

Can you take it from here? It seems you have a bunch of ideas so that might be quicker.

@YingboMa
Copy link
Contributor

Done. @ChrisRackauckas could you take a look?

"""
issingular(A::Matrix) = !issuccess(lu(A, check=false))
issingular(A::UniformScaling) = A.λ == 0
issingular(A::Diagonal) = any(iszero,A.diag)
Copy link
Contributor

Choose a reason for hiding this comment

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

One could add here

issingular(B::Bidiagonal) = any(iszero, A.dv)
issingular(S::SymTridiagonal) = diaganyzero(iszero, ldlt(S).data)
issingular(T::Tridiagonal) = !issuccess(lu(A, check=false))

And perhaps as a fallback (which fulfills the promise of the docstring)

issingular(A::AbstractMatrix) = issingular(Matrix(A))
issingular(A::AbstractSparseMatrix) = !issuccess(lu(A, check=false))

@ChrisRackauckas
Copy link
Member Author

Note I reverted the README change @YingboMa but it's expected that issingular is the best way to check for it: if it's ever faster to use rank, then the dispatch should be to use rank.

@ChrisRackauckas ChrisRackauckas merged commit 9b6e7f3 into master Mar 19, 2020
@ChrisRackauckas ChrisRackauckas deleted the issingular branch March 19, 2020 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants