Bridge++  Ver. 2.0.2
asolver_FBiCGStab.h
Go to the documentation of this file.
1 
15 #ifndef ASOLVER_FBICGSTAB_H
16 #define ASOLVER_FBICGSTAB_H
17 
18 #include <string>
19 
20 #include "asolver.h"
21 #include "lib/Fopr/afopr.h"
22 #include "aprecond.h"
23 
24 /*
25  Flexible BiCGStab:
26  a different impelemntation from asolver_BiCGStab_Precond
27  this version allows exiting after each mult (not each 2 mults)
28 
29  */
30 
31 template<typename AFIELD>
32 class ASolver_FBiCGStab : public ASolver<AFIELD>
33 {
34  public:
35  typedef typename AFIELD::real_t real_t;
37  static const std::string class_name;
39 
40  struct coeff_t
41  {
42  std::complex<real_t> rho;
43  std::complex<real_t> alpha;
44  }
45  coeff;
46 
47  private:
48 
51 
52  int m_Niter;
55 
58 
59  // std::complex<real_t> m_rho_prev, m_alpha;
60 
61  protected:
62 
64  int m_nconv;
65 
67 
68  double m_Omega_tolerance = 0.7;
71 
72  public:
77  {
78  m_fopr = fopr;
79  m_prec = prec;
80  init();
81  }
82 
85 
87  void set_parameters(const Parameters& params);
88 
90  void set_parameters(const int Niter, const real_t Stop_cond);
91 
93  void set_parameters(const int Niter, const real_t Stop_cond, const InitialGuess init_guess_mode);
94 
96  void set_parameters(const int Niter, const real_t Stop_cond, const bool use_init_guess);
97 
99  void set_parameters_BiCGStab_series(const real_t Omega_tolerance);
100 
102  void solve(AFIELD& xq, const AFIELD& b, int& nconv, real_t& diff);
103 
106 
108  double flop_count();
109 
110  protected:
111 
113  void init(void);
114 
116  void tidyup(void);
117 
118  void solve_init(const AFIELD& b, const AFIELD& xq, real_t& rr, coeff_t& prev);
119 
120  void solve_step1(real_t& rr, coeff_t& prev);
121  void solve_step2(real_t& rr, coeff_t& prev);
122 
123  void prec(AFIELD&, AFIELD&);
124 
125  double flop_count_intermediate(const int iter);
126 
127  /*
128 #ifdef USE_FACTORY
129  private:
130  static ASolver<AFIELD> *create_object_with_fopr(AFopr<AFIELD>* fopr)
131  { return new ASolver_FBiCGStab<AFIELD>(fopr); }
132 
133  public:
134  static bool register_factory()
135  {
136  bool init = ASolver<AFIELD>::Factory_fopr::Register("ASolver_FBiCGStab",
137  create_object_with_fopr);
138  return init;
139  }
140 #endif
141  */
142 };
143 
144 #endif // ASOLVER_FBICGSTAB_H
ASolver_FBiCGStab::m_Omega_tolerance
double m_Omega_tolerance
Definition: asolver_FBiCGStab.h:68
ASolver_FBiCGStab::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: asolver_FBiCGStab-tmpl.h:57
ASolver_FBiCGStab::m_s
AFIELD m_s
Definition: asolver_FBiCGStab.h:57
ASolver::RHS
@ RHS
Definition: asolver.h:31
AFopr
Definition: afopr.h:48
ASolver
Definition: asolver.h:23
ASolver_FBiCGStab
Definition: asolver_FBiCGStab.h:32
ASolver_FBiCGStab::flop_count_intermediate
double flop_count_intermediate(const int iter)
Definition: asolver_FBiCGStab-tmpl.h:381
ASolver_FBiCGStab::ASolver_FBiCGStab
ASolver_FBiCGStab(AFopr< AFIELD > *fopr, APrecond< AFIELD > *prec)
constructor.
Definition: asolver_FBiCGStab.h:74
Parameters
Class for parameters.
Definition: parameters.h:46
ASolver_FBiCGStab::m_u
AFIELD m_u
Definition: asolver_FBiCGStab.h:57
ASolver_FBiCGStab::m_r
AFIELD m_r
Definition: asolver_FBiCGStab.h:57
APrecond
Definition: aprecond.h:28
ASolver_FBiCGStab::solve_step1
void solve_step1(real_t &rr, coeff_t &prev)
Definition: asolver_FBiCGStab-tmpl.h:289
ASolver_FBiCGStab::m_Stop_cond
real_t m_Stop_cond
stopping criterion (squared).
Definition: asolver_FBiCGStab.h:53
ASolver_FBiCGStab::real_t
AFIELD::real_t real_t
Definition: asolver_FBiCGStab.h:35
ASolver_FBiCGStab::InitialGuess
typename ASolver< AFIELD >::InitialGuess InitialGuess
Definition: asolver_FBiCGStab.h:38
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
ASolver_FBiCGStab::get_afopr
AFopr< AFIELD > * get_afopr()
returns the pointer to the fermion operator.
Definition: asolver_FBiCGStab.h:105
ASolver_FBiCGStab::coeff
struct ASolver_FBiCGStab::coeff_t coeff
ASolver_FBiCGStab::~ASolver_FBiCGStab
~ASolver_FBiCGStab()
destructor.
Definition: asolver_FBiCGStab.h:84
ASolver_FBiCGStab::solve_init
void solve_init(const AFIELD &b, const AFIELD &xq, real_t &rr, coeff_t &prev)
Definition: asolver_FBiCGStab-tmpl.h:248
Field::real_t
double real_t
Definition: field.h:51
ASolver_FBiCGStab::class_name
static const std::string class_name
Definition: asolver_FBiCGStab.h:37
ASolver_FBiCGStab::m_initial_mode
InitialGuess m_initial_mode
Definition: asolver_FBiCGStab.h:66
ASolver_FBiCGStab::init
void init(void)
initial setup.
Definition: asolver_FBiCGStab-tmpl.h:24
ASolver_FBiCGStab::m_fopr
AFopr< AFIELD > * m_fopr
fermion operator.
Definition: asolver_FBiCGStab.h:49
ASolver_FBiCGStab::flop_count
double flop_count()
returns the floating point operation count.
Definition: asolver_FBiCGStab-tmpl.h:373
ASolver_FBiCGStab::m_v
AFIELD m_v
Definition: asolver_FBiCGStab.h:57
ASolver_FBiCGStab::coeff_t::alpha
std::complex< real_t > alpha
Definition: asolver_FBiCGStab.h:43
ASolver_FBiCGStab::m_x
AFIELD m_x
Matsufuru added: new AField_dev implementation.
Definition: asolver_FBiCGStab.h:57
ASolver_FBiCGStab::m_rh
AFIELD m_rh
Definition: asolver_FBiCGStab.h:57
ASolver_FBiCGStab::m_p
AFIELD m_p
Definition: asolver_FBiCGStab.h:57
ASolver_FBiCGStab::m_Stop_cond2
real_t m_Stop_cond2
stopping criterion for inner solver.
Definition: asolver_FBiCGStab.h:54
ASolver_FBiCGStab::m_prec
APrecond< AFIELD > * m_prec
preconditioner.
Definition: asolver_FBiCGStab.h:50
ASolver_FBiCGStab::m_Niter
int m_Niter
maximum iteration number.
Definition: asolver_FBiCGStab.h:52
ASolver_FBiCGStab::solve_step2
void solve_step2(real_t &rr, coeff_t &prev)
Definition: asolver_FBiCGStab-tmpl.h:314
ASolver_FBiCGStab::m_nconv
int m_nconv
to remember convergence iteration to provide flop count.
Definition: asolver_FBiCGStab.h:64
ASolver_FBiCGStab::tidyup
void tidyup(void)
final tidy-up.
Definition: asolver_FBiCGStab-tmpl.h:48
ASolver_FBiCGStab::m_t
AFIELD m_t
Definition: asolver_FBiCGStab.h:57
ASolver_FBiCGStab::coeff_t::rho
std::complex< real_t > rho
Definition: asolver_FBiCGStab.h:42
ASolver_FBiCGStab::ASolver_FBiCGStab
ASolver_FBiCGStab()
calling constructor without fermion operator is forbidden.
Definition: asolver_FBiCGStab.h:70
aprecond.h
ASolver_FBiCGStab::prec
void prec(AFIELD &, AFIELD &)
Definition: asolver_FBiCGStab-tmpl.h:365
ASolver_FBiCGStab::solve
void solve(AFIELD &xq, const AFIELD &b, int &nconv, real_t &diff)
solver main.
Definition: asolver_FBiCGStab-tmpl.h:158
ASolver::InitialGuess
InitialGuess
Definition: asolver.h:31
ASolver_FBiCGStab::set_parameters_BiCGStab_series
void set_parameters_BiCGStab_series(const real_t Omega_tolerance)
setting BiCGStab specific parameters.
Definition: asolver_FBiCGStab-tmpl.h:141
Field
Container of Field-type object.
Definition: field.h:46
afopr.h
asolver.h
ASolver::real_t
AFIELD::real_t real_t
Definition: asolver.h:29
ASolver_FBiCGStab::coeff_t
Definition: asolver_FBiCGStab.h:40