24 template<
class T=real_t>
33 typedef typename Base::LinOpPtr LinOpPtr;
35 typedef memory::shared_ptr<gsMinimalResidual> Ptr;
36 typedef memory::unique_ptr<gsMinimalResidual> uPtr;
42 template<
typename OperatorType >
44 const LinOpPtr& precond = LinOpPtr())
45 :
Base(mat, precond), m_inexact_residual(false) {}
51 template<
typename OperatorType >
52 static uPtr
make(
const OperatorType& mat,
const LinOpPtr& precond = LinOpPtr() )
58 bool step( VectorType& x );
65 "If true, the residual is estimated, not accurately computed.",
74 m_inexact_residual = opt.
askSwitch(
"InexactResidual", m_inexact_residual);
82 std::ostream &
print(std::ostream &os)
const
84 os <<
"gsMinimalResidual\n";
99 wPrev, w, wNew, AwPrev, Aw, AwNew,
103 gammaPrev, gamma, gammaNew,
107 bool m_inexact_residual;
112 #ifndef GISMO_BUILD_LIB
113 #include GISMO_HPP_HEADER(gsMinimalResidual.hpp)
const LinOpPtr m_mat
The matrix/operator to be solved for.
Definition: gsIterativeSolver.h:252
void finalizeIteration(VectorType &x)
Some post-processing might be required.
Definition: gsMinimalResidual.hpp:102
virtual gsIterativeSolver & setOptions(const gsOptionList &opt)
Set the options based on a gsOptionList.
Definition: gsIterativeSolver.h:102
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsMinimalResidual.h:82
gsOptionList::Real m_tol
The tolerance for m_error to be reached.
Definition: gsIterativeSolver.h:255
gsMinimalResidual & setOptions(const gsOptionList &opt)
Set the options based on a gsOptionList.
Definition: gsMinimalResidual.h:71
The minimal residual (MinRes) method.
Definition: gsMinimalResidual.h:25
T m_rhs_norm
The norm of the right-hand-side.
Definition: gsIterativeSolver.h:257
static gsOptionList defaultOptions()
Returns a list of default options.
Definition: gsMinimalResidual.h:61
static gsOptionList defaultOptions()
Returns a list of default options.
Definition: gsIterativeSolver.h:92
index_t m_max_iters
The upper bound for the number of iterations.
Definition: gsIterativeSolver.h:254
gsMinimalResidual(const OperatorType &mat, const LinOpPtr &precond=LinOpPtr())
Constructor using a matrix (operator) and optionally a preconditionner.
Definition: gsMinimalResidual.h:43
bool initIteration(const VectorType &rhs, VectorType &x)
Init the iteration.
Definition: gsMinimalResidual.hpp:18
T m_error
The relative error as absolute_error/m_rhs_norm.
Definition: gsIterativeSolver.h:258
Abstract class for iterative solvers.
bool step(VectorType &x)
Perform one step, requires initIteration.
Definition: gsMinimalResidual.hpp:54
void setInexactResidual(bool flag)
If true, the residual is estimated, not accurately computed.
Definition: gsMinimalResidual.h:79
bool askSwitch(const std::string &label, const bool &value=false) const
Reads value for option label from options.
Definition: gsOptionList.cpp:128
Abstract class for iterative solvers.
Definition: gsIterativeSolver.h:26
Class which holds a list of parameters/options, and provides easy access to them. ...
Definition: gsOptionList.h:32
static uPtr make(const OperatorType &mat, const LinOpPtr &precond=LinOpPtr())
Make function using a matrix (operator) and optionally a preconditionner.
Definition: gsMinimalResidual.h:52
void addSwitch(const std::string &label, const std::string &desc, const bool &value)
Adds a option named label, with description desc and value value.
Definition: gsOptionList.cpp:235
index_t m_num_iter
The number of iterations performed.
Definition: gsIterativeSolver.h:256
LinOpPtr m_precond
The preconditioner.
Definition: gsIterativeSolver.h:253