Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Clover_eo.h
Go to the documentation of this file.
1 
14 #ifndef FOPR_CLOVER_EO_INCLUDED
15 #define FOPR_CLOVER_EO_INCLUDED
16 
17 #include <valarray>
18 #include <vector>
19 #include <string>
20 
21 #include "fopr_Wilson_eo.h"
22 #include "fopr_CloverTerm_eo.h"
23 
24 #include "solver_CG.h"
25 
26 #include "bridgeIO.h"
27 using Bridge::vout;
28 
29 //- parameters class
30 class Parameters_Fopr_Clover_eo : virtual public Parameters
31 {
32  public:
34 };
35 //- end
36 
38 
50 class Fopr_Clover_eo : public Fopr_eo
51 {
52  private:
54  double m_kappa, m_cSW;
55  std::valarray<int> m_boundary;
56  std::string m_mode;
57 
60 
63 
65 
69 
70  void (Fopr_Clover_eo::*m_mult) (Field&, const Field&);
71  void (Fopr_Clover_eo::*m_mult_dag) (Field&, const Field&);
72  void (Fopr_Clover_eo::*m_preProp) (Field&, Field&, const Field&);
73  void (Fopr_Clover_eo::*m_postProp) (Field&, const Field&, const Field&);
74 
75  public:
76  Fopr_Clover_eo(std::string repr)
77  {
79  m_Nvol2 = m_Nvol / 2;
83  m_boundary.resize(m_Ndim);
84 
85  m_fee_inv = new Field_F(m_Nvol2, m_Nc * m_Nd);
86  m_foo_inv = new Field_F(m_Nvol2, m_Nc * m_Nd);
87 
88  m_Ueo = new Field_G(m_Nvol, m_Ndim);
89 
90  m_fopr_w = new Fopr_Wilson_eo(repr);
91  m_fopr_csw = new Fopr_CloverTerm_eo(repr);
92  }
93 
95  {
96  delete m_fopr_w;
97  delete m_fopr_csw;
98 
99  delete m_Ueo;
100 
101  delete m_foo_inv;
102  delete m_fee_inv;
103  }
104 
105  void set_parameters(const Parameters& params);
106  void set_parameters(const double kappa, const double cSW,
107  const std::valarray<int> bc);
108  void set_config(Field *U);
109 
110  void set_mode(std::string mode)
111  {
112  m_mode = mode;
113 
114  if (m_mode == "D") {
119  } else if (m_mode == "Ddag") {
124  } else if (m_mode == "DdagD") {
127  } else if (m_mode == "H") {
130  } else {
131  vout.crucial("Fopr_Clover_eo: undefined mode = %s\n", mode.c_str());
132  abort();
133  }
134  }
135 
136  std::string get_mode() const
137  {
138  return m_mode;
139  }
140 
141  const Field mult(const Field& f)
142  {
143  Field v(f.nin(), f.nvol(), f.nex());
144 
145  mult(v, f);
146  return v;
147  }
148 
149  const Field mult_dag(const Field& f)
150  {
151  Field v(f.nin(), f.nvol(), f.nex());
152 
153  mult_dag(v, f);
154  return v;
155  }
156 
157  void mult(Field& v, const Field& f)
158  {
159  (this->*m_mult)(v, f);
160  }
161 
162  void mult_dag(Field& v, const Field& f)
163  {
164  (this->*m_mult_dag)(v, f);
165  }
166 
167  //- method for even odd fermion operator
168  void preProp(Field& Be, Field& bo, const Field& b)
169  {
170  (this->*m_preProp)(Be, bo, b);
171  }
172 
173  void postProp(Field& x, const Field& xe, const Field& bo)
174  {
175  (this->*m_postProp)(x, xe, bo);
176  }
177 
178  void prePropD(Field&, Field&, const Field&);
179  void postPropD(Field&, const Field&, const Field&);
180  void prePropDag(Field&, Field&, const Field&);
181  void postPropDag(Field&, const Field&, const Field&);
182 
183  const Field_F mult_csw_inv(const Field_F&, const int ieo);
184  const Field_G trSigmaInv(const int mu, const int nu);
185 
186  const Field MeoMoe(const Field& f)
187  {
188  Field_F v((Field_F)f);
189 
190  v -= Meo(Meo(f, 1), 0);
191  return (Field)v;
192  }
193 
194  const Field D(const Field& f)
195  {
196  Field v(f.nin(), f.nvol(), f.nex());
197 
198  D(v, f);
199  return v;
200  }
201 
202  void D(Field& v, const Field& f)
203  {
204  v = f;
205  v -= (Field)Meo(Meo(f, 1), 0);
206  }
207 
208  const Field Ddag(const Field& f)
209  {
210  Field v(f.nin(), f.nvol(), f.nex());
211 
212  Ddag(v, f);
213  return v;
214  }
215 
216  void Ddag(Field& v, const Field& f)
217  {
218  v = f;
219  v -= (Field)Mdageo(Mdageo(f, 1), 0);
220  }
221 
222  const Field DdagD(const Field& f)
223  {
224  Field v(f.nin(), f.nvol(), f.nex());
225 
226  DdagD(v, f);
227  return v;
228  }
229 
230  void DdagD(Field& v, const Field& f)
231  {
232  v = Ddag(D(f));
233  }
234 
235  const Field H(const Field& f)
236  {
237  Field v(f.nin(), f.nvol(), f.nex());
238 
239  H(v, f);
240  return v;
241  }
242 
243  void H(Field& v, const Field& f)
244  {
245  v = mult_gm5(D(f));
246  }
247 
248  inline const Field_F Meo(const Field_F& f, const int ieo)
249  {
250  // ieo=0: even <-- odd
251  // ieo=1: odd <-- even
252  return mult_csw_inv(m_fopr_w->Meo(f, ieo), ieo);
253  }
254 
255  inline const Field_F Meo_gm5(const Field_F& f, const int ieo)
256  {
257  return mult_gm5(Meo(f, ieo));
258  }
259 
260  inline const Field_F Mdageo(const Field_F& f, const int ieo)
261  {
262  return mult_csw_inv(m_fopr_w->Mdageo(f, ieo), ieo);
263  }
264 
265  inline const Field mult_gm5(const Field& f)
266  {
267  return m_fopr_w->mult_gm5(f);
268  }
269 
270  inline void mult_isigma(Field_F& w, const Field_F& f,
271  const int mu, const int nu)
272  {
273  return m_fopr_csw->mult_isigma(w, f, mu, nu);
274  }
275 
276  inline std::vector<double> csmatrix(const int& site)
277  {
278  return m_fopr_csw->csmatrix(site);
279  }
280 
281  int field_nvol() { return CommonParameters::Nvol() / 2; }
283  int field_nex() { return 1; }
284 
285  private:
286  void solve_csw_inv();
287 };
288 #endif