LLT::rankUpdate() requires explicit inclusion of Jacobi module
Submitted by Björn Barz
Assigned to Nobody
Link to original bugzilla bug (#1455)
Version: 3.3 (current stable)
Description
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.
Edited by Eigen Bugzilla