Bugzilla – Bug 736

LDLT isPositive incorrectly returns false for a positive semidefinite matrix

Last modified: 2014-02-06 12:37:56 UTC

Created attachment 419 [details] Test case for LDLT::isPositive According to the documentation for Eigen 3.2.0, LDLT::isPositive should return true if a matrix is positive semidefinite. See: http://eigen.tuxfamily.org/dox/classEigen_1_1LDLT.html#a02588e810c938a215dfd59d933488ba3 However, it returns false on some positive definite matrices. There is an example attached to this bug report. Given the matrix: 1 0 0 0 0 0 0 0 1 Both isPositive and isNegative return false. However, the eigenvalues are all non-negative and have no imaginary parts: 1 + 0i 0 + 0i 1 + 0i So this is a positive semidefinite matrix. LDLT::isPositive should return true.

Typo: "it returns false on some positive definite matrices" should be "it returns false on some positive semidefinite matrices". Also, I've tested this with a fresh checkout from bitbucket.org and it behaves the same as the 3.2.0 release.

I can confirm this. Even worse, isPositive and isNegative both return false for the zero matrix, which is of course both positive semi-definite and negative semi-definite. It does not seem that the case of the zero matrix is taken into account in the current implementation. In the presence of round-off error, the difference between positive definite and positive semi-definite is of course rather tricky, but for these matrices we should be able to do the right thing. Related may be the fix of bug 608.

I just committed a fix. changeset: 5751:b7308ae775bb user: Jitse Niesen <jitse@maths.leeds.ac.uk> date: Thu Feb 06 11:06:06 2014 +0000 summary: Fix bug 736: LDLT isPositive returns false for a positive semidefinite matrix changeset: 5752:6bb4d49bca4e branch: 3.2 tag: tip parent: 5748:79cff6ee0ed5 user: Jitse Niesen <jitse@maths.leeds.ac.uk> date: Thu Feb 06 11:06:06 2014 +0000 summary: Fix bug 736: LDLT isPositive returns false for a positive semidefinite matrix