Ifpack2 Templated Preconditioning Package  Version 1.0
Ifpack2_SparsityFilter_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_SPARSITYFILTER_DEF_HPP
44 #define IFPACK2_SPARSITYFILTER_DEF_HPP
45 #include "Ifpack2_SparsityFilter_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 #include <vector>
55 #include <algorithm>
56 
57 namespace Ifpack2 {
58 
59 //==========================================================================
60 template<class MatrixType>
61 SparsityFilter<MatrixType>::SparsityFilter(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& Matrix,
62  size_t AllowedNumEntries,
63  LocalOrdinal AllowedBandwidth):
64  A_(Matrix),
65  AllowedNumEntries_(AllowedNumEntries),
66  AllowedBandwidth_(AllowedBandwidth),
67  NumRows_(0),
68  NumNonzeros_(0),
69  MaxNumEntries_(0),
70  MaxNumEntriesA_(0)
71 {
72 
73  // use this filter only on serial matrices
74  if (A_->getComm()->getSize() != 1 || A_->getNodeNumRows() != A_->getGlobalNumRows()) {
75  throw std::runtime_error("Ifpack2::SparsityFilter can be used with Comm().getSize() == 1 only. This class is a tool for Ifpack2_AdditiveSchwarz, and it is not meant to be used otherwise.");
76  }
77 
78 
79  // localized matrix has all the local rows of Matrix
80  NumRows_ = A_->getNodeNumRows();
81 
82  // NodeNumEntries_ will contain the actual number of nonzeros
83  // for each localized row (that is, without external nodes,
84  // and always with the diagonal entry)
85  NumEntries_.resize(NumRows_);
86 
87  // tentative value for MaxNumEntries. This is the number of
88  // nonzeros in the local matrix
89  MaxNumEntries_ = A_->getNodeMaxNumRowEntries();
90  MaxNumEntriesA_ = A_->getNodeMaxNumRowEntries();
91 
92  // ExtractMyRowCopy() will use these vectors
93  Indices_.resize(MaxNumEntries_);
94  Values_.resize(MaxNumEntries_);
95 
96  size_t ActualMaxNumEntries = 0;
97  for (size_t i = 0 ; i < NumRows_ ; ++i) {
98  NumEntries_[i] = MaxNumEntriesA_;
99  size_t Nnz;
100  A_->getLocalRowCopy(i,Indices_,Values_,Nnz);
101 
102  NumNonzeros_ += Nnz;
103  NumEntries_[i] = Nnz;
104  if (Nnz > ActualMaxNumEntries)
105  ActualMaxNumEntries = Nnz;
106  }
107 
108  MaxNumEntries_ = ActualMaxNumEntries;
109 }
110 
111 //=========================================================================
112 template<class MatrixType>
114 
115 //==========================================================================
116 template<class MatrixType>
117 const Teuchos::RCP<const Teuchos::Comm<int> > & SparsityFilter<MatrixType>::getComm() const
118 {
119  return A_->getComm();
120 }
121 
122 //==========================================================================
123 template<class MatrixType>
124 Teuchos::RCP <typename MatrixType::node_type> SparsityFilter<MatrixType>::getNode() const
125 {
126  return A_->getNode();
127 }
128 
129 //==========================================================================
130 template<class MatrixType>
131 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
132  typename MatrixType::global_ordinal_type,
133  typename MatrixType::node_type> >&
135 {
136  return A_->getRowMap();
137 }
138 
139 //==========================================================================
140 template<class MatrixType>
141 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
142  typename MatrixType::global_ordinal_type,
143  typename MatrixType::node_type> >&
145 {
146  return A_->getColMap();
147 }
148 
149 //==========================================================================
150 template<class MatrixType>
151 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
152  typename MatrixType::global_ordinal_type,
153  typename MatrixType::node_type> >&
155 {
156  return A_->getDomainMap();
157 }
158 
159 //==========================================================================
160 template<class MatrixType>
161 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
162  typename MatrixType::global_ordinal_type,
163  typename MatrixType::node_type> >&
165 {
166  return A_->getRangeMap();
167 }
168 
169 //==========================================================================
170 template<class MatrixType>
171 Teuchos::RCP<const Tpetra::RowGraph<typename MatrixType::local_ordinal_type,
172  typename MatrixType::global_ordinal_type,
173  typename MatrixType::node_type> >
175 {
176  throw std::runtime_error("Ifpack2::SparsityFilter: does not support getGraph.");
177 }
178 
179 //==========================================================================
180 template<class MatrixType>
182 {
183  return NumRows_;
184 }
185 
186 //==========================================================================
187 template<class MatrixType>
189 {
190  return NumRows_;
191 }
192 
193 //==========================================================================
194 template<class MatrixType>
196 {
197  return NumRows_;
198 }
199 
200 //==========================================================================
201 
202 template<class MatrixType>
204 {
205  return NumRows_;
206 }
207 
208 //==========================================================================
209 template<class MatrixType>
210 typename MatrixType::global_ordinal_type SparsityFilter<MatrixType>::getIndexBase() const
211 {
212  return A_->getIndexBase();
213 }
214 
215 //==========================================================================
216 template<class MatrixType>
218 {
219  return NumNonzeros_;
220 }
221 
222 //==========================================================================
223 template<class MatrixType>
225 {
226  return NumNonzeros_;
227 }
228 
229 //==========================================================================
230 template<class MatrixType>
231 size_t SparsityFilter<MatrixType>::getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
232 {
233  throw std::runtime_error("Ifpack2::SparsityFilter does not implement getNumEntriesInGlobalRow.");
234 }
235 
236 //==========================================================================
237 template<class MatrixType>
238 size_t SparsityFilter<MatrixType>::getNumEntriesInLocalRow(LocalOrdinal localRow) const
239 {
240  return NumEntries_[localRow];
241 }
242 
243 //==========================================================================
244 template<class MatrixType>
246 {
247  return A_->getGlobalNumDiags();
248 }
249 
250 //==========================================================================
251 template<class MatrixType>
253 {
254  return A_->getNodeNumDiags();
255 }
256 
257 //==========================================================================
258 template<class MatrixType>
260 {
261  return MaxNumEntries_;
262 }
263 
264 //==========================================================================
265 template<class MatrixType>
267 {
268  return MaxNumEntries_;
269 }
270 
271 //==========================================================================
272 template<class MatrixType>
274 {
275  return true;
276 }
277 
278 //==========================================================================
279 template<class MatrixType>
281 {
282  return A_->isLowerTriangular();
283 }
284 
285 //==========================================================================
286 template<class MatrixType>
288 {
289  return A_->isUpperTriangular();
290 }
291 
292 //==========================================================================
293 template<class MatrixType>
295 {
296  return A_->isLocallyIndexed();
297 }
298 
299 //==========================================================================
300 template<class MatrixType>
302 {
303  return A_->isGloballyIndexed();
304 }
305 
306 //==========================================================================
307 template<class MatrixType>
309 {
310  return A_->isFillComplete();
311 }
312 
313 //==========================================================================
314 template<class MatrixType>
315 void SparsityFilter<MatrixType>::getGlobalRowCopy(GlobalOrdinal GlobalRow,
316  const Teuchos::ArrayView<GlobalOrdinal> &Indices,
317  const Teuchos::ArrayView<Scalar> &Values,
318  size_t &NumEntries) const
319 {
320  throw std::runtime_error("Ifpack2::SparsityFilter does not implement getGlobalRowCopy.");
321 }
322 
323 //==========================================================================
324 template<class MatrixType>
326  const Teuchos::ArrayView<LocalOrdinal> &Indices,
327  const Teuchos::ArrayView<Scalar> &Values,
328  size_t &NumEntries) const
329 {
330  TEUCHOS_TEST_FOR_EXCEPTION((LocalRow < 0 || (size_t) LocalRow >= NumRows_ || (size_t) Indices.size() < NumEntries_[LocalRow]), std::runtime_error, "Ifpack2::SparsityFilter::getLocalRowCopy invalid row or array size.");
331 
332  // Note: This function will work correctly if called by apply, say, with Indices_ and Values_ as
333  // parameters. The structure of the loop below should make that obvious.
334 
335  // always extract using the object Values_ and Indices_.
336  // This is because I need more space than that given by
337  // the user (for the external nodes)
338  size_t A_NumEntries=0;
339  A_->getLocalRowCopy(LocalRow,Indices_(),Values_(),A_NumEntries);
340  magnitudeType Threshold = Teuchos::ScalarTraits<magnitudeType>::zero();
341  std::vector<magnitudeType> Values2(A_NumEntries,Teuchos::ScalarTraits<magnitudeType>::zero());
342 
343  if (A_NumEntries > AllowedNumEntries_) {
344  size_t count = 0;
345  for (size_t i = 0 ; i < A_NumEntries ; ++i) {
346  // skip diagonal entry (which is always inserted)
347  if (Indices_[i] == LocalRow)
348  continue;
349  // put magnitude
350  Values2[count] = Teuchos::ScalarTraits<Scalar>::magnitude(Values_[i]);
351  count++;
352  }
353 
354  // sort in descending order
355  std::sort(Values2.rbegin(),Values2.rend());
356  // get the cut-off value
357  Threshold = Values2[AllowedNumEntries_ - 1];
358  }
359 
360 
361  // loop over all nonzero elements of row MyRow,
362  // and drop elements below specified threshold.
363  // Also, add value to zero diagonal
364  NumEntries = 0;
365  for (size_t i = 0 ; i < A_NumEntries ; ++i) {
366  if (std::abs(Indices_[i] - LocalRow) > AllowedBandwidth_)
367  continue;
368 
369  if ((Indices_[i] != LocalRow) && (Teuchos::ScalarTraits<Scalar>::magnitude(Values_[i]) < Threshold))
370  continue;
371 
372  Values[NumEntries] = Values_[i];
373  Indices[NumEntries] = Indices_[i];
374 
375  NumEntries++;
376  if (NumEntries > AllowedNumEntries_)
377  break;
378  }
379 
380 }
381 
382 //==========================================================================
383 template<class MatrixType>
384 void SparsityFilter<MatrixType>::getGlobalRowView(GlobalOrdinal GlobalRow,
385  Teuchos::ArrayView<const GlobalOrdinal> &indices,
386  Teuchos::ArrayView<const Scalar> &values) const
387 {
388  throw std::runtime_error("Ifpack2::SparsityFilter: does not support getGlobalRowView.");
389 }
390 
391 //==========================================================================
392 template<class MatrixType>
394  Teuchos::ArrayView<const LocalOrdinal> &indices,
395  Teuchos::ArrayView<const Scalar> &values) const
396 {
397  throw std::runtime_error("Ifpack2::SparsityFilter: does not support getLocalRowView.");
398 }
399 
400 //==========================================================================
401 template<class MatrixType>
402 void SparsityFilter<MatrixType>::getLocalDiagCopy(Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &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 SparsityFilter<MatrixType>::leftScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x)
411 {
412  throw std::runtime_error("Ifpack2::SparsityFilter does not support leftScale.");
413 }
414 
415 //==========================================================================
416 template<class MatrixType>
417 void SparsityFilter<MatrixType>::rightScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x)
418 {
419  throw std::runtime_error("Ifpack2::SparsityFilter does not support rightScale.");
420 }
421 
422 //==========================================================================
423 template<class MatrixType>
424 void SparsityFilter<MatrixType>::apply(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
425  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
426  Teuchos::ETransp mode,
427  Scalar alpha,
428  Scalar beta) const
429 {
430  // Note: This isn't AztecOO compliant. But neither was Ifpack's version.
431  // Note: The localized maps mean the matvec is trivial (and has no import)
432  TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
433  "Ifpack2::SparsityFilter::apply ERROR: X.getNumVectors() != Y.getNumVectors().");
434 
435  Scalar zero = Teuchos::ScalarTraits<Scalar>::zero();
436  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> > x_ptr = X.get2dView();
437  Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> > y_ptr = Y.get2dViewNonConst();
438 
439  Y.putScalar(zero);
440  size_t NumVectors = Y.getNumVectors();
441 
442  for (size_t i = 0 ; i < NumRows_ ; ++i) {
443  size_t Nnz;
444  // Use this class's getrow to make the below code simpler
445  getLocalRowCopy(i,Indices_(),Values_(),Nnz);
446  if (mode==Teuchos::NO_TRANS){
447  for (size_t j = 0 ; j < Nnz ; ++j)
448  for (size_t k = 0 ; k < NumVectors ; ++k)
449  y_ptr[k][i] += Values_[j] * x_ptr[k][Indices_[j]];
450  }
451  else if (mode==Teuchos::TRANS){
452  for (size_t j = 0 ; j < Nnz ; ++j)
453  for (size_t k = 0 ; k < NumVectors ; ++k)
454  y_ptr[k][Indices_[j]] += Values_[j] * x_ptr[k][i];
455  }
456  else { //mode==Teuchos::CONJ_TRANS
457  for (size_t j = 0 ; j < Nnz ; ++j)
458  for (size_t k = 0 ; k < NumVectors ; ++k)
459  y_ptr[k][Indices_[j]] += Teuchos::ScalarTraits<Scalar>::conjugate(Values_[j]) * x_ptr[k][i];
460  }
461  }
462 }
463 
464 
465 //==========================================================================
466 template<class MatrixType>
468 {
469  return true;
470 }
471 
472 //==========================================================================
473 template<class MatrixType>
475 {
476  return false;
477 }
478 
479 //==========================================================================
480 template<class MatrixType>
481 typename Teuchos::ScalarTraits<typename MatrixType::scalar_type>::magnitudeType SparsityFilter<MatrixType>::getFrobeniusNorm() const
482 {
483  throw std::runtime_error("Ifpack2::SparsityFilter does not implement getFrobeniusNorm.");
484 }
485 
486 //==========================================================================
487 template<class MatrixType>
488 TPETRA_DEPRECATED void SparsityFilter<MatrixType>::getGlobalRowView(GlobalOrdinal GlobalRow,
489  Teuchos::ArrayRCP<const GlobalOrdinal> &indices,
490  Teuchos::ArrayRCP<const Scalar> &values) const
491 {
492  throw std::runtime_error("Ifpack2::SparsityFilter does not implement getGlobalRowView.");
493 }
494 
495 //==========================================================================
496 template<class MatrixType>
497 TPETRA_DEPRECATED void SparsityFilter<MatrixType>::getLocalRowView(LocalOrdinal LocalRow,
498  Teuchos::ArrayRCP<const LocalOrdinal> &indices,
499  Teuchos::ArrayRCP<const Scalar> &values) const
500 {
501  throw std::runtime_error("Ifpack2::SparsityFilter does not implement getLocalRowView.");
502 }
503 
504 }// namespace Ifpack2
505 
506 #endif
virtual void apply(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=Teuchos::ScalarTraits< Scalar >::one(), Scalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Computes the operator-multivector application.
Definition: Ifpack2_SparsityFilter_def.hpp:424
virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
Definition: Ifpack2_SparsityFilter_def.hpp:238
virtual bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
Definition: Ifpack2_SparsityFilter_def.hpp:467
virtual Teuchos::RCP< Node > getNode() const
Returns the underlying node.
Definition: Ifpack2_SparsityFilter_def.hpp:124
virtual const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getDomainMap() const
Returns the Map that describes the domain distribution in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:154
virtual const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:164
virtual const Teuchos::RCP< const Teuchos::Comm< int > > & getComm() const
Returns the communicator.
Definition: Ifpack2_SparsityFilter_def.hpp:117
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_SparsityFilter_def.hpp:203
virtual size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
Definition: Ifpack2_SparsityFilter_def.hpp:252
virtual GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:210
virtual void getGlobalRowCopy(GlobalOrdinal GlobalRow, const Teuchos::ArrayView< GlobalOrdinal > &Indices, const Teuchos::ArrayView< Scalar > &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_SparsityFilter_def.hpp:315
virtual const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:144
virtual void getLocalDiagCopy(Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
Definition: Ifpack2_SparsityFilter_def.hpp:402
virtual bool isUpperTriangular() const
Indicates whether this matrix is upper triangular.
Definition: Ifpack2_SparsityFilter_def.hpp:287
virtual size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
Definition: Ifpack2_SparsityFilter_def.hpp:266
virtual bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
Definition: Ifpack2_SparsityFilter_def.hpp:301
virtual Teuchos::RCP< const Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node > > getGraph() const
Returns the RowGraph associated with this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:174
virtual bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
Definition: Ifpack2_SparsityFilter_def.hpp:294
virtual ~SparsityFilter()
Destructor.
Definition: Ifpack2_SparsityFilter_def.hpp:113
virtual global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:181
virtual size_t getNodeNumRows() const
Returns the number of rows owned on the calling node.
Definition: Ifpack2_SparsityFilter_def.hpp:195
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:481
virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
Definition: Ifpack2_SparsityFilter_def.hpp:231
virtual global_size_t getGlobalNumCols() const
Returns the number of global columns in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:188
virtual bool hasColMap() const
Indicates whether this matrix has a well-defined column map.
Definition: Ifpack2_SparsityFilter_def.hpp:273
virtual global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
Definition: Ifpack2_SparsityFilter_def.hpp:245
virtual size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:224
virtual size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
Definition: Ifpack2_SparsityFilter_def.hpp:259
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:217
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Ifpack2_SparsityFilter_def.hpp:308
SparsityFilter(const Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &Matrix, size_t AllowedNumEntries, LocalOrdinal AllowedBandwidth=-Teuchos::ScalarTraits< LocalOrdinal >::one())
Constructor.
Definition: Ifpack2_SparsityFilter_def.hpp:61
virtual const Teuchos::RCP< const Tpetra::Map< LocalOrdinal, GlobalOrdinal, Node > > & getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:134
virtual void getLocalRowView(LocalOrdinal DropRow, Teuchos::ArrayView< const LocalOrdinal > &indices, Teuchos::ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:393
virtual void rightScale(const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Scales the RowMatrix on the right with the Vector x.
Definition: Ifpack2_SparsityFilter_def.hpp:417
virtual void leftScale(const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Scales the RowMatrix on the left with the Vector x.
Definition: Ifpack2_SparsityFilter_def.hpp:410
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition: Ifpack2_SparsityFilter_def.hpp:474
virtual void getLocalRowCopy(LocalOrdinal DropRow, const Teuchos::ArrayView< LocalOrdinal > &Indices, const Teuchos::ArrayView< Scalar > &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_SparsityFilter_def.hpp:325
Ifpack2::Container: a pure virtual class for creating and solving local linear problems.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:67
virtual void getGlobalRowView(GlobalOrdinal GlobalRow, Teuchos::ArrayView< const GlobalOrdinal > &indices, Teuchos::ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
Definition: Ifpack2_SparsityFilter_def.hpp:384
virtual bool isLowerTriangular() const
Indicates whether this matrix is lower triangular.
Definition: Ifpack2_SparsityFilter_def.hpp:280