Eigen库函数同lapack dsyev_

Eigen library function same as lapack dsyev_

我使用 lapack/blas 下载了一些开源代码,我想将其更改为基于 Eigen 的自动 SIMD 代码生成源。

Eigen 库中是否有与 LAPACK 中的 dsyev 相同的函数。

dsyve returns info 用于多种用途的值。

但据我所知,eigensolverEigen 图书馆 returns eigenvalueeigenvector.

Eigen 库中有我想要的函数吗?

我想你想要的是.info(), as well as other APIs provided by SelfAdjointEigenSolver

tutorial page 还展示了如何使用它。

#include <iostream>
#include <Eigen/Dense>

using namespace std;
using namespace Eigen;

int main()
{
   Matrix2f A;
   A << 1, 2, 2, 3;
   cout << "Here is the matrix A:\n" << A << endl;
   SelfAdjointEigenSolver<Matrix2f> eigensolver(A);
   if (eigensolver.info() != Success) abort();
   cout << "The eigenvalues of A are:\n" << eigensolver.eigenvalues() << endl;
   cout << "Here's a matrix whose columns are eigenvectors of A \n"
        << "corresponding to these eigenvalues:\n"
        << eigensolver.eigenvectors() << endl;
}

如果你真的想知道 dsyev() 所报告的 NoConvergence 的细节,你可能不得不使用低级 LAPACK API。

This function returns a value info.

If info=0, the execution is successful.

If info = -i, the i-th parameter had an illegal value.

If info = i, then the algorithm failed to converge; i indicates the number of elements of an intermediate tridiagonal form which did not converge to zero.