Ifpack2 Templated Preconditioning Package  Version 1.0
Ifpack2_Krylov_def.hpp
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack2: Tempated Object-Oriented Algebraic Preconditioner Package
5 // Copyright (2009) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 //@HEADER
41 */
42 
43 #ifndef IFPACK2_KRYLOV_DEF_HPP
44 #define IFPACK2_KRYLOV_DEF_HPP
45 
46 #include "Ifpack2_Chebyshev.hpp"
47 #include "Ifpack2_Heap.hpp"
48 #include "Ifpack2_ILUT.hpp"
49 #include "Ifpack2_Parameters.hpp"
50 #include "Ifpack2_Relaxation.hpp"
51 #include "Ifpack2_RILUK.hpp"
52 
54 #include "BelosBlockCGSolMgr.hpp"
55 
56 #include "Teuchos_Assert.hpp"
57 #include "Teuchos_Time.hpp"
58 
59 #include <iostream>
60 #include <sstream>
61 #include <cmath>
62 
63 
64 namespace Ifpack2 {
65 
66 template <class MatrixType>
68 Krylov (const Teuchos::RCP<const row_matrix_type>& A) :
69  A_ (A),
70  // Default values
71  iterationType_ ("GMRES"),
72  numIters_ (5),
73  resTol_ (0.001), // FIXME (mfh 17 Jan 2014) Make a function of STS::eps()
74  BlockSize_ (1),
75  ZeroStartingSolution_ (true),
76  PreconditionerType_ (1),
77  // General
78  IsInitialized_ (false),
79  IsComputed_ (false),
80  NumInitialize_ (0),
81  NumCompute_ (0),
82  NumApply_ (0),
83  InitializeTime_ (0.0),
84  ComputeTime_ (0.0),
85  ApplyTime_ (0.0)
86 {}
87 
88 
89 template <class MatrixType>
91 
92 
93 template <class MatrixType>
94 void Krylov<MatrixType>::setMatrix (const Teuchos::RCP<const row_matrix_type>& A)
95 {
96  // Check in serial or one-process mode if the matrix is square.
97  TEUCHOS_TEST_FOR_EXCEPTION(
98  ! A.is_null () && A->getComm ()->getSize () == 1 &&
99  A->getNodeNumRows () != A->getNodeNumCols (),
100  std::runtime_error, "Ifpack2::Krylov::setMatrix: If A's communicator only "
101  "contains one process, then A must be square. Instead, you provided a "
102  "matrix A with " << A->getNodeNumRows () << " rows and "
103  << A->getNodeNumCols () << " columns.");
104 
105  // It's legal for A to be null; in that case, you may not call
106  // initialize() until calling setMatrix() with a nonnull input.
107  // Regardless, setting the matrix invalidates any previous
108  // factorization.
109  IsInitialized_ = false;
110  IsComputed_ = false;
111 
112  A_ = A;
113 }
114 
115 
116 template <class MatrixType>
117 void Krylov<MatrixType>::setParameters (const Teuchos::ParameterList& plist)
118 {
119  using Teuchos::as;
120  using Teuchos::ParameterList;
121  using Teuchos::Exceptions::InvalidParameterName;
122  using Teuchos::Exceptions::InvalidParameterType;
123 
124  // FIXME (mfh 12 Sep 2014) Don't rewrite Belos::SolverFactory!!! Use
125  // that instead.
126 
127  ParameterList params = plist;
128 
129  // Get the current parameters' values. We don't assign to the
130  // instance data directly until we've gotten all the parameters.
131  // This ensures "transactional" semantics, so that if attempting to
132  // get some parameter throws an exception, the class' state doesn't
133  // change.
134  magnitude_type resTol = resTol_;
135  int numIters = numIters_;
136  std::string iterType = iterationType_;
137  int blockSize = BlockSize_;
138  bool zeroStartingSolution = ZeroStartingSolution_;
139  int precType = PreconditionerType_;
140 
141  //
142  // Get the "krylov: iteration type" parameter.
143  //
144  // We prefer std::string (name of Belos solver), but allow int
145  // ("enum" value) for backwards compatibility.
146  //
147  bool gotIterType = false;
148  try {
149  iterType = params.get<std::string> ("krylov: iteration type");
150  gotIterType = true;
151  }
152  catch (InvalidParameterName) {
153  gotIterType = true; // the parameter is not there, so don't try to get it anymore
154  }
155  catch (InvalidParameterType) {
156  // Perhaps the user specified it as int.
157  }
158  // If it's not string, it has to be int.
159  // We've already checked whether the name exists.
160  if (! gotIterType) {
161  const int iterTypeInt = params.get<int> ("krylov: iteration type");
162  gotIterType = true;
163 
164  if (iterTypeInt == 1) {
165  iterType = "GMRES";
166  } else if (iterTypeInt == 2) {
167  iterType = "CG";
168  } else {
169  TEUCHOS_TEST_FOR_EXCEPTION(
170  true, std::invalid_argument, "Ifpack2::Krylov::setParameters: Invalid "
171  "\"krylov: iteration type\" value " << iterTypeInt << ". Valid int "
172  "values are 1 (GMRES) and 2 (CG). Please prefer setting this "
173  "parameter as a string (the name of the Krylov solver to use).");
174  }
175  }
176 
177  resTol = params.get ("krylov: residual tolerance", resTol);
178  numIters = params.get ("krylov: number of iterations", numIters);
179  blockSize = params.get ("krylov: block size", blockSize);
180  zeroStartingSolution = params.get ("krylov: zero starting solution",
181  zeroStartingSolution);
182  precType = params.get ("krylov: preconditioner type", precType);
183 
184  // Separate preconditioner parameters into another list
185  //
186  // FIXME (mfh 17 Jan 2014) Inner preconditioner's parameters should
187  // be a sublist, not part of the main list!!!
188  if (PreconditionerType_ == 1) {
189  precParams_.set ("relaxation: sweeps",
190  params.get ("relaxation: sweeps", 1));
191  precParams_.set ("relaxation: damping factor",
192  params.get ("relaxation: damping factor", (scalar_type) 1.0));
193  precParams_.set ("relaxation: min diagonal value",
194  params.get ("relaxation: min diagonal value", STS::one ()));
195  precParams_.set ("relaxation: zero starting solution",
196  params.get ("relaxation: zero starting solution", true));
197  precParams_.set ("relaxation: backward mode",
198  params.get ("relaxation: backward mode", false));
199  }
200  // FIXME (mfh 17 Jan 2014) AdditiveSchwarz's ParameterList no longer
201  // takes parameters for its subdomain solver! You have to pass them
202  // into a sublist.
203  if (PreconditionerType_ == 2 || PreconditionerType_ == 3) {
204  // FIXME (mfh 17 Jan 2014) should be an integer, given how ILUT
205  // works! Furthermore, this parameter does not mean what you
206  // think it means.
207  precParams_.set ("fact: ilut level-of-fill",
208  params.get ("fact: ilut level-of-fill", (double) 1.0));
209  precParams_.set ("fact: iluk level-of-fill",
210  params.get ("fact: iluk level-of-fill", (double) 1.0));
211  // FIXME (mfh 17 Jan 2014) scalar_type or magnitude_type? not
212  // sure, but double is definitely wrong.
213  precParams_.set ("fact: absolute threshold",
214  params.get ("fact: absolute threshold", (double) 0.0));
215  // FIXME (mfh 17 Jan 2014) scalar_type or magnitude_type? not
216  // sure, but double is definitely wrong.
217  precParams_.set ("fact: relative threshold",
218  params.get("fact: relative threshold", (double) 1.0));
219  // FIXME (mfh 17 Jan 2014) scalar_type or magnitude_type? not
220  // sure, but double is definitely wrong.
221  precParams_.set ("fact: relax value",
222  params.get ("fact: relax value", (double) 0.0));
223  }
224 
225  // "Commit" the new values to the instance data.
226  iterationType_ = iterType;
227  numIters_ = numIters;
228  resTol_ = resTol;
229  BlockSize_ = blockSize;
230  ZeroStartingSolution_ = zeroStartingSolution;
231  PreconditionerType_ = precType;
232 }
233 
234 
235 template <class MatrixType>
236 Teuchos::RCP<const Teuchos::Comm<int> >
238  TEUCHOS_TEST_FOR_EXCEPTION(
239  A_.is_null (), std::runtime_error, "Ifpack2::Krylov::getComm: "
240  "The input matrix A is null. Please call setMatrix() with a nonnull "
241  "input matrix before calling this method.");
242  return A_->getComm ();
243 }
244 
245 
246 template <class MatrixType>
247 Teuchos::RCP<const Tpetra::RowMatrix<typename MatrixType::scalar_type,typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> >
249  return A_;
250 }
251 
252 
253 template <class MatrixType>
254 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> >
256 {
257  TEUCHOS_TEST_FOR_EXCEPTION(
258  A_.is_null (), std::runtime_error, "Ifpack2::Krylov::getDomainMap: "
259  "The input matrix A is null. Please call setMatrix() with a nonnull "
260  "input matrix before calling this method.");
261  return A_->getDomainMap ();
262 }
263 
264 
265 template <class MatrixType>
266 Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,typename MatrixType::global_ordinal_type,typename MatrixType::node_type> >
268 {
269  TEUCHOS_TEST_FOR_EXCEPTION(
270  A_.is_null (), std::runtime_error, "Ifpack2::Krylov::getRangeMap: "
271  "The input matrix A is null. Please call setMatrix() with a nonnull "
272  "input matrix before calling this method.");
273  return A_->getRangeMap ();
274 }
275 
276 
277 template <class MatrixType>
279  // FIXME (mfh 17 Jan 2014) apply() does not currently work with mode
280  // != NO_TRANS, so it's correct to return false here.
281  return false;
282 }
283 
284 
285 template <class MatrixType>
287  return NumInitialize_;
288 }
289 
290 
291 template <class MatrixType>
293  return NumCompute_;
294 }
295 
296 
297 template <class MatrixType>
299  return NumApply_;
300 }
301 
302 
303 template <class MatrixType>
305  return InitializeTime_;
306 }
307 
308 
309 template <class MatrixType>
311  return ComputeTime_;
312 }
313 
314 
315 template <class MatrixType>
317  return ApplyTime_;
318 }
319 
320 
321 template <class MatrixType>
323 {
324  using Teuchos::ParameterList;
325  using Teuchos::RCP;
326  using Teuchos::rcp;
327  typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
329  typedef Tpetra::Operator<scalar_type, local_ordinal_type,
331 
332  TEUCHOS_TEST_FOR_EXCEPTION(
333  A_.is_null (), std::runtime_error, "Ifpack2::Krylov::initialize: "
334  "The input matrix A is null. Please call setMatrix() with a nonnull "
335  "input matrix before calling this method.");
336 
337  // clear any previous allocation
338  IsInitialized_ = false;
339  IsComputed_ = false;
340 
341  Teuchos::Time timer ("initialize");
342  { // The body of code to time
343  Teuchos::TimeMonitor timeMon (timer);
344 
345  // Belos parameter list
346  RCP<ParameterList> belosList = rcp (new ParameterList ("GMRES"));
347  belosList->set ("Maximum Iterations", numIters_);
348  belosList->set ("Convergence Tolerance", resTol_);
349 
350  // FIXME (17 Jan 2014) This whole "preconditioner type" thing is
351  // not how we want Krylov to initialize its inner preconditioner.
352  // Krylov should be initialized like AdditiveSchwarz: the Factory
353  // should create it, in order to avoid circular dependencies.
354 
355  if (PreconditionerType_ == 0) {
356  // no preconditioner
357  }
358  else if (PreconditionerType_==1) {
359  ifpack2_prec_=rcp (new Relaxation<row_matrix_type> (A_));
360  }
361  else if (PreconditionerType_==2) {
362  ifpack2_prec_=rcp (new ILUT<row_matrix_type> (A_));
363  }
364  else if (PreconditionerType_==3) {
365  ifpack2_prec_ = rcp (new RILUK<row_matrix_type> (A_));
366  }
367  else if (PreconditionerType_==4) {
368  ifpack2_prec_ = rcp (new Chebyshev<row_matrix_type> (A_));
369  }
370  if (PreconditionerType_>0) {
371  ifpack2_prec_->initialize();
372  ifpack2_prec_->setParameters(precParams_);
373  }
374  belosProblem_ = rcp (new Belos::LinearProblem<belos_scalar_type,TMV,TOP> ());
375  belosProblem_->setOperator (A_);
376 
377  if (iterationType_ == "GMRES") {
378  belosSolver_ =
379  rcp (new Belos::BlockGmresSolMgr<belos_scalar_type,TMV,TOP> (belosProblem_, belosList));
380  }
381  else {
382  belosSolver_ =
383  rcp (new Belos::BlockCGSolMgr<belos_scalar_type,TMV,TOP> (belosProblem_, belosList));
384  }
385 
386  }
387  IsInitialized_ = true;
388  ++NumInitialize_;
389  InitializeTime_ += timer.totalElapsedTime ();
390 }
391 
392 
393 template <class MatrixType>
395 {
396  TEUCHOS_TEST_FOR_EXCEPTION(
397  A_.is_null (), std::runtime_error, "Ifpack2::Krylov::compute: "
398  "The input matrix A is null. Please call setMatrix() with a nonnull "
399  "input matrix before calling this method.");
400 
401  // Don't time the initialize(); that gets timed separately.
402  if (! isInitialized ()) {
403  initialize ();
404  }
405 
406  Teuchos::Time timer ("compute");
407  { // The body of code to time
408  Teuchos::TimeMonitor timeMon (timer);
409  if (PreconditionerType_ > 0) {
410  ifpack2_prec_->compute ();
411  belosProblem_->setLeftPrec (ifpack2_prec_);
412  }
413  }
414  IsComputed_ = true;
415  ++NumCompute_;
416  ComputeTime_ += timer.totalElapsedTime ();
417 }
418 
419 
420 template <class MatrixType>
422 apply (const Tpetra::MultiVector<typename MatrixType::scalar_type,
423  typename MatrixType::local_ordinal_type,
424  typename MatrixType::global_ordinal_type,
425  typename MatrixType::node_type>& X,
426  Tpetra::MultiVector<typename MatrixType::scalar_type,
427  typename MatrixType::local_ordinal_type,
428  typename MatrixType::global_ordinal_type,
429  typename MatrixType::node_type>& Y,
430  Teuchos::ETransp mode,
431  typename MatrixType::scalar_type alpha,
432  typename MatrixType::scalar_type beta) const
433 {
434  using Teuchos::RCP;
435  using Teuchos::rcp;
436  using Teuchos::rcpFromRef;
437  typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
439  TEUCHOS_TEST_FOR_EXCEPTION(
440  ! isComputed (), std::runtime_error,
441  "Ifpack2::Krylov::apply: You must call compute() before you may call apply().");
442  TEUCHOS_TEST_FOR_EXCEPTION(
443  X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
444  "Ifpack2::Krylov::apply: The MultiVector inputs X and Y do not have the "
445  "same number of columns. X.getNumVectors() = " << X.getNumVectors ()
446  << " != Y.getNumVectors() = " << Y.getNumVectors () << ".");
447 
448  // Catch unimplemented cases: alpha != 1, beta != 0, mode != NO_TRANS.
449  TEUCHOS_TEST_FOR_EXCEPTION(
450  alpha != STS::one (), std::logic_error,
451  "Ifpack2::Krylov::apply: alpha != 1 has not been implemented.");
452  TEUCHOS_TEST_FOR_EXCEPTION(
453  beta != STS::zero (), std::logic_error,
454  "Ifpack2::Krylov::apply: zero != 0 has not been implemented.");
455  TEUCHOS_TEST_FOR_EXCEPTION(
456  mode != Teuchos::NO_TRANS, std::logic_error,
457  "Ifpack2::Krylov::apply: mode != Teuchos::NO_TRANS has not been implemented.");
458 
459  Teuchos::Time timer ("apply");
460  { // The body of code to time
461  Teuchos::TimeMonitor timeMon (timer);
462 
463  // If X and Y are pointing to the same memory location,
464  // we need to create an auxiliary vector, Xcopy
465  RCP<const MV> Xcopy;
466  {
467  auto X_lcl_host = X.template getLocalView<Kokkos::HostSpace> ();
468  auto Y_lcl_host = Y.template getLocalView<Kokkos::HostSpace> ();
469  if (X_lcl_host.ptr_on_device () == Y_lcl_host.ptr_on_device ()) {
470  Xcopy = rcp (new MV (X, Teuchos::Copy));
471  } else {
472  Xcopy = rcpFromRef (X);
473  }
474  }
475 
476  RCP<MV> Ycopy = rcpFromRef (Y);
477  if (ZeroStartingSolution_) {
478  Ycopy->putScalar (STS::zero ());
479  }
480 
481  // Set left and right hand sides for Belos
482  belosProblem_->setProblem (Ycopy, Xcopy);
483  belosSolver_->solve (); // solve the linear system
484  }
485  ++NumApply_;
486  ApplyTime_ += timer.totalElapsedTime ();
487 }
488 
489 
490 template <class MatrixType>
492 {
493  std::ostringstream os;
494 
495  // Output is a valid YAML dictionary in flow style. If you don't
496  // like everything on a single line, you should call describe()
497  // instead.
498  os << "\"Ifpack2::Krylov\": {";
499  if (this->getObjectLabel () != "") {
500  os << "Label: \"" << this->getObjectLabel () << "\", ";
501  }
502  os << "Initialized: " << (isInitialized () ? "true" : "false") << ", "
503  << "Computed: " << (isComputed () ? "true" : "false") << ", ";
504 
505  if (A_.is_null ()) {
506  os << "Matrix: null";
507  }
508  else {
509  os << "Matrix: not null"
510  << ", Global matrix dimensions: ["
511  << A_->getGlobalNumRows () << ", " << A_->getGlobalNumCols () << "]";
512  }
513 
514  os << "}";
515  return os.str ();
516 }
517 
518 
519 template <class MatrixType>
521 describe (Teuchos::FancyOStream &out,
522  const Teuchos::EVerbosityLevel verbLevel) const
523 {
524  using std::endl;
525  using std::setw;
526  using Teuchos::VERB_DEFAULT;
527  using Teuchos::VERB_NONE;
528  using Teuchos::VERB_LOW;
529  using Teuchos::VERB_MEDIUM;
530  using Teuchos::VERB_HIGH;
531  using Teuchos::VERB_EXTREME;
532 
533  const Teuchos::EVerbosityLevel vl =
534  (verbLevel == VERB_DEFAULT) ? VERB_LOW : verbLevel;
535 
536  if (vl != VERB_NONE) {
537  // describe() always starts with a tab by convention.
538  Teuchos::OSTab tab0 (out);
539  out << "\"Ifpack2::Krylov\":";
540 
541  Teuchos::OSTab tab1 (out);
542  if (this->getObjectLabel () != "") {
543  out << "Label: " << this->getObjectLabel () << endl;
544  }
545  out << "Initialized: " << (isInitialized () ? "true" : "false") << endl
546  << "Computed: " << (isComputed () ? "true" : "false") << endl
547  << "Global number of rows: " << A_->getGlobalNumRows () << endl
548  << "Global number of columns: " << A_->getGlobalNumCols () << endl
549  << "Matrix:";
550  if (A_.is_null ()) {
551  out << " null" << endl;
552  } else {
553  A_->describe (out, vl);
554  }
555  }
556 }
557 
558 } // namespace Ifpack2
559 
560 // There's no need to instantiate for CrsMatrix too. All Ifpack2
561 // preconditioners can and should do dynamic casts if they need a type
562 // more specific than RowMatrix.
563 //
564 // In fact, Krylov really doesn't _need_ the RowMatrix methods; it
565 // could very well just rely on the Operator interface. initialize()
566 // need only check whether the domain and range Maps have changed
567 // (which would necessitate reinitializing the Krylov solver).
568 
569 #define IFPACK2_KRYLOV_INSTANT(S,LO,GO,N) \
570  template class Ifpack2::Krylov< Tpetra::RowMatrix<S, LO, GO, N> >;
571 
572 #endif /* IFPACK2_KRYLOV_DEF_HPP */
double getApplyTime() const
Returns the time spent in apply().
Definition: Ifpack2_Krylov_def.hpp:316
void initialize()
Do any initialization that depends on the input matrix&#39;s structure.
Definition: Ifpack2_Krylov_def.hpp:322
int getNumApply() const
Returns the number of calls to apply().
Definition: Ifpack2_Krylov_def.hpp:298
double getInitializeTime() const
Returns the time spent in Initialize().
Definition: Ifpack2_Krylov_def.hpp:304
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:110
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getDomainMap() const
Tpetra::Map representing the domain of this operator.
Definition: Ifpack2_Krylov_def.hpp:255
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
Apply the preconditioner to X, putting the result in Y.
Definition: Ifpack2_Krylov_def.hpp:422
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_Krylov_def.hpp:94
int getNumCompute() const
Returns the number of calls to Compute().
Definition: Ifpack2_Krylov_def.hpp:292
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_Krylov_decl.hpp:125
Krylov(const Teuchos::RCP< const row_matrix_type > &A)
Constructor that takes a Tpetra::RowMatrix.
Definition: Ifpack2_Krylov_def.hpp:68
std::string description() const
Return a simple one-line description of this object.
Definition: Ifpack2_Krylov_def.hpp:491
ILU(k) factorization of a given Tpetra::RowMatrix.
Definition: Ifpack2_RILUK_decl.hpp:243
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:119
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:122
ILUT (incomplete LU factorization with threshold) of a Tpetra sparse matrix.
Definition: Ifpack2_ILUT_decl.hpp:91
virtual ~Krylov()
Destructor.
Definition: Ifpack2_Krylov_def.hpp:90
Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > getRangeMap() const
Tpetra::Map representing the range of this operator.
Definition: Ifpack2_Krylov_def.hpp:267
Teuchos::RCP< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > getMatrix() const
Returns a reference to the matrix to be preconditioned.
Definition: Ifpack2_Krylov_def.hpp:248
void compute()
Do any initialization that depends on the input matrix&#39;s values.
Definition: Ifpack2_Krylov_def.hpp:394
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_Krylov_decl.hpp:116
int getNumInitialize() const
Returns the number of calls to Initialize().
Definition: Ifpack2_Krylov_def.hpp:286
Diagonally scaled Chebyshev iteration for Tpetra sparse matrices.
Definition: Ifpack2_Chebyshev_decl.hpp:199
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Return the operator&#39;s communicator.
Definition: Ifpack2_Krylov_def.hpp:237
bool hasTransposeApply() const
Whether this object&#39;s apply() method can apply the transpose (or conjugate transpose, if applicable).
Definition: Ifpack2_Krylov_def.hpp:278
bool isComputed() const
Return true if compute() completed successfully, else false.
Definition: Ifpack2_Krylov_decl.hpp:183
Relaxation preconditioners for Tpetra::RowMatrix and Tpetra::CrsMatrix sparse matrices.
Definition: Ifpack2_Relaxation_decl.hpp:222
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
void setParameters(const Teuchos::ParameterList &params)
Set the preconditioner&#39;s parameters.
Definition: Ifpack2_Krylov_def.hpp:117
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.
Definition: Ifpack2_Krylov_def.hpp:521
bool isInitialized() const
Return true if initialize() completed successfully, else false.
Definition: Ifpack2_Krylov_decl.hpp:175
double getComputeTime() const
Returns the time spent in Compute().
Definition: Ifpack2_Krylov_def.hpp:310