23template<
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)
The generalized minimal residual (GMRES) method.
Definition gsGMRes.h:25
void finalizeIteration(VectorType &x)
Some post-processing might be required.
Definition gsGMRes.hpp:45
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
static uPtr make(const OperatorType &mat, const LinOpPtr &precond=LinOpPtr())
Make function using a matrix (operator) and optionally a preconditionner.
Definition gsGMRes.h:49
void solveUpperTriangular(const VectorType &R, const VectorType &gg)
Definition gsGMRes.h:60
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
Abstract class for iterative solvers.
Definition gsIterativeSolver.h:27
T m_rhs_norm
The norm of the right-hand-side.
Definition gsIterativeSolver.h:257
T m_error
The relative error as absolute_error/m_rhs_norm.
Definition gsIterativeSolver.h:258
LinOpPtr m_precond
The preconditioner.
Definition gsIterativeSolver.h:253
gsOptionList::Real m_tol
The tolerance for m_error to be reached.
Definition gsIterativeSolver.h:255
index_t m_num_iter
The number of iterations performed.
Definition gsIterativeSolver.h:256
index_t m_max_iters
The upper bound for the number of iterations.
Definition gsIterativeSolver.h:254
const LinOpPtr m_mat
The matrix/operator to be solved for.
Definition gsIterativeSolver.h:252
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
Abstract class for iterative solvers.
The G+Smo namespace, containing all definitions for the library.