27 U[d2].start_gather(d1,
ALL);
29 onsites(
ALL) staples[d1][X] = 0;
35 mult_aa(U[d1][X], U[d2][X + d1], tF1[X]);
37 mult(tF1[X], U[d2][X], lw1[X]);
44 mult_add(U[d1][X + d2], tF1[X], staples[d2][X]);
47 staples[d1][X] += lw1[X - d2];
52template <
typename T,
typename atype = hila::arithmetic_type<T>>
58 chexp((U[d][X] * stout[d][X]).project_to_algebra_scaled(-coeff).expand()) * U[d][X];
63template <
typename T,
typename atype = hila::arithmetic_type<T>>
69 stout[d][X] =
chexp((U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand()) * U[d][X];
85template <
typename T,
typename atype = hila::arithmetic_type<T>>
90 for (
int i = 0; i < iter / 2; ++i) {
91 stout_smear1(stout, tmp, coeff);
92 stout_smear1(tmp, stout, coeff);
96 for (
int i = 0; i < iter / 2; ++i) {
97 stout_smear1(tmp, stout, coeff);
98 stout_smear1(stout, tmp, coeff);
100 stout_smear1(tmp, stout, coeff);
117template <
typename T,
const int nstap = 2 * (NDIM - 1)>
123 U[d2].start_gather(d1,
ALL);
133 mult_aa(U[d1][X], U[d2][X + d1], tF1[X]);
135 mult(tF1[X], U[d2][X], lw1[X]);
146 mult(U[d1][X + d2], tF1[X], S[rl][d2][X]);
150 S[rk][d1][X] = lw1[X - d2];
157 onsites(
ALL) Ssum[d1][X] = S[0][d1][X];
158 for (k = 1; k < nstap; ++k) {
159 onsites(
ALL) Ssum[d1][X] += S[k][d1][X];
164template <
typename T,
typename atype = hila::arithmetic_type<T>>
170 for (
int i = 1; i < stoutlist.size(); ++i) {
171 stout_smear1(stoutlist[i - 1], stoutlist[i], staplist[i - 1], coeff);
175template <
typename T,
typename atype = hila::arithmetic_type<T>>
176void stout_smear_force(
const std::vector<
GaugeField<T>> &stoutlist,
190 for (
int i = stoutlist.size() - 2; i >= 0; --i) {
205 T tplaqs = U[d1][X] * staps[d1][X];
212 mult_chexp(tplaqs.project_to_algebra_scaled(-coeff).expand(), KS[d1][X].expand(),
217 K1[d1][X] = mdtexp.project_to_algebra_scaled(coeff).expand();
221 KS[d1][X] = (mtexp - tplaqs * K1[d1][X]).project_to_algebra();
224 K1[d1][X] *= U[d1][X];
234 U4 = U[d2][X].dagger();
236 tM1 = U2 * U[d1][X + d2].dagger();
237 K21[X] = U4 * K1[d1][X] * tM1;
239 K22[X] = tM1 * K1[d1][X];
240 K24[X] = K1[d1][X] * tM1;
242 tM1 = U2 * K1[d1][X + d2].
dagger() * U4;
243 K23[X] = U[d1][X] * tM1;
244 K22[X] += tM1 * U[d1][X];
250 KS[d2][X] -= (K22[X - d1] - K24[X]).project_to_algebra();
251 KS[d1][X] -= (K23[X] - K21[X - d2]).project_to_algebra();
257template <
typename T,
typename atype = hila::arithmetic_type<T>>
263 stout[d][X] =
chexpk((U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand(),
264 stoutk[d][X]) * U[d][X];
269template <
typename T,
typename atype = hila::arithmetic_type<T>>
276 for (
int i = 1; i < stoutlist.size(); ++i) {
277 stout_smear1k(stoutlist[i - 1], stoutlist[i], staplist[i - 1], stoutklist[i - 1], coeff);
281template <
typename T,
typename atype = hila::arithmetic_type<T>>
282void stout_smeark_force(
297 for (
int i = stoutlist.size() - 2; i >= 0; --i) {
313 T tplaqs = U[d1][X] * staps[d1][X];
321 U0[d1][X] * U[d1][X].dagger(), dUK[d1][X], KS[d1][X].expand(),
326 K1[d1][X] = mdtexp.project_to_algebra_scaled(coeff).expand();
330 KS[d1][X] = (mtexp - tplaqs * K1[d1][X]).project_to_algebra();
333 K1[d1][X] *= U[d1][X];
359 U4 = U[d2][X].dagger();
361 tM1 = U2 * U[d1][X + d2].dagger();
362 K21[X] = U4 * K1[d1][X] * tM1;
364 K22[X] = tM1 * K1[d1][X];
365 K24[X] = K1[d1][X] * tM1;
367 tM1 = U2 * K1[d1][X + d2].
dagger() * U4;
368 K23[X] = U[d1][X] * tM1;
369 K22[X] += tM1 * U[d1][X];
375 KS[d2][X] -= (K22[X - d1] - K24[X]).project_to_algebra();
376 KS[d1][X] -= (K23[X] - K21[X - d2]).project_to_algebra();
383template <
typename T,
int N = T::rows(),
int NSTP = 2 * (NDIM - 1),
384 typename atype = hila::arithmetic_type<T>>
385void stout_smeark_force_b(
const std::vector<
GaugeField<T>> &stoutlist,
402 for (
int i = stoutlist.size() - 2; i >= 0; --i) {
407 get_stout_staples(U, stapl, staps);
418 T tplaqs = U[d1][X] * staps[d1][X];
426 U0[d1][X] * U[d1][X].dagger(), dUK[d1][X], KS[d1][X].expand(),
431 K1[d1][X] = mdtexp.project_to_algebra_scaled(coeff).expand();
435 KS[d1][X] = (mtexp - tplaqs * K1[d1][X]).project_to_algebra();
438 K1[d1][X] *= U[d1][X];
450 onsites(
ALL) stapl[istp][d1][X] *= K1[d1][X];
451 stapl[istp][d1].start_gather(-d1,
ALL);
452 istn = NSTP - 1 - istp;
453 onsites(
ALL) stapl[istn][d1][X] *= K1[d1][X];
454 stapl[istn][d1].start_gather(-d1,
ALL);
468 staps[d1][X] = stapl[istp][d1][X - d1];
472 std::vector<Direction> pathp = {d2, -d1, -d2};
474 get_wloop_force_from_wl_add(U, pathp, staps[d1], 1.0, KS);
477 istn = NSTP - 1 - istp;
480 staps[d1][X] = stapl[istn][d1][X - d1];
484 std::vector<Direction> pathn = {-d2, -d1, d2};
486 get_wloop_force_from_wl_add(U, pathn, staps[d1], 1.0, KS);
The field class implements the standard methods for accessing Fields. Hilapp replaces the parity acce...
Field< A > dagger() const
Returns dagger or Hermitian conjugate of Field depending on how it is defined for Field type T.
dir_mask_t start_gather(Direction d, Parity p=ALL) const
#define foralldir(d)
Macro to loop over (all) Direction(s)
constexpr Parity ALL
bit pattern: 011
void mult_chexp(const Matrix_t< n, m, T, MT > &mat, const Matrix_t< n, m, T, MT > &mmat, Matrix_t< n, m, T, MT > &omat, Matrix_t< n, m, T, MT > &domat)
Calculate exp(mat).dagger()*mmat*exp(mat) and trace(exp(mat).dagger*mmat*dexp(mat))
int chexp(const Matrix_t< n, m, T, MT > &mat, Matrix_t< n, m, T, MT > &omat, Mt(&pl)[n])
Calculate exp of a square matrix.
void mult_add(const Mt1 &a, const Mt2 &b, Mt3 &res)
compute product of two matrices and add result to existing matrix
void mult_chexpk_fast(const Matrix_t< n, m, T, MT > &mat, const Matrix_t< n, m, T, MT > &texp, const Matrix_t< n, m, T, MT > &kmats, const Matrix_t< n, m, T, MT > &mmat, Matrix_t< n, m, T, MT > &omat, Matrix_t< n, m, T, MT > &domat)
Calculate exp(mat).dagger()*mmat*exp(mat) and trace(exp(mat).dagger*mmat*dexp(mat)) from output of ch...
void chexpk(const Matrix_t< n, m, T, MT > &mat, Matrix_t< n, m, T, MT > &omat, Matrix_t< n, m, T, MT > &kmats)
Calculate exp(mat) and the decomposition k_{i,j} of dexp in terms bilinears of powers of mat.
void mult_aa(const Mt1 &a, const Mt2 &b, Mt3 &res)
compute hermitian conjugate of product of two matrices and write result to existing matrix
void mult(const Mt1 &a, const Mt2 &b, Mt3 &res)
compute product of two matrices and write result to existing matrix