Trying to use eigs
from Arpack
gives me a lot of trouble, is there any alternative?
Yes, for example
using ArnoldiMethod
decomp, history = partialschur(M)
λ, evs = partialeigen(decomp);
or
using KrylovKit
λ, evs = eigsolve(M);
where M
is the sparse matrix.
4 Likes
In LightGraphs, we have defined
function eigs(A; kwargs...)
schr =partialschur(A; kwargs...)
vals, vectors = partialeigen(schr[1])
reved = (kwargs[:which] == LR() || kwargs[:which] == LM())
k::Int = get(kwargs, :nev, length(vals))
k = min(k, length(vals))
perm = collect(1:k)
if vals[1] isa(Real)
perm = sortperm(vals, rev=reved)
perm = perm[1:k]
end
λ = vals[perm]
Q = vectors[:, perm]
return λ, Q
end
in terms of the functions exported from ArnoldiMethod.jl.
(cc @jpfairbanks). Don’t ask me how it works; I don’t do matrices.
1 Like
Thanks! I need the 2 argument version with generalized eigenvalue problem, not only the 1 argument one
What seems to be the problem?