Bridge++  Ver. 1.2.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_CloverTerm_eo.cpp
Go to the documentation of this file.
1 
14 #include "fopr_CloverTerm_eo.h"
15 
16 #include "threadManager_OpenMP.h"
17 #include "solver_CG.h"
18 
19 #ifdef USE_PARAMETERS_FACTORY
20 #include "parameters_factory.h"
21 #endif
22 
23 using std::valarray;
24 
25 #if defined USE_GROUP_SU3
26 #include "fopr_Wilson_impl_SU3.inc"
27 #elif defined USE_GROUP_SU2
28 #include "fopr_Wilson_impl_SU2.inc"
29 #elif defined USE_GROUP_SU_N
30 #include "fopr_Wilson_impl_SU_N.inc"
31 #endif
32 
33 //====================================================================
34 //- parameter entry
35 namespace {
36  void append_entry(Parameters& param)
37  {
38  param.Register_double("hopping_parameter", 0.0);
39  param.Register_double("clover_coefficient", 0.0);
40  param.Register_int_vector("boundary_condition", std::valarray<int>());
41 
42  param.Register_string("verbose_level", "NULL");
43  }
44 
45 
46 #ifdef USE_PARAMETERS_FACTORY
47  bool init_param = ParametersFactory::Register("Fopr.CloverTerm_eo",
48  append_entry);
49 #endif
50 }
51 //- end
52 
53 //- parameters class
55 { append_entry(*this); }
56 //- end
57 
58 const std::string Fopr_CloverTerm_eo::class_name = "Fopr_CloverTerm_eo";
59 
60 //====================================================================
61 void Fopr_CloverTerm_eo::init(std::string repr)
62 {
63  m_repr = repr;
64 
68  m_NinF = 2 * m_Nc * m_Nd;
70  m_Nvol2 = m_Nvol / 2;
71 
72  m_boundary.resize(m_Ndim);
73 
74  m_Ueo = 0;
75 
76  m_GM.resize(m_Ndim + 1);
77  m_SG.resize(m_Ndim * m_Ndim);
78 
79  GammaMatrixSet *gmset = GammaMatrixSet::New(m_repr);
80 
81  m_GM[0] = gmset->get_GM(gmset->GAMMA1);
82  m_GM[1] = gmset->get_GM(gmset->GAMMA2);
83  m_GM[2] = gmset->get_GM(gmset->GAMMA3);
84  m_GM[3] = gmset->get_GM(gmset->GAMMA4);
85  m_GM[4] = gmset->get_GM(gmset->GAMMA5);
86 
87  m_SG[sg_index(0, 1)] = gmset->get_GM(gmset->SIGMA12);
88  m_SG[sg_index(1, 2)] = gmset->get_GM(gmset->SIGMA23);
89  m_SG[sg_index(2, 0)] = gmset->get_GM(gmset->SIGMA31);
90  m_SG[sg_index(3, 0)] = gmset->get_GM(gmset->SIGMA41);
91  m_SG[sg_index(3, 1)] = gmset->get_GM(gmset->SIGMA42);
92  m_SG[sg_index(3, 2)] = gmset->get_GM(gmset->SIGMA43);
93 
94  m_SG[sg_index(1, 0)] = m_SG[sg_index(0, 1)].mult(-1);
95  m_SG[sg_index(2, 1)] = m_SG[sg_index(1, 2)].mult(-1);
96  m_SG[sg_index(0, 2)] = m_SG[sg_index(2, 0)].mult(-1);
97  m_SG[sg_index(0, 3)] = m_SG[sg_index(3, 0)].mult(-1);
98  m_SG[sg_index(1, 3)] = m_SG[sg_index(3, 1)].mult(-1);
99  m_SG[sg_index(2, 3)] = m_SG[sg_index(3, 2)].mult(-1);
100 
101  m_SG[sg_index(0, 0)] = gmset->get_GM(gmset->UNITY);
102  m_SG[sg_index(1, 1)] = gmset->get_GM(gmset->UNITY);
103  m_SG[sg_index(2, 2)] = gmset->get_GM(gmset->UNITY);
104  m_SG[sg_index(3, 3)] = gmset->get_GM(gmset->UNITY);
105  // these 4 gamma matrices are actually not used.
106 
107  delete gmset;
108 
109  m_fee_inv = new Field_F(m_Nvol2, m_Nc * m_Nd);
110  m_foo_inv = new Field_F(m_Nvol2, m_Nc * m_Nd);
111 
112  m_vf.reset(m_Nvol2, 1);
113  m_ff.reset(m_Nvol2, 1);
114 }
115 
116 
117 //====================================================================
119 {
120  delete m_foo_inv;
121  delete m_fee_inv;
122 }
123 
124 
125 //====================================================================
127 {
128  const string str_vlevel = params.get_string("verbose_level");
129 
130  m_vl = vout.set_verbose_level(str_vlevel);
131 
132  //- fetch and check input parameters
133  double kappa, cSW;
134  valarray<int> bc;
135 
136  int err = 0;
137  err += params.fetch_double("hopping_parameter", kappa);
138  err += params.fetch_double("clover_coefficient", cSW);
139  err += params.fetch_int_vector("boundary_condition", bc);
140 
141  if (err) {
142  vout.crucial(m_vl, "%s: fetch error, input parameter not found.\n", class_name.c_str());
143  abort();
144  }
145 
146  set_parameters(kappa, cSW, bc);
147 }
148 
149 
150 //====================================================================
151 void Fopr_CloverTerm_eo::set_parameters(const double kappa, const double cSW,
152  const std::valarray<int> bc)
153 {
154  //- print input parameters
155  vout.general(m_vl, "Parameters of %s:\n", class_name.c_str());
156  vout.general(m_vl, " kappa = %8.4f\n", kappa);
157  vout.general(m_vl, " cSW = %8.4f\n", cSW);
158  for (int mu = 0; mu < m_Ndim; ++mu) {
159  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
160  }
161 
162  //- range check
163  // NB. kappa,cSW == 0 is allowed.
164  assert(bc.size() == m_Ndim);
165 
166  //- store values
167  m_kappa = kappa;
168  m_cSW = cSW;
169  assert(bc.size() == m_Ndim);
170  for (int mu = 0; mu < m_Ndim; ++mu) {
171  m_boundary[mu] = bc[mu];
172  }
173 }
174 
175 
176 //====================================================================
178 {
179  m_Ueo = (Field_G *)Ueo;
180 
181  set_csw();
182  solve_csw_inv();
183 }
184 
185 
186 //====================================================================
188 {
189  double eps2 = CommonParameters::epsilon_criterion2();
190 
191  Parameters *params_solver = ParametersFactory::New("Solver");
192 
193  params_solver->set_string("solver_type", "CG");
194  params_solver->set_int("maximum_number_of_iteration", 1000);
195  params_solver->set_double("convergence_criterion_squared", 1.0e-30);
196  //- NB. set VerboseLevel to CRUCIAL to suppress frequent messages.
197  params_solver->set_string("verbose_level", "Crucial");
198 
199  int Nconv;
200  double diff;
201 
202  Solver *solver = new Solver_CG(this);
203  solver->set_parameters(*params_solver);
204 
205  Field_F w(m_Nvol2);
206  Field_F w2(m_Nvol2);
207 
208  for (int ispin = 0; ispin < m_Nd; ++ispin) {
209  for (int icolor = 0; icolor < m_Nc; ++icolor) {
210  int spin_color = icolor + m_Nc * ispin;
211  w = 0.0;
212  for (int isite = 0; isite < m_Nvol2; ++isite) {
213  w.set_ri(icolor, ispin, isite, 0, 1, 0);
214  }
215 
216  if (m_cSW * m_cSW < eps2) {
217  m_fee_inv->setpart_ex(spin_color, w, 0);
218  m_foo_inv->setpart_ex(spin_color, w, 0);
219  } else {
220  set_mode("even");
221  solver->solve(w2, w, Nconv, diff);
222  m_fee_inv->setpart_ex(spin_color, w2, 0);
223  vout.detailed(m_vl, " Nconv,diff = %d %12.4e\n", Nconv, diff);
224 
225  set_mode("odd");
226  solver->solve(w2, w, Nconv, diff);
227  m_foo_inv->setpart_ex(spin_color, w2, 0);
228  vout.detailed(m_vl, " Nconv,diff = %d %12.4e\n", Nconv, diff);
229  }
230  }
231  }
232 
233  delete params_solver;
234  delete solver;
235 
236  // redefine the inverse matrix with its dagger.
237  double re, im;
238  for (int ics = 0; ics < m_Nc * m_Nd; ++ics) {
239  for (int site = 0; site < m_Nvol2; ++site) {
240  for (int id = 0; id < m_Nd; ++id) {
241  for (int ic = 0; ic < m_Nc; ++ic) {
242  re = m_foo_inv->cmp_r(ic, id, site, ics);
243  im = m_foo_inv->cmp_i(ic, id, site, ics);
244  m_foo_inv->set_ri(ic, id, site, ics, re, -im);
245 
246  re = m_fee_inv->cmp_r(ic, id, site, ics);
247  im = m_fee_inv->cmp_i(ic, id, site, ics);
248  m_fee_inv->set_ri(ic, id, site, ics, re, -im);
249  }
250  }
251  }
252  }
253 }
254 
255 
256 //====================================================================
257 const Field_F Fopr_CloverTerm_eo::mult_csw_inv(const Field_F& f, const int ieo)
258 {
259  int nex = f.nex();
260  Field_F w(m_Nvol2, nex);
261 
262  mult_csw_inv(w, f, ieo);
263 
264  return w;
265 }
266 
267 
268 //====================================================================
270  const Field& f, const int ieo)
271 {
272  if (m_repr == "Dirac") {
273  mult_csw_inv_dirac(v, f, ieo);
274  } else if (m_repr == "Chiral") {
275  mult_csw_inv_chiral(v, f, ieo);
276  }
277 }
278 
279 
280 //====================================================================
282  const Field& f, const int ieo)
283 {
284  int Nvc = 2 * m_Nc;
285 
286  double *v1 = const_cast<Field *>(&f)->ptr(0);
287  double *v2 = v.ptr(0);
288  double *csw_inv;
289 
290  if (ieo == 0) {
291  csw_inv = m_fee_inv->ptr(0);
292  } else if (ieo == 1) {
293  csw_inv = m_foo_inv->ptr(0);
294 
295  /*
296  } else {
297  vout.crucial(m_vl, "%s: wrong parameter, ieo = %d.\n",
298  class_name.c_str(), ieo);
299  abort();
300  */
301  }
302 
303 #pragma omp barrier
304 
305  // threadding applied.
308  int is = m_Nvol2 * ith / nth;
309  int ns = m_Nvol2 * (ith + 1) / nth;
310 
311  int Nd2 = m_Nd / 2;
312  for (int site = is; site < ns; ++site) {
313  for (int icd = 0; icd < m_Nc * Nd2; ++icd) {
314  int iv2 = 2 * icd + m_NinF * site;
315  v2[iv2] = 0.0;
316  v2[iv2 + 1] = 0.0;
317  for (int jd = 0; jd < m_Nd; ++jd) {
318  int jcd = Nvc * jd;
319  int iv = jcd + m_NinF * site;
320  int ig = jcd + m_NinF * (site + m_Nvol2 * icd);
321  v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv], m_Nc);
322  v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv], m_Nc);
323  }
324  }
325 
326  for (int icd = 0; icd < m_Nc * Nd2; ++icd) {
327  int iv2 = 2 * (icd + m_Nc * Nd2) + m_NinF * site;
328  v2[iv2] = 0.0;
329  v2[iv2 + 1] = 0.0;
330  for (int jd = 0; jd < m_Nd; ++jd) {
331  int jd2 = (jd + Nd2) % m_Nd;
332  int iv = Nvc * jd + m_NinF * site;
333  int ig = Nvc * jd2 + m_NinF * (site + m_Nvol2 * icd);
334  v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv], m_Nc);
335  v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv], m_Nc);
336  }
337  }
338  }
339 #pragma omp barrier
340 }
341 
342 
343 //====================================================================
345  const Field& f, const int ieo)
346 {
347  int Nvc = 2 * m_Nc;
348 
349  double *v1 = const_cast<Field *>(&f)->ptr(0);
350  double *v2 = v.ptr(0);
351  double *csw_inv;
352 
353  if (ieo == 0) {
354  csw_inv = m_fee_inv->ptr(0);
355  } else if (ieo == 1) {
356  csw_inv = m_foo_inv->ptr(0);
357 
358  /*
359  } else {
360  vout.crucial(m_vl, "%s: wrong parameter, ieo = %d.\n",
361  class_name.c_str(), ieo);
362  abort();
363  */
364  }
365 
366 #pragma omp barrier
367 
368  // threadding applied.
371  int is = m_Nvol2 * ith / nth;
372  int ns = m_Nvol2 * (ith + 1) / nth;
373 
374  for (int site = is; site < ns; ++site) {
375  for (int icd = 0; icd < m_Nc * m_Nd / 2; ++icd) {
376  int iv2 = 2 * icd + m_NinF * site;
377  v2[iv2] = 0.0;
378  v2[iv2 + 1] = 0.0;
379 
380  for (int jd = 0; jd < m_Nd / 2; ++jd) {
381  int jcd = Nvc * jd;
382  int iv = jcd + m_NinF * site;
383  int ig = jcd + m_NinF * (site + m_Nvol2 * icd);
384  v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv], m_Nc);
385  v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv], m_Nc);
386  }
387  }
388 
389  for (int icd = m_Nc * m_Nd / 2; icd < m_Nc * m_Nd; ++icd) {
390  int iv2 = 2 * icd + m_NinF * site;
391  v2[iv2] = 0.0;
392  v2[iv2 + 1] = 0.0;
393 
394  for (int jd = m_Nd / 2; jd < m_Nd; ++jd) {
395  int jcd = Nvc * jd;
396  int iv = jcd + m_NinF * site;
397  int ig = jcd + m_NinF * (site + m_Nvol2 * icd);
398  v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv], m_Nc);
399  v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv], m_Nc);
400  }
401  }
402  }
403 #pragma omp barrier
404 }
405 
406 
407 //====================================================================
408 std::vector<double> Fopr_CloverTerm_eo::csmatrix(const int& site)
409 {
410  std::vector<double> matrix(m_Nc * m_Nc * m_Nd * m_Nd * 2);
411 
412  for (int ispin = 0; ispin < m_Nd / 2; ++ispin) {
413  for (int icolor = 0; icolor < m_Nc; ++icolor) {
414  int ics = icolor + ispin * m_Nc;
415  for (int jspin = 0; jspin < m_Nd; ++jspin) {
416  int js2 = (jspin + m_Nd / 2) % m_Nd;
417  for (int jcolor = 0; jcolor < m_Nc; ++jcolor) {
418  int cs1 = jcolor + m_Nc * (jspin + m_Nd * ics);
419  int cs2 = jcolor + m_Nc * (jspin + m_Nd * (ics + m_Nc * m_Nd / 2));
420  int cc = jcolor + icolor * m_Nc;
421  int ss1 = jspin + ispin * m_Nd;
422  int ss2 = js2 + ispin * m_Nd;
423 
424  matrix[2 * cs1] = m_T.cmp_r(cc, site, ss1);
425  matrix[2 * cs1 + 1] = m_T.cmp_i(cc, site, ss1);
426 
427  matrix[2 * cs2] = m_T.cmp_r(cc, site, ss2);
428  matrix[2 * cs2 + 1] = m_T.cmp_i(cc, site, ss2);
429  }
430  }
431  }
432  }
433 
434  return matrix;
435 }
436 
437 
438 //====================================================================
439 void Fopr_CloverTerm_eo::D(Field& v, const Field& f, const int ieo)
440 {
441  if (m_repr == "Dirac") {
442  D_dirac(v, f, ieo);
443  } else if (m_repr == "Chiral") {
444  D_chiral(v, f, ieo);
445  }
446 }
447 
448 
449 //====================================================================
450 void Fopr_CloverTerm_eo::D_dirac(Field& v, const Field& f, const int ieo)
451 {
452  // assert(f.nvol() == m_Nvol2);
453  // assert(f.nex() == 1);
454  // assert(v.nvol() == m_Nvol2);
455  // assert(v.nex() == 1);
456 
457  double *fp = const_cast<Field *>(&f)->ptr(0);
458  double *vp = v.ptr(0);
459  double *tp = m_T.ptr(0, m_Nvol2 * ieo, 0);
460 
463  int is = m_Nvol2 * ith / nth;
464  int ns = m_Nvol2 * (ith + 1) / nth;
465 
466  int Nvc = 2 * m_Nc;
467  int Nd2 = m_Nd / 2;
468  int NinF = 2 * m_Nc * m_Nd;
469  int NinG = 2 * m_Nc * m_Nc;
470 
471  for (int site = is; site < ns; ++site) {
472  for (int id = 0; id < Nd2; ++id) {
473  for (int ic = 0; ic < m_Nc; ++ic) {
474  int icd = ic + m_Nc * id;
475 
476  int iv2 = 2 * icd + NinF * site;
477  vp[iv2] = 0.0;
478  vp[iv2 + 1] = 0.0;
479  for (int jd = 0; jd < m_Nd; ++jd) {
480  int iv = Nvc * jd + NinF * site;
481  int ig = Nvc * ic + NinG * (site + m_Nvol * (id * m_Nd + jd));
482  vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
483  vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
484  }
485 
486  iv2 += Nvc * Nd2;
487  vp[iv2] = 0.0;
488  vp[iv2 + 1] = 0.0;
489  for (int jd = 0; jd < m_Nd; ++jd) {
490  int jd2 = (2 + jd) % m_Nd;
491  int iv = Nvc * jd + NinF * site;
492  int ig = Nvc * ic + NinG * (site + m_Nvol * (id * m_Nd + jd2));
493  vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
494  vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
495  }
496  }
497  }
498  }
499 #pragma omp barrier
500 }
501 
502 
503 //====================================================================
504 void Fopr_CloverTerm_eo::D_chiral(Field& v, const Field& f, const int ieo)
505 {
506  double *fp = const_cast<Field *>(&f)->ptr(0);
507  double *vp = v.ptr(0);
508  double *tp = m_T.ptr(0, m_Nvol2 * ieo, 0);
509 
512  int is = m_Nvol2 * ith / nth;
513  int ns = m_Nvol2 * (ith + 1) / nth;
514 
515  int Nvc = 2 * m_Nc;
516  int Nd2 = m_Nd / 2;
517  int NinF = 2 * m_Nc * m_Nd;
518  int NinG = 2 * m_Nc * m_Nc;
519 
520  for (int site = is; site < ns; ++site) {
521  for (int id = 0; id < Nd2; ++id) {
522  for (int ic = 0; ic < m_Nc; ++ic) {
523  int icd = ic + m_Nc * id;
524 
525  int iv2 = 2 * icd + NinF * site;
526  vp[iv2] = 0.0;
527  vp[iv2 + 1] = 0.0;
528  for (int jd = 0; jd < Nd2; ++jd) {
529  int iv = Nvc * jd + NinF * site;
530  int ig = Nvc * ic + NinG * (site + m_Nvol * (id * Nd2 + jd));
531  vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
532  vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
533  }
534 
535  iv2 += Nvc * Nd2;
536  vp[iv2] = 0.0;
537  vp[iv2 + 1] = 0.0;
538  for (int jd = 0; jd < Nd2; ++jd) {
539  int iv = Nvc * (Nd2 + jd) + NinF * site;
540  int ig = Nvc * ic + NinG * (site + m_Nvol * (m_Nd + id * Nd2 + jd));
541  vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
542  vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
543  }
544  }
545  }
546  }
547 #pragma omp barrier
548 }
549 
550 
551 //====================================================================
553  const int mu, const int nu)
554 {
555  assert(mu != nu);
556  mult_iGM(v, m_SG[sg_index(mu, nu)], w);
557 }
558 
559 
560 //====================================================================
562 {
563  if (m_repr == "Dirac") {
564  set_csw_dirac();
565  } else if (m_repr == "Chiral") {
566  set_csw_chiral();
567  } else {
568  vout.crucial(m_vl, "%s: unsupported gamma matrix repr. %s.\n",
569  class_name.c_str(), m_repr.c_str());
570  abort();
571  }
572 }
573 
574 
575 //====================================================================
577 {
578  // The clover term in the Dirac representation is as spin-space
579  // matrix
580  // [ P Q ]
581  // [ Q P ],
582  // where P and Q are 2x2 block matrices as
583  // P = [ iF(1,2) F(3,1) + iF(2,3) ]
584  // [-F(3,1) + iF(2,3) - iF(1,2) ]
585  // and
586  // Q = [ - iF(4,3) -F(4,2) - iF(4,1) ]
587  // [ F(4,2) - iF(4,1) iF(4,3) ]
588  // up to the coefficient.
589  // in the following what defined is
590  // [ P Q ] = [ T(0) T(1) T(2) T(3) ]
591  // [ T(4) T(5) T(6) T(7) ].
592 
593  m_T.set(0.0);
594 
595  //- sigma23
596  Field_G F;
597  set_fieldstrength(F, 1, 2);
598  F.xI();
599  axpy(m_T, 1, 1.0, F, 0);
600  axpy(m_T, 4, 1.0, F, 0);
601 
602  //- sigma31
603  set_fieldstrength(F, 2, 0);
604  axpy(m_T, 1, 1.0, F, 0);
605  axpy(m_T, 4, -1.0, F, 0);
606 
607  //- sigma12
608  set_fieldstrength(F, 0, 1);
609  F.xI();
610  axpy(m_T, 0, 1.0, F, 0);
611  axpy(m_T, 5, -1.0, F, 0);
612 
613  //- sigma41
614  set_fieldstrength(F, 3, 0);
615  F.xI();
616  axpy(m_T, 3, -1.0, F, 0);
617  axpy(m_T, 6, -1.0, F, 0);
618 
619  //- sigma42
620  set_fieldstrength(F, 3, 1);
621  axpy(m_T, 3, -1.0, F, 0);
622  axpy(m_T, 6, 1.0, F, 0);
623 
624  //- sigma43
625  set_fieldstrength(F, 3, 2);
626  F.xI();
627  axpy(m_T, 2, -1.0, F, 0);
628  axpy(m_T, 7, 1.0, F, 0);
629 
630  scal(m_T, -m_kappa * m_cSW);
631 
632  Field_G Unity(m_Nvol, 1);
633  Unity.set_unit();
634  axpy(m_T, 0, 1.0, Unity, 0);
635  axpy(m_T, 5, 1.0, Unity, 0);
636 }
637 
638 
639 //====================================================================
641 {
642  // The clover term in the Dirac representation is
643  // as spin-space matrix
644  // [ P+Q 0 ]
645  // [ 0 P-Q ],
646  // where P and Q are 2x2 block matrices as
647  // [ iF(1,2) | F(3,1) + iF(2,3) ]
648  // P = [ -----------------+------------------ ]
649  // [-F(3,1) + iF(2,3) | - iF(1,2) ]
650  // and
651  // [ - iF(4,3) | -F(4,2) - iF(4,1) ]
652  // Q = [ -----------------+------------------ ]
653  // [ F(4,2) - iF(4,1) | iF(4,3) ]
654  // up to the coefficient.
655  // in the following what defined is
656  // [ T(0) | T(1) ] [ T(4) | T(5) ]
657  // P+Q = [ -----+----- ] P - Q = [ -----+----- ]
658  // [ T(2) | T(3) ] [ T(6) | T(7) ]
659 
660  m_T.set(0.0);
661 
662  Field_G F;
663 
664  //- sigma23
665  set_fieldstrength(F, 1, 2);
666  F.xI();
667  axpy(m_T, 1, 1.0, F, 0);
668  axpy(m_T, 2, 1.0, F, 0);
669  axpy(m_T, 5, 1.0, F, 0);
670  axpy(m_T, 6, 1.0, F, 0);
671 
672  //- sigma31
673  set_fieldstrength(F, 2, 0);
674  axpy(m_T, 1, 1.0, F, 0);
675  axpy(m_T, 2, -1.0, F, 0);
676  axpy(m_T, 5, 1.0, F, 0);
677  axpy(m_T, 6, -1.0, F, 0);
678 
679  //- sigma12
680  set_fieldstrength(F, 0, 1);
681  F.xI();
682  axpy(m_T, 0, 1.0, F, 0);
683  axpy(m_T, 3, -1.0, F, 0);
684  axpy(m_T, 4, 1.0, F, 0);
685  axpy(m_T, 7, -1.0, F, 0);
686 
687  //- sigma41
688  set_fieldstrength(F, 3, 0);
689  F.xI();
690  axpy(m_T, 1, -1.0, F, 0);
691  axpy(m_T, 2, -1.0, F, 0);
692  axpy(m_T, 5, 1.0, F, 0);
693  axpy(m_T, 6, 1.0, F, 0);
694 
695  //- sigma42
696  set_fieldstrength(F, 3, 1);
697  axpy(m_T, 1, -1.0, F, 0);
698  axpy(m_T, 2, 1.0, F, 0);
699  axpy(m_T, 5, 1.0, F, 0);
700  axpy(m_T, 6, -1.0, F, 0);
701 
702  //- sigma43
703  set_fieldstrength(F, 3, 2);
704  F.xI();
705  axpy(m_T, 0, -1.0, F, 0);
706  axpy(m_T, 3, 1.0, F, 0);
707  axpy(m_T, 4, 1.0, F, 0);
708  axpy(m_T, 7, -1.0, F, 0);
709 
710  scal(m_T, -m_kappa * m_cSW);
711 
712  Field_G Unity(m_Nvol, 1);
713  Unity.set_unit();
714  axpy(m_T, 0, 1.0, Unity, 0);
715  axpy(m_T, 3, 1.0, Unity, 0);
716  axpy(m_T, 4, 1.0, Unity, 0);
717  axpy(m_T, 7, 1.0, Unity, 0);
718 }
719 
720 
721 //====================================================================
723  const int mu, const int nu)
724 {
725  Staples_eo staple;
726 
727  Field_G Cup(m_Nvol, 1), Cdn(m_Nvol, 1);
728  Field_G Umu(m_Nvol, 1);
729  Field_G w(m_Nvol, 1), v(m_Nvol, 1), v2(m_Nvol, 1);
730 
731  Cup = staple.upper(m_Ueo, mu, nu);
732  Cdn = staple.lower(m_Ueo, mu, nu);
733  Umu.setpart_ex(0, *m_Ueo, mu);
734 
735  for (int site = 0; site < m_Nvol; ++site) {
736  w.set_mat(site, 0, Umu.mat(site) * Cup.mat_dag(site));
737  }
738 
739  for (int site = 0; site < m_Nvol; ++site) {
740  v2.set_mat(site, 0, Umu.mat(site) * Cdn.mat_dag(site));
741  }
742 
743  w -= v2;
744 
745  for (int site = 0; site < m_Nvol; ++site) {
746  v.set_mat(site, 0, Cup.mat_dag(site) * Umu.mat(site));
747  }
748 
749  for (int site = 0; site < m_Nvol; ++site) {
750  v2.set_mat(site, 0, Cdn.mat_dag(site) * Umu.mat(site));
751  }
752 
753  v -= v2;
754 
755  m_shift_eo.forward(v2, v, mu);
756 
757  w += v2;
758 
759  for (int site = 0; site < m_Nvol; ++site) {
760  Fst.set_mat(site, 0, w.mat(site).ah());
761  }
762 
763  Fst *= 0.25;
764 }
765 
766 
767 //====================================================================
768 const Field_G Fopr_CloverTerm_eo::trSigmaInv(const int mu, const int nu)
769 {
770  int nex_finv = m_fee_inv->nex();
771  Vec_SU_N v;
772  Field_F sigma_inv(m_Nvol, nex_finv);
773  Field_G tr_sigma_inv(m_Nvol, 1);
774 
775  {
776  Field_F sigma_eo_inv(m_Nvol2, nex_finv);
777  mult_isigma(sigma_eo_inv, *m_fee_inv, mu, nu);
778  m_idx.reverseField(sigma_inv, sigma_eo_inv, 0);
779  mult_isigma(sigma_eo_inv, *m_foo_inv, mu, nu);
780  m_idx.reverseField(sigma_inv, sigma_eo_inv, 1);
781  }
782 
783  for (int isite = 0; isite < m_Nvol; ++isite) {
784  for (int ispin = 0; ispin < m_Nd; ++ispin) {
785  for (int icolor = 0; icolor < m_Nc; ++icolor) {
786  v = sigma_inv.vec(ispin, isite, icolor + m_Nc * ispin);
787  for (int jcolor = 0; jcolor < m_Nc; ++jcolor) {
788  int cc = icolor + m_Nc * jcolor;
789  tr_sigma_inv.set_r(cc, isite, 0, v.r(jcolor));
790  tr_sigma_inv.set_i(cc, isite, 0, v.i(jcolor));
791  }
792  }
793  }
794  }
795  return tr_sigma_inv;
796 }
797 
798 
799 //====================================================================
801 {
802  // The following counting explicitly depends on the implementation
803  // and to be recalculated when the code is modified.
804  // Present counting is based on rev.1107. [24 Aug 2014 H.Matsufuru]
805 
806  int Lvol = CommonParameters::Lvol();
807  double flop_site = 0.0;
808 
809  if (m_repr == "Dirac") {
810  flop_site = static_cast<double>(8 * m_Nc * m_Nc * m_Nd * m_Nd);
811  } else if (m_repr == "Chiral") {
812  flop_site = static_cast<double>(4 * m_Nc * m_Nc * m_Nd * m_Nd);
813  }
814 
815  double flop = flop_site * static_cast<double>(Lvol / 2);
816 
817  return flop;
818 }
819 
820 
821 //====================================================================
822 //============================================================END=====
Staple construction.
Definition: staples_eo.h:33
void scal(Field &x, const double a)
scal(x, a): x = a * x
Definition: field.cpp:310
void D_chiral(Field &v, const Field &f, const int ieo)
explicit implementation for Chiral representation (for Imp-version).
BridgeIO vout
Definition: bridgeIO.cpp:207
void init(std::string repr)
double cmp_i(const int cc, const int s, const int site, const int e=0) const
Definition: field_F.h:100
void detailed(const char *format,...)
Definition: bridgeIO.cpp:50
static int get_num_threads()
returns available number of threads.
void Register_string(const string &, const string &)
Definition: parameters.cpp:352
double r(const int c) const
Definition: vec_SU_N.h:65
void set(const int jin, const int site, const int jex, double v)
Definition: field.h:128
void general(const char *format,...)
Definition: bridgeIO.cpp:38
GammaMatrix get_GM(GMspecies spec)
void set_int(const string &key, const int value)
Definition: parameters.cpp:262
double * ptr(const int jin, const int site, const int jex)
Definition: field.h:118
Container of Field-type object.
Definition: field.h:37
void D_dirac(Field &v, const Field &f, const int ieo)
explicit implementation for Dirac representation (for Imp-version).
double cmp_i(const int cc, const int site, const int mn=0) const
Definition: field_G.h:88
Field_G m_T
m_T = 1 - kappa c_SW sigma F / 2
void set_csw_dirac()
explicit implementation for Dirac representation (for Imp-version).
std::valarray< GammaMatrix > m_SG
const Field_G * m_Ueo
Class for parameters.
Definition: parameters.h:40
void mult_csw_inv_chiral(Field &, const Field &, const int ieo)
static int Lvol()
void set_parameters(const Parameters &params)
static Parameters * New(const std::string &realm)
Standard Conjugate Gradient solver algorithm.
Definition: solver_CG.h:41
int fetch_int_vector(const string &key, std::valarray< int > &val) const
Definition: parameters.cpp:176
static int get_thread_id()
returns thread id.
Wilson-type fermion field.
Definition: field_F.h:37
virtual void set_parameters(const Parameters &params)=0
void set_string(const string &key, const string &value)
Definition: parameters.cpp:298
SU(N) gauge field.
Definition: field_G.h:36
static double epsilon_criterion2()
void reset(int Nvol, int Nex)
Definition: field_F.h:81
static const std::string class_name
const Field_F mult_csw_inv(const Field_F &, const int ieo)
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
Definition: field_F_imp.cpp:94
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
double i(const int c) const
Definition: vec_SU_N.h:67
void set_ri(const int cc, const int s, const int site, const int e, const double re, const double im)
Definition: field_F.h:116
Bridge::VerboseLevel m_vl
Definition: fopr.h:99
const Field D(const Field &f, const int ieo)
Set of Gamma Matrices: basis class.
Field_G upper(const Field_G *, const int, const int)
Definition: staples_eo.cpp:89
int nex() const
Definition: field.h:102
void set_fieldstrength(Field_G &, const int, const int)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
Definition: field.cpp:193
void crucial(const char *format,...)
Definition: bridgeIO.cpp:26
Base class for linear solver class family.
Definition: solver.h:37
static bool Register(const std::string &realm, const creator_callback &cb)
void set_double(const string &key, const double value)
Definition: parameters.cpp:271
void set_mode(std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void reverseField(Field &lex, const Field &eo)
Definition: index_eo.cpp:110
void forward(Field &, const Field &, const int mu)
const Field_G trSigmaInv(const int mu, const int nu)
Field_G lower(const Field_G *, const int, const int)
Definition: staples_eo.cpp:112
std::valarray< int > m_boundary
void Register_double(const string &, const double)
Definition: parameters.cpp:324
double cmp_r(const int cc, const int site, const int mn=0) const
Definition: field_G.h:83
void Register_int_vector(const string &, const std::valarray< int > &)
Definition: parameters.cpp:345
void setpart_ex(int ex, const Field &w, int exw)
Definition: field.h:150
int fetch_double(const string &key, double &val) const
Definition: parameters.cpp:124
string get_string(const string &key) const
Definition: parameters.cpp:85
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Definition: field_G.h:156
void set_csw_chiral()
explicit implementation for Chiral representation (for Imp-version).
void mult_csw_inv_dirac(Field &, const Field &, const int ieo)
std::valarray< GammaMatrix > m_GM
Gamma Matrix and Sigma_{mu,nu} = -i [Gamma_mu, Gamma_nu] /2.
double flop_count()
retuns number of floating point number operations.
std::vector< double > csmatrix(const int &)
int sg_index(int mu, int nu)
ShiftField_eo m_shift_eo
virtual void solve(Field &solution, const Field &source, int &Nconv, double &diff)=0
static VerboseLevel set_verbose_level(const std::string &str)
Definition: bridgeIO.cpp:191
void set_config(Field *Ueo)
setting pointer to the gauge configuration.
void xI()
Definition: field_G.h:180
double cmp_r(const int cc, const int s, const int site, const int e=0) const
Definition: field_F.h:94