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

Shift-and-invert mode wrong result compared to Matlab #172

Open
Litbeginner opened this issue Mar 21, 2024 · 1 comment
Open

Shift-and-invert mode wrong result compared to Matlab #172

Litbeginner opened this issue Mar 21, 2024 · 1 comment

Comments

@Litbeginner
Copy link

hello, I used the GenEigsRealShiftSolver to compute a large sym matrix (3362*3362), the eigenvalues and eigenvectors are different to the results get in Matlab.
Here is part of the code(it's used to calculate the mode profiles in Computational Electromagnetics):

double shift = (guess * k0) * (guess * k0);
DenseSymShiftSolve<double> op(P0);
SymEigsShiftSolver<DenseSymShiftSolve<double>> eigs(op, nmodes, 2*nmodes+1, shift);
ArrayXXd evalues;
MatrixXd evectors;

eigs.init();
eigs.compute(SortRule::LargestMagn,100000000,1e-8,SortRule::LargestMagn);
if (eigs.info() == CompInfo::Successful)
{
    evalues = eigs.eigenvalues().real();
    evectors = eigs.eigenvectors().real();
}

I think the Maximum number of iterations is big enough, and the difference between the results from this and matlab is obvious.

@Litbeginner
Copy link
Author

I also used the GenEigsRealShiftSolver, but the result is wrong.
Arguments: lamda = 0.78e-6; guess = 2.02; k0 = 2*3.1415926/lamda; nmodes = 3.
The matrix P0 :
P.zip

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

1 participant