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,
115 get_wloop_froce_add(U, path, W, eps, K);
118template <
typename group,
typename atype = hila::arithmetic_type<group>>
119void get_wloop_force_add(
const GaugeField<group> &U,
const std::vector<Direction> &path, atype eps,
124 get_wilson_line(U, path, R);
127 int udirs[
NDIRS] = {0};
128 for (
int i = 0; i < L; ++i) {
130 if (is_up_dir(dir)) {
131 if ((udirs[(
int)dir]++) == 0) {
132 U[dir].start_gather(-dir,
ALL);
137 for (
int i = 0; i < L; ++i) {
140 if (is_up_dir(dir)) {
142 onsites(
ALL) K[dir][X] -= R[X].project_to_algebra_scaled(eps);
144 onsites(
ALL)
mult(U[dir][X - dir].
dagger(), R[X - dir], R0[X]);
145 onsites(
ALL)
mult(R0[X], U[dir][X - dir], R[X]);
148 onsites(
ALL)
mult(U[-dir][X], R[X - dir], R0[X]);
151 onsites(
ALL) K[-dir][X] += R[X].project_to_algebra_scaled(eps);
156template <
typename group,
typename atype = hila::arithmetic_type<group>>
157void get_wloop_force(
const GaugeField<group> &U,
const std::vector<Direction> &path, atype eps,
163 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 Mt &a, const Mt &b, Mt &res)
compute product of two square matrices and write result to existing matrix