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