GEOS
Public Types | Public Member Functions | List of all members
geos::LinearOperator< VECTOR > Class Template Referenceabstract

Abstract base class for linear operators. More...

#include <LinearOperator.hpp>

Inheritance diagram for geos::LinearOperator< VECTOR >:
Inheritance graph
[legend]

Public Types

using Vector = VECTOR
 Alias for template parameter.
 

Public Member Functions

 LinearOperator ()=default
 Constructor.
 
virtual ~LinearOperator ()=default
 Destructor.
 
virtual void apply (Vector const &src, Vector &dst) const =0
 Apply operator to a vector, dst = this(src). More...
 
virtual void residual (Vector const &x, Vector const &b, Vector &r) const
 Compute residual r = b - this(x). More...
 
virtual globalIndex numGlobalRows () const =0
 
virtual globalIndex numGlobalCols () const =0
 
virtual globalIndex numGlobalNonzeros () const
 
virtual localIndex numLocalRows () const =0
 
virtual localIndex numLocalCols () const =0
 
virtual localIndex numLocalNonzeros () const
 
virtual MPI_Comm comm () const =0
 Get the MPI communicator the matrix was created with. More...
 

Detailed Description

template<typename VECTOR>
class geos::LinearOperator< VECTOR >

Abstract base class for linear operators.

Template Parameters
VECTORType of vector this operator can be applied to

Definition at line 34 of file LinearOperator.hpp.

Member Function Documentation

◆ apply()

template<typename VECTOR >
virtual void geos::LinearOperator< VECTOR >::apply ( Vector const &  src,
Vector dst 
) const
pure virtual

◆ comm()

template<typename VECTOR >
virtual MPI_Comm geos::LinearOperator< VECTOR >::comm ( ) const
pure virtual

◆ numGlobalCols()

template<typename VECTOR >
virtual globalIndex geos::LinearOperator< VECTOR >::numGlobalCols ( ) const
pure virtual

◆ numGlobalNonzeros()

template<typename VECTOR >
virtual globalIndex geos::LinearOperator< VECTOR >::numGlobalNonzeros ( ) const
inlinevirtual
Returns
the total number of nonzero entries in the operator.
Note
While "non-zero entries" is not a well-defined term for the abstract concept of a linear operator, in practice this value is needed to track runtime/memory complexity of the operator implementation. The function returns the number of nonzero floating-point values stored/used when applying to a vector. A matrix-free operator implemented without any additional FP storage may either return 0, or the (approximate) number of floating-point multiply operations performed by apply().

Reimplemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.

Definition at line 95 of file LinearOperator.hpp.

◆ numGlobalRows()

template<typename VECTOR >
virtual globalIndex geos::LinearOperator< VECTOR >::numGlobalRows ( ) const
pure virtual

◆ numLocalCols()

template<typename VECTOR >
virtual localIndex geos::LinearOperator< VECTOR >::numLocalCols ( ) const
pure virtual
Returns
the number of local columns.
Note
The use of term "local columns" refers not to physical partitioning of columns across ranks (as e.g. matrices are partitioned by rows and typically physically store all column entries), but to the partitioning of a compatible vector object that this operator can be applied to.

Implemented in geos::KrylovSolver< VECTOR >, geos::TransposeOperator< MATRIX >, geos::NormalOperator< MATRIX >, geos::InverseNormalOperator< LAI, SOLVER >, geos::BlockOperatorView< VECTOR, OPERATOR >, geos::BlockOperatorView< VECTOR, LinearOperator< VECTOR > >, geos::BlockOperatorView< VECTOR, OPERATOR >, geos::EpetraMatrix, geos::PetscMatrix, geos::HypreMatrix, geos::PreconditionerBase< LAI >, geos::PreconditionerBase< PetscInterface >, geos::PreconditionerBase< HypreInterface >, and geos::PreconditionerBase< TrilinosInterface >.

◆ numLocalNonzeros()

template<typename VECTOR >
virtual localIndex geos::LinearOperator< VECTOR >::numLocalNonzeros ( ) const
inlinevirtual
Returns
the number of nonzero entries in the local portion of the operator.

Reimplemented in geos::EpetraMatrix, geos::PetscMatrix, and geos::HypreMatrix.

Definition at line 117 of file LinearOperator.hpp.

◆ numLocalRows()

template<typename VECTOR >
virtual localIndex geos::LinearOperator< VECTOR >::numLocalRows ( ) const
pure virtual

◆ residual()

template<typename VECTOR >
virtual void geos::LinearOperator< VECTOR >::residual ( Vector const &  x,
Vector const &  b,
Vector r 
) const
inlinevirtual

Compute residual r = b - this(x).

Parameters
xInput solution.
bInput right hand side.
rOutput residual.
Warning
b and x may alias the same vector. r cannot alias any of the other two vectors (some implementations may allow this).

Reimplemented in geos::MatrixBase< MATRIX, VECTOR >, geos::MatrixBase< HypreMatrix, HypreVector >, geos::MatrixBase< PetscMatrix, PetscVector >, and geos::MatrixBase< EpetraMatrix, EpetraVector >.

Definition at line 70 of file LinearOperator.hpp.


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