Repository navigation
Apply the CG preconditioner to the initial residual - #155
Merged
SamDuffield merged 1 commit intoNov 13, 2026
Merged
SamDuffield merged 1 commit into
SamDuffield merged 1 commit into
Conversation
Fixes normal-computing-oss#154. Signed-off-by: Keshav Tibrewal <keshav.tibrewal@iitgn.ac.in>
SamDuffield
approved these changes
Nov 13, 2026
SamDuffield
left a comment
Contributor
There was a problem hiding this comment.
Ooops! Good spot and thanks for the fix
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.
Fixes #154.
cgstarts with the raw residual as its search direction, then appliesMonly on subsequent iterations. Initializez0andp0withM(r0)so the preconditioner is used from the first step.The regression uses an exact inverse preconditioner for a diagonal positive-definite system. It should solve the system in one iteration. Eight cases cover tensor and dictionary parameters, zero and nonzero initial guesses, and damping. All eight fail on main and pass with the fix. The
Mdocstring now clarifies its role.Validation on Python 3.12.14 and PyTorch 2.15.0+cpu:
pytest tests/test_utils.py tests/test_tree_utils.py -q: 35 passed.git diff --checkpassed.The full sampling suite is still running locally; a full-suite pass is not claimed.