3

每当我尝试使用 eigen 库使用任何矩阵或稀疏矩阵的 selfadjointView 属性时,我都会不断收到错误消息。下面是一个简单的代码来检查。在我的程序中,我尝试使用自伴随矩阵:

#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;
}

我得到的错误消息是:错误:没有匹配函数调用“Eigen::SparseMatrix::selfadjointView()”</p>

4

1 回答 1

3

你必须指定模板参数,所以它应该是mat.selfadjointView<Upper>()or mat.selfadjointView<Lower>()。第一个意味着它应该使用上三角部分的条目mat并填充下三角部分以使矩阵自伴。第二个是相反的。

于 2011-08-25T01:03:21.987 回答