Tensor Network Theory Library  Beta release 1.2.1 A library of routines for performing TNT-based operations
tntMpsOrth.c
1 /*
2 Authors: Sarah Al-Assam, Stephen Clark and Dieter Jaksch
3 $LastChangedDate: 2015-11-23 14:39:53 +0000 (Mon, 23 Nov 2015)$
4 (c) University of Oxford 2013
5 */
6
13 /* Include the header for the TNT MPS library */
14 #include "tntMpsInternal.h"
15
16
36 void tntMpsOrth(tntNetwork mps,
37  unsigned orth_centre)
38 {
39
40  double err; /* truncation error from the orthonormalisation - not used as it will be exactly zero. */
41  double trunc_tol; /* current value of the truncation tolerance */
42
43  /* Get the current truncation tolerance */
44  trunc_tol = tntSVDTruncTolGet();
45
46  /* Turn the truncation tolerance off */
47  tntSVDTruncTolSet(-1.0);
48
49  /* Call the routine to truncate, which will now simply orthogonalise since it will perform only untruncated SVDs */
50  err = tntMpsTruncate(mps, orth_centre, -1);
51
52  /* we don't need the error. This line avoids compilation warnings */
53  err = (double) err;
54
55  /* Set the truncation tolerance back to it's initial value. */
56  tntSVDTruncTolSet(trunc_tol);
57
58  return;
59
60 }
61
83 void tntMpsOrthNorm(tntNetwork mps,
84  unsigned orth_centre)
85 {
86
87  double normsq; /* norm squared of MPS */
88  tntNode A; /* Node of the MPS */
89  unsigned m; /* Used for looping through sites */
90
91  /* First orthogonalise */
92  tntMpsOrth(mps,orth_centre);
93
94  /* Find the norm */
95  normsq = tntMpsSelfProduct(mps,orth_centre);
96
97  /* Find the orthogonality centre */
98  A = tntNodeFindFirst(mps);
99  for (m = 0; m < orth_centre; m++) A = tntNodeFindConn(A,"R");
100
101  /* Divide by the square root of the norm */
102  tntNodeScaleReal(A,1.0/sqrt(normsq));
103
104  return;
105 }
double tntMpsTruncate(tntNetwork mps, unsigned orth_centre, int chi)
void tntSVDTruncTolSet(double truncTol)
Definition: tntSys.c:253
double tntMpsSelfProduct(tntNetwork mps, int orth_centre)
Definition: tntMpsMps.c:544
void tntMpsOrthNorm(tntNetwork mps, unsigned orth_centre)
Definition: tntMpsOrth.c:83
double tntSVDTruncTolGet(void)
Definition: tntSys.c:312
tntNode tntNodeFindConn(tntNode A, tntLegLabel legA)
Definition: tntNodeInfo.c:29
tntNode tntNodeFindFirst(tntNetwork nw)
Definition: tntNodeInfo.c:50
void tntNodeScaleReal(tntNode A, double val)
void tntMpsOrth(tntNetwork mps, unsigned orth_centre)
Definition: tntMpsOrth.c:36