Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_LocalFilter_def.hpp
1 /*@HEADER
2 // ***********************************************************************
3 //
4 // Ifpack2: Tempated 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_LOCALFILTER_DEF_HPP
44 #define IFPACK2_LOCALFILTER_DEF_HPP
45 #include "Ifpack2_LocalFilter_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 #ifdef HAVE_MPI
55 #include <mpi.h>
56 #include "Teuchos_DefaultMpiComm.hpp"
57 #else
58 #include "Teuchos_DefaultSerialComm.hpp"
59 #endif
60 namespace Ifpack2 {
61 
62 //==========================================================================
63 template<class MatrixType>
65 LocalFilter (const Teuchos::RCP<const Tpetra::RowMatrix<scalar_type,local_ordinal_type,global_ordinal_type,node_type> >& Matrix) :
66  A_(Matrix),
67  NumRows_(0),
68  NumNonzeros_(0),
69  MaxNumEntries_(0),
70  MaxNumEntriesA_(0)
71 {
72  using Teuchos::RCP;
73  using Teuchos::rcp;
74  typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> map_type;
75 
76  // Communicator containing this process only.
77  RCP<const Teuchos::Comm<int> > localComm;
78 
79 #ifdef HAVE_MPI
80  localComm = rcp (new Teuchos::MpiComm<int> (MPI_COMM_SELF));
81 #else
82  localComm = rcp (new Teuchos::SerialComm<int> ());
83 #endif
84 
85  // localized matrix has all the local rows of Matrix
86  NumRows_ = A_->getNodeNumRows();
87 
88  // build a linear map, based on the serial communicator
89  LocalMap_ = rcp (new map_type (NumRows_, 0, localComm));
90 
91  // NodeNumEntries_ will contain the actual number of nonzeros
92  // for each localized row (that is, without external nodes,
93  // and always with the diagonal entry)
94  NumEntries_.resize(NumRows_);
95 
96  // tentative value for MaxNumEntries. This is the number of
97  // nonzeros in the local matrix
98  MaxNumEntries_ = A_->getNodeMaxNumRowEntries();
99  MaxNumEntriesA_ = A_->getNodeMaxNumRowEntries();
100 
101  // ExtractMyRowCopy() will use these vectors
102  Indices_.resize(MaxNumEntries_);
103  Values_.resize(MaxNumEntries_);
104 
105  // now compute:
106  // - the number of nonzero per row
107  // - the total number of nonzeros
108  // - the diagonal entries
109 
110  // compute nonzeros (total and per-row), and store the
111  // diagonal entries (already modified)
112  size_t ActualMaxNumEntries = 0;
113 
114  for (size_t i = 0 ; i < NumRows_ ; ++i) {
115 
116  NumEntries_[i] = 0;
117  size_t Nnz, NewNnz = 0;
118  A_->getLocalRowCopy(i,Indices_,Values_,Nnz);
119  for (size_t j = 0 ; j < Nnz ; ++j) {
120  // FIXME (mfh 03 Apr 2013) This assumes the following:
121  //
122  // 1. Row Map, range Map, and domain Map are all the same.
123  //
124  // 2. The column Map's list of GIDs on this process is the
125  // domain Map's list of GIDs, followed by remote GIDs. Thus,
126  // for any GID in the domain Map on this process, its LID in
127  // the domain Map (and therefore in the row Map, by (1)) is
128  // the same as its LID in the column Map. (Hence the
129  // less-than test, which if true, means that Indices_[j]
130  // belongs to the row Map.)
131  if ((size_t) Indices_[j] < NumRows_ ) ++NewNnz;
132  }
133 
134  if (NewNnz > ActualMaxNumEntries)
135  ActualMaxNumEntries = NewNnz;
136 
137  NumNonzeros_ += NewNnz;
138  NumEntries_[i] = NewNnz;
139 
140  }
141 
142  MaxNumEntries_ = ActualMaxNumEntries;
143 }
144 
145 //=========================================================================
146 template<class MatrixType>
148 
149 //==========================================================================
150 template<class MatrixType>
152 {
153  return LocalMap_->getComm ();
154 }
155 
156 //==========================================================================
157 template<class MatrixType>
159 {
160  return A_->getNode();
161 }
162 
163 //==========================================================================
164 template<class MatrixType>
165 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
166  typename MatrixType::global_ordinal_type,
167  typename MatrixType::node_type> >&
169 {
170  return LocalMap_;
171 }
172 
173 //==========================================================================
174 template<class MatrixType>
175 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
176  typename MatrixType::global_ordinal_type,
177  typename MatrixType::node_type> >&
179 {
180  return LocalMap_;
181 }
182 
183 //==========================================================================
184 template<class MatrixType>
185 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
186  typename MatrixType::global_ordinal_type,
187  typename MatrixType::node_type> >&
189 {
190  return LocalMap_;
191 }
192 
193 //==========================================================================
194 template<class MatrixType>
195 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
196  typename MatrixType::global_ordinal_type,
197  typename MatrixType::node_type> >&
199 {
200  return LocalMap_;
201 }
202 
203 //==========================================================================
204 template<class MatrixType>
205 Teuchos::RCP<const Tpetra::RowGraph<typename MatrixType::local_ordinal_type,
206  typename MatrixType::global_ordinal_type,
207  typename MatrixType::node_type> >
209 {
210  throw std::runtime_error("Ifpack2::LocalFilter: does not support getGraph.");
211 }
212 
213 //==========================================================================
214 template<class MatrixType>
216 {
217  return NumRows_;
218 }
219 
220 //==========================================================================
221 template<class MatrixType>
223 {
224  return NumRows_;
225 }
226 
227 //==========================================================================
228 template<class MatrixType>
230 {
231  return NumRows_;
232 }
233 
234 //==========================================================================
235 
236 template<class MatrixType>
238 {
239  return NumRows_;
240 }
241 
242 //==========================================================================
243 template<class MatrixType>
244 typename MatrixType::global_ordinal_type LocalFilter<MatrixType>::getIndexBase() const
245 {
246  return A_->getIndexBase();
247 }
248 
249 //==========================================================================
250 template<class MatrixType>
252 {
253  return NumNonzeros_;
254 }
255 
256 //==========================================================================
257 template<class MatrixType>
259 {
260  return NumNonzeros_;
261 }
262 
263 //==========================================================================
264 template<class MatrixType>
266 {
267  throw std::runtime_error("Ifpack2::LocalFilter does not implement getNumEntriesInGlobalRow.");
268 }
269 
270 //==========================================================================
271 template<class MatrixType>
273 {
274  return NumEntries_[localRow];
275 }
276 
277 //==========================================================================
278 template<class MatrixType>
280 {
281  return A_->getGlobalNumDiags();
282 }
283 
284 //==========================================================================
285 template<class MatrixType>
287 {
288  return A_->getNodeNumDiags();
289 }
290 
291 //==========================================================================
292 template<class MatrixType>
294 {
295  return MaxNumEntries_;
296 }
297 
298 //==========================================================================
299 template<class MatrixType>
301 {
302  return MaxNumEntries_;
303 }
304 
305 //==========================================================================
306 template<class MatrixType>
308 {
309  return true;
310 }
311 
312 //==========================================================================
313 template<class MatrixType>
315 {
316  return A_->isLowerTriangular();
317 }
318 
319 //==========================================================================
320 template<class MatrixType>
322 {
323  return A_->isUpperTriangular();
324 }
325 
326 //==========================================================================
327 template<class MatrixType>
329 {
330  return A_->isLocallyIndexed();
331 }
332 
333 //==========================================================================
334 template<class MatrixType>
336 {
337  return A_->isGloballyIndexed();
338 }
339 
340 //==========================================================================
341 template<class MatrixType>
343 {
344  return A_->isFillComplete();
345 }
346 
347 //==========================================================================
348 template<class MatrixType>
351  const Teuchos::ArrayView<scalar_type> &Values,
352  size_t &NumEntries) const
353 {
354  throw std::runtime_error("Ifpack2::LocalFilter does not implement getGlobalRowCopy.");
355 }
356 
357 //==========================================================================
358 template<class MatrixType>
361  const Teuchos::ArrayView<scalar_type> &Values,
362  size_t &NumEntries) const
363 {
365  NumRows_ == 0, std::invalid_argument,
366  "Ifpack2::LocalFilter::getLocalRowCopy: Invalid local row index "
367  << LocalRow << ". This process " << LocalMap_->getComm ()->getSize ()
368  << " owns no rows of the matrix.");
370  LocalRow < 0 || (size_t) LocalRow >= NumRows_,
371  std::invalid_argument,
372  "Ifpack2::LocalFilter::getLocalRowCopy: Invalid local row index "
373  << LocalRow << ". The valid range of row indices on this process "
374  << LocalMap_->getComm ()->getSize () << " is "
375  << "[0, " << (NumRows_ - 1) << "].");
376  TEUCHOS_TEST_FOR_EXCEPTION(
377  (size_t) Indices.size() < NumEntries_[LocalRow], std::runtime_error,
378  "Ifpack2::LocalFilter::getLocalRowCopy: Invalid output array length. "
379  "The output arrays must each have length at least " << NumEntries_[LocalRow]
380  << " for local row " << LocalRow << " on process "
381  << LocalMap_->getComm ()->getSize () << ".");
382 
383  size_t A_NumEntries=0;
384  // Always extract using the object Values_ and Indices_. This is
385  // because I may need more space than that given by the user. The
386  // users expects only the local (in the domain Map) column indices,
387  // but I have to extract both local and remote (not in the domain
388  // Map) column indices.
389  A_->getLocalRowCopy (LocalRow, Indices_ (), Values_ (), A_NumEntries);
390 
391  // populate the user's vectors
392  NumEntries = 0;
393  for (size_t j = 0 ; j < A_NumEntries; ++j) {
394  // only local indices
395  if ((size_t) Indices_[j] < NumRows_) {
396  Indices[NumEntries] = Indices_[j];
397  Values[NumEntries] = Values_[j];
398  NumEntries++;
399  }
400  }
401 }
402 
403 //==========================================================================
404 template<class MatrixType>
408 {
409  throw std::runtime_error("Ifpack2::LocalFilter: does not support getGlobalRowView.");
410 }
411 
412 //==========================================================================
413 template<class MatrixType>
417 {
418  throw std::runtime_error("Ifpack2::LocalFilter: does not support getLocalRowView.");
419 }
420 
421 //==========================================================================
422 template<class MatrixType>
423 void LocalFilter<MatrixType>::getLocalDiagCopy(Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &diag) const
424 {
425  Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> temp(A_->getRowMap());
426  A_->getLocalDiagCopy(temp);
427  Teuchos::ArrayRCP<Teuchos::ArrayRCP<scalar_type> > d_ptr = diag.get2dViewNonConst();
429 
430  for(size_t i=0; i<NumRows_; i++)
431  d_ptr[0][i] = t_ptr[0][i];
432 }
433 
434 //==========================================================================
435 template<class MatrixType>
436 void LocalFilter<MatrixType>::leftScale(const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x)
437 {
438  throw std::runtime_error("Ifpack2::LocalFilter does not support leftScale.");
439 }
440 
441 //==========================================================================
442 template<class MatrixType>
443 void LocalFilter<MatrixType>::rightScale(const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& x)
444 {
445  throw std::runtime_error("Ifpack2::LocalFilter does not support rightScale.");
446 }
447 
448 //==========================================================================
449 template<class MatrixType>
450 void LocalFilter<MatrixType>::apply(const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
451  Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
452  Teuchos::ETransp mode,
453  scalar_type alpha,
454  scalar_type beta) const
455 {
457 
458  // Note: This isn't AztecOO compliant. But neither was Ifpack's version.
459 
460  TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
461  "Ifpack2::LocalFilter::apply ERROR: X.getNumVectors() != Y.getNumVectors().");
462 
464  X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
465  "Ifpack2::LocalFilter::apply: X and Y must have the same number of columns. "
466  "X has " << X.getNumVectors () << " columns, but Y has "
467  << Y.getNumVectors () << " columns.");
468 
470  alpha != STS::one (), std::logic_error,
471  "Ifpack2::LocalFilter::apply: This method does not currently work when alpha != 1.");
472 
473  TEUCHOS_TEST_FOR_EXCEPTION(
474  beta != STS::zero (), std::logic_error,
475  "Ifpack2::LocalFilter::apply: This method does not currently work when beta != 0.");
476 
477  const scalar_type zero = STS::zero();
479  Teuchos::ArrayRCP<Teuchos::ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
480 
481  Y.putScalar(zero);
482  size_t NumVectors = Y.getNumVectors();
483 
484 
485  for (size_t i = 0 ; i < NumRows_ ; ++i) {
486  size_t Nnz;
487  // Use this class's getrow to make the below code simpler
488  getLocalRowCopy(i,Indices_(),Values_(),Nnz);
489  if (mode==Teuchos::NO_TRANS){
490  for (size_t j = 0 ; j < Nnz ; ++j)
491  for (size_t k = 0 ; k < NumVectors ; ++k)
492  y_ptr[k][i] += Values_[j] * x_ptr[k][Indices_[j]];
493  }
494  else if (mode==Teuchos::TRANS){
495  for (size_t j = 0 ; j < Nnz ; ++j)
496  for (size_t k = 0 ; k < NumVectors ; ++k)
497  y_ptr[k][Indices_[j]] += Values_[j] * x_ptr[k][i];
498  }
499  else { //mode==Teuchos::CONJ_TRANS
500  for (size_t j = 0 ; j < Nnz ; ++j)
501  for (size_t k = 0 ; k < NumVectors ; ++k)
502  y_ptr[k][Indices_[j]] += STS::conjugate(Values_[j]) * x_ptr[k][i];
503  }
504  }
505 }
506 
507 
508 //==========================================================================
509 template<class MatrixType>
511 {
512  return true;
513 }
514 
515 //==========================================================================
516 template<class MatrixType>
518 {
519  return false;
520 }
521 
522 //==========================================================================
523 template<class MatrixType>
525 {
528 
531  const size_t numRows = NumRows_; // compilers like constant loop bounds
532 
533  // FIXME (mfh 03 Apr 2013) Scale during sum to avoid overflow.
534  magnitude_type sumSquared = STM::zero ();
535  if (STS::isComplex) {
536  for (size_t i = 0; i < numRows; ++i) {
537  size_t numEntries = 0;
538  this->getLocalRowCopy (i, ind, val, numEntries);
539  for (size_t k = 0; k < numEntries; ++k) {
540  sumSquared += STS::real (val[k]) * STS::real (val[k]) +
541  STS::imag (val[k]) * STS::imag (val[k]);
542  }
543  }
544  }
545  else {
546  for (size_t i = 0; i < numRows; ++i) {
547  size_t numEntries = 0;
548  this->getLocalRowCopy (i, ind, val, numEntries);
549  for (size_t k = 0; k < numEntries; ++k) {
550  sumSquared += STS::magnitude(val[k]) * STS::magnitude(val[k]);
551  }
552  }
553  }
554  return STM::squareroot (sumSquared); // Different for each process; that's OK.
555 }
556 
557 //==========================================================================
558 template<class MatrixType>
559 TPETRA_DEPRECATED
560 void
565 {
566  throw std::runtime_error("Ifpack2::LocalFilter does not implement getGlobalRowView.");
567 }
568 
569 //==========================================================================
570 template<class MatrixType>
571 TPETRA_DEPRECATED
572 void
577 {
578  throw std::runtime_error("Ifpack2::LocalFilter does not implement getLocalRowView.");
579 }
580 
581 }// namespace Ifpack2
582 
583 #endif
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_LocalFilter_def.hpp:443
virtual size_t getNodeNumDiags() const
The number of local diagonal entries, based on global row/column index comparisons.
Definition: Ifpack2_LocalFilter_def.hpp:286
virtual magnitude_type getFrobeniusNorm() const
The Frobenius norm of the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:524
virtual const Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > & getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:168
virtual Teuchos::RCP< node_type > getNode() const
Returns the underlying Kokkos Node object.
Definition: Ifpack2_LocalFilter_def.hpp:158
virtual size_t getNodeNumRows() const
The number of rows owned on the calling process.
Definition: Ifpack2_LocalFilter_def.hpp:229
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
size_type size() const
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Ifpack2_LocalFilter_def.hpp:342
virtual size_t getNodeMaxNumRowEntries() const
The maximum number of entries across all rows/columns on this process.
Definition: Ifpack2_LocalFilter_def.hpp:300
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
Computes the operator-multivector application.
Definition: Ifpack2_LocalFilter_def.hpp:450
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition: Ifpack2_LocalFilter_decl.hpp:125
virtual bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
Definition: Ifpack2_LocalFilter_def.hpp:510
virtual bool isLocallyIndexed() const
Whether the underlying sparse matrix is locally (opposite of globally) indexed.
Definition: Ifpack2_LocalFilter_def.hpp:328
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_LocalFilter_def.hpp:405
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_LocalFilter_def.hpp:423
virtual const Teuchos::RCP< const Teuchos::Comm< int > > & getComm() const
Returns the communicator.
Definition: Ifpack2_LocalFilter_def.hpp:151
virtual Teuchos::RCP< const Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > getGraph() const
The (locally filtered) matrix&#39;s graph.
Definition: Ifpack2_LocalFilter_def.hpp:208
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition: Ifpack2_LocalFilter_decl.hpp:118
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition: Ifpack2_LocalFilter_def.hpp:517
virtual global_size_t getGlobalNumDiags() const
The number of global diagonal entries, based on global row/column index comparisons.
Definition: Ifpack2_LocalFilter_def.hpp:279
virtual const Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > & getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:178
virtual size_t getNumEntriesInGlobalRow(global_ordinal_type globalRow) const
The current number of entries on this node in the specified global row.
Definition: Ifpack2_LocalFilter_def.hpp:265
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_LocalFilter_def.hpp:436
virtual global_ordinal_type getIndexBase() const
Returns the index base for global indices for this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:244
virtual bool isGloballyIndexed() const
Whether the underlying sparse matrix is globally (opposite of locally) indexed.
Definition: Ifpack2_LocalFilter_def.hpp:335
virtual bool isUpperTriangular() const
Whether this matrix is upper triangular.
Definition: Ifpack2_LocalFilter_def.hpp:321
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on all processes.
Definition: Ifpack2_LocalFilter_def.hpp:293
virtual void getLocalRowCopy(local_ordinal_type LocalRow, 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_LocalFilter_def.hpp:359
void resize(size_type new_size, const value_type &x=value_type())
virtual size_t getNodeNumCols() const
The number of columns in the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:237
LocalFilter(const Teuchos::RCP< const Tpetra::RowMatrix< scalar_type, local_ordinal_type, global_ordinal_type, node_type > > &Matrix)
Constructor.
Definition: Ifpack2_LocalFilter_def.hpp:65
virtual ~LocalFilter()
Destructor.
Definition: Ifpack2_LocalFilter_def.hpp:147
virtual global_size_t getGlobalNumRows() const
The number of global rows in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:215
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition: Ifpack2_LocalFilter_decl.hpp:111
virtual size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:258
virtual size_t getNumEntriesInLocalRow(local_ordinal_type localRow) const
The current number of entries on this node in the specified local row.
Definition: Ifpack2_LocalFilter_def.hpp:272
Teuchos::ScalarTraits< scalar_type >::magnitudeType magnitude_type
The type of the magnitude (absolute value) of a matrix entry.
Definition: Ifpack2_LocalFilter_decl.hpp:139
virtual const Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > & getDomainMap() const
Returns the Map that describes the domain distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:188
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:251
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_LocalFilter_def.hpp:349
virtual global_size_t getGlobalNumCols() const
The number of global columns in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:222
virtual bool isLowerTriangular() const
Whether this matrix is lower triangular.
Definition: Ifpack2_LocalFilter_def.hpp:314
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_LocalFilter_def.hpp:414
virtual bool hasColMap() const
Whether this matrix has a well-defined column Map.
Definition: Ifpack2_LocalFilter_def.hpp:307
virtual const Teuchos::RCP< const Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > > & getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:198