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

Detailed Description

template<typename MatrixType, gsGaussSeidel::ordering ordering = gsGaussSeidel::forward>
class gismo::gsGaussSeidelOp< MatrixType, ordering >

Gauss-Seidel preconditioner.

ordering can be gsGaussSeidel::forward, gsGaussSeidel::reverse or gsGaussSeidel::symmetric.

+ Inheritance diagram for gsGaussSeidelOp< MatrixType, ordering >:
+ Collaboration diagram for gsGaussSeidelOp< MatrixType, ordering >:

Public Types

typedef gsPreconditionerOp< TBase
 Base class.
 
typedef gsLinearOperator
< MatrixType::Scalar >::Ptr 
BasePtr
 Base class.
 
typedef memory::shared_ptr
< gsGaussSeidelOp
Ptr
 Shared pointer for gsGaussSeidelOp.
 
typedef MatrixType::Scalar T
 Scalar type.
 
typedef memory::unique_ptr
< gsGaussSeidelOp
uPtr
 Unique pointer for gsGaussSeidelOp.
 

Public Member Functions

void apply (const gsMatrix< MatrixType::Scalar > &input, gsMatrix< MatrixType::Scalar > &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.
 
MatrixType::Scalar estimateLargestEigenvalueOfPreconditionedSystem (index_t steps=10) const
 Estimates the largest eigenvalue of \( PA \). More...
 
 gsGaussSeidelOp (const MatrixType &mat)
 Constructor with given matrix.
 
 gsGaussSeidelOp (const MatrixPtr &mat)
 Constructor with shared pointer to matrix.
 
NestedMatrix matrix () const
 Returns the matrix.
 
MatrixPtr matrixPtr () const
 Returns a shared pinter to the matrix.
 
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 setNumOfSweeps (index_t n)
 Set the number of sweeps to be applied in the member function apply.
 
virtual 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...
 
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...
 
gsLinearOperator< T >::Ptr underlyingOp () const
 Return the underlying operator \( A \).
 

Static Public Member Functions

static gsOptionList defaultOptions ()
 Get the default options as gsOptionList object.
 
static gsIdentityOp
< MatrixType::Scalar > 
Identity (const index_t dim)
 Identity operator.
 

Private Attributes

NestedMatrix m_expr
 Nested Eigen expression.
 
const MatrixPtr m_mat
 Shared pointer to matrix (if needed)
 

Related Functions

(Note that these are not member functions.)

template<class Derived >
gsGaussSeidelOp< Derived >::uPtr makeGaussSeidelOp (const gsEigen::EigenBase< Derived > &mat)
 Returns a smart pointer to a Gauss-Seidel operator referring on mat. More...
 
template<class Derived >
gsGaussSeidelOp< Derived >::uPtr makeGaussSeidelOp (const memory::shared_ptr< Derived > &mat)
 Returns a smart pointer to a Jacobi operator referring on mat. More...
 
template<class Derived >
gsGaussSeidelOp< Derived,
gsGaussSeidel::reverse >::uPtr 
makeReverseGaussSeidelOp (const gsEigen::EigenBase< Derived > &mat)
 Returns a smart pointer to a reverse Gauss-Seidel operator referring on mat. More...
 
template<class Derived >
gsGaussSeidelOp< Derived,
gsGaussSeidel::reverse >::uPtr 
makeReverseGaussSeidelOp (const memory::shared_ptr< Derived > &mat)
 Returns a smart pointer to a reverse Gauss-Seidel operator referring on mat. More...
 
template<class Derived >
gsGaussSeidelOp< Derived,
gsGaussSeidel::symmetric >
::uPtr 
makeSymmetricGaussSeidelOp (const gsEigen::EigenBase< Derived > &mat)
 Returns a smart pointer to a symmetric Gauss-Seidel operator referring on mat. More...
 
template<class Derived >
gsGaussSeidelOp< Derived,
gsGaussSeidel::symmetric >
::uPtr 
makeSymmetricGaussSeidelOp (const memory::shared_ptr< Derived > &mat)
 Returns a smart pointer to a symmetric Gauss-Seidel operator referring on mat. More...
 

Member Function Documentation

void apply ( const gsMatrix< MatrixType::Scalar > &  input,
gsMatrix< MatrixType::Scalar > &  x 
) const
inlinevirtualinherited

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

Parameters
inputInput vector
xresult vector

Implements gsLinearOperator< MatrixType::Scalar >.

MatrixType::Scalar estimateLargestEigenvalueOfPreconditionedSystem ( index_t  steps = 10) const
inlineinherited

Estimates the largest eigenvalue of \( PA \).

Parameters
stepsNumber of steps to be performed.
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< MatrixType::Scalar >.

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

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 from gsPreconditionerOp< MatrixType::Scalar >.

Friends And Related Function Documentation

gsGaussSeidelOp< Derived >::uPtr makeGaussSeidelOp ( const gsEigen::EigenBase< Derived > &  mat)
related

Returns a smart pointer to a Gauss-Seidel operator referring on mat.

gsGaussSeidelOp< Derived >::uPtr makeGaussSeidelOp ( const memory::shared_ptr< Derived > &  mat)
related

Returns a smart pointer to a Jacobi operator referring on mat.

gsGaussSeidelOp< Derived, gsGaussSeidel::reverse >::uPtr makeReverseGaussSeidelOp ( const gsEigen::EigenBase< Derived > &  mat)
related

Returns a smart pointer to a reverse Gauss-Seidel operator referring on mat.

gsGaussSeidelOp< Derived, gsGaussSeidel::reverse >::uPtr makeReverseGaussSeidelOp ( const memory::shared_ptr< Derived > &  mat)
related

Returns a smart pointer to a reverse Gauss-Seidel operator referring on mat.

gsGaussSeidelOp< Derived, gsGaussSeidel::symmetric >::uPtr makeSymmetricGaussSeidelOp ( const gsEigen::EigenBase< Derived > &  mat)
related

Returns a smart pointer to a symmetric Gauss-Seidel operator referring on mat.

gsGaussSeidelOp< Derived, gsGaussSeidel::symmetric >::uPtr makeSymmetricGaussSeidelOp ( const memory::shared_ptr< Derived > &  mat)
related

Returns a smart pointer to a symmetric Gauss-Seidel operator referring on mat.