18 #ifdef USE_PARAMETERS_FACTORY
30 bool init = Solver::Factory::Register(
"BiCGStab_L_Cmplx", create_object);
47 #ifdef USE_PARAMETERS_FACTORY
60 const string str_vlevel = params.
get_string(
"verbose_level");
70 err += params.
fetch_int(
"maximum_number_of_iteration", Niter);
71 err += params.
fetch_double(
"convergence_criterion_squared", Stop_cond);
72 err += params.
fetch_int(
"number_of_orthonormal_vectors", N_L);
75 vout.
crucial(
m_vl,
"Solver_BiCGStab_L_Cmplx: fetch error, input parameter not found.\n");
99 vout.
crucial(
m_vl,
"Solver_BiCGStab_L_Cmplx: parameter range check failed.\n");
120 vout.
crucial(
m_vl,
"Solver_BiCGStab_L_Cmplx: parameter range check failed.\n");
131 int& Nconv,
double& diff)
140 double snorm = 1.0 / b.
norm2();
150 for (
int iter = 0; iter <
m_Niter; iter++) {
161 Nconv = 2 *
m_N_L * (iter + 1);
189 if ((
s.
nin() != Nin) || (
s.
nvol() != Nvol) || (
s.
nex() != Nex)) {
203 for (
int i = 0; i <
m_N_L + 1; ++i) {
204 u[i].reset(Nin, Nvol, Nex);
205 r[i].reset(Nin, Nvol, Nex);
225 rho_p = cmplx(1.0, 0.0);
236 double const_r, const_i;
240 for (
int j = 0; j <
m_N_L; ++j) {
243 dcomplex rho = cmplx(const_r, -const_i);
248 for (
int i = 0; i < j + 1; ++i) {
258 dcomplex gamma = cmplx(const_r, -const_i);
262 for (
int i = 0; i < j + 1; ++i) {
276 valarray<double> sigma(m_N_L + 1);
277 valarray<dcomplex> gamma_prime(m_N_L + 1);
280 valarray<dcomplex> tau(m_N_L * (m_N_L + 1));
283 for (
int j = 1; j < m_N_L + 1; ++j) {
284 for (
int i = 1; i < j; ++i) {
289 tau[ij] = cmplx(const_r, -const_i) / sigma[i];
297 sigma[j] =
r[j] *
r[j];
302 gamma_prime[j] = cmplx(const_r, -const_i) / sigma[j];
306 valarray<dcomplex> gamma(m_N_L + 1);
312 for (
int j = m_N_L - 1; j > 0; --j) {
313 c_tmp = cmplx(0.0, 0.0);
315 for (
int i = j + 1; i < m_N_L + 1; ++i) {
317 c_tmp += tau[ji] * gamma[i];
320 gamma[j] = gamma_prime[j] - c_tmp;
325 valarray<dcomplex> gamma_double_prime(m_N_L);
327 for (
int j = 1; j <
m_N_L; ++j) {
328 c_tmp = cmplx(0.0, 0.0);
330 for (
int i = j + 1; i <
m_N_L; ++i) {
332 c_tmp += tau[ji] * gamma[i + 1];
335 gamma_double_prime[j] = gamma[j + 1] + c_tmp;
345 mult_c(
v_tmp,
r[m_N_L], real(gamma_prime[m_N_L]), imag(gamma_prime[m_N_L]));
348 mult_c(
v_tmp,
u[m_N_L], real(gamma[m_N_L]), imag(gamma[m_N_L]));
352 for (
int j = 1; j <
m_N_L; ++j) {
357 mult_c(
v_tmp,
r[j], real(gamma_double_prime[j]), imag(gamma_double_prime[j]));
360 mult_c(
v_tmp,
r[j], real(gamma_prime[j]), imag(gamma_prime[j]));
379 assert(v.
size() == size);
384 for (
int i = 0; i < size; i += 2) {
385 prod_r += v.
cmp(i) * w.
cmp(i) + v.
cmp(i + 1) * w.
cmp(i + 1);
386 prod_i += v.
cmp(i) * w.
cmp(i + 1) - v.
cmp(i + 1) * w.
cmp(i);
397 const double& prod_r,
const double& prod_i)
403 assert(v.
size() == size);
406 for (
int i = 0; i < size; i += 2) {
407 vr = prod_r * w.
cmp(i) - prod_i * w.
cmp(i + 1);
408 vi = prod_r * w.
cmp(i + 1) + prod_i * w.
cmp(i);