Skip to content

Rework fixed-point differentiation#386

Open
leburgel wants to merge 10 commits into
mainfrom
lb/remove_iterscheme
Open

Rework fixed-point differentiation#386
leburgel wants to merge 10 commits into
mainfrom
lb/remove_iterscheme

Conversation

@leburgel
Copy link
Copy Markdown
Member

Attempt at reorganizing the fixed-point differentiation approach. The main motivation was to remove the iterscheme keyword that was previously used to select a specific flavor of fixed-point differentiation, which has now become trivial since we only support one value.

As a result it now made more sense to switch the logic around: instead of using a solver algorithm struct as a representation of a gradient algorithm where the type parameter specifies how the gradient is actually computed, I now represent the gradient algorithm as a specific type and store the solver algorithm inside that. This involved coming up with a new name, which ended up being FixedPointGradient, and wiring this into the algorithm selection. It looks a bit silly now since there's only one option, but hopefully this is a good setup for adding different styles of implicit differentiation.

Very open to suggestions and changes, let me know what you think.

@leburgel leburgel requested review from lkdvos and pbrehmer May 21, 2026 13:54
Copy link
Copy Markdown
Member

@lkdvos lkdvos left a comment

Choose a reason for hiding this comment

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

Left some very small comments, but this looks pretty good to me actually

Comment thread src/algorithms/optimization/fixed_point_differentiation.jl
Comment thread src/Defaults.jl Outdated
Comment thread src/algorithms/select_algorithm.jl
@leburgel leburgel added the documentation Improvements or additions to documentation label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

After the build completes, the updated documentation will be available here

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 93.33333% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...rithms/optimization/fixed_point_differentiation.jl 93.02% 3 Missing ⚠️
Files with missing lines Coverage Δ
src/Defaults.jl 85.71% <ø> (ø)
src/algorithms/optimization/peps_optimization.jl 94.66% <100.00%> (ø)
src/algorithms/select_algorithm.jl 76.92% <ø> (-1.65%) ⬇️
...rithms/optimization/fixed_point_differentiation.jl 88.79% <93.02%> (-0.56%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@pbrehmer pbrehmer left a comment

Choose a reason for hiding this comment

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

This is really great, thanks! I find that it definitely cleans up and improves the entire (fixed-point) gradient framework. I only left a few minor comments.

Comment thread examples/3d_ising_partition_function/main.jl Outdated

boundary_alg = (; tol = 1.0e-8, alg = :SimultaneousCTMRG, trunc = (; alg = :FixedSpaceTruncation))
gradient_alg = (; tol = 1.0e-6, maxiter = 10, alg = :LinSolver)
gradient_alg = (; tol = 1.0e-6, maxiter = 10, solver_alg = (alg = :GMRES))
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.

With all the example changes we have to make sure to rerun all of them such that the rendered version reflect the changes.

Comment thread src/algorithms/optimization/fixed_point_differentiation.jl Outdated
@@ -1,12 +1,15 @@
abstract type GradMode{F} end
abstract type GradMode{A} end
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.

Although this is not really necessary, what do we think about renaming this to GradientMode{A}? I think the abbreviation is not really useful here and GradientMode sounds better in my opinion. (And we're already renaming and breaking a lot anyway.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm happy to rename it. What do you think about GradientAlgorithm as an alternative option? I was never too sure about Mode to be honest.

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.

I like GradientAlgorithm even better since it is more consistent with the rest of our algorithm struct names.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Then I would go for that.

Comment thread src/algorithms/select_algorithm.jl
Comment thread test/examples/j1j2_model.jl Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants