43 #ifndef IFPACK2_LOCALFILTER_DEF_HPP 44 #define IFPACK2_LOCALFILTER_DEF_HPP 46 #include <Ifpack2_LocalFilter_decl.hpp> 47 #include <Tpetra_Map.hpp> 48 #include <Tpetra_MultiVector.hpp> 49 #include <Tpetra_Vector.hpp> 52 # include "Teuchos_DefaultMpiComm.hpp" 54 # include "Teuchos_DefaultSerialComm.hpp" 60 template<
class MatrixType>
62 LocalFilter<MatrixType>::
63 mapPairsAreFitted (
const row_matrix_type& A)
65 const map_type& rangeMap = * (A.getRangeMap ());
66 const map_type& rowMap = * (A.getRowMap ());
67 const bool rangeAndRowFitted = mapPairIsFitted (rowMap, rangeMap);
69 const map_type& domainMap = * (A.getDomainMap ());
70 const map_type& columnMap = * (A.getColMap ());
71 const bool domainAndColumnFitted = mapPairIsFitted (columnMap, domainMap);
78 int localSuccess = rangeAndRowFitted && domainAndColumnFitted;
81 Teuchos::reduceAll<int, int> (*(A.getComm()), Teuchos::REDUCE_MIN, localSuccess, Teuchos::outArg (globalSuccess));
83 return globalSuccess == 1;
87 template<
class MatrixType>
89 LocalFilter<MatrixType>::
90 mapPairIsFitted (
const map_type& map1,
const map_type& map2)
92 return map1.isLocallyFitted (map2);
96 template<
class MatrixType>
107 #ifdef HAVE_IFPACK2_DEBUG 108 if(! mapPairsAreFitted (*A))
110 std::cout <<
"WARNING: Ifpack2::LocalFilter:\n" <<
111 "A's Map pairs are not fitted to each other on Process " 112 << A_->getRowMap ()->getComm ()->getRank () <<
" of the input matrix's " 114 "This means that LocalFilter may not work with A. " 115 "Please see discussion of Bug 5992.";
117 #endif // HAVE_IFPACK2_DEBUG 120 RCP<const Teuchos::Comm<int> > localComm;
122 localComm = rcp (
new Teuchos::MpiComm<int> (MPI_COMM_SELF));
124 localComm = rcp (
new Teuchos::SerialComm<int> ());
150 const size_t numRows = A_->getRangeMap()->getLocalNumElements ();
158 const global_ordinal_type indexBase =
static_cast<global_ordinal_type
> (0);
161 rcp (
new map_type (numRows, indexBase, localComm,
162 Tpetra::GloballyDistributed));
165 localRangeMap_ = localRowMap_;
169 if (A_->getRangeMap ().getRawPtr () == A_->getDomainMap ().getRawPtr ()) {
172 localDomainMap_ = localRangeMap_;
175 const size_t numCols = A_->getDomainMap()->getLocalNumElements ();
177 rcp (
new map_type (numCols, indexBase, localComm,
178 Tpetra::GloballyDistributed));
184 NumEntries_.resize (numRows);
188 MaxNumEntries_ = A_->getLocalMaxNumRowEntries ();
189 MaxNumEntriesA_ = A_->getLocalMaxNumRowEntries ();
192 Kokkos::resize(localIndices_,MaxNumEntries_);
193 Kokkos::resize(localIndicesForGlobalCopy_,MaxNumEntries_);
194 Kokkos::resize(Values_,MaxNumEntries_);
203 size_t ActualMaxNumEntries = 0;
205 for (
size_t i = 0; i < numRows; ++i) {
207 size_t Nnz, NewNnz = 0;
208 A_->getLocalRowCopy (i, localIndices_, Values_, Nnz);
209 for (
size_t j = 0; j < Nnz; ++j) {
221 if (static_cast<size_t> (localIndices_[j]) < numRows) {
226 if (NewNnz > ActualMaxNumEntries) {
227 ActualMaxNumEntries = NewNnz;
230 NumNonzeros_ += NewNnz;
231 NumEntries_[i] = NewNnz;
234 MaxNumEntries_ = ActualMaxNumEntries;
238 template<
class MatrixType>
243 template<
class MatrixType>
244 Teuchos::RCP<const Teuchos::Comm<int> >
247 return localRowMap_->getComm ();
253 template<
class MatrixType>
254 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
255 typename MatrixType::global_ordinal_type,
256 typename MatrixType::node_type> >
263 template<
class MatrixType>
264 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
265 typename MatrixType::global_ordinal_type,
266 typename MatrixType::node_type> >
273 template<
class MatrixType>
274 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
275 typename MatrixType::global_ordinal_type,
276 typename MatrixType::node_type> >
279 return localDomainMap_;
283 template<
class MatrixType>
284 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
285 typename MatrixType::global_ordinal_type,
286 typename MatrixType::node_type> >
289 return localRangeMap_;
293 template<
class MatrixType>
294 Teuchos::RCP<
const Tpetra::RowGraph<
typename MatrixType::local_ordinal_type,
295 typename MatrixType::global_ordinal_type,
296 typename MatrixType::node_type> >
302 return A_->getGraph ();
306 template<
class MatrixType>
309 return static_cast<global_size_t
> (localRangeMap_->getLocalNumElements ());
313 template<
class MatrixType>
316 return static_cast<global_size_t
> (localDomainMap_->getLocalNumElements ());
320 template<
class MatrixType>
323 return static_cast<size_t> (localRangeMap_->getLocalNumElements ());
327 template<
class MatrixType>
330 return static_cast<size_t> (localDomainMap_->getLocalNumElements ());
334 template<
class MatrixType>
335 typename MatrixType::global_ordinal_type
338 return A_->getIndexBase ();
342 template<
class MatrixType>
349 template<
class MatrixType>
356 template<
class MatrixType>
361 const local_ordinal_type localRow = getRowMap ()->getLocalElement (globalRow);
362 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
370 return NumEntries_[localRow];
375 template<
class MatrixType>
385 if (getRowMap ()->isNodeLocalElement (localRow)) {
386 return NumEntries_[localRow];
398 template<
class MatrixType>
401 return MaxNumEntries_;
405 template<
class MatrixType>
408 return MaxNumEntries_;
412 template<
class MatrixType>
419 template<
class MatrixType>
422 return A_->isLocallyIndexed ();
426 template<
class MatrixType>
429 return A_->isGloballyIndexed();
433 template<
class MatrixType>
436 return A_->isFillComplete ();
440 template<
class MatrixType>
444 nonconst_global_inds_host_view_type &globalIndices,
445 nonconst_values_host_view_type &values,
446 size_t& numEntries)
const 448 typedef local_ordinal_type LO;
449 typedef typename Teuchos::Array<LO>::size_type size_type;
451 const LO localRow = this->getRowMap ()->getLocalElement (globalRow);
452 if (localRow == Teuchos::OrdinalTraits<LO>::invalid ()) {
464 numEntries = this->getNumEntriesInLocalRow (localRow);
470 this->getLocalRowCopy (localRow, localIndicesForGlobalCopy_, values, numEntries);
472 const map_type& colMap = * (this->getColMap ());
475 const size_type numEnt =
476 std::min (static_cast<size_type> (numEntries),
477 std::min ((size_type)globalIndices.size (), (size_type)values.size ()));
478 for (size_type k = 0; k < numEnt; ++k) {
479 globalIndices[k] = colMap.getGlobalElement (localIndicesForGlobalCopy_[k]);
485 template<
class MatrixType>
489 nonconst_local_inds_host_view_type &Indices,
490 nonconst_values_host_view_type &Values,
491 size_t& NumEntries)
const 493 typedef local_ordinal_type LO;
494 typedef global_ordinal_type GO;
496 if (! A_->getRowMap ()->isNodeLocalElement (LocalRow)) {
502 if (A_->getRowMap()->getComm()->getSize() == 1) {
503 A_->getLocalRowCopy (LocalRow, Indices, Values, NumEntries);
508 const size_t numEntInLclRow = NumEntries_[LocalRow];
509 if (static_cast<size_t> (Indices.size ()) < numEntInLclRow ||
510 static_cast<size_t> (Values.size ()) < numEntInLclRow) {
514 TEUCHOS_TEST_FOR_EXCEPTION(
515 true, std::runtime_error,
516 "Ifpack2::LocalFilter::getLocalRowCopy: Invalid output array length. " 517 "The output arrays must each have length at least " << numEntInLclRow
518 <<
" for local row " << LocalRow <<
" on Process " 519 << localRowMap_->getComm ()->getRank () <<
".");
521 else if (numEntInLclRow == static_cast<size_t> (0)) {
540 size_t numEntInMat = 0;
541 A_->getLocalRowCopy (LocalRow, localIndices_, Values_ , numEntInMat);
546 const map_type& matrixDomMap = * (A_->getDomainMap ());
547 const map_type& matrixColMap = * (A_->getColMap ());
549 const size_t capacity =
static_cast<size_t> (std::min (Indices.size (),
552 const size_t numRows = localRowMap_->getLocalNumElements ();
553 const bool buggy =
true;
554 for (
size_t j = 0; j < numEntInMat; ++j) {
560 const LO matrixLclCol = localIndices_[j];
561 const GO gblCol = matrixColMap.getGlobalElement (matrixLclCol);
570 if ((
size_t) localIndices_[j] < numRows) {
571 Indices[NumEntries] = localIndices_[j];
572 Values[NumEntries] = Values_[j];
576 if (matrixDomMap.isNodeGlobalElement (gblCol)) {
580 if (NumEntries < capacity) {
581 Indices[NumEntries] = matrixLclCol;
582 Values[NumEntries] = Values_[j];
591 template<
class MatrixType>
595 global_inds_host_view_type &,
596 values_host_view_type &)
const 598 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
599 "Ifpack2::LocalFilter does not implement getGlobalRowView.");
603 template<
class MatrixType>
607 local_inds_host_view_type &,
608 values_host_view_type &)
const 610 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
611 "Ifpack2::LocalFilter does not implement getLocalRowView.");
615 template<
class MatrixType>
618 getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& diag)
const 621 typedef Tpetra::Vector<scalar_type, local_ordinal_type,
622 global_ordinal_type, node_type> vector_type;
625 RCP<vector_type> diagView = diag.offsetViewNonConst (A_->getRowMap (), 0);
626 A_->getLocalDiagCopy (*diagView);
630 template<
class MatrixType>
633 leftScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
635 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
636 "Ifpack2::LocalFilter does not implement leftScale.");
640 template<
class MatrixType>
643 rightScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
645 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
646 "Ifpack2::LocalFilter does not implement rightScale.");
650 template<
class MatrixType>
653 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
654 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
655 Teuchos::ETransp mode,
657 scalar_type beta)
const 659 typedef Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> MV;
660 TEUCHOS_TEST_FOR_EXCEPTION(
661 X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
662 "Ifpack2::LocalFilter::apply: X and Y must have the same number of columns. " 663 "X has " << X.getNumVectors () <<
" columns, but Y has " 664 << Y.getNumVectors () <<
" columns.");
666 #ifdef HAVE_IFPACK2_DEBUG 668 typedef Teuchos::ScalarTraits<magnitude_type> STM;
669 Teuchos::Array<magnitude_type> norms (X.getNumVectors ());
672 for (
size_t j = 0; j < X.getNumVectors (); ++j) {
673 if (STM::isnaninf (norms[j])) {
678 TEUCHOS_TEST_FOR_EXCEPTION( ! good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the input X is NaN or Inf.");
680 #endif // HAVE_IFPACK2_DEBUG 688 MV X_copy (X, Teuchos::Copy);
689 applyNonAliased (X_copy, Y, mode, alpha, beta);
691 applyNonAliased (X, Y, mode, alpha, beta);
694 #ifdef HAVE_IFPACK2_DEBUG 696 typedef Teuchos::ScalarTraits<magnitude_type> STM;
697 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
700 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
701 if (STM::isnaninf (norms[j])) {
706 TEUCHOS_TEST_FOR_EXCEPTION( ! good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the output Y is NaN or Inf.");
708 #endif // HAVE_IFPACK2_DEBUG 711 template<
class MatrixType>
714 applyNonAliased (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
715 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
716 Teuchos::ETransp mode,
718 scalar_type beta)
const 720 using Teuchos::ArrayView;
721 using Teuchos::ArrayRCP;
722 typedef Teuchos::ScalarTraits<scalar_type> STS;
724 const scalar_type zero = STS::zero ();
725 const scalar_type one = STS::one ();
730 else if (beta != one) {
734 const size_t NumVectors = Y.getNumVectors ();
735 const size_t numRows = localRowMap_->getLocalNumElements ();
742 const bool constantStride = X.isConstantStride () && Y.isConstantStride ();
743 if (constantStride) {
746 const size_t x_stride = X.getStride();
747 const size_t y_stride = Y.getStride();
748 ArrayRCP<scalar_type> y_rcp = Y.get1dViewNonConst();
749 ArrayRCP<const scalar_type> x_rcp = X.get1dView();
750 ArrayView<scalar_type> y_ptr = y_rcp();
751 ArrayView<const scalar_type> x_ptr = x_rcp();
752 for (
size_t i = 0; i < numRows; ++i) {
755 getLocalRowCopy (i, localIndices_ , Values_ , Nnz);
756 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
757 if (mode == Teuchos::NO_TRANS) {
758 for (
size_t j = 0; j < Nnz; ++j) {
759 const local_ordinal_type col = localIndices_[j];
760 for (
size_t k = 0; k < NumVectors; ++k) {
761 y_ptr[i + y_stride*k] +=
762 alpha * Values[j] * x_ptr[col + x_stride*k];
766 else if (mode == Teuchos::TRANS) {
767 for (
size_t j = 0; j < Nnz; ++j) {
768 const local_ordinal_type col = localIndices_[j];
769 for (
size_t k = 0; k < NumVectors; ++k) {
770 y_ptr[col + y_stride*k] +=
771 alpha * Values[j] * x_ptr[i + x_stride*k];
776 for (
size_t j = 0; j < Nnz; ++j) {
777 const local_ordinal_type col = localIndices_[j];
778 for (
size_t k = 0; k < NumVectors; ++k) {
779 y_ptr[col + y_stride*k] +=
780 alpha * STS::conjugate (Values[j]) * x_ptr[i + x_stride*k];
789 ArrayRCP<ArrayRCP<const scalar_type> > x_ptr = X.get2dView();
790 ArrayRCP<ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
792 for (
size_t i = 0; i < numRows; ++i) {
795 getLocalRowCopy (i, localIndices_ , Values_ , Nnz);
796 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
797 if (mode == Teuchos::NO_TRANS) {
798 for (
size_t k = 0; k < NumVectors; ++k) {
799 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
800 ArrayView<scalar_type> y_local = (y_ptr())[k]();
801 for (
size_t j = 0; j < Nnz; ++j) {
802 y_local[i] += alpha * Values[j] * x_local[localIndices_[j]];
806 else if (mode == Teuchos::TRANS) {
807 for (
size_t k = 0; k < NumVectors; ++k) {
808 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
809 ArrayView<scalar_type> y_local = (y_ptr())[k]();
810 for (
size_t j = 0; j < Nnz; ++j) {
811 y_local[localIndices_[j]] += alpha * Values[j] * x_local[i];
816 for (
size_t k = 0; k < NumVectors; ++k) {
817 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
818 ArrayView<scalar_type> y_local = (y_ptr())[k]();
819 for (
size_t j = 0; j < Nnz; ++j) {
820 y_local[localIndices_[j]] +=
821 alpha * STS::conjugate (Values[j]) * x_local[i];
829 template<
class MatrixType>
836 template<
class MatrixType>
843 template<
class MatrixType>
845 LocalFilter<MatrixType>::mag_type
848 typedef Kokkos::Details::ArithTraits<scalar_type> STS;
849 typedef Kokkos::Details::ArithTraits<mag_type> STM;
850 typedef typename Teuchos::Array<scalar_type>::size_type size_type;
852 const size_type maxNumRowEnt = getLocalMaxNumRowEntries ();
853 nonconst_local_inds_host_view_type ind (
"ind",maxNumRowEnt);
854 nonconst_values_host_view_type val (
"val",maxNumRowEnt);
855 const size_t numRows =
static_cast<size_t> (localRowMap_->getLocalNumElements ());
858 mag_type sumSquared = STM::zero ();
859 for (
size_t i = 0; i < numRows; ++i) {
860 size_t numEntries = 0;
861 this->getLocalRowCopy (i, ind, val, numEntries);
862 for (size_type k = 0; k < static_cast<size_type> (numEntries); ++k) {
863 const mag_type v_k_abs = STS::magnitude (val[k]);
864 sumSquared += v_k_abs * v_k_abs;
867 return STM::squareroot (sumSquared);
870 template<
class MatrixType>
874 using Teuchos::TypeNameTraits;
875 std::ostringstream os;
877 os <<
"Ifpack2::LocalFilter: {";
878 os <<
"MatrixType: " << TypeNameTraits<MatrixType>::name ();
879 if (this->getObjectLabel () !=
"") {
880 os <<
", Label: \"" << this->getObjectLabel () <<
"\"";
882 os <<
", Number of rows: " << getGlobalNumRows ()
883 <<
", Number of columns: " << getGlobalNumCols ()
889 template<
class MatrixType>
893 const Teuchos::EVerbosityLevel verbLevel)
const 895 using Teuchos::OSTab;
896 using Teuchos::TypeNameTraits;
899 const Teuchos::EVerbosityLevel vl =
900 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
902 if (vl > Teuchos::VERB_NONE) {
906 out <<
"Ifpack2::LocalFilter:" << endl;
908 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name () << endl;
909 if (this->getObjectLabel () !=
"") {
910 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
912 out <<
"Number of rows: " << getGlobalNumRows () << endl
913 <<
"Number of columns: " << getGlobalNumCols () << endl
914 <<
"Number of nonzeros: " << NumNonzeros_ << endl;
916 if (vl > Teuchos::VERB_LOW) {
917 out <<
"Row Map:" << endl;
918 localRowMap_->describe (out, vl);
919 out <<
"Domain Map:" << endl;
920 localDomainMap_->describe (out, vl);
921 out <<
"Range Map:" << endl;
922 localRangeMap_->describe (out, vl);
927 template<
class MatrixType>
928 Teuchos::RCP<
const Tpetra::RowMatrix<
typename MatrixType::scalar_type,
929 typename MatrixType::local_ordinal_type,
930 typename MatrixType::global_ordinal_type,
931 typename MatrixType::node_type> >
940 #define IFPACK2_LOCALFILTER_INSTANT(S,LO,GO,N) \ 941 template class Ifpack2::LocalFilter< Tpetra::RowMatrix<S, LO, GO, N> >; virtual void getGlobalRowCopy(global_ordinal_type GlobalRow, nonconst_global_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const
Get the entries in the given row, using global indices.
Definition: Ifpack2_LocalFilter_def.hpp:443
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Ifpack2_LocalFilter_def.hpp:434
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:643
virtual mag_type getFrobeniusNorm() const
The Frobenius norm of the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:846
virtual Teuchos::RCP< const row_matrix_type > getUnderlyingMatrix() const
Return matrix that LocalFilter was built on.
Definition: Ifpack2_LocalFilter_def.hpp:932
virtual global_size_t getGlobalNumCols() const
The number of global columns in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:314
virtual bool isLocallyIndexed() const
Whether the underlying sparse matrix is locally (opposite of globally) indexed.
Definition: Ifpack2_LocalFilter_def.hpp:420
virtual size_t getLocalNumRows() const
The number of rows owned on the calling process.
Definition: Ifpack2_LocalFilter_def.hpp:321
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object to the given output stream.
Definition: Ifpack2_LocalFilter_def.hpp:892
virtual global_size_t getGlobalNumRows() const
The number of global rows in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:307
virtual Teuchos::RCP< const map_type > getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:287
Tpetra::Map< local_ordinal_type, global_ordinal_type, node_type > map_type
Type of the Tpetra::Map specialization that this class uses.
Definition: Ifpack2_LocalFilter_decl.hpp:216
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition: Ifpack2_LocalFilter_def.hpp:837
virtual Teuchos::RCP< const map_type > getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:267
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:633
virtual Teuchos::RCP< const Tpetra::RowGraph< local_ordinal_type, global_ordinal_type, node_type > > getGraph() const
The (locally filtered) matrix's graph.
Definition: Ifpack2_LocalFilter_def.hpp:297
virtual void getLocalRowCopy(local_ordinal_type LocalRow, nonconst_local_inds_host_view_type &Indices, nonconst_values_host_view_type &Values, size_t &NumEntries) const
Get the entries in the given row, using local indices.
Definition: Ifpack2_LocalFilter_def.hpp:488
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
Compute Y = beta*Y + alpha*A_local*X.
Definition: Ifpack2_LocalFilter_def.hpp:653
virtual global_ordinal_type getIndexBase() const
Returns the index base for global indices for this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:336
virtual bool hasColMap() const
Whether this matrix has a well-defined column Map.
Definition: Ifpack2_LocalFilter_def.hpp:413
virtual size_t getLocalNumCols() const
The number of columns in the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:328
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on all processes.
Definition: Ifpack2_LocalFilter_def.hpp:399
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the communicator.
Definition: Ifpack2_LocalFilter_def.hpp:245
virtual std::string description() const
A one-line description of this object.
Definition: Ifpack2_LocalFilter_def.hpp:872
LocalFilter(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition: Ifpack2_LocalFilter_def.hpp:98
virtual ~LocalFilter()
Destructor.
Definition: Ifpack2_LocalFilter_def.hpp:239
virtual size_t getLocalNumEntries() const
Returns the local number of entries in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:350
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:343
virtual Teuchos::RCP< const map_type > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:257
virtual size_t getLocalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on this process.
Definition: Ifpack2_LocalFilter_def.hpp:406
virtual bool isGloballyIndexed() const
Whether the underlying sparse matrix is globally (opposite of locally) indexed.
Definition: Ifpack2_LocalFilter_def.hpp:427
virtual void getLocalDiagCopy(Tpetra::Vector< scalar_type, local_ordinal_type, global_ordinal_type, node_type > &diag) const
Get the diagonal entries of the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:618
Access only local rows and columns of a sparse matrix.
Definition: Ifpack2_LocalFilter_decl.hpp:160
virtual Teuchos::RCP< const map_type > getDomainMap() const
Returns the Map that describes the domain distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:277
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:359
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:74
virtual void getLocalRowView(local_ordinal_type LocalRow, local_inds_host_view_type &indices, values_host_view_type &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
Definition: Ifpack2_LocalFilter_def.hpp:606
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
Definition: Ifpack2_LocalFilter_def.hpp:830
virtual void getGlobalRowView(global_ordinal_type GlobalRow, global_inds_host_view_type &indices, values_host_view_type &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
Definition: Ifpack2_LocalFilter_def.hpp:594
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:378