Ifpack2 Templated Preconditioning Package  Version 1.0
Ifpack2_ReorderFilter_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_REORDERFILTER_DEF_HPP
44 #define IFPACK2_REORDERFILTER_DEF_HPP
45 #include "Ifpack2_ReorderFilter_decl.hpp"
46 #include <vector>
47 
48 #include "Tpetra_ConfigDefs.hpp"
49 #include "Tpetra_RowMatrix.hpp"
50 #include "Tpetra_Map.hpp"
51 #include "Tpetra_MultiVector.hpp"
52 #include "Tpetra_Vector.hpp"
53 
54 namespace Ifpack2 {
55 
56 template<class MatrixType>
58 ReorderFilter (const Teuchos::RCP<const row_matrix_type>& A,
59  const Teuchos::ArrayRCP<local_ordinal_type>& perm,
60  const Teuchos::ArrayRCP<local_ordinal_type>& reverseperm)
61  : A_ (A),
62  perm_ (perm),
63  reverseperm_ (reverseperm)
64 {
65  TEUCHOS_TEST_FOR_EXCEPTION(
66  A_.is_null (), std::invalid_argument,
67  "Ifpack2::ReorderFilter: The input matrix is null.");
68 
69  // use this filter only on serial matrices
70  TEUCHOS_TEST_FOR_EXCEPTION(
71  A_->getComm()->getSize() != 1, std::invalid_argument,
72  "Ifpack2::ReorderFilter: This class may only be used if the input matrix's "
73  "communicator has one process. This class is an implementation detail of "
74  "Ifpack2::AdditiveSchwarz, and it is not meant to be used otherwise.");
75 
76  TEUCHOS_TEST_FOR_EXCEPTION(
77  A_->getNodeNumRows () != A_->getGlobalNumRows (),
78  std::invalid_argument,
79  "Ifpack2::ReorderFilter: The input matrix is not square.");
80 
81  // Temp arrays for apply
82  Indices_.resize (A_->getNodeMaxNumRowEntries ());
83  Values_.resize (A_->getNodeMaxNumRowEntries ());
84 }
85 
86 
87 template<class MatrixType>
89 
90 
91 template<class MatrixType>
92 Teuchos::RCP<const Teuchos::Comm<int> > ReorderFilter<MatrixType>::getComm() const
93 {
94  return A_->getComm();
95 }
96 
97 
98 template<class MatrixType>
99 Teuchos::RCP<typename ReorderFilter<MatrixType>::node_type>
101 {
102  return A_->getNode ();
103 }
104 
105 
106 template<class MatrixType>
107 Teuchos::RCP<const typename ReorderFilter<MatrixType>::map_type>
109 {
110  TEUCHOS_TEST_FOR_EXCEPTION(
111  A_.is_null (), std::runtime_error, "Ifpack2::ReorderFilter::"
112  "getRowMap: The matrix A is null, so there is no row Map.");
113 
114  return A_->getRowMap ();
115 }
116 
117 
118 template<class MatrixType>
119 Teuchos::RCP<const typename ReorderFilter<MatrixType>::map_type>
121 {
122  TEUCHOS_TEST_FOR_EXCEPTION(
123  A_.is_null (), std::runtime_error, "Ifpack2::ReorderFilter::"
124  "getColMap: The matrix A is null, so there is no column Map.");
125 
126  return A_->getColMap();
127 }
128 
129 
130 template<class MatrixType>
131 Teuchos::RCP<const typename ReorderFilter<MatrixType>::map_type>
133 {
134  TEUCHOS_TEST_FOR_EXCEPTION(
135  A_.is_null (), std::runtime_error, "Ifpack2::ReorderFilter::"
136  "getDomainMap: The matrix A is null, so there is no domain Map.");
137 
138  return A_->getDomainMap();
139 }
140 
141 
142 template<class MatrixType>
143 Teuchos::RCP<const typename ReorderFilter<MatrixType>::map_type>
145 {
146  TEUCHOS_TEST_FOR_EXCEPTION(
147  A_.is_null (), std::runtime_error, "Ifpack2::ReorderFilter::"
148  "getRangeMap: The matrix A is null, so there is no range Map.");
149 
150  return A_->getRangeMap();
151 }
152 
153 
154 template<class MatrixType>
155 Teuchos::RCP<const Tpetra::RowGraph<typename MatrixType::local_ordinal_type,
156  typename MatrixType::global_ordinal_type,
157  typename MatrixType::node_type> >
159 {
160  throw std::runtime_error("Ifpack2::ReorderFilter: does not support getGraph.");
161 }
162 
163 
164 template<class MatrixType>
166 {
167  return A_->getGlobalNumRows();
168 }
169 
170 
171 template<class MatrixType>
173 {
174  return A_->getGlobalNumCols();
175 }
176 
177 
178 template<class MatrixType>
180 {
181  return A_->getNodeNumRows();
182 }
183 
184 
185 template<class MatrixType>
187 {
188  return A_->getNodeNumCols();
189 }
190 
191 
192 template<class MatrixType>
193 typename MatrixType::global_ordinal_type ReorderFilter<MatrixType>::getIndexBase() const
194 {
195  return A_->getIndexBase();
196 }
197 
198 
199 template<class MatrixType>
201 {
202  return A_->getGlobalNumEntries();
203 }
204 
205 
206 template<class MatrixType>
208 {
209  return A_->getNodeNumEntries();
210 }
211 
212 
213 template<class MatrixType>
215 getNumEntriesInGlobalRow (global_ordinal_type globalRow) const
216 {
217  if (A_.is_null () || A_->getRowMap ().is_null ()) {
218  return Teuchos::OrdinalTraits<size_t>::invalid ();
219  }
220  else {
221  const local_ordinal_type lclRow =
222  A_->getRowMap ()->getLocalElement (globalRow);
223  if (lclRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
224  // The calling process doesn't own any entries in this row.
225  return static_cast<size_t> (0);
226  } else {
227  const local_ordinal_type origLclRow = reverseperm_[lclRow];
228  return A_->getNumEntriesInLocalRow (origLclRow);
229  }
230  }
231 }
232 
233 
234 template<class MatrixType>
236 getNumEntriesInLocalRow (local_ordinal_type localRow) const
237 {
238  // Make sure that localRow is in bounds before using it to index
239  // into the permutation.
240  if (A_->getRowMap ()->isNodeLocalElement (localRow)) {
241  // localRow is a valid index into reverseperm_.
242  const local_ordinal_type localReorderedRow = reverseperm_[localRow];
243  return A_->getNumEntriesInLocalRow (localReorderedRow);
244  } else {
245  // The calling process doesn't own any entries in this row.
246  return static_cast<size_t> (0);
247  }
248 }
249 
250 
251 template<class MatrixType>
253 {
254  return A_->getGlobalMaxNumRowEntries();
255 }
256 
257 
258 template<class MatrixType>
260 {
261  return A_->getNodeMaxNumRowEntries();
262 }
263 
264 
265 template<class MatrixType>
267 {
268  return true;
269 }
270 
271 
272 template<class MatrixType>
274 {
275  return A_->isLocallyIndexed();
276 }
277 
278 
279 template<class MatrixType>
281 {
282  return A_->isGloballyIndexed();
283 }
284 
285 
286 template<class MatrixType>
288 {
289  return A_->isFillComplete();
290 }
291 
292 
293 template<class MatrixType>
295 getGlobalRowCopy (global_ordinal_type globalRow,
296  const Teuchos::ArrayView<global_ordinal_type>& globalInd,
297  const Teuchos::ArrayView<scalar_type>& val,
298  size_t& numEntries) const
299 {
300  using Teuchos::Array;
301  using Teuchos::ArrayView;
302  using Teuchos::av_reinterpret_cast;
303  typedef local_ordinal_type LO;
304  typedef global_ordinal_type GO;
305  typedef Teuchos::OrdinalTraits<LO> OTLO;
306 
307  const map_type& rowMap = * (A_->getRowMap ());
308  const local_ordinal_type localRow = rowMap.getLocalElement (globalRow);
309  TEUCHOS_TEST_FOR_EXCEPTION(
310  localRow == OTLO::invalid (), std::invalid_argument, "Ifpack2::Reorder"
311  "Filter::getGlobalRowCopy: The given global row index " << globalRow
312  << " is not owned by the calling process with rank "
313  << rowMap.getComm ()->getRank () << ".");
314 
315  if (sizeof (GO) == sizeof (LO)) {
316  // This means we can convert local to global in place.
317  ArrayView<LO> localInd = av_reinterpret_cast<LO> (globalInd);
318  this->getLocalRowCopy (localRow, localInd, val, numEntries);
319 
320  // Convert local indices back to global indices.
321  for (size_t k = 0; k < numEntries; ++k) {
322  globalInd[k] = rowMap.getGlobalElement (localInd[k]);
323  }
324  }
325  else {
326  // LO and GO have different sizes, so we need a temp array
327  // for converting local to global.
328  numEntries = this->getNumEntriesInLocalRow (localRow);
329  Array<LO> localInd (numEntries);
330  this->getLocalRowCopy (localRow, localInd, val, numEntries);
331 
332  // Convert local indices back to global indices.
333  for (size_t k = 0; k < numEntries; ++k) {
334  globalInd[k] = rowMap.getGlobalElement (localInd[k]);
335  }
336  }
337 }
338 
339 
340 template<class MatrixType>
342 getLocalRowCopy (local_ordinal_type LocalRow,
343  const Teuchos::ArrayView<local_ordinal_type> &Indices,
344  const Teuchos::ArrayView<scalar_type> &Values,
345  size_t &NumEntries) const
346 {
347  TEUCHOS_TEST_FOR_EXCEPTION(
348  ! A_->getRowMap ()->isNodeLocalElement (LocalRow),
349  std::invalid_argument,
350  "Ifpack2::ReorderFilter::getLocalRowCopy: The given local row index "
351  << LocalRow << " is not a valid local row index on the calling process "
352  "with rank " << A_->getRowMap ()->getComm ()->getRank () << ".");
353 
354  // This duplicates code in getNumEntriesInGlobalRow, but avoids an
355  // extra array lookup and some extra tests.
356  const local_ordinal_type origLclRow = reverseperm_[LocalRow];
357  const size_t numEntries = A_->getNumEntriesInLocalRow (origLclRow);
358 
359  TEUCHOS_TEST_FOR_EXCEPTION(
360  static_cast<size_t> (Indices.size ()) < numEntries ||
361  static_cast<size_t> (Values.size ()) < numEntries,
362  std::invalid_argument,
363  "Ifpack2::ReorderFilter::getLocalRowCopy: The given array views are not "
364  "long enough to store all the data in the given row " << LocalRow
365  << ". Indices.size() = " << Indices.size () << ", Values.size() = "
366  << Values.size () << ", but the (original) row has " << numEntries
367  << " entry/ies.");
368 
369  A_->getLocalRowCopy (origLclRow, Indices, Values, NumEntries);
370  // Do a col reindex via perm
371  //
372  // FIXME (mfh 30 Jan 2014) This assumes that the row and column
373  // indices are the same.
374  for (size_t i = 0; i < NumEntries; ++i) {
375  Indices[i] = perm_[Indices[i]];
376  }
377 }
378 
379 
380 template<class MatrixType>
382 getGlobalRowView (global_ordinal_type /* GlobalRow */,
383  Teuchos::ArrayView<const global_ordinal_type> &/* indices */,
384  Teuchos::ArrayView<const scalar_type> &/* values */) const
385 {
386  throw std::runtime_error("Ifpack2::ReorderFilter: does not support getGlobalRowView.");
387 }
388 
389 
390 template<class MatrixType>
392 getLocalRowView (local_ordinal_type /* LocalRow */,
393  Teuchos::ArrayView<const local_ordinal_type> &/* indices */,
394  Teuchos::ArrayView<const scalar_type> &/* values */) const
395 {
396  throw std::runtime_error("Ifpack2::ReorderFilter: does not support getLocalRowView.");
397 }
398 
399 
400 template<class MatrixType>
402 getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &diag) const
403 {
404  // This is somewhat dubious as to how the maps match.
405  return A_->getLocalDiagCopy(diag);
406 }
407 
408 
409 template<class MatrixType>
410 void ReorderFilter<MatrixType>::leftScale(const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& /* x */)
411 {
412  throw std::runtime_error("Ifpack2::ReorderFilter does not support leftScale.");
413 }
414 
415 
416 template<class MatrixType>
417 void ReorderFilter<MatrixType>::rightScale(const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& /* x */)
418 {
419  throw std::runtime_error("Ifpack2::ReorderFilter does not support rightScale.");
420 }
421 
422 
423 template<class MatrixType>
425 apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
426  Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
427  Teuchos::ETransp mode,
428  scalar_type alpha,
429  scalar_type beta) const
430 {
431  typedef Teuchos::ScalarTraits<scalar_type> STS;
432 
433  TEUCHOS_TEST_FOR_EXCEPTION(
434  alpha != STS::one () || beta != STS::zero (), std::logic_error,
435  "Ifpack2::ReorderFilter::apply is only implemented for alpha = 1 and "
436  "beta = 0. You set alpha = " << alpha << " and beta = " << beta << ".");
437 
438  // Note: This isn't AztecOO compliant. But neither was Ifpack's version.
439  // Note: The localized maps mean the matvec is trivial (and has no import)
440  TEUCHOS_TEST_FOR_EXCEPTION(
441  X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
442  "Ifpack2::ReorderFilter::apply: X.getNumVectors() != Y.getNumVectors().");
443 
444  const scalar_type zero = STS::zero ();
445  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const scalar_type> > x_ptr = X.get2dView();
446  Teuchos::ArrayRCP<Teuchos::ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
447 
448  Y.putScalar (zero);
449  const size_t NumVectors = Y.getNumVectors ();
450 
451  for (size_t i = 0; i < A_->getNodeNumRows (); ++i) {
452  size_t Nnz;
453  // Use this class's getrow to make the below code simpler
454  getLocalRowCopy (i, Indices_ (), Values_ (), Nnz);
455  if (mode == Teuchos::NO_TRANS) {
456  for (size_t j = 0; j < Nnz; ++j) {
457  for (size_t k = 0; k < NumVectors; ++k) {
458  y_ptr[k][i] += Values_[j] * x_ptr[k][Indices_[j]];
459  }
460  }
461  }
462  else if (mode == Teuchos::TRANS) {
463  for (size_t j = 0; j < Nnz; ++j) {
464  for (size_t k = 0; k < NumVectors; ++k) {
465  y_ptr[k][Indices_[j]] += Values_[j] * x_ptr[k][i];
466  }
467  }
468  }
469  else { //mode==Teuchos::CONJ_TRANS
470  for (size_t j = 0; j < Nnz; ++j) {
471  for (size_t k = 0; k < NumVectors; ++k) {
472  y_ptr[k][Indices_[j]] += STS::conjugate(Values_[j]) * x_ptr[k][i];
473  }
474  }
475  }
476  }
477 }
478 
479 
480 template<class MatrixType>
482 {
483  return true;
484 }
485 
486 
487 template<class MatrixType>
489 {
490  return false;
491 }
492 
493 
494 template<class MatrixType>
495 typename ReorderFilter<MatrixType>::mag_type ReorderFilter<MatrixType>::getFrobeniusNorm() const
496 {
497  // Reordering doesn't change the Frobenius norm.
498  return A_->getFrobeniusNorm ();
499 }
500 
501 
502 template<class MatrixType>
504 permuteOriginalToReordered (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &originalX,
505  Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &reorderedY) const
506 {
507  this->template permuteOriginalToReorderedTempl<scalar_type,scalar_type>(originalX, reorderedY);
508 }
509 
510 
511 template<class MatrixType>
512 template<class DomainScalar, class RangeScalar>
513 void ReorderFilter<MatrixType>::permuteOriginalToReorderedTempl(const Tpetra::MultiVector<DomainScalar,local_ordinal_type,global_ordinal_type,node_type> &originalX,
514  Tpetra::MultiVector<RangeScalar,local_ordinal_type,global_ordinal_type,node_type> &reorderedY) const
515 {
516  TEUCHOS_TEST_FOR_EXCEPTION(originalX.getNumVectors() != reorderedY.getNumVectors(), std::runtime_error,
517  "Ifpack2::ReorderFilter::permuteOriginalToReordered ERROR: X.getNumVectors() != Y.getNumVectors().");
518 
519  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > x_ptr = originalX.get2dView();
520  Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > y_ptr = reorderedY.get2dViewNonConst();
521 
522  for(size_t k=0; k < originalX.getNumVectors(); k++)
523  for(local_ordinal_type i=0; (size_t)i< originalX.getLocalLength(); i++)
524  y_ptr[k][perm_[i]] = (RangeScalar)x_ptr[k][i];
525 }
526 
527 
528 template<class MatrixType>
529 void ReorderFilter<MatrixType>::permuteReorderedToOriginal(const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &reorderedX,
530  Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &originalY) const
531 {
532  this->template permuteReorderedToOriginalTempl<scalar_type,scalar_type>(reorderedX, originalY);
533 }
534 
535 
536 template<class MatrixType>
537 template<class DomainScalar, class RangeScalar>
539 permuteReorderedToOriginalTempl (const Tpetra::MultiVector<DomainScalar,local_ordinal_type,global_ordinal_type,node_type> &reorderedX,
540  Tpetra::MultiVector<RangeScalar,local_ordinal_type,global_ordinal_type,node_type> &originalY) const
541 {
542  TEUCHOS_TEST_FOR_EXCEPTION(
543  reorderedX.getNumVectors() != originalY.getNumVectors(),
544  std::runtime_error,
545  "Ifpack2::ReorderFilter::permuteReorderedToOriginal: "
546  "X.getNumVectors() != Y.getNumVectors().");
547 
548 #ifdef HAVE_IFPACK2_DEBUG
549  {
550  typedef Teuchos::ScalarTraits<DomainScalar> STS;
551  typedef typename STS::magnitudeType magnitude_type;
552  typedef Teuchos::ScalarTraits<magnitude_type> STM;
553  Teuchos::Array<magnitude_type> norms (reorderedX.getNumVectors ());
554  reorderedX.norm2 (norms ());
555  bool good = true;
556  for (size_t j = 0;
557  j < reorderedX.getNumVectors (); ++j) {
558  if (STM::isnaninf (norms[j])) {
559  good = false;
560  break;
561  }
562  }
563  TEUCHOS_TEST_FOR_EXCEPTION(
564  ! good, std::runtime_error, "Ifpack2::ReorderFilter::"
565  "permuteReorderedToOriginalTempl: The 2-norm of the input reorderedX is "
566  "NaN or Inf.");
567  }
568 #endif // HAVE_IFPACK2_DEBUG
569 
570  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > x_ptr = reorderedX.get2dView();
571  Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > y_ptr = originalY.get2dViewNonConst();
572 
573  for (size_t k = 0; k < reorderedX.getNumVectors (); ++k) {
574  for (local_ordinal_type i = 0; (size_t)i < reorderedX.getLocalLength (); ++i) {
575  y_ptr[k][reverseperm_[i]] = (RangeScalar) x_ptr[k][i];
576  }
577  }
578 
579 #ifdef HAVE_IFPACK2_DEBUG
580  {
581  typedef Teuchos::ScalarTraits<RangeScalar> STS;
582  typedef typename STS::magnitudeType magnitude_type;
583  typedef Teuchos::ScalarTraits<magnitude_type> STM;
584  Teuchos::Array<magnitude_type> norms (originalY.getNumVectors ());
585  originalY.norm2 (norms ());
586  bool good = true;
587  for (size_t j = 0;
588  j < originalY.getNumVectors (); ++j) {
589  if (STM::isnaninf (norms[j])) {
590  good = false;
591  break;
592  }
593  }
594  TEUCHOS_TEST_FOR_EXCEPTION(
595  ! good, std::runtime_error, "Ifpack2::ReorderFilter::"
596  "permuteReorderedToOriginalTempl: The 2-norm of the output originalY is "
597  "NaN or Inf.");
598  }
599 #endif // HAVE_IFPACK2_DEBUG
600 }
601 
602 } // namespace Ifpack2
603 
604 #define IFPACK2_REORDERFILTER_INSTANT(S,LO,GO,N) \
605  template class Ifpack2::ReorderFilter< Tpetra::RowMatrix<S, LO, GO, N> >;
606 
607 #endif
virtual size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const
The current number of entries in this matrix, stored on the calling process, in the row whose local i...
Definition: Ifpack2_ReorderFilter_def.hpp:236
Wraps a Tpetra::RowMatrix in a filter that reorders local rows and columns.
Definition: Ifpack2_ReorderFilter_decl.hpp:69
virtual bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
Definition: Ifpack2_ReorderFilter_def.hpp:273
virtual void getLocalRowView(local_ordinal_type LocalRow, Teuchos::ArrayView< const local_ordinal_type > &indices, Teuchos::ArrayView< const scalar_type > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:392
virtual void permuteOriginalToReordered(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &originalX, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &reorderedY) const
Permute multivector: original-to-reordered.
Definition: Ifpack2_ReorderFilter_def.hpp:504
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition: Ifpack2_ReorderFilter_def.hpp:488
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:200
virtual Teuchos::RCP< const map_type > getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:144
virtual void permuteReorderedToOriginal(const Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &reorderedX, Tpetra::MultiVector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &originalY) const
Permute multivector: reordered-to-original.
Definition: Ifpack2_ReorderFilter_def.hpp:529
virtual Teuchos::RCP< const map_type > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:108
virtual size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
Definition: Ifpack2_ReorderFilter_def.hpp:252
ReorderFilter(const Teuchos::RCP< const row_matrix_type > &A, const Teuchos::ArrayRCP< local_ordinal_type > &perm, const Teuchos::ArrayRCP< local_ordinal_type > &reverseperm)
Constructor.
Definition: Ifpack2_ReorderFilter_def.hpp:58
virtual global_size_t getGlobalNumCols() const
Returns the number of global columns in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:172
virtual size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:207
virtual size_t getNodeNumCols() const
Returns the number of columns needed to apply the forward operator on this node, i.e., the number of elements listed in the column map.
Definition: Ifpack2_ReorderFilter_def.hpp:186
virtual bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
Definition: Ifpack2_ReorderFilter_def.hpp:280
virtual global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:165
virtual void getLocalDiagCopy(Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
Definition: Ifpack2_ReorderFilter_def.hpp:402
virtual 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
, where Op(A) is either A, , or .
Definition: Ifpack2_ReorderFilter_def.hpp:425
virtual Teuchos::RCP< node_type > getNode() const
The matrix&#39;s Node instance.
Definition: Ifpack2_ReorderFilter_def.hpp:100
virtual Teuchos::RCP< const map_type > getDomainMap() const
Returns the Map that describes the domain distribution in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:132
virtual void getGlobalRowCopy(global_ordinal_type GlobalRow, const Teuchos::ArrayView< global_ordinal_type > &Indices, const Teuchos::ArrayView< scalar_type > &Values, size_t &NumEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
Definition: Ifpack2_ReorderFilter_def.hpp:295
virtual Teuchos::RCP< const map_type > getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:120
virtual mag_type getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:495
virtual size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
Definition: Ifpack2_ReorderFilter_def.hpp:259
virtual size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const
The current number of entries in this matrix, stored on the calling process, in the row whose global ...
Definition: Ifpack2_ReorderFilter_def.hpp:215
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
The matrix&#39;s communicator.
Definition: Ifpack2_ReorderFilter_def.hpp:92
virtual void getLocalRowCopy(local_ordinal_type DropRow, const Teuchos::ArrayView< local_ordinal_type > &Indices, const Teuchos::ArrayView< scalar_type > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the graph. Put into storage allocated by callin...
Definition: Ifpack2_ReorderFilter_def.hpp:342
virtual bool hasTransposeApply() const
Whether apply() can apply the transpose or conjugate transpose.
Definition: Ifpack2_ReorderFilter_def.hpp:481
virtual size_t getNodeNumRows() const
Returns the number of rows owned on the calling node.
Definition: Ifpack2_ReorderFilter_def.hpp:179
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Ifpack2_ReorderFilter_def.hpp:287
virtual void getGlobalRowView(global_ordinal_type GlobalRow, Teuchos::ArrayView< const global_ordinal_type > &indices, Teuchos::ArrayView< const scalar_type > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:382
virtual void leftScale(const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &x)
Scales the RowMatrix on the left with the Vector x.
Definition: Ifpack2_ReorderFilter_def.hpp:410
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
virtual void rightScale(const Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &x)
Scales the RowMatrix on the right with the Vector x.
Definition: Ifpack2_ReorderFilter_def.hpp:417
virtual Teuchos::RCP< const Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > getGraph() const
Returns the RowGraph associated with this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:158
virtual bool hasColMap() const
Indicates whether this matrix has a well-defined column map.
Definition: Ifpack2_ReorderFilter_def.hpp:266
virtual ~ReorderFilter()
Destructor.
Definition: Ifpack2_ReorderFilter_def.hpp:88
virtual global_ordinal_type getIndexBase() const
Returns the index base for global indices for this matrix.
Definition: Ifpack2_ReorderFilter_def.hpp:193