G+Smo
24.08.0
Geometry + Simulation Modules
|
Abstract class for iterative solvers.
Public Member Functions | |
virtual std::string | detail () const |
Prints the object as a string with extended details. | |
T | error () const |
The relative residual error of the current iterate. More... | |
virtual void | finalizeIteration (VectorType &) |
Some post-processing might be required. | |
gsIterativeSolver (const LinOpPtr &mat, const LinOpPtr &precond) | |
Contructor using a linear operator to be solved for and a preconditioner. More... | |
template<typename Derived > | |
gsIterativeSolver (const gsEigen::EigenBase< Derived > &mat, const LinOpPtr &precond) | |
Contructor using any dense or sparse matrix and a preconditioner. More... | |
virtual bool | initIteration (const VectorType &rhs, VectorType &x) |
Init the iteration. | |
index_t | iterations () const |
The number of iterations needed to reach the error criteria. | |
LinOpPtr | preconditioner () const |
Get the preconditioner. | |
virtual std::ostream & | print (std::ostream &os) const =0 |
Prints the object as a string. | |
void | setMaxIterations (index_t max_iters) |
Set the maximum number of iterations (default: 1000) | |
virtual gsIterativeSolver & | setOptions (const gsOptionList &opt) |
Set the options based on a gsOptionList. | |
void | setPreconditioner (const LinOpPtr &precond) |
Set the preconditionner. | |
void | setTolerance (T tol) |
Set the tolerance for the error criteria on the relative residual error (default: 1e-10) | |
index_t | size () const |
Returns the size of the linear system. | |
void | solve (const VectorType &rhs, VectorType &x) |
Solves the linear system and stores the solution in x. More... | |
void | solveDetailed (const VectorType &rhs, VectorType &x, VectorType &error_history) |
Solves the linear system and stores the solution in x and records the error histroy. More... | |
virtual bool | step (VectorType &x)=0 |
Perform one step, requires initIteration. | |
T | tolerance () const |
The chosen tolerance for the error criteria on the relative residual error. | |
LinOpPtr | underlying () const |
Get the underlying matrix/operator to be solved for. | |
Static Public Member Functions | |
static gsOptionList | defaultOptions () |
Returns a list of default options. | |
Protected Attributes | |
T | m_error |
The relative error as absolute_error/m_rhs_norm. | |
const LinOpPtr | m_mat |
The matrix/operator to be solved for. | |
index_t | m_max_iters |
The upper bound for the number of iterations. | |
index_t | m_num_iter |
The number of iterations performed. | |
LinOpPtr | m_precond |
The preconditioner. | |
T | m_rhs_norm |
The norm of the right-hand-side. | |
gsOptionList::Real | m_tol |
The tolerance for m_error to be reached. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
std::ostream & | operator<< (std::ostream &os, const gsIterativeSolver< T > &b) |
Print (as string) operator for iterative solvers. More... | |
|
inline |
Contructor using a linear operator to be solved for and a preconditioner.
mat | The operator to be solved for as shared pointer to a gsLinearOperator |
precond | The preconditioneras shared pointer to a gsLinearOperator, a null pointer is defaulted to the identity |
|
inline |
Contructor using any dense or sparse matrix and a preconditioner.
mat | The operator to be solved for as a (reference) to a matrix. |
precond | The preconditioneras shared pointer to a gsLinearOperator, a null pointer is defaulted to the identity |
|
inline |
The relative residual error of the current iterate.
This is the Euclidean norm of the residual, devided by the Euclidean norm of the right-hand side.
|
inline |
Solves the linear system and stores the solution in x.
Solves the linear system of equations
[in] | rhs | the right hand side of the linear system |
[in,out] | x | starting value; the solution is stored in here |
|
inline |
Solves the linear system and stores the solution in x and records the error histroy.
Solves the linear system of equations
[in] | rhs | the right hand side of the linear system |
[in,out] | x | starting value; the solution is stored in here |
[out] | error_history | the error history is stored here |
|
related |
Print (as string) operator for iterative solvers.