Tensor Network Theory Library  Beta release 1.2.1
A library of routines for performing TNT-based operations
 All Data Structures Functions Variables Groups Pages
Creating, copying and deleting

Detailed Description

This contains utility type function for nodes, e.g. creating different types of nodes, deleting a single node or group of nodes, or copying nodes.


tntNode tntNodeCopy (tntNode A)
tntNode tntNodeCopyConj (tntNode A, int conj)
tntNode tntNodeCreate (tntComplexArray *nodeVals, tntLegLabel leglabels, unsigned dimleg1, unsigned dim...)
tntNode tntNodeCreateEyeLeg (tntNode A, tntLegLabel legA, tntNode B, tntLegLabel legB)
tntNode tntNodeCreateEyeOp (tntNode A)
void tntNodeFree (tntNode *A)
void tntNodeGroupFree (tntNode *A)

Function Documentation

tntNode tntNodeCopyConj ( tntNode  A,
int  conj 

Makes a copy of the original node. Any parameters that belong to the original node will also be copied to the new node.

The conjugate flag should be set to zero if the copy of the node should have the same form as the original node, and set this to 1 if the tensor values associated with the copy of the node should be the complex conjugate of those for the original node. The legs of the new node will not be connected to anything.

Note that if quantum number information is being used to preserve symmetries, then setting conj = 1 will also act to flip the directions of all the quantum number information for each leg.

The copy of the original node.
AThe node to take a copy of.
conjConjugate flag.

Definition at line 319 of file tntNodeUtil.c.

Referenced by tntMpsVarMinMpo1sFullContract().

tntNode tntNodeCreate ( tntComplexArray *  nodeVals,
tntLegLabel  leglabels,
unsigned  dimleg1,
unsigned  dim... 

Creates a new node, using the values given in the 1D complex array nodevals.

The label that should be assigned to each leg should be passed as a string, the length of which sets the number of legs (maximum number 12) The dimension of each leg should be passed as the final arguments. If the number of dimensions supplied is less than the length of the string, it will be assumed that all remaining legs have a dimension of 1. The legs should be order such that the one with the fastest running index in the supplied array comes first. e.g. if there are three legs have respective indices \(i,j,k\) with dimensions \(d_i,d_j,d_k\), the then index in the suplied 1D array should be \( i + d_i j + d_i d_j k \). (Note: If there are two dimensions, rows then columns, this is equivalent to column-major order which is the default in MATLAB and Fortran).

The size of the array must be \(d_i d_j d_k\).

The values are copied from nodevals, so if the array is no longer required it should be freed afterwards using tntComplexArrayFree().

The new node.
nodeValsThe values for the node. If NULL, node will be filled with random values.
leglabelsThe label that will be assigned to each leg.
dimleg1The dimension of the first leg (optional).
dim...Dimensions of remaining legs in the order of the labels (optional).

Definition at line 354 of file tntNodeUtil.c.

Referenced by tntMpsCreateBosonOp(), tntMpsCreateConfig(), tntMpsCreateMpo(), tntMpsCreateRandom(), tntMpsCreateSpinOp(), tntMpsCreateSymmRandom(), tntMpsMpoMpsInit(), tntMpsMpoMpsInitOrth(), and tntMpsSelfInit().

tntNode tntNodeCreateEyeLeg ( tntNode  A,
tntLegLabel  legA,
tntNode  B,
tntLegLabel  legB 

Returns a node representing the identity matrix i.e. a node having two legs, where the value of the node is 1 when the leg indices are equal and zero otherwise. The legs do not have to have the same dimensions.

The leg properties, including quantum number information and labels are copied from existing nodes \(A\) and \(B\).

If the labels of the two legs are the same, then the second leg is given the next (cyclic) alphanumeric number of that type (i.e. number, lowercase, or uppercase).

See Also
If you want to create an identity Nodes sharing the leg properties of all the legs on a Nodes, use tntNodeCreateEyeOp() instead.
The tntNode which represents the identity matrix operator.
ANode \(A\) to define leg properties of the first leg of the identity node
legALeg of \(A\) to use for the first leg
BNode \(B\) to define leg properties of the second leg of the identity node
legBLeg of \(B\) to use for the second leg

Definition at line 76 of file tntNodeUtil.c.

References tntIntArrayFree().

Referenced by tntNodeContractSelf().

tntNode tntNodeCreateEyeOp ( tntNode  A)

Returns the operator which defines the identity node with the same leg properties as the node \(A\) passed as an argument i.e

  • the leg labels, leg dimensions and quantum number information match those of the node passed as an argument,
  • the elements of the node are 1 whenever the index of every leg is equal, and zero otherwise.

If NULL is passed as an argument, then the basis operator is used to define the leg properties instead. The basis operator can be set using tntSysBasisOpSet() and inspected using tntSysBasisOpGet(). If it has not been set yet calling this function with NULL as an argument will result in an error.

The tntNode which represents the identity operator.

Definition at line 195 of file tntNodeUtil.c.

References systype, tntIntArrayFree(), and tntSymmTypeGet().

Referenced by tntMpsCreateBosonOp(), tntMpsCreateEyeMpo(), tntMpsCreateMpo(), tntMpsCreatePropArray(), and tntMpsCreateSpinOp().

void tntNodeGroupFree ( tntNode *  A)

Deletes a group of nodes i.e. frees the node \(A\) and all the nodes connected to it. After calling the function the node pointer wil be NULL.

APointer to one of the nodes in the group of nodes to free.

Definition at line 288 of file tntNodeUtil.c.

Referenced by tntMpsCreateRandom(), and tntMpsMpoContract().