Add LSMR and general clean up of linear solvers - #1277
Open
msteinberg02 wants to merge 109 commits into
Open
Conversation
Fold _safe_b_norm_sq into conjugate_gradient.py and bicgstab.py, and _broadcast_batch_to into least_squares.py; remove both from utils.py. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Just for completeness: Although not mentioned, I am partly responsible for this PR as Maurice was doing this as part of a student project with me. So feel free to also reach out to me if necessary. there is also a small number of additional bugs that has been fixed in the linear optim module. |
…implicit_backward and fixed random seed Previous tolerance led to inconsistent passing of the test on the BiCGStab solver.
msteinberg02
commented
Aug 14, 2026
Author
There was a problem hiding this comment.
Tighetened tolerances to make test_implicit_backwards consistent on BiCGStab
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.
This PR adds LSMR to the linear solvers, as well as conduct a general clean up, including bug fixes, and standardisation across all linear solvers, particularly with regards to stopping criteria.
Also of note may be the addition of a dtype property for Tensorlists which is used in linear solvers but probably also useful elsewhere.
There were also changes done to the tests in test_optim, in particular decomposable physics were dropped in exchange for non-decomposable physics in
test_least_square_solvers, as theA_daggerroutine for decomposable physics never actually calls a solver.Additionally the test was slightly changed such that
prox_l2will no longer be seeded the exact solution, with the assertion now being that analytic optimality is reached, thus ensuring an actually meaningful test.Also added
test_least_squares_min_normto check for correct behavior on underdetermined systems.Checks to be done before submitting your PR
python3 -m pytest deepinv/testsruns successfully.black .andruff check .run successfully.make htmlruns successfully (in thedocs/directory).LLM policy
LLM usage is ok, but not PRs generated 100% by AI. See our LLM policy Tick below as appropriate: