Bridge++  Ver. 2.0.2
fopr_Rational_SF.h
Go to the documentation of this file.
1 
15 #ifndef FOPR_RATIONAL_SF_INCLUDED
16 #define FOPR_RATIONAL_SF_INCLUDED
17 
18 #include "fopr_Rational.h"
19 
20 #include "Field/field_SF.h"
21 #include "Solver/shiftsolver_CG.h"
22 
23 #include "IO/bridgeIO.h"
24 using Bridge::vout;
25 
27 
44 class Fopr_Rational_SF : public Fopr
45 {
46  public:
47  static const std::string class_name;
48 
49  private:
51 
52  int m_Np; // number of poles in rational approx.
53  int m_n_exp, m_d_exp; // numerator and denominator of the exponent
54  double m_x_min, m_x_max; // valid range of approximate sign function
55  int m_Niter; // max iteration of shiftsolver
56  double m_Stop_cond; // stopping condition of shift solver
57 
60 
61  double m_a0;
62  std::vector<double> m_cl;
63  std::vector<double> m_bl;
64  std::vector<Field> m_xq;
65 
66  public:
67 
69  : m_vl(CommonParameters::Vlevel()), m_fopr(fopr) {}
70 
71  Fopr_Rational_SF(Fopr *fopr, const Parameters& params)
72  : m_vl(CommonParameters::Vlevel()), m_fopr(fopr)
73  {
74  set_parameters(params);
75  }
76 
78  {
79  delete m_solver;
80  }
81 
82  void set_parameters(const Parameters& params);
83  void set_parameters(const int Np, const int n_exp, const int d_exp, const double x_min, const double x_max,
84  const int Niter, const double Stop_cond);
85 
86  void get_parameters(Parameters& params) const;
87 
88  void set_config(Field *U)
89  {
90  m_fopr->set_config(U);
91  }
92 
93  void mult(Field& v, const Field& f);
94 
95  void mult_dag(Field& v, const Field& f)
96  {
97  mult(v, f);
98  }
99 
100  double func(const double x);
101 
102  int field_nvol() { return m_fopr->field_nvol(); }
103  int field_nin() { return m_fopr->field_nin(); }
104  int field_nex() { return m_fopr->field_nex(); }
105 
107  double flop_count();
108 
109  private:
110  void init_parameters();
111 
112 #ifdef USE_FACTORY
113  private:
114  static Fopr *create_object(Fopr *fopr)
115  {
116  return new Fopr_Rational_SF(fopr);
117  }
118 
119  static Fopr *create_object_with_params(Fopr *fopr, const Parameters& params)
120  {
121  return new Fopr_Rational_SF(fopr, params);
122  }
123 
124  public:
125  static bool register_factory()
126  {
127  bool init = true;
128  init &= Fopr::Factory_fopr::Register("Rational_SF", create_object);
129  init &= Fopr::Factory_fopr_params::Register("Rational_SF", create_object_with_params);
130  return init;
131  }
132 #endif
133 };
134 #endif
bridgeIO.h
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
AFopr
Definition: afopr.h:48
Fopr_Rational_SF::~Fopr_Rational_SF
~Fopr_Rational_SF()
Definition: fopr_Rational_SF.h:77
Parameters
Class for parameters.
Definition: parameters.h:46
Fopr_Rational_SF::init_parameters
void init_parameters()
Definition: fopr_Rational_SF.cpp:116
Fopr_Rational_SF::m_Np
int m_Np
Definition: fopr_Rational_SF.h:52
AFopr::field_nex
virtual int field_nex()=0
returns the external degree of freedom of the fermion field.
Fopr_Rational_SF::m_d_exp
int m_d_exp
Definition: fopr_Rational_SF.h:53
Fopr_Rational_SF::get_parameters
void get_parameters(Parameters &params) const
gets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Rational_SF.cpp:58
Fopr_Rational_SF::m_fopr
Fopr * m_fopr
Definition: fopr_Rational_SF.h:58
Fopr_Rational_SF::m_x_min
double m_x_min
Definition: fopr_Rational_SF.h:54
Fopr_Rational_SF::m_a0
double m_a0
Definition: fopr_Rational_SF.h:61
shiftsolver_CG.h
Fopr_Rational_SF::set_config
void set_config(Field *U)
sets the gauge configuration.
Definition: fopr_Rational_SF.h:88
Fopr_Rational_SF::mult_dag
void mult_dag(Field &v, const Field &f)
hermitian conjugate of mult.
Definition: fopr_Rational_SF.h:95
AFopr::set_config
virtual void set_config(Field *)=0
sets the gauge configuration.
Fopr_Rational_SF::m_solver
Shiftsolver_CG * m_solver
Definition: fopr_Rational_SF.h:59
Fopr_Rational_SF::flop_count
double flop_count()
this returns the number of floating point operations.
Definition: fopr_Rational_SF.cpp:203
Fopr_Rational_SF
Fermion operator for rational approximation.
Definition: fopr_Rational_SF.h:44
AFopr::field_nvol
virtual int field_nvol()=0
returns the volume of the fermion field.
Fopr_Rational_SF::m_bl
std::vector< double > m_bl
Definition: fopr_Rational_SF.h:63
Fopr_Rational_SF::Fopr_Rational_SF
Fopr_Rational_SF(Fopr *fopr)
Definition: fopr_Rational_SF.h:68
Fopr_Rational_SF::field_nvol
int field_nvol()
returns the volume of the fermion field.
Definition: fopr_Rational_SF.h:102
Fopr_Rational_SF::set_parameters
void set_parameters(const Parameters &params)
sets parameters by a Parameter object: to be implemented in a subclass.
Definition: fopr_Rational_SF.cpp:25
field_SF.h
Fopr_Rational_SF::class_name
static const std::string class_name
Definition: fopr_Rational_SF.h:47
Fopr_Rational_SF::mult
void mult(Field &v, const Field &f)
Definition: fopr_Rational_SF.cpp:158
Fopr_Rational_SF::field_nex
int field_nex()
returns the external degree of freedom of the fermion field.
Definition: fopr_Rational_SF.h:104
Fopr_Rational_SF::m_Niter
int m_Niter
Definition: fopr_Rational_SF.h:55
Fopr_Rational_SF::m_cl
std::vector< double > m_cl
Definition: fopr_Rational_SF.h:62
Fopr_Rational_SF::m_vl
Bridge::VerboseLevel m_vl
Definition: fopr_Rational_SF.h:50
fopr_Rational.h
Fopr_Rational_SF::m_Stop_cond
double m_Stop_cond
Definition: fopr_Rational_SF.h:56
Fopr_Rational_SF::m_x_max
double m_x_max
Definition: fopr_Rational_SF.h:54
Fopr_Rational_SF::m_xq
std::vector< Field > m_xq
Definition: fopr_Rational_SF.h:64
Fopr_Rational_SF::func
double func(const double x)
Definition: fopr_Rational_SF.cpp:190
Fopr_Rational_SF::m_n_exp
int m_n_exp
Definition: fopr_Rational_SF.h:53
Field
Container of Field-type object.
Definition: field.h:46
AFopr::field_nin
virtual int field_nin()=0
returns the on-site degree of freedom of the fermion field.
AShiftsolver_CG
Multishift Conjugate Gradient solver.
Definition: ashiftsolver_CG.h:32
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
Fopr_Rational_SF::Fopr_Rational_SF
Fopr_Rational_SF(Fopr *fopr, const Parameters &params)
Definition: fopr_Rational_SF.h:71
Fopr_Rational_SF::field_nin
int field_nin()
returns the on-site degree of freedom of the fermion field.
Definition: fopr_Rational_SF.h:103
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512