Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_WilsonGeneral_impl.h
Go to the documentation of this file.
1 
14 #ifndef FOPR_WILSON_GENERAL_IMPL_IMP_INCLUDED
15 #define FOPR_WILSON_GENERAL_IMPL_IMP_INCLUDED
16 
17 #include "Fopr/fopr.h"
18 
19 #include "Field/shiftField_lex.h"
20 #include "Tools/gammaMatrixSet.h"
21 
23 
24 #include "IO/bridgeIO.h"
25 using Bridge::vout;
26 
28 
36 namespace Imp {
37  class Fopr_WilsonGeneral : public Fopr
38  {
39  public:
40  static const std::string class_name;
41 
42  private:
43  // lattice parameters
44  int m_Nc, m_Nd, m_Nvc, m_Ndf;
45  int m_Nx, m_Ny, m_Nz, m_Nt;
46  int m_Nvol, m_Ndim;
47 
48  // physical parameters
50  double m_nu_s, m_r_s;
51  std::vector<int> m_boundary;
52  std::vector<double> m_boundary_each_node;
53 
54  const Field_G *m_U;
55  std::vector<GammaMatrix> m_GM;
56 
58 
59  std::string m_mode;
60  std::string m_repr;
61 
63 
69 
70  public:
71  Fopr_WilsonGeneral() { init("Dirac"); }
72  Fopr_WilsonGeneral(const std::string repr) { init(repr); }
74 
75  void init(const std::string repr);
76 
77  void tidyup();
78 
79  void set_parameters(const Parameters& params);
80  void set_parameters(const double kappa_s, const double kappa_t,
81  const double nu_s, const double r_s,
82  const std::vector<int> bc);
83 
84  void set_config(Field *U)
85  { m_U = (Field_G *)U; }
86 
88  { return set_config(U.get()); }
89 
90  void set_mode(const std::string mode);
91 
92  std::string get_mode() const;
93 
94  inline void mult(Field& v, const Field& f)
95  { (this->*m_mult)(v, f); }
96 
97  inline void mult_dag(Field& v, const Field& f)
98  { (this->*m_mult_dag)(v, f); }
99 
100  inline void mult_gm5(Field& v, const Field& f)
101  { (this->*m_gm5)(v, f); }
102 
103  inline void D(Field& v, const Field& f)
104  { (this->*m_D)(v, f); }
105 
106  inline void Ddag(Field& w, const Field& f)
107  {
108  mult_gm5(w, f);
109  D(m_w1, w);
110  mult_gm5(w, m_w1);
111  }
112 
113  inline void DdagD(Field& w, const Field& f)
114  {
115  D(m_w1, f);
116 
117  // Ddag(w, m_w1);
118  mult_gm5(w, m_w1);
119  D(m_w1, w);
120  mult_gm5(w, m_w1);
121  }
122 
123  inline void DDdag(Field& w, const Field& f)
124  {
125  // Ddag(m_w1, f);
126  mult_gm5(m_w1, f);
127  D(w, m_w1);
128  mult_gm5(m_w1, w);
129 
130  D(w, m_w1);
131  }
132 
133  inline void H(Field& w, const Field& f)
134  {
135  D(m_w1, f);
136  mult_gm5(w, m_w1);
137  }
138 
139  inline void mult_undef(Field&, const Field& f)
140  {
141  vout.crucial(m_vl, "Error at %s: mode undefined.\n", class_name.c_str());
142  exit(EXIT_FAILURE);
143  }
144 
145  inline void D_ex(Field& v, const int ex1,
146  const Field& f, const int ex2)
147  { (this->*m_D_ex)(v, ex1, f, ex2); }
148 
149  const Field_F mult_gm5p(const int mu, const Field_F& w)
150  {
151  mult_gm5p(mu, m_w1, w);
152  return (Field_F)m_w1;
153  }
154 
155  void mult_gm5p(const int mu, Field&, const Field&);
156 
157  // void gm5p(Field_F& v, const int mu, const Field_F& w);
158 
159  void proj_chiral(Field& w, const int ex1,
160  const Field& v, const int ex2, const int ipm);
161 
162  void mult_up(const int mu, Field&, const Field&);
163  void mult_dn(const int mu, Field&, const Field&);
164 
166  { return CommonParameters::Nvol(); }
167  int field_nin()
168  { return 2 * CommonParameters::Nc() * CommonParameters::Nd(); }
169  int field_nex()
170  { return 1; }
171 
172  double flop_count();
173 
174  private:
175  // prohibit copy
178 
179  void (Fopr_WilsonGeneral::*m_mult)(Field&, const Field&);
181  void (Fopr_WilsonGeneral::*m_D)(Field&, const Field&);
182  void (Fopr_WilsonGeneral::*m_gm5)(Field&, const Field&);
185  void (Fopr_WilsonGeneral::*m_D_ex)(Field&, const int,
186  const Field&, const int);
187 
188  void D_chiral(Field&, const Field&);
189  void D_dirac(Field&, const Field&);
190  void gm5_chiral(Field&, const Field&);
191  void gm5_dirac(Field&, const Field&);
192 
193  void D_ex_chiral(Field&, const int ex1, const Field&, const int ex2);
194  void D_ex_dirac(Field&, const int ex1, const Field&, const int ex2);
195 
196  void mult_p(const int mu, Field_F&, const Field_F&);
197  void mult_m(const int mu, Field_F&, const Field_F&);
198 
199  void mult_x_plus(Field&, const Field&);
200  void mult_x_minus(Field&, const Field&);
201  void mult_y_plus(Field&, const Field&);
202  void mult_y_minus(Field&, const Field&);
203  void mult_z_plus(Field&, const Field&);
204  void mult_z_minus(Field&, const Field&);
205 
206  void mult_t_plus_dirac(Field&, const Field&);
207  void mult_t_minus_dirac(Field&, const Field&);
208  void mult_t_plus_chiral(Field&, const Field&);
209  void mult_t_minus_chiral(Field&, const Field&);
210 
211  void daxpy(Field&, const double, const Field&);
212  void daypx(Field&, const double, const Field&);
213  void scal(Field&, const double);
214  void clear(Field&);
215 
216  // member data for threading
217  int m_Mz, m_Mt;
220 
221  struct mult_arg
222  {
223  int isite;
225  int kz0, kz1, kt0, kt1;
226  };
227  std::vector<mult_arg> m_arg;
228 
229  // member functions for threading
230  void setup_thread();
231 
232  void mult_x_plus1_thread(const int, double *, const double *);
233  void mult_x_plus2_thread(const int, double *, const double *);
234  void mult_x_plus_bulk_thread(const int, double *, const double *);
235  void mult_x_minus1_thread(const int, double *, const double *);
236  void mult_x_minus2_thread(const int, double *, const double *);
237  void mult_x_minus_bulk_thread(const int, double *, const double *);
238 
239  void mult_y_plus1_thread(const int, double *, const double *);
240  void mult_y_plus2_thread(const int, double *, const double *);
241  void mult_y_plus_bulk_thread(const int, double *, const double *);
242  void mult_y_minus1_thread(const int, double *, const double *);
243  void mult_y_minus2_thread(const int, double *, const double *);
244  void mult_y_minus_bulk_thread(const int, double *, const double *);
245 
246  void mult_z_plus1_thread(const int, double *, const double *);
247  void mult_z_plus2_thread(const int, double *, const double *);
248  void mult_z_plus_bulk_thread(const int, double *, const double *);
249  void mult_z_minus1_thread(const int, double *, const double *);
250  void mult_z_minus2_thread(const int, double *, const double *);
251  void mult_z_minus_bulk_thread(const int, double *, const double *);
252 
253  void mult_t_plus1_dirac_thread(const int, double *, const double *);
254  void mult_t_plus2_dirac_thread(const int, double *, const double *);
255  void mult_t_plus_bulk_dirac_thread(const int, double *, const double *);
256  void mult_t_minus1_dirac_thread(const int, double *, const double *);
257  void mult_t_minus2_dirac_thread(const int, double *, const double *);
258  void mult_t_minus_bulk_dirac_thread(const int, double *, const double *);
259 
260  void mult_t_plus1_chiral_thread(const int, double *, const double *);
261  void mult_t_plus2_chiral_thread(const int, double *, const double *);
262  void mult_t_plus_bulk_chiral_thread(const int, double *, const double *);
263  void mult_t_minus1_chiral_thread(const int, double *, const double *);
264  void mult_t_minus2_chiral_thread(const int, double *, const double *);
265  void mult_t_minus_bulk_chiral_thread(const int, double *, const double *);
266 
267  void daxpy_thread(const int, double *, const double, const double *);
268  void daypx_thread(const int, double *, const double, const double *);
269  void scal_thread(const int, double *, const double);
270  void clear_thread(const int, double *);
271 
272  void gm5_dirac_thread(const int, double *, const double *);
273  void gm5_chiral_thread(const int, double *, const double *);
274 
275  //- for derivatives
276  // void mult_xpu(Field&, const Field&);
277  // void mult_ypu(Field&, const Field&);
278  // void mult_zpu(Field&, const Field&);
279  // void mult_tpu_dirac(Field&, const Field&);
280  // void mult_tpu_chiral(Field&, const Field&);
281 
282 #ifdef USE_FACTORY
283  private:
284  static Fopr *create_object()
285  {
286  return new Fopr_WilsonGeneral();
287  }
288 
289  static Fopr *create_object_with_repr(const std::string& repr)
290  {
291  return new Fopr_WilsonGeneral(repr);
292  }
293 
294  public:
295  static bool register_factory()
296  {
297  bool init1 = Fopr::Factory_noarg::Register("WilsonGeneral/Imp", create_object);
298  bool init2 = Fopr::Factory_string::Register("WilsonGeneral/Imp", create_object_with_repr);
299 
300  return init1 && init2;
301  }
302 #endif
303  };
304 }
305 #endif /* FOPR_WILSON_GENERAL_IMPL_IMP_INCLUDED */
BridgeIO vout
Definition: bridgeIO.cpp:503
void(Fopr_WilsonGeneral::* m_mult_t_plus)(Field &, const Field &)
void mult_x_minus2_thread(const int, double *, const double *)
void mult_z_minus_bulk_thread(const int, double *, const double *)
void DDdag(Field &w, const Field &f)
void mult_dag(Field &v, const Field &f)
hermitian conjugate of mult(Field&, const Field&).
void mult_x_plus_bulk_thread(const int, double *, const double *)
int field_nin()
returns the on-site d.o.f. for which the fermion operator is defined.
double * vcp1_x_plus
arrays for data transfer.
void clear_thread(const int, double *)
void D_dirac(Field &, const Field &)
void mult_x_plus2_thread(const int, double *, const double *)
void mult_z_minus1_thread(const int, double *, const double *)
void D_ex_chiral(Field &, const int ex1, const Field &, const int ex2)
int field_nvol()
returns the volume for which the fermion operator is defined.
void mult_t_minus2_chiral_thread(const int, double *, const double *)
void(Fopr_WilsonGeneral::* m_mult)(Field &, const Field &)
void mult_m(const int mu, Field_F &, const Field_F &)
void mult_z_minus2_thread(const int, double *, const double *)
Container of Field-type object.
Definition: field.h:45
void H(Field &w, const Field &f)
void mult_t_plus1_dirac_thread(const int, double *, const double *)
void mult_t_plus_dirac(Field &, const Field &)
std::string get_mode() const
only for Fopr_Overlap
void mult_t_plus2_dirac_thread(const int, double *, const double *)
void mult_x_plus(Field &, const Field &)
void set_config(Field *U)
setting pointer to the gauge configuration.
void mult_dn(const int mu, Field &, const Field &)
void mult_y_plus2_thread(const int, double *, const double *)
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
void mult_x_minus_bulk_thread(const int, double *, const double *)
void mult_x_plus1_thread(const int, double *, const double *)
Class for parameters.
Definition: parameters.h:46
double flop_count()
returns the flop in giga unit
void mult_t_minus2_dirac_thread(const int, double *, const double *)
Fopr_WilsonGeneral(const Fopr_WilsonGeneral &)
void D_ex(Field &v, const int ex1, const Field &f, const int ex2)
void gm5_dirac_thread(const int, double *, const double *)
Wilson-type fermion field.
Definition: field_F.h:37
void mult_y_minus2_thread(const int, double *, const double *)
std::vector< GammaMatrix > m_GM
gamma matrices.
void mult_t_minus_dirac(Field &, const Field &)
void mult_t_minus1_dirac_thread(const int, double *, const double *)
void init(const std::string repr)
void mult_z_plus2_thread(const int, double *, const double *)
void set_config(unique_ptr< Field_G > &U)
void DdagD(Field &w, const Field &f)
void daypx_thread(const int, double *, const double, const double *)
void mult_y_minus(Field &, const Field &)
void daxpy_thread(const int, double *, const double, const double *)
void mult_p(const int mu, Field_F &, const Field_F &)
void scal_thread(const int, double *, const double)
void mult_undef(Field &, const Field &f)
SU(N) gauge field.
Definition: field_G.h:38
void gm5_chiral_thread(const int, double *, const double *)
void mult_gm5(Field &v, const Field &f)
gamma_5 multiplication. [31 Mar 2017 H.Matsufuru]
void mult_z_plus_bulk_thread(const int, double *, const double *)
const Field_G * m_U
gauge configuration.
void mult_y_minus1_thread(const int, double *, const double *)
Field m_w2
temporary fields.
void mult_z_plus1_thread(const int, double *, const double *)
pointer get() const
void mult_x_minus(Field &, const Field &)
Fopr_WilsonGeneral(const std::string repr)
void mult_t_plus_chiral(Field &, const Field &)
void mult_t_minus_chiral(Field &, const Field &)
void daypx(Field &, const double, const Field &)
void mult_t_minus1_chiral_thread(const int, double *, const double *)
void(Fopr_WilsonGeneral::* m_mult_dag)(Field &, const Field &)
void mult_x_minus1_thread(const int, double *, const double *)
const Field_F mult_gm5p(const int mu, const Field_F &w)
void mult_y_plus(Field &, const Field &)
void mult_t_plus_bulk_chiral_thread(const int, double *, const double *)
void crucial(const char *format,...)
Definition: bridgeIO.cpp:178
std::vector< double > m_boundary_each_node
b.c. for each node.
void mult_y_plus_bulk_thread(const int, double *, const double *)
void daxpy(Field &, const double, const Field &)
void(Fopr_WilsonGeneral::* m_mult_t_minus)(Field &, const Field &)
void(Fopr_WilsonGeneral::* m_D_ex)(Field &, const int, const Field &, const int)
void mult_t_minus_bulk_dirac_thread(const int, double *, const double *)
void mult_t_minus_bulk_chiral_thread(const int, double *, const double *)
static const std::string class_name
void gm5_chiral(Field &, const Field &)
void set_parameters(const Parameters &params)
VerboseLevel
Definition: bridgeIO.h:42
void mult_t_plus1_chiral_thread(const int, double *, const double *)
void proj_chiral(Field &w, const int ex1, const Field &v, const int ex2, const int ipm)
void Ddag(Field &w, const Field &f)
void mult_t_plus2_chiral_thread(const int, double *, const double *)
std::vector< mult_arg > m_arg
int field_nex()
returns the external d.o.f. for which the fermion operator is defined.
void(Fopr_WilsonGeneral::* m_gm5)(Field &, const Field &)
void D_ex_dirac(Field &, const int ex1, const Field &, const int ex2)
void D(Field &v, const Field &f)
void mult_z_minus(Field &, const Field &)
Base class of fermion operator family.
Definition: fopr.h:46
void scal(Field &, const double)
Fopr_WilsonGeneral & operator=(const Fopr_WilsonGeneral &)
void mult_t_plus_bulk_dirac_thread(const int, double *, const double *)
std::vector< int > m_boundary
boundary condition.
void mult_z_plus(Field &, const Field &)
void gm5_dirac(Field &, const Field &)
void(Fopr_WilsonGeneral::* m_D)(Field &, const Field &)
void mult_y_minus_bulk_thread(const int, double *, const double *)
void mult_up(const int mu, Field &, const Field &)
nearest neighbor hopping term: temporary entry [H.Matsufuru]
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
void mult_y_plus1_thread(const int, double *, const double *)
void D_chiral(Field &, const Field &)