Renormalizer interface for TRG (attempt 2)#195
Draft
Yue-Zhengyuan wants to merge 5 commits into
Draft
Conversation
- New Renormalizer{A,S,D} iterable state machine with Base.iterate
- TNRParams abstract type for pure algorithm descriptors
- TRGParams <: TNRParams with trunc and stop fields
- Generic iteration: step!(state, trunc) + finalize!(state) + push!
- Old TRG{E,S,TT} <: TNRScheme{E,S} preserved as state type
- Legacy run!(::TRG, trunc, criterion) delegates to Renormalizer
- rgstep! exported for single-step advancement
- gs_degeneracy.jl: tensor-level methods, shared helper (-110 lines)
- cft.jl: extract _row_transfer_matrix helper
- Finalizer infrastructure marked with TODO for future removal
- 10 files, +247/-148 vs upstream/master
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
Author
|
@VictorVanthilt I have made substantial efforts to maintain backward compatibility. This PR should be much more acceptable. |
Codecov Report❌ Patch coverage is
... and 23 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Motivation
run!interface mixes algorithm configuration (truncation, stopping criterion, finalizers) with execution.Finalizercallbacks. This makes it hard to inspect what happens during an RG flow or to capture observables mid-run.What this PR adds
Renormalizer— an iterator that separates algorithm parameters from tensor state:Architecture
Backward compatibility
The 3-argument
run!for TRG is preserved as a thin wrapper that constructsTRGParams+Renormalizerinternally and delegates:The new interface is a parallel layer that can be adopted incrementally.
run!. Also, the initial tensors are always normalized (finalized). Users who previously used aFinalizerto capture per-step data can instead use the iterator interface, which gives direct access to intermediate states without callback machinery. TheFinalizerinfrastructure remains in the codebase for other schemes (LoopTNR, etc.) and is tagged with TODO markers for eventual migration.Side improvements
gs_degeneracy.jl: tensor-level methods + shared helper (huge deduplication)cft.jl: extracted_row_transfer_matrixhelper, reused by CFT and GSD paths