1MatrixXd A(3,3);
2A << 4,-1,2, -1,6,0, 2,0,5;
3cout << "The matrix A is" << endl << A << endl;
4
5LLT<MatrixXd> lltOfA(A); // compute the Cholesky decomposition of A
6MatrixXd L = lltOfA.matrixL(); // retrieve factor L  in the decomposition
7// The previous two lines can also be written as "L = A.llt().matrixL()"
8
9cout << "The Cholesky factor L is" << endl << L << endl;
10cout << "To check this, let us compute L * L.transpose()" << endl;
11cout << L * L.transpose() << endl;
12cout << "This should equal the matrix A" << endl;
13