23 template<
class T = real_t>
31 typedef typename Base::LinOpPtr LinOpPtr;
33 typedef memory::shared_ptr<gsGMRes> Ptr;
34 typedef memory::unique_ptr<gsGMRes> uPtr;
40 template<
typename OperatorType >
41 explicit gsGMRes(
const OperatorType& mat,
const LinOpPtr& precond = LinOpPtr() )
42 :
Base(mat, precond) {}
48 template<
typename OperatorType >
49 static uPtr
make(
const OperatorType& mat,
const LinOpPtr& precond = LinOpPtr() )
50 {
return uPtr(
new gsGMRes(mat, precond) ); }
53 bool step( VectorType& x );
62 y = R.template triangularView<gsEigen::Upper>().
solve(gg);
66 std::ostream &
print(std::ostream &os)
const
84 gsMatrix<T> H_prev, H, Omega, Omega_prev, Omega_tmp, Omega_prev_tmp;
85 std::vector< gsMatrix<T> > v;
91 #ifndef GISMO_BUILD_LIB
92 #include GISMO_HPP_HEADER(gsGMRes.hpp)
const LinOpPtr m_mat
The matrix/operator to be solved for.
Definition: gsIterativeSolver.h:252
void solveUpperTriangular(const VectorType &R, const VectorType &gg)
Definition: gsGMRes.h:60
void solve(const VectorType &rhs, VectorType &x)
Solves the linear system and stores the solution in x.
Definition: gsIterativeSolver.h:114
static uPtr make(const OperatorType &mat, const LinOpPtr &precond=LinOpPtr())
Make function using a matrix (operator) and optionally a preconditionner.
Definition: gsGMRes.h:49
gsGMRes(const OperatorType &mat, const LinOpPtr &precond=LinOpPtr())
Constructor using a matrix (operator) and optionally a preconditionner.
Definition: gsGMRes.h:41
std::ostream & print(std::ostream &os) const
Prints the object as a string.
Definition: gsGMRes.h:66
gsOptionList::Real m_tol
The tolerance for m_error to be reached.
Definition: gsIterativeSolver.h:255
T m_rhs_norm
The norm of the right-hand-side.
Definition: gsIterativeSolver.h:257
The generalized minimal residual (GMRES) method.
Definition: gsGMRes.h:24
index_t m_max_iters
The upper bound for the number of iterations.
Definition: gsIterativeSolver.h:254
bool step(VectorType &x)
Perform one step, requires initIteration.
Definition: gsGMRes.hpp:83
bool initIteration(const VectorType &rhs, VectorType &x)
Init the iteration.
Definition: gsGMRes.hpp:20
T m_error
The relative error as absolute_error/m_rhs_norm.
Definition: gsIterativeSolver.h:258
Abstract class for iterative solvers.
Abstract class for iterative solvers.
Definition: gsIterativeSolver.h:26
void finalizeIteration(VectorType &x)
Some post-processing might be required.
Definition: gsGMRes.hpp:45
index_t m_num_iter
The number of iterations performed.
Definition: gsIterativeSolver.h:256
LinOpPtr m_precond
The preconditioner.
Definition: gsIterativeSolver.h:253