Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Details_Amesos2Wrapper_def.hpp
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack2: Templated 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_DETAILS_AMESOS2WRAPPER_DEF_HPP
44 #define IFPACK2_DETAILS_AMESOS2WRAPPER_DEF_HPP
45 
46 #ifdef HAVE_IFPACK2_AMESOS2
47 
48 #include "Ifpack2_LocalFilter.hpp"
51 #include "Teuchos_TimeMonitor.hpp"
53 
54 // FIXME (mfh 25 Aug 2015) Work-around for Bug 6392. This doesn't
55 // need to be a weak symbol as long as the Ifpack2 package depends on
56 // Amesos2.
57 namespace Amesos2 {
58 namespace Details {
59  extern void registerLinearSolverFactory ();
60 } // namespace Details
61 } // namespace Amesos2
62 
63 namespace Ifpack2 {
64 namespace Details {
65 
66 template <class MatrixType>
69  A_(A),
70  InitializeTime_ (0.0),
71  ComputeTime_ (0.0),
72  ApplyTime_ (0.0),
73  NumInitialize_ (0),
74  NumCompute_ (0),
75  NumApply_ (0),
76  IsInitialized_ (false),
77  IsComputed_ (false),
78  SolverName_ ("")
79 {}
80 
81 template <class MatrixType>
83 {}
84 
85 template <class MatrixType>
87 {
89  using Teuchos::RCP;
90  using Teuchos::rcp;
91 
92  // FIXME (mfh 12 Sep 2014) Why does this code make a deep copy of
93  // the input ParameterList? Does Amesos2 want a deep copy?
94 
95  // Extract the list called "Amesos2" that contains the Amesos2
96  // solver's options.
97  RCP<ParameterList> theList;
98  if (params.name () == "Amesos2") {
99  theList = rcp (new ParameterList (params));
100  } else if (params.isSublist ("Amesos2")) {
101  // FIXME (mfh 12 Sep 2014) This code actually makes _two_ deep copies.
102  ParameterList subpl = params.sublist ("Amesos2");
103  theList = rcp (new ParameterList (subpl));
104  theList->setName ("Amesos2"); //FIXME hack until Teuchos sublist name bug is fixed
105  if (params.isParameter ("Amesos2 solver name")) {
106  SolverName_ = params.get<std::string>("Amesos2 solver name");
107  }
108  } else {
109  // Amesos2 silently ignores any list not called "Amesos2". We'll
110  // throw an exception.
112  true, std::runtime_error, "The ParameterList passed to Amesos2 must be "
113  "called \"Amesos2\".");
114  }
115 
116  // If solver_ hasn't been allocated yet, cache the parameters and set them
117  // once the concrete solver does exist.
118  if (solver_.is_null ()) {
119  parameterList_ = theList;
120  return;
121  }
122  // FIXME (mfh 25 Aug 2015) Why doesn't this code set parameterList_
123  // when the solver is NOT null?
124 
125  solver_->setParameters(theList);
126 }
127 
128 
129 template <class MatrixType>
133  A_.is_null (), std::runtime_error, "Ifpack2::Amesos2Wrapper::getComm: "
134  "The matrix is null. Please call setMatrix() with a nonnull input "
135  "before calling this method.");
136  return A_->getComm ();
137 }
138 
139 
140 template <class MatrixType>
143  return A_;
144 }
145 
146 
147 template <class MatrixType>
150 {
152  A_.is_null (), std::runtime_error, "Ifpack2::Amesos2Wrapper::getDomainMap: "
153  "The matrix is null. Please call setMatrix() with a nonnull input "
154  "before calling this method.");
155  return A_->getDomainMap ();
156 }
157 
158 
159 template <class MatrixType>
162 {
164  A_.is_null (), std::runtime_error, "Ifpack2::Amesos2Wrapper::getRangeMap: "
165  "The matrix is null. Please call setMatrix() with a nonnull input "
166  "before calling this method.");
167  return A_->getRangeMap ();
168 }
169 
170 
171 template <class MatrixType>
173  return true;
174 }
175 
176 
177 template <class MatrixType>
179  return NumInitialize_;
180 }
181 
182 
183 template <class MatrixType>
185  return NumCompute_;
186 }
187 
188 
189 template <class MatrixType>
191  return NumApply_;
192 }
193 
194 
195 template <class MatrixType>
197  return InitializeTime_;
198 }
199 
200 
201 template<class MatrixType>
203  return ComputeTime_;
204 }
205 
206 
207 template<class MatrixType>
209  return ApplyTime_;
210 }
211 
212 template<class MatrixType>
214 {
215  // It's legal for A to be null; in that case, you may not call
216  // initialize() until calling setMatrix() with a nonnull input.
217  // Regardless, setting the matrix invalidates any previous
218  // factorization.
219  IsInitialized_ = false;
220  IsComputed_ = false;
221 
222  if (A.is_null ()) {
223  A_ = Teuchos::null;
224  }
225  else {
226  A_ = A;
227  }
228 
229  // FIXME (mfh 10 Dec 2013) Currently, initialize() recreates
230  // solver_ unconditionally, so this code won't have any
231  // effect. Once we fix initialize() so that it keeps
232  // solver_, the code below will be effective.
233  //if (! solver_.is_null ()) {
234  // solver_->setA (A_);
235  //}
236  // FIXME JJH 2014-July18 A_ might not be a locally filtered CRS matrix, which
237  // means we have to do that dance all over again before calling solver_->setA ....
238 }
239 
240 template<class MatrixType>
243 {
244  using Teuchos::RCP;
245  using Teuchos::rcp;
246  using Teuchos::rcp_dynamic_cast;
247  using Teuchos::rcp_implicit_cast;
248 
249  // If A_'s communicator only has one process, or if its column and
250  // row Maps are the same, then it is already local, so use it
251  // directly.
252  if (A->getRowMap ()->getComm ()->getSize () == 1 ||
253  A->getRowMap ()->isSameAs (* (A->getColMap ()))) {
254  return A;
255  }
256 
257  // If A_ is already a LocalFilter, then use it directly. This
258  // should be the case if RILUK is being used through
259  // AdditiveSchwarz, for example.
260  RCP<const LocalFilter<row_matrix_type> > A_lf_r =
261  rcp_dynamic_cast<const LocalFilter<row_matrix_type> > (A);
262  if (! A_lf_r.is_null ()) {
263  return rcp_implicit_cast<const row_matrix_type> (A_lf_r);
264  }
265  else {
266  // A_'s communicator has more than one process, its row Map and
267  // its column Map differ, and A_ is not a LocalFilter. Thus, we
268  // have to wrap it in a LocalFilter.
269  return rcp (new LocalFilter<row_matrix_type> (A));
270  }
271 }
272 
273 
274 template<class MatrixType>
276 {
277  using Teuchos::RCP;
278  using Teuchos::rcp;
279  using Teuchos::rcp_const_cast;
280  using Teuchos::rcp_dynamic_cast;
281  using Teuchos::Time;
282  using Teuchos::TimeMonitor;
283  using Teuchos::Array;
284  using Teuchos::ArrayView;
285 
286  const std::string timerName ("Ifpack2::Amesos2Wrapper::initialize");
287  RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
288  if (timer.is_null ()) {
289  timer = TimeMonitor::getNewCounter (timerName);
290  }
291 
292  { // Start timing here.
293  TimeMonitor timeMon (*timer);
294 
295  // Check that the matrix is nonnull.
297  A_.is_null (), std::runtime_error, "Ifpack2::Amesos2Wrapper::initialize: "
298  "The matrix to precondition is null. Please call setMatrix() with a "
299  "nonnull input before calling this method.");
300 
301  // Clear any previous computations.
302  IsInitialized_ = false;
303  IsComputed_ = false;
304 
305  RCP<const row_matrix_type> A_local = makeLocalFilter (A_);
307  A_local.is_null (), std::logic_error, "Ifpack2::AmesosWrapper::initialize: "
308  "makeLocalFilter returned null; it failed to compute A_local. "
309  "Please report this bug to the Ifpack2 developers.");
310 
311  {
312  // The matrix that Amesos2 will build the preconditioner on must be a Tpetra::Crs matrix.
313  // If A_local isn't, then we build one.
314  A_local_crs_ = rcp_dynamic_cast<const crs_matrix_type> (A_local);
315 
316  if (A_local_crs_.is_null ()) {
317  local_ordinal_type numRows = A_local->getNodeNumRows();
318  Array<size_t> entriesPerRow(numRows);
319  for(local_ordinal_type i = 0; i < numRows; i++)
320  {
321  entriesPerRow[i] = A_local->getNumEntriesInLocalRow(i);
322  }
323  RCP<crs_matrix_type> A_local_crs_nc =
324  rcp (new crs_matrix_type (A_local->getRowMap (),
325  A_local->getColMap (),
326  entriesPerRow()));
327  // copy entries into A_local_crs
328  Teuchos::Array<local_ordinal_type> indices(A_local->getNodeMaxNumRowEntries());
329  Teuchos::Array<scalar_type> values(A_local->getNodeMaxNumRowEntries());
330  for(local_ordinal_type i = 0; i < numRows; i++)
331  {
332  size_t numEntries = 0;
333  A_local->getLocalRowCopy(i, indices(), values(), numEntries);
334  ArrayView<const local_ordinal_type> indicesInsert(indices.data(), numEntries);
335  ArrayView<const scalar_type> valuesInsert(values.data(), numEntries);
336  A_local_crs_nc->insertLocalValues(i, indicesInsert, valuesInsert);
337  }
338  A_local_crs_nc->fillComplete (A_local->getDomainMap (), A_local->getRangeMap ());
339  A_local_crs_ = rcp_const_cast<const crs_matrix_type> (A_local_crs_nc);
340  }
341  }
342 
343  // FIXME (10 Dec 2013, 25 Aug 2015) It shouldn't be necessary to
344  // recreate the solver each time, since
345  // Trilinos::Details::LinearSolver has a setA() method. See the
346  // implementation of setMatrix(). I don't want to break anything
347  // so I will leave the code as it is, possibly inefficient.
348 
349 
350  // FIXME (mfh 25 Aug 2015) This is a work-around for Bug 6392.
352  Amesos2::Details::registerLinearSolverFactory ();
353  }
354 
355  solver_ = Trilinos::Details::getLinearSolver<MV, OP, typename MV::mag_type> ("Amesos2", SolverName_);
357  (solver_.is_null (), std::runtime_error, "Ifpack2::Details::"
358  "Amesos2Wrapper::initialize: Failed to create Amesos2 solver!");
359 
360  solver_->setMatrix (A_local_crs_);
361  // If parameters have been already been cached via setParameters, set them now.
362  if (parameterList_ != Teuchos::null) {
363  setParameters (*parameterList_);
364  parameterList_ = Teuchos::null;
365  }
366  // The symbolic factorization properly belongs to initialize(),
367  // since initialize() is concerned with the matrix's structure
368  // (and compute() with the matrix's values).
369  solver_->symbolic ();
370  } // Stop timing here.
371 
372  IsInitialized_ = true;
373  ++NumInitialize_;
374 
375  // timer->totalElapsedTime() returns the total time over all timer
376  // calls. Thus, we use = instead of +=.
377  InitializeTime_ = timer->totalElapsedTime ();
378 }
379 
380 template<class MatrixType>
382 {
383  using Teuchos::RCP;
384  using Teuchos::Time;
385  using Teuchos::TimeMonitor;
386 
387  // Don't count initialization in the compute() time.
388  if (! isInitialized ()) {
389  initialize ();
390  }
391 
392  const std::string timerName ("Ifpack2::Details::Amesos2Wrapper::compute");
393  RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
394  if (timer.is_null ()) {
395  timer = TimeMonitor::getNewCounter (timerName);
396  }
397 
398  { // Start timing here.
399  TimeMonitor timeMon (*timer);
400  solver_->numeric ();
401  } // Stop timing here.
402 
403  IsComputed_ = true;
404  ++NumCompute_;
405 
406  // timer->totalElapsedTime() returns the total time over all timer
407  // calls. Thus, we use = instead of +=.
408  ComputeTime_ = timer->totalElapsedTime ();
409 }
410 
411 
412 template <class MatrixType>
414 apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
415  Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
416  Teuchos::ETransp mode,
417  scalar_type alpha,
418  scalar_type beta) const
419 {
420  using Teuchos::ArrayView;
421  using Teuchos::RCP;
422  using Teuchos::rcp;
423  using Teuchos::rcpFromRef;
424  using Teuchos::Time;
425  using Teuchos::TimeMonitor;
426 
427  // X = RHS
428  // Y = solution
429 
430  const std::string timerName ("Ifpack2::Amesos2Wrapper::apply");
431  RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
432  if (timer.is_null ()) {
433  timer = TimeMonitor::getNewCounter (timerName);
434  }
435 
436  { // Start timing here.
437  TimeMonitor timeMon (*timer);
438 
440  ! isComputed (), std::runtime_error,
441  "Ifpack2::Amesos2Wrapper::apply: You must call compute() to compute the "
442  "incomplete factorization, before calling apply().");
443 
445  X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
446  "Ifpack2::Amesos2Wrapper::apply: X and Y must have the same number of columns. "
447  "X has " << X.getNumVectors () << " columns, but Y has "
448  << Y.getNumVectors () << " columns.");
449 
451  mode != Teuchos::NO_TRANS, std::logic_error,
452  "Ifpack2::Amesos2Wrapper::apply: Solving with the transpose (mode == "
453  "Teuchos::TRANS) or conjugate transpose (Teuchos::CONJ_TRANS) is not "
454  "implemented.");
455 
456  // If alpha != 1 or beta != 0, create a temporary multivector
457  // Y_temp to hold the contents of alpha*M^{-1}*X. Otherwise,
458  // alias Y_temp to Y.
459  RCP<MV> Y_temp = (alpha != STS::one () || beta != STS::zero ()) ?
460  rcp (new MV (Y.getMap (), Y.getNumVectors ())) :
461  rcpFromRef (Y);
462 
463  // If X and Y are pointing to the same memory location, create an
464  // auxiliary vector, X_temp, so that we don't clobber the input
465  // when computing the output. Otherwise, alias X_temp to X.
466  RCP<const MV> X_temp;
467  {
468  auto X_lcl_host = X.getLocalViewHost ();
469  auto Y_lcl_host = Y.getLocalViewHost ();
470 
471  if (X_lcl_host.data () == Y_lcl_host.data ()) {
472  X_temp = rcp (new MV (X, Teuchos::Copy));
473  } else {
474  X_temp = rcpFromRef (X);
475  }
476  }
477 
478  // Set up "local" views of X and Y.
479  RCP<const MV> X_local;
480  RCP<MV> Y_local;
481  //JJH 15-Apr-2016 I changed this from ">=" to ">". Otherwise the else block
482  //is never hit.
483  //bmk 6-19-17: previously, the next line only set multipleProcs if A_ was distributed
484  // This doesn't work if A_ is local but X/Y are distributed, as in AdditiveSchwarz.
485  const bool multipleProcs = (A_->getRowMap ()->getComm ()->getSize () > 1) || (X.getMap ()->getComm ()->getSize () > 1);
486  if (multipleProcs) {
487  // Interpret X and Y as "local" multivectors, that is, in the
488  // local filter's domain resp. range Maps. "Interpret" means that
489  // we create views with different Maps; we don't have to copy.
490  X_local = X_temp->offsetView (A_local_crs_->getDomainMap (), 0);
491  Y_local = Y_temp->offsetViewNonConst (A_local_crs_->getRangeMap (), 0);
492  }
493  else { // only one process in A_'s communicator
494  // X and Y are already "local"; no need to set up local views.
495  X_local = X_temp;
496  Y_local = Y_temp;
497  }
498 
499  // Use the precomputed factorization to solve.
500  solver_->solve (*Y_local, *X_local);
501 
502  if (alpha != STS::one () || beta != STS::zero ()) {
503  Y.update (alpha, *Y_temp, beta);
504  }
505  } // Stop timing here.
506 
507  ++NumApply_;
508 
509  // timer->totalElapsedTime() returns the total time over all timer
510  // calls. Thus, we use = instead of +=.
511  ApplyTime_ = timer->totalElapsedTime ();
512 }
513 
514 
515 template <class MatrixType>
518  std::ostringstream os;
519 
520  // Output is a valid YAML dictionary in flow style. If you don't
521  // like everything on a single line, you should call describe()
522  // instead.
523  os << "\"Ifpack2::Amesos2Wrapper\": {";
524  if (this->getObjectLabel () != "") {
525  os << "Label: \"" << this->getObjectLabel () << "\", ";
526  }
527  os << "Initialized: " << (isInitialized () ? "true" : "false")
528  << ", Computed: " << (isComputed () ? "true" : "false");
529 
530  if (A_local_crs_.is_null ()) {
531  os << ", Matrix: null";
532  }
533  else {
534  os << ", Global matrix dimensions: ["
535  << A_local_crs_->getGlobalNumRows () << ", " << A_local_crs_->getGlobalNumCols () << "]";
536  }
537 
538  // If the actual solver happens to implement Describable, have it
539  // describe itself. Otherwise, don't print anything.
540  if (! solver_.is_null ()) {
541  Teuchos::Describable* d = dynamic_cast<Teuchos::Describable*> (solver_.getRawPtr ());
542  if (d != NULL) {
543  os << ", {";
544  os << d->description ();
545  os << "}";
546  }
547  }
548  os << "}";
549  return os.str ();
550 }
551 
552 
553 template <class MatrixType>
554 void
557  const Teuchos::EVerbosityLevel verbLevel) const
558 {
559  using Teuchos::Comm;
560  using Teuchos::OSTab;
561  using Teuchos::RCP;
563  using std::endl;
564 
565  const Teuchos::EVerbosityLevel vl = (verbLevel == Teuchos::VERB_DEFAULT) ?
566  Teuchos::VERB_LOW : verbLevel;
567 
568  // describe() starts, by convention, with a tab before it prints anything.
569  OSTab tab0 (out);
570  if (vl > Teuchos::VERB_NONE) {
571  out << "\"Ifpack2::Amesos2Wrapper\":" << endl;
572  OSTab tab1 (out);
573  out << "MatrixType: \"" << TypeNameTraits<MatrixType>::name ()
574  << "\"" << endl;
575 
576  if (this->getObjectLabel () != "") {
577  out << "Label: \"" << this->getObjectLabel () << "\"" << endl;
578  }
579 
580  out << "Initialized: " << (isInitialized () ? "true" : "false") << endl;
581  out << "Computed: " << (isComputed () ? "true" : "false") << endl;
582  out << "Number of initialize calls: " << getNumInitialize () << endl;
583  out << "Number of compute calls: " << getNumCompute () << endl;
584  out << "Number of apply calls: " << getNumApply () << endl;
585  out << "Total time in seconds for initialize: " << getInitializeTime () << endl;
586  out << "Total time in seconds for compute: " << getComputeTime () << endl;
587  out << "Total time in seconds for apply: " << getApplyTime () << endl;
588 
589  if (vl > Teuchos::VERB_LOW) {
590  out << "Matrix:" << endl;
591  A_local_crs_->describe (out, vl);
592  }
593  }
594 }
595 
596 } // namespace Details
597 } // namespace Ifpack2
598 
599 // There's no need to instantiate for CrsMatrix too. All Ifpack2
600 // preconditioners can and should do dynamic casts if they need a type
601 // more specific than RowMatrix.
602 
603 #define IFPACK2_DETAILS_AMESOS2WRAPPER_INSTANT(S,LO,GO,N) \
604  template class Ifpack2::Details::Amesos2Wrapper< Tpetra::RowMatrix<S, LO, GO, N> >;
605 
606 #else
607 
608 #define IFPACK2_DETAILS_AMESOS2WRAPPER_INSTANT(S,LO,GO,N)
609 
610 #endif // HAVE_IFPACK2_AMESOS2
611 #endif // IFPACK2_DETAILS_AMESOS2WRAPPER_DEF_HPP
double getInitializeTime() const
The total time in seconds spent in successful calls to initialize().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:196
const std::string & name() const
double getApplyTime() const
The total time in seconds spent in successful calls to apply().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:208
basic_OSTab< char > OSTab
void setParameters(const Teuchos::ParameterList &params)
Set parameters.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:86
T & get(const std::string &name, T def_value)
bool rememberRegisteredSomeLinearSolverFactory(const std::string &packageName)
bool hasTransposeApply() const
Whether this object&#39;s apply() method can apply the transpose (or conjugate transpose, if applicable).
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:172
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
int getNumApply() const
The total number of successful calls to apply().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:190
void initialize()
Compute the preordering and symbolic factorization of the matrix.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:275
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The input matrix&#39;s communicator.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:131
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given output stream.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:556
int getNumInitialize() const
The total number of successful calls to initialize().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:178
bool isParameter(const std::string &name) const
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:117
Teuchos::RCP< const map_type > getDomainMap() const
Tpetra::Map representing the domain of this operator.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:149
Tpetra::CrsMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > crs_matrix_type
Type of the Tpetra::CrsMatrix specialization that this class uses.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:149
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Wrapper class for direct solvers in Amesos2.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:102
Teuchos::RCP< const map_type > getRangeMap() const
Tpetra::Map representing the range of this operator.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:161
bool isSublist(const std::string &name) const
virtual std::string description() const
virtual ~Amesos2Wrapper()
Destructor.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:82
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:120
Amesos2Wrapper(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:68
Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix; the matrix to be preconditioned.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:142
double getComputeTime() const
The total time in seconds spent in successful calls to compute().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:202
int getNumCompute() const
The total number of successful calls to compute().
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:184
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, resulting in Y.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:414
ParameterList & sublist(const std::string &name, bool mustAlreadyExist=false, const std::string &docString="")
void compute()
Compute the numeric factorization of the matrix.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:381
Access only local rows and columns of a sparse matrix.
Definition: Ifpack2_LocalFilter_decl.hpp:160
void registerLinearSolverFactory()
std::string description() const
A one-line description of this object.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:516
virtual void setMatrix(const Teuchos::RCP< const row_matrix_type > &A)
Change the matrix to be preconditioned.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:213
bool is_null() const