[eigen] Using MatrixL

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


I am trying to use the MatrixL function with the SimplicialLLT class; see
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1SimplicialLLT.html#ab1d2a318355498a335b9923e0b12a290
I do not understand why I get the following message
error: invalid use of ‘Eigen::SimplicialLLT<Eigen::SparseMatrix<double, 0>, 1>::MatrixL’
when I compile the following program:

# include <iostream>
# include <Eigen/SparseCholesky>
# define TRY_TO_USE_MATRIXL 1
int main(void)
{
    typedef Eigen::SparseMatrix<double, Eigen::ColMajor> eigen_sparse;
typedef Eigen::SimplicialLLT<eigen_sparse, Eigen::Lower> eigen_cholesky;

    size_t n = 4;
    //
    // identity matrix
    eigen_sparse eye(n, n);
    for(size_t i = 0; i < n; i++)
        eye.insert(i, i) = 1.0;
    //
    // cholesky factor L * L^T
    eigen_cholesky cholesky;
    cholesky.compute( eye );
    //
    // unit vector in first coordinate direction
    eigen_sparse unit(n, 1);
    unit.insert(0, 0) = 1.0;
    //
    // solve eye * x = unit;
    eigen_sparse x = cholesky.solve(unit);
    //
    // print x
    std::cout << "x = " << x << std::endl;
    //
    // print L
# if TRY_TO_USE_MATRIXL
    std::cout << cholesky.MatrixL() << std::endl;
# endif
    //
    return 0;
}




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/