21 #ifndef SELDON_FILE_ITERATIVE_QMRSYM_CXX
41 #ifdef SELDON_WITH_VIRTUAL
42 template<
class T,
class Vector1>
43 int QmrSym(
const VirtualMatrix<T>& A, Vector1& x,
const Vector1& b,
44 Preconditioner_Base<T>& M,
45 Iteration<
typename ClassComplexType<T>::Treal>& iter)
47 template <
class Titer,
class Matrix1,
class Vector1,
class Preconditioner>
48 int QmrSym(
const Matrix1& A, Vector1& x,
const Vector1& b,
52 const int N = A.GetM();
56 typedef typename Vector1::value_type Complexe;
57 Complexe delta, ep, beta;
58 typedef typename ClassComplexType<Complexe>::Treal Treal;
60 Complexe theta_1, gamma_1;
61 Complexe theta, gamma, eta;
65 theta = zero; gamma = one; eta = -one; ep = zero;
68 Vector1 v(b), p_tld(b);
69 Vector1 p(b), d(b), s(b);
72 int success_init = iter.
Init(b);
73 if (success_init != 0)
79 iter.
MltAdd(-one, A, x, one, r);
95 iter.
Fail(1,
"Qmr breakdown #1");
104 delta = DotProd(v, y);
107 iter.
Fail(3,
"Qmr breakdown #2");
116 Mlt(-rho * delta / ep, p);
121 iter.
Mlt(A, p, p_tld);
123 ep = DotProd(p, p_tld);
126 iter.
Fail(4,
"Qmr breakdown #3");
133 iter.
Fail(5,
"Qmr breakdown #4");
138 Mlt(-beta, v); Add(one, p_tld, v);
147 theta = rho / (gamma_1 * beta);
148 gamma = one / sqrt(one + theta * theta);
150 if (gamma == Treal(0))
152 iter.
Fail(6,
"Qmr breakdown #5");
156 eta = -eta * rho_1 * gamma * gamma / (beta * gamma_1 * gamma_1);
167 Complexe tmp = (theta_1 * theta_1 * gamma * gamma);
184 #define SELDON_FILE_ITERATIVE_QMRSYM_CXX