Bridge++  Ver. 2.0.2
asolver_SAP_QWS.h
Go to the documentation of this file.
1 
10 #ifndef ASOLVER_SAP_QWS_H
11 #define ASOLVER_SAP_QWS_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"
26 
27 #ifdef USE_QWSLIB
29 #endif
30 
31 
32 template<typename AFIELD>
33 class ASolver_SAP_QWS : public ASolver<AFIELD>
34 {
35  public:
36  typedef typename AFIELD::real_t real_t;
38  static const std::string class_name;
39 
40  protected:
41 
42  // const block_index_t *m_block_index;
43  AFopr_Clover_QWS_dd<AFIELD> *m_fopr; // given from outside
44 
45  int m_Niter;
47  int m_Nconv;
48  double m_flop;
49  const int m_nm = 10;
50 
52  int m_nconv;
53 
56 
59 
60 #ifdef USE_QWSLIB
61  scs_t *m_s, *m_q;
62 #endif
63 
64  public:
67  : m_Niter(0), m_Stop_cond(0.0L)
68  {
69 #ifndef USE_QWSLIB
70  vout.crucial("%s: USE_QWSLIB is not defined\n", class_name.c_str());
71  exit(EXIT_FAILURE);
72 #endif
73 
74  m_fopr = dynamic_cast<AFopr_Clover_QWS_dd<AFIELD> *>(fopr);
75  if (m_fopr == nullptr) {
76  vout.crucial(m_vl, "asolver_SAP_QWS: bad fopr is given, must be AFopr_Clover_QWS_dd\n");
77  exit(EXIT_FAILURE);
78  }
79  this->init();
80  }
81 
83  ~ASolver_SAP_QWS() { this->tidyup(); }
84 
86  void set_parameters(const Parameters& params);
87 
89  void set_parameters(const int Niter, const real_t Stop_cond);
90 
92  void solve(AFIELD& xq, const AFIELD& b, int& nconv, real_t& diff);
93 
95  AFopr<AFIELD> *get_fopr() { return m_fopr; }
96 
98  double flop_count();
99 
100  protected:
101 
102  void init(void);
103 
104  void tidyup(void);
105 };
106 
107 #endif // ASOLVER_SAP_QWS_H
108 //============================================================END=====
ASolver_SAP_QWS::m_b
AFIELD m_b
Definition: asolver_SAP_QWS.h:58
AFopr
Definition: afopr.h:48
ASolver
Definition: asolver.h:23
ASolver_SAP_QWS::flop_count
double flop_count()
returns the floating point operation count.
ASolver_SAP_QWS::m_Nconv
int m_Nconv
iteratoin number to calculate flop
Definition: asolver_SAP_QWS.h:47
ASolver_SAP_QWS::m_x
AFIELD m_x
working vectors.
Definition: asolver_SAP_QWS.h:58
Parameters
Class for parameters.
Definition: parameters.h:46
ASolver_SAP_QWS::m_r
AFIELD m_r
Definition: asolver_SAP_QWS.h:58
ASolver_SAP_QWS::real_t
AFIELD::real_t real_t
Definition: asolver_SAP_QWS.h:36
afopr_Clover_QWS_dd.h
real_t
double real_t
Definition: bridgeQXS_Clover_coarse_double.cpp:16
AFopr_dd
Base class of fermion operator family.
Definition: afopr_dd.h:24
Field::real_t
double real_t
Definition: field.h:51
qws_lib.h
ASolver_SAP_QWS::init
void init(void)
ASolver_SAP_QWS::tidyup
void tidyup(void)
ASolver::m_vl
Bridge::VerboseLevel m_vl
Definition: asolver.h:26
ASolver_SAP_QWS::m_flop
double m_flop
flop count
Definition: asolver_SAP_QWS.h:48
ASolver_SAP_QWS
Definition: asolver_SAP_QWS.h:33
ASolver_SAP_QWS::set_parameters
void set_parameters(const Parameters &params)
setting parameters by a Parameter object.
ASolver_SAP_QWS::solve
void solve(AFIELD &xq, const AFIELD &b, int &nconv, real_t &diff)
solver main.
ASolver_SAP_QWS::ASolver_SAP_QWS
ASolver_SAP_QWS(AFopr_dd< AFIELD > *fopr)
constructor.
Definition: asolver_SAP_QWS.h:66
ASolver_SAP_QWS::~ASolver_SAP_QWS
~ASolver_SAP_QWS()
destructor.
Definition: asolver_SAP_QWS.h:83
ASolver_SAP_QWS::m_fopr
AFopr_Clover_QWS_dd< AFIELD > * m_fopr
Definition: asolver_SAP_QWS.h:43
AFopr_Clover_QWS_dd
Definition: afopr_Clover_QWS_dd.h:40
ASolver_SAP_QWS::m_Niter
int m_Niter
maximum iteration number.
Definition: asolver_SAP_QWS.h:45
ASolver_SAP_QWS::get_fopr
AFopr< AFIELD > * get_fopr()
returns the pointer to the fermion operator.
Definition: asolver_SAP_QWS.h:95
ASolver_SAP_QWS::m_nm
const int m_nm
fixted iteration for the inner jacobi iteration
Definition: asolver_SAP_QWS.h:49
Bridge::BridgeIO::crucial
void crucial(const char *format,...)
Definition: bridgeIO.cpp:180
ASolver_SAP_QWS::m_Stop_cond
real_t m_Stop_cond
stopping criterion (squared).
Definition: asolver_SAP_QWS.h:46
Field
Container of Field-type object.
Definition: field.h:46
ASolver_SAP_QWS::class_name
static const std::string class_name
Definition: asolver_SAP_QWS.h:38
ASolver_SAP_QWS::m_nconv
int m_nconv
to remember convergence iteration to provide flop count.
Definition: asolver_SAP_QWS.h:52
asolver.h
ASolver::real_t
AFIELD::real_t real_t
Definition: asolver.h:29
Bridge::vout
BridgeIO vout
Definition: bridgeIO.cpp:512
ASolver_SAP_QWS::ASolver_SAP_QWS
ASolver_SAP_QWS()
calling constructor without fermion operator is forbidden.
Definition: asolver_SAP_QWS.h:55