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

Generalized eigenvalue problem with symmetric matrices: complex solution!? #140

Open
PetrKryslUCSD opened this issue Jan 13, 2022 · 2 comments

Comments

@PetrKryslUCSD
Copy link
Contributor

PetrKryslUCSD commented Jan 13, 2022

Arpack v0.5.3: The generalized eigenvalue problem with symmetric matrices should return real eigenvalues and real eigenvectors. The eigs function fails to do that:

using LinearAlgebra
using SparseArrays 
using Arpack
neigvs = 2
K = sparse([1, 4, 5, 2, 3, 1, 4, 8, 1, 5, 8, 6, 7, 4, 5, 8], [1, 1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 7, 8, 8, 8], [2.37230e+05, -2.80193e+05, 1.18615e+05, 8.82496e+05, 6.80939e+08, -2.80193e+05, 8.82496e+05, 2.80193e+05, 1.18615e+05, 4.74459e+05, 1.18615e+05, 1.00348e+05, 4.74459e+05, 2.80193e+05, 1.18615e+05, 2.37230e+05], 8, 8)                                      
M = sparse([1, 4, 5, 2, 3, 1, 4, 8, 1, 5, 8, 6, 7, 4, 5, 8], [1, 1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 6, 7, 8, 8, 8], [3.16529e-01, 8.08509e-01, -2.37158e-01, 1.52896e+01, 1.37166e+01, 8.08509e-01, 1.52896e+01, -8.08509e-01, -2.37158e-01, 6.33057e-01, -2.37158e-01, 4.77869e-03, 6.33057e-01, -8.08509e-01, -2.37158e-01, 3.16529e-01], 8, 8) 
evals, evecs, nconv = eigs(Symmetric(K), Symmetric(M); nev=neigvs, which=:SM);

# First  we should check that the requested eigenvalues actually converged:
@show nconv == neigvs

fs = sqrt.(evals) / (2 * pi);
println("Approximate frequencies: $fs [Hz]")
println("Target frequencies: $([1.66013e+01, 3.76332e+01]) [Hz]")

gives

nconv == neigvs = true                                                                                                                                                                 
Approximate frequencies: ComplexF64[1.66645e+01 + 0.00000e+00im, 3.82365e+01 + 0.00000e+00im] [Hz]                                                                                     
Target frequencies: [1.66013e+01, 3.76332e+01] [Hz]   

This works as expected with Arpack v0.4.

@PetrKryslUCSD
Copy link
Contributor Author

I found that setting explicittransform = :none in the argument list fixes this issue. I believe the explicit transform was going to be set to default to :none?

@PetrKryslUCSD
Copy link
Contributor Author

#120?

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