Skip to content

Add EigenvalueProblem support with dense, Arpack, ArnoldiMethod, KrylovKit, and JacobiDavidson backends#1071

Open
AJ0070 wants to merge 9 commits into
SciML:mainfrom
AJ0070:fix/143-1
Open

Add EigenvalueProblem support with dense, Arpack, ArnoldiMethod, KrylovKit, and JacobiDavidson backends#1071
AJ0070 wants to merge 9 commits into
SciML:mainfrom
AJ0070:fix/143-1

Conversation

@AJ0070

@AJ0070 AJ0070 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

  • Added an EigenvalueProblem abstraction analogous to LinearProblem, with solve dispatch and shared spectral selection (which, sigma).
  • Added DenseEigen (default, via LinearAlgebra.eigen) plus ArpackJL, ArnoldiMethodJL, KrylovKitEigen, and JacobiDavidsonJL backends as package extensions.
  • Added genuine factorized shift-and-invert for KrylovKit, and fixed Arpack generalized problems and the iterative default_nev.
  • Added guarded tests covering every backend.

Define a problem, pick (or auto-select) an algorithm, and call solve, giving eigenvalue computations the same experience as linear solves. Standard (Av = λv) and generalized (Av = λBv) problems are supported, with shift-and-invert for interior eigenvalues near sigma.

JacobiDavidson is wired up for standard problems only (upstream jdqz is broken) and targets eigenvalues nearest the shift.

Addresses #143.
AI Usage: Used GPT 5.5

@AJ0070

AJ0070 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@ChrisRackauckas

Comment thread src/eigenvalue.jl Outdated
@@ -0,0 +1,141 @@
"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This goes in SciMLBase

Comment thread src/eigenvalue.jl Outdated
Define a standard or generalized eigenvalue problem.

The standard problem is ``A v = lambda v``. If `B` is supplied, the generalized
problem is ``A v = lambda B v``. `nev` requests a subset of eigenpairs, `which`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nev is not a self-explanatory name, what does it even mean?

which should be an EnumX like the rest of the interfaces. And it should define all of the enums with docstrings.

Comment thread src/eigenvalue.jl Outdated
Comment on lines +36 to +58
struct ArpackJL{A, K} <: AbstractEigenvalueAlgorithm
args::A
kwargs::K
end
ArpackJL(args...; kwargs...) = ArpackJL(args, kwargs)

struct ArnoldiMethodJL{A, K} <: AbstractEigenvalueAlgorithm
args::A
kwargs::K
end
ArnoldiMethod(args...; kwargs...) = ArnoldiMethodJL(args, kwargs)

struct KrylovKitEigen{A, K} <: AbstractEigenvalueAlgorithm
args::A
kwargs::K
end
KrylovKitEigen(args...; kwargs...) = KrylovKitEigen(args, kwargs)

struct JacobiDavidsonJL{A, K} <: AbstractEigenvalueAlgorithm
args::A
kwargs::K
end
JacobiDavidsonJL(args...; kwargs...) = JacobiDavidsonJL(args, kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Args and kwargs need to throw errors if wrong

Comment thread src/eigenvalue.jl Outdated
Comment on lines +190 to +195
function _target_symbol(w::EigenvalueTarget.T)
return w == EigenvalueTarget.LargestMagnitude ? :LM :
w == EigenvalueTarget.SmallestMagnitude ? :SM :
w == EigenvalueTarget.LargestRealPart ? :LR :
w == EigenvalueTarget.SmallestRealPart ? :SR :
w == EigenvalueTarget.LargestImaginaryPart ? :LI :

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the symbols...

@AJ0070 AJ0070 closed this Jul 7, 2026
@AJ0070 AJ0070 reopened this Jul 7, 2026
@ChrisRackauckas

Copy link
Copy Markdown
Member

LTS is having an issue with this. Make sure you're using the EnumX appropriately. The type is the enum.T

@AJ0070 AJ0070 requested a review from ChrisRackauckas July 8, 2026 10:19
Comment thread src/eigenvalue.jl
Comment on lines +1 to +11
# `EigenvalueProblem`, `EigenvalueSolution`, `EigenvalueTarget`, and
# `build_eigenvalue_solution` are defined natively in SciMLBase (analogous to
# `LinearProblem`/`LinearSolution`) once an upstream release adds them. Older
# SciMLBase versions lack them, so fall back to local definitions here,
# preserving the same public interface either way. This mirrors the existing
# `@static if isdefined(SciMLBase, :DiffEqArrayOperator)` gate further down in
# this module for the same reason: keep a wide SciMLBase compat range instead
# of forcing every LinearSolve user onto an upstream version they may not need.
@static if isdefined(SciMLBase, :EigenvalueProblem)
using SciMLBase: EigenvalueProblem, EigenvalueSolution, EigenvalueTarget,
build_eigenvalue_solution

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just bump the SciMLBase lower bound.

Comment thread src/LinearSolve.jl
Comment on lines +577 to +579
export AbstractEigenvalueAlgorithm,
DenseEigen, ArpackJL, ArnoldiMethod, ArnoldiMethodJL,
KrylovKitEigen, JacobiDavidsonJL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a doc poge about the eigenvalue solvers, and a tutorial

@ChrisRackauckas

Copy link
Copy Markdown
Member

QA failure.

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

Successfully merging this pull request may close these issues.

2 participants