Tensor Network Theory Library  Beta release 1.2.0
A library of routines for performing TNT-based operations
 All Data Structures Functions Variables Groups Pages
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
AThe first node to add and that will contain the result of the addition.
legAThe 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
AThe node to fuse
fuseLegsThe legs to fuse
newLabelAThe label for the fused leg
newLabelBThe 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
IThe node to insert
legIAThe leg of I that will connect to A
legIBthe leg of I that will connect to B
AThe node A
legAthe leg of A that will connect to I
BThe node B
legBthe 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
IThe node to insert
legIlastthe leg of I that will connect to what was previously connected to the end of the network
legInwendThe leg of I that will connect to the end of the network
nwThe network that the node will be inserted in

Definition at line 252 of file tntNodeConn.c.

Referenced by tntMpsAdd(), tntMpsCreateConfig(), tntMpsCreateMpo(), tntMpsCreateSymmRandom(), tntMpsMpoMpsInit(), tntMpsMpoMpsInitOrth(), tntMpsPropArrayToST2sc(), tntMpsSelfInit(), and tntMpsVarMinMpo2sBuild().

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
IThe node to insert
legInwstartThe leg of I that will connect to the start of the network
legIfirstthe leg of I that will connect to what was previously connected to the start of the network
nwThe network that the node will be inserted in

Definition at line 213 of file tntNodeConn.c.

Referenced by tntMpsCreateEyeMpo(), tntMpsCreateMpo(), tntMpsCreateRandom(), tntMpsMpoContract(), tntMpsMpoMpsInit(), tntMpsMpoMpsInitOrth(), tntMpsPropArrayToST2sc(), tntMpsSelfInit(), and tntMpsVarMinMpo2sBuild().

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
AThe first node to join
legAThe leg of the first node to join to the second node
BThe second node to join
legBThe leg of the second node to joing to the first node

Definition at line 52 of file tntNodeConn.c.

Referenced by tntDmrgLocalOps(), tntMpoMpoProduct(), tntMpoMpoTrace(), tntMpoPmpoProduct(), tntMpoPropST2scConnect(), tntMpoTrace(), tntMpsCreateBosonOp(), tntMpsMpoConnect(), tntMpsMpoContract(), tntMpsMpoMpsConnect(), tntMpsMpoMpsInit(), tntMpsMpoMpsInitOrth(), tntMpsMpoMpsPartProduct(), tntMpsMpsConnect(), tntMpsMpsContract(), tntMpsPmpoProduct(), tntMpsProcessExpecOptions(), tntMpsPropArrayToST2sc(), tntMpsPropST2scConnect(), tntMpsSelfInit(), tntMpsVarMinMpo2sBuild(), and tntMpsVarMinMpoUpdate().

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
ANode to change leg ids of
legmapMap for the leg labels that will change e.g. "abc=ABC"

Definition at line 125 of file tntNodeConn.c.

Referenced by tntMpoHC(), tntMpoPropST2scConnect(), tntMpoPropTwoSite(), tntMpsCreateBosonOp(), tntMpsMpoContract(), tntMpsMpsConnect(), and tntMpsNodeNodeMpsProduct().

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
AThe node to remove.
connLegsOptional. 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
AOriginal node in network to be replaced
BNode 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
ANode A to split from node B
BNode 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
AThe node to remove legs from
squeezeLegsA list of the legs to remove

Definition at line 292 of file tntNodeConn.c.

Referenced by tntMpsVarMinMpo2sContract().