16#ifndef dealii_solver_minres_h
17#define dealii_solver_minres_h
69template <
class VectorType = Vector<
double>>
102 template <
typename MatrixType,
typename PreconditionerType>
106 const VectorType & b,
107 const PreconditionerType &preconditioner);
134 const VectorType & x,
135 const VectorType & r,
136 const VectorType & d)
const;
152template <
class VectorType>
155 const AdditionalData &)
157 , res2(
numbers::signaling_nan<double>())
162template <
class VectorType>
164 const AdditionalData &)
171template <
class VectorType>
179template <
class VectorType>
184 const VectorType &)
const
189template <
class VectorType>
190template <
typename MatrixType,
typename PreconditionerType>
194 const VectorType & b,
195 const PreconditionerType &preconditioner)
211 using vecptr = VectorType *;
212 vecptr u[3] = {Vu0.get(), Vu1.get(), Vu2.get()};
213 vecptr m[3] = {Vm0.get(), Vm1.get(), Vm2.get()};
218 u[0]->reinit(b,
true);
219 u[1]->reinit(b,
true);
220 u[2]->reinit(b,
true);
221 m[0]->reinit(b,
true);
222 m[1]->reinit(b,
true);
223 m[2]->reinit(b,
true);
227 double delta[3] = {0, 0, 0};
228 double f[2] = {0, 0};
229 double e[2] = {0, 0};
251 preconditioner.vmult(v, *u[1]);
253 delta[1] = v * (*u[1]);
255 Assert(delta[1] >= 0, ExcPreconditionerNotDefinite());
276 u[2]->add(-
std::sqrt(delta[1] / delta[0]), *u[0]);
278 const double gamma = *u[2] * v;
279 u[2]->add(-gamma /
std::sqrt(delta[1]), *u[1]);
285 preconditioner.vmult(v, *u[2]);
287 delta[2] = v * (*u[2]);
289 Assert(delta[2] >= 0, ExcPreconditionerNotDefinite());
298 d_ = s *
e[0] - c *
gamma;
304 const double d =
std::sqrt(d_ * d_ + delta[2]);
316 m[0]->add(-e[0], *m[1]);
318 m[0]->add(-f[0], *m[2]);
321 r_l2 *= std::fabs(s);
323 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)
virtual void print_vectors(const unsigned int step, const VectorType &x, const VectorType &r, const VectorType &d) const
virtual double criterion()
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)
#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)