44#ifndef IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP
45#define IFPACK2_DETAILS_CHEBYSHEV_DECL_HPP
54#include "Ifpack2_ConfigDefs.hpp"
55#include "Teuchos_VerbosityLevel.hpp"
56#include "Teuchos_Describable.hpp"
57#include "Tpetra_CrsMatrix.hpp"
62#ifndef DOXYGEN_SHOULD_SKIP_THIS
63template<
class TpetraOperatorType>
108template<
class ScalarType,
class MV>
117 typedef Teuchos::ScalarTraits<ScalarType>
STS;
119 typedef typename STS::magnitudeType
MT;
121 typedef Tpetra::Operator<
typename MV::scalar_type,
122 typename MV::local_ordinal_type,
123 typename MV::global_ordinal_type,
126 typedef Tpetra::RowMatrix<
typename MV::scalar_type,
127 typename MV::local_ordinal_type,
128 typename MV::global_ordinal_type,
131 typedef Tpetra::Vector<
typename MV::scalar_type,
132 typename MV::local_ordinal_type,
133 typename MV::global_ordinal_type,
134 typename MV::node_type>
V;
136 typedef Tpetra::Map<
typename MV::local_ordinal_type,
137 typename MV::global_ordinal_type,
148 Chebyshev (Teuchos::RCP<const row_matrix_type> A);
159 Chebyshev (Teuchos::RCP<const row_matrix_type> A, Teuchos::ParameterList&
params);
271 void setZeroStartingSolution (
bool zeroStartingSolution) { zeroStartingSolution_ = zeroStartingSolution; }
326 ST getLambdaMaxForApply()
const;
329 Teuchos::RCP<const row_matrix_type>
getMatrix ()
const;
336 void setMatrix (
const Teuchos::RCP<const row_matrix_type>& A);
354 const Teuchos::EVerbosityLevel
verbLevel =
355 Teuchos::Describable::verbLevel_default)
const;
367 Teuchos::RCP<const row_matrix_type> A_;
370 Teuchos::RCP<ChebyshevKernel<op_type> > ck_;
382 Teuchos::RCP<const V> D_;
385 typedef Kokkos::View<size_t*, typename MV::node_type::device_type> offsets_type;
392 offsets_type diagOffsets_;
401 bool savedDiagOffsets_;
411 Teuchos::RCP<MV> W2_;
418 ST computedLambdaMax_;
425 ST computedLambdaMin_;
433 ST lambdaMaxForApply_;
444 ST lambdaMinForApply_;
447 ST eigRatioForApply_;
457 Teuchos::RCP<const V> userInvDiag_;
490 bool eigKeepVectors_;
493 std::string eigenAnalysisType_;
496 Teuchos::RCP<V> eigVector_;
497 Teuchos::RCP<V> eigVector2_;
500 int eigNormalizationFreq_;
503 bool zeroStartingSolution_;
511 bool assumeMatrixUnchanged_;
514 std::string chebyshevAlgorithm_;
517 bool computeMaxResNorm_;
520 bool computeSpectralRadius_;
524 bool ckUseNativeSpMV_;
529 Teuchos::RCP<Teuchos::FancyOStream> out_;
539 void checkConstructorInput ()
const;
542 void checkInputMatrix ()
const;
558 Teuchos::RCP<MV> makeTempMultiVector (
const MV& B);
566 Teuchos::RCP<MV> makeSecondTempMultiVector (
const MV& B);
570 firstIterationWithZeroStartingSolution
579 computeResidual (MV& R,
const MV& B,
const op_type& A,
const MV& X,
580 const Teuchos::ETransp
mode = Teuchos::NO_TRANS);
587 static void solve (MV& Z,
const V&
D_inv,
const MV& R);
594 static void solve (MV& Z,
const ST alpha,
const V&
D_inv,
const MV& R);
603 Teuchos::RCP<const V>
615 Teuchos::RCP<V> makeRangeMapVector (
const Teuchos::RCP<V>& D)
const;
618 Teuchos::RCP<const V>
619 makeRangeMapVectorConst (
const Teuchos::RCP<const V>& D)
const;
640 textbookApplyImpl (
const op_type& A,
671 fourthKindApplyImpl (
const op_type& A,
701 ifpackApplyImpl (
const op_type& A,
738 static MT maxNormInf (
const MV& X);
776 const ST zero = Teuchos::as<ST> (0);
777 const ST one = Teuchos::as<ST> (1);
778 const ST two = Teuchos::as<ST> (2);
780 MV
pAux (B.getMap (), B.getNumVectors ());
781 MV
dk (B.getMap (), B.getNumVectors ());
782 MV R (B.getMap (), B.getNumVectors ());
788 ST theta = (beta + alpha) /
two;
809 if (! zeroStartingSolution_) {
813 R.update (-one, pAux, one);
814 dk.elementWiseMultiply (one/theta, D_inv, R, zero);
815 X.update (one, dk, one);
817 dk.elementWiseMultiply (one/theta, D_inv, B, zero);
821 ST rhokp1, dtemp1, dtemp2;
822 for (
int k = 0; k < numIters-1; ++k) {
824 rhokp1 = one / (two*s1 - rhok);
825 dtemp1 = rhokp1*rhok;
826 dtemp2 = two*rhokp1/delta;
830 R.update (-one, pAux, one);
832 dk.elementWiseMultiply (dtemp2, D_inv, B, dtemp1);
833 X.update (one, dk, one);
Left-scaled Chebyshev iteration.
Definition Ifpack2_Details_Chebyshev_decl.hpp:109
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:134
Teuchos::ScalarTraits< ScalarType > STS
Traits class for ST.
Definition Ifpack2_Details_Chebyshev_decl.hpp:117
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:822
void setParameters(Teuchos::ParameterList &plist)
Set (or reset) parameters.
Definition Ifpack2_Details_Chebyshev_def.hpp:354
void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Set the matrix.
Definition Ifpack2_Details_Chebyshev_def.hpp:781
std::string description() const
A single-line description of the Chebyshev solver.
Definition Ifpack2_Details_Chebyshev_def.hpp:1678
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:138
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:129
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:1699
void print(std::ostream &out)
Print instance data to the given output stream.
Definition Ifpack2_Details_Chebyshev_def.hpp:1071
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:124
ScalarType ST
The type of entries in the matrix and vectors.
Definition Ifpack2_Details_Chebyshev_decl.hpp:115
STS::magnitudeType MT
The type of the absolute value of a ScalarType.
Definition Ifpack2_Details_Chebyshev_decl.hpp:119
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:1015
bool hasTransposeApply() const
Whether it's possible to apply the transpose of this operator.
Definition Ifpack2_Details_Chebyshev_def.hpp:1637
Teuchos::RCP< const row_matrix_type > getMatrix() const
Get the matrix given to the constructor.
Definition Ifpack2_Details_Chebyshev_def.hpp:1630
Ifpack2's implementation of Trilinos::Details::LinearSolver interface.
Definition Ifpack2_Details_LinearSolver_decl.hpp:110
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:74