Arpack.jl
Arpack.jl copied to clipboard
“eigs” function doesn’t work for a sparse matrix with one or more zero pivots
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.
Since you have a Hermitian matrix, try eigs(ham, nev=1, which=:SR) i.e use the real part option.