1#ifndef STOUT_SMEAR_NCHM_H_
2#define STOUT_SMEAR_NCHM_H_
28 U[d2].start_gather(d1,
ALL);
30 onsites(
ALL) staples[d1][X] = 0;
36 mult_aa(U[d1][X], U[d2][X + d1], tF1[X]);
38 mult(tF1[X], U[d2][X], lw1[X]);
45 mult_add(U[d1][X + d2], tF1[X], staples[d2][X]);
48 staples[d1][X] += lw1[X - d2];
53template <
typename T,
typename atype = hila::arithmetic_type<T>>
55 out_only std::array<
Field<int>, NDIM> &niter, atype coeff) {
56 nchm_staplesums(U, stout);
59 stout[d][X] =
altexp((U[d][X] * stout[d][X]).project_to_algebra_scaled(-coeff).expand(),
60 niter[d][X]) * U[d][X];
65template <
typename T,
typename atype = hila::arithmetic_type<T>>
68 out_only std::array<
Field<int>, NDIM> &niter, atype coeff) {
69 nchm_staplesums(U, stap);
72 stout[d][X] =
altexp((U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand(),
79template <
typename T,
typename atype = hila::arithmetic_type<T>>
82 out_only std::vector<std::array<
Field<int>, NDIM>> &niterlist, atype coeff) {
86 for (
int i = 1; i < stoutlist.size(); ++i) {
87 nchm_stout_smear1(stoutlist[i - 1], stoutlist[i], staplist[i - 1], niterlist[i - 1], coeff);
91template <
typename T,
typename atype = hila::arithmetic_type<T>>
93 nchm_staplesums(U, stout);
97 altexp((U[d][X] * stout[d][X]).project_to_algebra_scaled(-coeff).expand()) *
103template <
typename T,
typename atype = hila::arithmetic_type<T>>
106 nchm_staplesums(U, stap);
110 altexp((U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand()) * U[d][X];
115template <
typename T,
typename atype = hila::arithmetic_type<T>>
120 for (
int i = 0; i < iter / 2; ++i) {
121 nchm_stout_smear1(stout, tmp, coeff);
122 nchm_stout_smear1(tmp, stout, coeff);
126 for (
int i = 0; i < iter / 2; ++i) {
127 nchm_stout_smear1(tmp, stout, coeff);
128 nchm_stout_smear1(stout, tmp, coeff);
130 nchm_stout_smear1(tmp, stout, coeff);
134template <
typename T,
typename atype = hila::arithmetic_type<T>>
136 std::vector<std::array<
Field<int>, NDIM>> &niterlist, atype coeff) {
138 int iter = niterlist.size();
141 for (
int i = 0; i < iter / 2; ++i) {
142 nchm_stout_smear1(stout, tmp, niterlist[2 * i], coeff);
143 nchm_stout_smear1(tmp, stout, niterlist[2 * i + 1], coeff);
147 for (
int i = 0; i < iter / 2; ++i) {
148 nchm_stout_smear1(tmp, stout, niterlist[2 * i], coeff);
149 nchm_stout_smear1(stout, tmp, niterlist[2 * i + 1], coeff);
151 nchm_stout_smear1(tmp, stout, niterlist[iter - 1], coeff);
156template <
typename T,
int N = T::rows(),
int NSTP = 2 * (NDIM - 1),
157 typename atype = hila::arithmetic_type<T>>
158void nchm_stout_smear_force(
const std::vector<
GaugeField<T>> &stoutlist,
161 std::vector<std::array<
Field<int>, NDIM>> &niterlist, atype coeff) {
173 for (
int i = stoutlist.size() - 2; i >= 0; --i) {
177 const std::array<Field<int>, NDIM> &niter = niterlist[i];
189 T tplaqs = U[d1][X] * staps[d1][X];
196 mult_exp(tplaqs.project_to_algebra_scaled(-coeff).expand(),
197 U[d1][X] * U0[d1][X].dagger() * KS[d1][X].expand(), mtexp, mdtexp, niter[d1][X]);
201 K1[d1][X] = mdtexp.project_to_algebra_scaled(coeff).expand();
205 KS[d1][X] = (mtexp - tplaqs * K1[d1][X]).project_to_algebra();
208 K1[d1][X] *= U[d1][X];
218 U4 = U[d2][X].dagger();
220 tM1 = U2 * U[d1][X + d2].dagger();
221 K21[X] = U4 * K1[d1][X] * tM1;
223 K22[X] = tM1 * K1[d1][X];
224 K24[X] = K1[d1][X] * tM1;
226 tM1 = U2 * K1[d1][X + d2].
dagger() * U4;
227 K23[X] = U[d1][X] * tM1;
228 K22[X] += tM1 * U[d1][X];
234 KS[d2][X] -= (K22[X - d1] - K24[X]).project_to_algebra();
235 KS[d1][X] -= (K23[X] - K21[X - d2]).project_to_algebra();
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_exp(const Matrix_t< n, m, T, MT > &mat, const Matrix_t< n, m, T, MT > &mmat, Matrix_t< n, m, T, MT > &r, Matrix_t< n, m, T, MT > &dr, const int order=20)
Calculate mmat*exp(mat) and trace(mmat*dexp(mat))
void mult_add(const Mt1 &a, const Mt2 &b, Mt3 &res)
compute product of two matrices and add result to existing matrix
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
Matrix_t< n, m, T, MT > altexp(const Matrix_t< n, m, T, MT > &mat, int &niter)
Calculate exp of a square matrix.