13#ifndef dealii_solver_qmrs_h
14#define dealii_solver_qmrs_h
91template <
typename VectorType = Vector<
double>>
176 template <
typename MatrixType,
typename PreconditionerType>
183 const PreconditionerType &preconditioner);
194 const VectorType &d) const;
220 template <
typename MatrixType,
typename PreconditionerType>
225 const PreconditionerType &preconditioner,
244template <
typename VectorType>
248 const double last_residual)
250 , last_residual(last_residual)
255template <
typename VectorType>
259 const AdditionalData &data)
261 , additional_data(data)
267template <
typename VectorType>
270 const AdditionalData &data)
272 , additional_data(data)
278template <
typename VectorType>
283 const VectorType &)
const
288template <
typename VectorType>
290template <
typename MatrixType,
typename PreconditionerType>
297 const PreconditionerType &preconditioner)
327 deallog <<
"Restart step " << step << std::endl;
328 state = iterate(A, x, b, preconditioner, *Vr, *Vu, *Vq, *Vt, *Vd);
341template <
typename VectorType>
343template <
typename MatrixType,
typename PreconditionerType>
348 const PreconditionerType &preconditioner,
359 double tau, rho,
theta = 0;
367 if (additional_data.left_preconditioning)
370 preconditioner.vmult(t, r);
377 preconditioner.vmult(q, t);
396 const double sigma = q * t;
399 if (additional_data.breakdown_testing ==
true &&
400 std::fabs(sigma) < additional_data.breakdown_threshold)
403 const double alpha = rho / sigma;
409 const double theta_old =
theta;
412 if (additional_data.left_preconditioning)
415 preconditioner.vmult(t, r);
425 const double psi = 1. / (1. +
theta);
429 d.sadd(psi * theta_old, psi * alpha, q);
432 print_vectors(step, x, r, d);
440 if (res < additional_data.solver_tolerance)
446 state = this->iteration_status(step, res, x);
449 return IterationResult(state, res);
454 if (additional_data.breakdown_testing ==
true &&
455 std::fabs(sigma) < additional_data.breakdown_threshold)
458 const double rho_old = rho;
461 if (additional_data.left_preconditioning)
469 preconditioner.vmult(u, t);
474 const double beta = rho / rho_old;
SolverBase(SolverControl &solver_control, VectorMemory< VectorType > &vector_memory)
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
@ failure
Stop iteration, goal not reached.
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
IterationResult iterate(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner, VectorType &r, VectorType &u, VectorType &q, VectorType &t, VectorType &d)
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
SolverQMRS(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
AdditionalData additional_data
SolverQMRS(SolverControl &cn, const AdditionalData &data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define AssertThrow(cond, exc)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)
double breakdown_threshold
AdditionalData(const bool left_preconditioning=false, const double solver_tolerance=1.e-9, const bool breakdown_testing=true, const double breakdown_threshold=1.e-16)
bool left_preconditioning
SolverControl::State state
IterationResult(const SolverControl::State state, const double last_residual)