How do I determine if a matrix is positive definite using MATLAB?
55 次查看(过去 30 天)
显示 更早的评论
A symmetric matrix is defined to be positive definite if the real parts of all eigenvalues are positive.
A non-symmetric matrix (B) is positive definite if all eigenvalues of (B+B')/2 are positive.
采纳的回答
MathWorks Support Team
2013-9-9
This change has been incorporated into the documentation in Release 14 Service Pack 3 (R14SP3). For previous releases, read below for any additional information:
Rather than using the EIG function to obtain the eigenvalues in order to determine positive definiteness, it is more computationally efficient to use the CHOL function. The CHOL function provides an optional second output argument "p" which is zero if the matrix is found to be positive definite. If the input matrix is not positive definite, then "p" will be a positive integer:
>>[~,p] = chol(zeros(3))
p =
1
The CHOL function will return an error if it is only provided with a single output argument, and is also given a matrix that is not positive definite. NOTE: CHOL expects its input matrix to be symmetric and only looks at the upper triangular portion of the matrix.
3 个评论
Walter Roberson
2013-12-24
I think Sepehr is implying that the "p" output of chol() is returning 0, implying that chol thinks it is positive definite. (I have not tried it myself.)
Mohammad Haghighat
2014-3-14
编辑:Mohammad Haghighat
2014-3-14
Unfortunately, I couldn't see the code since the open-source code for chol.m was not available for me.
However, they might have considered " greater than or equal" as in the definition of " positive semi-definite ". That might be the reason why it gives a 0 to p.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!