Tensor Network Theory Library  Beta release 1.2.1 A library of routines for performing TNT-based operations
Matlab scripts

## Detailed Description

Add the directory tnt_matfiles to your path in MATLAB to make use of these functions. These functions can be used to build initialisiation files. See the files ending in .m in the Examples section for usage.

## Functions

function tntMat2nc (in matname, in ncoutput)

function tntMatAppendBasisOp (in op, in qnums)

function tntMatAppendOpArray (in narrin, in op)

function tntMatBosonOps (in nmax, in N)

function tntMatCreate2SitesOpArray (in ops)

function tntMatCreateBasisOp (in op, in qnums)

function tntMatCreateBlankFullInit ()

function tntMatCreateFunctionalOp (in ops, in func)

function tntMatCreateOpArray (in ops)

function tntMatCreateProdMps (in cfg, in qnums)

function tntMatExpandBasis (in ssop, in N)

function tntMatSpinOps (in s, in N)

function tntNc2mat (in ncname, in matoutput)

## Function Documentation

 function tntMat2nc ( in matname, in ncoutput )

Converts a MATLAB initialisation or output file to a NetCDF initialisation or output file.

The converted file will be saved in the current directory.

Parameters
 matname Path to the .mat file to convert to NetCDF format ncoutput Name to the NetCDF output file (should end in .nc)
Return values
 No return value, but saves a NetCDF file.
 function tntMatAppendBasisOp ( in op, in qnums )

Creates the basis operator structure, where the basis operator has been provided as a matrix. If there is a global physical symmetry (e.g. total number of bosons are being conserved), then the associated quantum numbers should be provided. Otherwise simply pass an empty array. In this case the basis operator should be diagonal

Parameters
 op Matrix representing the basis operator qnums Quantum numbers for a physical leg of the operator
Return values
 sx A struct
Examples:
init_domain_wall.m, init_harm_sf.m, init_heis_s1.m, init_impurity_boson_transport.m, and init_quantum_bowling.m.
 function tntMatAppendOpArray ( in narrin, in op )

Turns a matrix into a node structure representing an operator in the MPS library. To create a single node, call the function passing a cell of length 1 containing the matrix. The node can then be loaded using tntNodesLoad().

To create a node array, call the function passing a cell array, each entry contraining a matrix. The node can then be loaded using tntNodeArraysLoad().

The nodes are created have two legs according to the labelling of the MPS library i.e. columns correspond to the upwards facing leg and are labelled "U", rows correspond to the downwards facing leg and are labelled "D".

Parameters
 ops A cell array contraining matrices for the operators.
Return values
 narr A structure representing a singe node or a node array.
 function tntMatBosonOps ( in nmax, in N )

Creates matrices for N-species boson operators. These matrices can then be used to build Hamiltonian terms If you wish to turn these matrices into nodes that can be loaded into the library use tntMatCreateOpArray().

Returns the result in a cell having a number of elements equal to the number of species. i.e. n{1}, bdag{1} and b{1} will be the operators for the first species and n{2}, bdag{2} and b{2} will be the operators for the second species etc.

Parameters
 nmax Maximum number of bosons allowed on each site N The number of species
Return values
 bdag A cell, each entry containing the matrix representing $$\hat{b}^{\dagger}$$ for a given species. b A cell, each entry containing the matrix representing $$\hat{b}$$ for a given species. n A cell, each entry containing the matrix representing $$\hat{n}$$ for a given species.
Examples:
init_harm_sf.m, init_impurity_boson_transport.m, and init_quantum_bowling.m.
 function tntMatCreate2SitesOpArray ( in ops )

Turns a matrix into a node structure representing an operator in the MPS library.

To create a single node, call the function passing a cell of length 1 containing the matrix. The node can then be loaded using tntNodesLoad().

To create a node array, call the function passing a cell array, each entry contraining a matrix. The node can then be loaded using tntNodeArraysLoad().

The nodes are created have four legs according to the labelling of propagator nodes in the MPS library. The incoming matrix should have 4 dimensions. The first two dimensions correspond to the downwards facing legs and are labelled "D" and "E". The second two dimensions columns correspond to the upwards facing leg and are labelled "U" and "V".

Parameters
 ops A cell array contraining matrices for the operators.
Return values
 narr A structure representing a singe node or a node array.
 function tntMatCreateBasisOp ( in op, in qnums )

Creates the tntSystem structure and initialises it with the basis operator structure, where the basis operator has been provided as a matrix. If there is a global physical symmetry (e.g. total number of bosons are being conserved), then the associated quantum numbers should be provided. Otherwise simply pass an empty array. In this case the basis operator should be diagonal

Parameters
 op Matrix representing the basis operator qnums Quantum numbers for a physical leg of the operator
Return values
 sx A struct
Note
If the tntSystem variable already exists and you want to add the basisOp to it, use tntMatAppendBasisOp() instead.
 function tntMatCreateBlankFullInit ( )

Creates and initialises all the variables needed for initialisation file with default values

Examples:
init_domain_wall.m, init_harm_sf.m, init_heis_s1.m, init_impurity_boson_transport.m, and init_quantum_bowling.m.
 function tntMatCreateFunctionalOp ( in ops, in func )

Turns a cell array of operators into a functional node representing a sinlge site MPS operator. Once loaded into the TNT library, parameters on the node can be set to change the final value.

Parameters
 ops A cell array of the matrix operators. func A string representing the function for the node - either 'sum' or 'exp' are currently supported.
Return values
 node A structure representing the functional node.
 function tntMatCreateOpArray ( in ops )

Turns a matrix into a node structure representing an operator in the MPS library. To create a single node, call the function passing a cell of length 1 containing the matrix. The node can then be loaded using tntNodesLoad().

To create a node array, call the function passing a cell array, each entry contraining a matrix. The node can then be loaded using tntNodeArraysLoad().

The nodes are created have two legs according to the labelling of the MPS library i.e. columns correspond to the upwards facing leg and are labelled "U", rows correspond to the downwards facing leg and are labelled "D".

Parameters
 ops A cell array contraining matrices for the operators.
Return values
 narr A structure representing a singe node or a node array.
Examples:
init_domain_wall.m, init_harm_sf.m, init_heis_s1.m, init_impurity_boson_transport.m, and init_quantum_bowling.m.
 function tntMatCreateProdMps ( in cfg, in qnums )

Creates a structure that represents a product MPS network, that can then be loaded uses tntNetworksLoad(). Note that the created wave function may not be normalised.

Parameters
 cfg A cell, each entry containing a vector representing the state on each site qnums The quantum numbers for the physical leg, or an empty array if there is no global symmetry
Return values
 wf A structure representing the product MPS
Examples:
init_domain_wall.m, and init_impurity_boson_transport.m.
 function tntMatExpandBasis ( in ssop, in N )

Expands a matrix representing an operator for a single species into a matrix representing a multi-species operator

Returns the result in a cell having a number of elements equal to the number of species. If the original operator was $$d\times d$$, the new matrices will be $$d^N\times d^N$$.

Parameters
 ssop Single species operator N The number of species
Return values
 exop Cell array containing the operator for each species
 function tntMatSpinOps ( in s, in N )

Creates matrices for N-species spin operators. These matrices can then be used to build Hamiltonian terms If you wish to turn these matrices into nodes that can be loaded into the library use tntMatCreateOpArray().

Returns the result in a cell having a number of elements equal to the number of species. i.e. sx{1}, sy{1} and sz{1} will be the operators for the first species and sx{2}, sy{2} and sz{2} will be the operators for the second species etc.

Parameters
 s Required spin N The number of species
Return values
 sx A cell, each entry containing the matrix representing $$\hat{S}^x$$ for a given species. sy A cell, each entry containing the matrix representing $$\hat{S}^y$$ for a given species. sz A cell, each entry containing the matrix representing $$\hat{S}^z$$ for a given species. sp A cell, each entry containing the matrix representing $$\hat{S}^p$$ for a given species. sm A cell, each entry containing the matrix representing $$\hat{S}^m$$ for a given species.
Examples:
init_domain_wall.m, and init_heis_s1.m.
 function tntNc2mat ( in ncname, in matoutput )

Converts a NetCDF initialisation or output file to a MATLAB initialisation or output file.

The converted file will be saved in the current directory.

Parameters
 ncname Path to the .nc file to convert to MATLAB format matoutput Name of the MATLAB output file (should end in .mat)
Return values
 No return value, but saves a MATLAB file.