Example codes: TRG 

Please look at the readme page if you have not done so already. Here we present an implementation of the tensor renormalization group (TRG), which can be applied to contract the partition function of a 2D classical statistical mechanics model or the path-integral of a 1D quantum lattice model. This implementation is based on the insertion of properly chosen isometries into the network, as explained here, opposed to the direct use of the SVD. Isometries q are chosen to maximize the norm of the C tensor defined below, while isometries v and w are chosen to maximize the norm of the coarse-grained A' tensor defined below. We assume, for simplicity, that the initial network contains only real coefficients and is symmetric under reflections on both the horizontal and vertical axes.  


  • Computational cost: O(χ^6)

  • Exploits (horizontal and vertical) spatial reflection symmetries

  • Three isometries q, w and v at coarse-graining step

Coarse-graining structure:
Reflection symmetry constraints:
Optimization criteria:
Index ordering conventions:
Coarse-graining iteration (Python module):
Initialization (Python script):
'mainTRG' benchmark:

Method: TRG (heavily customized algorithm), bond dimension χ = 32

Test problem: 2D classical Ising model at T = 0.98Tc, square lattice of 2^16 by 2^16 sites

Running time: approx 15 secs

Quantities computed: free energy density, internal energy density, spontaneous magnetization

Typical results:

Error in free energy density (TRG): approx 1e-9


Error in internal energy density (TRG): approx 7e-6

Spontaneous magnetization (TRG):  M = 0.74615...

Spontaneous magnetization (exact): M = 0.74624...

Code examples: