Fix maxiter behavior for fallback gradient linear solver#261
Merged
Fix maxiter behavior for fallback gradient linear solver#261
maxiter behavior for fallback gradient linear solver#261Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
lkdvos
approved these changes
Sep 22, 2025
Member
lkdvos
left a comment
There was a problem hiding this comment.
Looks reasonable to me. In general we never really want to hit the maxiter anyways, and hope to reach the requested tolerance, so I think this is good.
lkdvos
approved these changes
Sep 23, 2025
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.
When falling back on a linear solver for computing the fixed-point gradient in case the eigsolver approach failed, the linear solver inherits its
maxitersetting from the original eigsolver. However, due to difference in what an 'iteration' means in Krylov-based versus non-Krylov-based linear solvers from KrylovKit.jl, this default behavior can give a fallback solver with a very lowmaxitersetting.In particular, now when using an
Arnoldisolver with a smallmaxiterand a largekrylovdim, the backup solver will be aBiCGStabsolver with a smallmaxiter, while thekrylovdimis just lost.Ideally, KrylovKit.jl would allow some way of setting a maximum number of function applications (which is really what we want to do here) that works the same way across all algorithms regardless of whether or not they're actually Krylov methods. For now though, we can kind of emulate this behavior by just combining the
maxiterandkrylovdimof the eigsolver into themaxiterfor the backup linear solver. I think this should be fine for now, and should at least avoid the issue until there is a better fix available.