Generating TTN

TenNetLib.jl defines following functions to generate TTNs with random entries.

For the standard TTN with the default hierarchical binary tree structure, follwoing function can be used.

TenNetLib.default_randomTTNFunction
function default_randomTTN(sites::Vector{Index{T}}, chi::Int, qn::QN = QN()) where T

Returns a TTN object, having random elements, from site Indexs sites, initial bond dimension chi and (optional) global QN sector qn. The structure is a default hierarchical binary tree graph. Automatically handles situations where the number of sites is not a power of 2.

Note: For QN conserving TTN, the bond dimension might be off by one or two from chi.

source

The underlying default binary tree for the function above is generated by the following function.

TenNetLib.default_graph_sitenodesMethod
function default_graph_sitenodes(N::Int)

Given the total number of sites, N::Int, generates the default hierarchical binary tree graph and a Dict{Int, Int2} object that maps each site to the corresponding node. Automatically handles situations where the number of sites is not a power of 2.

Return values:

  • ::Graph{Int2}: Default hierarchical tree graph to accomodate N number of sites in a TTN.
  • ::Dict{Int, Int2}: Maps each site to the corresponding node.

Example:

graph, sitenodes = default_graph_sitenodes(32)

sitenodes[1] == (1,1) # true
sitenodes[2] == (1,1) # true
sitenodes[3] == (1,2) # true
sitenodes[4] == (1,2) # true
sitenodes[31] == (1,16) # true
sitenodes[32] == (1,16) # true
source

In the generic scenario, a random TTN with user-defined structure can be generated by the following function.

TenNetLib.randomTTNFunction
function randomTTN(sites::Vector{Index{T}}, graph::Graph{Int2},
                   sitenodes::Dict{Int, Int2}, chi::Int, qn::QN = QN()) where T

Returns a TTN object, having random elements, from site Indexs sites, the underlyting graph, sitenodes::Dict{Int, Int2} that maps each site to the corresponding node, initial bond dimension chi, and (optional) global QN sector qn. The structure is determined by the input graph object.

Note: This function can be used to generate any loop-free tensor network.

Note: For QN conserving TTN, the bond dimension might be off by one or two from chi.

source
Info

The above function can be used to generate any loop-free tensor network.