Skip to content

Thermal TNR#172

Open
Adwait-Naravane wants to merge 14 commits intoQuantumKitHub:masterfrom
Adwait-Naravane:ThermalTNR
Open

Thermal TNR#172
Adwait-Naravane wants to merge 14 commits intoQuantumKitHub:masterfrom
Adwait-Naravane:ThermalTNR

Conversation

@Adwait-Naravane
Copy link
Copy Markdown
Contributor

This PR adds Thermal Tensor Network Renormalization (ThermalTNR) to TNRKit, following Ueda et al. (2025).

It introduces a workflow for coarse-graining in the z-direction, centered TNO container and a custom ThermalTNR scheme. Two operator layers are composed sitewise, with virtual-bond truncation performed using the oblique projector method.

What’s included

  • TNO: a matrix-like container for local tensor-network-operator tensors (basically PEPOs from PEPSKit)
  • ThermalTNR <: TNRScheme
  • apply!(top, bottom, trunc) for composing two TNO/PEPO-like operator layers
  • custom run! methods for evolving a target operator with an auxiliary layer finalize!(::ThermalTNR) support with geometric-mean normalization output. (product(norms)^(1/N))
    -tests for container behavior, apply!, finalize!, and run!

Implementation notes
The local tensors are treated in PEPO convention, with two physical legs and four virtual legs.
TNO composition contracts the physical output/input legs between layers.
The merged virtual bonds are compressed using oblique projectors derived from neighbouring tensors, following Wang-Verstraete.(2011).

References
Thermal TNR: https://arxiv.org/abs/2508.05406
Oblique projector method: https://arxiv.org/abs/1110.4362

@Adwait-Naravane
Copy link
Copy Markdown
Contributor Author

As a Physics based test. I also reproduced the diagrams 6(a) and 6(d) (roughly for smaller bond dimensions) from https://arxiv.org/pdf/2602.13124. The way to obtain them is to perform ThermalTNR on the initial PEPO/TNO of the Z2 and Z3 gauge theory tensors that represent the partition function for Lz -1 number of iterations. Then trace out the physical legs and perform LoopTNR to obtain the Universal data.
scaling_dimensions_nonnr_Z2.pdf
scaling_dimensions_nonnr_Z3.pdf

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 90.27778% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/schemes/ttnr.jl 89.62% 14 Missing ⚠️
Files with missing lines Coverage Δ
src/TNRKit.jl 100.00% <ø> (ø)
src/utility/finalize.jl 62.72% <100.00%> (+3.32%) ⬆️
src/schemes/ttnr.jl 89.62% <89.62%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

❌ Patch coverage is 90.27778% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/schemes/ttnr.jl 89.62% 14 Missing ⚠️
Files with missing lines Coverage Δ
src/utility/finalize.jl 62.72% <100.00%> (+3.32%) ⬆️
src/schemes/ttnr.jl 89.62% <89.62%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@VictorVanthilt VictorVanthilt left a comment

Choose a reason for hiding this comment

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

Some minor comments about a docstring and the exports.
Some major comments about the tests. Please write new tests that test the validity of the scheme.

Comment thread src/schemes/ttnr.jl
"""
$(TYPEDEF)

Minimal storage object for thermal tensor network renormalization on a square-lattice
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This line is a stylistic break from all the other scheme's docstrings. Please fix

Comment thread src/TNRKit.jl
Comment on lines +67 to +68
export TNO, TNOTensor
export ThermalTNR, apply!
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rethink exports. Does the user need apply!, TNO, TNOTensor ?

Comment thread test/ttnr.jl
@@ -0,0 +1,74 @@
@testset "TNO" begin
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This AI slop test needs to be removed

Comment thread test/ttnr.jl

scheme_top = ThermalTNR(TNO(local_tensor; unitcell = (1, 1)))
scheme_bottom = ThermalTNR(TNO(local_tensor; unitcell = (1, 1)))
@test apply!(scheme_top, scheme_bottom, truncrank(8)) isa ThermalTNR
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove

Comment thread test/ttnr.jl
@test apply!(scheme_top, scheme_bottom, truncrank(8)) isa ThermalTNR
end

@testset "ThermalTNR finalize!" begin
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

remove

Comment thread test/ttnr.jl
@test all(norm(@tensor scheme.T[i, j][1 1; 2 3 2 3]) ≈ 1 for i in 1:2, j in 1:2)
end

@testset "ThermalTNR run!" begin
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this doesn't really test the validity of the scheme. Please write new tests that test the scheme on the validity of its outcomes.

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