26 bool init = Solver::Factory::Register(
"BiCGStab_L_Cmplx", create_object);
43 #ifdef USE_PARAMETERS_FACTORY
58 const string str_vlevel = params.
get_string(
"verbose_level");
68 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
69 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
70 err += params.
fetch_int(
"number_of_orthonormal_vectors", N_L);
131 int& Nconv,
double& diff)
133 double bnorm2 = b.
norm2();
134 double snorm = 1.0 / bnorm2;
135 int bsize = b.
size();
151 bool is_converged =
false;
156 for (
int iter = 0; iter <
m_Niter; iter++) {
157 if (is_converged)
break;
215 if ((
s.
nin() != Nin) || (
s.
nvol() != Nvol) || (
s.
nex() != Nex)) {
225 for (
int i = 0; i <
m_N_L + 1; ++i) {
226 u[i].reset(Nin, Nvol, Nex);
227 r[i].reset(Nin, Nvol, Nex);
269 for (
int j = 0; j <
m_N_L; ++j) {
273 dcomplex beta = alpha_prev2 * (rho / rho_prev2);
277 for (
int i = 0; i < j + 1; ++i) {
284 alpha_prev2 = rho_prev2 / conj(gamma);
286 for (
int i = 0; i < j + 1; ++i) {
287 axpy(
r[i], -alpha_prev2,
u[i + 1]);
292 axpy(
x, alpha_prev2,
u[0]);
296 std::vector<double> sigma(m_N_L + 1);
297 std::vector<dcomplex> gamma_prime(m_N_L + 1);
300 std::vector<dcomplex> tau(m_N_L * (m_N_L + 1));
303 for (
int j = 1; j < m_N_L + 1; ++j) {
304 for (
int i = 1; i < j; ++i) {
307 dcomplex r_ji =
dotc(
r[j],
r[i]);
308 tau[ij] = conj(r_ji) / sigma[i];
309 axpy(
r[j], -tau[ij],
r[i]);
312 sigma[j] =
r[j].norm2();
314 dcomplex r_0j =
dotc(
r[0],
r[j]);
315 gamma_prime[j] = conj(r_0j) / sigma[j];
319 std::vector<dcomplex> gamma(m_N_L + 1);
324 for (
int j = m_N_L - 1; j > 0; --j) {
325 c_tmp = cmplx(0.0, 0.0);
327 for (
int i = j + 1; i < m_N_L + 1; ++i) {
329 c_tmp += tau[ji] * gamma[i];
332 gamma[j] = gamma_prime[j] - c_tmp;
337 std::vector<dcomplex> gamma_double_prime(m_N_L);
339 for (
int j = 1; j <
m_N_L; ++j) {
340 c_tmp = cmplx(0.0, 0.0);
342 for (
int i = j + 1; i <
m_N_L; ++i) {
344 c_tmp += tau[ji] * gamma[i + 1];
347 gamma_double_prime[j] = gamma[j + 1] + c_tmp;
352 axpy(
r[0], -gamma_prime[m_N_L],
r[m_N_L]);
353 axpy(
u[0], -gamma[m_N_L],
u[m_N_L]);
355 for (
int j = 1; j <
m_N_L; ++j) {
356 axpy(
x, gamma_double_prime[j],
r[j]);
357 axpy(
r[0], -gamma_prime[j],
r[j]);
358 axpy(
u[0], -gamma[j],
u[j]);
static const std::string class_name
void detailed(const char *format,...)
void Register_string(const string &, const string &)
int index_ij(int i, int j)
void general(const char *format,...)
void Register_int(const string &, const int)
void set_parameters_L(const int N_L)
void solve_step(double &)
Container of Field-type object.
void solve_init(const Field &, 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)
dcomplex dotc(const Field &y, const Field &x)
void reset(const int Nin, const int Nvol, const int Nex, const element_type cmpl=COMPLEX)
void aypx(const double a, Field &y, const Field &x)
aypx(y, a, x): y := a * y + x
void paranoiac(const char *format,...)
void axpy(Field &y, const double a, const Field &x)
axpy(y, a, x): y := a * x + y
void crucial(const char *format,...)
Base class for linear solver class family.
static bool Register(const std::string &realm, const creator_callback &cb)
virtual void mult(Field &, const Field &)=0
multiplies fermion operator to a given field (2nd argument)
int non_negative(const int v)
void Register_double(const string &, const double)
Base class of fermion operator family.
int fetch_double(const string &key, double &val) const
string get_string(const string &key) const
void reset_field(const Field &)
int fetch_int(const string &key, int &val) const
Parameters_Solver_BiCGStab_L_Cmplx()
Bridge::VerboseLevel m_vl
static VerboseLevel set_verbose_level(const std::string &str)
void solve(Field &solution, const Field &source, int &Nconv, double &diff)
static void assert_single_thread(const std::string &classname)
assert currently running on single thread.