44 #ifndef IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP 
   45 #define IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP 
   54 #include "Ifpack2_ConfigDefs.hpp" 
   56 #include "Teuchos_Describable.hpp" 
   57 #include "Tpetra_CrsMatrix.hpp" 
   62 #ifndef DOXYGEN_SHOULD_SKIP_THIS 
   63 template<
class TpetraOperatorType>
 
   64 class ScaledDampedResidual; 
 
   65 #endif // DOXYGEN_SHOULD_SKIP_THIS 
  105 template<
class ScalarType, 
class MV>
 
  112   typedef ScalarType 
ST;
 
  118   typedef Tpetra::Operator<
typename MV::scalar_type,
 
  119                            typename MV::local_ordinal_type,
 
  120                            typename MV::global_ordinal_type,
 
  123   typedef Tpetra::RowMatrix<
typename MV::scalar_type,
 
  124                            typename MV::local_ordinal_type,
 
  125                            typename MV::global_ordinal_type,
 
  128   typedef Tpetra::Vector<
typename MV::scalar_type,
 
  129                          typename MV::local_ordinal_type,
 
  130                          typename MV::global_ordinal_type,
 
  131                          typename MV::node_type> 
V;
 
  133   typedef Tpetra::Map<
typename MV::local_ordinal_type,
 
  134                       typename MV::global_ordinal_type,
 
  318   ST getLambdaMaxForApply() 
const;
 
  334   void print (std::ostream& out);
 
  377   typedef Kokkos::View<size_t*, typename MV::node_type::device_type> offsets_type;
 
  384   offsets_type diagOffsets_;
 
  393   bool savedDiagOffsets_;
 
  409   ST computedLambdaMax_;
 
  416   ST computedLambdaMin_;
 
  424   ST lambdaMaxForApply_;
 
  435   ST lambdaMinForApply_;
 
  438   ST eigRatioForApply_;
 
  478   bool zeroStartingSolution_;
 
  486   bool assumeMatrixUnchanged_;
 
  489   bool textbookAlgorithm_;
 
  492   bool computeMaxResNorm_;
 
  507   void checkConstructorInput () 
const;
 
  510   void checkInputMatrix () 
const;
 
  530   firstIterationWithZeroStartingSolution
 
  532    const ScalarType& alpha,
 
  539   computeResidual (MV& R, 
const MV& B, 
const op_type& A, 
const MV& X,
 
  547   static void solve (MV& Z, 
const V& D_inv, 
const MV& R);
 
  554   static void solve (MV& Z, 
const ST alpha, 
const V& D_inv, 
const MV& R);
 
  564   makeInverseDiagonal (
const row_matrix_type& A, 
const bool useDiagOffsets=
false) 
const;
 
  600   textbookApplyImpl (
const op_type& A,
 
  607                      const V& D_inv) 
const;
 
  632   ifpackApplyImpl (
const op_type& A,
 
  652   void computeInitialGuessForPowerMethod (
V& x, 
const bool nonnegativeRealParts = 
false) 
const;
 
  667   powerMethodWithInitGuess (
const op_type& A, 
const V& D_inv, 
const int numIters, 
V& x);
 
  679   powerMethod (
const op_type& A, 
const V& D_inv, 
const int numIters);
 
  682   static MT maxNormInf (
const MV& X);
 
  720     const ST zero = Teuchos::as<ST> (0);
 
  721     const ST one = Teuchos::as<ST> (1);
 
  722     const ST two = Teuchos::as<ST> (2);
 
  724     MV pAux (B.getMap (), B.getNumVectors ()); 
 
  725     MV dk (B.getMap (), B.getNumVectors ()); 
 
  726     MV R (B.getMap (), B.getNumVectors ()); 
 
  728     ST beta = Teuchos::as<ST> (1.1) * lambdaMax;
 
  729     ST alpha = lambdaMax / eigRatio;
 
  731     ST delta = (beta - alpha) / two;
 
  732     ST theta = (beta + alpha) / two;
 
  733     ST s1 = theta / delta;
 
  744     if (lambdaMin == one && lambdaMin == lambdaMax) {
 
  753     if (! zeroStartingSolution_) {
 
  757       R.update (-one, pAux, one); 
 
  758       dk.elementWiseMultiply (one/theta, D_inv, R, zero); 
 
  759       X.update (one, dk, one); 
 
  761       dk.elementWiseMultiply (one/theta, D_inv, B, zero); 
 
  765     ST rhokp1, dtemp1, dtemp2;
 
  766     for (
int k = 0; k < numIters-1; ++k) {
 
  768       rhokp1 = one / (two*s1 - rhok);
 
  769       dtemp1 = rhokp1*rhok;
 
  770       dtemp2 = two*rhokp1/delta;
 
  774       R.update (-one, pAux, one); 
 
  776       dk.elementWiseMultiply (dtemp2, D_inv, B, dtemp1);
 
  777       X.update (one, dk, one); 
 
  787 #endif // IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP 
void setParameters(Teuchos::ParameterList &plist)
Set (or reset) parameters. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:331
 
MT apply(const MV &B, MV &X)
Solve Ax=b for x with Chebyshev iteration with left diagonal scaling. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:907
 
Tpetra::Operator< typename MV::scalar_type, typename MV::local_ordinal_type, typename MV::global_ordinal_type, typename MV::node_type > op_type
Specialization of Tpetra::Operator. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:121
 
scalar_type magnitudeType
 
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const 
Print a description of the Chebyshev solver to out. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:1526
 
void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Set the matrix. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:695
 
Teuchos::RCP< const row_matrix_type > getMatrix() const 
Get the matrix given to the constructor. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:1476
 
Chebyshev(Teuchos::RCP< const row_matrix_type > A)
Definition: Ifpack2_Details_Chebyshev_def.hpp:277
 
Tpetra::Map< typename MV::local_ordinal_type, typename MV::global_ordinal_type, typename MV::node_type > map_type
Specialization of Tpetra::Map. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:135
 
void print(std::ostream &out)
Print instance data to the given output stream. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:960
 
STS::magnitudeType MT
The type of the absolute value of a ScalarType. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:116
 
ScalarType ST
The type of entries in the matrix and vectors. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:112
 
Tpetra::RowMatrix< typename MV::scalar_type, typename MV::local_ordinal_type, typename MV::global_ordinal_type, typename MV::node_type > row_matrix_type
Specialization of Tpetra::RowMatrix. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:126
 
Left-scaled Chebyshev iteration. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:106
 
static const EVerbosityLevel verbLevel_default
 
std::string description() const 
A single-line description of the Chebyshev solver. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:1508
 
Teuchos::ScalarTraits< ScalarType > STS
Traits class for ST. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:114
 
bool hasTransposeApply() const 
Whether it's possible to apply the transpose of this operator. 
Definition: Ifpack2_Details_Chebyshev_def.hpp:1483
 
void compute()
(Re)compute the left scaling D_inv, and estimate min and max eigenvalues of D_inv * A...
Definition: Ifpack2_Details_Chebyshev_def.hpp:737
 
Tpetra::Vector< typename MV::scalar_type, typename MV::local_ordinal_type, typename MV::global_ordinal_type, typename MV::node_type > V
Specialization of Tpetra::Vector. 
Definition: Ifpack2_Details_Chebyshev_decl.hpp:131