Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fopr_Rational.h
Go to the documentation of this file.
1 
15 #ifndef FOPR_RATIONAL_INCLUDED
16 #define FOPR_RATIONAL_INCLUDED
17 
18 #include "fopr.h"
19 
20 #include "Field/field_G.h"
21 #include "Solver/shiftsolver_CG.h"
22 #include "Tools/math_Rational.h"
23 
24 #include "IO/bridgeIO.h"
25 using Bridge::vout;
26 
28 
41 class Fopr_Rational : public Fopr
42 {
43  public:
44  static const std::string class_name;
45 
46  private:
47  int m_Np; // number of poles in rational approx.
48  int m_n_exp, m_d_exp; // numerator and denominator of the exponent
49  double m_x_min, m_x_max; // valid range of approximate sign function
50  int m_Niter; // max iteration of shiftsolver
51  double m_Stop_cond; // stopping condition of shift solver
52 
55 
56  double m_a0;
57  std::vector<double> m_cl;
58  std::vector<double> m_bl;
59  std::vector<Field> m_xq;
60 
61  public:
63  : Fopr(), m_fopr(fopr) {}
64 
66  : Fopr(), m_fopr(fopr.get()) {}
67 
69  {
70  delete m_solver;
71  }
72 
73  void set_parameters(const Parameters& params);
74  void set_parameters(const int Np, const int n_exp, const int d_exp, const double x_min, const double x_max,
75  const int Niter, const double Stop_cond);
76 
77  void set_config(Field *U)
78  {
79  m_fopr->set_config(U);
80  }
81 
83  {
84  m_fopr->set_config(U.get());
85  }
86 
87  void mult(Field& v, const Field& f);
88 
89  void mult_dag(Field& v, const Field& f)
90  {
91  mult(v, f);
92  }
93 
94  double func(const double x);
95 
96  int field_nvol() { return m_fopr->field_nvol(); }
97  int field_nin() { return m_fopr->field_nin(); }
98  int field_nex() { return m_fopr->field_nex(); }
99 
100  private:
101  void init_parameters();
102 
103 #ifdef USE_FACTORY
104  private:
105  static Fopr *create_object(Fopr *fopr)
106  {
107  return new Fopr_Rational(fopr);
108  }
109 
110  public:
111  static bool register_factory()
112  {
113  return Fopr::Factory_fopr::Register("Rational", create_object);
114  }
115 #endif
116 };
117 #endif
Fermion operator for rational approximation.
Definition: fopr_Rational.h:41
BridgeIO vout
Definition: bridgeIO.cpp:503
void set_config(unique_ptr< Field_G > &U)
Definition: fopr_Rational.h:82
virtual void set_config(Field *)=0
setting pointer to the gauge configuration.
std::vector< Field > m_xq
Definition: fopr_Rational.h:59
Container of Field-type object.
Definition: field.h:45
Multishift Conjugate Gradient solver.
int field_nvol()
returns the volume for which the fermion operator is defined.
Definition: fopr_Rational.h:96
void init_parameters()
Class for parameters.
Definition: parameters.h:46
void mult(Field &v, const Field &f)
multiplies fermion operator to a given field (2nd argument)
std::vector< double > m_cl
Definition: fopr_Rational.h:57
virtual int field_nin()=0
returns the on-site d.o.f. for which the fermion operator is defined.
double m_Stop_cond
Definition: fopr_Rational.h:51
Shiftsolver_CG * m_solver
Definition: fopr_Rational.h:54
void set_config(Field *U)
setting pointer to the gauge configuration.
Definition: fopr_Rational.h:77
pointer get() const
virtual int field_nex()=0
returns the external d.o.f. for which the fermion operator is defined.
Fopr_Rational(unique_ptr< Fopr > &fopr)
Definition: fopr_Rational.h:65
Fopr_Rational(Fopr *fopr)
Definition: fopr_Rational.h:62
static const std::string class_name
Definition: fopr_Rational.h:44
void set_parameters(const Parameters &params)
double func(const double x)
void mult_dag(Field &v, const Field &f)
hermitian conjugate of mult(Field&, const Field&).
Definition: fopr_Rational.h:89
int field_nin()
returns the on-site d.o.f. for which the fermion operator is defined.
Definition: fopr_Rational.h:97
std::vector< double > m_bl
Definition: fopr_Rational.h:58
int field_nex()
returns the external d.o.f. for which the fermion operator is defined.
Definition: fopr_Rational.h:98
Base class of fermion operator family.
Definition: fopr.h:46
virtual int field_nvol()=0
returns the volume for which the fermion operator is defined.