Ifpack2 Templated Preconditioning Package Version 1.0
Ifpack2::Relaxation< MatrixType > Class Template Reference

Ifpack2::Relaxation: defines relaxation preconditioners for Tpetra::RowMatrix objects. More...

#include <Ifpack2_Relaxation_decl.hpp>

Inheritance diagram for Ifpack2::Relaxation< MatrixType >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 Relaxation (const Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &Matrix)
 Relaxation constructor with given Tpetra::RowMatrix input.
virtual ~Relaxation ()
 Relaxation Destructor.
void setParameters (const Teuchos::ParameterList &params)
 Sets all the parameters for the preconditioner.
void initialize ()
 Initialize.
bool isInitialized () const
 Returns true if the preconditioner has been successfully initialized.
void compute ()
 compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation parameters.
bool isComputed () const
 Return true if compute() has been called.
Methods implementing a Tpetra::Operator interface.
void apply (const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
 Applies the preconditioner to X, returns the result in Y.
const Teuchos::RCP< const
Tpetra::Map< LocalOrdinal,
GlobalOrdinal, Node > > & 
getDomainMap () const
 Returns the Tpetra::Map object associated with the domain of this operator.
const Teuchos::RCP< const
Tpetra::Map< LocalOrdinal,
GlobalOrdinal, Node > > & 
getRangeMap () const
 Returns the Tpetra::Map object associated with the range of this operator.
bool hasTransposeApply () const
void applyMat (const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS) const
 Applies the matrix to a Tpetra::MultiVector.
Mathematical functions.
magnitudeType computeCondEst (CondestType CT=Cheap, LocalOrdinal MaxIters=1550, magnitudeType Tol=1e-9, const Teuchos::Ptr< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &matrix=Teuchos::null)
 Computes the estimated condition number and returns the value.
Attribute accessor methods
magnitudeType getCondEst () const
 Returns the computed estimated condition number, or -1.0 if no computed.
const Teuchos::RCP< const
Teuchos::Comm< int > > & 
getComm () const
 Returns the Tpetra::BlockMap object associated with the range of this matrix operator.
Teuchos::RCP< const
Tpetra::RowMatrix< Scalar,
LocalOrdinal, GlobalOrdinal,
Node > > 
getMatrix () const
 Returns a reference to the matrix to be preconditioned.
double getComputeFlops () const
 Returns the number of flops in the computation phase.
double getApplyFlops () const
 Returns the number of flops for the application of the preconditioner.
int getNumInitialize () const
 Returns the number of calls to initialize().
int getNumCompute () const
 Returns the number of calls to compute().
int getNumApply () const
 Returns the number of calls to apply().
double getInitializeTime () const
 Returns the time spent in initialize().
double getComputeTime () const
 Returns the time spent in compute().
double getApplyTime () const
 Returns the time spent in apply().
Overridden from Teuchos::Describable
std::string description () const
 Return a simple one-line description of this object.
void describe (Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
 Print the object with some verbosity level to an FancyOStream object.

Detailed Description

template<class MatrixType>
class Ifpack2::Relaxation< MatrixType >

Ifpack2::Relaxation: defines relaxation preconditioners for Tpetra::RowMatrix objects.

The Ifpack2::Relaxation class enables the construction of relaxation preconditioners for Tpetra::RowMatrix. Ifpack2::Relaxation is derived from Ifpack2::Preconditioner, which is itself derived from Tpetra::Operator. Therefore this object can be used as preconditioner everywhere an apply() method is required in the preconditioning step.

This class enables the construction of the following simple preconditioners:

We now briefly describe the main features of the above preconditioners. Consider a linear system of type

\[ A x = b, \]

where \(A\) is a square, real matrix, and \(x, b\) are two real vectors. We begin with the decomposition

\[ A = D - E - F \]

where \(D\) is the diagonal of A, \(-E\) is the strict lower part, and \(-F\) is the strict upper part. It is assumed that the diagonal entries of \(A\) are different from zero.

Given an starting solution \(x_0\), an iteration of the (damped) Jacobi method can be written in matrix form as follows:

\[ x_{k+1} = \omega D^{-1}(E + F) x_k + D_{-1}b, \]

for \(k < k_{max}\), and \(\omega \) a damping parameter.

Using Ifpack2::Jacobi, the user can apply the specified number of sweeps ( \(k_{max}\)), and the damping parameter. If only one sweep is used, then the class simply applies the inverse of the diagonal of A to the input vector.

Given a starting solution \(x_0\), an iteration of the (damped) GaussSeidel method can be written in matrix form as follows:

\[ (D - E) x_{k+1} = \omega F x_k + b, \]

for \(k < k_{max}\), and \(\omega \) a damping parameter. Equivalently, the Gauss-Seidel preconditioner can be defined as

\[ P_{GS}^{-1} = (D - E)^{-1}. \]

Clearly, the role of E and F can be interchanged. However, Ifpack2::GaussSeidel does not consider backward Gauss-Seidel methods.

For a list of supported parameters, please refer to the Relaxation::setParameters method.

Author:
Michael Heroux, SNL 9214.
Date:
Last modified on 22-Jan-05.

Constructor & Destructor Documentation

template<class MatrixType >
Ifpack2::Relaxation< MatrixType >::Relaxation ( const Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &  Matrix) [explicit]

Relaxation constructor with given Tpetra::RowMatrix input.

template<class MatrixType >
Ifpack2::Relaxation< MatrixType >::~Relaxation ( ) [virtual]

Relaxation Destructor.


Member Function Documentation

template<class MatrixType >
void Ifpack2::Relaxation< MatrixType >::setParameters ( const Teuchos::ParameterList params) [virtual]

Sets all the parameters for the preconditioner.

Valid parameters include the following:

  • "relaxation: type"
    Valid values (string):
    • "Jacobi"
    • "Gauss-Seidel"
    • "Symmetric Gauss-Seidel"
  • "relaxation: sweeps" (int)
  • "relaxation: damping factor" (floating-point)
  • "relaxation: min diagonal value" (floating-point)
  • "relaxation: zero starting solution" (bool)
  • "relaxation: backward mode" (bool)

Implements Ifpack2::Preconditioner< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type >.

template<class MatrixType >
void Ifpack2::Relaxation< MatrixType >::initialize ( ) [virtual]
template<class MatrixType>
bool Ifpack2::Relaxation< MatrixType >::isInitialized ( ) const [inline, virtual]
template<class MatrixType >
void Ifpack2::Relaxation< MatrixType >::compute ( ) [virtual]

compute the preconditioner for the specified matrix, diagonal perturbation thresholds and relaxation parameters.

Implements Ifpack2::Preconditioner< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type >.

template<class MatrixType>
bool Ifpack2::Relaxation< MatrixType >::isComputed ( ) const [inline, virtual]
template<class MatrixType>
void Ifpack2::Relaxation< MatrixType >::apply ( const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  X,
Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  Y,
Teuchos::ETransp  mode = Teuchos::NO_TRANS,
Scalar  alpha = Teuchos::ScalarTraits< Scalar >::one(),
Scalar  beta = Teuchos::ScalarTraits< Scalar >::zero() 
) const [virtual]

Applies the preconditioner to X, returns the result in Y.

Parameters:
X- (In) A Tpetra::MultiVector of dimension NumVectors to be preconditioned.
Y- (InOut) A Tpetra::MultiVector of dimension NumVectors containing result.
Returns:
Integer error code, set to 0 if successful.
Warning:
This routine is NOT AztecOO compliant.

Implements Ifpack2::Preconditioner< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type >.

template<class MatrixType >
const Teuchos::RCP< const Tpetra::Map< typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > & Ifpack2::Relaxation< MatrixType >::getDomainMap ( ) const [virtual]
template<class MatrixType >
const Teuchos::RCP< const Tpetra::Map< typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > & Ifpack2::Relaxation< MatrixType >::getRangeMap ( ) const [virtual]
template<class MatrixType>
void Ifpack2::Relaxation< MatrixType >::applyMat ( const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  X,
Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &  Y,
Teuchos::ETransp  mode = Teuchos::NO_TRANS 
) const

Applies the matrix to a Tpetra::MultiVector.

Parameters:
X- (In) A Tpetra::MultiVector of dimension NumVectors to multiply with matrix.
Y- (Out) A Tpetra::MultiVector of dimension NumVectors containing the result.
template<class MatrixType>
magnitudeType Ifpack2::Relaxation< MatrixType >::computeCondEst ( CondestType  CT = Cheap,
LocalOrdinal  MaxIters = 1550,
magnitudeType  Tol = 1e-9,
const Teuchos::Ptr< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &  matrix = Teuchos::null 
) [virtual]
template<class MatrixType >
Teuchos::ScalarTraits< typename MatrixType::scalar_type >::magnitudeType Ifpack2::Relaxation< MatrixType >::getCondEst ( ) const [virtual]
template<class MatrixType >
const Teuchos::RCP< const Teuchos::Comm< int > > & Ifpack2::Relaxation< MatrixType >::getComm ( ) const

Returns the Tpetra::BlockMap object associated with the range of this matrix operator.

template<class MatrixType >
Teuchos::RCP< const Tpetra::RowMatrix< typename MatrixType::scalar_type, typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > Ifpack2::Relaxation< MatrixType >::getMatrix ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Relaxation< MatrixType >::getComputeFlops ( ) const

Returns the number of flops in the computation phase.

template<class MatrixType >
double Ifpack2::Relaxation< MatrixType >::getApplyFlops ( ) const

Returns the number of flops for the application of the preconditioner.

template<class MatrixType >
int Ifpack2::Relaxation< MatrixType >::getNumInitialize ( ) const [virtual]
template<class MatrixType >
int Ifpack2::Relaxation< MatrixType >::getNumCompute ( ) const [virtual]
template<class MatrixType >
int Ifpack2::Relaxation< MatrixType >::getNumApply ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Relaxation< MatrixType >::getInitializeTime ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Relaxation< MatrixType >::getComputeTime ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Relaxation< MatrixType >::getApplyTime ( ) const [virtual]
template<class MatrixType >
std::string Ifpack2::Relaxation< MatrixType >::description ( ) const

Return a simple one-line description of this object.

template<class MatrixType >
void Ifpack2::Relaxation< MatrixType >::describe ( Teuchos::FancyOStream out,
const Teuchos::EVerbosityLevel  verbLevel = Teuchos::Describable::verbLevel_default 
) const

Print the object with some verbosity level to an FancyOStream object.


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