Skip to content

Add C4v CTMRG and QR-CTMRG example#336

Merged
pbrehmer merged 9 commits intomasterfrom
pb-c4v-example
Mar 4, 2026
Merged

Add C4v CTMRG and QR-CTMRG example#336
pbrehmer merged 9 commits intomasterfrom
pb-c4v-example

Conversation

@pbrehmer
Copy link
Collaborator

Here I add a small example where we demonstrate how to work with C4v-symmetric PEPS and environments and what to look out for when contracting and optimizing with C4v CTMRG. I also added a section on QR-CTMRG.

In order to make C4v optimization work with real numbers I needed to modify a small check in fixedpoint (which wrongly stopped us from using real numbers with :fixed mode differentiation for C4v CTMRG). Also, I had to introduce a dummy truncation error and condition number to the return info tuple in c4v_projector! to make QR-CTMRG work with fixedpoint. For both modifications I added tests. Maybe there is also a meaningful way to compute a truncation error/condition number for QR-CTMRG?

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/algorithms/ctmrg/c4v.jl 90.29% <100.00%> (ø)
src/algorithms/select_algorithm.jl 78.57% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pbrehmer pbrehmer added the documentation Improvements or additions to documentation label Feb 20, 2026
@github-actions
Copy link
Contributor

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

Copy link
Member

@Yue-Zhengyuan Yue-Zhengyuan left a comment

Choose a reason for hiding this comment

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

Minor comments on the example.

[ Info: LBFGS: iter 20, Δt 250.4 ms: f = -6.602282359103e-01, ‖∇f‖ = 1.2155e-03, α = 1.00e+00, m = 19, nfg = 1
[ Info: LBFGS: iter 21, Δt 126.2 ms: f = -6.602299515427e-01, ‖∇f‖ = 1.0743e-03, α = 1.00e+00, m = 20, nfg = 1
[ Info: LBFGS: iter 22, Δt 253.0 ms: f = -6.602310402232e-01, ‖∇f‖ = 4.7766e-04, α = 1.00e+00, m = 20, nfg = 1
[ Info: LBFGS: converged after 23 iterations and time 2.06 s: f = -6.602310919804e-01, ‖∇f‖ = 5.4688e-05
Copy link
Member

Choose a reason for hiding this comment

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

Honestly, QR-CTMRG performance is quite mundane in the example...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Very true, so I didn't want to highlight this here. I think the reason is that at $D=2, \chi=16$ everything is fast (I'm assuming at moderate/high bond dimensions you really start to see the difference) but I found that the gradient linear problem had worse convergence. I'm not sure if this is related to the worse element-wise convergence or something else but in an actual application I would tweak the gradient settings.

pbrehmer and others added 2 commits February 20, 2026 18:15
Co-authored-by: Yue Zhengyuan <yuezy1997@icloud.com>
Copy link
Member

@leburgel leburgel left a comment

Choose a reason for hiding this comment

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

The example itself looks great, I just have a few comments on the src changes. If you prefer merging the example first and then addressing these separately that would be fine by me. Having the example in is the most important, but then we should sort these out immediately after.

Co-authored-by: Lukas Devos <ldevos98@gmail.com>
@pbrehmer pbrehmer mentioned this pull request Feb 24, 2026
Copy link
Member

@leburgel leburgel left a comment

Choose a reason for hiding this comment

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

#337 addressed all my remaining comments. I don't know if the example needs rerunning, otherwise this is good to go for me.

@pbrehmer
Copy link
Collaborator Author

pbrehmer commented Mar 4, 2026

I'll just rerun everything today. Probably doesn't hurt since some of the generated examples are quite old now.

@leburgel
Copy link
Member

leburgel commented Mar 4, 2026

I'll just rerun everything today. Probably doesn't hurt since some of the generated examples are quite old now.

Could you just rerun the C4v ones here, and then do the other older generated examples in a different PR? Just so the PR title matches the actual git diff.

@pbrehmer pbrehmer enabled auto-merge (squash) March 4, 2026 12:46
@pbrehmer pbrehmer merged commit 4c5f078 into master Mar 4, 2026
63 checks passed
@pbrehmer pbrehmer deleted the pb-c4v-example branch March 4, 2026 14:59
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.

4 participants