10 #ifndef IFPACK2_CONDEST_HPP
11 #define IFPACK2_CONDEST_HPP
13 #include "Ifpack2_ConfigDefs.hpp"
14 #include "Ifpack2_CondestType.hpp"
16 #include <Teuchos_Ptr.hpp>
59 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
63 const int MaxIters = 1550,
65 const Teuchos::Ptr<
const Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& matrix_in = Teuchos::null)
69 typedef typename STS::magnitudeType MT;
71 typedef Tpetra::RowMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> row_matrix_type;
72 typedef Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> vec_type;
74 MT condNumEst = -STS::magnitude( STS::one() );
78 Ptr<const row_matrix_type> matrix = matrix_in;
79 if (matrix_in == Teuchos::null) {
82 matrix == Teuchos::null,
84 "Ifpack2::Condest: Both the input matrix (matrix_in) and the Ifpack2 "
85 "preconditioner's matrix are null, so we have no matrix with which to "
86 "compute a condition number estimate. This probably indicates a bug "
87 "in Ifpack2, since no Ifpack2::Preconditioner subclass should accept a"
93 ones.putScalar (STS::one ());
95 onesResult.putScalar (STS::zero ());
96 TIFP.
apply (ones, onesResult);
97 condNumEst = onesResult.normInf ();
99 STM::isnaninf (condNumEst),
101 "Ifpack2::Condest: $\\|A*[1, ..., 1]^T\\|_{\\infty}$ = " << condNumEst <<
" is NaN or Inf.");
104 true, std::logic_error,
105 "Ifpack2::Condest: Condition number estimation using CG is not currently supported.");
108 true, std::logic_error,
109 "Ifpack2::Condest: Condition number estimation using GMRES is not currently supported.");
116 #endif // IFPACK2_CONDEST_HPP
virtual Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const =0
The domain Map of this operator.
CondestType
Ifpack2::CondestType: enum to define the type of condition number estimate.
Definition: Ifpack2_CondestType.hpp:17
virtual Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMatrix() const =0
The input matrix given to the constructor.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const =0
The range Map of this operator.
Interface for all Ifpack2 preconditioners.
Definition: Ifpack2_Preconditioner.hpp:74
Uses AztecOO's CG.
Definition: Ifpack2_CondestType.hpp:19
Uses AztecOO's GMRES.
Definition: Ifpack2_CondestType.hpp:20
virtual 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 =0
Apply the preconditioner to X, putting the result in Y.
cheap estimate
Definition: Ifpack2_CondestType.hpp:18