28template <
typename T,
int N>
33 double xr1, xr2, xr3, xr4;
42 double pi2 = M_PI * 2.0;
50 action = U * staple.
dagger();
53 for (
int ina = 0; ina < N - 1; ina++)
54 for (
int inb = ina + 1; inb < N; inb++) {
62 v.d = action.
e(ina, ina).re + action.
e(inb, inb).re;
63 v.c = -(action.
e(ina, ina).im - action.
e(inb, inb).im);
64 v.a = -(action.
e(ina, inb).im + action.
e(inb, ina).im);
65 v.b = -(action.
e(ina, inb).re - action.
e(inb, ina).re);
106 d = -(xr2 + xr1 * xr3 * xr3) / al;
112 if ((1.00 - 0.5 * d) <= xr4 * xr4) {
115 for (k = 0; k < 40 && !test; k++) {
122 xr3 =
cos(pi2 * xr3);
124 d = -(xr2 + xr1 * xr3 * xr3) / al;
125 if ((1.00 - 0.5 * d) > xr4 * xr4)
137 xl =
exp((
double)(-2.0 * al));
141 for (k = 0; k < 40 && test == 0; k++) {
147 a0 = 1.00 +
log((
double)r) / al;
148 if ((1.0 - a0 * a0) > xr2 * xr2)
170 r2 = 1.0 - a.d * a.d;
178 rho = r2 - a.c * a.c;
179 rho =
sqrt(fabs(rho));
183 a.a = rho *
cos((
double)xr2);
184 a.b = rho *
sin((
double)xr2);
190 h2x2 = h.convert_to_2x2_matrix();
201 return (uhit / utry);
Array< n, m, T > exp(Array< n, m, T > a)
Exponential.
Array< n, m, T > cos(Array< n, m, T > a)
Cosine.
Array< n, m, T > sqrt(Array< n, m, T > a)
Square root.
Array< n, m, T > sin(Array< n, m, T > a)
Sine.
Array< n, m, T > log(Array< n, m, T > a)
Logarithm.
void mult_by_2x2_left(int p, int q, const Matrix_t< 2, 2, R, Mt > &M)
Multiply -matrix from the left by matrix defined by sub matrix.
Rtype dagger() const
Hermitian conjugate of matrix.
T e(const int i, const int j) const
Standard array indexing operation for matrices and vectors.
double random()
Real valued uniform random number generator.
double suN_heatbath(SU< N, T > &U, const SU< N, T > &staple, double beta)
heatbath
SU(N) Matrix definitions.