Go to the documentation of this file.
16 #ifdef USE_FACTORY_AUTOREGISTER
18 bool init = Solver_BiCGStab_L_Cmplx::register_factory();
36 double Omega_tolerance;
40 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
41 err += params.
fetch_int(
"maximum_number_of_restart", Nrestart);
42 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
43 err += params.
fetch_bool(
"use_initial_guess", use_init_guess);
44 err += params.
fetch_double(
"Omega_tolerance", Omega_tolerance);
45 err += params.
fetch_int(
"number_of_orthonormal_vectors", N_L);
55 set_parameters(Niter, Nrestart, Stop_cond, use_init_guess, Omega_tolerance, N_L);
112 vout.
general(
m_vl,
" use_init_guess = %s\n", use_init_guess ?
"true" :
"false");
172 const double Stop_cond,
173 const bool use_init_guess,
174 const double Omega_tolerance,
184 vout.
general(
m_vl,
" use_init_guess = %s\n", use_init_guess ?
"true" :
"false");
219 int& Nconv,
double& diff)
221 const double bnorm2 = b.
norm2();
222 const int bsize = b.
size();
228 bool is_converged =
false;
246 Nconv2 += Nconv_unit;
251 for (
int i_restart = 0; i_restart <
m_Nrestart; i_restart++) {
252 for (
int iter = 0; iter <
m_Niter; iter++) {
256 Nconv2 += 2 * Nconv_unit *
m_N_L;
288 vout.
crucial(
m_vl,
" iter(final): %8d %22.15e\n", Nconv2, diff2 / bnorm2);
298 diff = sqrt(diff2 / bnorm2);
313 const int Nin = b.
nin();
314 const int Nvol = b.
nvol();
315 const int Nex = b.
nex();
327 for (
int i = 0; i <
m_N_L + 1; ++i) {
328 m_u[i].reset(Nin, Nvol, Nex);
329 m_r[i].reset(Nin, Nvol, Nex);
343 for (
int i = 0; i <
m_N_L + 1; ++i) {
374 for (
int j = 0; j <
m_N_L; ++j) {
378 dcomplex beta = alpha_prev2 * (rho / rho_prev2);
382 for (
int i = 0; i < j + 1; ++i) {
389 alpha_prev2 = rho_prev2 / conj(gamma);
391 for (
int i = 0; i < j + 1; ++i) {
401 std::vector<double> sigma(
m_N_L + 1);
402 std::vector<dcomplex> gamma_prime(
m_N_L + 1);
405 std::vector<dcomplex> tau(
m_N_L * (
m_N_L + 1));
407 const double sigma_0 =
m_r[0].norm2();
409 for (
int j = 1; j <
m_N_L + 1; ++j) {
410 for (
int i = 1; i < j; ++i) {
414 tau[ij] = conj(r_ji) / sigma[i];
418 sigma[j] =
m_r[j].norm2();
421 gamma_prime[j] = conj(r_0j) / sigma[j];
424 double abs_rho = abs(r_0j) / sqrt(sigma[j] * sigma_0);
431 std::vector<dcomplex> gamma(
m_N_L + 1);
434 for (
int j =
m_N_L - 1; j > 0; --j) {
435 dcomplex c_tmp = cmplx(0.0, 0.0);
437 for (
int i = j + 1; i <
m_N_L + 1; ++i) {
439 c_tmp += tau[ji] * gamma[i];
442 gamma[j] = gamma_prime[j] - c_tmp;
447 std::vector<dcomplex> gamma_double_prime(
m_N_L);
449 for (
int j = 1; j <
m_N_L; ++j) {
450 dcomplex c_tmp = cmplx(0.0, 0.0);
452 for (
int i = j + 1; i <
m_N_L; ++i) {
454 c_tmp += tau[ji] * gamma[i + 1];
457 gamma_double_prime[j] = gamma[j + 1] + c_tmp;
465 for (
int j = 1; j <
m_N_L; ++j) {
492 const int Nin =
m_x.
nin();
494 const int Nex =
m_x.
nex();
503 const double gflop_axpy = (Nin * Nex * 2) * ((Nvol * NPE) / 1.0e+9);
504 const double gflop_dotc = (Nin * Nex * 4) * ((Nvol * NPE) / 1.0e+9);
505 const double gflop_norm = (Nin * Nex * 2) * ((Nvol * NPE) / 1.0e+9);
508 for (
int j = 0; j <
m_N_L; ++j) {
509 for (
int i = 0; i < j + 1; ++i) {
514 const double gflop_init = gflop_fopr + gflop_axpy + gflop_norm;
515 const double gflop_step_BiCG_part = 2 *
m_N_L * gflop_fopr
516 + 2 *
m_N_L * gflop_dotc
517 + (
m_N_L + 2 * N_L_part) * gflop_axpy;
518 const double gflop_step_L_part = (N_L_part +
m_N_L) * gflop_dotc
519 + (N_L_part + 3 *
m_N_L) * gflop_axpy
520 + (
m_N_L + 1) * gflop_norm;
521 const double gflop_step = gflop_step_BiCG_part + gflop_step_L_part;
522 const double gflop_true_residual = gflop_fopr + gflop_axpy + gflop_norm;
525 const double gflop = gflop_norm + gflop_init + gflop_step * N_iter + gflop_true_residual * (
m_Nrestart_count + 1)
void set_bool(const string &key, const bool value)
int index_ij(const int i, const int j)
static const std::string class_name
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
void set_string(const string &key, const string &value)
virtual void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
void set_double(const string &key, const double value)
void get_parameters(Parameters ¶ms) const
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 set_parameters(const Parameters ¶ms)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
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,...)
DEPRECATED void set_parameters_BiCGStab_series(const double Omega_tolerance)
virtual double flop_count()
returns the number of floating point operations.
int square_non_zero(const double v)
dcomplex dotc(const Field &y, const Field &x)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=Element_type::COMPLEX)
void solve_step(double &)
Bridge::VerboseLevel m_vl
static VerboseLevel set_verbose_level(const std::string &str)
void solve_init(const Field &, double &)
DEPRECATED void set_parameters_L(const int N_L)
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 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()