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