Belos Package Browser (Single Doxygen Collection) Development
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
Belos::OpAkx< Scalar, MV, OP > Class Template Reference

Base for Akx implementations using only abstract operators. More...

#include <BelosOpAkx.hpp>

Inheritance diagram for Belos::OpAkx< Scalar, MV, OP >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 OpAkx (const Teuchos::RCP< const OP > &A, const Teuchos::RCP< const OP > &M_left, const Teuchos::RCP< const OP > &M_right, const int recommendedBasisLength)
 Constructor.
int maxCandidateBasisLength () const
 Maximum candidate basis length.
int recommendedCandidateBasisLength () const
 (Initial) recommended candidate basis length.

Protected Member Functions

void applyOp (const MV &v_prv, MV &v_cur)
 Apply the "operator" M_left*A*M_right.
void applyFlexibleOp (const MV &v_prv, MV &z_cur, MV &v_cur)
 Apply the "flexible operator.".

Private Member Functions

int validatedBasisLength (const int len) const
 Validate and return the given recommended candidate basis length.

Private Attributes

Teuchos::RCP< const OP > A_
 The matrix A of interest.
Teuchos::RCP< const OP > M_left_
 The left preconditioner (null means the identity operator)
Teuchos::RCP< const OP > M_right_
 The right preconditioner (null means the identity operator)
Teuchos::RCP< const MV > v_scratch_
 Scratch space for applying preconditioners.

Detailed Description

template<class Scalar, class MV, class OP>
class Belos::OpAkx< Scalar, MV, OP >

Base for Akx implementations using only abstract operators.

Author:
Mark Hoemmen
Warning:
This is EXPERIMENTAL CODE. DO NOT RELY ON THIS CODE. The interface or implementation may change at any time.

It's not always beneficial or desirable to use a matrix powers kernel implementation that expensively reorganizes the sparse matrix and preconditioners. Also, in some cases, we might only have access to the matrix as an abstract operator, or the operator might not even be represented as a matrix. In these cases, subclasses of OpAkx can be useful. They implement the matrix powers kernel straightforwardly, using s applications of the operator (including left and/or right preconditioner(s), if provided) to generate s basis vectors. Subclasses implement specific basis types, like monomial or Newton.

Definition at line 71 of file BelosOpAkx.hpp.


Constructor & Destructor Documentation

template<class Scalar , class MV , class OP >
Belos::OpAkx< Scalar, MV, OP >::OpAkx ( const Teuchos::RCP< const OP > &  A,
const Teuchos::RCP< const OP > &  M_left,
const Teuchos::RCP< const OP > &  M_right,
const int  recommendedBasisLength 
) [inline]

Constructor.

Parameters:
A[in] The matrix of interest.
M_left[in] If not null, the left preconditioner, or split preconditioner if M_right is also not null.
M_right[in] If not null, the right preconditioner, or split preconditioner if M_left is also not null.
recommendedBasisLength[in] The basis length recommended, at least initially, for good performance, numerical stability, or both.

Definition at line 86 of file BelosOpAkx.hpp.


Member Function Documentation

template<class Scalar , class MV , class OP >
int Belos::OpAkx< Scalar, MV, OP >::maxCandidateBasisLength ( ) const [inline, virtual]

Maximum candidate basis length.

Implements Belos::Akx< Scalar, MV >.

Definition at line 97 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
int Belos::OpAkx< Scalar, MV, OP >::recommendedCandidateBasisLength ( ) const [inline, virtual]

(Initial) recommended candidate basis length.

Implements Belos::Akx< Scalar, MV >.

Definition at line 106 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
void Belos::OpAkx< Scalar, MV, OP >::applyOp ( const MV &  v_prv,
MV &  v_cur 
) [inline, protected]

Apply the "operator" M_left*A*M_right.

The operator is suitable for (CA-)GMRES and for unpreconditioned iterative methods (where M_left and M_right are each the identity operator). This method computes v_cur := M_left * (A * (M_right * v_prv)), where "*" indicates the "apply" operation which Belos::OperatorTraits::Apply() performs.

This method has been made available so that subclasses don't have to access A, M_left_, or M_right_ directly, and also to avoid duplicated code.

Parameters:
v_prv[in] Vector to which to apply the operator.
v_cur[out] Result of applying the operator to z_cur.

Definition at line 127 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
void Belos::OpAkx< Scalar, MV, OP >::applyFlexibleOp ( const MV &  v_prv,
MV &  z_cur,
MV &  v_cur 
) [inline, protected]

Apply the "flexible operator.".

The flexible operator is suitable for (CA-) Flexible GMRES. This method first applies the right preconditioner to v_prv, storing the result in z_cur. If the right preconditioner is the identity operator, v_prv is just copied into z_cur. Then, this method applies the matrix A to z_cur, storing the result in v_cur.

This method has been made available so that subclasses don't have to access A, M_left_, or M_right_ directly, and also to avoid duplicated code.

Parameters:
v_prv[in] Vector to which to apply the right preconditioner.
z_cur[out] Result of applying the right preconditioner to v_cur.
v_cur[out] Result of applying the matrix A to z_cur.

Definition at line 175 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
int Belos::OpAkx< Scalar, MV, OP >::validatedBasisLength ( const int  len) const [inline, private]

Validate and return the given recommended candidate basis length.

Definition at line 196 of file BelosOpAkx.hpp.


Member Data Documentation

template<class Scalar , class MV , class OP >
Teuchos::RCP<const OP> Belos::OpAkx< Scalar, MV, OP >::A_ [private]

The matrix A of interest.

Definition at line 204 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
Teuchos::RCP<const OP> Belos::OpAkx< Scalar, MV, OP >::M_left_ [private]

The left preconditioner (null means the identity operator)

Definition at line 206 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
Teuchos::RCP<const OP> Belos::OpAkx< Scalar, MV, OP >::M_right_ [private]

The right preconditioner (null means the identity operator)

Definition at line 208 of file BelosOpAkx.hpp.

template<class Scalar , class MV , class OP >
Teuchos::RCP<const MV> Belos::OpAkx< Scalar, MV, OP >::v_scratch_ [private]

Scratch space for applying preconditioners.

This vector is allocated only when necessary, and the allocation is kept for later use.

FIXME (mfh 09 Feb 2011) Since Belos::MultiVecTraits doesn't have a way to compare different multivectors' Maps, caching the allocation here is subject to possible bugs if the operators are changed such that their inputs or outputs have different Maps.

Definition at line 219 of file BelosOpAkx.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines