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

Bug 1455

Summary: LLT::rankUpdate() requires explicit inclusion of Jacobi module
Product: Eigen Reporter: Björn Barz <bjoern.barz>
Component: CholeskyAssignee: Nobody <eigen.nobody>
Status: RESOLVED FIXED    
Severity: Documentation CC: chtz, gael.guennebaud
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Whiteboard:

Description Björn Barz 2017-08-04 10:03:43 UTC
The LLT::rankUpdate() method apparently requires the Jacobi module. This requirement is not documented anywhere and straightforward use of the method without explicitly including Eigen/Jacobi leads to compiler errors.

For example, trying to compile the following code:

    #include <Eigen/Core>
    #include <Eigen/Cholesky>
    using namespace Eigen;

    int main(int argc, char * argv[])
    {
        MatrixXd A = MatrixXd::Random(10, 10);
        A = A * A.transpose();
        VectorXd v = VectorXd::Random(10);

        LLT<MatrixXd> llt(A);
        llt.rankUpdate(v);

        return 0;
    }

This leads to the following compiler errors:

    In file included from /home/barz/lib/eigen-3.3.4/Eigen/Cholesky:31:0,
                     from eigen_test.cc:2:
    /home/barz/lib/eigen-3.3.4/Eigen/src/Cholesky/LLT.h: In instantiation of ‘Eigen::Index Eigen::internal::llt_rank_update_lower(MatrixType&, const VectorType&, const typename MatrixType::RealScalar&) [with MatrixType = Eigen::Matrix<double, -1, -1>; VectorType = Eigen::Matrix<double, -1, 1>; Eigen::Index = long int; typename MatrixType::RealScalar = double]’:
    /home/barz/lib/eigen-3.3.4/Eigen/src/Cholesky/LLT.h:362:66:   required from ‘static Eigen::Index Eigen::internal::llt_inplace<Scalar, 1>::rankUpdate(MatrixType&, const VectorType&, const RealScalar&) [with MatrixType = Eigen::Matrix<double, -1, -1>; VectorType = Eigen::Matrix<double, -1, 1>; Scalar = double; Eigen::Index = long int; Eigen::internal::llt_inplace<Scalar, 1>::RealScalar = double]’
    /home/barz/lib/eigen-3.3.4/Eigen/src/Cholesky/LLT.h:462:91:   required from ‘Eigen::LLT<MatrixType, _UpLo> Eigen::LLT<MatrixType, UpLo>::rankUpdate(const VectorType&, const RealScalar&) [with VectorType = Eigen::Matrix<double, -1, 1>; _MatrixType = Eigen::Matrix<double, -1, -1>; int _UpLo = 1; Eigen::LLT<MatrixType, UpLo>::RealScalar = double]’
    eigen_test.cc:12:21:   required from here
    /home/barz/lib/eigen-3.3.4/Eigen/src/Cholesky/LLT.h:254:30: error: ‘Eigen::JacobiRotation<double> g’ has incomplete type
           JacobiRotation<Scalar> g;
                                  ^
    /home/barz/lib/eigen-3.3.4/Eigen/src/Cholesky/LLT.h:262:44: error: ‘apply_rotation_in_the_plane’ was not declared in this scope
             apply_rotation_in_the_plane(x, y, g);
                                                ^

Adding "#include <Eigen/Jacobi>" solves this.
This requirement should either be documented or resolved implicitly.
Comment 1 Gael Guennebaud 2017-08-22 09:38:39 UTC
Thank you for the report, fixed:

https://bitbucket.org/eigen/eigen/commits/efc40ce4441a/
https://bitbucket.org/eigen/eigen/commits/2e6e26b851a8/ (3.3)
Comment 2 Nobody 2019-12-04 17:07: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/1455.