Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Wilson_impl.cpp
Go to the documentation of this file.
1 
14 #include "fopr_Wilson_impl.h"
15 
16 using std::valarray;
17 using std::string;
18 
19 //====================================================================
21 {
23 
26  m_boundary.resize(m_Ndim);
27 
28  m_U = 0;
29 
30  m_repr = repr;
31 
32  m_GM.resize(m_Ndim + 1);
33 
34  GammaMatrixSet *gmset = GammaMatrixSet::New(m_repr);
35 
36  m_GM[0] = gmset->get_GM(GammaMatrixSet::GAMMA1);
37  m_GM[1] = gmset->get_GM(GammaMatrixSet::GAMMA2);
38  m_GM[2] = gmset->get_GM(GammaMatrixSet::GAMMA3);
39  m_GM[3] = gmset->get_GM(GammaMatrixSet::GAMMA4);
40  m_GM[4] = gmset->get_GM(GammaMatrixSet::GAMMA5);
41 
44 
45  delete gmset;
46 }
47 
48 
49 //====================================================================
51 {
52  m_mode = mode;
53 
54  if (m_mode == "D") {
57  } else if (m_mode == "Ddag") {
60  } else if (m_mode == "DdagD") {
63  } else if (m_mode == "H") {
66  } else {
67  vout.crucial(m_vl, "Fopr_Wilson_impl: input mode is undefined.\n");
68  abort();
69  }
70 }
71 
72 
73 //====================================================================
75 {
76  return m_mode;
77 }
78 
79 
80 //====================================================================
81 void Fopr_Wilson::Fopr_Wilson_impl::set_parameters(const double kappa, const valarray<int> bc)
82 {
83  //- print input parameters
84  vout.general(m_vl, "Parameters of Wilson fermion operator:\n");
85  vout.general(m_vl, " kappa = %8.4f\n", kappa);
86  for (int mu = 0; mu < m_Ndim; ++mu) {
87  vout.general(m_vl, " boundary[%d] = %2d\n", mu, bc[mu]);
88  }
89 
90  //- range check
91  // NB. kappa = 0 is allowed.
92  assert(bc.size() == m_Ndim);
93 
94  //- store values
95  m_kappa = kappa;
96 
97  // m_boundary.resize(m_Ndim); // already resized in init.
98  for (int mu = 0; mu < m_Ndim; ++mu) {
99  m_boundary[mu] = bc[mu];
100  }
101 }
102 
103 
104 //====================================================================
106 {
107  Field_F w(f.nvol(), f.nex());
108 
109  v = 0.0;
110  w = 0.0;
111  for (int mu = 0; mu < m_Ndim; ++mu) {
112  mult_up(mu, w, f);
113  mult_dn(mu, w, f);
114  }
115 
116  v = (Field)w;
117 
118  v *= -m_kappa;
119  v += f;
120 }
121 
122 
123 //====================================================================
125 {
126  assert(v.nvol() == f.nvol());
127  assert(v.nex() == f.nex());
128  assert(v.nin() == f.nin());
129 
130  Field_F vt(f.nvol(), f.nex());
131 
132  vt.mult_GM(m_GM[4], (Field_F)f);
133  v = (Field)vt;
134 }
135 
136 
137 //====================================================================
139 {
140  Field_F vt, v;
141 
142  vt = 0.0;
143 
144  assert(mu >= 0);
145  assert(mu < m_Ndim);
146 
147  mult_up(mu, vt, w);
148 
149  // v = (Field_F) mult_gm5(vt);
150  mult_gm5(v, vt);
151 
152  return v;
153 }
154 
155 
156 //====================================================================
157 void Fopr_Wilson::Fopr_Wilson_impl::mult_up(int mu, Field& w, const Field& f)
158 {
159  Field_F vt(f.nvol(), 1);
160 
161  for (int ex = 0; ex < f.nex(); ++ex) {
162  vt.setpart_ex(0, f, ex);
163  shift.backward(trf, f, m_boundary[mu], mu);
164  trf2.mult_Field_Gn(0, *m_U, mu, trf, 0);
165  vt.mult_GMproj2(-1, m_GM[mu], trf2);
166  w.addpart_ex(ex, vt, 0);
167  }
168 }
169 
170 
171 //====================================================================
172 void Fopr_Wilson::Fopr_Wilson_impl::mult_dn(int mu, Field& w, const Field& f)
173 {
174  Field_F vt(f.nvol(), 1);
175 
176  for (int ex = 0; ex < f.nex(); ++ex) {
177  trf.mult_Field_Gd(0, *m_U, mu, (Field_F)f, ex);
178  shift.forward(trf2, trf, m_boundary[mu], mu);
179  vt.mult_GMproj2(1, m_GM[mu], trf2);
180  w.addpart_ex(ex, vt, 0);
181  }
182 }
183 
184 
185 //====================================================================
186 
187 /*
188 void Fopr_Wilson::Fopr_Wilson_impl::mult_p(int mu, Field_F& w, const Field_F& f){
189 
190  Field_F vt(f.nvol(),1);
191 
192  for(int ex = 0; ex < f.nex(); ++ex){
193  vt.setpart_ex(0,f,ex);
194  shift.backward(trf,f,m_boundary[mu],mu);
195  trf2.mult_Field_Gn(0,*m_U,mu,trf,0);
196  vt.mult_GMproj2(-1,m_GM[mu],trf2);
197  w.addpart_ex(ex,vt,0);
198  }
199 
200 }
201 //====================================================================
202 void Fopr_Wilson::Fopr_Wilson_impl::mult_m(int mu, Field_F& w, const Field_F& f){
203 
204  Field_F vt(f.nvol(),1);
205 
206  for(int ex = 0; ex < f.nex(); ++ex){
207  trf.mult_Field_Gd(0,*m_U,mu,f,ex);
208  shift.forward(trf2,trf,m_boundary[mu],mu);
209  vt.mult_GMproj2( 1,m_GM[mu],trf2);
210  w.addpart_ex(ex,vt,0);
211  }
212 
213 }
214 */
215 //====================================================================
216 //============================================================END=====