betaFeedback

WorksPhysics and Astronomy

TTNOpt: Tree tensor network package for high-rank tensor compression

Abstract

We have developed TTNOpt, a software package that utilizes tree tensor networks (TTNs) for quantum spin systems and high-dimensional data analysis. TTNOpt provides efficient and powerful TTN computations by locally optimizing the network structure, guided by the entanglement pattern of the target tensors. For quantum spin systems, TTNOpt searches for the ground state of Hamiltonians with bilinear spin interactions and magnetic fields, and computes physical properties of these states, including the variational energy, bipartite entanglement entropy (EE), single-site expectation values, and two-site correlation functions. Additionally, TTNOpt can target the lowest-energy state within a specified subspace, provided that the Hamiltonian conserves total magnetization. For high-dimensional data analysis, TTNOpt factorizes complex tensors into TTN states that maximize fidelity to the original tensors by optimizing the tensors and the network. When a TTN is provided as input, TTNOpt reconstructs the network based on the EE without referencing the fidelity of the original state. We present three demonstrations of TTNOpt: (1) Ground-state search for the hierarchical chain model with a system size of 256256. The entanglement patterns of the ground state manifest themselves in a tree structure, and TTNOpt successfully identifies the tree. (2) Factorization of a quantic tensor of the 2242^{24} dimensions representing a three-variable function where each variant has a weak bit-wise correlation. The optimized TTN shows that its structure isolates the variables from each other. (3) Reconstruction of the matrix product network representing a 1616-variable normal distribution characterized by a tree-like correlation structure. TTNOpt can reveal hidden correlation structures of the covariance matrix.

PROGRAM SUMMARY

Program Title: TTNOpt

CPC Library link to program files: (to be added by Technical Editor)

Developer’s repository link: Reference [1]

Licensing provisions: Apache 2.0

Programming language: Python

External routines/libraries: Reference [2]

Nature of problem:

Characterizing the entanglement structure of the lowest energy state of quantum spin systems and of high-dimensional tensor data, for efficient representation.

Solution method:

Tensor network contractions combined with a variational algorithm based on the Lanczos method, with automatic structural optimization of tree tensor networks.

Restrictions:

Applicable to quantum spin systems and data that can be represented as tensors.

Unusual features:

Adaptive structural reconfiguration of TTNs based on the system’s entanglement pattern.

Introduction

Tensors, as multidimensional arrays, are widely used across various computational sciences, including condensed matter physics, big data analytics, and machine learning. A fundamental difficulty with manipulating tensors is that the number of tensor elements grows exponentially with the tensor rank NN. One promising approach to overcoming this challenge is to employ the tensor network (TN) representation (decomposition), in which the tensor of interest is expressed as a contraction of small, low-rank tensors [3]. By setting an upper bound χ\chi on the dimensions of each index (mode), which is referred to as auxiliary bonds, in O(N)O(N) small tensors during factorization, the total number of elements in the TN can be reduced to O(Nχp)O(N\chi^p) where pp reflects the maximum rank of small tensors. TNs have found broad applications in condensed matter physics and data science. In the former, high-rank tensors, such as wave functions and Boltzmann weights, are handled within the TN framework [4, 5]. In the latter, TNs are utilized for representing complex data, including images [6, 7]. Further expanding their applications are particularly in machine learning [8, 9, 10]. Quantic tensors have been used for enabling the treatment of functions with continuous variables [11, 12]. So far, several types of TN structures have been developed, particularly in the quantum many-body physics [13, 14, 15, 16].

In this study, we focus on the tree-tensor networks (TTNs) [19, 20], which have no loop in their network structure; see Figure 1 for the examples. The tree structure naturally allows us to impose the isometric conditions on tensors, resulting in efficient contraction schemes [14, 21, 22]. In particular, the isometric conditions guarantee that a TTN can be brought into the form of Schmidt decomposition across any bipartition regions AA and BB:

Figure 1. Examples of TTN structures: (a) a matrix product network (MPN) or tensor train, (b) a rainbow structural network, (c) a perfect binary tree (PBT) network, and (d) a general TTN. White circles represent tensors defined in Eq. (10), while blue ones represent bare sites. Bare sites are arranged from left to right, following the order of basis states (indices). Arrows indicate tensor indices and point from the bare sites to the canonical center. These directions correspond to the domain and codomain of the isometric mapping as Eq. (10). The red square highlights the singular value tensor at the canonical center. Notably, the position of the singular value tensor can be arbitrary under gauge transformations [17, 18].

∣Ψ⟩=∑p,q∑cUpcDcVcq∣ψp⟩A∣ψq⟩B,(1)|\Psi\rangle= \sum_{p,q} \sum_{c} U_{pc}D_{c}V_{cq}|\psi_p\rangle^{A}|\psi_q\rangle^{B}, \tag*{(1)}

where UU and VV are unitaries, and DD is the singular values tensor. Here, TTN state ∣Ψ⟩|\Psi\rangle belongs to the Hilbert space H=HA⊗HB\mathcal{H} = \mathcal{H}_A \otimes\mathcal{H}_B, where {∣ψp⟩A}\{|\psi_p\rangle^{A}\} and {∣ψq⟩B}\{|\psi_q\rangle^{B}\} are orthonormal bases of the Hilbert spaces HA\mathcal{H}_A and HB\mathcal{H}_B, respectively. This representation makes it possible to take the truncation of DcD_c. Additionally, the entanglement entropy (EE) of ∣Ψ⟩|\Psi\rangle between AA and BB can be calculated as

S=−Tr⁡[ρAlog⁡(ρA)]=−Tr⁡[ρBlog⁡(ρB)]=−∑c(Dc)2log⁡(Dc)2,(2)\begin{aligned} S = -\operatorname{Tr}\left[\rho_A \log\left(\rho_A\right)\right] = -\operatorname{Tr}\left[\rho_B \log\left(\rho_B\right)\right] \\ &= -\sum_c (D_c)^2 \log(D_c)^2, \tag*{(2)} \end{aligned}

where ρA=Tr⁡B(∣Ψ⟩⟨Ψ∣)\rho_A = \operatorname{Tr}_B(|\Psi\rangle\langle\Psi|) and ρB=Tr⁡A(∣Ψ⟩⟨Ψ∣)\rho_B = \operatorname{Tr}_A(|\Psi\rangle\langle\Psi|).

While introducing truncation of DcD_c by bounding the dimension of tensors with c∈[1,χ]c \in[1,\chi] on Eq. (1) reduces computational complexity, it also leads to a loss of precision in the TTN representation. Therefore, mitigating the loss of precision due to the finite bond dimension χ\chi is a critical issue in the TN approach.

A promising solution to the problem is to optimize the network structure. The following examples illustrate the relevance of the network structure to the accuracy of the TTN approach. Let us consider a quantum state with a one-dimensional (1D) entanglement pattern, where the entanglement between qubits arranged in 1D is short-ranged [Fig. 2 (a)]. For this state, a Matrix Product Network (MPN) [23, 24], depicted in Figure 1 (a), also known as a tensor train [25], is a reasonable choice.

As a result, MPN-based approaches, such as the density-matrix renormalization group (DMRG) method [26, 27, 28], have been working well for 1D quantum systems. As another example, consider a state where Bell-paired qubits are arranged in a rainbow pattern, as shown in Figure 2(b). If the MPN is applied to represent this state accurately, the canonical center in Figure 1(a) must accommodate an exponentially large dimension χ\chi with respect to NN, in order to carry an amount of entanglement equivalent to N/2N/2 Bell pairs. The bonds with a constant dimension χ\chi miss such a large amount of entanglement, resulting in a significant loss of accuracy. This problem can be resolved by employing a TTN with the structure shown in Figure 1(b). Using the TTN with this appropriate structure reduces the entanglement carried by each bond to that of, at most, a single Bell pair, allowing the state to be represented accurately with χ=2\chi= 2.

Figure 2. Examples of the entanglement structure of wavefunctions Ψ\Psi: (a) a state with a one-dimensional entanglement structure, and (b) a state with a rainbow bell pairs structure.

As demonstrated by the above examples, the network structure can significantly affect the efficiency of the TTN approach [29]. Nevertheless, identifying the optimal network structure remains a nontrivial problem, particularly for states with complex entanglement distributions. Several studies have been conducted to develop methods for determining optimal TTN structures. Many of these works have focused on optimizing the ordering of qudits in MPNs [30, 31, 32, 33, 34], while others have attempted to explore optimal structures within TTNs [20].

An algorithm for searching the optimal TTN structure in variational calculations of quantum many-body systems has been proposed [35]. This algorithm focuses on a particular bond in the TTN and recombines the local network structure to minimize the entanglement brought by that bond. Iterating this procedure while sweeping the entire network, the algorithm explores the TTN with the optimized structure. This algorithm has been proven effective for several quantum spin models [36, 37].

In this work, we provide a software library for TTN calculations that includes the optimization of network structures. The library consists of three main packages:

  1. To perform the variational calculation for the lowest energy state of quantum spin systems. TTNOpt provides the variational wave function with the optimized structure in the TTN format. It outputs the optimized TTN, the variational energy, EE, and truncation error for each bond in the TTN, as well as the expectation values of various one- and two-spin functions. TTNOpt can treat a wide range of quantum spin models. Namely, the Hamiltonian terms that can be handled include the XXZ/XYZ exchange, Dzyaloshinskii-Moriya, and symmetric off-diagonal ex-

change interactions for arbitrary spin pairs, as well as external magnetic fields and single-ion anisotropy for arbitrary spins. The interaction parameters can take different values depending on pairs or spins. The spin sizes can also be site-dependent. If the model treated has the U(1) symmetry of conservation of total magnetization, the user can specify the total magnetization of the subspace in which the variational calculation is performed.

(2) To factorize or decompose a given high-dimensional tensor into a TTN with the optimized structure. The user can input the tensor as a multidimensional function. TTNOpt first decomposes the input tensor into the MPN and then performs the TTN structural optimization while maximizing the fidelity with the input tensor.

(3) To reconstruct the network of a given TTN. The user can input a tensor represented in the TTN format. TTNOpt performs structural reconnection of the network for the TTN from the original input as the initial TTN. While the TTN structure is optimized through sweeps, the tensors are only updated by the singular value decomposition (SVD).

Additionally, TTNOpt contains descriptions of sample calculations to demonstrate its functionality and practical applications. The structure of this paper is as follows. In Sec. 2, we give an overview of the methods provided by TTNOpt and their basic usage. We also describe the variables used for the calculation in detail. In Sec. 3, we explain the implemented algorithms in TTNOpt. While the explanation focuses on the sweep procedure proposed in Ref. [35], we also discuss the numerical techniques for TTN manipulations. Then, we showcase example benchmarks for each implemented method in Sec. 4. Finally, Sec. 5 concludes with an outlook on TTNOpt and explores prospective avenues for future development.

Basic usage of TTNOpt

Here, we provide a detailed explanation of how to use TTNOpt. This section describes the input files required mainly for ground-state searches and high-rank tensor factorizations. The sample input files for the demonstrations discussed in Sec. 4, including those used for the network reconstruction, are available in the “sample” directory of the GitHub repository [1].

Ground state search

The TTNOpt package has been developed for finite-size spin systems, including XXZ and XYZ Hamiltonians,

HXXZ=∑i,j(>i)Jij(sixsjx+siysjy+Δijzsizsjz),(3)H_{\mathrm{XXZ}} = \sum_{i,j(>i)} J_{ij}\left(s_i^x s_j^x + s_i^y s_j^y + \Delta_{ij}^z s_i^z s_j^z\right), \tag*{(3)}
HXYZ=∑i,j(>i)(Jijxsixsjx+Jijysiysjy+Jijzsizsjz),(4)H_{\mathrm{XYZ}} = \sum_{i,j(>i)}\left(J_{ij}^x s_i^x s_j^x + J_{ij}^y s_i^y s_j^y + J_{ij}^z s_i^z s_j^z\right), \tag*{(4)}

where si=(six,siy,siz)\boldsymbol{s}_i = (s_i^x,s_i^y,s_i^z) is a spin operator at ii th site on an NN-site system, and {Jij,Δijz}\{J_{ij},\Delta_{ij}^z\} or {Jijx,Jijy,Jijz}\{J_{ij}^x,J_{ij}^y,J_{ij}^z\} are the coupling parameters for the exchange interaction between the ii th and jj th spins.

The size of spin sis_i can be arbitrary for each site. In addition to the Hamiltonian Eqs. (3) and (4), TTNOpt can treat the interactions including magnetic field

Hhα=∑i−hiαsiα,(5)H_{h_\alpha} = \sum_i -h_i^\alpha s_i^\alpha, \tag*{(5)}

single-ion anisotropy

HD=∑iDi(siz)2,(6)H_D = \sum_i D_i(s_i^z)^2, \tag*{(6)}

Dzyaloshinskii-Moriya (DM) interaction

HDMα=∑i,j(>i)Dijα(si×sj)α,(7)H_{\mathrm{DM}_\alpha} = \sum_{i,j(>i)} D_{ij}^\alpha(\boldsymbol{s}_i \times\boldsymbol{s}_j)^\alpha, \tag*{(7)}

and symmetric off-diagonal exchange anisotropy

HΓα=∑i,j(>i)Γijα(siξsjη+siηsjξ),(8)H_{\Gamma_\alpha} = \sum_{i,j(>i)} \Gamma_{ij}^\alpha(s_i^\xi s_j^\eta+ s_i^\eta s_j^\xi), \tag*{(8)}

where α,ξ,η∈{x,y,z}\alpha,\xi,\eta\in\{x,y,z\} and α≠ξ≠η\alpha\ne\xi\ne\eta.

Regarding the whole Hamiltonian H=HXXZ+∑α∈{x,y,z}Hhα+HD+∑α∈{x,y,z}HDMα+∑α∈{x,y,z}HΓαH = H_{\mathrm{XXZ}}+\sum_{\alpha\in\{x,y,z\}}H_{h_\alpha}+H_D+\sum_{\alpha\in\{x,y,z\}}H_{\mathrm{DM}_\alpha}+\sum_{\alpha\in\{x,y,z\}}H_{\Gamma_\alpha}, if and only if it meets hix=hiy=Dijx=Dijy=Γijx=Γijy=0h_i^x=h_i^y=D_{ij}^x=D_{ij}^y=\Gamma_{ij}^x=\Gamma_{ij}^y=0, the Hamiltonian commutes with the operator for the total magnetization of zz axis:

M=∑isiz,(9)M = \sum_i s_i^z, \tag*{(9)}

i.e., [H,M]=0[H,M]=0, so that the U(1) symmetry is preserved. In this case, TTNOpt provides a function to calculate the TTNs for the lowest-energy state within the subspace labeled by MM.

How to set input files

Running the TTNOpt package requires the main input file and, if necessary, several setting files. The main input file consists of system, numerics, and output. The meaning of each section and the variables used there are explained below.

system

This section requires users to specify the information of the Hamiltonian for the target system, including the number of spins, spin size, and interactions in the Hamiltonian. TTNOpt requires users to prepare a separate file to define the two-site interactions of Eq. (3) or Eq. (4). Other additional terms Eqs. (5), (6), (7), and (8) are not necessarily specified if they are not present in the Hamiltonian. TTNOpt assumes that the input files are in the “.dat” format.

  • N (INTEGER): The number of spins, NN. Thus, TTN wave functions are tensors in the vector product space of NN local spin Hilbert spaces.

  • spin_size (REAL or STRING) The spin sizes sis_i defined for i∈[0,N−1]i \in[0,N-1]. If a spin value ss is provided, it is applied uniformly across the

entire system, i.e., si=ss_i=s for all i∈[0,N−1]i\in[0,N-1]. Alternatively, if a file path is provided, TTNOpt imports the file, which must contain two columns: The first column specifies the site index ii, and the second column specifies the corresponding spin value sis_i. Note that, in the case that the spin size is a half-odd integer, TTNOpt does not accept decimal values for spin settings, and only the fractional representations, such as 1/2 and 3/2, are allowed.

  • model.type (XXZ or XYZ) The basic interaction type, XXZ or XYZ interaction, that is respectively given in Eq. (3) or (4).

  • model.file (STRING) The coupling parameters for the exchange interactions. Each row contains two integers and two or three floats, where the first two columns specify a pair of site indices ii, jj, and subsequent columns specify the coupling parameters Jij,ΔijzJ_{ij},\Delta_{ij}^{z} or Jijx,Jijy,JijzJ_{ij}^{x},J_{ij}^{y},J_{ij}^{z} according to system.model.type.

  • MF_X (Y, Z) (REAL or STRING) The magnetic field along the α\alpha direction (α=x,y,z\alpha=x,y,z) described in Eq. (5). If a float value hh is provided, it is applied uniformly across the entire system, i.e., hiα=hh_i^\alpha=h for i∈[0,N−1]i\in[0,N-1]. Alternatively, if the path to a file is provided, TTNOpt imports the file, which must contain two columns where the first and second columns specify, respectively, the site ii and the corresponding value hiαh_i^\alpha.

  • SIA (REAL or STRING) The single-ion anisotropy described in Eq. (6). If a float value D is provided, the anisotropy is applied uniformly across the entire system, i.e., Di=DD_i=D for i∈[0,N−1]i\in[0,N-1]. Alternatively, if the path to a file is provided, TTNOpt imports the file, which must contain two columns where the first and second columns specify, respectively, the site ii and the corresponding value DiD_i.

  • DM_X (Y, Z) (STRING) The Dzyaloshinskii-Moriya (DM) interaction described in Eq. (7). TTNOpt requires a file with three columns to contain two integers and a real value. The first two columns identify a pair of site indices i,ji,j, and the last column specifies DijαD_{ij}^{\alpha}.

  • SOD_X (Y, Z) (STRING) The symmetric off-diagonal anisotropic exchange interaction described in Eq. (8). TTNOpt requires a file with three columns to contain two integers and a real value. The first two columns identify a pair of site indices i,ji,j, and the last column specifies Γijα\Gamma_{ij}^{\alpha}.

numerics

This section requires users to specify the conditions and hyperparameters for the calculation, including the settings for the structural optimization algorithm and the maximum bond dimension of the TTN states.

  • init_tree (0 or 1) If this value is set to 0, the initial structure is set to the MPN. If it is set to 1 and the system size is a power of 2, the initial structure is set to the perfect binary tree (PBT) structure. Otherwise, the MPN structure is used by default.

  • initial_bond_dimension (INTEGER) The maximum bond dimension χinit\chi_{\mathrm{init}} during the preparation of an initial TTN. The initial tensors are prepared by the real space renormalization group (RSRG) [38, 39], where the bond dimension of tensors is upper-bounded by χinit\chi_{\mathrm{init}} (see § 4.2.2 for details). The value of χinit\chi_{\mathrm{init}} must not be too small to ensure that each tensor contains all degenerate lowest-energy states of the block Hamiltonian [Eq. (13) in § 4.2.1] in the renormalized region belonging to the tensor.

  • total_magnetization (REAL) The total magnetization MM that defines the subspace in which the lowest-energy state is computed. This input is used only for the Hamiltonian with U(1) symmetry. To activate this function, it is not allowed to use XYZ interaction in system.model.type even if the user numerically sets Jx=JyJ_x=J_y. Among other terms, those that break the symmetry are also prohibited.

    When the initial bond dimension χinit\chi_{\mathrm{init}} is not sufficiently large, the RSRG method may fail to construct the initial TTN in the subspace labeled by the magnetization MM. In this case, TTNOpt initializes the TTN state with a magnetization M′M' such that ∣M′∣<∣M∣|M'|<|M| and ∣M′∣|M'| is the closest to ∣M∣|M| among the magnetizations that can be spanned by the RSRG. It then performs warmup calculations while keeping the TTN state’s bond dimension at χinit\chi_{\mathrm{init}} and adjusting M′M' as M′:=M′±1M':=M'\pm1 at the end of each update sweep [40], until the appropriate initial state with magnetization MM is realized.

  • opt_structure.type (0, 1 or 2) The method for optimizing the network structure. If the value is 0, TTNOpt does not optimize the TTN structure. If it is 1, TTNOpt performs structural reconstruction by referring to EEs. If the value is 2, TTNOpt selects the structure with the minimum truncation error [Eq. (24) in § 4.2.3]. However, when the differences between the minimum truncation errors are less than 1×10−131\times10^{-13}, the optimal structure is determined using EE as a secondary criterion.

  • opt_structure.temperature (REAL) An effective temperature T0T_0, which is a positive real number. When opt_structure.type = 1, the structure is selected stochastically using this T0T_0 with nτn_\tau, which is described later in § 4.2.3. This value is set to T0=0T_0=0 by default, and then TTNOpt chooses the structure with the minimum EE.

  • opt_structure.tau (INTEGER) The decay factor nτn_{\tau}, which is a positive integer. When opt_structure.type = 1 and T0>0T_0 > 0, it controls the temperature decay according to the sweep count nn. [See Eq. (23) in § 4.2.3.] TTNOpt sets nτn_{\tau} to ⌊nmax⁡,0/2⌋\lfloor n_{\max,0}/2\rfloor by default.

  • opt_structure.seed (INTEGER) The random seed for stochastic selection of the structure. [See Eq. (22) in § 4.2.3.] TTNOpt sets this value to 0 by default to ensure that the results are reproducible.

  • max_bond_dimensions (LIST of INTEGER) The elements of the list specify the maximum bond dimensions χ=[χm]1≤m≤m\chi= [\chi_m]_{1\le m\le\mathfrak{m}} in the TTN, where m\mathfrak{m} is the total number of stages. At the m\mathit{m}-th stage, TTNOpt performs sweeps using χ:=χm\chi:= \chi_m until the TTN state converges or the number of sweeps reaches nmax⁡,mn_{\max,m}, as specified in numerics.max_num_sweeps. Once the sweeps at stage mm are completed, TTNOpt proceeds to the next stage with χ:=χm+1\chi:= \chi_{m+1} and nmax⁡,m+1n_{\max,m+1}, using the TTN state obtained at χ=χm\chi= \chi_m as the initial state. It is worth noting that the values in χ\chi should be arranged in ascending order. This strategy enables computation with larger χm\chi_m, which requires a higher computational cost, to begin from a well-prepared initial state. As a result, the number of sweeps needed for convergence at larger χm\chi_m can be reduced. If numerics.opt_structure.type ∈{1,2}\in\{1,2\}, the structural optimization is applied only for the sweeps with χ=χ1\chi= \chi_1. As for the remaining computation with χ=χm\chi= \chi_m for m>1m > 1, only tensors are updated while the structure is fixed.

  • max_num_sweeps (LIST of INTEGER) The elements of the list specify the maximum number of sweeps nmax⁡=[nmax⁡,m]1≤m≤mn_{\max} = [n_{\max,m}]_{1\le m\le\mathfrak{m}} for each stage of calculations. All elements nmax⁡,mn_{\max,m} should be set sufficiently large to achieve the TTN state’s convergence. In this paper, we denote nmax⁡,mn_{\max,m} simply as nmax⁡n_{\max} to represent the maximum number of sweeps at mm th stage unless otherwise specified.

  • energy_convergence_threshold (REAL) The tolerance ϵE\epsilon_E for the convergence of energy. If the relative difference between each the energy Eb\mathcal{E}_b calculated by using the Lanczos method for the auxiliary bond bb at the current sweep and that from the previous sweep, Eb′\mathcal{E}'_b, is less than the threshold ϵE\epsilon_E, i.e., ∣1−Eb′Eb∣≤ϵE|1-\frac{\mathcal{E}'_b}{\mathcal{E}_b}| \le\epsilon_E for all bb, TTNOpt considers that the TTN has been converged concerning energy. TTNOpt sets this value to ϵE=1×10−8\epsilon_E = 1 \times10^{-8} by default.

  • entanglement_convergence_threshold (REAL) The tolerance ϵS\epsilon_S for the convergence of EE. If the difference between the bipartite EE Sb\mathcal{S}_b for the bond bb at the current sweep as Eq. (2) and that from the previous sweep, Sb′\mathcal{S}'_b, is less than the threshold ϵS\epsilon_S, i.e., ∣Sb−Sb′∣<ϵS|\mathcal{S}_b-\mathcal{S}'_b| < \epsilon_S for all bonds bb, TTNOpt considers that the EEs of TTN have been converged. Furthermore, if opt_structure.type is set to 1 and the EE of the optimal and previous structures differs by less than ϵS\epsilon_S, the structure remains unchanged to avoid inconsequential fluctuation of the TTN structure at each step of sweeps. TTNOpt sets this value to ϵS=1×10−8\epsilon_S = 1 \times10^{-8} by default.

  • energy_degeneracy_threshold (REAL) The threshold δE\delta_E used in the preparation of the initial tensors by the RSRG to determine whether the eigenvalues of a block Hamiltonian are degenerate. The procedure is detailed in § 4.2.2. TTNOpt sets this value to δE=1×10−8\delta_E = 1 \times10^{-8} by default.

  • entanglement_degeneracy_threshold (REAL) The threshold δS\delta_S used in the SVD to determine whether singular values are degenerate for updating the local two-tensor. The procedure is detailed in the last paragraph of § 4.2.2. TTNOpt sets this value to δS=1×10−8\delta_S = 1 \times10^{-8} by default.

output

This section requires users to specify the physical quantities for which TTNOpt will generate output files. By default, TTNOpt outputs, in a file named “basic.csv”, the EEs for all bonds, as well as the variational energies and truncation errors for the auxiliary bonds, computed during the final sweep of each stage m∈[1,m]m \in[1,\mathfrak{m}]. In the “basic.csv” file, all bonds are identified by two nodes connected by the bond, (i,i′)(i,i') with i,i′∈[0,N+Nt−1]i,i' \in[0,N+N_t-1], where NN is the number of spins and NtN_t is the number of tensors. Additionally, TTNOpt saves the set of bond labels EE for the TTN structure in a file named “graph.dat”. The format to describe the bond labels is explained in the second paragraph of § 4.1. Users can save single-site spin expectation values at each site and two-site spin correlations between any two sites.

  • dir (STRING) The location of the directory where the data will be output.

  • single_site (0 or 1) If this value equals 1, TTNOpt calculates single-site spin expectation values and saves them in a file named “single_site.csv”. The file has four columns where the first column owns site ii with i∈[0,N−1]i \in[0,N-1] and the subsequent columns have ⟨siα⟩\langle s_i^\alpha\rangle with α=x,y,z\alpha= x,y,z, where ⟨⋯ ⟩\langle\cdots\rangle denotes the expectation value of ⋯\cdots in the ground state. Otherwise, TTNOpt does not save them.

  • two_site (0 or 1) If this value equals 1, TTNOpt calculates two-site spin correlation functions and saves them in a file named “two_site.csv”. The file has eleven columns where the first two columns own a pair of two sites i,ji,j with i,j∈[0,N−1]i,j \in[0,N-1] and i<ji<j, and

the subsequent columns have ⟨siαsjβ⟩\langle s_i^\alpha s_j^\beta\rangle, where (α,β)∈{xx,yy,zz,yz,zy,zx,xz,xy,yx}(\alpha,\beta) \in\{xx, yy, zz, yz, zy, zx, xz, xy, yx\}. Otherwise, TTNOpt does not save them.

Run and results

After preparing all input files described above, users can perform the calculation as follows:

$ gss input.yml

Here, the results of mm th stage of calculation are saved in a subdirectory “run{mm}”, where {mm} with m∈[1,m]m \in[1,m] relies on variable expansion of Python notation, under the directory specified by the output.dir in the main input file.

Factorising tensors

The TTNOpt package provides functions to factorize a high-dimensional tensor Ψ={Ψs0,…,sN−1}\Psi= \{\Psi_{s_0,\ldots,s_{N-1}}\}, with indices s0,…,sN−1s_0,\ldots,s_{N-1}, into a TTN as an efficient data structure. The overall procedure is illustrated in Figure 3.

Figure 3. Schematic overview of the procedures for (a) factorizing tensors and (b) reconstructing TTNs. In (a), TTNOpt performs (c) sequential SVD to construct an MPN, after which users might either (d) apply reconstruction to this MPN or proceed directly to (e), where both the tensors and the network structure of the TTN are optimized to maximize the fidelity with Ψ\Psi. TTNOpt also allows using the optimized TTN obtained in (d) as the input to (e), depicted as a dashed line. In (b), TTNOpt runs (d) for the given TTN.

TTNOpt first decomposes the input tensor Ψ\Psi into an MPN using sequential SVD [Figure 3(c)] [28]. Users may then choose to transform this MPN into a TTN via reconstruction sweeps [Figure 3(d)]. This yields a TTN structure optimized to minimize bipartite EEs based on local SVDs applied to the initial MPN.

If the entanglement structure of the input tensor Ψ\Psi is not compatible with the MPN, the TTN obtained from this procedure may suffer from low-precision approximations. To address this limitation, TTNOpt also implements the fidelity-based update that directly references Ψ\Psi [Figure 3(e)]. Specifically, this procedure optimizes the tensor elements to maximize the fidelity with Ψ\Psi, while simultaneously reconstructing the network structure to reduce EEs. However, since it requires explicit contractions with Ψ\Psi at each update step, it entails a significantly higher computational cost compared to the reconstruction process alone.

How to set input files

target

This section requires specifying the directory of the input tensor Ψ\Psi. TTNOpt needs users to specify “.npy” format file as tensors.

  • tensor (STRING) The directory name for the file of the input tensor Ψ\Psi.

numerics

This section requires users to specify the conditions for the calculation.

  • initial_bond_dimension (INTEGER) The initial bond dimension χinit\chi_{\mathrm{init}}. TTNOpt first decomposes Ψ\Psi into an MPN structure with up to this bond dimension χinit\chi_{\mathrm{init}} using the SVD.

  • opt_structure.type (0, 1 or 2) This value is applied to local reconstructions in TTN structural optimization. Explanations of this input and the following ones, opt_structure.temperature, opt_structure.tau, and opt_structure.seed are in § 2.1.1.

  • max_sweep_num (INTEGER) The maximum number of sweeps nmax⁡n_{\max} for reconstruction. During the sweep procedure, we set the bond dimension χ\chi as χinit\chi_{\mathrm{init}} specified by initial_bond_dimension.

  • entanglement_convergence_threshold (REAL) The entanglement convergence threshold ϵS\epsilon_S, which is explained in § 2.1.1. It is noted that this value is used both when TTNOpt reconstructs the initial MPN into the optimal TTN and updates the TTN state based on the fidelity with the input tensor Ψ\Psi.

  • max_truncated_singularvalue (REAL) This threshold σ\sigma is used in SVD to reduce the bond dimension while tolerating a certain loss of accuracy. All singular values satisfying Di/D1<σD_i/D_1 < \sigma are truncated, where DiD_i is the ii-th singular value sorted in descending order. By default, σ\sigma is set to 0, in which case up to χ\chi singular values are retained.

  • fidelity.opt_structure.type (0, 1 or 2) This value is applied when TTNOpt updates the TTN state according to the fidelity. Explanations of this value and the following inputs, fidelity.opt_structure.temperature, fidelity.opt_structure.tau, fidelity.opt_structure.seed, and fidelity.max_num_sweeps are in § 2.1.1. Note that if users set values related to the fidelity-based optimization in the input file, TTNOpt will update both the network structure and tensors of the TTN concerning Ψ\Psi, even if the TTN structure has already been determined by opt_structure.type.

  • fidelity.max_bond_dimensions (LIST of INTEGER) Explanations of this value are detailed in § 2.1.1. The bond dimension practically kept can be reduced when a nonzero σ\sigma is set in max_truncated_value.

  • fidelity.convergence_threshold(REAL) The tolerance ϵF\epsilon_F for the convergence of fidelity. If the difference between the fidelity FbF_b calculated for auxiliary bond bb at the current sweep and that from the previous sweep, Fb′F_b', is less than the threshold ϵF\epsilon_F, i.e., ∣Fb−Fb′∣<ϵF|F_b-F_b'|<\epsilon_F for all auxiliary bonds bb, TTNOpt considers that the TTN has been converged concerning fidelity.

output

This section requires users to specify the output settings. By default, TTNOpt outputs properties of TTN in a file named “basic.csv” and TTN structure in “graph.dat” in the same manner as the ground state search algorithm. In the “basic.csv”, TTNOpt outputs the EEs for all bonds and the truncation errors for all auxiliary bonds. TTNOpt also saves the fidelity with the input tensor Ψ\Psi calculated at each auxiliary bond to a file named “basic.csv”, if users specify the input file to conduct the update regarding the fidelity.

In addition to the outputs above, the user can save the tensors, singular values, and the norm of the tensor Ψ\Psi, which is used for the normalization of the TTN.

  • dir (STRING) The location of the directory where the data will be output.

  • tensors (0 or 1) If this value is 1, TTNOpt saves optimized tensors as the “isometry{i}\{i\}.npy” file with i∈[0,Nt−1]i \in[0,N_t-1], singular values tensor in the “singular_values.npy” file, and norm in the “norm.npy” file. Otherwise, TTNOpt does not save them.

Run and result

After preparing the input files described above, users can perform the calculation as follows:

$ ft input.yml

Here, the computed results are output in the directory specified by the output.dir variable in the main input file.

Reconstruction of TTNs

Motivated by the recent applications of MPNs and tensor train data, TTNOpt allows users to load a TTN. TTNOpt then reconstructs the network structure of a given TTN [Figs. 3(b) and (d)].

This function of TTNOpt would be powerful for searching more efficient TTN structures in the sense that each bond carries low EE or has small bond dimensions.

Users can perform the calculation as follows:

$ ft input.yml

Note that the command to execute this method is identical to the one used for the factorizing tensors. The users must ensure that the input tensor is consistent with the intended type, which is either a tensor or a TTN (see the sample input files in Ref. [1]). The variables for the calculations share the same format as those for the factorizing tensors method, excluding those relevant to the fidelity-based optimization, described in § 3.1.1.

Inplemented algorithms

Representation of TTNs

The TTNOpt package constructs TTN states from a set of three-leg isometric tensors v={v0,v1,…,vNt−1}\boldsymbol{v}=\{v_0,v_1,\ldots,v_{N_t-1}\}, where Nt=N−2N_t=N-2 is the total number of tensors [41]. Each isometric tensor [vi]i1i2i3[v_i]_{i_1i_2}^{i_3} for all 0≤i≤Nt−10\leq i\leq N_t-1, where ik∈{1,2,3}i_k\in\{1,2,3\} represents index with bond dimensions χik\chi_{i_k}, satisfies the following isometric condition:

∑i1i2[vi]i1i2i3[vi∗]i1i2i3′=δi3i3′.(10)\sum_{i_1i_2}[v_i]_{i_1i_2}^{i_3}[v_i^*]_{i_1i_2}^{i_3'}=\delta_{i_3i_3'}. \tag*{(10)}

where vi∗v_i^* denotes the complex conjugate of viv_i, and δi3i3′\delta_{i_3i_3'} is the Kronecker delta. On the isometry [vi]i1i2i3[v_i]_{i_1i_2}^{i_3}, the degrees of freedom χi3\chi_{i_3} is limited by the product of the bond dimensions χi1\chi_{i_1} and χi2\chi_{i_2}, i.e., χi3≤χi1χi2\chi_{i_3}\leq\chi_{i_1}\chi_{i_2}. In addition, TTNOpt practically poses an upper bound χ\chi on bond dimensions for all bonds in the TTN state.

TTNOpt maintains connectivity between tensors as a set of three bond (edge) labels E={E0,…,ENt−1}E=\{E_0,\ldots,E_{N_t-1}\} where Ei=(e1(i),e2(i),e3(i))E_i=(e_1^{(i)},e_2^{(i)},e_3^{(i)}), to define TTN structures. Each edge label ee is written as an integer e∈[0,2Nt]e\in[0,2N_t] where 2Nt+12N_t+1 is the number of bonds in the TTN. The edge with the label e=r∈[0,N−1]e=r\in[0,N-1] is connected to the bare spin rr. In this data structure, two tensors viv_i and vjv_j that share the same edge label in EiE_i and EjE_j are connected. There is an unique pair of tensors specified by pp and qq connected to each other through e3(p)e_3^{(p)} and e3(q)e_3^{(q)} as shown in Figure 4(a). This bond is referred to as the canonical center ece_c, defined as ec=e3(p)=e3(q)e_c=e_3^{(p)}=e_3^{(q)} detailed in Figure 4(a) and (Figure 4b). It is important to note that in TTNOpt, ece_c is supposed not to be connected to any physical sites, i.e., ec∉[0,N−1]e_c\notin[0,N-1]. TTNOpt assumes that up to χ\chi elements from the vector D=(D1,…,Dχ2)D=(D_1,\ldots,D_{\chi^2}) are assigned on ece_c, where the singular values DiD_i are ordered in descending magnitude as D1≥D2≥⋯≥Dχ2≥0D_1\geq D_2\geq\cdots\geq D_{\chi^2}\geq0. Since the truncation of bond dimensions causes a loss of the norm of TTN states, TTNOpt rescales the singular values, Dc\mathcal{D}_c with c∈[1,χ]c\in[1,\chi] as

Figure 4. Schematic diagrams of (a) data structure of labels for tensors and edges around the initial canonical center, i.e., e3(p)=e3(q)e_3^{(p)} = e_3^{(q)}, and (b) local structure surrounding the canonical center ece_c.

Dc:=Dc∑c′=1χ(Dc′)2.(11)\mathcal{D}_c:=\frac{D_c}{\sqrt{\sum_{c'=1}^{\chi}(D_{c'})^2}}. \tag*{(11)}

That is because, within the canonical formulas, the norm of the TTN state ∣Ψ⟩|\Psi\rangle is described as ⟨Ψ∣Ψ⟩=∑c′=1χ(Dc′)2\langle\Psi|\Psi\rangle=\sum_{c'=1}^{\chi}(D_{c'})^2. With these settings, TTNOpt allows for representing TTN states in mixed canonical form [28] to manage various calculations efficiently.

Ground state search

Representation of the Hamiltonian

Conducting the ground-state search requires constructing the effective Hamiltonian for each renormalized region, which is achieved by contracting a tensor network composed of the TTN state and the local Hamiltonian tensors. TTNOpt preserves the renormalized spin operators, S~z\widetilde{S}^{z} and S~+\widetilde{S}^{+}, at all bonds, enabling efficient evaluation of these contractions. Since S~−\widetilde{S}^{-} is the Hermitian conjugate of S~+\widetilde{S}^{+}, it is sufficient to retain only the S~z\widetilde{S}^{z} and S~+\widetilde{S}^{+} operators [26, 27].

For a general TTN structure, this procedure differs from that in the case of considering only MPN, where the entire contraction with matrix product operators is efficient with O(Nχ3)O(N\chi^{3}) cost [28].

To manage the calculation on TTN, we assign a distance de3(i)∈[0,Nt−1]d_{e_3^{(i)}} \in[0,N_{\mathrm{t}}-1] to each edge label e3(i)e_3^{(i)} for all viv_i, measured from the origin bond oco_c, which corresponds to the canonical center of the initialized TTN and doc=0d_{o_c}=0. Specifically, the value de3(i)d_{e_3^{(i)}} represents the minimum number of isometries that must be traversed to reach viv_i from oco_c. We also introduce L={l0,l1,…,ldmax⁡}L=\{l_0,l_1,\ldots,l_{d_{\max}}\} with ld={ld1,…,ldnd∣ldj∈[0,Nt−1]}l_d=\{l_d^1,\ldots,l_d^{n_d}\mid l_d^j\in[0,N_{\mathrm{t}}-1]\}, where ndn_d is the number of edges whose distances are equal to dd, i.e., dld1=dld2=⋯=dldnd=dd_{l_d^1}=d_{l_d^2}=\cdots=d_{l_d^{n_d}}=d. Regarding the maximum distance dmax⁡d_{\max}, the isometries {vi∣e3(i)∈ldmax⁡}\{v_i\mid e_3^{(i)}\in l_{d_{\max}}\} are ensured to connect directly to bare sites, i.e., ei(1),ei(2)∈[0,N−1]e_i^{(1)},e_i^{(2)}\in[0,N-1]. For example, in the MPN structure as Figure 1(a), in which the origin bond oco_c is positioned on the midpoint of the system, {vi∣e3(i)∈ldmax⁡}\{v_i\mid e_3^{(i)}\in l_{d_{\max}}\} correspond to two isometries located at both ends of the MPN. Additionally, to define LL uniquely, we incorporated an ordering rule such that ld1<ld2<⋯<ldndl_d^1<l_d^2<\cdots<l_d^{n_d} for each ldl_d. We finally introduce a set of spin locations rk(i)={rk,1(i),rk,2(i),…,rk,g(i,k)(i)}r_k^{(i)}=\{r_{k,1}^{(i)},r_{k,2}^{(i)},\ldots,r_{k,g(i,k)}^{(i)}\} within the renormalized region specified by the edge label ek(i)e_k^{(i)}, where g(i,k)=∣rk(i)∣g(i,k)=|r_k^{(i)}|. It is trivial that r3(i)=r1(i)∪r2(i)r_3^{(i)}=r_1^{(i)}\cup r_2^{(i)}, since the sets of spins of e1(i)e_1^{(i)} and e2(i)e_2^{(i)} are renormalized to e3(i)e_3^{(i)} by viv_i.

These definitions allow us to consider the following renormalized spin transformation using the isometry viv_i:

[S~e3(i),r(⋅)]i3,i3′={∑i1,i2[vi]i1,i2i3[S~e1(i),r(⋅)]i1,i1′[vi∗]i1′,i2′i3′(r∈r1(i))∑i1′,i2′[vi]i1,i2i3[S~e2(i),r(⋅)]i2,i2′[vi∗]i1′,i2′i3′(r∈r2(i)).(12)\left[\widetilde{S}_{e_3^{(i)},r}^{(\cdot)}\right]_{i_3,i_3'} = \begin{cases} \sum_{i_1,i_2}\left[v_i\right]_{i_1,i_2}^{i_3}\left[\widetilde{S}_{e_1^{(i)},r}^{(\cdot)}\right]_{i_1,i_1'}\left[v_i^*\right]_{i_1',i_2'}^{i_3'} & (r\in r_1^{(i)})\\ \sum_{i_1',i_2'}\left[v_i\right]_{i_1,i_2}^{i_3}\left[\widetilde{S}_{e_2^{(i)},r}^{(\cdot)}\right]_{i_2,i_2'}\left[v_i^*\right]_{i_1',i_2'}^{i_3'} & (r\in r_2^{(i)}). \end{cases} \tag*{(12)}

If ek(i)=re_k^{(i)}=r, S~(⋅)\widetilde{S}^{(\cdot)} is equal to the bare spin operator s(⋅)s^{(\cdot)} where (⋅)∈{z,+}(\cdot)\in\{z,+\} indicates the type of spin operators. We then calculate renormalized spin operators on de3(i)∈dmax⁡d_{e_3^{(i)}}\in d_{\max} by using Eq. (12).

Applying the renormalization procedure of Eq. (12) recursively enables to compose further block-spin operators on the edges in ld−1l_{d-1} with {vi∣e3(i)∈ld}\{v_i\mid e_3^{(i)}\in l_d\} from d=dmax⁡d=d_{\max} to d=0d=0.

Using the block-spin operators, we can construct the block Hamiltonian associated with viv_i, for example, the XXZ model of Eq. (3):

H~e1(i)e2(i)=H~e1(i)+H~e2(i)+H~e1(i)e2(i)int,\widetilde{H}_{e_1^{(i)}e_2^{(i)}}=\widetilde{H}_{e_1^{(i)}}+\widetilde{H}_{e_2^{(i)}}+\widetilde{H}_{e_1^{(i)}e_2^{(i)}}^{\mathrm{int}},
H~e1(i)e2(i)int=∑r∈r1(i)∑r′∈r2(i)Jrr′2(S~e1(i),r+S~e2(i),r′−+S~e1(i),r−S~e2(i),r′++Δrr′zS~e1(i),rzS~e2(i),r′z).(13)\widetilde{H}_{e_1^{(i)}e_2^{(i)}}^{\mathrm{int}}= \sum_{r\in r_1^{(i)}}\sum_{r'\in r_2^{(i)}}\frac{J_{rr'}}{2} \left( \widetilde{S}_{e_1^{(i)},r}^{+}\widetilde{S}_{e_2^{(i)},r'}^{-} +\widetilde{S}_{e_1^{(i)},r}^{-}\widetilde{S}_{e_2^{(i)},r'}^{+} +\Delta_{rr'}^{z}\widetilde{S}_{e_1^{(i)},r}^{z}\widetilde{S}_{e_2^{(i)},r'}^{z} \right). \tag*{(13)}

Then, we get

[H~e3(i)]i3i3′=∑i1i2i1′i2′[vi]i1i2i3[H~e1(i)e2(i)]i1i2i1′i2′[vi∗]i1′i2′i3′.(14)\left[\widetilde{H}_{e_3^{(i)}}\right]_{i_3}^{i_3'}= \sum_{i_1i_2i_1'i_2'}\left[v_i\right]_{i_1i_2}^{i_3} \left[\widetilde{H}_{e_1^{(i)}e_2^{(i)}}\right]_{i_1i_2}^{i_1'i_2'} \left[v_i^*\right]_{i_1'i_2'}^{i_3'}. \tag*{(14)}

that describes a projection of H~e1(i)e2(i)\widetilde{H}_{e_1^{(i)}e_2^{(i)}} onto a reduced subspace on bond e3(i)e_3^{(i)} defined by viv_i. The superblock Hamiltonian corresponding to two adjacent tensors {vp,vq∣{p,q}=l0}\{v_p,v_q\mid\{p,q\}=l_0\} surrounding the origin bond oco_c can be described as:

H~e1(p)e1(q)e2(p)e2(q)=∑k∈{1,2}∑r∈rk(p,q)H~ek(r)+∑r∈r(p,q)H~e1(p)e2(p)int+∑k,k′∈{1,2}H~ek(p)ek′(q)int.(15)\widetilde{H}_{e_1^{(p)}e_1^{(q)}e_2^{(p)}e_2^{(q)}}= \sum_{k\in\{1,2\}}\sum_{r\in r_k^{(p,q)}}\widetilde{H}_{e_k^{(r)}}+ \sum_{r\in r^{(p,q)}}\widetilde{H}_{e_1^{(p)}e_2^{(p)}}^{\mathrm{int}}+ \sum_{k,k'\in\{1,2\}}\widetilde{H}_{e_k^{(p)}e_{k'}^{(q)}}^{\mathrm{int}}. \tag*{(15)}

Initializing TTN tensors

Given a TTN structure identified by E\mathbf{E}, TTNOpt initializes isometric tensors vv using the real-space renormalization group (RSRG) [38, 39]. Namely, TTNOpt decides isometries following a recursive sequence from physical bonds to the canonical center of the initial TTN, oco_c, in the same order of composing renormalized spin operators by referring to LL as introduced in the previous section.

In order to initialize the isometry viv_i, TTNOpt requires the full diagonalization of H~e1(i)e2(i)\widetilde{H}_{e_1^{(i)}e_2^{(i)}} in Eq. (13). The corresponding eigenvectors uu are then collected in ascending order of their eigenvalues, and we obtain the element of isometry by

[vi]i1i2i3:=[u]i1i2i3,(16)\left[v_i\right]_{i_1i_2}^{i_3}:=\left[u\right]_{i_1i_2}^{i_3}, \tag*{(16)}

where [u]i1i2i3\left[u\right]_{i_1i_2}^{i_3} is the i3i_3-th eigenvector reshaped into a two-dimensional tensor indexed by i1i_1 and i2i_2. The maximum bond dimension here is χinit\chi_{\mathrm{init}}, which is determined by numerics.initial_bond_dimension. Consequently, the computational cost of full diagonalization of the block Hamiltonian is up to O(χinit6)O(\chi_{\mathrm{init}}^6).

It is worth noting that TTNOpt selects up to χinit\chi_{\mathrm{init}} eigenvectors, accounting for degeneracies arising from symmetries of the system [26, 27]. In the case of degenerate eigenvectors, they are either fully retained or discarded to maintain symmetry. To detect degeneracies, TTNOpt calculates the L1 norm of energy differences

Δk=∣ee3(i)k+1−ee3(i)k∣,(17)\Delta_k=\left|e_{e_3^{(i)}}^{k+1}-e_{e_3^{(i)}}^k\right|, \tag*{(17)}

where e(i)ke_{(i)}^{k} is the kk-th eigenvalue of the block Hamiltonian H~e1(i)e2(i)\widetilde{H}_{e_{1}^{(i)}e_{2}^{(i)}} for kk ranging from χinit−1\chi_{\mathrm{init}}-1 to 0. If Δk<δE\Delta_{k}<\delta_{E}, where δE\delta_{E} is set by numerics.energy degeneracy threshold, TTNOpt discards the (k+1)(k+1)-th eigenvector and updates k:=k−1k:=k-1. The iteration continues until Δk≥δE\Delta_{k}\geq\delta_{E} and then the practical bond dimension of i3i_{3} is determined as χe(i)3=k+1∈[1,χinit]\chi_{e_{(i)}^{3}}=k+1\in[1,\chi_{\mathrm{init}}].

Once the RSRG flow is complete, in order to determine singular values tensor D\mathcal{D}, TTNOpt derives the renormalized wave function Ψ~e1(p)e2(p)e1(q)e2(q)\widetilde{\Psi}_{e_{1}^{(p)}e_{2}^{(p)}e_{1}^{(q)}e_{2}^{(q)}} and bond energy Eoc\mathcal{E}_{\mathrm{oc}} from the diagonalization of the superblock Hamiltonian H~e1(p)e2(p)e1(q)e2(q)\widetilde{H}_{e_{1}^{(p)}e_{2}^{(p)}e_{1}^{(q)}e_{2}^{(q)}} of Eq. (15) by using the Lanczos method. TTNOpt then performs the SVD for Ψ~\widetilde{\Psi} as follows:

[Ψ~]p1p2q1q2=∑cUp1p2cDcVq1q2c,(18)\left[\widetilde{\Psi}\right]_{p_{1}p_{2}q_{1}q_{2}}=\sum_{c}U^{c}_{p_{1}p_{2}}D_{c}V^{c}_{q_{1}q_{2}}, \tag*{(18)}

where cc is up to χinit2\chi_{\mathrm{init}}^{2}. TTNOpt takes χ′≤χinit\chi^{\prime}\leq\chi_{\mathrm{init}} singular values considering degeneracies of singular values in the same manner as energy degeneracies while, in this case, TTNOpt compares the relative variation Δkrel=Dk+1−DkDk\Delta_{k}^{\mathrm{rel}}=\frac{D_{k+1}-D_{k}}{D_{k}}, with k∈[0,χinit−1]k\in[0,\chi_{\mathrm{init}}-1], to δS\delta_{S} defined by numerics.entanglement degeneracy threshold. After the bond dimension χoc\chi_{\mathrm{oc}} is decided, TTNOpt replaces two isometries {vp,vq∣{p,q}=l0}\{v_{p},v_{q}\mid\{p,q\}=l_{0}\} such that

[vp]p1p2p3:=[U]p1p2p3\left[v_{p}\right]_{p_{1}p_{2}}^{p_{3}}:=\left[U\right]_{p_{1}p_{2}}^{p_{3}}
[vq]q1q2q3:=[V]q1q2q3,(19)\left[v_{q}\right]_{q_{1}q_{2}}^{q_{3}}:=\left[V\right]_{q_{1}q_{2}}^{q_{3}}, \tag*{(19)}

with p3,q3∈[0,χoc−1]p_{3},q_{3}\in[0,\chi_{\mathrm{oc}}-1], and we also obtain the normalized singular values D\mathcal{D} with rank χoc\chi_{\mathrm{oc}}.

In the Lanczos method, H~\widetilde{H} must be applied to a vector Φ~\widetilde{\Phi} in the truncated Hilbert space as many times as the dimension of the Krylov subspace. The TTNOpt package calculates H~Φ~\widetilde{H}\widetilde{\Phi} by applying each term of Eq. (15) individually to reduce the computational cost. Since each operator has a χ×χ\chi\times\chi size, the computational cost of H~Φ~\widetilde{H}\widetilde{\Phi} scales as O(Cχ5)O(C\chi^{5}), where CC is an integer that depends on the number of terms. To further reduce computational cost, we adjust the order of summation of spin operators. For example, when taking ∑r∈r,r′∈r′Jrr′S~e,r+S~e′,r′−\sum_{r\in r,r^{\prime}\in r^{\prime}}J_{rr^{\prime}}\widetilde{S}^{+}_{e,r}\widetilde{S}^{-}_{e^{\prime},r^{\prime}} with g′>gg^{\prime}>g where g=∣r∣g=|r|, g′=∣r′∣g^{\prime}=|r^{\prime}|, we first apply ∑r′∈r′Jrr′S~e′,r′−\sum_{r^{\prime}\in r^{\prime}}J_{rr^{\prime}}\widetilde{S}^{-}_{e^{\prime},r^{\prime}} to Φ~\widetilde{\Phi} and subsequently apply S~e,r+\widetilde{S}^{+}_{e,r} for each r∈rr\in r. Additionally, TTNOpt utilizes

[Φ~]p1p2q1q2=∑c[vp]p1p2c[vq]q1q2c∑p1p2q1q2cc′[vp]p1p2c[vq]q1q2c[vp∗]p1p2c′[vq∗]q1q2c′∑p1p2q1q2[vp]p1p2c[vq]q1q2c[vp∗]p1p2c[vq∗]q1q2c,\left[\widetilde{\Phi}\right]_{p_{1}p_{2}q_{1}q_{2}}=\sum_{c}\left[v_{p}\right]_{p_{1}p_{2}}^{c}\left[v_{q}\right]_{q_{1}q_{2}}^{c}\sqrt{\frac{\sum_{p_{1}p_{2}q_{1}q_{2}cc^{\prime}}\left[v_{p}\right]_{p_{1}p_{2}}^{c}\left[v_{q}\right]_{q_{1}q_{2}}^{c}\left[v_{p}^{*}\right]_{p_{1}p_{2}}^{c^{\prime}}\left[v_{q}^{*}\right]_{q_{1}q_{2}}^{c^{\prime}}}{\sum_{p_{1}p_{2}q_{1}q_{2}}\left[v_{p}\right]_{p_{1}p_{2}}^{c}\left[v_{q}\right]_{q_{1}q_{2}}^{c}\left[v_{p}^{*}\right]_{p_{1}p_{2}}^{c}\left[v_{q}^{*}\right]_{q_{1}q_{2}}^{c}}},

where vpv_{p} and vqv_{q} are decided by the RSRG previously applied, as the initial state for the Lanczos method.

Main procedure

We first show the high-level procedure of the ground state search method of TTNOpt in Algorithm 1. Given a TTN state with the mixed canonical form described in § 4.1 with above vv, EE, ece_{c}, and D\mathcal{D}, TTNOpt updates TTN states based on the two-tensor update method within a sweep procedure as shown in Algorithm 2. Although the path of the sweep is not unique, it has to pass through all tensors in TTN states at least once during a sweep, even if TTN structures are not fixed. In TTNOpt, we implemented one variety of sweep procedures proposed in Ref. [35].

To illustrate Algorithm 2, let us introduce the set of edge labels e={0,1,⋯ ,2Nt}e=\{0,1,\cdots,2N_{t}\}. We assign a flag fe∈{0,1}f_{e}\in\{0,1\} to each bond e∈ee\in e to track the path and completion of the sweep. In the algorithm, flags for the bonds connecting to bare sites are initialized 1, i.e., fe=1f_{e}=1 with e∈[0,N−1]e\in[0,N-1]. We also use the bond distances ded_{e} from the origin bond ece_{c}. The distance ded_{e} is decided based on the Breadth-First Search algorithm described in Algorithm 3. Furthermore, we define two terminologies: the set of block spin operators S~\widetilde{S} for all bonds and the set of block Hamiltonians H~\widetilde{H} for all isometries. Both of these have been initially constructed during the RSRG procedure. In the TTNOpt package, S~\widetilde{S} and H~\widetilde{H} are implemented as dictionaries. Here, H~\widetilde{H} stores the block Hamiltonians H~e1(i)e2(i)\widetilde{H}_{e_{1}^{(i)}e_{2}^{(i)}} with a key e3(i)e_{3}^{(i)} for i∈[0,Nt−1]i\in[0,N_{t}-1] according to the isometry viv_{i}. Meanwhile, S~\widetilde{S} is a nested dictionary whose elements are indexed by an edge label key e∈ee\in e. Each S~e\widetilde{S}_{e} stores a dictionary of block spin operators S~e,r(O~)\widetilde{S}_{e,r}^{(\widetilde{O})} with (⋅)∈{z,+,−}(\cdot)\in\{z,+,-\}, where the key r∈rer\in r_{e} represents a set of physical spin locations associated with ee.

In Algorithm 2, the sweep procedure continues until all flags of bonds incoming to the renormalized region of the current canonical center ece_{c} are equal to 1. It is worth mentioning that in our algorithm, this situation always happens when ece_{c} returns to the origin bond ece_{c} and all flags, except for fecf_{e_{c}}, are equal to 1. Algorithm 4 is used to detect the edges incoming to the renormalized region whose flags are 0. From these edges, we choose the edge ec′e_{c}^{\prime}, which will be the next canonical center, by using Algorithm 5.

Let us assume that the bond ec′e_{c}^{\prime} connects vtv_{t} and vt′v_{t^{\prime}}, as shown in Figure 5(a), and vt′v_{t^{\prime}} was updated in the previous step. The flagging process in Algorithm 2 ensures that fec=1f_{e_{c}}=1 only if all bonds in the subtree rooted at the parent tensor vt′′v_{t^{\prime\prime}} have a flag of 1. To update tensors vtv_{t} and vt′v_{t^{\prime}}, we have to obtain the renormalized wave function Ψ~e1(t)e2(t)e1(t′)e2(t′)\widetilde{\Psi}_{e_{1}^{(t)}e_{2}^{(t)}e_{1}^{(t^{\prime})}e_{2}^{(t^{\prime})}} by using the Lanczos method. We note that TTNOpt contracts vtv_{t}, vt′v_{t^{\prime}}, and D\mathcal{D} at ece_{c} as described in Figs. 5(a) and (b), and this contracted tensor is used in the Lanczos method as an initial renormalized wave function. The Lanczos method requires to compose the superblock Hamiltonian H~e1(t)e2(t)e1(t′)e2(t′)\widetilde{H}_{e_{1}^{(t)}e_{2}^{(t)}e_{1}^{(t^{\prime})}e_{2}^{(t^{\prime})}} according to the new canonical region specified by ece_{c}. Recall that the effective Hamiltonians and the block spin operators for all bonds except those at ece_{c} are retained in H~\widetilde{H} and S~\widetilde{S}, respectively. This means that only S~ec\widetilde{S}_{e_{c}} and H~ec\widetilde{H}_{e_{c}} are refreshed by applying vt′′v_{t^{\prime\prime}} in Eqs. (12) and (13).

Figure 5. Schematic diagrams of procedures of the two-site tensor update: (a) the step of selecting the next canonical center denoted as ec′e'_c decided by using Algorithm 5, (b) the step of contraction within the next canonical region detailed in lines 12 and 13 of Algorithm 2, where a gray rounded rectangle represents the region of contracted tensors, (c) renormalized wave function Ψ~\widetilde{\Psi} resulting from the step (b) that is updated by using the Lanczos method in the ground state search, and (d),(e), and (f) three possible candidates of SVD of Ψ~\widetilde{\Psi} corresponding to Eq. (20).

After obtaining [Ψ~e1(t)e2(t)e1(t′)e2(t′)]p1p2q1q2\left[\widetilde{\Psi}_{e_{1}^{(t)}e_{2}^{(t)}e_{1}^{(t^{\prime})}e_{2}^{(t^{\prime})}}\right]_{p_{1}p_{2}q_{1}q_{2}}, where {p1,p2,q1,q2}\{p_{1},p_{2},q_{1},q_{2}\} are indices corresponding to edge labels {e1(t),e2(t),e1(t′),e2(t′)}\{e_{1}^{(t)},e_{2}^{(t)},e_{1}^{(t^{\prime})},e_{2}^{(t^{\prime})}\}, the DECOMPOSE_TENSOR function is performed to update tensors and local structure. For the reconnection of Ψ~e1(t)e2(t)e1(t′)e2(t′)\widetilde{\Psi}_{e_{1}^{(t)}e_{2}^{(t)}e_{1}^{(t^{\prime})}e_{2}^{(t^{\prime})}}, there exist three possible index orders: (p1p2∣q1q2)(p_{1}p_{2}\mid q_{1}q_{2}), (p1q2∣p2q1)(p_{1}q_{2}\mid p_{2}q_{1}), and (p1q1∣p2q2)(p_{1}q_{1}\mid p_{2}q_{2}) as shown in Figs. 5(d), (e), and (f). In DECOMPOSE_TENSOR function, the EEs for all three configuration are computed by performing a full SVD, which has a computational cost of O(χ6)O(\chi^6). The EEs are given by

S(p1p2∣q1q2)=−∑c(Dc)2ln⁡(Dc)2,S^{(p_1p_2|q_1q_2)}=-\sum_c(D_c)^2\ln(D_c)^2,
S(p1q2∣p2q1)=−∑c(Dc′)2ln⁡(Dc′)2,S^{(p_1q_2|p_2q_1)}=-\sum_c(D'_c)^2\ln(D'_c)^2,
S(p1q1∣p2q2)=−∑c(Dc′′)2ln⁡(Dc′′)2,(20)S^{(p_1q_1|p_2q_2)}=-\sum_c(D''_c)^2\ln(D''_c)^2, \tag*{(20)}

where

[Ψ~e1′e2′(t)e1(t)e2(t)e1′e2′(t′)e1′(t′)e2′(t′)]p1p2q1q2=∑c[U]p1p2c[D]c[V]q1q2c,=∑c[U′]p1q2c[D′]c[V′]p2q1c,=∑c[U′′]p1q1c[D′′]c[V′′]p2q2c,(21)\begin{aligned} \left[\widetilde{\Psi}_{e'_1e'_2}^{(t)e_1(t)e_2(t)}{}_{e'_1e'_2}^{(t')e_1'(t')e_2'(t')}\right]_{p_1p_2q_1q_2} =\sum_c[U]^c_{p_1p_2}[D]_c[V]^c_{q_1q_2}, \\ &=\sum_c[U']^c_{p_1q_2}[D']_c[V']^c_{p_2q_1}, \\ &=\sum_c[U'']^c_{p_1q_1}[D'']_c[V'']^c_{p_2q_2}, \tag*{(21)} \end{aligned}

respectively and cc is up to χ2\chi^2. TTNOpt then selects the structure with the smallest EE, if users set opt_structure.type to 1. However, if the minimum EE Smin⁡S_{\min} and S(p1p2∣q1q2)S^{(p_1p_2|q_1q_2)} of the original structure [Figure 5(d)], satisfy the condition ∣S(p1p2∣q1q2)−Smin⁡∣<ϵS\lvert S^{(p_1p_2|q_1q_2)}-S_{\min}\rvert<\epsilon_S, TTNOpt retains the original connection to avoid insignificant variations in the TTN structure. Here, ϵS\epsilon_S is defined by numerics.entanglement_convergence_threshold. Once the optimal structure is determined, TTNOpt truncates any singular values exceeding the rank χ\chi set by numerics.max_bond_dimension, while accounting for degeneracies in the singular values with δS\delta_S.

Since the reconnection procedure employed in TTNOpt is local, the solution may be trapped in local minima, especially in complex systems such as disordered ones [37]. To overcome this problem, TTNOpt has a function to select a structure based on relative probabilities. The heat-bath method works by evaluating the EEs for the three possible reconnections and sampling

Algorithm 1 Main procedure of ground state search.

  1. Input: HH: the definition of the Hamiltonian, EE: the list of three-integer tuples representing edge labels, ee: the list of integers of edge labels, oco_c: the integer referring to the edge label of the origin, mm: the number of stages of calculations, χinit\chi_{\mathrm{init}}: the maximum bond dimension for initializing tensor, χ\chi: the maximum bond dimensions for each stage of calculations, nmax⁡n_{\max}: the maximum number of sweeps for each stage of calculations, ϵE\epsilon_E: the threshold for the energies, ϵS\epsilon_S: the shoreshold for the EEs, ll: the number of consecutive times TTNOpt detects the TTN state as converged before terminating the optimization. This value is set to 2 by default.

  2. function MAIN⁡(H,E,e,oc,m,χinit,χ,nmax⁡,ϵE,ϵS,l)\operatorname{MAIN}(H,E,e,o_c,m,\chi_{\mathrm{init}},\chi,n_{\max},\epsilon_E,\epsilon_S,l)

  3. V,D,S~,H~:=INITIALIZE_TTN⁡(H,E,oc,χinit)\mathcal{V},\mathcal{D},\widetilde{S},\widetilde{H}:=\operatorname{INITIALIZE\_TTN}(H,E,o_c,\chi_{\mathrm{init}}) ▹ See § 4.2.2

  4. for m=1m=1 to mm do

  5. c:=0c:=0

  6. for n=1n=1 to nmax⁡,mn_{\max,m} do

  7. E,V,D,S~,H~,E,S:=SWEEP⁡(E,e,oc,V,D,S~,H~,χm)E,\mathcal{V},\mathcal{D},\widetilde{S},\widetilde{H},\mathcal{E},\mathcal{S}:=\operatorname{SWEEP}(E,e,o_c,\mathcal{V},\mathcal{D},\widetilde{S},\widetilde{H},\chi_m) ▹ E,S\mathcal{E},\mathcal{S} are sets of bond energies and EEs.

  8. if n>1n>1 then

  9. if Eb=Eb′E_b=E'_b for b∈[0,Nt−1]b\in[0,N_t-1] then

  10. if ∣1−E~bEb′∣<ϵE\left|1-\frac{\widetilde{E}_b}{E'_b}\right|<\epsilon_E for b∈[N,2Nt]b\in[N,2N_t] then

  11. if ∣S~b−S~b′∣<ϵS\left|\widetilde{S}_b-\widetilde{S}'_b\right|<\epsilon_S for b∈[0,2Nt]b\in[0,2N_t] then

  12. c:=c+1c:=c+1

  13. if c>lc>l then

  14. Break

  15. end if

  16. end if

  17. end if

  18. else

  19. c:=0c:=0

  20. end if

  21. end if

  22. E′:=EE':=E

  23. E′:=E\mathcal{E}':=\mathcal{E}

  24. S′:=S\mathcal{S}':=\mathcal{S}

  25. end for

  26. end for

  27. end function

Algorithm 2 Sweep procedure for the ground state search

  1. In/Output: EE, ee: the variables introduced in Algorithm 1, vv: the list of isometric tensors, D\mathcal{D}: the normalized vector containing up to χ\chi singular values, S~\widetilde{S}: the set of block spin operators for all edges, and H~\widetilde{H}: the set of block Hamiltonian for all isometries.

  2. Input: oco_c: the variables introduced in Algorithm 1, and χ\chi: the maximum bond dimension of TTN.

  3. Output: E\mathcal{E}: the set of bond energies obtained by the Lanczos method, and S\mathcal{S}: the set of EEs obtained from Eq. (20).

  4. function sweep⁡(E,e,oc,v,D,S~,H~,χ)\operatorname{sweep}(E,e,o_c,v,\mathcal{D},\widetilde{S},\widetilde{H},\chi)

  5. ec:=oce_c := o_c

  6. f:={0∣fe, where e∈e}f := \{0 \mid f_e,\ \text{where } e \in e\}

  7. d:=set_distance⁡(E,e,ec)d := \operatorname{set\_distance}(E,e,e_c)

  8. E:={}\mathcal{E} := \{\} ▷ Initialize the set of energies E\mathcal{E}.

  9. S:={}\mathcal{S} := \{\} ▷ Initialize the set of EEs S\mathcal{S}.

  10. while candidate_edge_indices⁡(E,ec,f)≠{}\operatorname{candidate\_edge\_indices}(E,e_c,f) \ne\{\} do

  11. ec′,t,t′,t′′:=local_two_tensor⁡(E,ec,f,d)e'_c,t,t',t'' := \operatorname{local\_two\_tensor}(E,e_c,f,d) ▷ See Figure 5(a).

  12. if {fe=1∣e∈{e1(t′′),e2(t′′)}}\{f_e=1\mid e\in\{e_1^{(t'')},e_2^{(t'')}\}\} then ▷ Recall that Et′′=(e1(t′′),e2(t′′),e3(t′′))E_{t''}=(e_1^{(t'')},e_2^{(t'')},e_3^{(t'')}).

  13. if ec≠oce_c\ne o_c then

  14. fec:=1f_{e_c}:=1 ▷ At this point, it satisfies ec=e3(t′′)e_c=e_3^{(t'')}

  15. end if

  16. end if ▷ If fecf_{e_c} becomes 1, it calculates expectation values according to vt′′v_{t''} with Ψ~\widetilde{\Psi} obtained at the previous step.

  17. Update S~ec\widetilde{S}_{e_c} by Eq. (12) with vt′′v_{t''}

  18. Update H~ec\widetilde{H}_{e_c} by Eq. (13) with vt′′v_{t''}

  19. Ψ~:=vt∘D∘vt′\widetilde{\Psi}:=v_t\circ\mathcal{D}\circ v_{t'} ▷ ∘\circ denotes the contraction of tensors according to the same indices based on EtE_t and Et′E_{t'}. See Figure 5 (b) and (Figure 5c).

  20. Ψ~,E:=lanczos⁡(Ψ~,S~,H~)\widetilde{\Psi},E:=\operatorname{lanczos}(\widetilde{\Psi},\widetilde{S},\widetilde{H})

  21. Eec:=E\mathcal{E}_{e_c}:=E

  22. vt,D,vt′,S:=decompose_tensor⁡(Ψ~,χ)v_t,\mathcal{D},v_{t'},\mathcal{S}:=\operatorname{decompose\_tensor}(\widetilde{\Psi},\chi)

  23. Sec:=S\mathcal{S}_{e_c}:=\mathcal{S} ▷ S\mathcal{S} is calculated by Eq. (20).

  24. for r∈{e1(t),e2(t),e1(t′),e2(t′)}r\in\{e_1^{(t)},e_2^{(t)},e_1^{(t')},e_2^{(t')}\} do

  25. if r∈[0,N−1]r\in[0,N-1] then

  26. Sr:=site_ee⁡(Ψ~,r)S_r:=\operatorname{site\_ee}(\widetilde{\Psi},r) ▷ See Figure 6.

  27. Sr:=Sr\mathcal{S}_r:=S_r

  28. end if

  29. end for

  30. ec:=ec′e_c:=e'_c

  31. Update Et,Et′E_t,E_{t'}

  32. d:=set_distance⁡(E,e,oc)d:=\operatorname{set\_distance}(E,e,o_c)

  33. end while ▷ Expectation values are calculated using vtv_t and vt′v_{t'} which construct Ψ~\widetilde{\Psi} obtained at the last step. return E,v,e,D,S~,H~,E,SE,v,e,\mathcal{D},\widetilde{S},\widetilde{H},\mathcal{E},\mathcal{S}

  34. end function

Figure 6. Schematic diagrams of the process of the site EE function. (a) and (b) represent the calculation of ∣ρp1p1′∣=∑p2q1q2[Ψ~∗]p1p2q1q2[Ψ~]p1′p2q1q2\lvert\rho_{p_1p'_1}\rvert=\sum_{p_2q_1q_2}[\widetilde{\Psi}^{*}]_{p_1p_2q_1q_2}[\widetilde{\Psi}]_{p'_1p_2q_1q_2}, where p1p_1 here is the index for a bare site srs_r with r∈[0,N−1]r\in[0,N-1]. (c) describes the diagonalization for ρ\rho to obtain the EE on the bond p1p_1, i.e., ∣ρp1p1′∣=∑c[ψ]p1c[Λc][ψ∗]cp1′\lvert\rho_{p_1p'_1}\rvert=\sum_c[\psi]_{p_1c}[\Lambda_c][\psi^*]_{cp'_1} and S=−∑cΛcln⁡ΛcS=-\sum_c\Lambda_c\ln\Lambda_c.

the one with a distribution given by the following expression

P(p1p2∣q1q2)∝exp⁡[−S(p1p2∣q1q2)/T],P(p_1p_2\mid q_1q_2)\propto\exp\left[-S(p_1p_2\mid q_1q_2)/T\right],
P(p1q2∣p2q1)∝exp⁡[−S(p1q2∣p2q1)/T],P(p_1q_2\mid p_2q_1)\propto\exp\left[-S(p_1q_2\mid p_2q_1)/T\right],
P(p1q1∣p2q2)∝exp⁡[−S(p1q1∣p2q2)/T],(22)P(p_1q_1\mid p_2q_2)\propto\exp\left[-S(p_1q_1\mid p_2q_2)/T\right], \tag*{(22)}

with

T=2−n/nτT0,(23)T=2^{-n/n_\tau}T_0, \tag*{(23)}

where an initial temperature T0T_0 and a decay factor nτn_\tau are set by numerics.opt_structure.temperature and numerics.opt_structure.tau, respectively, and n∈[0,nmax⁡−1]n\in[0,n_{\max}-1] represents the sweep number with nmax⁡n_{\max} assigned by numerics.max_sweep_nums. To achieve the convergence of the TTN structure during the sweep process, TTNOpt exponentially decreases TT to 0 (see Ref. [37]).

Furthermore, TTNOpt can select the structure with the minimum truncation error if opt_structure.type is set to 2. Here, the truncation error is defined as

Δ=1−∑c=1χ(Dc)2.(24)\Delta=1-\sum_{c=1}^{\chi}(D_c)^2. \tag*{(24)}

for (p1p2∣q1q2)(p_1p_2\mid q_1q_2) and similarly for the other decompositions.

As shown in Algorithm 1, the run_sweep is repeated until the number of sweeps reaches nmax⁡n_{\max} set by numerics.max_num_sweeps or the structure described by EE, variational energies, and EEs have been converged. TTNOpt saves the variational energy obtained by the Lanczos diagonalization performed at auxiliary bonds in the set E\mathcal{E}, as well as the EEs on all bonds, including physical ones, in the set S\mathcal{S}. These values are always overwritten for the same bonds in the sweep. To check for convergence, TTNOpt computes the difference in variational energies and EEs for all considered bonds with those from the previous sweep, and judges the convergence with ϵE\epsilon_E and ϵS\epsilon_S specified by numerics.energy_convergence_threshold and numerics.entanglement_convergence_threshold, respectively.

Algorithm 3 Set distances from the edge ee using the Breadth-First Search.

Input: EE, ee, oco_c: the variables introduced in Algorithm 1. Output: dd: the list of distances from edge oco_c

  1. function SET_DISTANCE(E,e,oc)(E,e,o_c)

  2. for e∈Ee \in\mathcal{E} do

  3. Ae:=⋃e′∈E{e′∣e∈E,e′∈E,e′≠e}A_e := \bigcup_{e' \in E}\{e' \mid e \in\mathcal{E}, e' \in\mathcal{E}, e' \ne e\}

  4. end for

  5. d:={0∣de, where e∈E}d := \{0 \mid d_e,\ \text{where } e \in\mathcal{E}\} ▷ Initialize entries of distance list as 0

  6. Initialize an empty queue QQ

  7. Enqueue oco_c into QQ

  8. while QQ is not empty do

  9. Dequeue e′e' from QQ

  10. d′:=de′d' := d_{e'}

  11. for each neighbor edge uu of e′e' in Ae′A_{e'} do

  12. if du=0d_u = 0 then

  13. du:=de′+1d_u := d_{e'} + 1

  14. Enqueue uu into QQ

  15. end if

  16. end for

  17. end while

  18. return dd

  19. end function

Algorithm 4 Detect candidate edges.

Input: EE: the variable introduced in Algorithm 1, ece_c: the integer of edge label of the current canonical center, and ff: the list of bools of flag at each edge label. Output: cc: the list of edge indices

  1. function CANDIDATE_EDGE_INDICES(E,ec,f)(E,e_c,f)

  2. c:=⋃(E1,E2,E3)∈E{e∣e∈{E1,E2},E3=ec}c := \bigcup_{(E_1,E_2,E_3)\in E}\{e \mid e \in\{E_1,E_2\}, E_3=e_c\} ▷ Find edges adjescent to canonical center.

  3. c:={i∈c∣fi=0}c := \{i \in c \mid f_i=0\} ▷ Filter by flag ff.

  4. return cc

  5. end function

Algorithm 5 Select two local tensors connected by the edge with the largest distance from the initial canonical center.

Input: EE, ece_c, ff: the variables introduced in Algorithm 4, and dd: the list of integers of distance at each edge Output: ec′e'_c: the integer of edge label of the next canonical center, tt, t′t', t′′t'': the integers of tensor labels.

  1. function LOCAL_TWO_TENSOR(E,ec,f,d)(E,e_c,f,d)

  2. c:=c := CANDIDATE_EDGE_INDICES(E,ec,f)(E,e_c,f)

  3. dmax⁡:=max⁡({de∣e∈c})d_{\max} := \max(\{d_e \mid e \in c\})

  4. c:={e∈c∣de=dmax⁡}c := \{e \in c \mid d_e=d_{\max}\}

  5. ec′:=c1e'_c := c_1 ▷ Select the first edge in cc

  6. for i∈[0,Nt−1]i \in[0,N_t-1] do

  7. if ec∈Ei∧ec′∈Eie_c \in E_i \land e'_c \in E_i then

  8. t:=it := i

  9. end if

  10. if ec∉Ei∧ec′∈Eie_c \notin E_i \land e'_c \in E_i then

  11. t′:=it' := i

  12. end if

  13. if ec∈Ei∧ec′∉Eie_c \in E_i \land e'_c \notin E_i then

  14. t′′:=it'' := i

  15. end if

  16. end for

  17. return (ec′,t,t′,t′′)(e'_c,t,t',t'')

  18. end function

Calculating expectation values

The TTNOpt package computes expectation values for one and two-site spin operators in sweep procedures using block spin operators S~\tilde{S}. To ensure that the computation covers all bare sites and site pairs without duplication or omission, TTNOpt assumes the structure remains unchanged during the calculation of the expectation values. Therefore, if users specify the structural optimization conducted, TTNOpt performs an additional sweep to calculate the expectation values after the first update stage, where m=1m=1, for the TTN with the optimized structure. In the stages of m>1m>1, the same calculations are carried out in every sweep since the structure is fixed.

TTNOpt calculates expectation values using Ψ~e1(t)e2(t′)e1(t′′)e2(t′′)\tilde{\Psi}_{e_1^{(t)}e_2^{(t')}e_1^{(t'')}e_2^{(t'')}} in Figure 5(a) at each step. Single-site expectation values are computed when the renormalized wave function Ψ~\tilde{\Psi} is directly associated with the corresponding physical site. Two-site expectation values are evaluated at the step where the edge of the canonical center, ec′e'_c, lies on the minimal path connecting the two physical sites. See Algorithm 1 for the details.

Let us denote for simplicity the renormalized wave function as [Ψ~]p1p2q1q2\left[\tilde{\Psi}\right]_{p_1p_2q_1q_2} with (p,q)=(t′′,t)(p,q)=(t'',t) and eliminate the subscripts {e1(t),e2(t),e1(t′′),e2(t′′)}\{e_1^{(t)},e_2^{(t)},e_1^{(t'')},e_2^{(t'')}\}. When vpv_p directly connects with the physical site rr, expectation values of spin operators for the site are evaluated by the following equation

⟨Srα⟩={∑p1p2q1q2p1′[Ψ~∗]p1p2q1q2[Ψ~]p1′p2q1q2[Sr(α)]p1p1′,(r=e1(p))∑p1p2q1q2p2′[Ψ~∗]p1p2q1q2[Ψ~]p1p2′q1q2[Sr(α)]p2p2′,(r=e2(p))(25)\left\langle S_r^\alpha\right\rangle= \begin{cases} \sum_{p_1p_2q_1q_2p'_1}\left[\tilde{\Psi}^{*}\right]_{p_1p_2q_1q_2}\left[\tilde{\Psi}\right]_{p'_1p_2q_1q_2}\left[S_r^{(\alpha)}\right]_{p_1p'_1}, & (r=e_1^{(p)})\\ \sum_{p_1p_2q_1q_2p'_2}\left[\tilde{\Psi}^{*}\right]_{p_1p_2q_1q_2}\left[\tilde{\Psi}\right]_{p_1p'_2q_1q_2}\left[S_r^{(\alpha)}\right]_{p_2p'_2}, & (r=e_2^{(p)}) \end{cases} \tag*{(25)}

with α∈{x,y,z}\alpha\in\{x,y,z\}. The two-site correlation between sites r∈e1(p)r \in e_1^{(p)} and r′∈e2(p)r' \in e_2^{(p)} are obtained by

⟨SrαSr′β⟩=∑p1p2q1q2p1′p2′[Ψ~∗]p1p2q1q2[Ψ~]p1′p2′q1q2[S~(α)]e1(p)p1p1′[S~(β)]e2(p)p2p2′,(26)\left\langle S_r^\alpha S_{r'}^\beta\right\rangle= \sum_{p_1p_2q_1q_2p'_1p'_2} \left[\tilde{\Psi}^{*}\right]_{p_1p_2q_1q_2} \left[\tilde{\Psi}\right]_{p'_1p'_2q_1q_2} \left[\tilde{S}^{(\alpha)}\right]_{e_1^{(p)}p_1p'_1} \left[\tilde{S}^{(\beta)}\right]_{e_2^{(p)}p_2p'_2}, \tag*{(26)}

with (α,β)∈{x,y,z}⊗2(\alpha,\beta)\in\{x,y,z\}^{\otimes2}. After completing a sweep, TTNOpt calculates expectation values concerning the origin bond oco_c with the renormalized wave function Ψ~e1(t)e2(t)e1(t′)e2(t′)\tilde{\Psi}_{e_1^{(t)}e_2^{(t)}e_1^{(t')}e_2^{(t')}} obtained at the final step of sweeps as shown in Figure 5(b), (Figure 5c). We denote [Ψ~e1(t)e2(t)e1(t′)e2(t′)]p1p2q1q2\left[\tilde{\Psi}_{e_1^{(t)}e_2^{(t)}e_1^{(t')}e_2^{(t')}}\right]_{p_1p_2q_1q_2} as [Ψ~]p1p2q1q2[\widetilde{\Psi}]_{p_1p_2q_1q_2} eliminating the subscripts with (p,q)∈{(t,t′),(t′,t)}(p,q)\in\{(t,t'),(t',t)\}.

Single site expectation values are obtained using the same equation as Eq. (25), which is calculated only in the case that one (or some) of the bonds {e1(p),e2(p),e1(q),e2(q)}\{e_1^{(p)},e_2^{(p)},e_1^{(q)},e_2^{(q)}\} is connected directly with a physical site rr. Regarding two-site correlations, TTNOpt calculates expectation values for all spin pairs that have not yet been evaluated during the sweeps, using the renormalized wave function associated with the pair (r,r′)(r,r'), where r∈{r1(p),r2(p)}r\in\{r_1^{(p)},r_2^{(p)}\} and r′∈{r1(q),r2(q)}r'\in\{r_1^{(q)},r_2^{(q)}\}. For example, in the case of (r,r′)=(r1(p),r1(q))(r,r')=(r_1^{(p)},r_1^{(q)}), the corresponding contraction is evaluated as

⟨Sr(α)Sr′(β)⟩=∑p1′p2′q1′q2′[Ψ∗]p1p2q1q2[Ψ~]p1′p2′q1′q2′[S~e1(p)(α)]p1′p1[S~e1(q)(β)]q1′q1.(27)\left\langle S_r^{(\alpha)}S_{r'}^{(\beta)}\right\rangle=\sum_{p_1'p_2'q_1'q_2'}[\Psi^*]_{p_1p_2q_1q_2}[\widetilde{\Psi}]_{p_1'p_2'q_1'q_2'}[\widetilde{S}_{e_1^{(p)}}^{(\alpha)}]_{p_1'p_1}[\widetilde{S}_{e_1^{(q)}}^{(\beta)}]_{q_1'q_1}. \tag*{(27)}

In our algorithm, the expectation values are computed at the step where the distance between the renormalized region in which the wave function Ψ~\widetilde{\Psi} is obtained and the corresponding physical sites is minimized. This approach stems from the idea that minimizing the number of renormalization steps for spin operators can reduce the loss of accuracy induced by truncation. However, it remains an open question whether the current strategy outperforms the alternative approach in which expectation values are evaluated using the fixed TTN wavefunction ∣Ψ⟩|\Psi\rangle after the completion of the sweep.

Factorizing tensors

Let us assume that a rank-NN tensor Ψs0,…,sN−1\Psi_{s_0,\ldots,s_{N-1}} is given by target.tensor, and Ψ\Psi is normalized as

Ψ:=Ψs0,…,sN−1∑s0,…,sN−1[Ψ]s0,…,sN−1[Ψ∗]s0,…,sN−1.(28)\Psi:=\frac{\Psi_{s_0,\ldots,s_{N-1}}}{\sqrt{\sum_{s_0,\ldots,s_{N-1}}[\Psi]_{s_0,\ldots,s_{N-1}}[\Psi^*]_{s_0,\ldots,s_{N-1}}}.} \tag*{(28)}

which is performed by TTNOpt itself before the factorization. TTNOpt then proceeds to decompose Ψ\Psi by using the sequential SVD into the MPN form [28] with a bond dimension χinit\chi_{\mathrm{init}} specified in numerics.initial_bond_dimension [Fig. 3(c)]. If users set numerics.opt_structure.type as 1 or 2, TTNOpt runs sweeps to transform the TTN with reconnection of local structures [Fig. 3(d)]. During these sweeps, TTNOpt applies the SVD with χinit\chi_{\mathrm{init}} for the renormalized wave function Ψ~\widetilde{\Psi} composed by the contraction of two tensors, i.e., skipping the Lanczos methods unlike the ground state search in Algorithm 2. This process continues until the TTN structure is fixed and the EEs are converged within the value εS\varepsilon_S specified by numerics.entanglement_convergence_threshold.

If users specify variables of numerics.fidelity, TTNOpt optimizes the TTN state based on the fidelity with the original tensor Ψ\Psi. TTNOpt can also include the network update in this process, depending on the input file. To obtain the optimal renormalized wave function Ψ~e1(p)e2(p)e1(q)e2(q)\widetilde{\Psi}_{e_1^{(p)}e_2^{(p)}e_1^{(q)}e_2^{(q)}}, it is necessary to compute the environment Ee1(p)e2(p)e1(q)e2(q)\mathcal{E}_{e_1^{(p)}e_2^{(p)}e_1^{(q)}e_2^{(q)}} associated with two tensors vpv_p and vqv_q within the canonical region:

Ee1(p)e2(p)e1(q)e2(q)=Ψ∏i∈[0,Nt−1]∖{p,q}∘vi∗,(29)\mathcal{E}_{e_1^{(p)}e_2^{(p)}e_1^{(q)}e_2^{(q)}}=\Psi\prod_{i\in[0,N_t-1]\setminus\{p,q\}}\circ v_i^*, \tag*{(29)}

where ∘\circ represents the contraction between tensors with the same indices following E\mathcal{E}. We directly embed the environment as

[Ψ~]p1p2q1q2:=[E]p1p2q1q2∑p1p2q1q2[E]p1p2q1q2[E∗]p1p2q1q2,(30)[\widetilde{\Psi}]_{p_1p_2q_1q_2}:=\frac{[\mathcal{E}]_{p_1p_2q_1q_2}}{\sqrt{\sum_{p_1p_2q_1q_2}[\mathcal{E}]_{p_1p_2q_1q_2}[\mathcal{E}^*]_{p_1p_2q_1q_2}}}, \tag*{(30)}

where we omitted the subscripts on tensors, to locally maximize the fidelity with Ψ\Psi.

The contraction of E\mathcal{E} is performed from the physical sites to the canonical center, which ensures that the environment tensor is built step by step while respecting the structure of the network. TTNOpt iterates the sweeps until the TTN state converges with respect to the network structure, the EE, and the fidelity. The convergence criteria of EE and fidelity are set by the thresholds εS\varepsilon_S and εF\varepsilon_F, specified in numerics.fidelity.convergence.entanglement and numerics.fidelity.convergence.threshold, respectively.

Reconstructing TTNs

If the TTN state is loaded by target.tensors, users must specify numerics.max_sweep_num and numerics.opt_structure.type as either 1 or 2. TTNOpt applies sweeps to the TTN to reconstruct its network by using DECOMPOSE_TENSOR in the same way as described in the first paragraph of Sec. 3.3 [Fig. 3(d)]. It is emphasized that TTNOpt retains up to χinit\chi_{\mathrm{init}} singular values during the SVD, where χinit\chi_{\mathrm{init}} is the maximum bond dimension of the given TTN state. The calculation terminates when the TTN state has converged concerning both the network structure and the EE, or when the maximum number of sweeps is reached.

Benchmark results

Hierarchical chain model

To briefly demonstrate the TTNOpt package, we performed the ground state search for the S=1/2S=1/2 hierarchical chain model [35] with system size N=2dN=2^d of an integer dd, defined as

H=∑h=0d−1∑i∈I(h)JαhSi⋅Si+1,(31)H=\sum_{h=0}^{d-1}\sum_{i\in I(h)}J\alpha^h\boldsymbol{S}_i\cdot\boldsymbol{S}_{i+1}, \tag*{(31)}

where J>0J>0 is the base coupling constant, and 0<α≤1.00<\alpha\leq1.0 is the decay factor for the coupling strength. In Eq. (31), an integer h∈[0,d−1]h\in[0,d-1] represents the height in the perfect binary tree (PBT) structure, and an integer set I(h)={i∣i=2h(2k+1)−1, where k=0,1,…,2d−h−1−1}I(h)=\{i\mid i=2^h(2k+1)-1,\ \text{where }k=0,1,\ldots,2^{d-h-1}-1\} specifies pairs of adjacent sites, (i,i+1)(i,i+1) according to the PBT structure, as illustrated in Figure 7.

Figure 7. Representation of the hierarchical chain model with N=8N = 8. The physical sites are ordered from left to right with indices i=0,…,N−1i = 0,\ldots,N - 1.

We examined the model with (J,α)=(1.0,0.5)(J,\alpha)=(1.0,0.5) and (1.0,1.0)(1.0,1.0), where the system size is N=256N=256, i.e., d=8d=8. These settings serve as reasonable litmus tests since α\alpha controls the interaction strength between adjacent spins, directly influencing the entanglement structure of the ground states. It allows for predicting ideal TTN structures: for α=0.5\alpha= 0.5, by the perturbative RSRG approach [42], the optimal TTN structure for the ground state would be the PBT. For α=1.0\alpha= 1.0, the system is the uniform Heisenberg chain under the open boundary conditions, and the optimal TTN structure for the ground state is expected to be an MPN-like one consisting of the dimer units as shown in Ref. [35].

We ran the variational algorithm with the maximum bond dimension χ=20\chi= 20 to find the optimal TTN structures. Additionally, we set the maximum number of sweeps to 50 and performed the calculation with δE=1×10−10\delta_E = 1 \times10^{-10} and δS=1×10−10\delta_S = 1 \times10^{-10}, respectively. The remaining parameters used in the calculation can be found in the input file “samples/ground_state_search/hierarchical”.

We demonstrate that TTNOpt can achieve the same optimal structure for both α=0.5\alpha= 0.5 and 1.01.0 as Ref. [35], where the system up to N=128N = 128 sites was treated. Furthermore, to show the importance of TTN structures, we present the bond EEs in the optimized TTN and MPN in Table 1. It shows that the optimal TTNs reduced both the maximum and average EEs compared to the case with MPN. The reduction is significant, especially in the case of α=0.5\alpha= 0.5. On the other hand, in α=1.0\alpha= 1.0, it is subtle since the MPN and the dimer MPN are similar structurally.

TypeMaximumAverage
optimized TTN (α=0.5\alpha= 0.5)0.11100.0618
MPN (α=0.5\alpha= 0.5)0.69350.3730
optimized TTN (α=1.0\alpha= 1.0)0.99770.9065
MPN (α=1.0\alpha= 1.0)1.01500.9376

Table 1. Maximum and average of the bond EEs in the optimized TTN and MPN when N=256N = 256 with α=0.5\alpha= 0.5 and 1.01.0. The EEs on the physical bonds are excluded from the analysis.

Multivariable quantics function

Recently, the impact of TTN structures on approximating the general tensor data and compressing quantics tensors has been studied [43]. Here, we apply TTNOpt to the compression of the three-variable quantics function employed in Ref. [43] that is written as

f(x)=∑j=1ncos⁡(kj⋅x)(32)f(\boldsymbol{x}) = \sum_{j=1}^{n} \cos\left(\boldsymbol{k}_j \cdot\boldsymbol{x}\right) \tag*{(32)}

where n=30n = 30, x=(x1,x2,x3)∈[0,1)⊗3\boldsymbol{x} = (x_1, x_2, x_3) \in[0, 1)^{\otimes3} and kj=(kj,1,kj,2,kj,3)\boldsymbol{k}_j = (k_{j,1}, k_{j,2}, k_{j,3}) with kjα∈N(0,1)k_j^\alpha\in\mathcal{N}(0, 1) that is the standard normal distribution. In quantics formulation, the continuous variable xi∈[0,1)x_i \in[0, 1) with the LL-bit precision is described as

xi=∑l=1Lxi,l2l,(33)x_i = \sum_{l=1}^{L} \frac{x_{i,l}}{2^l}, \tag*{(33)}

where xi,l∈{0,1}x_{i,l} \in\{0, 1\}. It allows the expression of a continuous function ff of mm variables as a 2mL2^{mL} dimensional tensor. In this paper, we set L=8L = 8 for all three variables m=3m = 3 to represent Eq. (32). The function’s heatmap concerning (x1,x2)∈[0,1)⊗2(x_1, x_2) \in[0, 1)^{\otimes2} with x3=0.5x_3 = 0.5 is depicted in Figure 8(a). To construct the tensor Ψ\Psi of Eq. (32), we employed a one-dimensional variable ordering, in the same order as the MPN structure shown in Figure 8(b) that was generated via the sequential SVD from Ψ\Psi. The authors of Ref. [43] have shown that TTN structures designed to separate each of the three variables (x1,x2,x3)(x_1, x_2, x_3) are reasonable, as Eq. (32) exhibits only weak correlations among them.

Figure 8. (a) The heatmap of the function Eq. (32) at x3=0.5x_3 = 0.5, where (x,y):=(x1,x2)(x, y) := (x_1, x_2). (b) MPN decomposition of the quantics function Eq. (32) where the red, blue, and green circles distinguish variants x1x_1, x2x_2, and x3x_3, respectively. (c) TTN structure obtained by the two-site update algorithm in TTNOpt, which optimizes the structure while maximizing the fidelity with respect to the original functional tensor, starting from the MPN depicted in (b). In both (b) and (c), we omit the drawing of the canonical center and arrows for clarity.

In our demonstration, we constructed an MPN representation of the normalized function in Eq. (32) using sequential SVD with χinit=4\chi_{\mathrm{init}} = 4, as depicted in Figure 8(b). The resulting MPN was then passed into the TTN update methods of maximizing the fidelity with [χ1,χ2,χ3]=[4,8,16][\chi_1,\chi_2,\chi_3] = [4, 8, 16]. The structural optimization was applied to MPN when χ1=4\chi_1 = 4. The thresholds for the convergence of fidelity and EE were set to ϵF=1×10−10\epsilon_F = 1 \times10^{-10} and ϵS=1×10−14\epsilon_S = 1 \times10^{-14}, respectively.

The TTN structure obtained by TTNOpt is illustrated in Figure 8(c). TTNOpt successfully identified a TTN structure that reflects the insight that the three variables are not correlated in a bit-wise way. Table 2 shows the EEs and fidelities obtained for both the MPN and the optimized TTN. The EEs for the TTN are lower than those from the MPN at each bond dimension. For instance, at χ=16\chi= 16, the EE of the MPN reaches 0.9745, while that of the TTN remains at 0.6169. It should also be noted that, when comparing the fidelities of the TTN and the MPN, the memory footprint of the former is bigger than that of the latter. It should also be noted that, concerning the fidelities of the two TNs, the memory footprint of the resulting TTN exceeds that of the MPN. For example, at χ=16\chi= 16, the TTN requires approximately 1.65 times more memory. These results highlight that TTNOpt not only improves compression fidelity but also reveals efficient data sparsity based on the entanglement structure, offering a significant advantage over conventional MPN-based approaches.

TypeTTNMPN
SS (χ=4\chi= 4)0.38250.5631
SS (χ=8\chi= 8)0.53780.7920
SS (χ=16\chi= 16)0.61690.9745
FF (χ=4\chi= 4)0.394080.33479
FF (χ=8\chi= 8)0.725120.57523
FF (χ=16\chi= 16)0.999970.83884

Table 2. The average bond EEs SS and fidelities F=∣Ψ∏v∈V∘v∣F = \lvert\Psi\prod_{v \in\mathcal{V}} \circ v \rvert obtained for the optimized TTN and the fixed MPN, respectively. The average EEs are taken over auxiliary and physical bonds and rounded to four decimal places. On the other hand, the average fidelity is taken over auxiliary bonds and truncated after the fifth significant figure.

Multivariate normal distribution

Finally, as an illustrative example of TTN reconstruction, we consider the TTN representation of a multivariate normal distribution [44]. The probability density function of a multivariate normal distribution with mean zero and covariance matrix KK is given as follows:

f(x)=exp⁡(−12xTK−1x)(34)f(\boldsymbol{x}) = \exp\left(-\frac{1}{2}\boldsymbol{x}^{T}K^{-1}\boldsymbol{x}\right) \tag*{(34)}

where x\boldsymbol{x} is a DD-dimensional vector and the normalization term is omitted for simplicity. In our demonstration, we set D=16D = 16 and each component of x\boldsymbol{x} is discretized over the range [−5,5][-5, 5] using L=4L = 4 bits of precision. We use the covariance matrix KK shown in Figure 9, which is constructed based on the tree structure illustrated in Figure 10. The elements of KK are defined using a parameter ρ=0.2\rho= 0.2 and decay exponentially with the shortest path length between the variables on the tree. In this setting, f(x)f(x) can be efficiently represented using a TTN whose geometry corresponds to the tree graph in Figure 10.

Figure 9. The definition of the covariance matrix KK in this experiment with ρ=0.2\rho= 0.2. (b) The heatmap of the matrix elements of KK is shown as a reference.

Figure 10. The tree structure to define the covariance matrix KK described in Figure 9 in the numerical experiment.

Building upon this setup, we explore whether automatic structural optimization can recover the optimal network structure of the multivariate normal distribution with tree-like correlation, following the same task as in [44]. Each bare bond carries 242^4 degrees of freedom representing LL-bit precision. Initially, f(x)f(x) is constructed as an MPN with auxiliary bond dimension χ=16\chi= 16 by using the Tensor Cross Interpolation (TCI) method [45, 46, 47]. Subsequently, the reconstruction algorithm is applied, optimizing the TTN structure based on bipartite EEs. During the sweeps, we use the default values in ϵEE\epsilon_{\mathrm{EE}} and δEE\delta_{\mathrm{EE}}.

The resulting TTN is shown in Figure 11. The optimized struc-

Figure 11. The initial and final structure of the tree tensor network in the reconstruction. The colors in the edges represent the amount of entanglement entropy.

ture perfectly matches the tree structure in Figure 10, successfully capturing the underlying correlations. Moreover, the bipartite EEs on the edges are reduced compared to those in the initial MPN. These results demonstrate that the TTNOpt can detect hidden correlation structures of f(x)f(x) and replace the MPN with the more efficient TTN representation.

Summary

We have developed a TTN manipulation package for analyzing the ground states of quantum spin systems and general tensor data. The TTNOpt package conducts the local structural reconnection during the sweep procedures based on two-tensor updates. This enables us to search for effective and efficient TTN representations, surpassing the simple MPN structure.

As a demonstration, we first applied the ground state search, including the structural optimization, to the hierarchical chain model [35]. We confirmed the resulting TTN and those of EEs are consistent with those in Ref. [35]. Second, we applied the fidelity-based update method to quantic MPN, representing the three-variable function in Ref. [43], in both cases, with and without structural optimization. We corroborated that a well-structured TTN can achieve better convergence in terms of fidelity when approximating the target data. Finally, we applied TTNOpt for MPN, representing the multi-variable probability density function where the covariance matrix is explicitly defined by the tree structure [44]. As a result, the optimized TTN structure could reproduce the same structure in the covariance relation tree, and we observed a decrease in EEs compared to the MPN.

The prospects of TTNOpt are extending its scope to fermionic systems and then applying it to quantum chemistry problems. Although molecular systems are not one-dimensional, they have been analyzed using MPN-based

DMRG in many cases. On the other hand, the potential benefits of introducing TTN, depending on molecular structures, especially in dendritic ones, have also been discussed [48, 49]. Combining our method for time evolution algorithm such as the time-dependent variational principle (TDVP) [50, 51] could also allow for more extended time evolutions by maintaining structures with low entanglement [52]. It would be implemented by alternatively applying the structural search sweeps and short-time evolution.

The factorizing tensor method is used not only to reveal the entanglement structure of the target data but also, of course, to compress the data into the TTNs. In particular, if we obtain TTN states that approximate the target quantum states, they can be converted into quantum circuits. In this scenario, a TTN structure with smaller bond dimensions would directly reduce the circuit depth [53]. It would be suitable for enhancing the usability of intermediate-sized quantum circuits [54].

The TCI algorithm [45, 46] constructs the MPN that approximates the function f(x)f(x) by accessing the sufficiently large number of input-output pairs (x,f(x))(x, f(x)), rather than explicitly constructing the high-rank tensor Ψ\Psi representing f(x)f(x). In the TCI, MPN has been used so far, while the use of TTN opens up the possibility of more efficient data representation. The extension of TCI to TTN is feasible [43]. However, the integration of TTN structural optimization into the TCI framework remains a subject for future research.

Acknowledgments

This work is partially supported by, KAKENHI Grant Numbers JP24K06881, JP22H01171, JP21H04446, JP21H05182, JP21H05191, and JP25KJ1773 from JSPS of Japan. We also acknowledge support from MEXT Q-LEAP Grant No. JPMXS0120319794, and from JST COI-NEXT No. JP-MJPF2014, ASPIRE No. JPMJAP2319, and CREST No.JPMJCR24I1 and JPMJCR24I3. We thank K. Okunishi for insightful discussions and comments. R.W. would like to thank D. Sels, H. Shinaoka, and the Tensor Network team at the Flatiron Institute, especially J. Tindall and M. Stoudenmire, for their useful discussions. R.W. was supported by the Σ\Sigma Doctoral Futures Research Grant Program from Osaka University. H.M was supported by JSTCOI-NEXT program Grant Numbers JP-MJPF2014. H.U. was supported by the COE research grant in computational science from Hyogo Prefecture and Kobe City through Foundation for Computational Science.

References

  1. [1]TTNOpt, https://github.com/Ryo-wtnb11/TTNOpt (2025).
  2. [2]C. Roberts, A. Milsted, M. Ganahl, A. Zalcman, B. Fontaine, Y. Zou, J. Hidary, G. Vidal, and S. Leichenauer, (2019), arXiv:1905.01330 [physics.comp-ph].arxiv.org/abs/1905.01330
  3. [3]R. Orús, Ann. Phys. 349, 117 (2014).
  4. [4]K. Okunishi, T. Nishino, and H. Ueda, J. Phys. Soc. Jpn. 91, 062001 (2022).
  5. [5]R. Orús, Nat. Rev. Phys. 1, 538 (2019).
  6. [6]S. Lu, M. Kanaś-Nagy, I. Kukuljan, and J. I. Cirac, (2024), arXiv:23103.06872 [quant-ph].
  7. [7]B. Jobst, K. Shen, C. A. Riofrío, E. Shishenina, and F. Pollmann, Quantum 8, 1544 (2024).
  8. [8]E. M. Stoudemire and D. J. Schwab, (2017), arXiv:1605.05775 [stat].
  9. [9]Z.-Y. Han, J. Wang, H. Fan, L. Wang, and P. Zhang, Phys. Rev. X 8, 031012 (2018).
  10. [10]S. Cheng, L. Wang, T. Xiang, and P. Zhang, Phys. Rev. B 99, 155131 (2019).
  11. [11]I. V. Oseledets, Dokl. Math. 80, 653 (2009).
  12. [12]B. N. Khoromskij, Constr. Approx. 34, 257 (2011).
  13. [13]T. Nishino, Y. Hieda, K. Okunishi, N. Maeshima, Y. Akutsu, and A. Gendiar, Prog. Theor. Phys. 105, 409 (2001).
  14. [14]G. Vidal, Phys. Rev. Lett. 99, 220405 (2007).
  15. [15]J. Jordan, R. Orús, G. Vidal, F. Verstraete, and J. I. Cirac, Phys. Rev. Lett. 101, 250602 (2008).
  16. [16]J. I. Cirac, D. Pérez-García, N. Schuch, and F. Verstraete, Rev. Mod. Phys. 93, 045003 (2021).
  17. [17]G. Vidal, Phys. Rev. Lett. 91, 147902 (2003).
  18. [18]G. Vidal, Phys. Rev. Lett. 93, 040502 (2004).
  19. [19]V. Murg, F. Verstraete, O. Legeza, and R. M. Noack, Phys. Rev. B 82, 205105 (2010).
  20. [20]H. R. Larsson, J. Chem. Phys. 151, 204102 (2019).
  21. [21]G. Evenbly and G. Vidal, Phys. Rev. B 79, 144108 (2009).
  22. [22]M. P. Zaletel and F. Pollmann, Phys. Rev. Lett. 124, 037201 (2020).
  23. [23]D. Sauerwein, A. Molnar, J. I. Cirac, and B. Kraus, Phys. Rev. Lett. 123, 170504 (2019).
  24. [24]D. Perez-Garcia, F. Verstraete, M. M. Wolf, and J. I. Cirac, Quantum Inf. Comput. 7, 401–430 (2007).
  25. [25]I. V. Oseledets, SIAM J. Sci. Comput. 33, 2295 (2011).
  26. [26]S. R. White, Phys. Rev. Lett. 69, 2863 (1992).
  27. [27]S. R. White, Phys. Rev. B 48, 10345 (1993).
  28. [28]U. Schollwöck, Ann. Phys. 326, 96 (2011), January 2011 Special Issue.
  29. [29]K. Okunishi, H. Ueda, and T. Nishino, Prog. Theor. Exp. Phys. 2023, 023A02 (2023).
  30. [30]K. G.-L. Chan and M. Head-Gordon, J. Chem. Phys. 116, 4462 (2002).
  31. [31]O. Legeza and J. Sólyom, Phys. Rev. B 68, 195116 (2003).
  32. [32]G. Moritz, B. A. Hess, and M. Reiher, J. Chem. Phys. 122, 024107 (2005).
  33. [33]O. Legeza, L. Veis, A. Poves, and J. Dukelsky, Phys. Rev. C 92, 051303 (2015).
  34. [34]W. Li, J. Ren, H. Yang, and Z. Shuai, J. Phys. Condens. Matter 34, 544003 (2022).
  35. [35]T. Hikihara, H. Ueda, K. Okunishi, K. Harada, and T. Nishino, Phys. Rev. Res. 5, 013031 (2023).
  36. [36]T. Hikihara, H. Ueda, K. Okunishi, K. Harada, and T. Nishino, (2024), arXiv:2401.16000 [cond-mat].arxiv.org/abs/2401.16000
  37. [37]T. Hikihara, H. Ueda, K. Okunishi, K. Harada, and T. Nishino, (2025), arXiv:2501.15514 [cond-mat].DOI
  38. [38]K. G. Wilson, Rev. Mod. Phys. 47, 773 (1975).
  39. [39]T. Hikihara, A. Furusaki, and M. Sigrist, Phys. Rev. B 60, 12116 (1999).
  40. [40]Specifically, each sweep searches for the lowest-energy state with M′, so that the renormalized wave function after the sweep span on the subspaces labeled by {· · · , M′ − 1, M′ + 1, · · ·} as long as χinit > 1.
  41. [41]There should be caution about discrepancies between the isometry indices i in the main text and the output format. When TTNOpt outputs the physical properties on “basic.csv”, indices of isometries i ∈ [0, Nt − 1] are shifted by adding the system size N to assign physical sites as nodes with index from [0, N − 1].
  42. [42]S.-k. Ma, C. Dasgupta, and C.-k. Hu, Phys. Rev. Lett. 43, 1434 (1979).
  43. [43]J. Tindall, M. Stoudenmire, and R. Levy, (2024), arXiv:2410.03572.DOI
  44. [44]H. Manabe and Y. Sano, (2024), arXiv:2412.12067 [quant-ph].DOI
  45. [45]H. Shinaoka, M. Wallenberger, Y. Murakami, K. Nogaki, R. Sakurai, P. Werner, and A. Kauch, Phys. Rev. X 13, 021015 (2023).
  46. [46]Y. N. Fernández, M. K. Ritter, M. Jeannin, J.-W. Li, T. Kloss, T. Louvet, S. Terasaki, O. Parcollet, J. von Delft, H. Shinaoka, and X. Waintal, (2024), arXiv:2407.02454 [physics].DOI
  47. [47]It is worth mentioning that the MPN constructed by the TCI must be transformed into the mixed canonical MPN, since it has the pivots on auxiliary bonds and does not follow the rule of TTNOpt as an input TTN. We put the TCI code in “sample/reconstruct” in TTNOpt such that users can use for broad data.
  48. [48]N. Nakatani and G. K.-L. Chan, J. Chem. Phys. 138, 134111 (2013).
  49. [49]V. Murg, F. Verstraete, R. Schneider, P. R. Nagy, and Ö. Legeza, J. Chem. Theory Comput. 11, 1027 (2015).
  50. [50]J. Haegeman, J. I. Cirac, T. J. Osborne, I. Pižorn, H. Verschelde, and F. Verstraete, Phys. Rev. Lett. 107, 070601 (2011).
  51. [51]J. Haegeman, C. Lubich, I. Oseledets, B. Vandereycken, and F. Verstraete, Phys. Rev. B 94, 165118 (2016).
  52. [52]D. Bauernfeind and M. Aichhorn, SciPost Phys. 8, 024 (2020).
  53. [53]S. Sugawara, K. Inomata, T. Okubo, and S. Todo, (2025), arXiv:2501.18856 [quant-ph].
  54. [54]J. Schuhmacher, M. Ballarin, A. Baiardi, G. Magnifico, F. Tacchino, S. Montangero, and I. Tavernelli, PRX Quantum 6, 010320 (2025).

Paper details

vlnc:W_sm99a3ym
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Physics and Astronomy

Not recorded for this paper

View statement
Looking for related papers…
Contents