Bridge++  Ver. 2.0.2
afopr_Overlap.h
Go to the documentation of this file.
1 
15 #ifndef AFOPR_OVERLAP_INCLUDED
16 #define AFOPR_OVERLAP_INCLUDED
17 
18 #include "Fopr/afopr_Sign.h"
19 
20 #include "IO/bridgeIO.h"
21 using Bridge::vout;
22 
23 
25 
44 template<typename AFIELD>
45 class AFopr_Overlap : public AFopr<AFIELD>
46 {
47  public:
49  typedef typename AFIELD::real_t real_t;
50  static const std::string class_name;
51 
52  private:
53 
54  // input parameters
57  int m_Np;
60  int m_Niter;
61  double m_Stop_cond;
62  std::vector<int> m_boundary;
63 
64  std::string m_kernel_type;
65  std::string m_repr;
66 
68 
69  std::string m_mode;
70 
71  // local variables
73 
76 
78 
79  //- for low-eigenmode subtraction.
80  int m_Nsbt;
81  std::vector<real_t> *m_ev;
82  std::vector<AFIELD> *m_vk;
83 
84  //- workarea
86 
88 
89  public:
90 
91  AFopr_Overlap(const Parameters& params) { init(params); }
92 
93  AFopr_Overlap(AFOPR *fopr, const Parameters& params)
94  { init(fopr, params); }
95 
98  : m_fopr_w(fopr) { init(); }
99 
101 
102  void set_parameters(const Parameters& params);
103 
104  void set_parameters(const real_t mq, const real_t M0, const int Np,
105  const real_t x_min, const real_t x_max,
106  const int Niter, const real_t Stop_cond,
107  const std::vector<int> bc);
108 
109  void get_parameters(Parameters& params) const;
110 
111  void set_config(Field *U);
112 
113  void set_lowmodes(const int Nsbt, std::vector<real_t> *,
114  std::vector<AFIELD> *);
115 
116  void mult(AFIELD&, const AFIELD&);
117  void mult_dag(AFIELD&, const AFIELD&);
118  void mult_gm5(AFIELD&, const AFIELD&);
119 
120  void set_mode(const std::string mode);
121 
122  std::string get_mode() const { return m_mode; }
123 
124  void H(AFIELD& v, const AFIELD& w);
125  void D(AFIELD& v, const AFIELD& w);
126  void Ddag(AFIELD& v, const AFIELD& w);
127  void DdagD(AFIELD& v, const AFIELD& w);
128 
130  virtual bool needs_convert()
131  { return m_fopr_w->needs_convert(); }
132 
134  virtual void convert(AFIELD& v, const Field& w)
135  { m_fopr_w->convert(v, w); }
136 
138  virtual void reverse(Field& v, const AFIELD& w)
139  { m_fopr_w->reverse(v, w); }
140 
141  int field_nin() { return m_Nin; }
142  int field_nvol() { return m_Nvol; }
143  int field_nex() { return m_Nex; }
144 
146  double flop_count();
147 
149  double flop_count(const std::string mode);
150 
151  private:
152 
153  void init(const Parameters& params);
154 
155  void init(AFOPR *fopr, const Parameters& params);
156 
157  void init();
158 
159  void tidyup();
160 
161 
162 #ifdef USE_FACTORY
163  private:
164  static Fopr *create_object(AFOPR *fopr)
165  { return new AFopr_Overlap<AFIELD>(fopr); }
166 
167  static Fopr *create_object_params(const Parameters& params)
168  { return new AFopr_Overlap<AFIELD>(params); }
169 
170  static Fopr *create_object_fopr_params(AFOPR *fopr,
171  const Parameters& params)
172  { return new AFopr_Overlap<AFIELD>(fopr, params); }
173 
174  public:
175  static bool register_factory()
176  {
177  bool init = true;
178  init &= AFOPR::Factory_fopr::Register("Overlap", create_object);
179  init &= AFOPR::Factory_params::Register("Overlap",
180  create_object_params);
181  init &= AFOPR::Factory_fopr_params::Register("Overlap",
182  create_object_fopr_params);
183  return init;
184  }
185 #endif
186 };
187 #endif
AFopr_Overlap::m_x_max
real_t m_x_max
valid range of approximate sign function
Definition: afopr_Overlap.h:59
AFopr_Overlap::real_t
AFIELD::real_t real_t
Definition: afopr_Overlap.h:49
AFopr_Overlap::m_is_initial_step
bool m_is_initial_step
to avoid redundant setup
Definition: afopr_Overlap.h:87
AFopr_Overlap::m_vk
std::vector< AFIELD > * m_vk
Definition: afopr_Overlap.h:82
bridgeIO.h
AFopr_Overlap::m_w2
AFIELD m_w2
Definition: afopr_Overlap.h:85
AFopr_Overlap::mult_dag
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
Definition: afopr_Overlap-tmpl.h:377
AFopr_Overlap::get_parameters
void get_parameters(Parameters &params) const
gets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Overlap-tmpl.h:293
AFopr_Overlap::~AFopr_Overlap
~AFopr_Overlap()
Definition: afopr_Overlap.h:100
AFopr
Definition: afopr.h:48
AFopr_Overlap::m_Nex
int m_Nex
Definition: afopr_Overlap.h:72
AFopr_Sign
Sign function of a given fermion operator.
Definition: afopr_Sign.h:56
AFopr_Overlap::mult
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
Definition: afopr_Overlap-tmpl.h:357
Parameters
Class for parameters.
Definition: parameters.h:46
AFopr::reverse
virtual void reverse(Field &, const AFIELD &)
converts an alternative field to a Field object.
Definition: afopr.h:184
AFopr_Overlap::AFopr_Overlap
AFopr_Overlap(const Parameters &params)
Definition: afopr_Overlap.h:91
AFopr_Overlap::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: afopr_Overlap.h:143
AFopr_Overlap::reverse
virtual void reverse(Field &v, const AFIELD &w)
reverses to a Field object from other format if necessary.
Definition: afopr_Overlap.h:138
AFopr::convert
virtual void convert(AFIELD &, const Field &)
converts a Field object into other format if necessary.
Definition: afopr.h:177
AFopr_Overlap::m_mq
real_t m_mq
quark mass
Definition: afopr_Overlap.h:55
AFopr_Overlap::init
void init()
Definition: afopr_Overlap-tmpl.h:126
AFopr_Overlap::m_Nvol
int m_Nvol
Definition: afopr_Overlap.h:72
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_Overlap::m_mode
std::string m_mode
mult mode
Definition: afopr_Overlap.h:69
AFopr_Overlap::m_Niter
int m_Niter
max iteration of shiftsolver
Definition: afopr_Overlap.h:60
AFopr_Overlap::m_w0
AFIELD m_w0
Definition: afopr_Overlap.h:85
Field::real_t
double real_t
Definition: field.h:51
AFopr_Overlap::AFOPR
AFopr< AFIELD > AFOPR
Definition: afopr_Overlap.h:48
AFopr_Overlap::set_lowmodes
void set_lowmodes(const int Nsbt, std::vector< real_t > *, std::vector< AFIELD > *)
Definition: afopr_Overlap-tmpl.h:320
AFopr_Overlap::m_Nin
int m_Nin
Definition: afopr_Overlap.h:72
AFopr_Overlap::m_repr
std::string m_repr
gamma-matrix repr. (if given)
Definition: afopr_Overlap.h:65
AFopr_Overlap::m_M0
real_t m_M0
domain-wall height
Definition: afopr_Overlap.h:56
afopr_Sign.h
AFopr_Overlap::m_Np
int m_Np
number of poles in rational approx.
Definition: afopr_Overlap.h:57
AFopr::needs_convert
virtual bool needs_convert()
returns true if additional field conversion is needed.
Definition: afopr.h:174
AFopr_Overlap::class_name
static const std::string class_name
Definition: afopr_Overlap.h:50
AFopr_Overlap::m_x_min
real_t m_x_min
valid range of approximate sign function
Definition: afopr_Overlap.h:58
AFopr_Overlap::m_fopr_w
AFOPR * m_fopr_w
kernel fermion operator.
Definition: afopr_Overlap.h:74
AFopr_Overlap::tidyup
void tidyup()
Definition: afopr_Overlap-tmpl.h:165
AFopr_Overlap::D
void D(AFIELD &v, const AFIELD &w)
Definition: afopr_Overlap-tmpl.h:436
AFopr_Overlap::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: afopr_Overlap-tmpl.h:174
AFopr_Overlap::mult_gm5
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
Definition: afopr_Overlap-tmpl.h:397
AFopr_Overlap::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: afopr_Overlap.h:141
AFopr_Overlap::m_ev
std::vector< real_t > * m_ev
Definition: afopr_Overlap.h:81
AFopr_Overlap::convert
virtual void convert(AFIELD &v, const Field &w)
converts a Field object into other format if necessary.
Definition: afopr_Overlap.h:134
AFopr_Overlap::H
void H(AFIELD &v, const AFIELD &w)
Definition: afopr_Overlap-tmpl.h:417
AFopr_Overlap::m_kernel_type
std::string m_kernel_type
kernel type (if given)
Definition: afopr_Overlap.h:64
AFopr_Overlap::m_vl
Bridge::VerboseLevel m_vl
Definition: afopr_Overlap.h:67
AFopr_Overlap::set_mode
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
Definition: afopr_Overlap-tmpl.h:342
AFopr_Overlap::flop_count
double flop_count()
returns the number of floating point operations.
Definition: afopr_Overlap-tmpl.h:459
AFopr_Overlap::m_Stop_cond
double m_Stop_cond
stopping condition of shift solver
Definition: afopr_Overlap.h:61
AFopr_Overlap::DdagD
void DdagD(AFIELD &v, const AFIELD &w)
Definition: afopr_Overlap-tmpl.h:405
AFopr_Overlap::m_Nsbt
int m_Nsbt
Definition: afopr_Overlap.h:80
AFopr_Overlap::m_kernel_created
bool m_kernel_created
whether kernel is created in this object
Definition: afopr_Overlap.h:75
AFopr_Overlap::AFopr_Overlap
DEPRECATED AFopr_Overlap(AFOPR *fopr)
Definition: afopr_Overlap.h:97
AFopr_Overlap::AFopr_Overlap
AFopr_Overlap(AFOPR *fopr, const Parameters &params)
Definition: afopr_Overlap.h:93
AFopr_Overlap::Ddag
void Ddag(AFIELD &v, const AFIELD &w)
Definition: afopr_Overlap-tmpl.h:426
AFopr_Overlap::m_boundary
std::vector< int > m_boundary
boundary condition
Definition: afopr_Overlap.h:62
AFopr_Overlap
Overlap fermion operator.
Definition: afopr_Overlap.h:45
AFopr_Overlap::m_sign
AFopr_Sign< AFIELD > * m_sign
sign function approximation.
Definition: afopr_Overlap.h:77
AFopr_Overlap::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: afopr_Overlap.h:142
AFopr_Overlap::m_w1
AFIELD m_w1
Definition: afopr_Overlap.h:85
Field
Container of Field-type object.
Definition: field.h:46
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AFopr_Overlap::set_config
void set_config(Field *U)
sets the gauge configuration.
Definition: afopr_Overlap-tmpl.h:312
DEPRECATED
#define DEPRECATED
Definition: configure.h:28
AFopr_Overlap::needs_convert
virtual bool needs_convert()
returns true if additional field conversion is needed.
Definition: afopr_Overlap.h:130
AFopr_Overlap::get_mode
std::string get_mode() const
returns the current mult mode.
Definition: afopr_Overlap.h:122
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512