CHROMA
gammasgn_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Compute gamma matrix multiplication table factors
3  */
4 
5 #include "chromabase.h"
6 #include "util/ferm/gammasgn_w.h"
7 
8 namespace Chroma
9 {
10 
11  //! Anonymous namespace
12  /*! \ingroup ferm */
13  namespace
14  {
15  multi2d<int> meson_eta2;
16  bool initP = false;
17 
18 
19  //! Init gamma matrix multiplication table factors
20  /*!
21  * \ingroup ferm
22  *
23  * Initialize signs needed for Gamma(n)*Gamma(m)=sgn(n,m)*Gamma(n ^ m)
24  */
25  void gammaSgnInit()
26  {
27  START_CODE();
28 
29  if (Ns != 4)
30  {
31  QDPIO::cerr << __func__ << ": only supports Ns=4 currently" << std::endl;
32  QDP_abort(1);
33  }
34 
35  meson_eta2.resize(Ns*Ns,Ns*Ns);
36 
37  for(int n = 0; n < Ns*Ns; ++n)
38  {
39  int nn = n;
40  int n1 = nn & 1;
41  nn >>= 1;
42  int n2 = nn & 1;
43  nn >>= 1;
44  int n3 = nn & 1;
45  int n4 = nn >> 1;
46 
47 // int ssum = (n1 + n2 + n3 + n4) & 1;
48 
49  for(int m = 0; m < Ns*Ns; ++m)
50  {
51  int mm = m;
52  int m1 = mm & 1;
53  mm >>= 1;
54  int m2 = mm & 1;
55  mm >>= 1;
56  int m3 = mm & 1;
57  int m4 = mm >> 1;
58 
59  int ssum = ((n2+n3+n4)*m1 + (n3+n4)*m2 + n4*m3) & 1;
60  meson_eta2(n,m) = (ssum == 0) ? 1 : -1;
61  }
62  }
63 
64  initP = true;
65 
66  END_CODE();
67  }
68  } // end namespace
69 
70  //! Return gamma matrix multiplication table factors
71  /*!
72  * \ingroup ferm
73  *
74  * Initialize signs needed for Gamma(n)*Gamma(m)=sgn(n,m)*Gamma(n ^ m)
75  */
76  int gammaSgn(int n, int m)
77  {
78  if (! initP)
79  gammaSgnInit();
80 
81  return meson_eta2(n,m);
82  }
83 
84 } // end namespace Chroma
Primary include file for CHROMA library code.
Compute gamma matrix multiplication table factors.
int gammaSgn(int n, int m)
Return gamma matrix multiplication table factors.
Definition: gammasgn_w.cc:76
unsigned n
Definition: ldumul_w.cc:36
static int m[4]
Definition: make_seeds.cc:16
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
START_CODE()