You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Interface suggestion: make TNR schemes iterable to access intermediate tensors #191
Currently, the run! interface runs the TNR scheme to the end of the RG process, with only a limited information of the intermediate RG steps only accessible at the end from the returned value of Finalizer. This also negatively affects the tests (especially in test/schemes/schemes.jl): sometimes TNR are repeatedly run for different number of steps to examine different properties (free energy or CFT data). For example:
cft =sort(CFTData(scheme; shape = [1, 1, 0]).scaling_dimensions[2:end]; by = abs) .|> real
A nicer interface in my opinion is to make the TNR schemes iterable (similar to the TimeEvolver in PEPSKit or IterativeSolver in MPSKit). Each iteration returns the tensors at the current step, and the normalization factor (for free energy calculation, etc). The TRG test above then may be written as
@info"BTRG ising free energy"
scheme =TRG(T)
data =scalartype(T)[]
# may make `scheme` callable; or use other approaches
rg_runner =scheme(truncrank(24), maxiter(25))
for (n, (T, nrm)) inenumerate(rg_runner)
push!(data, nrm)
(n !=10) &&continue# examine CFT data at step 10
cft =sort(CFTData(scheme; shape = [1, 1, 0]).scaling_dimensions[2:end]; by = abs) .|> real
# CFT testsend@testfree_energy(data, ising_βc) ≈ f_onsager rtol =6.0e-8
I'm quite curious to see this in action! We could keep supporting the run! functionality but at the same time offer an "expert mode" which people can use by using the schemes as an iterable.
Activity
Yue-Zhengyuan commentedon Jun 12, 2026
I can make a PR next week on TRG to illustrate how this works. If you like it, we can gradually roll out the new interface to all TNR schemes.
VictorVanthilt commentedon Jun 16, 2026
I'm quite curious to see this in action! We could keep supporting the
run!functionality but at the same time offer an "expert mode" which people can use by using the schemes as an iterable.Chenqitrg commentedon Jul 7, 2026
If do not consider the backward compatibility, I would dream to have a structure called
and a struct called
And define a function
which returns a tensorblock.