mathnet / mathnet-numerics

Math.NET Numerics
http://numerics.mathdotnet.com
MIT License
3.49k stars 897 forks source link

Matrix must be positive definite #997

Open ElDuderinoBerlin opened 1 year ago

ElDuderinoBerlin commented 1 year ago

Is there a way for checking that a matrix is not "positive definite"?

Regards Martin

jkalias commented 1 year ago

I am not sure this is an easy question to answer in a general way. It depends on whether the matrix is symmetric or not, or if you are interested to check if the matrix can be negative definite.

If you are just interested to check that the matrix is semi-positive definite, this would mean that there exists a vector x, such that x^T A x = 0. So if you find a non-trivial null space for the matrix, then you have your answer.

wo80 commented 1 year ago

From https://mathworld.wolfram.com/PositiveDefiniteMatrix.html:

The following are necessary (but not sufficient) conditions for a Hermitian matrix A (which by definition has real diagonal elements $a_{ii}$) to be positive definite.

  1. $a_{ii}>0$ for all $i$,
  2. $a{ii}+a{jj} > 2|\Re(a_{ij})|$ for $i \neq j$,
  3. The element with largest modulus lies on the main diagonal,
  4. $\det(A)>0$.

So if any of those conditions fail, you know the matrix is not p.d.