20 #if defined USE_GROUP_SU3
22 #elif defined USE_GROUP_SU2
24 #elif defined USE_GROUP_SU_N
98 const string str_vlevel = params.
get_string(
"verbose_level");
122 const std::vector<int> bc)
128 for (
int mu = 0; mu <
m_Ndim; ++mu) {
134 assert(bc.size() ==
m_Ndim);
163 params_solver.
set_string(
"solver_type",
"CG");
164 params_solver.
set_int(
"maximum_number_of_iteration", 100);
165 params_solver.
set_int(
"maximum_number_of_restart", 40);
166 params_solver.
set_double(
"convergence_criterion_squared", 1.0e-30);
167 params_solver.
set_string(
"use_initial_guess",
"false");
169 params_solver.
set_string(
"verbose_level",
"Crucial");
181 const int Niter = 100;
182 const int Nrestart = 40;
183 const double Stopping_condition = 1.0e-30;
189 for (
int ispin = 0; ispin <
m_Nd; ++ispin) {
190 for (
int icolor = 0; icolor <
m_Nc; ++icolor) {
191 int spin_color = icolor + m_Nc * ispin;
195 for (
int isite = 0; isite <
m_Nvol2; ++isite) {
196 w.
set_ri(icolor, ispin, isite, 0, 1, 0);
207 solver->
solve(w2, w, Nconv, diff);
212 solver->
solve(w2, w, Nconv, diff);
220 for (
int ics = 0; ics <
m_Nc *
m_Nd; ++ics) {
221 for (
int site = 0; site <
m_Nvol2; ++site) {
222 for (
int id = 0;
id <
m_Nd; ++id) {
223 for (
int ic = 0; ic <
m_Nc; ++ic) {
242 const Field& f,
const int ieo)
247 }
else if (
m_repr ==
"Chiral") {
255 const Field& f,
const int ieo)
258 const int Nvc = 2 *
m_Nc;
260 const double *
v1 = f.
ptr(0);
261 double *
v2 = v.
ptr(0);
267 }
else if (ieo == 1) {
281 const int is =
m_Nvol2 * i_thread / Nthread;
282 const int ns =
m_Nvol2 * (i_thread + 1) / Nthread;
284 const int Nd2 =
m_Nd / 2;
285 for (
int site = is; site < ns; ++site) {
286 for (
int icd = 0; icd <
m_Nc * Nd2; ++icd) {
287 int iv2 = 2 * icd +
m_NinF * site;
290 for (
int jd = 0; jd <
m_Nd; ++jd) {
292 int iv = jcd +
m_NinF * site;
295 v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv],
m_Nc);
296 v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv],
m_Nc);
300 for (
int icd = 0; icd <
m_Nc * Nd2; ++icd) {
301 int iv2 = 2 * (icd +
m_Nc * Nd2) +
m_NinF * site;
304 for (
int jd = 0; jd <
m_Nd; ++jd) {
305 int jd2 = (jd + Nd2) % m_Nd;
306 int iv = Nvc * jd +
m_NinF * site;
309 v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv],
m_Nc);
310 v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv],
m_Nc);
320 const Field& f,
const int ieo)
323 const int Nvc = 2 *
m_Nc;
325 const double *
v1 = f.
ptr(0);
326 double *
v2 = v.
ptr(0);
332 }
else if (ieo == 1) {
346 const int is =
m_Nvol2 * i_thread / Nthread;
347 const int ns =
m_Nvol2 * (i_thread + 1) / Nthread;
349 for (
int site = is; site < ns; ++site) {
350 for (
int icd = 0; icd <
m_Nc *
m_Nd / 2; ++icd) {
351 int iv2 = 2 * icd +
m_NinF * site;
355 for (
int jd = 0; jd <
m_Nd / 2; ++jd) {
357 int iv = jcd +
m_NinF * site;
360 v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv],
m_Nc);
361 v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv],
m_Nc);
366 int iv2 = 2 * icd +
m_NinF * site;
370 for (
int jd = m_Nd / 2; jd <
m_Nd; ++jd) {
372 int iv = jcd +
m_NinF * site;
375 v2[iv2] += mult_uv_r(&csw_inv[ig], &v1[iv],
m_Nc);
376 v2[iv2 + 1] += mult_uv_i(&csw_inv[ig], &v1[iv],
m_Nc);
389 for (
int ispin = 0; ispin < m_Nd / 2; ++ispin) {
390 for (
int icolor = 0; icolor <
m_Nc; ++icolor) {
391 int ics = icolor + ispin *
m_Nc;
393 for (
int jspin = 0; jspin <
m_Nd; ++jspin) {
394 int js2 = (jspin + m_Nd / 2) % m_Nd;
396 for (
int jcolor = 0; jcolor <
m_Nc; ++jcolor) {
397 int cs1 = jcolor + m_Nc * (jspin + m_Nd * ics);
398 int cs2 = jcolor + m_Nc * (jspin + m_Nd * (ics + m_Nc * m_Nd / 2));
399 int cc = jcolor + icolor *
m_Nc;
400 int ss1 = jspin + ispin *
m_Nd;
401 int ss2 = js2 + ispin *
m_Nd;
404 int cs1_i = 2 * cs1 + 1;
406 matrix[cs1_r] =
m_T.
cmp_r(cc, site, ss1);
407 matrix[cs1_i] =
m_T.
cmp_i(cc, site, ss1);
410 int cs2_i = 2 * cs2 + 1;
412 matrix[cs2_r] =
m_T.
cmp_r(cc, site, ss2);
413 matrix[cs2_i] =
m_T.
cmp_i(cc, site, ss2);
429 }
else if (
m_repr ==
"Chiral") {
445 const double *fp = f.
ptr(0);
446 double *vp = v.
ptr(0);
451 const int is =
m_Nvol2 * i_thread / Nthread;
452 const int ns =
m_Nvol2 * (i_thread + 1) / Nthread;
454 const int Nvc = 2 *
m_Nc;
455 const int Nd2 =
m_Nd / 2;
459 for (
int site = is; site < ns; ++site) {
460 for (
int id = 0;
id < Nd2; ++id) {
461 for (
int ic = 0; ic <
m_Nc; ++ic) {
462 int icd = ic + m_Nc * id;
464 int iv2 = 2 * icd + NinF * site;
467 for (
int jd = 0; jd <
m_Nd; ++jd) {
468 int iv = Nvc * jd + NinF * site;
469 int ig = Nvc * ic + NinG * (site +
m_Nvol * (
id * m_Nd + jd));
471 vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
472 vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
478 for (
int jd = 0; jd <
m_Nd; ++jd) {
479 int jd2 = (2 + jd) % m_Nd;
480 int iv = Nvc * jd + NinF * site;
481 int ig = Nvc * ic + NinG * (site +
m_Nvol * (
id * m_Nd + jd2));
483 vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
484 vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
495 const Field& f,
const int ieo)
499 const double *fp = f.
ptr(0);
500 double *vp = v.
ptr(0);
505 const int is =
m_Nvol2 * i_thread / Nthread;
506 const int ns =
m_Nvol2 * (i_thread + 1) / Nthread;
508 const int Nvc = 2 *
m_Nc;
509 const int Nd2 =
m_Nd / 2;
513 for (
int site = is; site < ns; ++site) {
514 for (
int id = 0;
id < Nd2; ++id) {
515 for (
int ic = 0; ic <
m_Nc; ++ic) {
516 int icd = ic + m_Nc * id;
518 int iv2 = 2 * icd + NinF * site;
521 for (
int jd = 0; jd < Nd2; ++jd) {
522 int iv = Nvc * jd + NinF * site;
523 int ig = Nvc * ic + NinG * (site +
m_Nvol * (
id * Nd2 + jd));
525 vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
526 vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
532 for (
int jd = 0; jd < Nd2; ++jd) {
533 int iv = Nvc * (Nd2 + jd) + NinF * site;
534 int ig = Nvc * ic + NinG * (site +
m_Nvol * (m_Nd +
id * Nd2 + jd));
536 vp[iv2] += mult_uv_r(&tp[ig], &fp[iv], m_Nc);
537 vp[iv2 + 1] += mult_uv_i(&tp[ig], &fp[iv], m_Nc);
548 const Field_F& w,
const int mu,
const int nu)
560 }
else if (
m_repr ==
"Chiral") {
563 vout.
crucial(
m_vl,
"Error at %s: unsupported gamma matrix repr. %s.\n",
718 const int mu,
const int nu)
733 for (
int site = 0; site <
m_Nvol; ++site) {
738 for (
int site = 0; site <
m_Nvol; ++site) {
745 for (
int site = 0; site <
m_Nvol; ++site) {
749 for (
int site = 0; site <
m_Nvol; ++site) {
759 for (
int site = 0; site <
m_Nvol; ++site) {
769 const int mu,
const int nu)
774 assert(tr_sigma_inv.
nex() == 1);
786 for (
int isite = 0; isite <
m_Nvol; ++isite) {
787 for (
int ispin = 0; ispin <
m_Nd; ++ispin) {
788 for (
int icolor = 0; icolor <
m_Nc; ++icolor) {
789 Vec_SU_N v = sigma_inv.vec(ispin, isite, icolor + m_Nc * ispin);
791 for (
int jcolor = 0; jcolor <
m_Nc; ++jcolor) {
792 int cc = icolor + m_Nc * jcolor;
794 tr_sigma_inv.
set_r(cc, isite, 0, v.
r(jcolor));
795 tr_sigma_inv.
set_i(cc, isite, 0, v.
i(jcolor));
818 }
else if (
m_repr ==
"Chiral") {
822 const double gflop = flop_site * ((Nvol / 2) * (NPE / 1.0e+9));
void scal(Field &x, const double a)
scal(x, a): x = a * x
void mult_csw_inv_dirac(Field &, const Field &, const int ieo)
void D(Field &v, const Field &f, const int ieo)
double cmp_i(const int cc, const int s, const int site, const int e=0) const
void detailed(const char *format,...)
static int get_num_threads()
returns available number of threads.
const double * ptr(const int jin, const int site, const int jex) const
virtual void upper(Field_G &, const Field_G &, const int mu, const int nu)=0
constructs upper staple in mu-nu plane.
double r(const int c) const
void set(const int jin, const int site, const int jex, double v)
virtual void lower(Field_G &, const Field_G &, const int mu, const int nu)=0
constructs lower staple in mu-nu plane.
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
std::vector< GammaMatrix > m_SG
void general(const char *format,...)
GammaMatrix get_GM(GMspecies spec)
void set_int(const string &key, const int value)
int solver(const std::string &)
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
std::vector< GammaMatrix > m_GM
Gamma Matrix and Sigma_{mu,nu} = -i [Gamma_mu, Gamma_nu] /2.
Container of Field-type object.
int fetch_double(const string &key, double &value) const
void set_parameters(const Parameters ¶ms)
double cmp_i(const int cc, const int site, const int mn=0) const
Standard Conjugate Gradient solver algorithm.
void set_csw_chiral()
explicit implementation for Chiral representation (for Imp-version).
static int get_thread_id()
returns thread id.
Wilson-type fermion field.
std::vector< int > m_boundary
void trSigmaInv(Field_G &, const int mu, const int nu)
int sg_index(const int mu, const int nu)
void set_string(const string &key, const string &value)
void set_fieldstrength(Field_G &, const int, const int)
static double epsilon_criterion2()
void reset(int Nvol, int Nex)
void mult_csw_inv_chiral(Field &, const Field &, const int ieo)
void mult_iGM(Field_F &y, const GammaMatrix &gm, const Field_F &x)
gamma matrix multiplication (i is multiplied)
double i(const int c) const
void set_parameters(const Parameters ¶ms)
void set_ri(const int cc, const int s, const int site, const int e, const double re, const double im)
Bridge::VerboseLevel m_vl
double flop_count()
returns number of floating point operations.
void set_i(const int cc, const int site, const int mn, const double im)
Mat_SU_N & ah()
antihermitian
void init(const std::string repr)
std::vector< double > csmatrix(const int &)
void mult_isigma(Field_F &, const Field_F &, const int mu, const int nu)
void set_r(const int cc, const int site, const int mn, const double re)
void mult_csw_inv(Field &, const Field &, const int ieo)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void crucial(const char *format,...)
static const std::string class_name
void set_double(const string &key, const double value)
void reverseField(Field &lex, const Field &eo)
void set_config(Field *Ueo)
setting pointer to the gauge configuration.
void forward(Field &, const Field &, const int mu)
Mat_SU_N mat_dag(const int site, const int mn=0) const
void set_csw_dirac()
explicit implementation for Dirac representation (for Imp-version).
double cmp_r(const int cc, const int site, const int mn=0) const
Field_G m_T
m_T = 1 - kappa c_SW sigma F / 2
void D_dirac(Field &v, const Field &f, const int ieo)
explicit implementation for Dirac representation (for Imp-version).
void setpart_ex(int ex, const Field &w, int exw)
void set_parameter_verboselevel(const Bridge::VerboseLevel vl)
string get_string(const string &key) const
int fetch_int_vector(const string &key, vector< int > &value) const
void set_mat(const int site, const int mn, const Mat_SU_N &U)
Mat_SU_N mat(const int site, const int mn=0) const
static VerboseLevel set_verbose_level(const std::string &str)
void D_chiral(Field &v, const Field &f, const int ieo)
explicit implementation for Chiral representation (for Imp-version).
double cmp_r(const int cc, const int s, const int site, const int e=0) const