16 #if defined USE_GROUP_SU3
18 #elif defined USE_GROUP_SU2
20 #elif defined USE_GROUP_SU_N
36 const Field_G& U,
const int ex1,
37 const Field_F& x,
const int ex2)
40 assert(ex1 < U.
nex());
41 assert(ex2 < x.
nex());
45 const int Nd = x.
nd();
46 const int Nc = x.
nc();
47 const int Nc2 = x.
nc2();
48 const int Ncd2 = Nc2 * Nd;
49 const int Ndf = Nc2 * Nc;
53 const int Nthread = 1;
54 const int i_thread = 0;
56 const int is = y.
nvol() * i_thread / Nthread;
57 const int ns = y.
nvol() * (i_thread + 1) / Nthread - is;
59 double *v = y.
ptr(0, is, ex);
60 const double *g = U.
ptr(0, is, ex1);
61 const double *w = x.
ptr(0, is, ex2);
63 for (
int site = 0; site < ns; ++site) {
66 for (
int s = 0; s < Nd; ++s) {
67 for (
int ic = 0; ic < Nc; ++ic) {
68 int ig2 = ic * Nc2 + ig;
69 int iv2 = s * Nc2 + iv;
70 v[2 * ic + iv2] = mult_Gn_r(&g[ig2], &w[iv2], Nc);
71 v[2 * ic + 1 + iv2] = mult_Gn_i(&g[ig2], &w[iv2], Nc);
80 const Field_G& U,
const int ex1,
81 const Field_F& x,
const int ex2)
84 assert(ex1 < U.
nex());
85 assert(ex2 < x.
nex());
89 const int Nd = x.
nd();
90 const int Nc = x.
nc();
91 const int Nc2 = x.
nc2();
92 const int Ncd2 = Nc2 * Nd;
93 const int Ndf = Nc2 * Nc;
97 const int Nthread = 1;
98 const int i_thread = 0;
100 const int is = y.
nvol() * i_thread / Nthread;
101 const int ns = y.
nvol() * (i_thread + 1) / Nthread - is;
103 double *v = y.
ptr(0, is, ex);
104 const double *g = U.
ptr(0, is, ex1);
105 const double *w = x.
ptr(0, is, ex2);
107 for (
int site = 0; site < ns; ++site) {
109 int iv = Ncd2 * site;
110 for (
int s = 0; s < Nd; ++s) {
111 for (
int ic = 0; ic < Nc; ++ic) {
112 int ig2 = ic * 2 + ig;
113 int iv2 = s * Nc2 + iv;
114 v[2 * ic + iv2] = mult_Gd_r(&g[ig2], &w[iv2], Nc);
115 v[2 * ic + 1 + iv2] = mult_Gd_i(&g[ig2], &w[iv2], Nc);
124 const Field_G& U,
const int ex1,
125 const Field_F& x,
const int ex2,
128 assert(ex < y.
nex());
129 assert(ex1 < U.
nex());
130 assert(ex2 < x.
nex());
134 const int Nd = x.
nd();
135 const int Nc = x.
nc();
136 const int Nc2 = x.
nc2();
137 const int Ncd2 = Nc2 * Nd;
138 const int Ndf = Nc2 * Nc;
142 const int Nthread = 1;
143 const int i_thread = 0;
145 const int is = y.
nvol() * i_thread / Nthread;
146 const int ns = y.
nvol() * (i_thread + 1) / Nthread - is;
148 double *v = y.
ptr(0, is, ex);
149 const double *g = U.
ptr(0, is, ex1);
150 const double *w = x.
ptr(0, is, ex2);
152 for (
int site = 0; site < ns; ++site) {
154 int iv = Ncd2 * site;
155 for (
int s = 0; s < Nd; ++s) {
156 for (
int ic = 0; ic < Nc; ++ic) {
157 int ig2 = ic * Nc2 + ig;
158 int iv2 = s * Nc2 + iv;
159 v[2 * ic + iv2] += a * mult_Gn_r(&g[ig2], &w[iv2], Nc);
160 v[2 * ic + 1 + iv2] += a * mult_Gn_i(&g[ig2], &w[iv2], Nc);
169 const Field_G& U,
const int ex1,
170 const Field_F& x,
const int ex2,
173 assert(ex < y.
nex());
174 assert(ex1 < U.
nex());
175 assert(ex2 < x.
nex());
179 const int Nd = x.
nd();
180 const int Nc = x.
nc();
181 const int Nc2 = x.
nc2();
182 const int Ncd2 = Nc2 * Nd;
183 const int Ndf = Nc2 * Nc;
187 const int Nthread = 1;
188 const int i_thread = 0;
190 const int is = y.
nvol() * i_thread / Nthread;
191 const int ns = y.
nvol() * (i_thread + 1) / Nthread - is;
193 double *v = y.
ptr(0, is, ex);
194 const double *g = U.
ptr(0, is, ex1);
195 const double *w = x.
ptr(0, is, ex2);
197 for (
int site = 0; site < ns; ++site) {
199 int iv = Ncd2 * site;
200 for (
int s = 0; s < Nd; ++s) {
201 for (
int ic = 0; ic < Nc; ++ic) {
202 int ig2 = ic * 2 + ig;
203 int iv2 = s * Nc2 + iv;
204 v[2 * ic + iv2] += a * mult_Gd_r(&g[ig2], &w[iv2], Nc);
205 v[2 * ic + 1 + iv2] += a * mult_Gd_i(&g[ig2], &w[iv2], Nc);
215 assert(x.
nex() == y.
nex());
218 const int Nd = x.
nd();
219 const int Nc = x.
nc();
220 const int Nc2 = x.
nc2();
221 const int Ncd2 = Nc2 * Nd;
229 for (
int s = 0; s < Nd; ++s) {
234 idc_i[s] = 1 - idc_r[s];
239 const int Nthread = 1;
240 const int i_thread = 0;
242 const int is = y.
nvol() * i_thread / Nthread;
243 const int ns = y.
nvol() * (i_thread + 1) / Nthread - is;
245 const int Nex = y.
nex();
247 for (
int ex = 0; ex < Nex; ++ex) {
248 double *v = y.
ptr(0, is, ex);
249 const double *w = x.
ptr(0, is, ex);
251 for (
int site = 0; site < ns; ++site) {
252 int iv = Ncd2 * site;
254 for (
int s = 0; s < Nd; ++s) {
255 int iv2 = s * Nc2 + iv;
256 int iw2 =
id[s] * Nc2 + iv;
258 for (
int ic = 0; ic < Nc; ++ic) {
259 v[2 * ic + iv2] = gv_r[s] * w[2 * ic + idc_r[s] + iw2];
260 v[2 * ic + 1 + iv2] = gv_i[s] * w[2 * ic + idc_i[s] + iw2];
271 assert(x.
nex() == y.
nex());
274 const int Nd = x.
nd();
275 const int Nc = x.
nc();
276 const int Nc2 = x.
nc2();
277 const int Ncd2 = Nc2 * Nd;
285 for (
int s = 0; s < Nd; ++s) {
290 idc_i[s] = 1 - idc_r[s];
295 const int Nthread = 1;
296 const int i_thread = 0;
298 const int is = y.
nvol() * i_thread / Nthread;
299 const int ns = y.
nvol() * (i_thread + 1) / Nthread - is;
301 const int Nex = y.
nex();
303 for (
int ex = 0; ex < Nex; ++ex) {
304 double *v = y.
ptr(0, is, ex);
305 const double *w = x.
ptr(0, is, ex);
307 for (
int site = 0; site < ns; ++site) {
308 int iv = Ncd2 * site;
310 for (
int s = 0; s < Nd; ++s) {
311 int iv2 = s * Nc2 + iv;
312 int iw2 =
id[s] * Nc2 + iv;
313 for (
int ic = 0; ic < Nc; ++ic) {
314 v[2 * ic + iv2] = gv_r[s] * w[2 * ic + idc_r[s] + iw2];
315 v[2 * ic + 1 + iv2] = gv_i[s] * w[2 * ic + idc_i[s] + iw2];
329 assert(w.
nex() == y.
nex());
336 }
else if (pm == -1) {
340 vout.
crucial(
"Error at %s: wrong pm.\n", __func__);
352 assert(w.
nex() == y.
nex());
358 }
else if (pm == -1) {
362 vout.
crucial(
"Error at %s: wrong pm.\n", __func__);
377 assert(w.
nex() == y.
nex());
384 }
else if (pm == -1) {
388 vout.
crucial(
"Error at %s: wrong pm = %d\n", __func__, pm);
void scal(Field &x, const double a)
scal(x, a): x = a * x
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
const double * ptr(const int jin, const int site, const int jex) const
void check()
check several assumptions for performance implementation.
void mult_GM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication
Wilson-type fermion field.
double value_r(int row) const
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void crucial(const char *format,...)
void multadd_Field_Gn(Field_F &y, const int ex, const Field_G &U, const int ex1, const Field_F &x, const int ex2, const double a)
void mult_Field_Gd(Field_F &y, const int ex, const Field_G &U, const int ex1, const Field_F &x, const int ex2)
void mult_GMproj2(Field_F &y, const int pm, const GammaMatrix &gm, const Field_F &w)
projection with gamma matrix: (1 gamma)
int index_c(int row) const
double value_i(int row) const
void mult_GMproj(Field_F &y, const int pm, const GammaMatrix &gm, const Field_F &w)
projection with gamma matrix: (1 gamma)/2
void mult_Field_Gn(Field_F &y, const int ex, const Field_G &U, const int ex1, const Field_F &x, const int ex2)
void multadd_Field_Gd(Field_F &y, const int ex, const Field_G &U, const int ex1, const Field_F &x, const int ex2, const double a)