This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen

Bug 1458

Summary: Documentation of LDLT.info() does not match with the computation
Product: Eigen Reporter: Hongkai Dai <daihongkai>
Component: CholeskyAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Unknown CC: chtz, gael.guennebaud
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: Linux   
Whiteboard:

Description Hongkai Dai 2017-08-04 16:34:04 UTC
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::LDLT<Eigen::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::LDLT<Eigen::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::LDLT<Eigen::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::LDLT<Eigen::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
Comment 1 Gael Guennebaud 2017-08-22 09:34:33 UTC
Thank you for the report, that's a copy-paste mistake, fixed:

https://bitbucket.org/eigen/eigen/commits/ecc350809cf1/
https://bitbucket.org/eigen/eigen/commits/2a4cf4f473dd/ (3.3)
Summary:     Bug 1458: fix documentation of LLT and LDLT info() method.
Comment 2 Nobody 2019-12-04 17:08:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1458.