21 #ifndef SELDON_FILE_ITERATIVE_QMR_CXX
41 #ifdef SELDON_WITH_VIRTUAL
42 template<
class T,
class Vector1>
43 int Qmr(
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 Qmr(
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, one, zero;
64 theta = zero; gamma = one; eta = -one; ep = zero;
66 Vector1 r(b), y(b), z_tld(b);
67 Vector1 v(b), w(b), p_tld(b);
68 Vector1 p(b), q(b), d(b), s(b);
71 int success_init = iter.
Init(b);
72 if (success_init != 0)
78 iter.
MltAdd(-one, A, x, one, r);
96 iter.
Fail(1,
"Qmr breakdown #1");
101 iter.
Fail(2,
"Qmr breakdown #2");
113 delta = DotProd(w, y);
116 iter.
Fail(3,
"Qmr breakdown #3");
120 M.TransSolve(A, w, z_tld);
131 Mlt(-xi * delta / ep, p);
133 Mlt(-rho * delta / ep, q);
138 iter.
Mlt(A, p, p_tld);
140 ep = DotProd(q, p_tld);
143 iter.
Fail(4,
"Qmr breakdown #4");
150 iter.
Fail(5,
"Qmr breakdown #5");
163 iter.
Mlt(SeldonTrans, A, q, z_tld);
165 Mlt(-beta, w); Add(one, z_tld, w);
173 theta = rho / (gamma_1 * beta);
174 gamma = one / sqrt(one + theta * theta);
176 if (gamma == Treal(0))
178 iter.
Fail(6,
"Qmr breakdown #6");
182 eta = -eta * rho_1 * gamma * gamma / (beta * gamma_1 * gamma_1);
193 Complexe tmp = (theta_1 * theta_1 * gamma * gamma);
210 #define SELDON_FILE_ITERATIVE_QMR_CXX