16 #ifndef dealii_solver_qmrs_h
17 #define dealii_solver_qmrs_h
19 #include <deal.II/base/config.h>
21 #include <deal.II/base/logstream.h>
22 #include <deal.II/base/subscriptor.h>
24 #include <deal.II/lac/solver.h>
25 #include <deal.II/lac/solver_control.h>
29 DEAL_II_NAMESPACE_OPEN
94 template <
typename VectorType = Vector<
double>>
178 template <
typename MatrixType,
typename PreconditionerType>
180 solve(
const MatrixType & A,
182 const VectorType & b,
183 const PreconditionerType &preconditioner);
192 const VectorType & x,
193 const VectorType & r,
194 const VectorType & d)
const;
210 double last_residual;
213 const double last_residual);
220 template <
typename MatrixType,
typename PreconditionerType>
224 const VectorType & b,
225 const PreconditionerType &preconditioner,
244 template <
class VectorType>
247 const double last_residual)
249 , last_residual(last_residual)
254 template <
class VectorType>
257 const AdditionalData & data)
259 , additional_data(data)
263 template <
class VectorType>
265 const AdditionalData &data)
267 , additional_data(data)
271 template <
class VectorType>
276 const VectorType &)
const
279 template <
class VectorType>
280 template <
typename MatrixType,
typename PreconditionerType>
284 const VectorType & b,
285 const PreconditionerType &preconditioner)
315 deallog <<
"Restart step " << step << std::endl;
316 state = iterate(A, x, b, preconditioner, *Vr, *Vu, *Vq, *Vt, *Vd);
327 template <
class VectorType>
328 template <
typename MatrixType,
typename PreconditionerType>
332 const VectorType & b,
333 const PreconditionerType &preconditioner,
344 double tau, rho, theta = 0;
352 if (additional_data.left_preconditioning)
355 preconditioner.vmult(t, r);
362 preconditioner.vmult(q, t);
366 res = std::sqrt(tau);
381 const double sigma = q * t;
384 if (additional_data.breakdown_testing ==
true &&
385 std::fabs(sigma) < additional_data.breakdown_threshold)
388 const double alpha = rho / sigma;
394 const double theta_old = theta;
397 if (additional_data.left_preconditioning)
400 preconditioner.vmult(t, r);
410 const double psi = 1. / (1. + theta);
414 d.sadd(psi * theta_old, psi * alpha, q);
417 print_vectors(step, x, r, d);
422 res = std::sqrt((it + 1) * tau);
425 if (res < additional_data.solver_tolerance)
431 state = this->iteration_status(step, res, x);
434 return IterationResult(state, res);
439 if (additional_data.breakdown_testing ==
true &&
440 std::fabs(sigma) < additional_data.breakdown_threshold)
443 const double rho_old = rho;
446 if (additional_data.left_preconditioning)
454 preconditioner.vmult(u, t);
459 const double beta = rho / rho_old;
467 DEAL_II_NAMESPACE_CLOSE