Bridge++  Ver. 2.0.2
ashiftsolver_CG.h
Go to the documentation of this file.
1 
14 #ifndef ASHIFTSOLVER_CG_INCLUDED
15 #define ASHIFTSOLVER_CG_INCLUDED
16 
17 #include "Solver/ashiftsolver.h"
18 
19 #include "IO/bridgeIO.h"
20 using Bridge::vout;
21 
22 
24 
31 template<typename FIELD, typename FOPR>
32 class AShiftsolver_CG : public AShiftsolver<FIELD>
33 {
34  public:
35  typedef typename FIELD::real_t real_t;
36 
37  static const std::string class_name;
38 
39  private:
41 
42  FOPR *m_fopr;
43 
44  int m_Niter;
45  double m_Stop_cond;
46 
47  std::vector<FIELD> m_x, m_p;
48  FIELD m_r, m_s;
49  std::vector<double> m_zeta1, m_zeta2, m_csh2, m_pp;
50 
52  int m_Nshift2;
53 
54  double m_sigma0;
55 
56  public:
57 
58  AShiftsolver_CG(FOPR *fopr)
59  : m_vl(CommonParameters::Vlevel()),
60  m_fopr(fopr) {}
61 
62  AShiftsolver_CG(FOPR *fopr, int niter, double stop_cond)
63  : m_vl(CommonParameters::Vlevel()),
64  m_fopr(fopr)
65  { set_parameters(niter, stop_cond); }
66 
68 
69  void set_parameters(const Parameters& params);
70 
71  void set_parameters(const int niter, const double stop_cond);
72 
73  void get_parameters(Parameters& params) const;
74 
75  void solve(
76  std::vector<FIELD>& solution,
77  const std::vector<double>& shift,
78  const FIELD& source,
79  int& Nconv,
80  double& diff);
81 
82  double flop_count();
83 
84  private:
85 
86  void solve_init(double&);
87 
88  void solve_step(double&);
89 
90  void reset_field(const FIELD& b,
91  const std::vector<double>& sigma,
92  const int Nshift);
93 };
94 #endif
AShiftsolver_CG::get_parameters
void get_parameters(Parameters &params) const
Definition: ashiftsolver_CG-tmpl.h:49
AShiftsolver
Shiftsolver class as an abstract base class for multi-shift solvers.
Definition: ashiftsolver.h:26
bridgeIO.h
AShiftsolver_CG::m_Niter
int m_Niter
Definition: ashiftsolver_CG.h:44
CommonParameters
Common parameter class: provides parameters as singleton.
Definition: commonParameters.h:42
AShiftsolver_CG::set_parameters
void set_parameters(const Parameters &params)
Definition: ashiftsolver_CG-tmpl.h:22
AShiftsolver_CG::m_vl
Bridge::VerboseLevel m_vl
Definition: ashiftsolver_CG.h:40
AShiftsolver_CG::AShiftsolver_CG
AShiftsolver_CG(FOPR *fopr)
Definition: ashiftsolver_CG.h:58
Parameters
Class for parameters.
Definition: parameters.h:46
AShiftsolver_CG::solve_init
void solve_init(double &)
Definition: ashiftsolver_CG-tmpl.h:185
ashiftsolver.h
AShiftsolver_CG::m_alpha_p
double m_alpha_p
Definition: ashiftsolver_CG.h:51
AShiftsolver_CG::m_p
std::vector< FIELD > m_p
Definition: ashiftsolver_CG.h:47
AShiftsolver_CG::~AShiftsolver_CG
~AShiftsolver_CG()
Definition: ashiftsolver_CG.h:67
AShiftsolver_CG::m_r
FIELD m_r
Definition: ashiftsolver_CG.h:48
AShiftsolver_CG::solve_step
void solve_step(double &)
Definition: ashiftsolver_CG-tmpl.h:211
AShiftsolver_CG::m_pp
std::vector< double > m_pp
Definition: ashiftsolver_CG.h:49
AShiftsolver_CG::reset_field
void reset_field(const FIELD &b, const std::vector< double > &sigma, const int Nshift)
Definition: ashiftsolver_CG-tmpl.h:286
AShiftsolver_CG::m_x
std::vector< FIELD > m_x
Definition: ashiftsolver_CG.h:47
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AShiftsolver_CG::m_Nshift2
int m_Nshift2
Definition: ashiftsolver_CG.h:52
AShiftsolver_CG::flop_count
double flop_count()
Definition: ashiftsolver_CG-tmpl.h:327
AShiftsolver_CG::m_csh2
std::vector< double > m_csh2
Definition: ashiftsolver_CG.h:49
AShiftsolver_CG::solve
void solve(std::vector< FIELD > &solution, const std::vector< double > &shift, const FIELD &source, int &Nconv, double &diff)
Definition: ashiftsolver_CG-tmpl.h:88
AShiftsolver_CG::class_name
static const std::string class_name
Definition: ashiftsolver_CG.h:37
AShiftsolver_CG::m_beta_p
double m_beta_p
Definition: ashiftsolver_CG.h:51
AShiftsolver_CG::m_zeta2
std::vector< double > m_zeta2
Definition: ashiftsolver_CG.h:49
AShiftsolver_CG::m_Stop_cond
double m_Stop_cond
Definition: ashiftsolver_CG.h:45
AShiftsolver_CG::m_zeta1
std::vector< double > m_zeta1
Definition: ashiftsolver_CG.h:49
AShiftsolver_CG::real_t
FIELD::real_t real_t
Definition: ashiftsolver_CG.h:35
AShiftsolver_CG::m_sigma0
double m_sigma0
Definition: ashiftsolver_CG.h:54
AShiftsolver_CG::m_snorm
double m_snorm
Definition: ashiftsolver_CG.h:51
AShiftsolver_CG::AShiftsolver_CG
AShiftsolver_CG(FOPR *fopr, int niter, double stop_cond)
Definition: ashiftsolver_CG.h:62
AShiftsolver_CG
Multishift Conjugate Gradient solver.
Definition: ashiftsolver_CG.h:32
Bridge::VerboseLevel
VerboseLevel
Definition: bridgeIO.h:42
AShiftsolver_CG::m_s
FIELD m_s
Definition: ashiftsolver_CG.h:48
AShiftsolver_CG::m_fopr
FOPR * m_fopr
Definition: ashiftsolver_CG.h:42
Test_Gauge::shift
int shift(void)
Definition: test_Gauge_Shift.cpp:58
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512