3#ifndef WILSON_LINE_AND_FORCE_H_
4#define WILSON_LINE_AND_FORCE_H_
11template <
typename group>
12void get_wilson_line(
const GaugeField<group> &U,
const std::vector<Direction> &path,
17 int udirs[
NDIRS] = {0};
19 for (i = 0; i < L; ++i) {
22 if ((udirs[(
int)dir]++) == 0) {
23 U[dir].start_gather(-dir,
ALL);
36 onsites(
ALL) R0[ip][X] = U[dir][X - dir];
39 onsites(
ALL) R0[ip][X] = U[-dir][X].dagger();
44 for (i = 1; i < L - 1; ++i) {
49 onsites(
ALL)
mult(R0[ip][X - dir], U[dir][X - dir], R0[1 - ip][X]);
52 onsites(
ALL)
mult(R0[ip][X - dir], U[-dir][X].
dagger(), R0[1 - ip][X]);
62 onsites(
ALL)
mult(R0[ip][X - dir], U[dir][X - dir], R[X]);
65 onsites(
ALL)
mult(R0[ip][X - dir], U[-dir][X].
dagger(), R[X]);
69template <
typename group,
typename atype = hila::arithmetic_type<group>>
70void get_wloop_force_from_wl_add(
const GaugeField<group> &U,
const std::vector<Direction> &path,
77 int udirs[
NDIRS] = {0};
79 for (
int i = 0; i < L; ++i) {
82 if ((udirs[(
int)dir]++) == 0) {
83 U[dir].start_gather(-dir,
ALL);
88 for (
int i = 0; i < L; ++i) {
93 onsites(
ALL) K[dir][X] -= R[X].project_to_algebra_scaled(eps);
95 onsites(
ALL)
mult(U[dir][X - dir].
dagger(), R[X - dir], R0[X]);
96 onsites(
ALL)
mult(R0[X], U[dir][X - dir], R[X]);
99 onsites(
ALL)
mult(U[-dir][X], R[X - dir], R0[X]);
102 onsites(
ALL) K[-dir][X] += R[X].project_to_algebra_scaled(eps);
107template <
typename group,
typename atype = hila::arithmetic_type<group>>
108void get_wloop_force_from_wl(
const GaugeField<group> &U,
const std::vector<Direction> &path,
116 get_wloop_froce_add(U, path, W, eps, K);
119template <
typename group,
typename atype = hila::arithmetic_type<group>>
120void get_wloop_force_add(
const GaugeField<group> &U,
const std::vector<Direction> &path, atype eps,
125 get_wilson_line(U, path, R);
128 int udirs[
NDIRS] = {0};
129 for (
int i = 0; i < L; ++i) {
131 if (is_up_dir(dir)) {
132 if ((udirs[(
int)dir]++) == 0) {
133 U[dir].start_gather(-dir,
ALL);
138 for (
int i = 0; i < L; ++i) {
141 if (is_up_dir(dir)) {
143 onsites(
ALL) K[dir][X] -= R[X].project_to_algebra_scaled(eps);
145 onsites(
ALL)
mult(U[dir][X - dir].
dagger(), R[X - dir], R0[X]);
146 onsites(
ALL)
mult(R0[X], U[dir][X - dir], R[X]);
149 onsites(
ALL)
mult(U[-dir][X], R[X - dir], R0[X]);
152 onsites(
ALL) K[-dir][X] += R[X].project_to_algebra_scaled(eps);
157template <
typename group,
typename atype = hila::arithmetic_type<group>>
158void get_wloop_force(
const GaugeField<group> &U,
const std::vector<Direction> &path, atype eps,
164 get_wloop_froce_add(U, path, eps, K);
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
dir_mask_t start_gather(Direction d, Parity p=ALL) const
Complex< T > dagger(const Complex< T > &val)
Return dagger of Complex number.
#define foralldir(d)
Macro to loop over (all) Direction(s)
constexpr unsigned NDIRS
Number of directions.
Direction
Enumerator for direction that assigns integer to direction to be interpreted as unit vector.
constexpr Parity ALL
bit pattern: 011
void mult(const Mt1 &a, const Mt2 &b, Mt3 &res)
compute product of two matrices and write result to existing matrix