Go to the documentation of this file.
18 #ifdef USE_FACTORY_AUTOREGISTER
24 template<
typename AFIELD>
28 template<
typename AFIELD>
35 vout.
general(m_vl,
"%s: construction\n", class_name.c_str());
38 m_is_initial_step =
true;
40 std::string kernel_type;
41 int err = params.
fetch_string(
"kernel_type", kernel_type);
43 vout.
crucial(m_vl,
"Error at %s: kernel_type is not specified.\n",
47 m_kernel_type = kernel_type;
53 double kappa = 1.0 / (8.0 - 2.0 * M0);
54 params_kernel.
set_double(
"hopping_parameter", kappa);
56 m_fopr_w = AFOPR::New(kernel_type, params_kernel);
57 m_kernel_created =
true;
59 m_Nin = m_fopr_w->field_nin();
60 m_Nvol = m_fopr_w->field_nvol();
61 m_Nex = m_fopr_w->field_nex();
66 m_boundary.resize(Ndim);
68 m_w0.reset(m_Nin, m_Nvol, m_Nex);
69 m_w1.reset(m_Nin, m_Nvol, m_Nex);
70 m_w2.reset(m_Nin, m_Nvol, m_Nex);
72 set_parameters(params);
74 m_is_initial_step =
false;
83 template<
typename AFIELD>
90 vout.
general(m_vl,
"%s: construction\n", class_name.c_str());
93 m_is_initial_step =
true;
96 m_kernel_created =
false;
98 m_kernel_type =
"unknown";
102 m_Nvol = m_fopr_w->field_nvol();
103 m_Nex = m_fopr_w->field_nex();
108 m_boundary.resize(Ndim);
110 m_w0.reset(m_Nin, m_Nvol, m_Nex);
111 m_w1.reset(m_Nin, m_Nvol, m_Nex);
112 m_w2.reset(m_Nin, m_Nvol, m_Nex);
114 set_parameters(params);
116 m_is_initial_step =
false;
125 template<
typename AFIELD>
132 vout.
general(m_vl,
"%s: construction (obsolete)\n",
136 m_is_initial_step =
true;
137 m_kernel_created =
false;
139 m_kernel_type =
"unknown";
142 m_Nin = m_fopr_w->field_nin();
143 m_Nvol = m_fopr_w->field_nvol();
144 m_Nex = m_fopr_w->field_nex();
149 m_boundary.resize(Ndim);
151 m_w0.reset(m_Nin, m_Nvol, m_Nex);
152 m_w1.reset(m_Nin, m_Nvol, m_Nex);
153 m_w2.reset(m_Nin, m_Nvol, m_Nex);
155 m_is_initial_step =
false;
164 template<
typename AFIELD>
168 if (m_kernel_created ==
true)
delete m_fopr_w;
173 template<
typename AFIELD>
186 double mq, M0, x_min, x_max;
196 err += params.
fetch_int(
"number_of_poles", Np);
199 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
200 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
204 vout.
crucial(m_vl,
"Error at %s: input parameter not found.\n",
209 std::string repr, kernel;
210 if (!params.
fetch_string(
"gamma_matrix_type", repr)) m_repr = repr;
211 if (!params.
fetch_string(
"kernel_type", kernel)) m_kernel_type = kernel;
215 Niter,
real_t(Stop_cond), bc);
217 if (!m_is_initial_step) {
219 double kappa = 1.0 / (8.0 - 2.0 * M0);
220 params_kernel.
set_double(
"hopping_parameter", kappa);
221 m_fopr_w->set_parameters(params_kernel);
223 m_sign->set_parameters(params);
229 template<
typename AFIELD>
237 const std::vector<int> bc)
253 vout.
crucial(m_vl,
"Error at %s: parameter range check failed.\n",
259 assert(bc.size() == Ndim);
268 m_Stop_cond = Stop_cond;
277 vout.
general(m_vl,
"%s parameters:\n", class_name.c_str());
284 vout.
general(m_vl,
" Stop_cond = %8.2e\n", m_Stop_cond);
285 for (
int mu = 0; mu < Ndim; ++mu) {
286 vout.
general(m_vl,
" boundary[%d] = %2d\n", mu, m_boundary[mu]);
292 template<
typename AFIELD>
295 params.
set_double(
"quark_mass",
double(m_mq));
296 params.
set_double(
"domain_wall_height",
double(m_M0));
297 params.
set_int(
"number_of_poles", m_Np);
298 params.
set_double(
"lower_bound",
double(m_x_min));
299 params.
set_double(
"upper_bound",
double(m_x_max));
300 params.
set_int(
"maximum_number_of_iteration", m_Niter);
301 params.
set_double(
"convergence_criterion_squared",
double(m_Stop_cond));
303 params.
set_string(
"kernel_type", m_kernel_type);
304 params.
set_string(
"gamma_matrix_type", m_repr);
311 template<
typename AFIELD>
314 m_sign->set_config(U);
319 template<
typename AFIELD>
321 std::vector<real_t> *ev,
322 std::vector<AFIELD> *vk)
336 m_sign->set_lowmodes(m_Nsbt, m_ev, m_vk);
341 template<
typename AFIELD>
347 if (ith == 0) m_mode = mode;
349 m_sign->set_mode(mode);
356 template<
typename AFIELD>
361 }
else if (m_mode ==
"Ddag") {
363 }
else if (m_mode ==
"DdagD") {
365 }
else if (m_mode ==
"H") {
368 vout.
crucial(m_vl,
"Error at %s: mode undefined.\n",
376 template<
typename AFIELD>
381 }
else if (m_mode ==
"Ddag") {
383 }
else if (m_mode ==
"DdagD") {
385 }
else if (m_mode ==
"H") {
388 vout.
crucial(m_vl,
"Error at %s: mode undefined.\n",
396 template<
typename AFIELD>
399 m_fopr_w->mult_gm5(v, w);
404 template<
typename AFIELD>
408 m_fopr_w->mult_gm5(m_w2, m_w1);
411 m_fopr_w->mult_gm5(v, m_w1);
416 template<
typename AFIELD>
420 m_fopr_w->mult_gm5(v, m_w1);
425 template<
typename AFIELD>
428 m_fopr_w->mult_gm5(m_w1, b);
430 m_fopr_w->mult_gm5(v, m_w2);
435 template<
typename AFIELD>
443 real_t f1 = m_M0 + 0.5 * m_mq;
444 real_t f2 = m_M0 - 0.5 * m_mq;
446 m_sign->mult(m_w0, b);
448 m_fopr_w->mult_gm5(v, m_w0);
458 template<
typename AFIELD>
466 template<
typename AFIELD>
471 double gflop_sign = m_sign->flop_count();
473 double flop_blas = double(m_Nin * m_Nex * 3);
476 double gflop = flop_blas * double(m_Nvol) * double(NPE) * 1.0e-9;
480 if (mode ==
"DdagD") gflop *= 2.0;
void mult_dag(AFIELD &, const AFIELD &)
hermitian conjugate of mult.
void get_parameters(Parameters ¶ms) const
gets parameters by a Parameter object: to be implemented in a subclass.
void set_string(const string &key, const string &value)
Sign function of a given fermion operator.
void mult(AFIELD &, const AFIELD &)
multiplies fermion operator to a given field.
void set_double(const string &key, const double value)
bool check_size(const int nin, const int nvol, const int nex) const
checking size parameters. [23 May 2016 H.Matsufuru]
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void set_lowmodes(const int Nsbt, std::vector< real_t > *, std::vector< AFIELD > *)
void D(AFIELD &v, const AFIELD &w)
void set_parameters(const Parameters ¶ms)
sets parameters by a Parameter object: to be implemented in a subclass.
void mult_gm5(AFIELD &, const AFIELD &)
multiplies gamma_5 matrix.
int fetch_int_vector(const string &key, vector< int > &value) const
int square_non_zero(const double v)
void H(AFIELD &v, const AFIELD &w)
void set_mode(const std::string mode)
setting the mode of multiplication if necessary. Default implementation here is just to avoid irrelev...
double flop_count()
returns the number of floating point operations.
void DdagD(AFIELD &v, const AFIELD &w)
void set_int_vector(const string &key, const vector< int > &value)
static Bridge::VerboseLevel Vlevel()
static VerboseLevel set_verbose_level(const std::string &str)
int non_zero(const double v)
void Ddag(AFIELD &v, const AFIELD &w)
void set_int(const string &key, const int value)
void scal(Field &x, const double a)
scal(x, a): x = a * x
Overlap fermion operator.
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.
virtual int field_nin()=0
returns the on-site degree of freedom of the fermion field.
static int get_thread_id()
returns thread id.
void set_config(Field *U)
sets the gauge configuration.
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)