Skip to content

LDLT gives NAN result for linear solve using semi-definite matrix

Submitted by Etienne Vouga

Assigned to Nobody

Link to original bugzilla bug (#241)
Version: 3.0
Operating system: Linux

Description

LDLT is suppose to work for semi-definite symmetric matrices, but in some cases it returns a NAN result even when the system has a solution.

Example code:

#include <Eigen/Cholesky>
#include <Eigen/Core>
#include <iostream>

using namespace Eigen;
using namespace std;

int main()
{
MatrixXd A(2,2);
A << 1,1,1,1;
VectorXd rhs(2);
rhs << 0,0;
VectorXd result = A.ldlt().solve(rhs);
cout << result << endl;
}

Output:

-nan
-nan

Expected Output:

a
-a,

for any real number a.

Blocking

#55 (closed)

Edited by Eigen Bugzilla