Bridge++  Ver. 2.0.2
afopr_Clover_QWS_dd.h
Go to the documentation of this file.
1 
10 #ifndef QXS_AFOPR_CLOVER_QWS_DD_INCLUDED
11 #define QXS_AFOPR_CLOVER_QWS_DD_INCLUDED
12 
13 #include <cstdio>
14 #include <cstdlib>
15 
16 #include <string>
17 using std::string;
18 
19 #include <vector>
20 using std::vector;
21 
22 #include "lib_alt/Fopr/afopr_dd.h"
23 
26 #include "lib/IO/bridgeIO.h"
27 using Bridge::vout;
28 
31 
33 
36 
37 class Field;
38 
39 template<typename AFIELD>
40 class AFopr_Clover_QWS_dd : public AFopr_dd<AFIELD>
41 {
42  public:
43  typedef typename AFIELD::real_t real_t;
44  static const std::string class_name;
45 
46  protected:
48  int m_Nx, m_Ny, m_Nz, m_Nt, m_Nst;
50 
52  std::vector<int> m_boundary;
53  std::string m_repr;
54 
56 
57  std::vector<int> m_block_size;
58 
59  int m_Ieo;
60 
64 
65  std::string m_mode;
66 
69 
71 
74 
75  int m_Nsize[4];
76  int m_block_sizev[4];
77 
78  int do_comm[4]; // switchs of communication (4=Ndim): (0: n, 1: y).
79  int do_comm_any; // switchs of communication (if any): (0: n, 1: y).
80 
81  std::vector<int> m_bdsize;
82  using allocator_t = typename AFIELD::template aligned_allocator<char>;
84  std::vector<Channel> chsend_up, chrecv_up, chsend_dn, chrecv_dn;
86 
87  public:
90  {
91  init();
92  set_parameters(params);
93  }
94 
97 
99  void set_parameters(const Parameters& params);
100 
102  void set_parameters(real_t CKs, std::vector<int> bc,
103  std::vector<int> block_size);
104 
106  void set_config(Field *u);
107 
109  bool needs_convert() { return true; }
110 
112  void convert(AFIELD& v, const Field& w);
113 
115  void convert(AFIELD& v, const AFIELD& w);
116 
118  void reverse(Field& v, const AFIELD& w);
119 
121  void reverse(AFIELD& v, const AFIELD& w);
122 
124  inline Field *get_conf(void) { return m_conf; }
125 
127  //void set_mode(std::string mode){ m_mode = mode; }
128  void set_mode(std::string mode);
129 
131  std::string get_mode() const;
132 
133  void mult(AFIELD&, const AFIELD&);
134  void mult_dag(AFIELD&, const AFIELD&);
135  void mult_gm5(AFIELD&, const AFIELD&);
136 
137  void project_chiral(AFIELD&, const AFIELD&, int ch);
138 
139  void mult_up(int mu, AFIELD&, const AFIELD&);
140  void mult_dn(int mu, AFIELD&, const AFIELD&);
141 
142  void mult_sap(AFIELD&, const AFIELD&, const int ieo);
143  void mult_dd(AFIELD&, const AFIELD&);
144  void mult_dup(AFIELD&, const AFIELD&, const int mu);
145  void mult_ddn(AFIELD&, const AFIELD&, const int mu);
146 
147  void mult_clv_inv(AFIELD& v);
148  void mult_clv(AFIELD& v);
149 
150  // to be discarded
151  void mult_block_hop(AFIELD& v, const AFIELD& w, const int mu)
152  { mult_dup(v, w, mu); }
153 
155  int field_nin() { return 2 * m_Nc * m_Nd; }
156 
158  int field_nvol() { return m_Nst; }
159 
161  int field_nex() { return 1; }
162 
164  double flop_count() { return flop_count(m_mode); }
165 
167  double flop_count_sap();
168 
170  double flop_count(const std::string mode);
171 
172  private:
174  void init();
175 
177  void tidyup();
178 
180  void setup_channels();
181 
183  void set_boundary();
184 
186  void set_boundary_config(AFIELD&, const int);
187 
189  void set_block_config(AFIELD&);
190 
192  void set_csw();
193 
195  void set_csw_chrot();
196 
198  void set_csw_qws();
199 
200  void solve_csw_qws_inv(Field&, const Field&);
201 
203  void mult_csw(real_t *, real_t *);
204 
205  void DdagD(AFIELD&, const AFIELD&);
206  void Ddag(AFIELD&, const AFIELD&);
207  void H(AFIELD&, const AFIELD&);
208  void D(AFIELD&, const AFIELD&);
209 
210  void mult_gm4(AFIELD&, const AFIELD&);
211 
213  void mult_D(AFIELD&, const AFIELD&);
214 
216  void mult_D_qws(AFIELD&, const AFIELD&);
217 
219  void mult_D_alt(AFIELD&, const AFIELD&);
220 
221  void mult_xp(real_t *, real_t *, int);
222  void mult_xm(real_t *, real_t *, int);
223  void mult_yp(real_t *, real_t *, int);
224  void mult_ym(real_t *, real_t *, int);
225  void mult_zp(real_t *, real_t *, int);
226  void mult_zm(real_t *, real_t *, int);
227  void mult_tp(real_t *, real_t *, int);
228  void mult_tm(real_t *, real_t *, int);
229 
230  void mult_gm5(real_t *, real_t *);
231 
232  void clear(real_t *);
233 
234  void scal_local(real_t *, real_t);
235  void aypx(real_t, real_t *, real_t *);
236  void gm5_aypx(real_t, real_t *, real_t *);
237 
238 
239 #ifdef USE_FACTORY
240  private:
241  static AFopr<AFIELD> *create_object_with_params(const Parameters& params)
242  { return new AFopr_Clover_QWS_dd(params); }
243 
244  public:
245  static bool register_factory()
246  {
247  bool init1 = AFopr<AFIELD>::Factory_params::Register("Clover_QWS_dd",
248  create_object_with_params);
249  return init1;
250  }
251 #endif
252 };
253 
254 #endif // AFOPR_CLOVER_DD_INCLUDED
AFopr_Clover_QWS_dd::H
void H(AFIELD &, const AFIELD &)
Definition: afopr_Clover_QWS_dd-tmpl.h:1630
AFopr_Clover_QWS_dd::scal_local
void scal_local(real_t *, real_t)
Definition: afopr_Clover_QWS_dd-tmpl.h:1211
AFopr_Clover_QWS_dd::chsend_dn
std::vector< Channel > chsend_dn
Definition: afopr_Clover_QWS_dd.h:84
AFopr_Clover_QWS_dd::m_Nyv
int m_Nyv
Definition: afopr_Clover_QWS_dd.h:49
AFopr_Clover_QWS_dd::m_T
AFIELD m_T
clover term
Definition: afopr_Clover_QWS_dd.h:72
AFopr_Clover_QWS_dd::m_repr
std::string m_repr
gamma matrix representation
Definition: afopr_Clover_QWS_dd.h:53
bridgeIO.h
AFopr_Clover_QWS_dd::mult_xm
void mult_xm(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:1742
AFopr_Clover_QWS_dd::m_fopr_csw_chiral
Fopr_CloverTerm * m_fopr_csw_chiral
clover term (corelib)
Definition: afopr_Clover_QWS_dd.h:68
afield.h
AFopr_Clover_QWS_dd::mult_up
void mult_up(int mu, AFIELD &, const AFIELD &)
upward nearest neighbor hopping term.
Definition: afopr_Clover_QWS_dd-tmpl.h:1013
AFopr_Clover_QWS_dd::AFopr_Clover_QWS_dd
AFopr_Clover_QWS_dd(const Parameters &params)
constructor.
Definition: afopr_Clover_QWS_dd.h:89
AFopr
Definition: afopr.h:48
AFopr_Clover_QWS_dd::set_csw
void set_csw()
set_csw now assumes Dirac repr.
Definition: afopr_Clover_QWS_dd-tmpl.h:523
AFopr_Clover_QWS_dd::mult_yp
void mult_yp(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:1813
AFopr_Clover_QWS_dd::m_T_qws
AFIELD m_T_qws
clover term
Definition: afopr_Clover_QWS_dd.h:73
AFopr_Clover_QWS_dd::m_U
AFIELD m_U
copied gauge config. with boundary conditions.
Definition: afopr_Clover_QWS_dd.h:62
AFopr_Clover_QWS_dd::convert
void convert(AFIELD &v, const Field &w)
convert of spinor field (to QWS specific).
Definition: afopr_Clover_QWS_dd-tmpl.h:952
communicator_impl.h
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr_Clover_QWS_dd::m_vl
Bridge::VerboseLevel m_vl
verbose level
Definition: afopr_Clover_QWS_dd.h:55
AFopr_Clover_QWS_dd::mult_clv
void mult_clv(AFIELD &v)
Definition: afopr_Clover_QWS_dd-tmpl.h:1325
AFopr_Clover_QWS_dd::Ddag
void Ddag(AFIELD &, const AFIELD &)
Definition: afopr_Clover_QWS_dd-tmpl.h:1142
AFopr_Clover_QWS_dd::flop_count
double flop_count()
returns floating operation counts.
Definition: afopr_Clover_QWS_dd.h:164
AFopr_Clover_QWS_dd::gm5_aypx
void gm5_aypx(real_t, real_t *, real_t *)
AFopr_Clover_QWS_dd::setup_channels
void setup_channels()
setup channels for communication.
Definition: afopr_Clover_QWS_dd-tmpl.h:92
AFopr_Clover_QWS_dd::class_name
static const std::string class_name
Definition: afopr_Clover_QWS_dd.h:44
AFopr_Clover_QWS_dd::m_conf
Field * m_conf
original gauge config.
Definition: afopr_Clover_QWS_dd.h:61
ChannelSet
ChannelSet class for a collection of channels.
Definition: channel.h:148
AFopr_Clover_QWS_dd::m_Nxv
int m_Nxv
Definition: afopr_Clover_QWS_dd.h:49
AFopr_Clover_QWS_dd::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Clover_QWS_dd-tmpl.h:1169
AFopr_Clover_QWS_dd::field_nin
int field_nin()
returns inner size parameter.
Definition: afopr_Clover_QWS_dd.h:155
AFopr_Clover_QWS_dd::tidyup
void tidyup()
final tidy-up.
Definition: afopr_Clover_QWS_dd-tmpl.h:126
AFopr_Clover_QWS_dd::field_nex
int field_nex()
returns external size parameter.
Definition: afopr_Clover_QWS_dd.h:161
AFopr_Clover_QWS_dd::mult_clv_inv
void mult_clv_inv(AFIELD &v)
Definition: afopr_Clover_QWS_dd-tmpl.h:1304
AFopr_Clover_QWS_dd::chset_send
ChannelSet chset_send
Definition: afopr_Clover_QWS_dd.h:85
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Clover_QWS_dd::mult_zp
void mult_zp(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:1959
AFopr_Clover_QWS_dd< Field >::allocator_t
typename Field ::template aligned_allocator< char > allocator_t
Definition: afopr_Clover_QWS_dd.h:82
AFopr_Clover_QWS_dd::do_comm_any
int do_comm_any
Definition: afopr_Clover_QWS_dd.h:79
AFopr_Clover_QWS_dd::chrecv_up
std::vector< Channel > chrecv_up
Definition: afopr_Clover_QWS_dd.h:84
AFopr_Clover_QWS_dd::mult_tm
void mult_tm(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:2157
AFopr_dd
Base class of fermion operator family.
Definition: afopr_dd.h:24
AFopr_Clover_QWS_dd::m_block_size
std::vector< int > m_block_size
block size
Definition: afopr_Clover_QWS_dd.h:57
AFopr_Clover_QWS_dd::m_Nx
int m_Nx
Definition: afopr_Clover_QWS_dd.h:48
AFopr_Clover_QWS_dd::m_Nvc
int m_Nvc
Definition: afopr_Clover_QWS_dd.h:47
AFopr_Clover_QWS_dd::init
void init()
initial setup.
Definition: afopr_Clover_QWS_dd-tmpl.h:22
Field::real_t
double real_t
Definition: field.h:51
AFopr_Clover_QWS_dd::set_config
void set_config(Field *u)
setting gauge configuration.
Definition: afopr_Clover_QWS_dd-tmpl.h:250
AFopr_Clover_QWS_dd::D
void D(AFIELD &, const AFIELD &)
Definition: afopr_Clover_QWS_dd-tmpl.h:1118
AFopr_Clover_QWS_dd::mult_ddn
void mult_ddn(AFIELD &, const AFIELD &, const int mu)
Downward hopping part of mult.
Definition: afopr_Clover_QWS_dd-tmpl.h:1555
afopr_dd.h
AFopr_Clover_QWS_dd::field_nvol
int field_nvol()
returns local volume size parameter.
Definition: afopr_Clover_QWS_dd.h:158
AFopr_Clover_QWS_dd::set_csw_qws
void set_csw_qws()
set_csw to use qws implemenation
Definition: afopr_Clover_QWS_dd-tmpl.h:693
AFopr_Clover_QWS_dd::m_Ny
int m_Ny
Definition: afopr_Clover_QWS_dd.h:48
AFopr_Clover_QWS_dd::m_Nst
int m_Nst
Definition: afopr_Clover_QWS_dd.h:48
AFopr_Clover_QWS_dd::m_CKs
real_t m_CKs
hopping parameter.
Definition: afopr_Clover_QWS_dd.h:51
AFopr_Clover_QWS_dd::real_t
AFIELD::real_t real_t
Definition: afopr_Clover_QWS_dd.h:43
aindex_lex.h
AFopr_Clover_QWS_dd::clear
void clear(real_t *)
Definition: afopr_Clover_QWS_dd-tmpl.h:1657
AFopr_Clover_QWS_dd::m_Ublock
AFIELD m_Ublock
copied gauge config. with block condition.
Definition: afopr_Clover_QWS_dd.h:63
AFopr_Clover_QWS_dd::DdagD
void DdagD(AFIELD &, const AFIELD &)
Definition: afopr_Clover_QWS_dd-tmpl.h:1131
fopr_CloverTerm.h
AFopr_Clover_QWS_dd::chrecv_dn
std::vector< Channel > chrecv_dn
Definition: afopr_Clover_QWS_dd.h:84
AFopr_Clover_QWS_dd::mult_dup
void mult_dup(AFIELD &, const AFIELD &, const int mu)
Upward hopping part of mult.
Definition: afopr_Clover_QWS_dd-tmpl.h:1519
AFopr_Clover_QWS_dd::mult_D_qws
void mult_D_qws(AFIELD &, const AFIELD &)
D mult using QWS library.
Definition: afopr_Clover_QWS_dd-tmpl.h:1460
AFopr_Clover_QWS_dd::set_block_config
void set_block_config(AFIELD &)
inpose the block condition to link variable.
Definition: afopr_Clover_QWS_dd-tmpl.h:473
AFopr_Clover_QWS_dd::~AFopr_Clover_QWS_dd
~AFopr_Clover_QWS_dd()
destructor.
Definition: afopr_Clover_QWS_dd.h:96
AFopr_Clover_QWS_dd::m_v2
AFIELD m_v2
Definition: afopr_Clover_QWS_dd.h:70
AFopr_Clover_QWS_dd::m_Nsize
int m_Nsize[4]
lattice sizes (Nxv in x-direction)
Definition: afopr_Clover_QWS_dd.h:75
AFopr_Clover_QWS_dd::set_mode
void set_mode(std::string mode)
setting mult mode.
Definition: afopr_Clover_QWS_dd-tmpl.h:1067
AFopr_Clover_QWS_dd::needs_convert
bool needs_convert()
QXS version requires convert of spinor field.
Definition: afopr_Clover_QWS_dd.h:109
parameters.h
AFopr_Clover_QWS_dd::project_chiral
void project_chiral(AFIELD &, const AFIELD &, int ch)
Definition: afopr_Clover_QWS_dd-tmpl.h:1152
AFopr_Clover_QWS_dd::mult_ym
void mult_ym(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:1884
AFopr_Clover_QWS_dd::get_conf
Field * get_conf(void)
returns the pointer to gauge configuration.
Definition: afopr_Clover_QWS_dd.h:124
AFopr_Clover_QWS_dd::m_Nc
int m_Nc
Definition: afopr_Clover_QWS_dd.h:47
AFopr_Clover_QWS_dd::m_Nz
int m_Nz
Definition: afopr_Clover_QWS_dd.h:48
AFopr_Clover_QWS_dd::mult_dn
void mult_dn(int mu, AFIELD &, const AFIELD &)
downward nearest neighbor hopping term.
Definition: afopr_Clover_QWS_dd-tmpl.h:1036
AFopr_Clover_QWS_dd::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: afopr_Clover_QWS_dd-tmpl.h:139
AFopr_Clover_QWS_dd::mult_dd
void mult_dd(AFIELD &, const AFIELD &)
Mult only inside domain.
Definition: afopr_Clover_QWS_dd-tmpl.h:1433
AFopr_Clover_QWS_dd::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Clover_QWS_dd-tmpl.h:1080
AFopr_Clover_QWS_dd::m_Ieo
int m_Ieo
even-odd label of origin in units of block
Definition: afopr_Clover_QWS_dd.h:59
AFopr_Clover_QWS_dd::m_Ndim
int m_Ndim
Definition: afopr_Clover_QWS_dd.h:47
AFopr_Clover_QWS_dd::mult_block_hop
void mult_block_hop(AFIELD &v, const AFIELD &w, const int mu)
Definition: afopr_Clover_QWS_dd.h:151
AFopr_Clover_QWS_dd::set_boundary
void set_boundary()
inpose the boundary condition to link variable.
Definition: afopr_Clover_QWS_dd-tmpl.h:372
AFopr_Clover_QWS_dd
Definition: afopr_Clover_QWS_dd.h:40
AFopr_Clover_QWS_dd::set_boundary_config
void set_boundary_config(AFIELD &, const int)
partially inpose the boundary condition to link variable.
Definition: afopr_Clover_QWS_dd-tmpl.h:333
AFopr_Clover_QWS_dd::m_v1
AFIELD m_v1
Definition: afopr_Clover_QWS_dd.h:70
AFopr_Clover_QWS_dd::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Clover_QWS_dd-tmpl.h:1099
AFopr_Clover_QWS_dd::m_boundary
std::vector< int > m_boundary
pointer to boundary condition
Definition: afopr_Clover_QWS_dd.h:52
AFopr_Clover_QWS_dd::mult_D_alt
void mult_D_alt(AFIELD &, const AFIELD &)
D mult using mult_xp, etc.
Definition: afopr_Clover_QWS_dd-tmpl.h:1493
AFopr_Clover_QWS_dd::m_Nd
int m_Nd
Definition: afopr_Clover_QWS_dd.h:47
Org::Fopr_CloverTerm
Definition: fopr_CloverTerm_impl.h:55
AFopr_Clover_QWS_dd::aypx
void aypx(real_t, real_t *, real_t *)
Definition: afopr_Clover_QWS_dd-tmpl.h:1639
AFopr_Clover_QWS_dd::chsend_up
std::vector< Channel > chsend_up
Definition: afopr_Clover_QWS_dd.h:84
AFopr_Clover_QWS_dd::chset_recv
ChannelSet chset_recv
Definition: afopr_Clover_QWS_dd.h:85
commonParameters.h
AFopr_Clover_QWS_dd::m_Ndf
int m_Ndf
Definition: afopr_Clover_QWS_dd.h:47
AFopr_Clover_QWS_dd::mult_csw
void mult_csw(real_t *, real_t *)
set_csw now assumes Dirac repr.
Definition: afopr_Clover_QWS_dd-tmpl.h:1260
AFopr_Clover_QWS_dd::mult_tp
void mult_tp(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:2092
AFopr_Clover_QWS_dd::mult_zm
void mult_zm(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:2025
Field
Container of Field-type object.
Definition: field.h:46
AFopr_Clover_QWS_dd::do_comm
int do_comm[4]
Definition: afopr_Clover_QWS_dd.h:78
AFopr_Clover_QWS_dd::m_Nstv
int m_Nstv
Definition: afopr_Clover_QWS_dd.h:49
communicator.h
AFopr_Clover_QWS_dd::mult_sap
void mult_sap(AFIELD &, const AFIELD &, const int ieo)
SAP operator.
Definition: afopr_Clover_QWS_dd-tmpl.h:1411
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Clover_QWS_dd::solve_csw_qws_inv
void solve_csw_qws_inv(Field &, const Field &)
Definition: afopr_Clover_QWS_dd-tmpl.h:830
AFopr_Clover_QWS_dd::m_mode
std::string m_mode
mult mode
Definition: afopr_Clover_QWS_dd.h:65
AFopr_Clover_QWS_dd::set_csw_chrot
void set_csw_chrot()
set_csw now assumes Dirac repr. with internally using Chiral repr.
Definition: afopr_Clover_QWS_dd-tmpl.h:606
AFopr_Clover_QWS_dd::flop_count_sap
double flop_count_sap()
returns floating operation counts of mult_sap.
Definition: afopr_Clover_QWS_dd-tmpl.h:2249
AFopr_Clover_QWS_dd::m_block_sizev
int m_block_sizev[4]
block size in units of SIMD vector
Definition: afopr_Clover_QWS_dd.h:76
AFopr_Clover_QWS_dd::mult_gm4
void mult_gm4(AFIELD &, const AFIELD &)
Definition: afopr_Clover_QWS_dd-tmpl.h:1227
AFopr_Clover_QWS_dd::m_Nt
int m_Nt
Definition: afopr_Clover_QWS_dd.h:48
AFopr_Clover_QWS_dd::m_bdsize
std::vector< int > m_bdsize
Definition: afopr_Clover_QWS_dd.h:81
AFopr_Clover_QWS_dd::reverse
void reverse(Field &v, const AFIELD &w)
reverse of spinor field (from QWS specific).
Definition: afopr_Clover_QWS_dd-tmpl.h:982
AFopr_Clover_QWS_dd::get_mode
std::string get_mode() const
returns mult mode.
Definition: afopr_Clover_QWS_dd-tmpl.h:1059
AFopr_Clover_QWS_dd::m_fopr_csw
Fopr_CloverTerm * m_fopr_csw
clover term (corelib)
Definition: afopr_Clover_QWS_dd.h:67
AFopr_Clover_QWS_dd::mult_xp
void mult_xp(real_t *, real_t *, int)
Definition: afopr_Clover_QWS_dd-tmpl.h:1673
Channel_impl
Definition: channel.h:86
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
AFopr_Clover_QWS_dd::mult_D
void mult_D(AFIELD &, const AFIELD &)
standard D mult.
Definition: afopr_Clover_QWS_dd-tmpl.h:1346