Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Details_DenseSolver_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_DENSESOLVER_DEF_HPP
11 #define IFPACK2_DETAILS_DENSESOLVER_DEF_HPP
12 
13 #include "Ifpack2_LocalFilter.hpp"
14 #include "Teuchos_LAPACK.hpp"
15 #include "Ifpack2_Details_DenseSolver.hpp"
16 #include "Tpetra_Map.hpp"
17 
18 #ifdef HAVE_MPI
19 # include <mpi.h>
21 #else
22 # include "Teuchos_DefaultSerialComm.hpp"
23 #endif // HAVE_MPI
24 
25 
26 namespace Ifpack2 {
27 namespace Details {
28 
30 // Non-stub (full) implementation
32 
33 template<class MatrixType>
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 {}
46 
47 
48 template<class MatrixType>
52  A_.is_null (), std::runtime_error, "Ifpack2::Details::DenseSolver::"
53  "getDomainMap: The input matrix A is null. Please call setMatrix() with a "
54  "nonnull input matrix before calling this method.");
55  // For an input matrix A, DenseSolver solves Ax=b for x.
56  // Thus, its Maps are reversed from those of the input matrix.
57  return A_->getRangeMap ();
58 }
59 
60 
61 template<class MatrixType>
65  A_.is_null (), std::runtime_error, "Ifpack2::Details::DenseSolver::"
66  "getRangeMap: The input matrix A is null. Please call setMatrix() with a "
67  "nonnull input matrix before calling this method.");
68  // For an input matrix A, DenseSolver solves Ax=b for x.
69  // Thus, its Maps are reversed from those of the input matrix.
70  return A_->getDomainMap ();
71 }
72 
73 
74 template<class MatrixType>
75 void
78  (void) params; // this preconditioner doesn't currently take any parameters
79 }
80 
81 
82 template<class MatrixType>
83 bool
85  return isInitialized_;
86 }
87 
88 
89 template<class MatrixType>
90 bool
92  return isComputed_;
93 }
94 
95 
96 template<class MatrixType>
97 int
99  return numInitialize_;
100 }
101 
102 
103 template<class MatrixType>
104 int
106  return numCompute_;
107 }
108 
109 
110 template<class MatrixType>
111 int
113  return numApply_;
114 }
115 
116 
117 template<class MatrixType>
118 double
120  return initializeTime_;
121 }
122 
123 
124 template<class MatrixType>
125 double
127  return computeTime_;
128 }
129 
130 
131 template<class MatrixType>
132 double
134  return applyTime_;
135 }
136 
137 
138 template<class MatrixType>
141  return A_;
142 }
143 
144 
145 template<class MatrixType>
147 reset ()
148 {
149  isInitialized_ = false;
150  isComputed_ = false;
151  A_local_ = Teuchos::null;
152  A_local_dense_.reshape (0, 0);
153  ipiv_.resize (0);
154 }
155 
156 
157 template<class MatrixType>
160 {
161  // It's legitimate to call setMatrix() with a null input. This has
162  // the effect of resetting the preconditioner's internal state.
163  if (! A_.is_null ()) {
164  const global_size_t numRows = A->getRangeMap ()->getGlobalNumElements ();
165  const global_size_t numCols = A->getDomainMap ()->getGlobalNumElements ();
167  numRows != numCols, std::invalid_argument, "Ifpack2::Details::DenseSolver::"
168  "setMatrix: Input matrix must be (globally) square. "
169  "The matrix you provided is " << numRows << " by " << numCols << ".");
170  }
171  // Clear any previously computed objects.
172  reset ();
173 
174  // Now that we've cleared the state, we can keep the matrix.
175  A_ = A;
176 }
177 
178 
179 template<class MatrixType>
181 {
182  using Teuchos::Comm;
183  using Teuchos::null;
184  using Teuchos::RCP;
185  using Teuchos::rcp;
186  using Teuchos::Time;
187  using Teuchos::TimeMonitor;
188  const std::string timerName ("Ifpack2::Details::DenseSolver::initialize");
189 
190  RCP<Time> timer = TimeMonitor::lookupCounter (timerName);
191  if (timer.is_null ()) {
192  timer = TimeMonitor::getNewCounter (timerName);
193  }
194 
195  double startTime = timer->wallTime();
196 
197  { // Begin timing here.
198  Teuchos::TimeMonitor timeMon (*timer);
199 
201  A_.is_null (), std::runtime_error, "Ifpack2::Details::DenseSolver::"
202  "initialize: The input matrix A is null. Please call setMatrix() "
203  "with a nonnull input before calling this method.");
204 
206  ! A_->hasColMap (), std::invalid_argument, "Ifpack2::Details::DenseSolver: "
207  "The constructor's input matrix must have a column Map, "
208  "so that it has local indices.");
209 
210  // Clear any previously computed objects.
211  reset ();
212 
213  // Make the local filter of the input matrix A.
214  if (A_->getComm ()->getSize () > 1) {
215  A_local_ = rcp (new LocalFilter<row_matrix_type> (A_));
216  } else {
217  A_local_ = A_;
218  }
219 
221  A_local_.is_null (), std::logic_error, "Ifpack2::Details::DenseSolver::"
222  "initialize: A_local_ is null after it was supposed to have been "
223  "initialized. Please report this bug to the Ifpack2 developers.");
224 
225  // Allocate the dense local matrix and the pivot array.
226  const size_t numRows = A_local_->getLocalNumRows ();
227  const size_t numCols = A_local_->getLocalNumCols ();
229  numRows != numCols, std::logic_error, "Ifpack2::Details::DenseSolver::"
230  "initialize: Local filter matrix is not square. This should never happen. "
231  "Please report this bug to the Ifpack2 developers.");
232  A_local_dense_.reshape (numRows, numCols);
233  ipiv_.resize (std::min (numRows, numCols));
234  std::fill (ipiv_.begin (), ipiv_.end (), 0);
235 
236  isInitialized_ = true;
237  ++numInitialize_;
238  }
239 
240  initializeTime_ += (timer->wallTime() - startTime);
241 }
242 
243 
244 template<class MatrixType>
246 {}
247 
248 
249 template<class MatrixType>
251 {
252  using Teuchos::RCP;
253  const std::string timerName ("Ifpack2::Details::DenseSolver::compute");
254 
255  RCP<Teuchos::Time> timer = Teuchos::TimeMonitor::lookupCounter (timerName);
256  if (timer.is_null ()) {
257  timer = Teuchos::TimeMonitor::getNewCounter (timerName);
258  }
259 
260  double startTime = timer->wallTime();
261 
262  // Begin timing here.
263  {
264  Teuchos::TimeMonitor timeMon (*timer);
266  A_.is_null (), std::runtime_error, "Ifpack2::Details::DenseSolver::"
267  "compute: The input matrix A is null. Please call setMatrix() with a "
268  "nonnull input, then call initialize(), before calling this method.");
269 
271  A_local_.is_null (), std::logic_error, "Ifpack2::Details::DenseSolver::"
272  "compute: A_local_ is null. Please report this bug to the Ifpack2 "
273  "developers.");
274 
275  isComputed_ = false;
276  if (! this->isInitialized ()) {
277  this->initialize ();
278  }
279  extract (A_local_dense_, *A_local_); // extract the dense local matrix
280  factor (A_local_dense_, ipiv_ ()); // factor the dense local matrix
281 
282  isComputed_ = true;
283  ++numCompute_;
284  }
285  computeTime_ += (timer->wallTime() - startTime);
286 }
287 
288 template<class MatrixType>
291  const Teuchos::ArrayView<int>& ipiv)
292 {
293  // Fill the LU permutation array with zeros.
294  std::fill (ipiv.begin (), ipiv.end (), 0);
295 
297  int INFO = 0;
298  lapack.GETRF (A.numRows (), A.numCols (), A.values (), A.stride (),
299  ipiv.getRawPtr (), &INFO);
300  // INFO < 0 is a bug.
302  INFO < 0, std::logic_error, "Ifpack2::Details::DenseSolver::factor: "
303  "LAPACK's _GETRF (LU factorization with partial pivoting) was called "
304  "incorrectly. INFO = " << INFO << " < 0. "
305  "Please report this bug to the Ifpack2 developers.");
306  // INFO > 0 means the matrix is singular. This is probably an issue
307  // either with the choice of rows the rows we extracted, or with the
308  // input matrix itself.
310  INFO > 0, std::runtime_error, "Ifpack2::Details::DenseSolver::factor: "
311  "LAPACK's _GETRF (LU factorization with partial pivoting) reports that the "
312  "computed U factor is exactly singular. U(" << INFO << "," << INFO << ") "
313  "(one-based index i) is exactly zero. This probably means that the input "
314  "matrix has a singular diagonal block.");
315 }
316 
317 
318 template<class MatrixType>
319 void DenseSolver<MatrixType, false>::
320 applyImpl (const MV& X,
321  MV& Y,
322  const Teuchos::ETransp mode,
323  const scalar_type alpha,
324  const scalar_type beta) const
325 {
326  using Teuchos::ArrayRCP;
327  using Teuchos::RCP;
328  using Teuchos::rcp;
329  using Teuchos::rcpFromRef;
330  using Teuchos::CONJ_TRANS;
331  using Teuchos::TRANS;
332 
333  const int numVecs = static_cast<int> (X.getNumVectors ());
334  if (alpha == STS::zero ()) { // don't need to solve the linear system
335  if (beta == STS::zero ()) {
336  // Use BLAS AXPY semantics for beta == 0: overwrite, clobbering
337  // any Inf or NaN values in Y (rather than multiplying them by
338  // zero, resulting in NaN values).
339  Y.putScalar (STS::zero ());
340  }
341  else { // beta != 0
342  Y.scale (STS::zero ());
343  }
344  }
345  else { // alpha != 0; must solve the linear system
347  // If beta is nonzero, Y is not constant stride, or alpha != 1, we
348  // have to use a temporary output multivector Y_tmp. It gets a
349  // copy of alpha*X, since GETRS overwrites its (multi)vector input
350  // with its output.
351  RCP<MV> Y_tmp;
352  if (beta == STS::zero () && Y.isConstantStride () && alpha == STS::one ()) {
353  deep_copy (Y, X);
354  Y_tmp = rcpFromRef (Y);
355  }
356  else {
357  Y_tmp = rcp (new MV (X, Teuchos::Copy)); // constructor copies X
358  if (alpha != STS::one ()) {
359  Y_tmp->scale (alpha);
360  }
361  }
362  const int Y_stride = static_cast<int> (Y_tmp->getStride ());
363  ArrayRCP<scalar_type> Y_view = Y_tmp->get1dViewNonConst ();
364  scalar_type* const Y_ptr = Y_view.getRawPtr ();
365  int INFO = 0;
366  const char trans =
367  (mode == CONJ_TRANS ? 'C' : (mode == TRANS ? 'T' : 'N'));
368  lapack.GETRS (trans, A_local_dense_.numRows (), numVecs,
369  A_local_dense_.values (), A_local_dense_.stride (),
370  ipiv_.getRawPtr (), Y_ptr, Y_stride, &INFO);
372  INFO != 0, std::runtime_error, "Ifpack2::Details::DenseSolver::"
373  "applyImpl: LAPACK's _GETRS (solve using LU factorization with "
374  "partial pivoting) failed with INFO = " << INFO << " != 0.");
375 
376  if (beta != STS::zero ()) {
377  Y.update (alpha, *Y_tmp, beta);
378  }
379  else if (! Y.isConstantStride ()) {
380  deep_copy (Y, *Y_tmp);
381  }
382  }
383 }
384 
385 
386 template<class MatrixType>
388 apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
389  Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
390  Teuchos::ETransp mode,
391  scalar_type alpha,
392  scalar_type beta) const
393 {
394  using Teuchos::ArrayView;
395  using Teuchos::as;
396  using Teuchos::RCP;
397  using Teuchos::rcp;
398  using Teuchos::rcpFromRef;
399 
400  const std::string timerName ("Ifpack2::Details::DenseSolver::apply");
401  RCP<Teuchos::Time> timer = Teuchos::TimeMonitor::lookupCounter (timerName);
402  if (timer.is_null ()) {
403  timer = Teuchos::TimeMonitor::getNewCounter (timerName);
404  }
405 
406  double startTime = timer->wallTime();
407 
408  // Begin timing here.
409  {
410  Teuchos::TimeMonitor timeMon (*timer);
411 
413  ! isComputed_, std::runtime_error, "Ifpack2::Details::DenseSolver::apply: "
414  "You must have called the compute() method before you may call apply(). "
415  "You may call the apply() method as many times as you want after calling "
416  "compute() once, but you must have called compute() at least once.");
417 
418  const size_t numVecs = X.getNumVectors ();
419 
421  numVecs != Y.getNumVectors (), std::runtime_error,
422  "Ifpack2::Details::DenseSolver::apply: X and Y have different numbers "
423  "of vectors. X has " << X.getNumVectors () << ", but Y has "
424  << X.getNumVectors () << ".");
425 
426  if (numVecs == 0) {
427  return; // done! nothing to do
428  }
429 
430  // Set up "local" views of X and Y.
431  RCP<const MV> X_local;
432  RCP<MV> Y_local;
433  const bool multipleProcs = (A_->getRowMap ()->getComm ()->getSize () >= 1);
434  if (multipleProcs) {
435  // Interpret X and Y as "local" multivectors, that is, in the
436  // local filter's domain resp. range Maps. "Interpret" means that
437  // we create views with different Maps; we don't have to copy.
438  X_local = X.offsetView (A_local_->getDomainMap (), 0);
439  Y_local = Y.offsetViewNonConst (A_local_->getRangeMap (), 0);
440  }
441  else { // only one process in A_'s communicator
442  // X and Y are already "local"; no need to set up local views.
443  X_local = rcpFromRef (X);
444  Y_local = rcpFromRef (Y);
445  }
446 
447  // Apply the local operator:
448  // Y_local := beta*Y_local + alpha*M^{-1}*X_local
449  this->applyImpl (*X_local, *Y_local, mode, alpha, beta);
450 
451  ++numApply_; // We've successfully finished the work of apply().
452  }
453 
454  applyTime_ += (timer->wallTime() - startTime);
455 }
456 
457 
458 template<class MatrixType>
459 std::string
461 {
462  std::ostringstream out;
463 
464  // Output is a valid YAML dictionary in flow style. If you don't
465  // like everything on a single line, you should call describe()
466  // instead.
467  out << "\"Ifpack2::Details::DenseSolver\": ";
468  out << "{";
469  if (this->getObjectLabel () != "") {
470  out << "Label: \"" << this->getObjectLabel () << "\", ";
471  }
472  out << "Initialized: " << (isInitialized () ? "true" : "false") << ", "
473  << "Computed: " << (isComputed () ? "true" : "false") << ", ";
474 
475  if (A_.is_null ()) {
476  out << "Matrix: null";
477  }
478  else {
479  out << "Matrix: not null"
480  << ", Global matrix dimensions: ["
481  << A_->getGlobalNumRows () << ", " << A_->getGlobalNumCols () << "]";
482  }
483 
484  out << "}";
485  return out.str ();
486 }
487 
488 
489 template<class MatrixType>
492  const Teuchos::EVerbosityLevel verbLevel) const
493 {
494  using Teuchos::FancyOStream;
495  using Teuchos::OSTab;
496  using Teuchos::RCP;
497  using Teuchos::rcpFromRef;
498  using std::endl;
499 
500  if (verbLevel == Teuchos::VERB_NONE) {
501  return;
502  }
503  else {
504  RCP<FancyOStream> ptrOut = rcpFromRef (out);
505  OSTab tab1 (ptrOut);
506  if (this->getObjectLabel () != "") {
507  out << "label: " << this->getObjectLabel () << endl;
508  }
509  out << "initialized: " << (isInitialized_ ? "true" : "false") << endl
510  << "computed: " << (isComputed_ ? "true" : "false") << endl
511  << "number of initialize calls: " << numInitialize_ << endl
512  << "number of compute calls: " << numCompute_ << endl
513  << "number of apply calls: " << numApply_ << endl
514  << "total time in seconds in initialize: " << initializeTime_ << endl
515  << "total time in seconds in compute: " << computeTime_ << endl
516  << "total time in seconds in apply: " << applyTime_ << endl;
517  if (verbLevel >= Teuchos::VERB_EXTREME) {
518  out << "A_local_dense_:" << endl;
519  {
520  OSTab tab2 (ptrOut);
521  out << "[";
522  for (int i = 0; i < A_local_dense_.numRows (); ++i) {
523  for (int j = 0; j < A_local_dense_.numCols (); ++j) {
524  out << A_local_dense_(i,j);
525  if (j + 1 < A_local_dense_.numCols ()) {
526  out << ", ";
527  }
528  }
529  if (i + 1 < A_local_dense_.numRows ()) {
530  out << ";" << endl;
531  }
532  }
533  out << "]" << endl;
534  }
535  out << "ipiv_: " << Teuchos::toString (ipiv_) << endl;
536  }
537  }
538 }
539 
540 
541 template<class MatrixType>
544  const Teuchos::EVerbosityLevel verbLevel) const
545 {
546  using Teuchos::FancyOStream;
547  using Teuchos::OSTab;
548  using Teuchos::RCP;
549  using Teuchos::rcpFromRef;
550  using std::endl;
551 
552  RCP<FancyOStream> ptrOut = rcpFromRef (out);
553  OSTab tab0 (ptrOut);
554  if (A_.is_null ()) {
555  // If A_ is null, we don't have a communicator, so we can't
556  // safely print local data on all processes. Just print the
557  // local data without arbitration between processes, and hope
558  // for the best.
559  if (verbLevel > Teuchos::VERB_NONE) {
560  out << "Ifpack2::Details::DenseSolver:" << endl;
561  }
562  describeLocal (out, verbLevel);
563  }
564  else {
565  // If A_ is not null, we have a communicator, so we can
566  // arbitrate among all processes to print local data.
567  const Teuchos::Comm<int>& comm = * (A_->getRowMap ()->getComm ());
568  const int myRank = comm.getRank ();
569  const int numProcs = comm.getSize ();
570  if (verbLevel > Teuchos::VERB_NONE && myRank == 0) {
571  out << "Ifpack2::Details::DenseSolver:" << endl;
572  }
573  OSTab tab1 (ptrOut);
574  for (int p = 0; p < numProcs; ++p) {
575  if (myRank == p) {
576  out << "Process " << myRank << ":" << endl;
577  describeLocal (out, verbLevel);
578  }
579  comm.barrier ();
580  comm.barrier ();
581  comm.barrier ();
582  } // for p = 0 .. numProcs-1
583  }
584 }
585 
586 
587 template<class MatrixType>
590  const row_matrix_type& A_local)
591 {
592  using Teuchos::Array;
593  using Teuchos::ArrayView;
594  typedef local_ordinal_type LO;
595  typedef typename Teuchos::ArrayView<LO>::size_type size_type;
596 
597  // Fill the local dense matrix with zeros.
598  A_local_dense.putScalar (STS::zero ());
599 
600  //
601  // Map both row and column indices to local indices. We can use the
602  // row Map's local indices for row indices, and the column Map's
603  // local indices for column indices. It doesn't really matter;
604  // either way is just a permutation of rows and columns.
605  //
606  const map_type& rowMap = * (A_local.getRowMap ());
607 
608  // Temporary arrays to hold the indices and values of the entries in
609  // each row of A_local.
610  const size_type maxNumRowEntries =
611  static_cast<size_type> (A_local.getLocalMaxNumRowEntries ());
612  nonconst_local_inds_host_view_type localIndices ("localIndices",maxNumRowEntries);
613  nonconst_values_host_view_type values ("values",maxNumRowEntries);
614 
615  const LO numLocalRows = static_cast<LO> (rowMap.getLocalNumElements ());
616  const LO minLocalRow = rowMap.getMinLocalIndex ();
617  // This slight complication of computing the upper loop bound avoids
618  // issues if the row Map has zero entries on the calling process.
619  const LO maxLocalRow = minLocalRow + numLocalRows; // exclusive bound
620  for (LO localRow = minLocalRow; localRow < maxLocalRow; ++localRow) {
621  // The LocalFilter automatically excludes "off-process" entries.
622  // That means all the column indices in this row belong to the
623  // domain Map. We can, therefore, just use the local row and
624  // column indices to put each entry directly in the dense matrix.
625  // It's OK if the column Map puts the local indices in a different
626  // order; the Import will bring them into the correct order.
627  const size_type numEntriesInRow =
628  static_cast<size_type> (A_local.getNumEntriesInLocalRow (localRow));
629  size_t numEntriesOut = 0; // ignored
630  A_local.getLocalRowCopy (localRow,
631  localIndices,
632  values,
633  numEntriesOut);
634  for (LO k = 0; k < numEntriesInRow; ++k) {
635  const LO localCol = localIndices[k];
636  const scalar_type val = values[k];
637  // We use += instead of =, in case there are duplicate entries
638  // in the row. There should not be, but why not be general?
639  A_local_dense(localRow, localCol) += val;
640  }
641  }
642 }
643 
645 // Stub implementation
647 
648 template<class MatrixType>
649 DenseSolver<MatrixType, true>::
650 DenseSolver (const Teuchos::RCP<const row_matrix_type>& A) {
651  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
652 }
653 
654 
655 template<class MatrixType>
658  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
659 }
660 
661 
662 template<class MatrixType>
665  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
666 }
667 
668 
669 template<class MatrixType>
670 void
672 setParameters (const Teuchos::ParameterList& params) {
673  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
674 }
675 
676 
677 template<class MatrixType>
678 bool
680  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
681 }
682 
683 
684 template<class MatrixType>
685 bool
687  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
688 }
689 
690 
691 template<class MatrixType>
692 int
694  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
695 }
696 
697 
698 template<class MatrixType>
699 int
701  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
702 }
703 
704 
705 template<class MatrixType>
706 int
708  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
709 }
710 
711 
712 template<class MatrixType>
713 double
715  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
716 }
717 
718 
719 template<class MatrixType>
720 double
722  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
723 }
724 
725 
726 template<class MatrixType>
727 double
729  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
730 }
731 
732 
733 template<class MatrixType>
736  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
737 }
738 
739 
740 template<class MatrixType>
743 {
744  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
745 }
746 
747 
748 template<class MatrixType>
750 {
751  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
752 }
753 
754 
755 template<class MatrixType>
756 DenseSolver<MatrixType, true>::~DenseSolver ()
757 {
758  // Destructors should never throw exceptions.
759 }
760 
761 
762 template<class MatrixType>
764 {
765  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
766 }
767 
768 
769 template<class MatrixType>
771 apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
772  Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
773  Teuchos::ETransp mode,
774  scalar_type alpha,
775  scalar_type beta) const
776 {
777  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
778 }
779 
780 
781 template<class MatrixType>
782 std::string
783 DenseSolver<MatrixType, true>::description () const
784 {
785  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
786 }
787 
788 
789 template<class MatrixType>
790 void DenseSolver<MatrixType, true>::
791 describe (Teuchos::FancyOStream& out,
792  const Teuchos::EVerbosityLevel verbLevel) const
793 {
794  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error, "Not implemented");
795 }
796 
797 
798 } // namespace Details
799 } // namespace Ifpack2
800 
801 #define IFPACK2_DETAILS_DENSESOLVER_INSTANT(S,LO,GO,N) \
802  template class Ifpack2::Details::DenseSolver< Tpetra::RowMatrix<S, LO, GO, N> >;
803 
804 #endif // IFPACK2_DETAILS_DENSESOLVER_HPP
ScalarType * values() const
virtual Teuchos::RCP< const Tpetra::Map< MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getDomainMap() const =0
The domain Map of this operator.
virtual int getSize() const =0
virtual Teuchos::RCP< const Tpetra::RowMatrix< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getMatrix() const =0
The input matrix given to the constructor.
virtual int getRank() const =0
basic_OSTab< char > OSTab
iterator begin() const
DenseSolver(const Teuchos::RCP< const row_matrix_type > &matrix)
Constructor.
Definition: Ifpack2_Details_DenseSolver_def.hpp:35
static RCP< Time > getNewCounter(const std::string &name)
static RCP< Time > lookupCounter(const std::string &name)
basic_FancyOStream< char > FancyOStream
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
&quot;Preconditioner&quot; that uses LAPACK&#39;s dense LU.
Definition: Ifpack2_Details_DenseSolver_decl.hpp:42
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to the given FancyOStream.
Definition: Ifpack2_Details_DenseSolver_def.hpp:543
virtual Teuchos::RCP< const Tpetra::Map< MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > getRangeMap() const =0
The range Map of this operator.
void GETRF(const OrdinalType &m, const OrdinalType &n, ScalarType *A, const OrdinalType &lda, OrdinalType *IPIV, OrdinalType *info) const
virtual void barrier() const =0
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
int putScalar(const ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero())
T * getRawPtr() const
virtual bool isComputed() const =0
True if the preconditioner has been successfully computed, else false.
OrdinalType numCols() const
void GETRS(const char &TRANS, const OrdinalType &n, const OrdinalType &nrhs, const ScalarType *A, const OrdinalType &lda, const OrdinalType *IPIV, ScalarType *B, const OrdinalType &ldb, OrdinalType *info) const
virtual void setParameters(const Teuchos::ParameterList &List)=0
Set this preconditioner&#39;s parameters.
iterator end() const
TypeTo as(const TypeFrom &t)
Access only local rows and columns of a sparse matrix.
Definition: Ifpack2_LocalFilter_decl.hpp:128
virtual void apply(const Tpetra::MultiVector< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > &X, Tpetra::MultiVector< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, MatrixType::scalar_typealpha=Teuchos::ScalarTraits< MatrixType::scalar_type >::one(), MatrixType::scalar_typebeta=Teuchos::ScalarTraits< MatrixType::scalar_type >::zero()) const =0
Apply the preconditioner to X, putting the result in Y.
MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition: Ifpack2_Details_DenseSolver_decl.hpp:75
virtual bool isInitialized() const =0
True if the preconditioner has been successfully initialized, else false.
OrdinalType stride() const
OrdinalType numRows() const
std::string toString(const T &t)
virtual void setMatrix(const Teuchos::RCP< const Tpetra::RowMatrix< MatrixType::scalar_type, MatrixType::local_ordinal_type, MatrixType::global_ordinal_type, MatrixType::node_type > > &A)=0
Set the new matrix.
bool is_null() const