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

“eigs” function doesn’t work for a sparse matrix with one or more zero pivots #135

Open
k-tamuraphys opened this issue Aug 7, 2021 · 1 comment

Comments

@k-tamuraphys
Copy link

Hi, I am trying to obtain the lowest eigenvalue of a sparse hermitian matrix with one or more zero pivots.
For example, my matrix has the following form:

ham
6×6 SparseMatrixCSC{Float64, Int64} with 10 stored entries:
5.0   ⋅   1.0  -1.0   ⋅     ⋅
   ⋅    ⋅    ⋅     ⋅    ⋅     ⋅
  1.0   ⋅    ⋅     ⋅    ⋅    1.0
 -1.0   ⋅    ⋅     ⋅    ⋅   -1.0
   ⋅    ⋅    ⋅     ⋅    ⋅     ⋅
   ⋅    ⋅   1.0  -1.0   ⋅    5.0

.
When I execute the “eigs” function for the above matrix, I get the following error message:

energy, ψ = eigs(ham, nev=1, which=:SM)
LoadError: ZeroPivotException: factorization encountered one or more zero pivots. Consider switching to a pivoted LU factorization.
ZeroPivotException: factorization encountered one or more zero pivots. Consider switching to a pivoted LU factorization.

According to the massage, it suggest the use of a pivoted LU factorization, can I chose it?
If not, is this designed with a purpose?
It would be nice to have it work for matrices that contain zero pivots.

@jd-foster
Copy link

Since you have a Hermitian matrix, try eigs(ham, nev=1, which=:SR) i.e use the real part option.

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