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  double startTime = timer->wallTime();
293 
294  { // Start timing here.
295  TimeMonitor timeMon (*timer);
296 
297  // Check that the matrix is nonnull.
299  A_.is_null (), std::runtime_error, "Ifpack2::Amesos2Wrapper::initialize: "
300  "The matrix to precondition is null. Please call setMatrix() with a "
301  "nonnull input before calling this method.");
302 
303  // Clear any previous computations.
304  IsInitialized_ = false;
305  IsComputed_ = false;
306 
307  RCP<const row_matrix_type> A_local = makeLocalFilter (A_);
309  A_local.is_null (), std::logic_error, "Ifpack2::AmesosWrapper::initialize: "
310  "makeLocalFilter returned null; it failed to compute A_local. "
311  "Please report this bug to the Ifpack2 developers.");
312 
313  {
314  // The matrix that Amesos2 will build the preconditioner on must be a Tpetra::Crs matrix.
315  // If A_local isn't, then we build one.
316  A_local_crs_ = rcp_dynamic_cast<const crs_matrix_type> (A_local);
317 
318  if (A_local_crs_.is_null ()) {
319  local_ordinal_type numRows = A_local->getLocalNumRows();
320  Array<size_t> entriesPerRow(numRows);
321  for(local_ordinal_type i = 0; i < numRows; i++)
322  {
323  entriesPerRow[i] = A_local->getNumEntriesInLocalRow(i);
324  }
325  RCP<crs_matrix_type> A_local_crs_nc =
326  rcp (new crs_matrix_type (A_local->getRowMap (),
327  A_local->getColMap (),
328  entriesPerRow()));
329  // copy entries into A_local_crs
330  typename crs_matrix_type::nonconst_local_inds_host_view_type indices("Indices",A_local->getLocalMaxNumRowEntries() );
331  typename crs_matrix_type::nonconst_values_host_view_type values("Values", A_local->getLocalMaxNumRowEntries());
332  for(local_ordinal_type i = 0; i < numRows; i++)
333  {
334  size_t numEntries = 0;
335  A_local->getLocalRowCopy(i, indices, values, numEntries);
336  ArrayView<const local_ordinal_type> indicesInsert(indices.data(), numEntries);
337  ArrayView<const scalar_type> valuesInsert((const scalar_type*)values.data(), numEntries);
338  A_local_crs_nc->insertLocalValues(i, indicesInsert, valuesInsert);
339  }
340  A_local_crs_nc->fillComplete (A_local->getDomainMap (), A_local->getRangeMap ());
341  A_local_crs_ = rcp_const_cast<const crs_matrix_type> (A_local_crs_nc);
342  }
343  }
344 
345  // FIXME (10 Dec 2013, 25 Aug 2015) It shouldn't be necessary to
346  // recreate the solver each time, since
347  // Trilinos::Details::LinearSolver has a setA() method. See the
348  // implementation of setMatrix(). I don't want to break anything
349  // so I will leave the code as it is, possibly inefficient.
350 
351 
352  // FIXME (mfh 25 Aug 2015) This is a work-around for Bug 6392.
354  Amesos2::Details::registerLinearSolverFactory ();
355  }
356 
357  solver_ = Trilinos::Details::getLinearSolver<MV, OP, typename MV::mag_type> ("Amesos2", SolverName_);
359  (solver_.is_null (), std::runtime_error, "Ifpack2::Details::"
360  "Amesos2Wrapper::initialize: Failed to create Amesos2 solver!");
361 
362  solver_->setMatrix (A_local_crs_);
363  // If parameters have been already been cached via setParameters, set them now.
364  if (parameterList_ != Teuchos::null) {
365  setParameters (*parameterList_);
366  parameterList_ = Teuchos::null;
367  }
368  // The symbolic factorization properly belongs to initialize(),
369  // since initialize() is concerned with the matrix's structure
370  // (and compute() with the matrix's values).
371  solver_->symbolic ();
372  } // Stop timing here.
373 
374  IsInitialized_ = true;
375  ++NumInitialize_;
376 
377  InitializeTime_ += (timer->wallTime() - startTime);
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  double startTime = timer->wallTime();
399 
400  { // Start timing here.
401  TimeMonitor timeMon (*timer);
402  solver_->numeric ();
403  } // Stop timing here.
404 
405  IsComputed_ = true;
406  ++NumCompute_;
407 
408  ComputeTime_ += (timer->wallTime() - startTime);
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  double startTime = timer->wallTime();
437 
438  { // Start timing here.
439  TimeMonitor timeMon (*timer);
440 
442  ! isComputed (), std::runtime_error,
443  "Ifpack2::Amesos2Wrapper::apply: You must call compute() to compute the "
444  "incomplete factorization, before calling apply().");
445 
447  X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
448  "Ifpack2::Amesos2Wrapper::apply: X and Y must have the same number of columns. "
449  "X has " << X.getNumVectors () << " columns, but Y has "
450  << Y.getNumVectors () << " columns.");
451 
453  mode != Teuchos::NO_TRANS, std::logic_error,
454  "Ifpack2::Amesos2Wrapper::apply: Solving with the transpose (mode == "
455  "Teuchos::TRANS) or conjugate transpose (Teuchos::CONJ_TRANS) is not "
456  "implemented.");
457 
458  // If alpha != 1 or beta != 0, create a temporary multivector
459  // Y_temp to hold the contents of alpha*M^{-1}*X. Otherwise,
460  // alias Y_temp to Y.
461  RCP<MV> Y_temp = (alpha != STS::one () || beta != STS::zero ()) ?
462  rcp (new MV (Y.getMap (), Y.getNumVectors ())) :
463  rcpFromRef (Y);
464 
465  // If X and Y are pointing to the same memory location, create an
466  // auxiliary vector, X_temp, so that we don't clobber the input
467  // when computing the output. Otherwise, alias X_temp to X.
468  RCP<const MV> X_temp;
469  {
470  if (X.aliases(Y)) {
471  X_temp = rcp (new MV (X, Teuchos::Copy));
472  } else {
473  X_temp = rcpFromRef (X);
474  }
475  }
476 
477  // Set up "local" views of X and Y.
478  RCP<const MV> X_local;
479  RCP<MV> Y_local;
480  //JJH 15-Apr-2016 I changed this from ">=" to ">". Otherwise the else block
481  //is never hit.
482  //bmk 6-19-17: previously, the next line only set multipleProcs if A_ was distributed
483  // This doesn't work if A_ is local but X/Y are distributed, as in AdditiveSchwarz.
484  const bool multipleProcs = (A_->getRowMap ()->getComm ()->getSize () > 1) || (X.getMap ()->getComm ()->getSize () > 1);
485  if (multipleProcs) {
486  // Interpret X and Y as "local" multivectors, that is, in the
487  // local filter's domain resp. range Maps. "Interpret" means that
488  // we create views with different Maps; we don't have to copy.
489  X_local = X_temp->offsetView (A_local_crs_->getDomainMap (), 0);
490  Y_local = Y_temp->offsetViewNonConst (A_local_crs_->getRangeMap (), 0);
491  }
492  else { // only one process in A_'s communicator
493  // X and Y are already "local"; no need to set up local views.
494  X_local = X_temp;
495  Y_local = Y_temp;
496  }
497 
498  // Use the precomputed factorization to solve.
499  solver_->solve (*Y_local, *X_local);
500 
501  if (alpha != STS::one () || beta != STS::zero ()) {
502  Y.update (alpha, *Y_temp, beta);
503  }
504  } // Stop timing here.
505 
506  ++NumApply_;
507 
508  ApplyTime_ += (timer->wallTime() - startTime);
509 }
510 
511 
512 template <class MatrixType>
515  std::ostringstream os;
516 
517  // Output is a valid YAML dictionary in flow style. If you don't
518  // like everything on a single line, you should call describe()
519  // instead.
520  os << "\"Ifpack2::Amesos2Wrapper\": {";
521  if (this->getObjectLabel () != "") {
522  os << "Label: \"" << this->getObjectLabel () << "\", ";
523  }
524  os << "Initialized: " << (isInitialized () ? "true" : "false")
525  << ", Computed: " << (isComputed () ? "true" : "false");
526 
527  if (A_local_crs_.is_null ()) {
528  os << ", Matrix: null";
529  }
530  else {
531  os << ", Global matrix dimensions: ["
532  << A_local_crs_->getGlobalNumRows () << ", " << A_local_crs_->getGlobalNumCols () << "]";
533  }
534 
535  // If the actual solver happens to implement Describable, have it
536  // describe itself. Otherwise, don't print anything.
537  if (! solver_.is_null ()) {
538  Teuchos::Describable* d = dynamic_cast<Teuchos::Describable*> (solver_.getRawPtr ());
539  if (d != NULL) {
540  os << ", {";
541  os << d->description ();
542  os << "}";
543  }
544  }
545  os << "}";
546  return os.str ();
547 }
548 
549 
550 template <class MatrixType>
551 void
554  const Teuchos::EVerbosityLevel verbLevel) const
555 {
556  using Teuchos::Comm;
557  using Teuchos::OSTab;
558  using Teuchos::RCP;
560  using std::endl;
561 
562  const Teuchos::EVerbosityLevel vl = (verbLevel == Teuchos::VERB_DEFAULT) ?
563  Teuchos::VERB_LOW : verbLevel;
564 
565  // describe() starts, by convention, with a tab before it prints anything.
566  OSTab tab0 (out);
567  if (vl > Teuchos::VERB_NONE) {
568  out << "\"Ifpack2::Amesos2Wrapper\":" << endl;
569  OSTab tab1 (out);
570  out << "MatrixType: \"" << TypeNameTraits<MatrixType>::name ()
571  << "\"" << endl;
572 
573  if (this->getObjectLabel () != "") {
574  out << "Label: \"" << this->getObjectLabel () << "\"" << endl;
575  }
576 
577  out << "Initialized: " << (isInitialized () ? "true" : "false") << endl;
578  out << "Computed: " << (isComputed () ? "true" : "false") << endl;
579  out << "Number of initialize calls: " << getNumInitialize () << endl;
580  out << "Number of compute calls: " << getNumCompute () << endl;
581  out << "Number of apply calls: " << getNumApply () << endl;
582  out << "Total time in seconds for initialize: " << getInitializeTime () << endl;
583  out << "Total time in seconds for compute: " << getComputeTime () << endl;
584  out << "Total time in seconds for apply: " << getApplyTime () << endl;
585 
586  if (vl > Teuchos::VERB_LOW) {
587  out << "Matrix:" << endl;
588  A_local_crs_->describe (out, vl);
589  }
590  }
591 }
592 
593 } // namespace Details
594 } // namespace Ifpack2
595 
596 // There's no need to instantiate for CrsMatrix too. All Ifpack2
597 // preconditioners can and should do dynamic casts if they need a type
598 // more specific than RowMatrix.
599 
600 #define IFPACK2_DETAILS_AMESOS2WRAPPER_INSTANT(S,LO,GO,N) \
601  template class Ifpack2::Details::Amesos2Wrapper< Tpetra::RowMatrix<S, LO, GO, N> >;
602 
603 #else
604 
605 #define IFPACK2_DETAILS_AMESOS2WRAPPER_INSTANT(S,LO,GO,N)
606 
607 #endif // HAVE_IFPACK2_AMESOS2
608 #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:553
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:161
void registerLinearSolverFactory()
std::string description() const
A one-line description of this object.
Definition: Ifpack2_Details_Amesos2Wrapper_def.hpp:513
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