16#ifndef dealii_solver_minres_h
17#define dealii_solver_minres_h
67template <
class VectorType = Vector<
double>>
100 template <
typename MatrixType,
typename PreconditionerType>
104 const VectorType & b,
105 const PreconditionerType &preconditioner);
132 const VectorType & x,
133 const VectorType & r,
134 const VectorType & d)
const;
150template <
class VectorType>
153 const AdditionalData &)
155 , res2(
numbers::signaling_nan<double>())
160template <
class VectorType>
162 const AdditionalData &)
169template <
class VectorType>
177template <
class VectorType>
182 const VectorType &)
const
187template <
class VectorType>
188template <
typename MatrixType,
typename PreconditionerType>
192 const VectorType & b,
193 const PreconditionerType &preconditioner)
209 using vecptr = VectorType *;
210 vecptr u[3] = {Vu0.get(), Vu1.get(), Vu2.get()};
211 vecptr m[3] = {Vm0.get(), Vm1.get(), Vm2.get()};
216 u[0]->reinit(b,
true);
217 u[1]->reinit(b,
true);
218 u[2]->reinit(b,
true);
219 m[0]->reinit(b,
true);
220 m[1]->reinit(b,
true);
221 m[2]->reinit(b,
true);
225 double delta[3] = {0, 0, 0};
226 double f[2] = {0, 0};
227 double e[2] = {0, 0};
249 preconditioner.vmult(v, *u[1]);
251 delta[1] = v * (*u[1]);
253 Assert(delta[1] >= 0, ExcPreconditionerNotDefinite());
274 u[2]->add(-
std::sqrt(delta[1] / delta[0]), *u[0]);
276 const double gamma = *u[2] * v;
277 u[2]->add(-gamma /
std::sqrt(delta[1]), *u[1]);
283 preconditioner.vmult(v, *u[2]);
285 delta[2] = v * (*u[2]);
287 Assert(delta[2] >= 0, ExcPreconditionerNotDefinite());
296 d_ = s *
e[0] - c *
gamma;
302 const double d =
std::sqrt(d_ * d_ + delta[2]);
314 m[0]->add(-e[0], *m[1]);
316 m[0]->add(-f[0], *m[2]);
319 r_l2 *= std::fabs(s);
321 conv = this->iteration_status(j, r_l2, x);
@ 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)
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 > &)
void swap(SmartPointer< T, P > &t1, SmartPointer< T, Q > &t2)