Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
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"
49#include "Trilinos_Details_LinearSolverFactory.hpp"
50#include "Trilinos_Details_LinearSolver.hpp"
51#include "Teuchos_TimeMonitor.hpp"
52#include "Teuchos_TypeNameTraits.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.
57namespace Amesos2 {
58namespace Details {
59 extern void registerLinearSolverFactory ();
60} // namespace Details
61} // namespace Amesos2
62
63namespace Ifpack2 {
64namespace Details {
65
66template <class MatrixType>
68Amesos2Wrapper (const Teuchos::RCP<const row_matrix_type>& A) :
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
81template <class MatrixType>
84
85template <class MatrixType>
86void Amesos2Wrapper<MatrixType>::setParameters (const Teuchos::ParameterList& params)
87{
88 using Teuchos::ParameterList;
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.
111 TEUCHOS_TEST_FOR_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
129template <class MatrixType>
130Teuchos::RCP<const Teuchos::Comm<int> >
132 TEUCHOS_TEST_FOR_EXCEPTION(
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
140template <class MatrixType>
141Teuchos::RCP<const typename Amesos2Wrapper<MatrixType>::row_matrix_type>
143 return A_;
144}
145
146
147template <class MatrixType>
148Teuchos::RCP<const typename Amesos2Wrapper<MatrixType>::map_type>
150{
151 TEUCHOS_TEST_FOR_EXCEPTION(
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
159template <class MatrixType>
160Teuchos::RCP<const typename Amesos2Wrapper<MatrixType>::map_type>
162{
163 TEUCHOS_TEST_FOR_EXCEPTION(
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
171template <class MatrixType>
173 return true;
174}
175
176
177template <class MatrixType>
179 return NumInitialize_;
180}
181
182
183template <class MatrixType>
185 return NumCompute_;
186}
187
188
189template <class MatrixType>
191 return NumApply_;
192}
193
194
195template <class MatrixType>
197 return InitializeTime_;
198}
199
200
201template<class MatrixType>
203 return ComputeTime_;
204}
205
206
207template<class MatrixType>
209 return ApplyTime_;
210}
211
212template<class MatrixType>
213void Amesos2Wrapper<MatrixType>::setMatrix (const Teuchos::RCP<const row_matrix_type>& A)
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
240template<class MatrixType>
241Teuchos::RCP<const typename Amesos2Wrapper<MatrixType>::row_matrix_type>
242Amesos2Wrapper<MatrixType>::makeLocalFilter (const Teuchos::RCP<const row_matrix_type>& A)
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
274template<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.
298 TEUCHOS_TEST_FOR_EXCEPTION(
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_);
308 TEUCHOS_TEST_FOR_EXCEPTION(
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.
353 if (! Trilinos::Details::Impl::rememberRegisteredSomeLinearSolverFactory ("Amesos2")) {
354 Amesos2::Details::registerLinearSolverFactory ();
355 }
356
357 solver_ = Trilinos::Details::getLinearSolver<MV, OP, typename MV::mag_type> ("Amesos2", SolverName_);
358 TEUCHOS_TEST_FOR_EXCEPTION
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
380template<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
412template <class MatrixType>
414apply (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
441 TEUCHOS_TEST_FOR_EXCEPTION(
442 ! isComputed (), std::runtime_error,
443 "Ifpack2::Amesos2Wrapper::apply: You must call compute() to compute the "
444 "incomplete factorization, before calling apply().");
445
446 TEUCHOS_TEST_FOR_EXCEPTION(
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
452 TEUCHOS_TEST_FOR_EXCEPTION(
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
512template <class MatrixType>
514 using Teuchos::TypeNameTraits;
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
550template <class MatrixType>
551void
553describe (Teuchos::FancyOStream& out,
554 const Teuchos::EVerbosityLevel verbLevel) const
555{
556 using Teuchos::Comm;
557 using Teuchos::OSTab;
558 using Teuchos::RCP;
559 using Teuchos::TypeNameTraits;
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
Wrapper class for direct solvers in Amesos2.
Definition Ifpack2_Details_Amesos2Wrapper_decl.hpp:111
double getComputeTime() const
The total time in seconds spent in successful calls to compute().
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:202
Teuchos::RCP< const map_type > getRangeMap() const
Tpetra::Map representing the range of this operator.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:161
Teuchos::RCP< const row_matrix_type > getMatrix() const
The input matrix; the matrix to be preconditioned.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:142
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition Ifpack2_Details_Amesos2Wrapper_decl.hpp:117
int getNumInitialize() const
The total number of successful calls to initialize().
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:178
double getApplyTime() const
The total time in seconds spent in successful calls to apply().
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:208
int getNumApply() const
The total number of successful calls to apply().
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:190
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition Ifpack2_Details_Amesos2Wrapper_decl.hpp:120
virtual ~Amesos2Wrapper()
Destructor.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:82
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
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
std::string description() const
A one-line description of this object.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:513
void initialize()
Compute the preordering and symbolic factorization of the matrix.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:275
int getNumCompute() const
The total number of successful calls to compute().
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:184
void setParameters(const Teuchos::ParameterList &params)
Set parameters.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:86
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::RCP< const map_type > getDomainMap() const
Tpetra::Map representing the domain of this operator.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:149
void compute()
Compute the numeric factorization of the matrix.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:381
Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The input matrix's communicator.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:131
Amesos2Wrapper(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:68
double getInitializeTime() const
The total time in seconds spent in successful calls to initialize().
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:196
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 hasTransposeApply() const
Whether this object's apply() method can apply the transpose (or conjugate transpose,...
Definition Ifpack2_Details_Amesos2Wrapper_def.hpp:172
void registerLinearSolverFactory()
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:74