Eigenvalue Problem Solvers

LS.solve(prob, alg; kwargs) for an EigenvalueProblem.

Solves for the eigenpairs $(\lambda, v)$ of $Av = \lambda v$ (or the generalized problem $Av = \lambda Bv$ when a second operator is supplied) defined by prob using the algorithm alg. If no algorithm is given, DenseEigen() is used.

The default DenseEigen() wraps LinearAlgebra.eigen and is the right choice for small to moderately sized dense matrices, or whenever most/all of the spectrum is needed. It always computes the full dense eigendecomposition before selecting the requested eigenpairs, so its cost does not depend on num_eigenpairs.

For large sparse or structured matrices where only a handful of eigenpairs are needed, an iterative Krylov-based backend is preferred, since these only ever factorize/apply A (and B) and never form the dense decomposition:

  • KrylovKitEigen() is a solid default iterative choice: it supports both standard and generalized problems, extremal targets, and interior (shift) targets.
  • ArpackJL() is a mature, widely-used implicitly restarted Arnoldi/Lanczos solver, also supporting extremal and shifted targets on standard and generalized problems.
  • LS.ArnoldiMethod() is a pure-Julia implicitly restarted Arnoldi method. It has no direct EigenvalueTarget.SmallestMagnitude support; use shift (shift-and-invert) or another backend for interior/smallest eigenvalues instead.
  • JacobiDavidsonJL() is a target/interior method: it is most effective when a shift close to the desired eigenvalues is known. It does not support generalized eigenvalue problems.

Full List of Methods

LinearAlgebra (built-in)

LinearSolve.AbstractEigenvalueAlgorithmType
AbstractEigenvalueAlgorithm

Base type for algorithms that solve an EigenvalueProblem. An instance is passed as the second argument of solve(prob::EigenvalueProblem, alg); when no algorithm is given, DenseEigen() is used.

The concrete algorithms are:

  • DenseEigen: dense LinearAlgebra.eigen, the default; always available.
  • ArpackJL: Arpack.eigs (requires using Arpack).
  • ArnoldiMethodJL / ArnoldiMethod: ArnoldiMethod.partialschur (requires using ArnoldiMethod).
  • KrylovKitEigen: KrylovKit.eigsolve (requires using KrylovKit).
  • JacobiDavidsonJL: JacobiDavidson.jdqr (requires using JacobiDavidson).

A new backend subtypes this type and defines SciMLBase.solve(prob::EigenvalueProblem, alg::MyAlg, args...; kwargs...), returning an EigenvalueSolution (see SciMLBase.build_eigenvalue_solution). The fallback method for the abstract type throws "The eigenvalue backend ... is not available", which is what a user sees when an extension-backed algorithm is used before its package has been loaded.

source
LinearSolve.DenseEigenType
DenseEigen()

Solve the EigenvalueProblem with LinearAlgebra.eigen. This is the default algorithm: it computes the full dense eigendecomposition and then selects the requested eigenpairs (via num_eigenpairs, eigentarget, or shift) from it. Best for small to moderately sized dense matrices where every eigenpair (or a sizable fraction of them) is needed.

source

Arpack.jl

Note

Using this solver requires adding the package Arpack.jl, i.e. using Arpack

LinearSolve.ArpackJLType
ArpackJL(; kwargs...)

Solve the EigenvalueProblem with Arpack.jl's eigs, an iterative Krylov (implicitly restarted Arnoldi/Lanczos) solver well suited to computing a handful of extremal eigenpairs of a large sparse or structured matrix. Extra kwargs are forwarded to Arpack.eigs.

Note

Using this solver requires loading Arpack.jl, i.e. using Arpack.

source

ArnoldiMethod.jl

Note

Using this solver requires adding the package ArnoldiMethod.jl, i.e. using ArnoldiMethod

LinearSolve.ArnoldiMethodFunction
ArnoldiMethod(; kwargs...)

Solve the EigenvalueProblem with ArnoldiMethod.jl's partialschur, a pure-Julia implicitly restarted Arnoldi method for large sparse or structured matrices. Extra kwargs are forwarded to ArnoldiMethod.partialschur.

Restrictions of the backend:

  • Standard problems only: a generalized problem (B !== nothing) raises an error.
  • eigentarget = EigenvalueTarget.SmallestMagnitude is not supported directly; supply shift for shift-and-invert instead, or use another backend such as KrylovKitEigen() or ArpackJL().

This constructor returns an ArnoldiMethodJL; the two names build the same algorithm. Once the ArnoldiMethod.jl package is loaded the bare name ArnoldiMethod refers to that module, so use ArnoldiMethodJL(; kwargs...) (or LinearSolve.ArnoldiMethod) in that case.

Note

Using this solver requires loading ArnoldiMethod.jl, i.e. using ArnoldiMethod.

source
LinearSolve.ArnoldiMethodJLType
ArnoldiMethodJL(; kwargs...)

Solve the EigenvalueProblem with ArnoldiMethod.jl's partialschur, a pure-Julia implicitly restarted Arnoldi method for computing a few eigenpairs of a large sparse or structured matrix. Extra kwargs are forwarded to ArnoldiMethod.partialschur (for example tol, mindim, maxdim, restarts).

Restrictions of the backend:

  • Standard problems only: a generalized problem (B !== nothing) raises an error.
  • eigentarget = EigenvalueTarget.SmallestMagnitude is not supported directly (ArnoldiMethod has no such target); supply shift for shift-and-invert, which factorizes A - shift*I and finds the eigenvalues nearest shift, or use another backend such as KrylovKitEigen() or ArpackJL().

ArnoldiMethodJL(; kwargs...) and ArnoldiMethod(; kwargs...) build the same algorithm object; this is the spelling to prefer once the ArnoldiMethod.jl package is loaded. Loading that package is what makes the solver available, and it binds the name ArnoldiMethod to the module, so after using LinearSolve, ArnoldiMethod a bare ArnoldiMethod(; kwargs...) reaches the module rather than the constructor and fails with "objects of type Module are not callable" (and ?ArnoldiMethod shows the module's help). ArnoldiMethodJL does not collide, and matches how the other backends are named.

Note

Using this solver requires loading ArnoldiMethod.jl, i.e. using ArnoldiMethod.

source

KrylovKit.jl

Note

Using this solver requires adding the package KrylovKit.jl, i.e. using KrylovKit

LinearSolve.KrylovKitEigenType
KrylovKitEigen(; kwargs...)

Solve the EigenvalueProblem with KrylovKit.jl's eigsolve, a Krylov solver for a few extremal or interior (shifted) eigenpairs of a large sparse or structured matrix. Extra kwargs are forwarded to the KrylovKit call (for example tol, krylovdim, maxiter, issymmetric, ishermitian, isposdef).

Which KrylovKit routine runs depends on the problem:

  • Standard problem, no shift: KrylovKit.eigsolve(A, nev, which) with which derived from eigentarget; no symmetry or definiteness is required of A.
  • Any problem with a shift: shift-and-invert. A - shift*I (or A - shift*B for a generalized problem) is factorized and KrylovKit.eigsolve is run on the inverse operator, so general (non-Hermitian) pencils are supported on this path.
  • Generalized problem without a shift: KrylovKit.geneigsolve((A, B), nev, which). KrylovKit only implements the symmetric/Hermitian case with positive definite B and throws an ArgumentError otherwise (it also rejects the imaginary-part targets). For matrices these properties are detected automatically; for other operator types pass issymmetric = true/ishermitian = true and isposdef = true through kwargs. For a non-Hermitian pencil supply a shift instead.
Note

Using this solver requires loading KrylovKit.jl, i.e. using KrylovKit.

source

JacobiDavidson.jl

Note

Using this solver requires adding the package JacobiDavidson.jl, i.e. using JacobiDavidson

LinearSolve.JacobiDavidsonJLType
JacobiDavidsonJL(; kwargs...)

Solve the EigenvalueProblem with JacobiDavidson.jl's jdqr, a target/interior method that finds the eigenvalues nearest a given shift. Does not support generalized eigenvalue problems (upstream jdqz is broken). Extra kwargs are forwarded to JacobiDavidson.jdqr.

Note

Using this solver requires loading JacobiDavidson.jl, i.e. using JacobiDavidson.

source