Repository navigation
Compare CTMRG gradients against a converged reference - #438
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
leburgel
force-pushed
the
lb/gradient_tests
branch
from
October 10, 2026 17:57
4101079 to
c6d2c05
Compare
pbrehmer
reviewed
Oct 12, 2026
pbrehmer
left a comment
Collaborator
There was a problem hiding this comment.
Only have a very minor comment but overall this is a really nice simplification.
pbrehmer
approved these changes
Oct 12, 2026
leburgel
marked this pull request as ready for review
October 13, 2026 04:00
leburgel
force-pushed
the
lb/gradient_tests
branch
2 times, most recently
from
October 13, 2026 05:49
8950ce0 to
da40c3c
Compare
Replace the optimtest directional-derivative checks at atol = 1e-2 by comparing every gradient algorithm against one tightly converged fixed-point reference gradient per state and forward algorithm, which is itself checked against a finite difference of the energy. Cover each option at least once instead of the full product of all options.
Co-authored-by: Paul Brehmer <paul.brehmer@univie.ac.at>
leburgel
force-pushed
the
lb/gradient_tests
branch
from
October 14, 2026 08:11
da40c3c to
da53249
Compare
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.
The CTMRG gradient tests checked every gradient algorithm with
OptimKit.optimtest, comparing directional derivatives with finite differences atatol = 1e-2. That is too loose to catch actual gradient errors: the wrongImplicitGradientforC4vQRProjectorfixed in #435, for instance, passes it.This PR restructures
ctmrg_gradients.jlandc4v_ctmrg_gradients.jlaround a single reference:FixedPointGradientwith GMRES) is computed once and checked against a finite difference of the energy.miniter) to be compared at the same accuracy as the other algorithms.test/testsuite/gradients/gradient_utility.jl.Both test files also run faster than before, since far fewer cases are run.
Depends on #435: without it, the
C4vQRProjectorimplicit-gradient case fails.