Bridge++  Ver. 2.0.2
asolver_Richardson.h
Go to the documentation of this file.
1 
15 #ifndef ASOLVER_RICHARDSON_H
16 #define ASOLVER_RICHARDSON_H
17 
18 #include <string>
19 
20 #include "asolver.h"
21 #include "lib/Fopr/afopr.h"
22 #include "aprecond.h"
23 
24 /*
25  preconditionted Rihcradson iteration
26 
27  */
28 
29 template<typename AFIELD>
30 class ASolver_Richardson : public ASolver<AFIELD>
31 {
32  public:
33  typedef typename AFIELD::real_t real_t;
35  static const std::string class_name;
37 
38 
39  private:
40 
43 
44  int m_Niter;
47 
50 
51 
52  protected:
53 
55  int m_nconv;
56 
58 
61 
62  public:
67  {
68  m_fopr = fopr;
69  m_prec = prec;
70  init();
71  }
72 
75 
77  void set_parameters(const Parameters& params);
78 
80  void set_parameters(const int Niter, const real_t Stop_cond);
81 
83  void set_parameters(const int Niter, const real_t Stop_cond, const InitialGuess init_guess_mode);
84 
86  void set_parameters(const int Niter, const real_t Stop_cond, const bool use_init_guess);
87 
89  void solve(AFIELD& xq, const AFIELD& b, int& nconv, real_t& diff);
90 
93 
95  double flop_count();
96 
97  protected:
98 
100  void init(void);
101 
103  void tidyup(void);
104 
105  void solve_init(const AFIELD& b, const AFIELD& xq, real_t& rr);
106 
107  // void solve(real_t& rr, coeff_t &prev);
108 
109  void prec(AFIELD&, AFIELD&);
110 
111  double flop_count_intermediate(const int iter);
112 
113  /*
114 #ifdef USE_FACTORY
115  private:
116  static ASolver<AFIELD> *create_object_with_fopr(AFopr<AFIELD>* fopr)
117  { return new ASolver_Richardson<AFIELD>(fopr); }
118 
119  public:
120  static bool register_factory()
121  {
122  bool init = ASolver<AFIELD>::Factory_fopr::Register("ASolver_Richardson",
123  create_object_with_fopr);
124  return init;
125  }
126 #endif
127  */
128 };
129 
130 #endif // ASOLVER_RICHARDSON_H
ASolver_Richardson::solve_init
void solve_init(const AFIELD &b, const AFIELD &xq, real_t &rr)
Definition: asolver_Richardson-tmpl.h:218
ASolver_Richardson::class_name
static const std::string class_name
Definition: asolver_Richardson.h:35
ASolver_Richardson::m_Stop_cond2
real_t m_Stop_cond2
stopping criterion for inner solver.
Definition: asolver_Richardson.h:46
ASolver_Richardson::m_nconv
int m_nconv
to remember convergence iteration to provide flop count.
Definition: asolver_Richardson.h:55
AFopr
Definition: afopr.h:48
ASolver
Definition: asolver.h:23
ASolver_Richardson::tidyup
void tidyup(void)
final tidy-up.
Definition: asolver_Richardson-tmpl.h:40
Parameters
Class for parameters.
Definition: parameters.h:46
ASolver_Richardson::flop_count
double flop_count()
returns the floating point operation count.
Definition: asolver_Richardson-tmpl.h:227
ASolver_Richardson::flop_count_intermediate
double flop_count_intermediate(const int iter)
Definition: asolver_Richardson-tmpl.h:235
APrecond
Definition: aprecond.h:28
ASolver_Richardson::m_s
AFIELD m_s
Definition: asolver_Richardson.h:49
ASolver_Richardson::m_prec
APrecond< AFIELD > * m_prec
preconditioner.
Definition: asolver_Richardson.h:42
ASolver_Richardson::ASolver_Richardson
ASolver_Richardson()
calling constructor without fermion operator is forbidden.
Definition: asolver_Richardson.h:60
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
ASolver_Richardson::get_afopr
AFopr< AFIELD > * get_afopr()
returns the pointer to the fermion operator.
Definition: asolver_Richardson.h:92
Field::real_t
double real_t
Definition: field.h:51
ASolver_Richardson::prec
void prec(AFIELD &, AFIELD &)
ASolver_Richardson::m_r
AFIELD m_r
Matsufuru added: new AField_dev implementation.
Definition: asolver_Richardson.h:49
ASolver_Richardson::~ASolver_Richardson
~ASolver_Richardson()
destructor.
Definition: asolver_Richardson.h:74
ASolver::ZERO
@ ZERO
Definition: asolver.h:31
ASolver_Richardson::solve
void solve(AFIELD &xq, const AFIELD &b, int &nconv, real_t &diff)
solver main.
Definition: asolver_Richardson-tmpl.h:131
ASolver_Richardson::m_Niter
int m_Niter
maximum iteration number.
Definition: asolver_Richardson.h:44
ASolver_Richardson::m_Stop_cond
real_t m_Stop_cond
stopping criterion (squared).
Definition: asolver_Richardson.h:45
ASolver_Richardson::init
void init(void)
initial setup.
Definition: asolver_Richardson-tmpl.h:24
ASolver_Richardson::ASolver_Richardson
ASolver_Richardson(AFopr< AFIELD > *fopr, APrecond< AFIELD > *prec)
constructor.
Definition: asolver_Richardson.h:64
aprecond.h
ASolver_Richardson::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: asolver_Richardson-tmpl.h:49
ASolver_Richardson::m_initial_mode
InitialGuess m_initial_mode
Definition: asolver_Richardson.h:57
ASolver_Richardson::m_fopr
AFopr< AFIELD > * m_fopr
fermion operator.
Definition: asolver_Richardson.h:41
ASolver::InitialGuess
InitialGuess
Definition: asolver.h:31
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
ASolver_Richardson
Definition: asolver_Richardson.h:30
asolver.h
ASolver::real_t
AFIELD::real_t real_t
Definition: asolver.h:29
ASolver_Richardson::InitialGuess
typename ASolver< AFIELD >::InitialGuess InitialGuess
Definition: asolver_Richardson.h:36
ASolver_Richardson::real_t
AFIELD::real_t real_t
Definition: asolver_Richardson.h:33