I am trying to compile the example provided for Eigen::JacobiSVD and I am getting the following error,
/usr/local/include/eigen3/Eigen/src/SVD/JacobiSVD.h: In instantiation of ‘Eigen::JacobiSVD<MatrixType, QRPreconditioner>& Eigen::JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType&, unsigned int) [with _MatrixType = Eigen::Matrix<float, -1, -1>; int QRPreconditioner = 40; Eigen::JacobiSVD<MatrixType, QRPreconditioner>::MatrixType = Eigen::Matrix<float, -1, -1>]’:
/usr/local/include/eigen3/Eigen/src/SVD/JacobiSVD.h:549:14: required from ‘Eigen::JacobiSVD<MatrixType, QRPreconditioner>::JacobiSVD(const MatrixType&, unsigned int) [with _MatrixType = Eigen::Matrix<float, -1, -1>; int QRPreconditioner = 40; Eigen::JacobiSVD<MatrixType, QRPreconditioner>::MatrixType = Eigen::Matrix<float, -1, -1>]’
demo.cpp:9:55: required from here
/usr/local/include/eigen3/Eigen/src/SVD/JacobiSVD.h:692:27: error: ‘struct Eigen::internal::qr_preconditioner_impl<Eigen::Matrix<float, -1, -1>, 40, 0, true>’ has no member named ‘run’
m_qr_precond_morecols.run(*this, m_scaledMatrix);
~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/local/include/eigen3/Eigen/src/SVD/JacobiSVD.h:693:27: error: ‘struct Eigen::internal::qr_preconditioner_impl<Eigen::Matrix<float, -1, -1>, 40, 1, true>’ has no member named ‘run’
m_qr_precond_morerows.run(*this, m_scaledMatrix);
Could you please help me with this? Thanks
Code :
#include <Eigen/Core>
#include <Eigen/SVD>
#include <iostream>
using namespace std;
using namespace Eigen;
int main () {
MatrixXf m = MatrixXf::Random(3,2);
cout << "Here is the matrix m:" << endl << m << endl;
JacobiSVD<MatrixXf, ComputeThinU | ComputeThinV> svd(m);
cout << "Its singular values are:" << endl << svd.singularValues() << endl;
cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl;
cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl;
Vector3f rhs(1, 0, 0);
cout << "Now consider this rhs vector:" << endl << rhs << endl;
cout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl;
}
g++ : 7.5
Eigen : 3.4.0