Add EigenvalueProblem support with dense, Arpack, ArnoldiMethod, KrylovKit, and JacobiDavidson backends#1071
Open
AJ0070 wants to merge 9 commits into
Open
Add EigenvalueProblem support with dense, Arpack, ArnoldiMethod, KrylovKit, and JacobiDavidson backends#1071AJ0070 wants to merge 9 commits into
AJ0070 wants to merge 9 commits into
Conversation
…ovKit, and JacobiDavidson backends
Contributor
Author
| @@ -0,0 +1,141 @@ | |||
| """ | |||
| 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` |
Member
There was a problem hiding this comment.
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 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) |
Member
There was a problem hiding this comment.
Args and kwargs need to throw errors if wrong
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 : |
Member
|
LTS is having an issue with this. Make sure you're using the EnumX appropriately. The type is the enum.T |
… with ReturnCode.T field annotation
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 |
Member
There was a problem hiding this comment.
Just bump the SciMLBase lower bound.
Comment on lines
+577
to
+579
| export AbstractEigenvalueAlgorithm, | ||
| DenseEigen, ArpackJL, ArnoldiMethod, ArnoldiMethodJL, | ||
| KrylovKitEigen, JacobiDavidsonJL |
Member
There was a problem hiding this comment.
Need a doc poge about the eigenvalue solvers, and a tutorial
Member
|
QA failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
EigenvalueProblemabstraction analogous toLinearProblem, withsolvedispatch and shared spectral selection (which,sigma).DenseEigen(default, viaLinearAlgebra.eigen) plusArpackJL,ArnoldiMethodJL,KrylovKitEigen, andJacobiDavidsonJLbackends as package extensions.default_nev.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 nearsigma.JacobiDavidson is wired up for standard problems only (upstream
jdqzis broken) and targets eigenvalues nearest the shift.Addresses #143.
AI Usage: Used GPT 5.5