Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
solver_GMRES_m_Cmplx.h
Go to the documentation of this file.
1 
14 #ifndef SOLVER_GMRES_m_CMPLX_INCLUDED
15 #define SOLVER_GMRES_m_CMPLX_INCLUDED
16 
17 #include "solver.h"
18 
19 #include "IO/bridgeIO.h"
20 using Bridge::vout;
21 
23 
42 {
43  public:
44  static const std::string class_name;
45 
46  private:
48 
49  int m_Niter;
51  double m_Stop_cond;
53 
54  int m_N_M;
55 
56  //- working area
57  double m_beta_prev;
58 
59  std::vector<Field> m_v;
61 
64 
65  public:
67  : Solver(), m_fopr(fopr)
68  {
69  m_use_init_guess = false;
70  m_Nrestart_count = 0;
71  m_Nconv_count = 0;
72  }
73 
75  : Solver(), m_fopr(fopr.get())
76  {
77  m_use_init_guess = false;
78  m_Nrestart_count = 0;
79  m_Nconv_count = 0;
80  }
81 
83 
84  void set_parameters(const Parameters& params);
85  void set_parameters(const int Niter, const int Nrestart, const double Stop_cond);
86  void set_parameters(const int Niter, const int Nrestart, const double Stop_cond, const bool use_init_guess);
87  void set_parameters_GMRES_m(const int N_M);
88 
89  void solve(Field& solution, const Field& source,
90  int& Nconv, double& diff);
91 
92  Fopr *get_fopr() { return m_fopr; }
93 
94  double flop_count();
95 
96  private:
97  void reset_field(const Field&);
98 
99  void solve_init(const Field&, double&);
100  void solve_step(const Field&, double&);
101 
102  void innerprod_c(double& prod_r, double& prod_i,
103  const Field& v, const Field& w);
104 
105  void min_J(std::valarray<dcomplex>& y,
106  std::valarray<dcomplex>& h);
107 
108  int index_ij(const int i, const int j)
109  {
110  return i + (m_N_M + 1) * j;
111  }
112 
113 #ifdef USE_FACTORY
114  private:
115  static Solver *create_object(Fopr *fopr)
116  {
117  return new Solver_GMRES_m_Cmplx(fopr);
118  }
119 
120  public:
121  static bool register_factory()
122  {
123  return Solver::Factory::Register("GMRES_m_Cmplx", create_object);
124  }
125 #endif
126 };
127 #endif
BridgeIO vout
Definition: bridgeIO.cpp:503
std::vector< Field > m_v
static const std::string class_name
Container of Field-type object.
Definition: field.h:45
void solve_init(const Field &, double &)
Class for parameters.
Definition: parameters.h:46
void innerprod_c(double &prod_r, double &prod_i, const Field &v, const Field &w)
GMRES(m) algorithm with complex variables.
int index_ij(const int i, const int j)
Base class for linear solver class family.
Definition: solver.h:36
void reset_field(const Field &)
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
void min_J(std::valarray< dcomplex > &y, std::valarray< dcomplex > &h)
void set_parameters_GMRES_m(const int N_M)
Base class of fermion operator family.
Definition: fopr.h:46
Solver_GMRES_m_Cmplx(unique_ptr< Fopr > &fopr)
void solve_step(const Field &, double &)
void set_parameters(const Parameters &params)