LifeV
ApproximatedInvertibleRowMatrix Class Reference

Provide the ApplyInverse method for a Epetra_CrsMatrix object. More...

#include <ApproximatedInvertibleRowMatrix.hpp>

+ Inheritance diagram for ApproximatedInvertibleRowMatrix:
+ Collaboration diagram for ApproximatedInvertibleRowMatrix:

Public Member Functions

 ApproximatedInvertibleRowMatrix ()
 
virtual ~ApproximatedInvertibleRowMatrix ()
 
int Compute ()
 
std::shared_ptr< RowMatrixPreconditioner > & Preconditioner ()
 
- Public Member Functions inherited from LinearOperatorAlgebra
virtual ~LinearOperatorAlgebra ()
 Destructor. More...
 
int apply (const VectorEpetra &X, VectorEpetra &Y) const
 Returns the result of a LinearOperator applied to a VectorEpetra X in Y. More...
 
int applyInverse (const VectorEpetra &X, VectorEpetra &Y)
 Returns the result of a LinearOperator inverse applied to an VectorEpetra X in Y. More...
 

Private Attributes

bool usePreconditionerAsApproximatedInverse
 
rowMatrixPtr_Type M_rowMatrix
 
std::shared_ptr< RowMatrixPreconditionerM_prec
 
std::shared_ptr< InvertibleOperatorM_linSolver
 
pList_Type M_pList
 

Public Typedef

typedef Epetra_CrsMatrix rowMatrix_Type
 
typedef std::shared_ptr< rowMatrix_TyperowMatrixPtr_Type
 
typedef Teuchos::ParameterList pList_Type
 

Attribute set methods

void SetRowMatrix (const rowMatrixPtr_Type &rowMatrix)
 
void SetParameterList (const pList_Type pList)
 
virtual int SetUseTranspose (bool UseTranspose)
 not fully supported! More...
 

Mathematical functions

virtual int Apply (const vector_Type &X, vector_Type &Y) const
 Returns the result of a raw_operator applied to a raw_vector X in Y. More...
 
virtual int ApplyInverse (const vector_Type &X, vector_Type &Y) const
 Returns the result of a raw_operator inverse applied to an raw_vector X in Y. More...
 
virtual double NormInf () const
 Returns the infinity norm of the global matrix. More...
 

Attribute access functions

virtual const char * Label () const
 Returns a character string describing the operator. More...
 
virtual bool UseTranspose () const
 Returns the current UseTranspose setting. More...
 
virtual bool HasNormInf () const
 Returns true if the this object can provide an approximate Inf-norm, false otherwise. More...
 
virtual const comm_TypeComm () const
 Returns a pointer to the Epetra_Comm communicator associated with this operator. More...
 
virtual const map_TypeOperatorDomainMap () const
 Returns the raw_map object associated with the domain of this operator. More...
 
virtual const map_TypeOperatorRangeMap () const
 Returns the raw_map object associated with the range of this operator. More...
 

Additional Inherited Members

- Public Types inherited from LinearOperatorAlgebra
typedef Epetra_Comm comm_Type
 
typedef std::shared_ptr< comm_TypecommPtr_Type
 
typedef Epetra_Map map_Type
 
typedef std::shared_ptr< map_TypemapPtr_Type
 
typedef std::shared_ptr< const map_TypeconstMapPtr_Type
 
typedef Epetra_Operator operator_Type
 
typedef std::shared_ptr< operator_TypeoperatorPtr_Type
 
typedef Epetra_MultiVector vector_Type
 
typedef std::shared_ptr< vector_TypevectorPtr_Type
 

Detailed Description

Provide the ApplyInverse method for a Epetra_CrsMatrix object.

ApproximatedInvertibleRowMatrix is derived by the LinearOperator class, and it can be used to approximate the inverse of a Epetra_CsrMatrix, either by using the Krylov methods in Belos or AztecOO or the preconditioning techniques in ML or Ifpack. Internally ApproximatedInvertibleRowMatrix contains pointers to a Epetra_CsrMatrix, to an InvertibleOperator object (that provides the interface to AztecOO or Belos), and RowMatrixPreconditioner (the provides the interface to Ifpack or ML).

The parameters to set up the Krylov methods or the preconditioner are given by using a Teuchos Parameter List. Below how the parameter list would look like:

*         <ParameterList name="ApproximatedInvertibleRowMatrix">
*           <Parameter name="use preconditioner as approximated inverse" type="bool" value="false"/>
*           <Parameter name="preconditioner type" type="string" value="ML"/> <!-- Ifpack, ML, TwoLevel-->
*           <ParameterList name="solver">
*              <Parameter name="Linear Solver Type" type="string" value="Belos"/>
*              <ParameterList name="AztecOO">
*                 <Parameter name="conv" type="string" value="r0"/>
*                 <Parameter name="max_iter" type="int" value="1500"/>
*                 <Parameter name="output" type="string" value="warnings"/>
*                 <Parameter name="scaling" type="string" value="none"/>
*                 <Parameter name="solver" type="string" value="cg"/>
*                 <Parameter name="tol" type="double" value="1e-03"/>
*              </ParameterList>
*              <ParameterList name="Belos">
*                  <Parameter name="Solver Type" type="string" value="RCG"/>
*                  <Parameter name="Preconditioner Side" type="string" value="Left"/>
*                  <ParameterList name="options">
*                      <Parameter name="Maximum Iterations" type="int" value="50"/>
*                      <Parameter name="Num Blocks" type="int" value="50"/>
*                      <Parameter name="Num Recycled Blocks" type="int" value="10"/>
*                      <Parameter name="Convergence Tolerance" type="double" value="1e-03"/>
*                      <Parameter name="Output Frequency" type="int" value="1"/>
*                      <Parameter name="Verbosity" type="int" value="0"/>
*                  </ParameterList>
*              </ParameterList>
*           </ParameterList>
*           <ParameterList name="preconditioner">
*               <ParameterList name="ML">
*                   <ParameterList name="options">
*                       <Parameter name="default values" type="string" value="SA"/>
*                   </ParameterList>
*               </ParameterList>
*           </ParameterList>
*       </ParameterList>
*  

Definition at line 87 of file ApproximatedInvertibleRowMatrix.hpp.

Member Typedef Documentation

◆ rowMatrix_Type

typedef Epetra_CrsMatrix rowMatrix_Type

Definition at line 93 of file ApproximatedInvertibleRowMatrix.hpp.

◆ rowMatrixPtr_Type

typedef std::shared_ptr<rowMatrix_Type> rowMatrixPtr_Type

Definition at line 94 of file ApproximatedInvertibleRowMatrix.hpp.

◆ pList_Type

typedef Teuchos::ParameterList pList_Type

Definition at line 95 of file ApproximatedInvertibleRowMatrix.hpp.

Constructor & Destructor Documentation

◆ ApproximatedInvertibleRowMatrix()

◆ ~ApproximatedInvertibleRowMatrix()

Member Function Documentation

◆ SetRowMatrix()

void SetRowMatrix ( const rowMatrixPtr_Type rowMatrix)

Definition at line 24 of file ApproximatedInvertibleRowMatrix.cpp.

◆ SetParameterList()

void SetParameterList ( const pList_Type  pList)

Definition at line 34 of file ApproximatedInvertibleRowMatrix.cpp.

◆ SetUseTranspose()

int SetUseTranspose ( bool  UseTranspose)
virtual

not fully supported!

Implements LinearOperatorAlgebra.

Definition at line 49 of file ApproximatedInvertibleRowMatrix.cpp.

◆ Compute()

int Compute ( )

Definition at line 54 of file ApproximatedInvertibleRowMatrix.cpp.

◆ Preconditioner()

std::shared_ptr<RowMatrixPreconditioner>& Preconditioner ( )
inline

Definition at line 113 of file ApproximatedInvertibleRowMatrix.hpp.

◆ Apply()

int Apply ( const vector_Type X,
vector_Type Y 
) const
virtual

Returns the result of a raw_operator applied to a raw_vector X in Y.

Parameters
InX - A raw_vector of dimension NumVectors to multiply with matrix.
OutY -A raw_vector of dimension NumVectors containing result.
Returns
Integer error code, set to 0 if successful.

Implements LinearOperatorAlgebra.

Definition at line 77 of file ApproximatedInvertibleRowMatrix.cpp.

◆ ApplyInverse()

int ApplyInverse ( const vector_Type X,
vector_Type Y 
) const
inlinevirtual

Returns the result of a raw_operator inverse applied to an raw_vector X in Y.

Parameters
InX - A raw_vector of dimension NumVectors to solve for.
OutY -A raw_vector of dimension NumVectors containing result.
Returns
Integer error code, set to 0 if successful.
Warning
In order to work with AztecOO, any implementation of this method must support the case where X and Y are the same object.

Implements LinearOperatorAlgebra.

Definition at line 82 of file ApproximatedInvertibleRowMatrix.cpp.

◆ NormInf()

double NormInf ( ) const
virtual

Returns the infinity norm of the global matrix.

Implements LinearOperatorAlgebra.

Definition at line 93 of file ApproximatedInvertibleRowMatrix.cpp.

◆ Label()

const char * Label ( ) const
virtual

Returns a character string describing the operator.

Implements LinearOperatorAlgebra.

Definition at line 98 of file ApproximatedInvertibleRowMatrix.cpp.

◆ UseTranspose()

bool UseTranspose ( ) const
virtual

Returns the current UseTranspose setting.

Implements LinearOperatorAlgebra.

Definition at line 103 of file ApproximatedInvertibleRowMatrix.cpp.

◆ HasNormInf()

bool HasNormInf ( ) const
virtual

Returns true if the this object can provide an approximate Inf-norm, false otherwise.

Implements LinearOperatorAlgebra.

Definition at line 108 of file ApproximatedInvertibleRowMatrix.cpp.

◆ Comm()

const LinearOperatorAlgebra::comm_Type & Comm ( ) const
virtual

Returns a pointer to the Epetra_Comm communicator associated with this operator.

Implements LinearOperatorAlgebra.

Definition at line 113 of file ApproximatedInvertibleRowMatrix.cpp.

◆ OperatorDomainMap()

const LinearOperatorAlgebra::map_Type & OperatorDomainMap ( ) const
virtual

Returns the raw_map object associated with the domain of this operator.

Implements LinearOperatorAlgebra.

Definition at line 118 of file ApproximatedInvertibleRowMatrix.cpp.

◆ OperatorRangeMap()

const LinearOperatorAlgebra::map_Type & OperatorRangeMap ( ) const
virtual

Returns the raw_map object associated with the range of this operator.

Implements LinearOperatorAlgebra.

Definition at line 123 of file ApproximatedInvertibleRowMatrix.cpp.

Field Documentation

◆ usePreconditionerAsApproximatedInverse

bool usePreconditionerAsApproximatedInverse
private

Definition at line 152 of file ApproximatedInvertibleRowMatrix.hpp.

◆ M_rowMatrix

rowMatrixPtr_Type M_rowMatrix
private

Definition at line 153 of file ApproximatedInvertibleRowMatrix.hpp.

◆ M_prec

std::shared_ptr<RowMatrixPreconditioner> M_prec
private

Definition at line 154 of file ApproximatedInvertibleRowMatrix.hpp.

◆ M_linSolver

std::shared_ptr<InvertibleOperator> M_linSolver
private

Definition at line 155 of file ApproximatedInvertibleRowMatrix.hpp.

◆ M_pList

pList_Type M_pList
private

Definition at line 156 of file ApproximatedInvertibleRowMatrix.hpp.


The documentation for this class was generated from the following files: