eclipse0922
eclipse0922

Reputation: 178

Eigen library function same as lapack dsyev_

I downloaded some opensource using lapack/blas and i want to change that into Eigenbased source for auto SIMD code generation.

Is there any function in Eigen library same as dsyev in LAPACK.

dsyve returns info value for several purposes.

but as far as i know, eigensolver in Eigen library returns eigenvalue or eigenvector.

Is there a function what i want in Eigen library.

Upvotes: 0

Views: 450

Answers (1)

kangshiyin
kangshiyin

Reputation: 9779

I think what you want is .info(), as well as other APIs provided by SelfAdjointEigenSolver.

The tutorial page also shows how to use it.

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

If you really want to know the details of NoConvergence as reported by dsyev(), you may have to use the low-level 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.

Upvotes: 2

Related Questions