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
tntMpsCreateEyeMpo.c
1 /*
2 Authors: Sarah Al-Assam, Stephen Clark and Dieter Jaksch
3 $LastChangedDate$
4 (c) University of Oxford 2014
5 */
6 
7 /* Include the internal header for the TNT library */
8 #include "tntMpsInternal.h"
9 
19 tntNetwork tntMpsCreateEyeMpo(unsigned L,
20  tntNode basisOp)
22 {
23  tntNetwork mponw; /* Network representing the MPO */
24  tntNode eye; /* Idendity node */
25  unsigned i; /* Loop counter */
26 
27  /* Create the empty network that will contain all the MPOs and that will be returned by the function. */
28  mponw = tntNetworkCreate();
29 
30  /* Create the identity node */
31  eye = tntNodeCreateEyeOp(basisOp);
32 
33  /* Add singleton internal legs */
34  tntNodeAddLeg(eye,"L");
35  tntNodeAddLeg(eye,"R");
36 
37  /* Insert L copies of the identity operator in the network */
38  for (i = 0; i < L; i++) {
39  tntNodeInsertAtStart(tntNodeCopy(eye),"L","R",mponw);
40  }
41 
42  /* Free the original copy of the identity operator */
43  tntNodeFree(&eye);
44 
45  /* Return the MPO network */
46  return mponw;
47 }
tntNode tntNodeCopy(tntNode A)
Definition: tntNodeUtil.c:304
tntNetwork tntNetworkCreate(void)
Definition: tntNetwork.c:92
tntNode tntNodeCreateEyeOp(tntNode A)
Definition: tntNodeUtil.c:195
void tntNodeFree(tntNode *A)
Definition: tntNodeUtil.c:275
void tntNodeAddLeg(tntNode A, tntLegLabel legA)
Definition: tntNodeConn.c:24
void tntNodeInsertAtStart(tntNode I, tntLegLabel legInwstart, tntLegLabel legIfirst, tntNetwork nw)
Definition: tntNodeConn.c:213
tntNetwork tntMpsCreateEyeMpo(unsigned L, tntNode basisOp)