Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when trying to compute eigenpairs of Identity matrix #23

Closed
jkflying opened this issue Mar 6, 2017 · 3 comments
Closed

Exception when trying to compute eigenpairs of Identity matrix #23

jkflying opened this issue Mar 6, 2017 · 3 comments

Comments

@jkflying
Copy link
Contributor

jkflying commented Mar 6, 2017

SymEigsSolver<double, LARGEST_ALGE, SparseSymMatProd<double, Eigen::Lower>>

is throwing an exception when computing eigenpairs of an Identity matrix, with the message

TridiagEigen: eigen decomposition failed.

@yixuan
Copy link
Owner

yixuan commented Mar 6, 2017

Thanks. Could you also post a concrete example to reproduce this so that it is easier for me to debug?

@jkflying
Copy link
Contributor Author

jkflying commented Mar 7, 2017

Sure, here is an example:

#include <spectra/SymEigsSolver.h>
#include <spectra/MatOp/SparseSymMatProd.h>

void findEigsOfIdentity()
{
    using namespace Eigen;
    Index N = 20;
    SparseMatrix<double> mat(N, N);
    mat.setIdentity();

    using namespace Spectra;
    SparseSymMatProd<double, Lower> op(mat);
    SymEigsSolver<double, LARGEST_ALGE, SparseSymMatProd<double, Lower>> eigs(&op, N-1, N-1);
    eigs.init();
    eigs.compute(); // this throws exception
}

@yixuan
Copy link
Owner

yixuan commented Mar 7, 2017

Hi @jkflying , ncv needs to be larger than nev, so if you change the code to eigs(&op, N - 1, N) it works fine. This is one of the reasons why Spectra does not compute all the eigenpairs (#22).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants