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

Wrapper for iterative linear solvers (e.g., CG or GMRES). More...

#include <Ifpack2_Krylov_decl.hpp>

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

List of all members.

Public Member Functions

 Krylov (const Teuchos::RCP< const row_matrix_type > &A)
 Constructor that takes a Tpetra::RowMatrix.
virtual ~Krylov ()
 Destructor.
Methods for setting parameters and initialization
void setParameters (const Teuchos::ParameterList &params)
 Set the preconditioner's parameters.
void initialize ()
 Do any initialization that depends on the input matrix's structure.
bool isInitialized () const
 Return true if initialize() completed successfully, else false.
void compute ()
 Do any initialization that depends on the input matrix's values.
bool isComputed () const
 Return true if compute() completed successfully, else false.
Implementation of Ifpack2::Details::CanChangeMatrix
virtual void setMatrix (const Teuchos::RCP< const row_matrix_type > &A)
 Change the matrix to be preconditioned.
Implementation of Tpetra::Operator
void apply (const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &X, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, scalar_type alpha=Teuchos::ScalarTraits< scalar_type >::one(), scalar_type beta=Teuchos::ScalarTraits< scalar_type >::zero()) const
 Apply the preconditioner to X, putting the result in Y.
Teuchos::RCP< const
Tpetra::Map
< local_ordinal_type,
global_ordinal_type, node_type > > 
getDomainMap () const
 Tpetra::Map representing the domain of this operator.
Teuchos::RCP< const
Tpetra::Map
< local_ordinal_type,
global_ordinal_type, node_type > > 
getRangeMap () const
 Tpetra::Map representing the range of this operator.
bool hasTransposeApply () const
 Whether this object's apply() method can apply the transpose (or conjugate transpose, if applicable).
virtual magnitude_type
TEUCHOS_DEPRECATED 
getCondEst () const
 Return the computed condition number estimate, or -1 if not computed.
Mathematical functions.
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_type,
local_ordinal_type,
global_ordinal_type, node_type > > 
getMatrix () const
 Returns a reference to the matrix to be preconditioned.
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().
virtual magnitude_type
TEUCHOS_DEPRECATED 
computeCondEst (CondestType CT=Cheap, local_ordinal_type MaxIters=1550, magnitude_type Tol=1e-9, const Teuchos::Ptr< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &Matrix_in=Teuchos::null)
 Compute the condition number estimate and return its value.
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.
typedef MatrixType::scalar_type scalar_type
 The type of the entries of the input MatrixType.
typedef BelosScalarType
< scalar_type >::type 
belos_scalar_type
 The scalar type used by Belos (which may not be scalar_type)
typedef
MatrixType::local_ordinal_type 
local_ordinal_type
 The type of local indices in the input MatrixType.
typedef
MatrixType::global_ordinal_type 
global_ordinal_type
 The type of global indices in the input MatrixType.
typedef MatrixType::node_type node_type
 The type of the Kokkos Node used by the input MatrixType.
typedef Teuchos::ScalarTraits
< scalar_type >::magnitudeType 
magnitude_type
 The type of the magnitude (absolute value) of a matrix entry.
typedef Tpetra::RowMatrix
< scalar_type,
local_ordinal_type,
global_ordinal_type, node_type
row_matrix_type
 Type of the Tpetra::RowMatrix specialization that this class uses.
typedef
Ifpack2::Preconditioner
< scalar_type,
local_ordinal_type,
global_ordinal_type, node_type
prec_type
 Type of the Ifpack2::Preconditioner specialization from which this class inherits.
TEUCHOS_DEPRECATED typedef
MatrixType::scalar_type 
Scalar
 Preserved only for backwards compatibility. Please use "scalar_type".
TEUCHOS_DEPRECATED typedef
MatrixType::local_ordinal_type 
LocalOrdinal
 Preserved only for backwards compatibility. Please use "local_ordinal_type".
TEUCHOS_DEPRECATED typedef
MatrixType::global_ordinal_type 
GlobalOrdinal
 Preserved only for backwards compatibility. Please use "global_ordinal_type".
TEUCHOS_DEPRECATED typedef
MatrixType::node_type 
Node
 Preserved only for backwards compatibility. Please use "node_type".
TEUCHOS_DEPRECATED typedef
Teuchos::ScalarTraits
< scalar_type >::magnitudeType 
magnitudeType
 Preserved only for backwards compatibility. Please use "magnitude_type".

Detailed Description

template<class MatrixType>
class Ifpack2::Krylov< MatrixType >

Wrapper for iterative linear solvers (e.g., CG or GMRES).

Ifpack2::Krylov computes a few iterations of CG/GMRES with zero initial guess as a smoother for a given Tpetra::RowMatrix.

For a list of all run-time parameters that this class accepts, see the documentation of setParameters().


Member Typedef Documentation

template<class MatrixType>
typedef MatrixType::scalar_type Ifpack2::Krylov< MatrixType >::scalar_type

The type of the entries of the input MatrixType.

template<class MatrixType>
typedef BelosScalarType<scalar_type>::type Ifpack2::Krylov< MatrixType >::belos_scalar_type

The scalar type used by Belos (which may not be scalar_type)

template<class MatrixType>
typedef MatrixType::local_ordinal_type Ifpack2::Krylov< MatrixType >::local_ordinal_type

The type of local indices in the input MatrixType.

template<class MatrixType>
typedef MatrixType::global_ordinal_type Ifpack2::Krylov< MatrixType >::global_ordinal_type

The type of global indices in the input MatrixType.

template<class MatrixType>
typedef MatrixType::node_type Ifpack2::Krylov< MatrixType >::node_type

The type of the Kokkos Node used by the input MatrixType.

template<class MatrixType>
typedef Teuchos::ScalarTraits<scalar_type>::magnitudeType Ifpack2::Krylov< MatrixType >::magnitude_type
template<class MatrixType>
typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> Ifpack2::Krylov< MatrixType >::row_matrix_type

Type of the Tpetra::RowMatrix specialization that this class uses.

Type of the Ifpack2::Preconditioner specialization from which this class inherits.


Constructor & Destructor Documentation

template<class MatrixType >
Ifpack2::Krylov< MatrixType >::Krylov ( const Teuchos::RCP< const row_matrix_type > &  A) [explicit]

Constructor that takes a Tpetra::RowMatrix.

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

Destructor.


Member Function Documentation

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

Set the preconditioner's parameters.

This preconditioner accepts the following parameters:

  • "krylov: iteration type" (std::string)
  • "krylov: number of iterations" (int)
  • "krylov: residual tolerance" (magnitude_type)

The "krylov: iteration type" parameter specifies the name of the iterative linear solver to use.

Note: Because some of the iterative solvers in Belos are not currently supported for complex types, the BelosSolverFactory is not used; Ifpack2::Krylov either uses Block GMRES or Block CG.

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

template<class MatrixType >
void Ifpack2::Krylov< MatrixType >::initialize ( ) [virtual]
template<class MatrixType>
bool Ifpack2::Krylov< MatrixType >::isInitialized ( ) const [inline, virtual]
template<class MatrixType >
void Ifpack2::Krylov< MatrixType >::compute ( ) [virtual]
template<class MatrixType>
bool Ifpack2::Krylov< MatrixType >::isComputed ( ) const [inline, virtual]
template<class MatrixType >
void Ifpack2::Krylov< MatrixType >::setMatrix ( const Teuchos::RCP< const row_matrix_type > &  A) [virtual]

Change the matrix to be preconditioned.

Parameters:
[in]AThe new matrix.
Postcondition:
! isInitialized ()
! isComputed ()

Calling this method resets the preconditioner's state. After calling this method with a nonnull input, you must first call initialize() and compute() (in that order) before you may call apply().

You may call this method with a null input. If A is null, then you may not call initialize() or compute() until you first call this method again with a nonnull input. This method invalidates any previous factorization whether or not A is null, so calling setMatrix() with a null input is one way to clear the preconditioner's state (and free any memory that it may be using).

The new matrix A need not necessarily have the same Maps or even the same communicator as the original matrix.

template<class MatrixType>
void Ifpack2::Krylov< MatrixType >::apply ( const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &  X,
Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &  Y,
Teuchos::ETransp  mode = Teuchos::NO_TRANS,
scalar_type  alpha = Teuchos::ScalarTraitsscalar_type >::one(),
scalar_type  beta = Teuchos::ScalarTraitsscalar_type >::zero() 
) const [virtual]
template<class MatrixType >
Teuchos::RCP< const Tpetra::Map< typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > Ifpack2::Krylov< MatrixType >::getDomainMap ( ) const [virtual]
template<class MatrixType >
Teuchos::RCP< const Tpetra::Map< typename MatrixType::local_ordinal_type, typename MatrixType::global_ordinal_type, typename MatrixType::node_type > > Ifpack2::Krylov< MatrixType >::getRangeMap ( ) const [virtual]
template<class MatrixType >
bool Ifpack2::Krylov< MatrixType >::hasTransposeApply ( ) const

Whether this object's apply() method can apply the transpose (or conjugate transpose, if applicable).

template<class MatrixType>
virtual magnitude_type TEUCHOS_DEPRECATED Ifpack2::Krylov< MatrixType >::getCondEst ( ) const [inline, virtual]

Return the computed condition number estimate, or -1 if not computed.

Warning:
This method is DEPRECATED. See warning for computeCondEst().

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

template<class MatrixType >
Teuchos::RCP< const Teuchos::Comm< int > > Ifpack2::Krylov< 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::Krylov< MatrixType >::getMatrix ( ) const [virtual]
template<class MatrixType >
int Ifpack2::Krylov< MatrixType >::getNumInitialize ( ) const [virtual]
template<class MatrixType >
int Ifpack2::Krylov< MatrixType >::getNumCompute ( ) const [virtual]
template<class MatrixType >
int Ifpack2::Krylov< MatrixType >::getNumApply ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Krylov< MatrixType >::getInitializeTime ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Krylov< MatrixType >::getComputeTime ( ) const [virtual]
template<class MatrixType >
double Ifpack2::Krylov< MatrixType >::getApplyTime ( ) const [virtual]
template<class MatrixType>
virtual magnitude_type TEUCHOS_DEPRECATED Ifpack2::Krylov< MatrixType >::computeCondEst ( CondestType  CT = Cheap,
local_ordinal_type  MaxIters = 1550,
magnitude_type  Tol = 1e-9,
const Teuchos::Ptr< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &  Matrix_in = Teuchos::null 
) [virtual]

Compute the condition number estimate and return its value.

Warning:
This method is DEPRECATED. It was inherited from Ifpack, and Ifpack never clearly stated what this method computes. Furthermore, Ifpack's method just estimates the condition number of the matrix A, and ignores the preconditioner -- which is probably not what users thought it did. If there is sufficient interest, we might reintroduce this method with a different meaning and a better algorithm.

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

template<class MatrixType >
std::string Ifpack2::Krylov< MatrixType >::description ( ) const

Return a simple one-line description of this object.

template<class MatrixType >
void Ifpack2::Krylov< 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.


Member Data Documentation

template<class MatrixType>
TEUCHOS_DEPRECATED typedef MatrixType::scalar_type Ifpack2::Krylov< MatrixType >::Scalar

Preserved only for backwards compatibility. Please use "scalar_type".

template<class MatrixType>
TEUCHOS_DEPRECATED typedef MatrixType::local_ordinal_type Ifpack2::Krylov< MatrixType >::LocalOrdinal

Preserved only for backwards compatibility. Please use "local_ordinal_type".

template<class MatrixType>
TEUCHOS_DEPRECATED typedef MatrixType::global_ordinal_type Ifpack2::Krylov< MatrixType >::GlobalOrdinal

Preserved only for backwards compatibility. Please use "global_ordinal_type".

template<class MatrixType>
TEUCHOS_DEPRECATED typedef MatrixType::node_type Ifpack2::Krylov< MatrixType >::Node

Preserved only for backwards compatibility. Please use "node_type".

template<class MatrixType>
TEUCHOS_DEPRECATED typedef Teuchos::ScalarTraits<scalar_type>::magnitudeType Ifpack2::Krylov< MatrixType >::magnitudeType

Preserved only for backwards compatibility. Please use "magnitude_type".

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


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