Tensor Network Theory Library  Beta release 1.2.0 A library of routines for performing TNT-based operations
Changing connections and legs

## Detailed Description

These functions are used to change the legs on a node, or change connections between nodes. The values in the tensor corresponding to the nodes are unchanged.

## Functions

void tntNodeAddLeg (tntNode A, tntLegLabel legA)

void tntNodeFuse (tntNode A, tntLegLabel fuseLegs, tntLegLabel newLabelA, tntLegLabel newLabelB)

void tntNodeInsert (tntNode I, tntLegLabel legIA, tntLegLabel legIB, tntNode A, tntLegLabel legA, tntNode B, tntLegLabel legB)

void tntNodeInsertAtEnd (tntNode I, tntLegLabel legIlast, tntLegLabel legInwend, tntNetwork nw)

void tntNodeInsertAtStart (tntNode I, tntLegLabel legInwstart, tntLegLabel legIfirst, tntNetwork nw)

void tntNodeJoin (tntNode A, tntLegLabel legA, tntNode B, tntLegLabel legB)

void tntNodeMapLegs (tntNode A, tntLegLabel legmap)

void tntNodeRemove (tntNode A, tntLegLabel connLegs)

void tntNodeReplace (tntNode A, tntNode B)

void tntNodeSplit (tntNode A, tntNode B)

void tntNodeSqueeze (tntNode A, tntLegLabel squeezeLegs)

## Function Documentation

 void tntNodeAddLeg ( tntNode A, tntLegLabel legA )

Adds a leg or multiple legs with singleton dimension, and the leg labels given in the arguments, to a node $$A$$. The leg labels must not be the same as any of the labels for the existing legs.

Parameters
 A The first node to add and that will contain the result of the addition. legA The id of the leg to add.

Definition at line 24 of file tntNodeConn.c.

Referenced by tntMpsCreateEyeMpo(), tntMpsMpoMpsPartProduct(), tntMpsOpGetQN(), and tntMpsPropArrayToST2sc().

 void tntNodeFuse ( tntNode A, tntLegLabel fuseLegs, tntLegLabel newLabelA, tntLegLabel newLabelB )

Fuses the specified legs together. The legs must either be all unconnected or all point to the same node. If the legs point to another node, the corresponding legs on the connecting node will also be fused. The final argument is optional give the identities that will be given to the legs connected to the fused leg(s). Pass NULL as the final argument if there is no connected node.

Returns
No return value.
Parameters
 A The node to fuse fuseLegs The legs to fuse newLabelA The label for the fused leg newLabelB The label for legs on the node connnected to the fused leg

Definition at line 90 of file tntNodeConn.c.

Referenced by tntMpoMpoProduct(), and tntMpsMpoContract().

 void tntNodeInsert ( tntNode I, tntLegLabel legIA, tntLegLabel legIB, tntNode A, tntLegLabel legA, tntNode B, tntLegLabel legB )

Inserts a node $$I$$ between node $$A$$ and node $$B$$, where node $$A$$ and node $$B$$ are already connected to each other.

Parameters
 I The node to insert legIA The leg of I that will connect to A legIB the leg of I that will connect to B A The node A legA the leg of A that will connect to I B The node B legB the leg of B that will connect to I

Definition at line 177 of file tntNodeConn.c.

Referenced by tntMpsMpoMpsConnect(), and tntMpsPropArrayToST2sc().

 void tntNodeInsertAtEnd ( tntNode I, tntLegLabel legIlast, tntLegLabel legInwend, tntNetwork nw )

Inserts a node $$I$$ at the end of the network. This is done by replacing the leg connections on the node $$I$$ with connections to the end of the network. Note the original node (not a copy of it) is used.

Parameters
 I The node to insert legIlast the leg of I that will connect to what was previously connected to the end of the network legInwend The leg of I that will connect to the end of the network nw The network that the node will be inserted in

Definition at line 252 of file tntNodeConn.c.

 void tntNodeInsertAtStart ( tntNode I, tntLegLabel legInwstart, tntLegLabel legIfirst, tntNetwork nw )

Inserts a node $$I$$ at the beginning of the network. This is done by replacing the leg connections on the node $$I$$ with connections to the start of the network. Note the original node (not a copy of it) is used.

Parameters
 I The node to insert legInwstart The leg of I that will connect to the start of the network legIfirst the leg of I that will connect to what was previously connected to the start of the network nw The network that the node will be inserted in

Definition at line 213 of file tntNodeConn.c.

 void tntNodeJoin ( tntNode A, tntLegLabel legA, tntNode B, tntLegLabel legB )

Joins one or more legA of node $$A$$ to legB of node $$B$$, where the number of legs of A and B should be equal. This function should only be used if legA and legB are currently not connected to anything. The legs are joined in order i.e. the ith listed leg of node $$A$$ is joined to the ith listed leg of node $$B$$. If they are already connected to something the program will exit with an error.

Parameters
 A The first node to join legA The leg of the first node to join to the second node B The second node to join legB The leg of the second node to joing to the first node

Definition at line 52 of file tntNodeConn.c.

 void tntNodeMapLegs ( tntNode A, tntLegLabel legmap )

Changes the labels of the legs of node $$A$$ using the leg map. The map should be a string descrbing how the legs will be relabelled with original leg labels for renaming listed, then an equals sign, then their new labels in the same order e.g. "abc=ABC" where 'a' should be relabelled as "A", 'b' as "B" and 'c' as "C". Any leg labels not listed keep their original values.

Parameters
 A Node to change leg ids of legmap Map for the leg labels that will change e.g. "abc=ABC"

Definition at line 125 of file tntNodeConn.c.

 void tntNodeRemove ( tntNode A, tntLegLabel connLegs )

Removes the node $$A$$ from the network, setting all the connections on that node to NULL.

The second optional argument leg_conn, indicates what to do with the connections of surrounding nodes in the network. If no argument is given (or NULL or an empty string is passed), then all the connections on surrounding nodes will be unconnected after the node is removed. However, to connect the nodes that were previously connected on legs $$l_i$$ and $$l_j$$ of $$A$$, then these labels should be passed in the string. Each pair of nodes connected to original leg labels listed will be paired together. E.g. see the example below, where two pairs of nodes are connected to each other once the connections to $$A$$ have been removed, whilst one node is left unconnected.

Note
The node is not deleted, so if it is no longer required call tntNodeFree() afterwards.
Parameters
 A The node to remove. connLegs Optional. Describes how nodes which were connected to $$A$$ will connect to one another after it has been removed.

Definition at line 324 of file tntNodeConn.c.

 void tntNodeReplace ( tntNode A, tntNode B )

Takes all nodes connected to $$A$$ and connects them to $$B$$ instead, i.e. replaces $$A$$ in a network with $$B$$. This function requires that $$A$$ and $$B$$ have the same number of legs, and the same leg labels. It also requires that $$B$$ is not currently connected to anything.

When replacing connections, the node that was previously connected to the leg with a given number label on $$A$$ then connects to the leg with the same label on $$B$$.

Parameters
 A Original node in network to be replaced B Node to replace the original node with

Definition at line 145 of file tntNodeConn.c.

Referenced by tntDmrgLocalOps(), and tntMpsVarMinMpo2sContract().

 void tntNodeSplit ( tntNode A, tntNode B )

Removes all connections between node $$A$$ and node $$B$$. If there are no connections between node $$A$$ and node $$B$$ no action is taken, and no error is returned.

Parameters
 A Node A to split from node B B Node B to split from node A

Definition at line 161 of file tntNodeConn.c.

Referenced by tntMpsMpoContract().

 void tntNodeSqueeze ( tntNode A, tntLegLabel squeezeLegs )

Removes the specified legs from the node $$A$$, but only if the legs are not connected to anything and have dimension 1. In any other case the function will cause an error.

If removing the legs will change the symmetry properties of the node (i.e. if they are not assigned a quantum number of zero) then the symmetry information will be removed from the node and it will be turned back into the full format.

Parameters
 A The node to remove legs from squeezeLegs A list of the legs to remove

Definition at line 292 of file tntNodeConn.c.

Referenced by tntMpsVarMinMpo2sContract().