70 #ifndef IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP 71 #define IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP 80 #include <Ifpack2_ConfigDefs.hpp> 81 #include <Teuchos_VerbosityLevel.hpp> 82 #include <Teuchos_Describable.hpp> 83 #include <Tpetra_CrsMatrix.hpp> 127 template<
class ScalarType,
class MV,
class MAT>
132 typedef ScalarType ST;
133 typedef Teuchos::ScalarTraits<ScalarType> STS;
134 typedef typename STS::magnitudeType MT;
135 typedef Tpetra::Operator<
typename MV::scalar_type,
136 typename MV::local_ordinal_type,
137 typename MV::global_ordinal_type,
138 typename MV::node_type> OP;
139 typedef Tpetra::Vector<
typename MV::scalar_type,
140 typename MV::local_ordinal_type,
141 typename MV::global_ordinal_type,
142 typename MV::node_type> V;
143 typedef Tpetra::Map<
typename MV::local_ordinal_type,
144 typename MV::global_ordinal_type,
145 typename MV::node_type> map_type;
160 Chebyshev (Teuchos::RCP<const MAT> A, Teuchos::ParameterList& params);
315 MT
apply (
const MV& B, MV& X);
317 ST getLambdaMaxForApply()
const;
320 Teuchos::RCP<const MAT>
getMatrix ()
const;
326 void print (std::ostream& out);
337 describe (Teuchos::FancyOStream& out,
338 const Teuchos::EVerbosityLevel verbLevel =
339 Teuchos::Describable::verbLevel_default)
const;
345 Teuchos::RCP<const MAT> A_;
357 Teuchos::RCP<const V> D_;
364 Teuchos::ArrayRCP<size_t> diagOffsets_;
371 bool savedDiagOffsets_;
387 ST computedLambdaMax_;
391 ST computedLambdaMin_;
399 ST lambdaMaxForApply_;
402 ST lambdaMinForApply_;
405 ST eigRatioForApply_;
413 Teuchos::RCP<const V> userInvDiag_;
432 bool zeroStartingSolution_;
439 bool assumeMatrixUnchanged_;
441 bool textbookAlgorithm_;
443 bool computeMaxResNorm_;
450 void checkConstructorInput ()
const;
465 makeTempMultiVectors (Teuchos::RCP<MV>& V1,
471 computeResidual (MV& R,
const MV& B,
const MAT& A,
const MV& X,
472 const Teuchos::ETransp mode = Teuchos::NO_TRANS);
479 static void solve (MV& Z,
const V& D_inv,
const MV& R);
486 static void solve (MV& Z,
const ST alpha,
const V& D_inv,
const MV& R);
496 makeInverseDiagonal (
const MAT& A,
const bool useDiagOffsets=
false)
const;
502 Teuchos::RCP<V> makeRangeMapVector (
const V& D)
const;
523 textbookApplyImpl (
const MAT& A,
530 const V& D_inv)
const;
555 ifpackApplyImpl (
const MAT& A,
567 powerMethod (
const MAT& A,
const V& D_inv,
const int numIters);
570 static MT maxNormInf (
const MV& X);
599 mlApplyImpl (
const MAT& A,
608 const ST zero = Teuchos::as<ST> (0);
609 const ST one = Teuchos::as<ST> (1);
610 const ST two = Teuchos::as<ST> (2);
612 MV pAux (B.getMap (), B.getNumVectors ());
613 MV dk (B.getMap (), B.getNumVectors ());
614 MV R (B.getMap (), B.getNumVectors ());
616 ST beta = Teuchos::as<ST> (1.1) * lambdaMax;
617 ST alpha = lambdaMax / eigRatio;
619 ST delta = (beta - alpha) / two;
620 ST theta = (beta + alpha) / two;
621 ST s1 = theta / delta;
632 if (lambdaMin == one && lambdaMin == lambdaMax) {
641 if (! zeroStartingSolution_) {
645 R.update (-one, pAux, one);
646 dk.elementWiseMultiply (one/theta, D_inv, R, zero);
647 X.update (one, dk, one);
649 dk.elementWiseMultiply (one/theta, D_inv, B, zero);
653 ST rhokp1, dtemp1, dtemp2;
654 for (
int k = 0; k < numIters-1; ++k) {
656 rhokp1 = one / (two*s1 - rhok);
657 dtemp1 = rhokp1*rhok;
658 dtemp2 = two*rhokp1/delta;
662 R.update (-one, pAux, one);
664 dk.elementWiseMultiply (dtemp2, D_inv, B, dtemp1);
665 X.update (one, dk, one);
675 #endif // IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP MT apply(const MV &B, MV &X)
Solve Ax=b for x with Chebyshev iteration with left diagonal scaling.
Definition: Ifpack2_Chebyshev_def.hpp:199
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_Chebyshev_def.hpp:364
Chebyshev(Teuchos::RCP< const MAT > A)
Definition: Ifpack2_Details_Chebyshev_def.hpp:149
Ifpack2 implementation details.
void print(std::ostream &out)
Print instance data to the given output stream.
Definition: Ifpack2_Details_Chebyshev_def.hpp:648
Left-scaled Chebyshev iteration.
Definition: Ifpack2_Details_Chebyshev_decl.hpp:128
void setParameters(Teuchos::ParameterList &plist)
Set (or reset) parameters.
Definition: Ifpack2_Chebyshev_def.hpp:75
void compute()
(Re)compute the left scaling D_inv, and estimate min and max eigenvalues of D_inv * A...
Definition: Ifpack2_Chebyshev_def.hpp:270
bool hasTransposeApply() const
Whether it's possible to apply the transpose of this operator.
Definition: Ifpack2_Chebyshev_def.hpp:115
std::string description() const
A single-line description of the Chebyshev solver.
Definition: Ifpack2_Chebyshev_def.hpp:339
Ifpack2::Container: a pure virtual class for creating and solving local linear problems.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:67
Teuchos::RCP< const MAT > getMatrix() const
Get the matrix given to the constructor.
Definition: Ifpack2_Chebyshev_def.hpp:93