Bridge++  Ver. 2.0.2
asolver_SAP.h
Go to the documentation of this file.
1 
10 #ifndef ASOLVER_SAP_H
11 #define ASOLVER_SAP_H
12 
17 #include <cstdio>
18 #include <cstdlib>
19 #include <vector>
20 using std::vector;
21 #include <string>
22 using std::string;
23 
24 #include "lib_alt/Solver/asolver.h"
25 #include "lib_alt/Fopr/afopr_dd.h"
26 #include "asolver_SAP_MINRES.h"
27 
28 template<typename AFIELD>
29 class ASolver_SAP : public ASolver<AFIELD>
30 {
31  public:
32  typedef typename AFIELD::real_t real_t;
35  static const std::string class_name;
36 
37  protected:
38 
40  AFopr_dd<AFIELD> *m_fopr; // given from outside
41  unique_ptr<ASolver_SAP_MINRES<AFIELD> > m_sap_minres;
42 
43  int m_Niter;
45  int m_Nconv;
46 
47  const int m_min_res_iter = 6;
48  //const int m_min_res_iter = 20;
49 
51  int m_nconv;
52 
55 
58 
59 
60  public:
62  // ASolver_SAP(AFopr<AFIELD>* fopr, const block_index_t *block_index)
63  ASolver_SAP(AFopr_dd<AFIELD> *fopr, const block_index_t *block_index)
64  : m_Niter(0), m_Stop_cond(0.0L)
65  {
66  m_fopr = fopr;
67  m_block_index = block_index;
68  this->init();
69  }
70 
72  ~ASolver_SAP() { this->tidyup(); }
73 
75  void set_parameters(const Parameters& params);
76 
78  void set_parameters(const int Niter, const real_t Stop_cond);
79 
81  void solve(AFIELD& xq, const AFIELD& b, int& nconv, real_t& diff);
82 
84  AFopr<AFIELD> *get_fopr() { return m_fopr; }
85 
87  double flop_count();
88 
89  protected:
90 
91  void init(void);
92 
93  void tidyup(void);
94 };
95 
96 #endif // ASOLVER_SAP_H
97 //============================================================END=====
ASolver_SAP::m_sap_minres
unique_ptr< ASolver_SAP_MINRES< AFIELD > > m_sap_minres
Definition: asolver_SAP.h:41
AFopr
Definition: afopr.h:48
ASolver
Definition: asolver.h:23
ASolver_SAP
Definition: asolver_SAP.h:29
Parameters
Class for parameters.
Definition: parameters.h:46
ASolver_SAP::block_index_t
AIndex_block_lex< real_t, AFIELD::IMPL > block_index_t
Definition: asolver_SAP.h:33
ASolver_SAP::m_Stop_cond
real_t m_Stop_cond
stopping criterion (squared).
Definition: asolver_SAP.h:44
ASolver_SAP::tidyup
void tidyup(void)
Definition: asolver_SAP-tmpl.h:58
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AIndex_block_lex< real_t, AFIELD::IMPL >
AFopr_dd
Base class of fermion operator family.
Definition: afopr_dd.h:24
Field::real_t
double real_t
Definition: field.h:51
ASolver_SAP::init
void init(void)
Definition: asolver_SAP-tmpl.h:36
ASolver_SAP::flop_count
double flop_count()
returns the floating point operation count.
Definition: asolver_SAP-tmpl.h:186
afopr_dd.h
ASolver_SAP::ASolver_SAP
ASolver_SAP()
calling constructor without fermion operator is forbidden.
Definition: asolver_SAP.h:54
ASolver_SAP::ASolver_SAP
ASolver_SAP(AFopr_dd< AFIELD > *fopr, const block_index_t *block_index)
constructor.
Definition: asolver_SAP.h:63
ASolver_SAP::m_p
AFIELD m_p
Definition: asolver_SAP.h:57
ASolver_SAP::m_block_index
const block_index_t * m_block_index
Definition: asolver_SAP.h:39
ASolver_SAP::get_fopr
AFopr< AFIELD > * get_fopr()
returns the pointer to the fermion operator.
Definition: asolver_SAP.h:84
ASolver_SAP::m_r
AFIELD m_r
Definition: asolver_SAP.h:57
ASolver_SAP::m_x
AFIELD m_x
working vectors.
Definition: asolver_SAP.h:57
ASolver_SAP::m_Nconv
int m_Nconv
iteratoin number to calculate flop
Definition: asolver_SAP.h:45
ASolver_SAP::solve
void solve(AFIELD &xq, const AFIELD &b, int &nconv, real_t &diff)
solver main.
Definition: asolver_SAP-tmpl.h:115
ASolver_SAP::~ASolver_SAP
~ASolver_SAP()
destructor.
Definition: asolver_SAP.h:72
ASolver_SAP::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
Definition: asolver_SAP-tmpl.h:67
ASolver_SAP::m_nconv
int m_nconv
to remember convergence iteration to provide flop count.
Definition: asolver_SAP.h:51
asolver_SAP_MINRES.h
ASolver_SAP::class_name
static const std::string class_name
Definition: asolver_SAP.h:35
Field
Container of Field-type object.
Definition: field.h:46
ASolver_SAP::m_fopr
AFopr_dd< AFIELD > * m_fopr
Definition: asolver_SAP.h:40
ASolver_SAP::m_min_res_iter
const int m_min_res_iter
Definition: asolver_SAP.h:47
asolver.h
ASolver_SAP::real_t
AFIELD::real_t real_t
Definition: asolver_SAP.h:32
ASolver< Field >::real_t
Field ::real_t real_t
Definition: asolver.h:29
ASolver_SAP::m_Niter
int m_Niter
maximum iteration number.
Definition: asolver_SAP.h:43