Go to the documentation of this file.
27 template<
typename AFIELD>
31 template<
typename AFIELD>
46 err += params.
fetch_int(
"number_of_poles", Np);
47 err += params.
fetch_int(
"exponent_numerator", n_exp);
48 err += params.
fetch_int(
"exponent_denominator", d_exp);
51 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
52 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
55 vout.
crucial(m_vl,
"Error at %s: input parameter not found.\n",
60 set_parameters(Np, n_exp, d_exp,
real_t(x_min),
real_t(x_max),
66 template<
typename AFIELD>
69 params.
set_int(
"number_of_poles", m_Np);
70 params.
set_int(
"exponent_numerator", m_n_exp);
71 params.
set_int(
"exponent_denominator", m_d_exp);
72 params.
set_double(
"lower_bound",
double(m_x_min));
73 params.
set_double(
"upper_bound",
double(m_x_max));
74 params.
set_int(
"maximum_number_of_iteration", m_Niter);
75 params.
set_double(
"convergence_criterion_squared",
double(m_Stop_cond));
82 template<
typename AFIELD>
85 const int n_exp,
const int d_exp,
87 const int Niter,
const real_t Stop_cond)
97 vout.
general(m_vl,
" Stop_cond = %8.2e\n", Stop_cond);
109 vout.
crucial(m_vl,
"Error at %s: parameter range check failed.\n", class_name.c_str());
120 m_Stop_cond = Stop_cond;
127 template<
typename AFIELD>
130 m_fopr->set_config(U);
134 template<
typename AFIELD>
137 const int Nin = m_fopr->field_nin();
138 const int Nvol = m_fopr->field_nvol();
139 const int Nex = m_fopr->field_nex();
141 const int Nshift = m_Np;
143 const double x_min2 = m_x_min * m_x_min;
144 const double x_max2 = m_x_max * m_x_max;
150 for (
int i = 0; i < Nshift; ++i) {
151 m_xq[i].reset(Nin, Nvol, Nex);
155 params_solver.
set_int(
"number_of_shifts", Nshift);
156 params_solver.
set_int(
"maximum_number_of_iteration", m_Niter);
157 params_solver.
set_double(
"convergence_criterion_squared", m_Stop_cond);
162 m_fopr, params_solver);
164 std::vector<double> bl(m_Np), cl(m_Np);
169 double(x_min2),
double(x_max2));
175 for (
int i = 0; i < m_Np; i++) {
178 vout.
general(m_vl,
" bl[%d] = %18.14f cl[%d] = %18.14f\n",
179 i, m_bl[i], i, m_cl[i]);
185 template<
typename AFIELD>
190 assert(v.
nin() == b.
nin());
192 assert(v.
nex() == b.
nex());
194 vout.
general(m_vl,
"Shift solver in rational function\n");
197 vout.
detailed(m_vl,
"Number of shift values = %d\n", m_Np);
202 unique_ptr<Timer> timer(
new Timer);
205 m_fopr->set_mode(
"DdagD");
207 m_solver->solve(m_xq, m_cl, b, Nconv, diff);
214 double elapsed_time = timer->elapsed_sec();
215 vout.
general(m_vl,
"Elapsed time = %14.6f sec\n", elapsed_time);
219 for (
int i = 0; i < m_Np; i++) {
229 template<
typename AFIELD>
234 for (
int k = 0; k < m_Np; ++k) {
235 y += m_bl[k] / (x + m_cl[k]);
void set_string(const string &key, const string &value)
void mult(AFIELD &v, const AFIELD &f)
multiplies fermion operator to a given field.
void set_parameters(const Parameters ¶ms)
sets parameters by a Parameter object: to be implemented in a subclass.
void set_double(const string &key, const double value)
real_t func(const real_t x)
void detailed(const char *format,...)
void get_parameters(double &norm, std::vector< double > &res, std::vector< double > &pole)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void copy(Field &y, const Field &x)
copy(y, x): y = x
void set_parameters(const Parameters ¶ms)
void get_parameters(Parameters ¶ms) const
gets parameters by a Parameter object: to be implemented in a subclass.
int square_non_zero(const double v)
Fermion operator for rational approximation.
static VerboseLevel set_verbose_level(const std::string &str)
int non_zero(const double v)
void set_config(Field *U)
sets the gauge configuration.
void set_int(const string &key, const int value)
void scal(Field &x, const double a)
scal(x, a): x = a * x
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.
Multishift Conjugate Gradient solver.
Determionation of coefficients of rational approximation.
int fetch_int(const string &key, int &value) const
void general(const char *format,...)
static std::string get_verbose_level(const VerboseLevel vl)