Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check for positive definiteness or positive semidefiniteness

I want to check if a matrix is positive definite or positive semidefinite using Python.

How can I do that? Is there a dedicated function in SciPy for that or in other modules?

like image 386
sramij Avatar asked Apr 06 '11 08:04

sramij


People also ask

How do you test for positive definiteness?

A matrix is positive definite if it's symmetric and all its pivots are positive. where Ak is the upper left k x k submatrix. All the pivots will be pos itive if and only if det(Ak) > 0 for all 1 k n. So, if all upper left k x k determinants of a symmetric matrix are positive, the matrix is positive definite.

How do you determine if a matrix is PSD?

A symmetric matrix is psd if and only if all eigenvalues are non-negative. It is nsd if and only if all eigenvalues are non-positive. It is pd if and only if all eigenvalues are positive. It is nd if and only if all eigenvalues are negative.

How do you determine if a matrix is positive or negative definite?

1. A is positive definite if and only if ∆k > 0 for k = 1,2,...,n; 2. A is negative definite if and only if (−1)k∆k > 0 for k = 1,2,...,n; 3. A is positive semidefinite if ∆k > 0 for k = 1,2,...,n − 1 and ∆n = 0; 4.

How do I know if my Hessian definite is positive?

The rules are: (a) If and only if all leading principal minors of the matrix are positive, then the matrix is positive definite. For the Hessian, this implies the stationary point is a minimum. (b) If and only if the kth order leading principal minor of the matrix has sign (-1)k, then the matrix is negative definite.


1 Answers

I assume you already know your matrix is symmetric.

A good test for positive definiteness (actually the standard one !) is to try to compute its Cholesky factorization. It succeeds iff your matrix is positive definite.

This is the most direct way, since it needs O(n^3) operations (with a small constant), and you would need at least n matrix-vector multiplications to test "directly".

like image 151
Alexandre C. Avatar answered Nov 04 '22 15:11

Alexandre C.