Reputation: 1090
I am persistently getting error messages whenever I try to use the selfadjointView property of any matrix or sparse matrix using the eigen library. Below is a simple code to check that. In my program I do try with self-adjoint matrix:
#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
#include <Eigen/Sparse>
#include <Eigen/Dense>
#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
int main ()
{
SparseMatrix<float> mat(3,3);
Matrix<float, 3, 1> vec;
std::cout<<mat.selfadjointView<>()*vec;
}
The error message I get is: error: no matching function for call to ‚'Eigen::SparseMatrix::selfadjointView()‚
Upvotes: 3
Views: 3241
Reputation: 4532
You have to specify the template argument, so it should read mat.selfadjointView<Upper>()
or mat.selfadjointView<Lower>()
. The first one means that it should use the entries in the upper triangular part of mat
and fill the lower triangular part to make the matrix self-adjoint. The second one is the other way around.
Upvotes: 3