16#ifndef dealii_solver_minres_h
17#define dealii_solver_minres_h
68template <
class VectorType = Vector<
double>>
101 template <
typename MatrixType,
typename PreconditionerType>
105 const VectorType &
b,
106 const PreconditionerType &preconditioner);
133 const VectorType & x,
134 const VectorType & r,
135 const VectorType &
d)
const;
151template <
class VectorType>
154 const AdditionalData &)
161template <
class VectorType>
163 const AdditionalData &)
170template <
class VectorType>
178template <
class VectorType>
183 const VectorType &)
const
188template <
class VectorType>
189template <
typename MatrixType,
typename PreconditionerType>
193 const VectorType &
b,
194 const PreconditionerType &preconditioner)
210 using vecptr = VectorType *;
211 vecptr u[3] = {Vu0.get(), Vu1.get(), Vu2.get()};
212 vecptr m[3] = {Vm0.get(), Vm1.get(), Vm2.get()};
217 u[0]->reinit(
b,
true);
218 u[1]->reinit(
b,
true);
219 u[2]->reinit(
b,
true);
220 m[0]->reinit(
b,
true);
221 m[1]->reinit(
b,
true);
222 m[2]->reinit(
b,
true);
226 double delta[3] = {0, 0, 0};
227 double f[2] = {0, 0};
228 double e[2] = {0, 0};
250 preconditioner.vmult(v, *u[1]);
252 delta[1] = v * (*u[1]);
254 Assert(delta[1] >= 0, ExcPreconditionerNotDefinite());
275 u[2]->add(-
std::sqrt(delta[1] / delta[0]), *u[0]);
277 const double gamma = *u[2] * v;
284 preconditioner.vmult(v, *u[2]);
286 delta[2] = v * (*u[2]);
288 Assert(delta[2] >= 0, ExcPreconditionerNotDefinite());
297 d_ = s *
e[0] - c *
gamma;
303 const double d =
std::sqrt(d_ * d_ + delta[2]);
315 m[0]->add(-
e[0], *m[1]);
317 m[0]->add(-f[0], *m[2]);
322 conv = this->iteration_status(j, r_l2, x);
void swap(BlockIndices &u, BlockIndices &v)
@ iterate
Continue iteration.
@ success
Stop iteration, goal reached.
virtual ~SolverMinRes() override=default
SolverMinRes(SolverControl &cn, const AdditionalData &data=AdditionalData())
void solve(const MatrixType &A, VectorType &x, const VectorType &b, const PreconditionerType &preconditioner)
SolverMinRes(SolverControl &cn, VectorMemory< VectorType > &mem, const AdditionalData &data=AdditionalData())
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define DeclException0(Exception0)
static ::ExceptionBase & ExcPreconditionerNotDefinite()
#define Assert(cond, exc)
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
virtual double criterion()
#define AssertThrow(cond, exc)
Expression fabs(const Expression &x)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > b(const Tensor< 2, dim, Number > &F)
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
long double gamma(const unsigned int n)
::VectorizedArray< Number, width > sqrt(const ::VectorizedArray< Number, width > &)