Documentation of LDLT.info() does not match with the computation
Submitted by Hongkai Dai
Assigned to Nobody
Link to original bugzilla bug (#1458)
Version: 3.3 (current stable)
Operating system: Linux
Description
The documentation of LDLT.info()
says it will report NumericalIssue
if the matrix appears to be negative https://eigen.tuxfamily.org/dox/classEigen_1_1LDLT.html#ae0eaebda205d5578085c3f9ea7b042d4. But I tested LDLT on four matrices, being positive definite, negative definite, indefinite or asymmetric, in all four cases the info are Eigen::Success
. Should we update the documentation?
My test script is
Eigen::LDLTEigen::Matrix2d ldlt1(Eigen::Matrix2d::Identity());
std::cout << "ldlt1.info() == Eigen::Success: " << (ldlt1.info() == Eigen::Success) << std::endl;
std::cout << "is positive: " << ldlt1.isPositive() << "\nis negative: " << ldlt1.isNegative() << std::endl;
Eigen::LDLTEigen::Matrix2d ldlt2(-Eigen::Matrix2d::Identity());
std::cout << "ldlt2.info() == Eigen::Success: " << (ldlt2.info() == Eigen::Success) << std::endl;
std::cout << "is positive: " << ldlt2.isPositive() << "\nis negative: " << ldlt2.isNegative() << std::endl;
Eigen::Matrix2d m3;
m3 << 1, 0, 0, -1;
Eigen::LDLTEigen::Matrix2d ldlt3(m3);
std::cout << "ldlt3.info() == Eigen::Success: " << (ldlt3.info() == Eigen::Success) << std::endl;
std::cout << "is positive: " << ldlt3.isPositive() << "\nis negative: " << ldlt3.isNegative() << std::endl;
Eigen::Matrix2d m4;
m4 << 1, 1, 0, -1;
Eigen::LDLTEigen::Matrix2d ldlt4(m4);
std::cout << "ldlt4.info() == Eigen::Success: " << (ldlt4.info() == Eigen::Success) << std::endl;
std::cout << "is positive: " << ldlt4.isPositive() << "\nis negative: " << ldlt4.isNegative() << std::endl;
And the output is
ldlt1.info() == Eigen::Success: 1
is positive: 1
is negative: 0
ldlt2.info() == Eigen::Success: 1
is positive: 0
is negative: 1
ldlt3.info() == Eigen::Success: 1
is positive: 0
is negative: 0
ldlt4.info() == Eigen::Success: 1
is positive: 0
is negative: 0