G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsPreconditionerFromOp< T > Class Template Reference

Detailed Description

template<class T>
class gismo::gsPreconditionerFromOp< T >

Simple class allowing to construct a preconditioner from a linear operator.

The class represents an iteration method in the form

\( x_{new} = x_{old} + \tau P (f - A*x_{old}).\)

Warning
The implemenation pf stepT assumes that P is symmetric.
+ Inheritance diagram for gsPreconditionerFromOp< T >:
+ Collaboration diagram for gsPreconditionerFromOp< T >:

Public Types

typedef gsLinearOperator< T > Base
 Base class.
 
typedef gsLinearOperator< T >::Ptr BasePtr
 Base class.
 
typedef memory::shared_ptr
< gsPreconditionerFromOp
Ptr
 Shared pointer for gsLinearOperator.
 
typedef memory::unique_ptr
< gsPreconditionerFromOp
uPtr
 Unique pointer for gsLinearOperator.
 

Public Member Functions

void apply (const gsMatrix< T > &rhs, gsMatrix< T > &x) const
 apply the operator on the input vector and store the result in x More...
 
index_t cols () const
 Returns the number of columns of the operator.
 
estimateLargestEigenvalueOfPreconditionedSystem (index_t steps=10) const
 Estimates the largest eigenvalue of \( PA \). More...
 
getDamping () const
 Get damping parameter.
 
index_t numOfSweeps ()
 Get the number of sweeps to be applied in the member function apply.
 
index_t rows () const
 Returns the number of rows of the operator.
 
void setDamping (const T tau)
 Set damping parameter.
 
void setNumOfSweeps (index_t n)
 Set the number of sweeps to be applied in the member function apply.
 
void setOptions (const gsOptionList &opt)
 Set options based on a gsOptionList object.
 
void step (const gsMatrix< T > &rhs, gsMatrix< T > &x) const
 Apply the method for given right hand side and current iterate. More...
 
virtual void stepT (const gsMatrix< T > &rhs, gsMatrix< T > &x) const
 Apply the transposed variant of the method for given right hand side and current iterate. More...
 
BasePtr underlyingOp () const
 Return the underlying operator \( A \).
 

Static Public Member Functions

static gsOptionList defaultOptions ()
 Get the default options as gsOptionList object.
 
static gsIdentityOp< T > Identity (const index_t dim)
 Identity operator.
 
static uPtr make (BasePtr underlying, BasePtr preconditioner, T tau=(T) 1)
 Make function returning a smart pointer. More...
 

Public Attributes

 __pad0__: m_underlying(give(underlying))
 Constructor. More...
 

Member Function Documentation

void apply ( const gsMatrix< T > &  input,
gsMatrix< T > &  x 
) const
inlinevirtual

apply the operator on the input vector and store the result in x

Parameters
inputInput vector
xresult vector

Reimplemented from gsPreconditionerOp< T >.

T estimateLargestEigenvalueOfPreconditionedSystem ( index_t  steps = 10) const
inlineinherited

Estimates the largest eigenvalue of \( PA \).

Parameters
stepsNumber of steps to be performed.
static uPtr make ( BasePtr  underlying,
BasePtr  preconditioner,
tau = (T)1 
)
inlinestatic

Make function returning a smart pointer.

Parameters
underlyingThe underlying operator \( A \).
preconditionerThe underlying preconditioner \( P \).
tauA damping parameter, defaulted to 1.
void step ( const gsMatrix< T > &  rhs,
gsMatrix< T > &  x 
) const
inlinevirtual

Apply the method for given right hand side and current iterate.

Parameters
rhsRight hand side vector
xCurrent iterate vector

Implements gsPreconditionerOp< T >.

virtual void stepT ( const gsMatrix< T > &  rhs,
gsMatrix< T > &  x 
) const
inlinevirtualinherited

Apply the transposed variant of the method for given right hand side and current iterate.

Parameters
rhsRight hand side vector
xCurrent iterate vector
Warning
Derived classes must overwrite this virtual function if the preconditioner is not symmetric.

Reimplemented in gsGaussSeidelOp< MatrixType, ordering >, gsMultiGridOp< T >, and gsCompositePrecOp< T >.

Member Data Documentation

__pad0__

Constructor.

Parameters
underlyingThe underlying operator \( A \).
preconditionerThe operator \( P \) to be used as preconditioner.
tauA damping parameter, defaulted to 1.