10#ifndef IFPACK2_LOCALFILTER_DEF_HPP
11#define IFPACK2_LOCALFILTER_DEF_HPP
13#include <Ifpack2_LocalFilter_decl.hpp>
14#include <Tpetra_Map.hpp>
15#include <Tpetra_MultiVector.hpp>
16#include <Tpetra_Vector.hpp>
19# include "Teuchos_DefaultMpiComm.hpp"
21# include "Teuchos_DefaultSerialComm.hpp"
27template<
class MatrixType>
33 const auto rowMap = A.getRowMap();
34 const bool rangeAndRowFitted = mapPairIsFitted (*rowMap, *rangeMap);
36 const auto domainMap = A.getDomainMap();
37 const auto columnMap = A.getColMap();
38 const bool domainAndColumnFitted = mapPairIsFitted (*columnMap, *domainMap);
45 int localSuccess = rangeAndRowFitted && domainAndColumnFitted;
48 Teuchos::reduceAll<int, int> (*(A.getComm()), Teuchos::REDUCE_MIN, localSuccess, Teuchos::outArg (globalSuccess));
50 return globalSuccess == 1;
54template<
class MatrixType>
59 return map1.isLocallyFitted (map2);
63template<
class MatrixType>
65LocalFilter (
const Teuchos::RCP<const row_matrix_type>& A) :
74#ifdef HAVE_IFPACK2_DEBUG
75 if(! mapPairsAreFitted (*A))
77 std::cout <<
"WARNING: Ifpack2::LocalFilter:\n" <<
78 "A's Map pairs are not fitted to each other on Process "
79 << A_->getRowMap ()->getComm ()->getRank () <<
" of the input matrix's "
81 "This means that LocalFilter may not work with A. "
82 "Please see discussion of Bug 5992.";
87 RCP<const Teuchos::Comm<int> > localComm;
89 localComm = rcp (
new Teuchos::MpiComm<int> (MPI_COMM_SELF));
91 localComm = rcp (
new Teuchos::SerialComm<int> ());
118 const size_t numRows = A_->getRangeMap()->getLocalNumElements () / blockSize;
123 rcp (
new map_type (numRows, indexBase, localComm,
124 Tpetra::GloballyDistributed));
127 localRangeMap_ = localRowMap_;
131 if (A_->getRangeMap ().getRawPtr () == A_->getDomainMap ().getRawPtr ()) {
134 localDomainMap_ = localRangeMap_;
137 const size_t numCols = A_->getDomainMap()->getLocalNumElements () / blockSize;
139 rcp (
new map_type (numCols, indexBase, localComm,
140 Tpetra::GloballyDistributed));
146 NumEntries_.resize (numRows);
150 MaxNumEntries_ = A_->getLocalMaxNumRowEntries ();
151 MaxNumEntriesA_ = A_->getLocalMaxNumRowEntries ();
154 Kokkos::resize(localIndices_,MaxNumEntries_);
155 Kokkos::resize(localIndicesForGlobalCopy_,MaxNumEntries_);
156 Kokkos::resize(Values_,MaxNumEntries_*blockSize*blockSize);
165 size_t ActualMaxNumEntries = 0;
167 for (
size_t i = 0; i < numRows; ++i) {
169 size_t Nnz, NewNnz = 0;
170 A_->getLocalRowCopy (i, localIndices_, Values_, Nnz);
171 for (
size_t j = 0; j < Nnz; ++j) {
183 if (
static_cast<size_t> (localIndices_[j]) < numRows) {
188 if (NewNnz > ActualMaxNumEntries) {
189 ActualMaxNumEntries = NewNnz;
192 NumNonzeros_ += NewNnz;
193 NumEntries_[i] = NewNnz;
196 MaxNumEntries_ = ActualMaxNumEntries;
200template<
class MatrixType>
205template<
class MatrixType>
206Teuchos::RCP<const Teuchos::Comm<int> >
209 return localRowMap_->getComm ();
215template<
class MatrixType>
216Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
217 typename MatrixType::global_ordinal_type,
218 typename MatrixType::node_type> >
225template<
class MatrixType>
226Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
227 typename MatrixType::global_ordinal_type,
228 typename MatrixType::node_type> >
235template<
class MatrixType>
236Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
237 typename MatrixType::global_ordinal_type,
238 typename MatrixType::node_type> >
241 return localDomainMap_;
245template<
class MatrixType>
246Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
247 typename MatrixType::global_ordinal_type,
248 typename MatrixType::node_type> >
251 return localRangeMap_;
255template<
class MatrixType>
256Teuchos::RCP<
const Tpetra::RowGraph<
typename MatrixType::local_ordinal_type,
257 typename MatrixType::global_ordinal_type,
258 typename MatrixType::node_type> >
261 if (local_graph_ == Teuchos::null) {
263 Teuchos::Array<size_t> entriesPerRow(numRows);
267 Teuchos::RCP<crs_graph_type> local_graph_nc =
268 Teuchos::rcp (
new crs_graph_type (this->
getRowMap (),
275 size_t numEntries = 0;
277 local_graph_nc->insertLocalIndices (i, numEntries, indices.data());
280 local_graph_ = Teuchos::rcp_const_cast<const crs_graph_type> (local_graph_nc);
286template<
class MatrixType>
289 return static_cast<global_size_t
> (localRangeMap_->getLocalNumElements ());
293template<
class MatrixType>
296 return static_cast<global_size_t
> (localDomainMap_->getLocalNumElements ());
300template<
class MatrixType>
303 return static_cast<size_t> (localRangeMap_->getLocalNumElements ());
307template<
class MatrixType>
310 return static_cast<size_t> (localDomainMap_->getLocalNumElements ());
314template<
class MatrixType>
315typename MatrixType::global_ordinal_type
318 return A_->getIndexBase ();
322template<
class MatrixType>
329template<
class MatrixType>
335template<
class MatrixType>
338 return A_->getBlockSize();
341template<
class MatrixType>
347 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
355 return NumEntries_[localRow];
360template<
class MatrixType>
370 if (
getRowMap ()->isNodeLocalElement (localRow)) {
371 return NumEntries_[localRow];
383template<
class MatrixType>
386 return MaxNumEntries_;
390template<
class MatrixType>
393 return MaxNumEntries_;
397template<
class MatrixType>
404template<
class MatrixType>
407 return A_->isLocallyIndexed ();
411template<
class MatrixType>
414 return A_->isGloballyIndexed();
418template<
class MatrixType>
421 return A_->isFillComplete ();
425template<
class MatrixType>
429 nonconst_global_inds_host_view_type &globalIndices,
430 nonconst_values_host_view_type &values,
431 size_t& numEntries)
const
434 typedef typename Teuchos::Array<LO>::size_type size_type;
436 const LO localRow = this->
getRowMap ()->getLocalElement (globalRow);
437 if (localRow == Teuchos::OrdinalTraits<LO>::invalid ()) {
455 this->
getLocalRowCopy (localRow, localIndicesForGlobalCopy_, values, numEntries);
460 const size_type numEnt =
461 std::min (
static_cast<size_type
> (numEntries),
462 std::min ((size_type)globalIndices.size (), (size_type)values.size ()));
463 for (size_type k = 0; k < numEnt; ++k) {
464 globalIndices[k] = colMap.getGlobalElement (localIndicesForGlobalCopy_[k]);
470template<
class MatrixType>
474 nonconst_local_inds_host_view_type &Indices,
475 nonconst_values_host_view_type &Values,
476 size_t& NumEntries)
const
481 if (! A_->getRowMap ()->isNodeLocalElement (LocalRow)) {
487 if (A_->getRowMap()->getComm()->getSize() == 1) {
488 A_->getLocalRowCopy (LocalRow, Indices, Values, NumEntries);
494 const size_t numEntInLclRow = NumEntries_[LocalRow];
495 if (
static_cast<size_t> (Indices.size ()) < numEntInLclRow ||
496 static_cast<size_t> (Values.size ()) < numEntInLclRow*blockNumEntr) {
500 TEUCHOS_TEST_FOR_EXCEPTION(
501 true, std::runtime_error,
502 "Ifpack2::LocalFilter::getLocalRowCopy: Invalid output array length. "
503 "The output arrays must each have length at least " << numEntInLclRow
504 <<
" for local row " << LocalRow <<
" on Process "
505 << localRowMap_->getComm ()->getRank () <<
".");
507 else if (numEntInLclRow ==
static_cast<size_t> (0)) {
526 size_t numEntInMat = 0;
527 A_->getLocalRowCopy (LocalRow, localIndices_, Values_ , numEntInMat);
532 const map_type& matrixDomMap = * (A_->getDomainMap ());
533 const map_type& matrixColMap = * (A_->getColMap ());
535 const size_t capacity =
static_cast<size_t> (std::min (Indices.size (),
536 Values.size ()/blockNumEntr));
538 const size_t numRows = localRowMap_->getLocalNumElements ();
539 const bool buggy =
true;
540 for (
size_t j = 0; j < numEntInMat; ++j) {
546 const LO matrixLclCol = localIndices_[j];
547 const GO gblCol = matrixColMap.getGlobalElement (matrixLclCol);
556 if ((
size_t) localIndices_[j] < numRows) {
557 Indices[NumEntries] = localIndices_[j];
558 for (LO k=0;k<blockNumEntr;++k)
559 Values[NumEntries*blockNumEntr + k] = Values_[j*blockNumEntr + k];
563 if (matrixDomMap.isNodeGlobalElement (gblCol)) {
567 if (NumEntries < capacity) {
568 Indices[NumEntries] = matrixLclCol;
569 for (LO k=0;k<blockNumEntr;++k)
570 Values[NumEntries*blockNumEntr + k] = Values_[j*blockNumEntr + k];
579template<
class MatrixType>
583 global_inds_host_view_type &,
584 values_host_view_type &)
const
586 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
587 "Ifpack2::LocalFilter does not implement getGlobalRowView.");
591template<
class MatrixType>
595 local_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 getLocalRowView.");
603template<
class MatrixType>
606getLocalDiagCopy (Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& diag)
const
613 RCP<vector_type> diagView = diag.offsetViewNonConst (A_->getRowMap (), 0);
614 A_->getLocalDiagCopy (*diagView);
618template<
class MatrixType>
621leftScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
623 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
624 "Ifpack2::LocalFilter does not implement leftScale.");
628template<
class MatrixType>
631rightScale (
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& )
633 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
634 "Ifpack2::LocalFilter does not implement rightScale.");
638template<
class MatrixType>
641apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
642 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
643 Teuchos::ETransp mode,
647 typedef Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> MV;
648 TEUCHOS_TEST_FOR_EXCEPTION(
649 X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
650 "Ifpack2::LocalFilter::apply: X and Y must have the same number of columns. "
651 "X has " << X.getNumVectors () <<
" columns, but Y has "
652 << Y.getNumVectors () <<
" columns.");
654#ifdef HAVE_IFPACK2_DEBUG
656 typedef Teuchos::ScalarTraits<magnitude_type> STM;
657 Teuchos::Array<magnitude_type> norms (X.getNumVectors ());
660 for (
size_t j = 0; j < X.getNumVectors (); ++j) {
661 if (STM::isnaninf (norms[j])) {
666 TEUCHOS_TEST_FOR_EXCEPTION( ! good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the input X is NaN or Inf.");
670 TEUCHOS_TEST_FOR_EXCEPTION(
672 "Ifpack2::LocalFilter::apply: Block size greater than zero is not yet supported for "
673 "LocalFilter::apply. Please contact an Ifpack2 developer to request this feature.");
681 MV X_copy (X, Teuchos::Copy);
682 applyNonAliased (X_copy, Y, mode, alpha, beta);
684 applyNonAliased (X, Y, mode, alpha, beta);
687#ifdef HAVE_IFPACK2_DEBUG
689 typedef Teuchos::ScalarTraits<magnitude_type> STM;
690 Teuchos::Array<magnitude_type> norms (Y.getNumVectors ());
693 for (
size_t j = 0; j < Y.getNumVectors (); ++j) {
694 if (STM::isnaninf (norms[j])) {
699 TEUCHOS_TEST_FOR_EXCEPTION( ! good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the output Y is NaN or Inf.");
704template<
class MatrixType>
707applyNonAliased (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
708 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
709 Teuchos::ETransp mode,
711 scalar_type beta)
const
713 using Teuchos::ArrayView;
714 using Teuchos::ArrayRCP;
715 typedef Teuchos::ScalarTraits<scalar_type> STS;
717 const scalar_type zero = STS::zero ();
718 const scalar_type one = STS::one ();
723 else if (beta != one) {
727 const size_t NumVectors = Y.getNumVectors ();
728 const size_t numRows = localRowMap_->getLocalNumElements ();
735 const bool constantStride = X.isConstantStride () && Y.isConstantStride ();
736 if (constantStride) {
739 const size_t x_stride = X.getStride();
740 const size_t y_stride = Y.getStride();
741 ArrayRCP<scalar_type> y_rcp = Y.get1dViewNonConst();
742 ArrayRCP<const scalar_type> x_rcp = X.get1dView();
743 ArrayView<scalar_type> y_ptr = y_rcp();
744 ArrayView<const scalar_type> x_ptr = x_rcp();
745 for (
size_t i = 0; i < numRows; ++i) {
748 getLocalRowCopy (i, localIndices_ , Values_ , Nnz);
749 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
750 if (mode == Teuchos::NO_TRANS) {
751 for (
size_t j = 0; j < Nnz; ++j) {
753 for (
size_t k = 0; k < NumVectors; ++k) {
754 y_ptr[i + y_stride*k] +=
755 alpha * Values[j] * x_ptr[col + x_stride*k];
759 else if (mode == Teuchos::TRANS) {
760 for (
size_t j = 0; j < Nnz; ++j) {
762 for (
size_t k = 0; k < NumVectors; ++k) {
763 y_ptr[col + y_stride*k] +=
764 alpha * Values[j] * x_ptr[i + x_stride*k];
769 for (
size_t j = 0; j < Nnz; ++j) {
771 for (
size_t k = 0; k < NumVectors; ++k) {
772 y_ptr[col + y_stride*k] +=
773 alpha * STS::conjugate (Values[j]) * x_ptr[i + x_stride*k];
782 ArrayRCP<ArrayRCP<const scalar_type> > x_ptr = X.get2dView();
783 ArrayRCP<ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
785 for (
size_t i = 0; i < numRows; ++i) {
788 getLocalRowCopy (i, localIndices_ , Values_ , Nnz);
789 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
790 if (mode == Teuchos::NO_TRANS) {
791 for (
size_t k = 0; k < NumVectors; ++k) {
792 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
793 ArrayView<scalar_type> y_local = (y_ptr())[k]();
794 for (
size_t j = 0; j < Nnz; ++j) {
795 y_local[i] += alpha * Values[j] * x_local[localIndices_[j]];
799 else if (mode == Teuchos::TRANS) {
800 for (
size_t k = 0; k < NumVectors; ++k) {
801 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
802 ArrayView<scalar_type> y_local = (y_ptr())[k]();
803 for (
size_t j = 0; j < Nnz; ++j) {
804 y_local[localIndices_[j]] += alpha * Values[j] * x_local[i];
809 for (
size_t k = 0; k < NumVectors; ++k) {
810 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
811 ArrayView<scalar_type> y_local = (y_ptr())[k]();
812 for (
size_t j = 0; j < Nnz; ++j) {
813 y_local[localIndices_[j]] +=
814 alpha * STS::conjugate (Values[j]) * x_local[i];
822template<
class MatrixType>
829template<
class MatrixType>
836template<
class MatrixType>
838LocalFilter<MatrixType>::mag_type
841 typedef Kokkos::ArithTraits<scalar_type> STS;
842 typedef Kokkos::ArithTraits<mag_type> STM;
843 typedef typename Teuchos::Array<scalar_type>::size_type size_type;
847 nonconst_local_inds_host_view_type ind (
"ind",maxNumRowEnt);
848 nonconst_values_host_view_type val (
"val",maxNumRowEnt*blockNumEntr);
849 const size_t numRows =
static_cast<size_t> (localRowMap_->getLocalNumElements ());
852 mag_type sumSquared = STM::zero ();
853 for (
size_t i = 0; i < numRows; ++i) {
854 size_t numEntries = 0;
856 for (size_type k = 0; k < static_cast<size_type> (numEntries*blockNumEntr); ++k) {
857 const mag_type v_k_abs = STS::magnitude (val[k]);
858 sumSquared += v_k_abs * v_k_abs;
861 return STM::squareroot (sumSquared);
864template<
class MatrixType>
868 using Teuchos::TypeNameTraits;
869 std::ostringstream os;
871 os <<
"Ifpack2::LocalFilter: {";
872 os <<
"MatrixType: " << TypeNameTraits<MatrixType>::name ();
873 if (this->getObjectLabel () !=
"") {
874 os <<
", Label: \"" << this->getObjectLabel () <<
"\"";
883template<
class MatrixType>
886describe (Teuchos::FancyOStream &out,
887 const Teuchos::EVerbosityLevel verbLevel)
const
889 using Teuchos::OSTab;
890 using Teuchos::TypeNameTraits;
893 const Teuchos::EVerbosityLevel vl =
894 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
896 if (vl > Teuchos::VERB_NONE) {
900 out <<
"Ifpack2::LocalFilter:" << endl;
902 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name () << endl;
903 if (this->getObjectLabel () !=
"") {
904 out <<
"Label: \"" << this->getObjectLabel () <<
"\"" << endl;
908 <<
"Number of nonzeros: " << NumNonzeros_ << endl;
910 if (vl > Teuchos::VERB_LOW) {
911 out <<
"Row Map:" << endl;
912 localRowMap_->describe (out, vl);
913 out <<
"Domain Map:" << endl;
914 localDomainMap_->describe (out, vl);
915 out <<
"Range Map:" << endl;
916 localRangeMap_->describe (out, vl);
921template<
class MatrixType>
922Teuchos::RCP<
const Tpetra::RowMatrix<
typename MatrixType::scalar_type,
923 typename MatrixType::local_ordinal_type,
924 typename MatrixType::global_ordinal_type,
925 typename MatrixType::node_type> >
934#define IFPACK2_LOCALFILTER_INSTANT(S,LO,GO,N) \
935 template class Ifpack2::LocalFilter< Tpetra::RowMatrix<S, LO, GO, N> >;
Access only local rows and columns of a sparse matrix.
Definition Ifpack2_LocalFilter_decl.hpp:131
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:886
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:259
virtual Teuchos::RCP< const map_type > getDomainMap() const
Returns the Map that describes the domain distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:239
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on all processes.
Definition Ifpack2_LocalFilter_def.hpp:384
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:621
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:428
virtual bool isGloballyIndexed() const
Whether the underlying sparse matrix is globally (opposite of locally) indexed.
Definition Ifpack2_LocalFilter_def.hpp:412
virtual Teuchos::RCP< const row_matrix_type > getUnderlyingMatrix() const
Return matrix that LocalFilter was built on.
Definition Ifpack2_LocalFilter_def.hpp:926
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:149
virtual Teuchos::RCP< const map_type > getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:249
virtual mag_type getFrobeniusNorm() const
The Frobenius norm of the (locally filtered) matrix.
Definition Ifpack2_LocalFilter_def.hpp:839
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:344
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:158
virtual global_size_t getGlobalNumCols() const
The number of global columns in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:294
virtual bool hasColMap() const
Whether this matrix has a well-defined column Map.
Definition Ifpack2_LocalFilter_def.hpp:398
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:582
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:155
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition Ifpack2_LocalFilter_def.hpp:419
virtual bool isLocallyIndexed() const
Whether the underlying sparse matrix is locally (opposite of globally) indexed.
Definition Ifpack2_LocalFilter_def.hpp:405
virtual size_t getLocalNumCols() const
The number of columns in the (locally filtered) matrix.
Definition Ifpack2_LocalFilter_def.hpp:308
virtual Teuchos::RCP< const map_type > getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:229
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
Definition Ifpack2_LocalFilter_def.hpp:823
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:606
virtual size_t getLocalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on this process.
Definition Ifpack2_LocalFilter_def.hpp:391
LocalFilter(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition Ifpack2_LocalFilter_def.hpp:65
virtual global_ordinal_type getIndexBase() const
Returns the index base for global indices for this matrix.
Definition Ifpack2_LocalFilter_def.hpp:316
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition Ifpack2_LocalFilter_def.hpp:830
virtual std::string description() const
A one-line description of this object.
Definition Ifpack2_LocalFilter_def.hpp:866
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:323
virtual local_ordinal_type getBlockSize() const
The number of degrees of freedom per mesh point.
Definition Ifpack2_LocalFilter_def.hpp:336
virtual ~LocalFilter()
Destructor.
Definition Ifpack2_LocalFilter_def.hpp:201
virtual size_t getLocalNumRows() const
The number of rows owned on the calling process.
Definition Ifpack2_LocalFilter_def.hpp:301
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:641
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:152
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:631
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:473
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:363
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:594
virtual global_size_t getGlobalNumRows() const
The number of global rows 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:189
virtual size_t getLocalNumEntries() const
Returns the local number of entries in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:330
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the communicator.
Definition Ifpack2_LocalFilter_def.hpp:207
virtual Teuchos::RCP< const map_type > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:219
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:41