16 #ifdef USE_FACTORY_AUTOREGISTER
18 bool init = Solver_CG::register_factory();
27 const string str_vlevel = params.
get_string(
"verbose_level");
37 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
38 err += params.
fetch_int(
"maximum_number_of_restart", Nrestart);
39 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
40 err += params.
fetch_bool(
"use_initial_guess", use_init_guess);
90 vout.
general(
m_vl,
" use_init_guess = %s\n", use_init_guess ?
"true" :
"false");
113 int& Nconv,
double& diff)
115 const double bnorm2 = b.
norm2();
116 const int bsize = b.
size();
122 bool is_converged =
false;
140 Nconv2 += Nconv_unit;
145 for (
int i_restart = 0; i_restart <
m_Nrestart; i_restart++) {
146 for (
int iter = 0; iter <
m_Niter; iter++) {
150 Nconv2 += Nconv_unit;
182 vout.
crucial(
m_vl,
" iter(final): %8d %22.15e\n", Nconv2, diff2 / bnorm2);
192 diff = sqrt(diff2 / bnorm2);
205 const int Nin = b.
nin();
206 const int Nvol = b.
nvol();
207 const int Nex = b.
nex();
240 const double rr_prev = rr;
245 const double cr = rr_prev / pap;
252 const double rr_ratio = rr / rr_prev;
264 const int Nin =
m_x.
nin();
266 const int Nex =
m_x.
nex();
277 const double gflop_axpy = Nin * Nex * 2 * ((Nvol * NPE) / 1.0e+9);
278 const double gflop_norm = Nin * Nex * 2 * ((Nvol * NPE) / 1.0e+9);
280 double gflop_dot = 0.0;
282 gflop_dot = Nin * Nex * 2 * ((Nvol * NPE) / 1.0e+9);
284 gflop_dot = Nin * Nex * 4 * ((Nvol * NPE) / 1.0e+9);
287 const double gflop_init = gflop_fopr + gflop_axpy + gflop_norm;
288 const double gflop_step = gflop_fopr + gflop_dot + 3 * gflop_axpy + gflop_norm;
289 const double gflop_true_residual = gflop_fopr + gflop_axpy + gflop_norm;
291 const double gflop = gflop_norm + gflop_init
int fetch_bool(const string &key, bool &value) const
void detailed(const char *format,...)
static double epsilon_criterion()
void solve_init(const Field &, double &)
double dot(const Field &y, const Field &x)
void general(const char *format,...)
void reset_field(const Field &)
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
Container of Field-type object.
static const std::string class_name
int fetch_double(const string &key, double &value) const
void solve_step(double &)
void copy(Field &y, const Field &x)
copy(y, x): y = x
int square_non_zero(const double v)
void set_parameters(const Parameters ¶ms)
int fetch_int(const string &key, int &value) const
virtual double flop_count()
returns the flop in giga unit
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
void paranoiac(const char *format,...)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void crucial(const char *format,...)
virtual void mult(Field &, const Field &)=0
multiplies fermion operator to a given field (2nd argument)
element_type field_element_type() const
int non_negative(const int v)
static void assert_single_thread(const std::string &class_name)
assert currently running on single thread.
string get_string(const string &key) const
Bridge::VerboseLevel m_vl
static VerboseLevel set_verbose_level(const std::string &str)