21 #ifndef SELDON_FILE_ITERATIVE_BICGSTAB_CXX
43 #ifdef SELDON_WITH_VIRTUAL
44 template<
class T,
class Vector1>
45 int BiCgStab(
const VirtualMatrix<T>& A, Vector1& x,
const Vector1& b,
46 Preconditioner_Base<T>& M,
47 Iteration<
typename ClassComplexType<T>::Treal>& iter)
49 template <
class Titer,
class Matrix1,
class Vector1,
class Preconditioner>
50 int BiCgStab(
const Matrix1& A, Vector1& x,
const Vector1& b,
54 const int N = A.GetM();
58 typedef typename Vector1::value_type Complexe;
59 Complexe rho_1, rho_2, alpha, beta, omega, sigma;
60 Vector1 p(b), phat(b), s(b), shat(b), t(b), v(b), r(b), rtilde(b);
64 omega = zero; alpha = zero; rho_2 = zero;
67 int success_init = iter.
Init(b);
68 if (success_init != 0)
74 iter.
MltAdd(-one, A, x, one, r);
85 rho_1 = DotProdConj(rtilde, r);
88 iter.
Fail(1,
"Bicgstab breakdown #1");
98 iter.
Fail(2,
"Bicgstab breakdown #2");
103 beta = (rho_1 / rho_2) * (alpha / omega);
112 iter.
Mlt(A, phat, v);
115 sigma = DotProdConj(rtilde, v);
118 iter.
Fail(3,
"Bicgstab breakdown #3");
121 alpha = rho_1 / sigma;
138 iter.
Mlt(A, shat, t);
140 omega = DotProdConj(t, s) / DotProdConj(t, t);
160 #define SELDON_FILE_ITERATIVE_BICGSTAB_CXX