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

Feature request: ispossemidef function #1232

Open
ignace-computing opened this issue Mar 3, 2025 · 2 comments
Open

Feature request: ispossemidef function #1232

ignace-computing opened this issue Mar 3, 2025 · 2 comments

Comments

@ignace-computing
Copy link

Currently, there exists a function isposdef.
I believe that it would be good to create a function ispossemidef, checking whether a matrix is positive semi-definite.
Any ideas on what would be a good way to implement such a method?

@ignace-computing ignace-computing changed the title Feature request: issemidef function Feature request: ispossemidef function Mar 3, 2025
@stevengj
Copy link
Member

stevengj commented Mar 3, 2025

This is quite difficult to check reliably. The basic issue is that roundoff errors make it virtually impossible to distinguish a matrix with zero eigenvalues from one with slightly negative eigenvalues.

In principle, we could do something similar to JuliaLang/julia#35057, i.e. checking that the eigenvalues are $\ge -\lambda_{\max} \epsilon$ for some relative tolerance $\epsilon$. Note that this would be much slower than the Cholesky-based approach of isposdef.

See also many previous discussions of this and related topics:

@araujoms
Copy link
Contributor

araujoms commented Mar 7, 2025

I would simply do isposdef(x+ϵ*I) for some tolerance ϵ. This is both too simple and too fragile to include in LinearAlgebra, though.

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

No branches or pull requests

3 participants