Ifpack2 Templated Preconditioning Package  Version 1.0
Ifpack2_SingletonFilter_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_SINGLETONFILTER_DEF_HPP
44 #define IFPACK2_SINGLETONFILTER_DEF_HPP
45 #include "Ifpack2_SingletonFilter_decl.hpp"
46 
47 #include "Tpetra_ConfigDefs.hpp"
48 #include "Tpetra_RowMatrix.hpp"
49 #include "Tpetra_Map.hpp"
50 #include "Tpetra_MultiVector.hpp"
51 #include "Tpetra_Vector.hpp"
52 
53 namespace Ifpack2 {
54 
55 //==========================================================================
56 template<class MatrixType>
57 SingletonFilter<MatrixType>::SingletonFilter(const Teuchos::RCP<const Tpetra::RowMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node> >& Matrix):
58  A_(Matrix),
59  NumSingletons_(0),
60  NumRows_(0),
61  NumNonzeros_(0),
62  MaxNumEntries_(0),
63  MaxNumEntriesA_(0)
64 {
65 
66  // use this filter only on serial matrices
67  if (A_->getComm()->getSize() != 1 || A_->getNodeNumRows() != A_->getGlobalNumRows()) {
68  throw std::runtime_error("Ifpack2::SingeltonFilter 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.");
69  }
70 
71  // Number of rows in A
72  size_t NumRowsA_ = A_->getNodeNumRows();
73 
74  // tentative value for MaxNumEntries. This is the number of
75  // nonzeros in the local matrix
76  MaxNumEntriesA_ = A_->getNodeMaxNumRowEntries();
77 
78  // ExtractMyRowCopy() will use these vectors
79  Indices_.resize(MaxNumEntriesA_);
80  Values_.resize(MaxNumEntriesA_);
81 
82  // Initialize reordering vector to -1
83  Reorder_.resize(NumRowsA_);
84  Reorder_.assign(Reorder_.size(),-1);
85 
86  // first check how may singletons I do have
87  NumRows_=0;
88  for (size_t i = 0 ; i < NumRowsA_ ; ++i) {
89  size_t Nnz;
90  A_->getLocalRowCopy(i,Indices_,Values_,Nnz);
91  if (Nnz != 1) {
92  Reorder_[i] = NumRows_++;
93  }
94  else {
95  NumSingletons_++;
96  }
97  }
98 
99  // build the inverse reordering
100  InvReorder_.resize(NumRows_);
101  for (size_t i = 0 ; i < NumRowsA_ ; ++i) {
102  if (Reorder_[i] < 0)
103  continue;
104  InvReorder_[Reorder_[i]] = i;
105  }
106  NumEntries_.resize(NumRows_);
107  SingletonIndex_.resize(NumSingletons_);
108 
109 
110  // now compute the nonzeros per row
111  size_t count = 0;
112  for (size_t i = 0 ; i < NumRowsA_ ; ++i) {
113  size_t Nnz;
114  A_->getLocalRowCopy(i,Indices_,Values_,Nnz);
115  LocalOrdinal ii = Reorder_[i];
116  if (ii >= 0) {
117  NumEntries_[ii] = Nnz;
118  NumNonzeros_ += Nnz;
119  if (Nnz > MaxNumEntries_)
120  MaxNumEntries_ = Nnz;
121  }
122  else {
123  SingletonIndex_[count] = i;
124  count++;
125  }
126  }
127 
128  // Build the reduced map. This map should be serial
129  ReducedMap_ = Teuchos::rcp( new Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node>(NumRows_,0,A_->getComm()) );
130 
131  // and finish up with the diagonal entry
132  Diagonal_ = Teuchos::rcp( new Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node>(ReducedMap_) );
133 
134  Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> DiagonalA(A_->getRowMap());
135  A_->getLocalDiagCopy(DiagonalA);
136  const Teuchos::ArrayRCP<const Scalar> & DiagonalAview = DiagonalA.get1dView();
137  for (size_t i = 0 ; i < NumRows_ ; ++i) {
138  LocalOrdinal ii = InvReorder_[i];
139  Diagonal_->replaceLocalValue((LocalOrdinal)i,DiagonalAview[ii]);
140  }
141 }
142 
143 //=========================================================================
144 template<class MatrixType>
146 
147 //==========================================================================
148 template<class MatrixType>
149 const Teuchos::RCP<const Teuchos::Comm<int> > & SingletonFilter<MatrixType>::getComm() const
150 {
151  return A_->getComm();
152 }
153 
154 //==========================================================================
155 template<class MatrixType>
156 Teuchos::RCP <typename MatrixType::node_type> SingletonFilter<MatrixType>::getNode() const
157 {
158  return A_->getNode();
159 }
160 
161 //==========================================================================
162 template<class MatrixType>
163 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
164  typename MatrixType::global_ordinal_type,
165  typename MatrixType::node_type> >&
167 {
168  return ReducedMap_;
169 }
170 
171 //==========================================================================
172 template<class MatrixType>
173 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
174  typename MatrixType::global_ordinal_type,
175  typename MatrixType::node_type> >&
177 {
178  return ReducedMap_;
179 }
180 
181 //==========================================================================
182 template<class MatrixType>
183 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
184  typename MatrixType::global_ordinal_type,
185  typename MatrixType::node_type> >&
187 {
188  return ReducedMap_;
189 }
190 
191 //==========================================================================
192 template<class MatrixType>
193 const Teuchos::RCP<const Tpetra::Map<typename MatrixType::local_ordinal_type,
194  typename MatrixType::global_ordinal_type,
195  typename MatrixType::node_type> >&
197 {
198  return ReducedMap_;
199 }
200 
201 //==========================================================================
202 template<class MatrixType>
203 Teuchos::RCP<const Tpetra::RowGraph<typename MatrixType::local_ordinal_type,
204  typename MatrixType::global_ordinal_type,
205  typename MatrixType::node_type> >
207 {
208  throw std::runtime_error("Ifpack2::SingletonFilter: does not support getGraph.");
209 }
210 
211 //==========================================================================
212 template<class MatrixType>
214 {
215  return NumRows_;
216 }
217 
218 //==========================================================================
219 template<class MatrixType>
221 {
222  return NumRows_;
223 }
224 
225 //==========================================================================
226 template<class MatrixType>
228 {
229  return NumRows_;
230 }
231 
232 //==========================================================================
233 
234 template<class MatrixType>
236 {
237  return NumRows_;
238 }
239 
240 //==========================================================================
241 template<class MatrixType>
242 typename MatrixType::global_ordinal_type SingletonFilter<MatrixType>::getIndexBase() const
243 {
244  return A_->getIndexBase();
245 }
246 
247 //==========================================================================
248 template<class MatrixType>
250 {
251  return NumNonzeros_;
252 }
253 
254 //==========================================================================
255 template<class MatrixType>
257 {
258  return NumNonzeros_;
259 }
260 
261 //==========================================================================
262 template<class MatrixType>
263 size_t SingletonFilter<MatrixType>::getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
264 {
265  throw std::runtime_error("Ifpack2::SingletonFilter does not implement getNumEntriesInGlobalRow.");
266 }
267 
268 //==========================================================================
269 template<class MatrixType>
270 size_t SingletonFilter<MatrixType>::getNumEntriesInLocalRow(LocalOrdinal localRow) const
271 {
272  return NumEntries_[localRow];
273 }
274 
275 //==========================================================================
276 template<class MatrixType>
278 {
279  return A_->getGlobalNumDiags();
280 }
281 
282 //==========================================================================
283 template<class MatrixType>
285 {
286  return A_->getNodeNumDiags();
287 }
288 
289 //==========================================================================
290 template<class MatrixType>
292 {
293  return MaxNumEntries_;
294 }
295 
296 //==========================================================================
297 template<class MatrixType>
299 {
300  return MaxNumEntries_;
301 }
302 
303 //==========================================================================
304 template<class MatrixType>
306 {
307  return true;
308 }
309 
310 //==========================================================================
311 template<class MatrixType>
313 {
314  return A_->isLowerTriangular();
315 }
316 
317 //==========================================================================
318 template<class MatrixType>
320 {
321  return A_->isUpperTriangular();
322 }
323 
324 //==========================================================================
325 template<class MatrixType>
327 {
328  return A_->isLocallyIndexed();
329 }
330 
331 //==========================================================================
332 template<class MatrixType>
334 {
335  return A_->isGloballyIndexed();
336 }
337 
338 //==========================================================================
339 template<class MatrixType>
341 {
342  return A_->isFillComplete();
343 }
344 
345 //==========================================================================
346 template<class MatrixType>
348  const Teuchos::ArrayView<GlobalOrdinal> &Indices,
349  const Teuchos::ArrayView<Scalar> &Values,
350  size_t &NumEntries) const
351 {
352  throw std::runtime_error("Ifpack2::SingletonFilter does not implement getGlobalRowCopy.");
353 }
354 
355 //==========================================================================
356 template<class MatrixType>
358  const Teuchos::ArrayView<LocalOrdinal> &Indices,
359  const Teuchos::ArrayView<Scalar> &Values,
360  size_t &NumEntries) const
361 {
362  TEUCHOS_TEST_FOR_EXCEPTION((LocalRow < 0 || (size_t) LocalRow >= NumRows_ || (size_t) Indices.size() < NumEntries_[LocalRow]), std::runtime_error, "Ifpack2::SingletonFilter::getLocalRowCopy invalid row or array size.");
363 
364  size_t Nnz;
365  LocalOrdinal ARow = InvReorder_[LocalRow];
366  A_->getLocalRowCopy(ARow,Indices_(),Values_(),Nnz);
367 
368  // populate the user's vectors
369  NumEntries = 0;
370  for (size_t i = 0 ; i < Nnz ; ++i) {
371  LocalOrdinal ii = Reorder_[Indices_[i]];
372  if ( ii >= 0) {
373  Indices[NumEntries] = ii;
374  Values[NumEntries] = Values_[i];
375  NumEntries++;
376  }
377  }
378 
379 }
380 
381 //==========================================================================
382 template<class MatrixType>
383 void SingletonFilter<MatrixType>::getGlobalRowView(GlobalOrdinal GlobalRow,
384  Teuchos::ArrayView<const GlobalOrdinal> &indices,
385  Teuchos::ArrayView<const Scalar> &values) const
386 {
387  throw std::runtime_error("Ifpack2::SingletonFilter: does not support getGlobalRowView.");
388 }
389 
390 //==========================================================================
391 template<class MatrixType>
393  Teuchos::ArrayView<const LocalOrdinal> &indices,
394  Teuchos::ArrayView<const Scalar> &values) const
395 {
396  throw std::runtime_error("Ifpack2::SingletonFilter: does not support getLocalRowView.");
397 }
398 
399 //==========================================================================
400 template<class MatrixType>
401 void SingletonFilter<MatrixType>::getLocalDiagCopy(Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &diag) const
402 {
403  // This is somewhat dubious as to how the maps match.
404  return A_->getLocalDiagCopy(diag);
405 }
406 
407 //==========================================================================
408 template<class MatrixType>
409 void SingletonFilter<MatrixType>::leftScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x)
410 {
411  throw std::runtime_error("Ifpack2::SingletonFilter does not support leftScale.");
412 }
413 
414 //==========================================================================
415 template<class MatrixType>
416 void SingletonFilter<MatrixType>::rightScale(const Tpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>& x)
417 {
418  throw std::runtime_error("Ifpack2::SingletonFilter does not support rightScale.");
419 }
420 
421 //==========================================================================
422 template<class MatrixType>
423 void SingletonFilter<MatrixType>::apply(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
424  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
425  Teuchos::ETransp mode,
426  Scalar alpha,
427  Scalar beta) const
428 {
429  this->template applyTempl<Scalar,Scalar>(X, Y, mode, alpha, beta);
430 }
431 
432 
433 //==========================================================================
434 template<class MatrixType>
435 template<class DomainScalar, class RangeScalar>
436 void SingletonFilter<MatrixType>::applyTempl(const Tpetra::MultiVector<DomainScalar,LocalOrdinal,GlobalOrdinal,Node> &X,
437  Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
438  Teuchos::ETransp mode,
439  RangeScalar alpha,
440  RangeScalar beta) const
441 {
442  // Note: This isn't AztecOO compliant. But neither was Ifpack's version.
443 
444  TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
445  "Ifpack2::SingletonFilter::apply ERROR: X.getNumVectors() != Y.getNumVectors().");
446 
447  RangeScalar zero = Teuchos::ScalarTraits<RangeScalar>::zero();
448  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > x_ptr = X.get2dView();
449  Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > y_ptr = Y.get2dViewNonConst();
450 
451  Y.putScalar(zero);
452  size_t NumVectors = Y.getNumVectors();
453 
454 
455  for (size_t i = 0 ; i < NumRows_ ; ++i) {
456  size_t Nnz;
457  // Use this class's getrow to make the below code simpler
458  getLocalRowCopy(i,Indices_(),Values_(),Nnz);
459  if (mode==Teuchos::NO_TRANS){
460  for (size_t j = 0 ; j < Nnz ; ++j)
461  for (size_t k = 0 ; k < NumVectors ; ++k)
462  y_ptr[k][i] += (RangeScalar)Values_[j] * (RangeScalar)x_ptr[k][Indices_[j]];
463  }
464  else if (mode==Teuchos::TRANS){
465  for (size_t j = 0 ; j < Nnz ; ++j)
466  for (size_t k = 0 ; k < NumVectors ; ++k)
467  y_ptr[k][Indices_[j]] += (RangeScalar)Values_[j] * (RangeScalar)x_ptr[k][i];
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]] += Teuchos::ScalarTraits<RangeScalar>::conjugate((RangeScalar)Values_[j]) * (RangeScalar)x_ptr[k][i];
473  }
474  }
475 }
476 
477 
478 //==========================================================================
479 template<class MatrixType>
481 {
482  return true;
483 }
484 
485 //==========================================================================
486 template<class MatrixType>
488 {
489  return false;
490 }
491 
492 //==============================================================================
493 template<class MatrixType>
494 void SingletonFilter<MatrixType>::SolveSingletons(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& RHS,
495  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& LHS)
496 {
497  this->template SolveSingletonsTempl<Scalar,Scalar>(RHS, LHS);
498 }
499 
500 //==============================================================================
501 template<class MatrixType>
502 template<class DomainScalar, class RangeScalar>
503 void SingletonFilter<MatrixType>::SolveSingletonsTempl(const Tpetra::MultiVector<DomainScalar,LocalOrdinal,GlobalOrdinal,Node>& RHS,
504  Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node>& LHS)
505 {
506  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > RHS_ptr = RHS.get2dView();
507  Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > LHS_ptr = LHS.get2dViewNonConst();
508 
509  for (size_t i = 0 ; i < NumSingletons_ ; ++i) {
510  LocalOrdinal ii = SingletonIndex_[i];
511  // get the diagonal value for the singleton
512  size_t Nnz;
513  A_->getLocalRowCopy(ii,Indices_(),Values_(),Nnz);
514  for (size_t j = 0 ; j < Nnz ; ++j) {
515  if (Indices_[j] == ii) {
516  for (size_t k = 0 ; k < LHS.getNumVectors() ; ++k)
517  LHS_ptr[k][ii] = (RangeScalar)RHS_ptr[k][ii] / (RangeScalar)Values_[j];
518  }
519  }
520  }
521 }
522 
523 //==============================================================================
524 template<class MatrixType>
525 void SingletonFilter<MatrixType>::CreateReducedRHS(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& LHS,
526  const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& RHS,
527  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& ReducedRHS)
528 {
529  this->template CreateReducedRHSTempl<Scalar,Scalar>(LHS, RHS, ReducedRHS);
530 }
531 
532 //==============================================================================
533 template<class MatrixType>
534 template<class DomainScalar, class RangeScalar>
535 void SingletonFilter<MatrixType>::CreateReducedRHSTempl(const Tpetra::MultiVector<DomainScalar,LocalOrdinal,GlobalOrdinal,Node>& LHS,
536  const Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node>& RHS,
537  Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node>& ReducedRHS)
538 {
539  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const RangeScalar > > RHS_ptr = RHS.get2dView();
540  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > LHS_ptr = LHS.get2dView();
541  Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > ReducedRHS_ptr = ReducedRHS.get2dViewNonConst();
542 
543  size_t NumVectors = LHS.getNumVectors();
544 
545  for (size_t i = 0 ; i < NumRows_ ; ++i)
546  for (size_t k = 0 ; k < NumVectors ; ++k)
547  ReducedRHS_ptr[k][i] = RHS_ptr[k][InvReorder_[i]];
548 
549  for (size_t i = 0 ; i < NumRows_ ; ++i) {
550  LocalOrdinal ii = InvReorder_[i];
551  size_t Nnz;
552  A_->getLocalRowCopy(ii,Indices_(),Values_(),Nnz);
553 
554  for (size_t j = 0 ; j < Nnz ; ++j) {
555  if (Reorder_[Indices_[j]] == -1) {
556  for (size_t k = 0 ; k < NumVectors ; ++k)
557  ReducedRHS_ptr[k][i] -= (RangeScalar)Values_[j] * (RangeScalar)LHS_ptr[k][Indices_[j]];
558  }
559  }
560  }
561 }
562 
563 //==============================================================================
564 template<class MatrixType>
565 void SingletonFilter<MatrixType>::UpdateLHS(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& ReducedLHS,
566  Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>& LHS)
567 {
568  this->template UpdateLHSTempl<Scalar,Scalar>(ReducedLHS, LHS);
569 }
570 
571 //==============================================================================
572 template<class MatrixType>
573 template<class DomainScalar, class RangeScalar>
574 void SingletonFilter<MatrixType>::UpdateLHSTempl(const Tpetra::MultiVector<DomainScalar,LocalOrdinal,GlobalOrdinal,Node>& ReducedLHS,
575  Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node>& LHS)
576 {
577 
578  Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > LHS_ptr = LHS.get2dViewNonConst();
579  Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > ReducedLHS_ptr = ReducedLHS.get2dView();
580 
581  for (size_t i = 0 ; i < NumRows_ ; ++i)
582  for (size_t k = 0 ; k < LHS.getNumVectors() ; ++k)
583  LHS_ptr[k][InvReorder_[i]] = (RangeScalar)ReducedLHS_ptr[k][i];
584 }
585 
586 //==========================================================================
587 template<class MatrixType>
588 typename Teuchos::ScalarTraits<typename MatrixType::scalar_type>::magnitudeType SingletonFilter<MatrixType>::getFrobeniusNorm() const
589 {
590  throw std::runtime_error("Ifpack2::SingletonFilter does not implement getFrobeniusNorm.");
591 }
592 
593 //==========================================================================
594 template<class MatrixType>
595 TPETRA_DEPRECATED void SingletonFilter<MatrixType>::getGlobalRowView(GlobalOrdinal GlobalRow,
596  Teuchos::ArrayRCP<const GlobalOrdinal> &indices,
597  Teuchos::ArrayRCP<const Scalar> &values) const
598 {
599  throw std::runtime_error("Ifpack2::SingletonFilter does not implement getGlobalRowView.");
600 }
601 
602 //==========================================================================
603 template<class MatrixType>
604 TPETRA_DEPRECATED void SingletonFilter<MatrixType>::getLocalRowView(LocalOrdinal LocalRow,
605  Teuchos::ArrayRCP<const LocalOrdinal> &indices,
606  Teuchos::ArrayRCP<const Scalar> &values) const
607 {
608  throw std::runtime_error("Ifpack2::SingletonFilter does not implement getLocalRowView.");
609 }
610 
611 
612 
613 
614 }// namespace Ifpack2
615 
616 #endif
virtual const Teuchos::RCP< const Teuchos::Comm< int > > & getComm() const
Returns the communicator.
Definition: Ifpack2_SingletonFilter_def.hpp:149
virtual bool hasTransposeApply() const
Indicates whether this operator supports applying the adjoint operator.
Definition: Ifpack2_SingletonFilter_def.hpp:480
virtual void rightScale(const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Scales the RowMatrix on the right with the Vector x.
Definition: Ifpack2_SingletonFilter_def.hpp:416
virtual ~SingletonFilter()
Destructor.
Definition: Ifpack2_SingletonFilter_def.hpp:145
virtual Teuchos::RCP< const Tpetra::RowGraph< LocalOrdinal, GlobalOrdinal, Node > > getGraph() const
Returns the RowGraph associated with this matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:206
virtual void UpdateLHS(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &ReducedLHS, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &LHS)
Updates a full LHS from a reduces LHS.
Definition: Ifpack2_SingletonFilter_def.hpp:565
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_SingletonFilter_def.hpp:383
void applyTempl(const Tpetra::MultiVector< DomainScalar, LocalOrdinal, GlobalOrdinal, Node > &X, Tpetra::MultiVector< RangeScalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, RangeScalar alpha=Teuchos::ScalarTraits< Scalar >::one(), RangeScalar beta=Teuchos::ScalarTraits< Scalar >::zero()) const
Computes the operator-multivector application.
Definition: Ifpack2_SingletonFilter_def.hpp:436
virtual void CreateReducedRHS(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &LHS, const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &RHS, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &ReducedRHS)
Creates a RHS for the reduced singleton-free system.
Definition: Ifpack2_SingletonFilter_def.hpp:525
virtual global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
Definition: Ifpack2_SingletonFilter_def.hpp:277
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition: Ifpack2_SingletonFilter_def.hpp:487
virtual global_size_t getGlobalNumRows() const
Returns the number of global rows in this matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:213
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:588
virtual GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:242
virtual size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:256
virtual size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
Definition: Ifpack2_SingletonFilter_def.hpp:284
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_SingletonFilter_def.hpp:176
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Ifpack2_SingletonFilter_def.hpp:340
virtual global_size_t getGlobalNumCols() const
Returns the number of global columns in this matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:220
virtual void getLocalRowView(LocalOrdinal LocalRow, 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_SingletonFilter_def.hpp:392
virtual bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
Definition: Ifpack2_SingletonFilter_def.hpp:333
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Ifpack2_SingletonFilter_def.hpp:249
virtual bool hasColMap() const
Indicates whether this matrix has a well-defined column map.
Definition: Ifpack2_SingletonFilter_def.hpp:305
virtual bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
Definition: Ifpack2_SingletonFilter_def.hpp:326
virtual Teuchos::RCP< Node > getNode() const
Returns the underlying node.
Definition: Ifpack2_SingletonFilter_def.hpp:156
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_SingletonFilter_def.hpp:235
virtual size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
Definition: Ifpack2_SingletonFilter_def.hpp:270
virtual size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
Definition: Ifpack2_SingletonFilter_def.hpp:263
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_SingletonFilter_def.hpp:196
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_SingletonFilter_def.hpp:186
virtual size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
Definition: Ifpack2_SingletonFilter_def.hpp:291
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_SingletonFilter_def.hpp:401
SingletonFilter(const Teuchos::RCP< const Tpetra::RowMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &Matrix)
Constructor.
Definition: Ifpack2_SingletonFilter_def.hpp:57
virtual size_t getNodeNumRows() const
Returns the number of rows owned on the calling node.
Definition: Ifpack2_SingletonFilter_def.hpp:227
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_SingletonFilter_def.hpp:166
virtual bool isLowerTriangular() const
Indicates whether this matrix is lower triangular.
Definition: Ifpack2_SingletonFilter_def.hpp:312
virtual size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
Definition: Ifpack2_SingletonFilter_def.hpp:298
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_SingletonFilter_def.hpp:423
virtual void SolveSingletons(const Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &RHS, Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &LHS)
Solve the singleton components of the linear system.
Definition: Ifpack2_SingletonFilter_def.hpp:494
Ifpack2::Container: a pure virtual class for creating and solving local linear problems.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:67
virtual bool isUpperTriangular() const
Indicates whether this matrix is upper triangular.
Definition: Ifpack2_SingletonFilter_def.hpp:319
Ifpack2_SingletonFilter: Filter based on matrix entries.
Definition: Ifpack2_SingletonFilter_decl.hpp:58
virtual void leftScale(const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Scales the RowMatrix on the left with the Vector x.
Definition: Ifpack2_SingletonFilter_def.hpp:409
virtual void getLocalRowCopy(LocalOrdinal LocalRow, 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_SingletonFilter_def.hpp:357
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_SingletonFilter_def.hpp:347