Tensor Network Theory Library  Beta release 1.2.0 A library of routines for performing TNT-based operations
Getting information and finding

## Detailed Description

These functions can be used to get the properties of a node or information about connections between nodes in a network. They do not alter the properties of the node.

## Functions

tntNode tntNodeFindConn (tntNode A, tntLegLabel legA)

tntNode tntNodeFindFirst (tntNetwork nw)

tntNode tntNodeFindLast (tntNetwork nw)

tntComplexArray tntNodeGetDiag (tntNode A, tntLegLabel rowlegs, tntLegLabel collegs)

tntComplex tntNodeGetFirstEl (tntNode A)

unsigned tntNodeGetLegDim (tntNode A, tntLegLabel legA)

int tntNodeGetLegDir (tntNode A, tntLegLabel legA)

tntComplexArray tntNodeGetMatrix (tntNode A, tntLegLabel rowlegs, tntLegLabel collegs)

double tntNodeGetNorm (tntNode A)

tntComplex tntNodeGetTrace (tntNode A, tntLegLabel rowlegs, tntLegLabel collegs)

unsigned tntNodeIsCovariant (tntNode A)

unsigned tntNodeIsFunctional (tntNode A)

void tntNodePrintAll (tntNode A)

void tntNodePrintAsMatrix (tntNode A, tntLegLabel rowlegs, tntLegLabel collegs)

void tntNodePrintInfo (tntNode A)

## Function Documentation

 tntNode tntNodeFindConn ( tntNode A, tntLegLabel legA )

Finds the node that is connected to legA of the node $$A$$ that is passed as an argument. It will return NULL if there is nothing connected to this leg.

Returns
The node connected to the node $$A$$ by the leg stated.
Parameters
 A The node to find the connection of legA The leg of the node $$A$$ to find the connection of

Definition at line 29 of file tntNodeInfo.c.

 tntNode tntNodeFindFirst ( tntNetwork nw )

Identifies the first node in the network.

Returns
The first node in the network. Returns NULL if the network is empty.
Examples:
tntThermal_cl.c.

Definition at line 50 of file tntNodeInfo.c.

 tntNode tntNodeFindLast ( tntNetwork nw )

Identifies the last node in the network.

Returns
The last node in the network. Returns NULL if the network is empty.

Definition at line 68 of file tntNodeInfo.c.

 tntComplexArray tntNodeGetDiag ( tntNode A, tntLegLabel rowlegs, tntLegLabel collegs )

Gets the diagonal values of a matrix formed by reshaping the tensor corresponding to the node $$A$$. The legs that are assigned to each of the dimensions of the matrix are given as arguments, where the first leg corresponds to the fastest moving index. The resulting matrix must be square, and if it is not the function exits with an error. The values returned are in complex format even if the tensor values are purely real. The diagonal values are returned in an array of type ::tntComplexArray which should be freed using tntComplexArrayFree() when no longer required.

Returns
A complex array containing the diagonal elements of the reshaped tensor that represents the node $$A$$.
Parameters
 A Node to get the trace of rowlegs List of legs making up the rows of the matrix collegs List of legs making up the columns of the matrix

Definition at line 145 of file tntNodeInfo.c.

 tntComplex tntNodeGetFirstEl ( tntNode A )

Gets the first element in the tensor corresponding to the node $$A$$. The value returned is in complex format even if the tensor values are purely real.

Returns
The first element of the tensor that represents the node $$A$$.

Definition at line 86 of file tntNodeInfo.c.

 unsigned tntNodeGetLegDim ( tntNode A, tntLegLabel legA )

Returns the dimension of the specified leg of the node $$A$$. If the leg does not exist an error will result.

Returns
The leg dimension.
Parameters
 A The node to get the dimension of. legA The leg of the node to get the dimension of.

Definition at line 246 of file tntNodeInfo.c.

References tntIntArrayFree().

 int tntNodeGetLegDir ( tntNode A, tntLegLabel legA )

Gets the direction of a given leg, which is used when determining quantum number blocks. The value taken will be TNT_QN_IN if it is an incoming leg, TNT_QN_OUT if it is an outgoing leg, and 0 if there is no quantum number information set on the leg.

Returns
An integer value TNT_QN_IN, TNT_QN_OUT or 0.
Parameters
 A Node to get quantum number information from. legA Leg to get quantum number information from.

Definition at line 295 of file tntNodeInfo.c.

References tntIntArrayFree().

Referenced by tntMpsMpoMpsInit(), tntMpsMpoMpsInitOrth(), and tntMpsSelfInit().

 tntComplexArray tntNodeGetMatrix ( tntNode A, tntLegLabel rowlegs, tntLegLabel collegs )

Gets all the values of a matrix formed by reshaping the tensor corresponding to the node $$A$$. The legs that are assigned to each of the dimensions of the matrix are given as arguments, where the first leg corresponds to the fastest moving index. The values returned are in complex format even if the tensor values are purely real. The values are returned in an array of type ::tntComplexArray which should be freed using tntComplexArrayFree() when no longer required.

Returns
A complex array containing the elements of the reshaped tensor that represents the node $$A$$.
Parameters
 A Node to get the trace of rowlegs List of legs making up the rows of the matrix collegs List of legs making up the columns of the matrix
Examples:
create_nodes.c.

Definition at line 178 of file tntNodeInfo.c.

 double tntNodeGetNorm ( tntNode A )

Calculates the norm of the node $$A$$ defined as the square root as the squared sum of all the tensor values i.e. the Euclidean norm of the vector forming the array of all tensor elements.

Returns
The norm of the node.

Definition at line 554 of file tntNodeInfo.c.

Referenced by tntMpsCreateSymmRandom().

 tntComplex tntNodeGetTrace ( tntNode A, tntLegLabel rowlegs, tntLegLabel collegs )

Gets the trace of a matrix formed by reshaping the tensor corresponding to the node $$A$$. The legs that are assigned to each of the dimensions of the matrix are given as arguments, where the first leg corresponds to the fastest moving index. The resulting matrix must be square, and if it is not the function exits with an error. The value returned is in complex format even if the tensor values are purely real.

tntNodeContractSelf() can take the partial (or full) trace of a tensor by contracting over a subset (or all) legs of the Nodes. Noet that tntNodeContractSelf() alters the original Nodes whereas tntNodeGetTrace() leaves the Nodes unchanged.
Returns
The trace of the reshaped tensor that represents the node $$A$$.
Parameters
 A Node to get the trace of rowlegs List of legs making up the rows of the matrix collegs List of legs making up the columns of the matrix

Definition at line 110 of file tntNodeInfo.c.

 unsigned tntNodeIsCovariant ( tntNode A )

Checks whether the node $$A$$ is covariant under the system type set i.e. whether quantum numbers have been assigned to all the indices, and whether the elements are being stored in blocked form.

Returns
1 if the node is a covariant node, 0 if the node there is no or incomplete symmetry information set for the node.

Definition at line 535 of file tntNodeInfo.c.

Referenced by tntMpsCreateProductMpo(), tntMpsNodeProduct(), and tntMpsOpGetQN().

 unsigned tntNodeIsFunctional ( tntNode A )

Checks whether the node $$A$$ is a functional node or a static node.

Returns
The number of parameters if the node is a functional node, 0 if the node is a static node.

Definition at line 521 of file tntNodeInfo.c.

 void tntNodePrintAll ( tntNode A )

Prints information about the node $$A$$, as well as the values. To print information only use tntNodePrintAll() or to have the values reshaped to your choosing, use tntNodePrintAsMatrix();

Examples:
create_nodes.c.

Definition at line 354 of file tntNodeInfo.c.

References systype, tntComplexArrayFree(), tntDoubleArrayFree(), and tntIntArrayFree().

 void tntNodePrintAsMatrix ( tntNode A, tntLegLabel rowlegs, tntLegLabel collegs )

Prints a node with any number of legs as a matrix. The legs that are assigned to each of the dimensions of the matrix are given as arguments, where the first leg corresponds to the fastest moving index.

Parameters
 A Node to print. rowlegs List of legs making up the rows of the matrix collegs List of legs making up the columns of the matrix

Definition at line 209 of file tntNodeInfo.c.

 void tntNodePrintInfo ( tntNode A )

Prints information about the node $$A$$, but not the values. To print the matrix values too, use tntNodePrintAll() or tntNodePrintAsMatrix();

Parameters
 A The node to print information for.

Definition at line 347 of file tntNodeInfo.c.