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 (rangeMap, rowMap);
69 const map_type& domainMap = * (A.getDomainMap ());
70 const map_type& columnMap = * (A.getColMap ());
71 const bool domainAndColumnFitted = mapPairIsFitted (domainMap, columnMap);
73 return rangeAndRowFitted && domainAndColumnFitted;
77 template<
class MatrixType>
79 LocalFilter<MatrixType>::
80 mapPairIsFitted (
const map_type& map1,
const map_type& map2)
82 return map1.isLocallyFitted (map2);
86 template<
class MatrixType>
97 #ifdef HAVE_IFPACK2_DEBUG 98 TEUCHOS_TEST_FOR_EXCEPTION(
99 ! mapPairsAreFitted (*A), std::invalid_argument,
"Ifpack2::LocalFilter: " 100 "A's Map pairs are not fitted to each other on Process " 101 << A_->getRowMap ()->getComm ()->getRank () <<
" of the input matrix's " 103 "This means that LocalFilter does not currently know how to work with A. " 104 "This will change soon. Please see discussion of Bug 5992.");
105 #endif // HAVE_IFPACK2_DEBUG 108 RCP<const Teuchos::Comm<int> > localComm;
110 localComm = rcp (
new Teuchos::MpiComm<int> (MPI_COMM_SELF));
112 localComm = rcp (
new Teuchos::SerialComm<int> ());
138 const size_t numRows = A_->getRangeMap()->getNodeNumElements ();
146 const global_ordinal_type indexBase =
static_cast<global_ordinal_type
> (0);
149 rcp (
new map_type (numRows, indexBase, localComm,
150 Tpetra::GloballyDistributed));
153 localRangeMap_ = localRowMap_;
157 if (A_->getRangeMap ().getRawPtr () == A_->getDomainMap ().getRawPtr ()) {
160 localDomainMap_ = localRangeMap_;
163 const size_t numCols = A_->getDomainMap()->getNodeNumElements ();
165 rcp (
new map_type (numCols, indexBase, localComm,
166 Tpetra::GloballyDistributed));
172 NumEntries_.resize (numRows);
176 MaxNumEntries_ = A_->getNodeMaxNumRowEntries ();
177 MaxNumEntriesA_ = A_->getNodeMaxNumRowEntries ();
180 Kokkos::resize(localIndices_,MaxNumEntries_);
181 Kokkos::resize(localIndicesForGlobalCopy_,MaxNumEntries_);
182 Kokkos::resize(Values_,MaxNumEntries_);
191 size_t ActualMaxNumEntries = 0;
193 for (
size_t i = 0; i < numRows; ++i) {
195 size_t Nnz, NewNnz = 0;
196 A_->getLocalRowCopy (i, localIndices_, Values_, Nnz);
197 for (
size_t j = 0; j < Nnz; ++j) {
209 if (static_cast<size_t> (localIndices_[j]) < numRows) {
214 if (NewNnz > ActualMaxNumEntries) {
215 ActualMaxNumEntries = NewNnz;
218 NumNonzeros_ += NewNnz;
219 NumEntries_[i] = NewNnz;
222 MaxNumEntries_ = ActualMaxNumEntries;
226 template<
class MatrixType>
231 template<
class MatrixType>
232 Teuchos::RCP<const Teuchos::Comm<int> >
235 return localRowMap_->getComm ();
241 template<
class MatrixType>
242 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
243 typename MatrixType::global_ordinal_type,
244 typename MatrixType::node_type> >
251 template<
class MatrixType>
252 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
253 typename MatrixType::global_ordinal_type,
254 typename MatrixType::node_type> >
261 template<
class MatrixType>
262 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
263 typename MatrixType::global_ordinal_type,
264 typename MatrixType::node_type> >
267 return localDomainMap_;
271 template<
class MatrixType>
272 Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
273 typename MatrixType::global_ordinal_type,
274 typename MatrixType::node_type> >
277 return localRangeMap_;
281 template<
class MatrixType>
282 Teuchos::RCP<
const Tpetra::RowGraph<
typename MatrixType::local_ordinal_type,
283 typename MatrixType::global_ordinal_type,
284 typename MatrixType::node_type> >
290 return A_->getGraph ();
294 template<
class MatrixType>
297 return static_cast<global_size_t
> (localRangeMap_->getNodeNumElements ());
301 template<
class MatrixType>
304 return static_cast<global_size_t
> (localDomainMap_->getNodeNumElements ());
308 template<
class MatrixType>
311 return static_cast<size_t> (localRangeMap_->getNodeNumElements ());
315 template<
class MatrixType>
318 return static_cast<size_t> (localDomainMap_->getNodeNumElements ());
322 template<
class MatrixType>
323 typename MatrixType::global_ordinal_type
326 return A_->getIndexBase ();
330 template<
class MatrixType>
337 template<
class MatrixType>
344 template<
class MatrixType>
349 const local_ordinal_type localRow = getRowMap ()->getLocalElement (globalRow);
350 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
358 return NumEntries_[localRow];
363 template<
class MatrixType>
373 if (getRowMap ()->isNodeLocalElement (localRow)) {
374 return NumEntries_[localRow];
386 template<
class MatrixType>
389 return MaxNumEntries_;
393 template<
class MatrixType>
396 return MaxNumEntries_;
400 template<
class MatrixType>
407 template<
class MatrixType>
410 return A_->isLocallyIndexed ();
414 template<
class MatrixType>
417 return A_->isGloballyIndexed();
421 template<
class MatrixType>
424 return A_->isFillComplete ();
428 template<
class MatrixType>
432 nonconst_global_inds_host_view_type &globalIndices,
433 nonconst_values_host_view_type &values,
434 size_t& numEntries)
const 436 typedef local_ordinal_type LO;
437 typedef typename Teuchos::Array<LO>::size_type size_type;
439 const LO localRow = this->getRowMap ()->getLocalElement (globalRow);
440 if (localRow == Teuchos::OrdinalTraits<LO>::invalid ()) {
452 numEntries = this->getNumEntriesInLocalRow (localRow);
458 this->getLocalRowCopy (localRow, localIndicesForGlobalCopy_, values, numEntries);
460 const map_type& colMap = * (this->getColMap ());
463 const size_type numEnt =
464 std::min (static_cast<size_type> (numEntries),
465 std::min ((size_type)globalIndices.size (), (size_type)values.size ()));
466 for (size_type k = 0; k < numEnt; ++k) {
467 globalIndices[k] = colMap.getGlobalElement (localIndicesForGlobalCopy_[k]);
472 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 473 template<
class MatrixType>
477 const Teuchos::ArrayView<global_ordinal_type>& Indices,
478 const Teuchos::ArrayView<scalar_type>& Values,
479 size_t& numEntries)
const {
480 using IST =
typename row_matrix_type::impl_scalar_type;
481 nonconst_global_inds_host_view_type ind_in(Indices.data(),Indices.size());
482 nonconst_values_host_view_type val_in(reinterpret_cast<IST*>(Values.data()),Values.size());
483 getGlobalRowCopy(globalRow,ind_in,val_in,numEntries);
487 template<
class MatrixType>
491 nonconst_local_inds_host_view_type &Indices,
492 nonconst_values_host_view_type &Values,
493 size_t& NumEntries)
const 495 typedef local_ordinal_type LO;
496 typedef global_ordinal_type GO;
498 if (! A_->getRowMap ()->isNodeLocalElement (LocalRow)) {
504 if (A_->getRowMap()->getComm()->getSize() == 1) {
505 A_->getLocalRowCopy (LocalRow, Indices, Values, NumEntries);
510 const size_t numEntInLclRow = NumEntries_[LocalRow];
511 if (static_cast<size_t> (Indices.size ()) < numEntInLclRow ||
512 static_cast<size_t> (Values.size ()) < numEntInLclRow) {
516 TEUCHOS_TEST_FOR_EXCEPTION(
517 true, std::runtime_error,
518 "Ifpack2::LocalFilter::getLocalRowCopy: Invalid output array length. " 519 "The output arrays must each have length at least " << numEntInLclRow
520 <<
" for local row " << LocalRow <<
" on Process " 521 << localRowMap_->getComm ()->getRank () <<
".");
523 else if (numEntInLclRow == static_cast<size_t> (0)) {
542 size_t numEntInMat = 0;
543 A_->getLocalRowCopy (LocalRow, localIndices_, Values_ , numEntInMat);
548 const map_type& matrixDomMap = * (A_->getDomainMap ());
549 const map_type& matrixColMap = * (A_->getColMap ());
551 const size_t capacity =
static_cast<size_t> (std::min (Indices.size (),
554 const size_t numRows = localRowMap_->getNodeNumElements ();
555 const bool buggy =
true;
556 for (
size_t j = 0; j < numEntInMat; ++j) {
562 const LO matrixLclCol = localIndices_[j];
563 const GO gblCol = matrixColMap.getGlobalElement (matrixLclCol);
572 if ((
size_t) localIndices_[j] < numRows) {
573 Indices[NumEntries] = localIndices_[j];
574 Values[NumEntries] = Values_[j];
578 if (matrixDomMap.isNodeGlobalElement (gblCol)) {
582 if (NumEntries < capacity) {
583 Indices[NumEntries] = matrixLclCol;
584 Values[NumEntries] = Values_[j];
592 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 593 template<
class MatrixType>
597 const Teuchos::ArrayView<local_ordinal_type> &Indices,
598 const Teuchos::ArrayView<scalar_type> &Values,
599 size_t &NumEntries)
const 601 using IST =
typename row_matrix_type::impl_scalar_type;
602 nonconst_local_inds_host_view_type ind_in(Indices.data(),Indices.size());
603 nonconst_values_host_view_type val_in(reinterpret_cast<IST*>(Values.data()),Values.size());
604 getLocalRowCopy(globalRow,ind_in,val_in,NumEntries);
609 template<
class MatrixType>
613 global_inds_host_view_type &,
614 values_host_view_type &)
const 616 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
617 "Ifpack2::LocalFilter does not implement getGlobalRowView.");
620 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 621 template<
class MatrixType>
625 Teuchos::ArrayView<const global_ordinal_type> &,
626 Teuchos::ArrayView<const scalar_type> &)
const 628 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
629 "Ifpack2::LocalFilter does not implement getGlobalRowView.");
633 template<
class MatrixType>
637 local_inds_host_view_type &,
638 values_host_view_type &)
const 640 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
641 "Ifpack2::LocalFilter does not implement getLocalRowView.");
645 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 646 template<
class MatrixType>
650 Teuchos::ArrayView<const local_ordinal_type> &,
651 Teuchos::ArrayView<const scalar_type> &)
const 653 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
654 "Ifpack2::LocalFilter does not implement getLocalRowView.");
659 template<
class MatrixType>
662 getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& diag)
const 665 typedef Tpetra::Vector<scalar_type, local_ordinal_type,
666 global_ordinal_type, node_type> vector_type;
669 RCP<vector_type> diagView = diag.offsetViewNonConst (A_->getRowMap (), 0);
670 A_->getLocalDiagCopy (*diagView);
674 template<
class MatrixType>
677 leftScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
679 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
680 "Ifpack2::LocalFilter does not implement leftScale.");
684 template<
class MatrixType>
687 rightScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
689 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
690 "Ifpack2::LocalFilter does not implement rightScale.");
694 template<
class MatrixType>
697 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
698 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
699 Teuchos::ETransp mode,
701 scalar_type beta)
const 703 typedef Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> MV;
704 TEUCHOS_TEST_FOR_EXCEPTION(
705 X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
706 "Ifpack2::LocalFilter::apply: X and Y must have the same number of columns. " 707 "X has " << X.getNumVectors () <<
" columns, but Y has " 708 << Y.getNumVectors () <<
" columns.");
710 #ifdef HAVE_IFPACK2_DEBUG 712 typedef Teuchos::ScalarTraits<magnitude_type> STM;
713 Teuchos::Array<magnitude_type> norms (X.getNumVectors ());
716 for (
size_t j = 0; j < X.getNumVectors (); ++j) {
717 if (STM::isnaninf (norms[j])) {
722 TEUCHOS_TEST_FOR_EXCEPTION( ! good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the input X is NaN or Inf.");
724 #endif // HAVE_IFPACK2_DEBUG 732 MV X_copy (X, Teuchos::Copy);
733 applyNonAliased (X_copy, Y, mode, alpha, beta);
735 applyNonAliased (X, Y, mode, alpha, beta);
738 #ifdef HAVE_IFPACK2_DEBUG 740 typedef Teuchos::ScalarTraits<magnitude_type> STM;
741 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
744 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
745 if (STM::isnaninf (norms[j])) {
750 TEUCHOS_TEST_FOR_EXCEPTION( ! good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the output Y is NaN or Inf.");
752 #endif // HAVE_IFPACK2_DEBUG 755 template<
class MatrixType>
758 applyNonAliased (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
759 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
760 Teuchos::ETransp mode,
762 scalar_type beta)
const 764 using Teuchos::ArrayView;
765 using Teuchos::ArrayRCP;
766 typedef Teuchos::ScalarTraits<scalar_type> STS;
768 const scalar_type zero = STS::zero ();
769 const scalar_type one = STS::one ();
774 else if (beta != one) {
778 const size_t NumVectors = Y.getNumVectors ();
779 const size_t numRows = localRowMap_->getNodeNumElements ();
786 const bool constantStride = X.isConstantStride () && Y.isConstantStride ();
787 if (constantStride) {
790 const size_t x_stride = X.getStride();
791 const size_t y_stride = Y.getStride();
792 ArrayRCP<scalar_type> y_rcp = Y.get1dViewNonConst();
793 ArrayRCP<const scalar_type> x_rcp = X.get1dView();
794 ArrayView<scalar_type> y_ptr = y_rcp();
795 ArrayView<const scalar_type> x_ptr = x_rcp();
796 for (
size_t i = 0; i < numRows; ++i) {
799 getLocalRowCopy (i, localIndices_ , Values_ , Nnz);
800 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
801 if (mode == Teuchos::NO_TRANS) {
802 for (
size_t j = 0; j < Nnz; ++j) {
803 const local_ordinal_type col = localIndices_[j];
804 for (
size_t k = 0; k < NumVectors; ++k) {
805 y_ptr[i + y_stride*k] +=
806 alpha * Values[j] * x_ptr[col + x_stride*k];
810 else if (mode == Teuchos::TRANS) {
811 for (
size_t j = 0; j < Nnz; ++j) {
812 const local_ordinal_type col = localIndices_[j];
813 for (
size_t k = 0; k < NumVectors; ++k) {
814 y_ptr[col + y_stride*k] +=
815 alpha * Values[j] * x_ptr[i + x_stride*k];
820 for (
size_t j = 0; j < Nnz; ++j) {
821 const local_ordinal_type col = localIndices_[j];
822 for (
size_t k = 0; k < NumVectors; ++k) {
823 y_ptr[col + y_stride*k] +=
824 alpha * STS::conjugate (Values[j]) * x_ptr[i + x_stride*k];
833 ArrayRCP<ArrayRCP<const scalar_type> > x_ptr = X.get2dView();
834 ArrayRCP<ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
836 for (
size_t i = 0; i < numRows; ++i) {
839 getLocalRowCopy (i, localIndices_ , Values_ , Nnz);
840 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
841 if (mode == Teuchos::NO_TRANS) {
842 for (
size_t k = 0; k < NumVectors; ++k) {
843 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
844 ArrayView<scalar_type> y_local = (y_ptr())[k]();
845 for (
size_t j = 0; j < Nnz; ++j) {
846 y_local[i] += alpha * Values[j] * x_local[localIndices_[j]];
850 else if (mode == Teuchos::TRANS) {
851 for (
size_t k = 0; k < NumVectors; ++k) {
852 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
853 ArrayView<scalar_type> y_local = (y_ptr())[k]();
854 for (
size_t j = 0; j < Nnz; ++j) {
855 y_local[localIndices_[j]] += alpha * Values[j] * x_local[i];
860 for (
size_t k = 0; k < NumVectors; ++k) {
861 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
862 ArrayView<scalar_type> y_local = (y_ptr())[k]();
863 for (
size_t j = 0; j < Nnz; ++j) {
864 y_local[localIndices_[j]] +=
865 alpha * STS::conjugate (Values[j]) * x_local[i];
873 template<
class MatrixType>
880 template<
class MatrixType>
887 template<
class MatrixType>
889 LocalFilter<MatrixType>::mag_type
892 #ifdef TPETRA_HAVE_KOKKOS_REFACTOR 893 typedef Kokkos::Details::ArithTraits<scalar_type> STS;
894 typedef Kokkos::Details::ArithTraits<mag_type> STM;
896 typedef Teuchos::ScalarTraits<scalar_type> STS;
897 typedef Teuchos::ScalarTraits<magnitude_type> STM;
899 typedef typename Teuchos::Array<scalar_type>::size_type size_type;
901 const size_type maxNumRowEnt = getNodeMaxNumRowEntries ();
902 nonconst_local_inds_host_view_type ind (
"ind",maxNumRowEnt);
903 nonconst_values_host_view_type val (
"val",maxNumRowEnt);
904 const size_t numRows =
static_cast<size_t> (localRowMap_->getNodeNumElements ());
907 mag_type sumSquared = STM::zero ();
908 for (
size_t i = 0; i < numRows; ++i) {
909 size_t numEntries = 0;
910 this->getLocalRowCopy (i, ind, val, numEntries);
911 for (size_type k = 0; k < static_cast<size_type> (numEntries); ++k) {
912 const mag_type v_k_abs = STS::magnitude (val[k]);
913 sumSquared += v_k_abs * v_k_abs;
916 return STM::squareroot (sumSquared);
919 template<
class MatrixType>
923 using Teuchos::TypeNameTraits;
924 std::ostringstream os;
926 os <<
"Ifpack2::LocalFilter: {";
927 os <<
"MatrixType: " << TypeNameTraits<MatrixType>::name ();
928 if (this->getObjectLabel () !=
"") {
929 os <<
", Label: \"" << this->getObjectLabel () <<
"\"";
931 os <<
", Number of rows: " << getGlobalNumRows ()
932 <<
", Number of columns: " << getGlobalNumCols ()
938 template<
class MatrixType>
942 const Teuchos::EVerbosityLevel verbLevel)
const 944 using Teuchos::OSTab;
945 using Teuchos::TypeNameTraits;
948 const Teuchos::EVerbosityLevel vl =
949 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
951 if (vl > Teuchos::VERB_NONE) {
955 out <<
"Ifpack2::LocalFilter:" << endl;
957 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name () << endl;
958 if (this->getObjectLabel () !=
"") {
959 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
961 out <<
"Number of rows: " << getGlobalNumRows () << endl
962 <<
"Number of columns: " << getGlobalNumCols () << endl
963 <<
"Number of nonzeros: " << NumNonzeros_ << endl;
965 if (vl > Teuchos::VERB_LOW) {
966 out <<
"Row Map:" << endl;
967 localRowMap_->describe (out, vl);
968 out <<
"Domain Map:" << endl;
969 localDomainMap_->describe (out, vl);
970 out <<
"Range Map:" << endl;
971 localRangeMap_->describe (out, vl);
976 template<
class MatrixType>
977 Teuchos::RCP<
const Tpetra::RowMatrix<
typename MatrixType::scalar_type,
978 typename MatrixType::local_ordinal_type,
979 typename MatrixType::global_ordinal_type,
980 typename MatrixType::node_type> >
989 #define IFPACK2_LOCALFILTER_INSTANT(S,LO,GO,N) \ 990 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:431
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition: Ifpack2_LocalFilter_def.hpp:422
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:687
virtual mag_type getFrobeniusNorm() const
The Frobenius norm of the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:890
virtual Teuchos::RCP< const row_matrix_type > getUnderlyingMatrix() const
Return matrix that LocalFilter was built on.
Definition: Ifpack2_LocalFilter_def.hpp:981
virtual global_size_t getGlobalNumCols() const
The number of global columns in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:302
virtual bool isLocallyIndexed() const
Whether the underlying sparse matrix is locally (opposite of globally) indexed.
Definition: Ifpack2_LocalFilter_def.hpp:408
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:941
virtual size_t getNodeNumCols() const
The number of columns in the (locally filtered) matrix.
Definition: Ifpack2_LocalFilter_def.hpp:316
virtual global_size_t getGlobalNumRows() const
The number of global rows in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:295
virtual Teuchos::RCP< const map_type > getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:275
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:881
virtual Teuchos::RCP< const map_type > getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:255
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:677
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:285
virtual size_t getNodeNumRows() const
The number of rows owned on the calling process.
Definition: Ifpack2_LocalFilter_def.hpp:309
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:490
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:697
virtual global_ordinal_type getIndexBase() const
Returns the index base for global indices for this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:324
virtual bool hasColMap() const
Whether this matrix has a well-defined column Map.
Definition: Ifpack2_LocalFilter_def.hpp:401
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on all processes.
Definition: Ifpack2_LocalFilter_def.hpp:387
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the communicator.
Definition: Ifpack2_LocalFilter_def.hpp:233
virtual std::string description() const
A one-line description of this object.
Definition: Ifpack2_LocalFilter_def.hpp:921
virtual size_t getNodeMaxNumRowEntries() const
The maximum number of entries across all rows/columns on this process.
Definition: Ifpack2_LocalFilter_def.hpp:394
LocalFilter(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition: Ifpack2_LocalFilter_def.hpp:88
virtual ~LocalFilter()
Destructor.
Definition: Ifpack2_LocalFilter_def.hpp:227
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:331
virtual Teuchos::RCP< const map_type > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:245
virtual size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
Definition: Ifpack2_LocalFilter_def.hpp:338
virtual bool isGloballyIndexed() const
Whether the underlying sparse matrix is globally (opposite of locally) indexed.
Definition: Ifpack2_LocalFilter_def.hpp:415
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:662
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:265
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:347
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:73
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:636
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
Definition: Ifpack2_LocalFilter_def.hpp:874
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:612
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:366