Ifpack2 Templated Preconditioning Package Version 1.0
Public Types | Public Member Functions
Ifpack2::Diagonal< MatrixType > Class Template Reference

A class for diagonal preconditioning. More...

#include <Ifpack2_Diagonal_decl.hpp>

List of all members.

Public Types

typedef Tpetra::RowMatrix
< scalar_type,
local_ordinal_type,
global_ordinal_type, node_type > 
row_matrix_type
 Tpetra::RowMatrix specialization used by this class.
typedef Tpetra::CrsMatrix
< scalar_type,
local_ordinal_type,
global_ordinal_type, node_type > 
crs_matrix_type
 Tpetra::CrsMatrix specialization used by this class.

Public Member Functions

 Diagonal (const Teuchos::RCP< const row_matrix_type > &A)
 Constructor that takes a Tpetra::RowMatrix.
 Diagonal (const Teuchos::RCP< const crs_matrix_type > &A_in)
 Constructor that takes a Tpetra::CrsMatrix.
 Diagonal (const Teuchos::RCP< const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &diag)
 Constructor that accepts a Tpetra::Vector of diagonal entries.
virtual ~Diagonal ()
 Destructor.
void setParameters (const Teuchos::ParameterList &params)
 Sets parameters on this object.
void initialize ()
 Initialize.
bool isInitialized () const
 Returns true if the preconditioner has been successfully initialized.
void compute ()
 compute the preconditioner
bool isComputed () const
 Return true if compute() has been called.
Methods implementing a Tpetra::Operator interface.
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
 Applies the preconditioner to X, returns the result in Y.
Teuchos::RCP< const
Tpetra::Map
< local_ordinal_type,
global_ordinal_type, node_type > > 
getDomainMap () const
 Returns the Tpetra::Map object associated with the domain of this operator.
Teuchos::RCP< const
Tpetra::Map
< local_ordinal_type,
global_ordinal_type, node_type > > 
getRangeMap () const
 Returns the Tpetra::Map object associated with the range of this operator.
void applyMat (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) const
 Applies the matrix to a Tpetra::MultiVector.
Mathematical functions.
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=Teuchos::null)
 Compute the condition number estimate and return its value.
Attribute accessor methods
magnitude_type TEUCHOS_DEPRECATED getCondEst () const
 Return the computed condition number estimate, or -1 if not computed.
Teuchos::RCP< const
Teuchos::Comm< int > > 
getComm () const
 Return the communicator associated with this matrix operator.
Teuchos::RCP< const
Tpetra::RowMatrix< scalar_type,
local_ordinal_type,
global_ordinal_type, node_type > > 
getMatrix () const
 Return a reference to the matrix to be preconditioned.
double getComputeFlops () const
 Return the number of flops in the computation phase.
double getApplyFlops () const
 Return the number of flops for the application of the preconditioner.
int getNumInitialize () const
 Return the number of calls to initialize().
int getNumCompute () const
 Return the number of calls to compute().
int getNumApply () const
 Return the number of calls to apply().
double getInitializeTime () const
 Return the time spent in initialize().
double getComputeTime () const
 Return the time spent in compute().
double getApplyTime () const
 Return the time spent in apply().
Implementation of 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::Diagonal< MatrixType >

A class for diagonal preconditioning.

Ifpack2::Diagonal wraps a vector as a diagonal preconditioner. The preconditioner is simply defined by

\[ z_i = D_i r_i, \]

where \(r,z\) are the vector to be preconditioned and the preconditioned vector, and \(D_i\) is the i-th element of the scaling vector.

When Ifpack2::Diagonal is constructed with a matrix, \(D\) contains the inverted diagonal elements from the matrix.

When Ifpack2::Diagonal is constructed with a vector, \(D\) is the caller-supplied vector.

Author:
Michael Heroux, ETHZ/D-INFK
Date:
Ifpack2 conversion (from Ifpack code) 31-Mar-2010

Member Typedef Documentation

template<class MatrixType >
typedef Tpetra::RowMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> Ifpack2::Diagonal< MatrixType >::row_matrix_type

Tpetra::RowMatrix specialization used by this class.

template<class MatrixType >
typedef Tpetra::CrsMatrix<scalar_type, local_ordinal_type, global_ordinal_type, node_type> Ifpack2::Diagonal< MatrixType >::crs_matrix_type

Tpetra::CrsMatrix specialization used by this class.


Constructor & Destructor Documentation

template<class MatrixType >
Ifpack2::Diagonal< MatrixType >::Diagonal ( const Teuchos::RCP< const row_matrix_type > &  A)

Constructor that takes a Tpetra::RowMatrix.

Parameters:
A_in[in] The input matrix.
template<class MatrixType >
Ifpack2::Diagonal< MatrixType >::Diagonal ( const Teuchos::RCP< const crs_matrix_type > &  A_in)

Constructor that takes a Tpetra::CrsMatrix.

This constructor exists to avoid "ambiguous constructor" warnings. It does the same thing as the constructor that takes a Tpetra::RowMatrix.

Parameters:
A_in[in] The input matrix.
template<class MatrixType >
Ifpack2::Diagonal< MatrixType >::Diagonal ( const Teuchos::RCP< const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &  diag)

Constructor that accepts a Tpetra::Vector of diagonal entries.

If your compiler complains about this constructor being ambigous with the other constructor overload, instead call the free-standing function Ifpack2::createDiagonalPreconditioner which is located at the bottom of this header file. (This issue may arise if this constructor is called with a Teuchos::RCP<Tpetra::Vector> that isn't const-qualified exactly as declared here.)

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

Destructor.


Member Function Documentation

template<class MatrixType >
void Ifpack2::Diagonal< MatrixType >::setParameters ( const Teuchos::ParameterList params)

Sets parameters on this object.

Currently doesn't need any parameters.

template<class MatrixType >
void Ifpack2::Diagonal< MatrixType >::initialize ( )

Initialize.

template<class MatrixType >
bool Ifpack2::Diagonal< MatrixType >::isInitialized ( ) const [inline]

Returns true if the preconditioner has been successfully initialized.

template<class MatrixType >
void Ifpack2::Diagonal< MatrixType >::compute ( )

compute the preconditioner

template<class MatrixType >
bool Ifpack2::Diagonal< MatrixType >::isComputed ( ) const [inline]

Return true if compute() has been called.

template<class MatrixType >
void Ifpack2::Diagonal< 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::ScalarTraits<scalar_type>::one(),
scalar_type  beta = Teuchos::ScalarTraits<scalar_type>::zero() 
) const

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.
template<class MatrixType >
Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > Ifpack2::Diagonal< MatrixType >::getDomainMap ( ) const [inline]

Returns the Tpetra::Map object associated with the domain of this operator.

template<class MatrixType >
Teuchos::RCP<const Tpetra::Map<local_ordinal_type,global_ordinal_type,node_type> > Ifpack2::Diagonal< MatrixType >::getRangeMap ( ) const [inline]

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

template<class MatrixType >
void Ifpack2::Diagonal< MatrixType >::applyMat ( 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 
) 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 >
Teuchos::ScalarTraits< typename MatrixType::scalar_type >::magnitudeType Ifpack2::Diagonal< 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 = Teuchos::null 
)

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.
template<class MatrixType >
magnitude_type TEUCHOS_DEPRECATED Ifpack2::Diagonal< MatrixType >::getCondEst ( ) const [inline]

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

Warning:
This method is DEPRECATED. See warning for computeCondEst().
template<class MatrixType >
Teuchos::RCP<const Teuchos::Comm<int> > Ifpack2::Diagonal< MatrixType >::getComm ( ) const

Return the communicator associated with this matrix operator.

template<class MatrixType >
Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> > Ifpack2::Diagonal< MatrixType >::getMatrix ( ) const [inline]

Return a reference to the matrix to be preconditioned.

template<class MatrixType >
double Ifpack2::Diagonal< MatrixType >::getComputeFlops ( ) const

Return the number of flops in the computation phase.

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

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

template<class MatrixType >
int Ifpack2::Diagonal< MatrixType >::getNumInitialize ( ) const

Return the number of calls to initialize().

template<class MatrixType >
int Ifpack2::Diagonal< MatrixType >::getNumCompute ( ) const

Return the number of calls to compute().

template<class MatrixType >
int Ifpack2::Diagonal< MatrixType >::getNumApply ( ) const

Return the number of calls to apply().

template<class MatrixType >
double Ifpack2::Diagonal< MatrixType >::getInitializeTime ( ) const

Return the time spent in initialize().

template<class MatrixType >
double Ifpack2::Diagonal< MatrixType >::getComputeTime ( ) const

Return the time spent in compute().

template<class MatrixType >
double Ifpack2::Diagonal< MatrixType >::getApplyTime ( ) const

Return the time spent in apply().

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

Return a simple one-line description of this object.

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