Go to the documentation of this file.
16 #ifdef USE_FACTORY_AUTOREGISTER
18 bool init = Solver_CG::register_factory();
38 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
39 err += params.
fetch_int(
"maximum_number_of_restart", Nrestart);
40 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
41 err += params.
fetch_bool(
"use_initial_guess", use_init_guess);
103 vout.
general(
m_vl,
" use_init_guess = %s\n", use_init_guess ?
"true" :
"false");
126 int& Nconv,
double& diff)
128 const double bnorm2 = b.
norm2();
129 const int bsize = b.
size();
135 bool is_converged =
false;
153 Nconv2 += Nconv_unit;
158 for (
int i_restart = 0; i_restart <
m_Nrestart; i_restart++) {
159 for (
int iter = 0; iter <
m_Niter; iter++) {
163 Nconv2 += Nconv_unit;
195 vout.
crucial(
m_vl,
" iter(final): %8d %22.15e\n", Nconv2, diff2 / bnorm2);
205 diff = sqrt(diff2 / bnorm2);
218 const int Nin = b.
nin();
219 const int Nvol = b.
nvol();
220 const int Nex = b.
nex();
253 const double rr_prev = rr;
258 const double cr = rr_prev / pap;
265 const double rr_ratio = rr / rr_prev;
277 const int Nin =
m_x.
nin();
279 const int Nex =
m_x.
nex();
290 const double gflop_axpy = Nin * Nex * 2 * ((Nvol * NPE) / 1.0e+9);
291 const double gflop_norm = Nin * Nex * 2 * ((Nvol * NPE) / 1.0e+9);
293 double gflop_dot = 0.0;
295 gflop_dot = Nin * Nex * 2 * ((Nvol * NPE) / 1.0e+9);
297 gflop_dot = Nin * Nex * 4 * ((Nvol * NPE) / 1.0e+9);
300 const double gflop_init = gflop_fopr + gflop_axpy + gflop_norm;
301 const double gflop_step = gflop_fopr + gflop_dot + 3 * gflop_axpy + gflop_norm;
302 const double gflop_true_residual = gflop_fopr + gflop_axpy + gflop_norm;
304 const double gflop = gflop_norm + gflop_init
void set_bool(const string &key, const bool value)
void set_string(const string &key, const string &value)
Bridge::VerboseLevel m_vl
virtual void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
void set_double(const string &key, const double value)
void reset_field(const Field &)
void detailed(const char *format,...)
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
void get_parameters(Parameters ¶ms) const
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
double dot(const Field &y, const Field &x)
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
int non_negative(const int v)
int fetch_bool(const string &key, bool &value) const
void copy(Field &y, const Field &x)
copy(y, x): y = x
void paranoiac(const char *format,...)
virtual double flop_count()
returns the number of floating point operations.
static const std::string class_name
int square_non_zero(const double v)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
element_type field_element_type() const
static VerboseLevel set_verbose_level(const std::string &str)
void set_int(const string &key, const int value)
int fetch_string(const string &key, string &value) const
int fetch_double(const string &key, double &value) const
void solve_init(const Field &, double &)
void set_parameters(const Parameters ¶ms)
void solve_step(double &)
void crucial(const char *format,...)
Container of Field-type object.
int fetch_int(const string &key, int &value) const
void general(const char *format,...)
static void assert_single_thread(const std::string &class_name)
assert currently running on single thread.
static std::string get_verbose_level(const VerboseLevel vl)
static double epsilon_criterion()