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<atype>, NDIM> &imnorm, atype coeff) {
69 nchm_staplesums(U, stout);
72 T tM = (U[d][X] * stout[d][X]).project_to_algebra_scaled(-coeff).expand();
73 imnorm[d][X] = tM.norm();
74 stout[d][X] =
altexp(tM, niter[d][X]) * U[d][X];
80template <
typename T,
typename atype = hila::arithmetic_type<T>>
83 out_only std::array<
Field<int>, NDIM> &niter, atype coeff) {
84 nchm_staplesums(U, stap);
87 stout[d][X] =
altexp((U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand(),
95template <
typename T,
typename atype = hila::arithmetic_type<T>>
98 out_only std::vector<std::array<
Field<int>, NDIM>> &niterlist, atype coeff) {
102 for (
int i = 1; i < stoutlist.size(); ++i) {
103 nchm_stout_smear1(stoutlist[i - 1], stoutlist[i], staplist[i - 1], niterlist[i - 1], coeff);
108template <
typename T,
typename atype = hila::arithmetic_type<T>>
111 out_only std::array<
Field<atype>, NDIM> &imnorm, atype coeff) {
112 nchm_staplesums(U, stap);
115 T tM = (U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand();
116 imnorm[d][X] = tM.norm();
117 stout[d][X] =
altexp(tM, niter[d][X]) * U[d][X];
122template <
typename T,
typename atype = hila::arithmetic_type<T>>
125 out_only std::vector<std::array<
Field<int>, NDIM>> &niterlist,
126 out_only std::vector<std::array<
Field<atype>, NDIM>> &imnormlist, atype coeff) {
130 for (
int i = 1; i < stoutlist.size(); ++i) {
131 nchm_stout_smear1(stoutlist[i - 1], stoutlist[i], staplist[i - 1], niterlist[i - 1],
132 imnormlist[i - 1], coeff);
137template <
typename T,
typename atype = hila::arithmetic_type<T>>
139 nchm_staplesums(U, stout);
143 altexp((U[d][X] * stout[d][X]).project_to_algebra_scaled(-coeff).expand()) *
149template <
typename T,
typename atype = hila::arithmetic_type<T>>
152 nchm_staplesums(U, stap);
156 altexp((U[d][X] * stap[d][X]).project_to_algebra_scaled(-coeff).expand()) * U[d][X];
161template <
typename T,
typename atype = hila::arithmetic_type<T>>
166 for (
int i = 0; i < iter / 2; ++i) {
167 nchm_stout_smear1(stout, tmp, coeff);
168 nchm_stout_smear1(tmp, stout, coeff);
172 for (
int i = 0; i < iter / 2; ++i) {
173 nchm_stout_smear1(tmp, stout, coeff);
174 nchm_stout_smear1(stout, tmp, coeff);
176 nchm_stout_smear1(tmp, stout, coeff);
180template <
typename T,
typename atype = hila::arithmetic_type<T>>
182 std::vector<std::array<
Field<int>, NDIM>> &niterlist, atype coeff) {
184 int iter = niterlist.size();
187 for (
int i = 0; i < iter / 2; ++i) {
188 nchm_stout_smear1(stout, tmp, niterlist[2 * i], coeff);
189 nchm_stout_smear1(tmp, stout, niterlist[2 * i + 1], coeff);
193 for (
int i = 0; i < iter / 2; ++i) {
194 nchm_stout_smear1(tmp, stout, niterlist[2 * i], coeff);
195 nchm_stout_smear1(stout, tmp, niterlist[2 * i + 1], coeff);
197 nchm_stout_smear1(tmp, stout, niterlist[iter - 1], coeff);
201template <
typename T,
typename atype = hila::arithmetic_type<T>>
203 std::vector<std::array<
Field<int>, NDIM>> &niterlist,
204 std::vector<std::array<
Field<atype>, NDIM>> &imnormlist,
207 int iter = niterlist.size();
210 for (
int i = 0; i < iter / 2; ++i) {
211 nchm_stout_smear1(stout, tmp, niterlist[2 * i], imnormlist[2 * i], coeff);
212 nchm_stout_smear1(tmp, stout, niterlist[2 * i + 1], imnormlist[2 * i + 1], coeff);
216 for (
int i = 0; i < iter / 2; ++i) {
217 nchm_stout_smear1(tmp, stout, niterlist[2 * i], imnormlist[2 * i], coeff);
218 nchm_stout_smear1(stout, tmp, niterlist[2 * i + 1], imnormlist[2 * i + 1], coeff);
220 nchm_stout_smear1(tmp, stout, niterlist[iter - 1], imnormlist[iter -1 ], coeff);
225template <
typename T,
int N = T::rows(),
int NSTP = 2 * (NDIM - 1),
226 typename atype = hila::arithmetic_type<T>>
227void nchm_stout_smear_force(
const std::vector<
GaugeField<T>> &stoutlist,
230 std::vector<std::array<
Field<int>, NDIM>> &niterlist, atype coeff) {
242 for (
int i = stoutlist.size() - 2; i >= 0; --i) {
246 const std::array<Field<int>, NDIM> &niter = niterlist[i];
258 T tplaqs = U[d1][X] * staps[d1][X];
265 mult_exp(tplaqs.project_to_algebra_scaled(-coeff).expand(),
266 U[d1][X] * U0[d1][X].dagger() * KS[d1][X].expand(), mtexp, mdtexp, niter[d1][X]);
270 K1[d1][X] = mdtexp.project_to_algebra_scaled(coeff).expand();
274 KS[d1][X] = (mtexp - tplaqs * K1[d1][X]).project_to_algebra();
277 K1[d1][X] *= U[d1][X];
287 U4 = U[d2][X].dagger();
289 tM1 = U2 * U[d1][X + d2].dagger();
290 K21[X] = U4 * K1[d1][X] * tM1;
292 K22[X] = tM1 * K1[d1][X];
293 K24[X] = K1[d1][X] * tM1;
295 tM1 = U2 * K1[d1][X + d2].
dagger() * U4;
296 K23[X] = U[d1][X] * tM1;
297 K22[X] += tM1 * U[d1][X];
303 KS[d2][X] -= (K22[X - d1] - K24[X]).project_to_algebra();
304 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.