Eigs does not work

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);


using KrylovKit
λ, evs = eigsolve(M);

where M is the sparse matrix.


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]
    λ = vals[perm]
    Q = vectors[:, perm]
    return λ, Q

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?