Skip to content

Ensure dynamic tolerance scaling works for every gradient algorithm - #421

Merged
leburgel merged 2 commits into
mainfrom
lb/fix_updatetol
Aug 27, 2026
Merged

Ensure dynamic tolerance scaling works for every gradient algorithm#421
leburgel merged 2 commits into
mainfrom
lb/fix_updatetol

Conversation

@leburgel

@leburgel leburgel commented Aug 25, 2026

Copy link
Copy Markdown
Member

Missed in #413 after #410 was merged, but the fact that the custom MPSKit._updatetol implementation was specialized to FixedPointGradient meant that the new default configuration for an optimization using fixedpoint was broken when using an ImplicitGradient.

I added such a run to the example tests, to test ImplicitGradient via the public interface, and not just through raw gradient accuracy tests.

UPDATE: This exposed some issues with the corner type of the environment returned by leading_boundary when using implicit differentiation. In this case, we return the corner as a complex non-diagonal tensor map before evaluating the energy density, since the implicit differentiation approach relies on allowing complex non-diagonal adjoints of the corner. When setting reuse_env = true, the update! runs into a type mismatch between the initial environment (which will have a real diagonal corner when using a C4vEighProjector) and the corner to be updated (complex non-diagonal when used to evaluate the energy). Instead of converting the initial environment to have a complex non-diagonal corner, I opted to convert the corner type of the updated environment to a real diagonal if necessary.

@codecov

codecov Bot commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
...lgorithms/optimization/implicit_differentiation.jl 90.08% <100.00%> (ø)
src/environments/ctmrg_environments.jl 72.97% <100.00%> (+1.06%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leburgel
leburgel requested a review from pbrehmer August 26, 2026 09:54

@pbrehmer pbrehmer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@leburgel
leburgel enabled auto-merge (squash) August 26, 2026 11:47
@leburgel
leburgel disabled auto-merge August 27, 2026 06:49
@leburgel
leburgel merged commit 3b3da3d into main Aug 27, 2026
70 of 72 checks passed
@leburgel
leburgel deleted the lb/fix_updatetol branch August 27, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants