![]() |
Tensor Network Theory Library
Beta release 1.2.1
A library of routines for performing TNT-based operations
|
Functions and properties that are concerned with the entire network, where the network can, for example, represent the wave function of a system.
Functions | |
tntNetwork | tntNetworkConjCopy (tntNetwork nw) |
tntNetwork | tntNetworkCopy (tntNetwork nw) |
tntNetwork | tntNetworkCreate (void) |
void | tntNetworkFree (tntNetwork *nwp) |
tntNode | tntNetworkMinSite (tntNode V, tntNetwork *nwMV, unsigned NM, tntNode(*eig_contract)(tntNode, tntNetwork), void(*eig_prep)(tntNode, tntNetwork), tntComplex *eigval) |
tntNetwork | tntNetworkSplit (tntNetwork nw, tntNode tnFirst_1, tntLegLabel leg_start_1, tntNode tnLast_1, tntLegLabel leg_end_1, tntNode tnFirst_2, tntLegLabel leg_start_2, tntNode tnLast_2, tntLegLabel leg_end_2, unsigned numSplit_1, tntNode *tnSplit_1, unsigned numSplit_2, tntNode *tnSplit_2) |
void | tntNetworkToNodeGroup (tntNetwork *nwp, int strip_connections) |
tntNetwork tntNetworkConjCopy | ( | tntNetwork | nw | ) |
Makes a copy of the original network, making a seperate copy of all the nodes and connections between them in the new network, and taking the complex conjugate of all the nodes at the same time. This function works for any network geometry.
nw | Pointer to the original network |
Definition at line 19 of file tntNetwork.c.
Referenced by tntMpoHC(), and tntMpoPropST2scConnect().
tntNetwork tntNetworkCopy | ( | tntNetwork | nw | ) |
Makes a copy of the original network, making a seperate copy of all the nodes and connections between them in the new network. This function works for any network geometry.
nw | Pointer to the original network |
Definition at line 56 of file tntNetwork.c.
Referenced by tntMpoMpoProduct(), tntMpoMpoTrace(), tntMpoPmpoTrace(), tntMpoPropST2scConnect(), tntMpoTrace(), tntMpsMpoConnect(), tntMpsMpoMpsConnect(), tntMpsMpsProduct(), tntMpsPmpoMpsProduct(), tntMpsPropST2scConnect(), tntMpsSelfInit(), tntMpsSelfProduct(), tntMpsVarMinMpo1sContract(), and tntMpsVarMinMpo2sContract().
tntNetwork tntNetworkCreate | ( | void | ) |
Creates a new empty network. New nodes can be added using tntNodeInsertAtStart() or tntNodeInsertAtEnd().
Definition at line 92 of file tntNetwork.c.
Referenced by tntMpsAdd(), tntMpsCreateConfig(), tntMpsCreateEyeMpo(), tntMpsCreateMpo(), tntMpsCreateRandom(), tntMpsCreateSymmRandom(), tntMpsPropArrayToST2sc(), tntMpsVarMinMpo1sBuild(), and tntMpsVarMinMpo2sBuild().
void tntNetworkFree | ( | tntNetwork * | nwp | ) |
Deletes all the nodes (and associated memory) in a network, as well as the network structure itself. After calling this function nw
will no longer refer to a valid network and should not be used again.
nwp | Pointer to network to delete |
Definition at line 118 of file tntNetwork.c.
Referenced by tntDmrg1sLocalOptimise(), tntDmrg2sLocalOps(), tntMpoMpoTrace(), tntMpoPmpoTrace(), tntMpoTrace(), tntMpsMpoMpsContract(), tntMpsMpoMpsInit(), tntMpsMpoMpsInitOrth(), tntMpsMpsContract(), and tntMpsSelfInit().
tntNode tntNetworkMinSite | ( | tntNode | V, |
tntNetwork * | nwMV, | ||
unsigned | NM, | ||
tntNode(*)(tntNode, tntNetwork) | eig_contract, | ||
void(*)(tntNode, tntNetwork) | eig_prep, | ||
tntComplex * | eigval | ||
) |
This function finds smallest eigenvalue and corresponding eigenvector of a matrix \(M\). The matrix \(M\) can be represented by a sum of terms \(M_i\), where each term is given by one of more nodes in the network that are connected to one another i.e. the matrix does not need to be represented by a single node or a single group of nodes. The node \(V\) represents a vector that is multiplied by \(M\) by contracting \(V\) with the remaining nodes in the network nwMV[i]
for each term using the function *eig_contract that is passed as an argument.
V | The node to be minimised - unchanged by the function |
nwMV | Array of networks representing the matrix times vector for each term in the sum for the total matrix. This is unchanged by the function |
NM | The number of terms in the sum for the matrix |
eig_contract | Pointer to the network function that performs the network contraction equivalent to matrix times vector. This network function should return the pointer to the contracted node that is the result of the contraction. The network that is contracted that is passed as an argument should not be freed in the network function. |
eig_prep | Pointer to the network function that prepares the nodes for the the network contraction equivalent to matrix times vector. This function should leave the nodes unchanged apart from a preparation step using tntNodePrepContract(). |
eigval | Pointer to the eigenvalue for this minimisation |
Definition at line 153 of file tntNetwork.c.
Referenced by tntDmrg1sLocalOptimise(), and tntDmrg2sLocalOps().
tntNetwork tntNetworkSplit | ( | tntNetwork | nw, |
tntNode | tnFirst_1, | ||
tntLegLabel | leg_start_1, | ||
tntNode | tnLast_1, | ||
tntLegLabel | leg_end_1, | ||
tntNode | tnFirst_2, | ||
tntLegLabel | leg_start_2, | ||
tntNode | tnLast_2, | ||
tntLegLabel | leg_end_2, | ||
unsigned | numSplit_1, | ||
tntNode * | tnSplit_1, | ||
unsigned | numSplit_2, | ||
tntNode * | tnSplit_2 | ||
) |
Splits a network into two, when the nodes that need to be split, and the new first and last nodes are given as arguments. For example, taking the network below:
To split the network above vertically down the middle you would need to pass as arguments the nodes that need to be split on one side in an array i.e. [B,F] and the nodes that nodes that need to be split on the other side as another array i.e. [C,G]. Any connections between the nodes in the first array with any of the nodes in the second array and vice versa will be removed. Connections between nodes in a single array (e.g. between B and F) will not be removed.
Alternatively to split the network above horizontally you would need to pass as arguments the array [A,B,C,D] for the nodes that need to be split on one side of the network, and the array [E,F,G,H] for the nodes that need to be split on the other side of the network.
The new first and last nodes should also be specified. In the above example it would be sensible to choose A and B as the new first and last node for the first network, and C and D as the new first and last node for the second network, although the choice is up to the user.
For each of the first and last nodes, a leg pointing to the first and last node in the network should be specified. This leg should not currently be connected to anything, and should have dimension 1. If a leg is specified that does not already exist, then it will be created.
The network passed as an argument now refers to the first network. The second network is given as the return value.
All split connections will now point to NULL.
nw | On entry: the network to split. On exit: The first network. |
tnFirst_1 | The node that will be the first node in the first network |
leg_start_1 | The leg of the first node that will point to the start of the first network |
tnLast_1 | The node that will be the last node in the first network |
leg_end_1 | The leg of the last node that will point to the end of the first network |
tnFirst_2 | The node that will be the first node in the second network |
leg_start_2 | The leg of the first node that will point to the start of the second network |
tnLast_2 | The node that will be the last node in the second network |
leg_end_2 | The leg of the second node that will point to the end of the second network |
numSplit_1 | The number of nodes that need to be split on the side of the first network |
tnSplit_1 | Array of length numSplit_1 listing all the nodes that need to be split on one side |
numSplit_2 | The number of nodes that need to be split on the side of the first network |
tnSplit_2 | Array of length numSplit_2 listing all the nodes that need to be split on the other side |
Definition at line 203 of file tntNetwork.c.
Referenced by tntMpsMpsContract().
void tntNetworkToNodeGroup | ( | tntNetwork * | nwp, |
int | strip_connections | ||
) |
Changes a network to a node group i.e. removes the singleton legs which connect to the start and end of the network and deletes the network object. It will also strip the connections of the terminating nodes to the network object if the flag is given. You may choose not to do this if the terminating legs carry quantum number information. This function can be useful when joining two networks together to form a single network. If the network you are changing is not joined to another network, make sure you have a variable assigned to one of the nodes in the network before calling this function (so that you can address nodes in the group once the network has been deleted).
nwp | Pointer to network to change to node group |
strip_connections | Flag to indicate whether to strip connections to terminating node (1) or leave them intact (0) |
Definition at line 268 of file tntNetwork.c.
Referenced by tntMpoMpoProduct(), tntMpoMpoTrace(), tntMpoPropST2scConnect(), tntMpsMpoConnect(), tntMpsPropST2scConnect(), tntMpsVarMinMpo1sContract(), and tntMpsVarMinMpo2sContract().