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"
26template <
class MatrixType>
27bool LocalFilter<MatrixType>::
28 mapPairsAreFitted(
const row_matrix_type& A) {
29 const auto rangeMap = A.getRangeMap();
30 const auto rowMap = A.getRowMap();
31 const bool rangeAndRowFitted = mapPairIsFitted(*rowMap, *rangeMap);
33 const auto domainMap = A.getDomainMap();
34 const auto columnMap = A.getColMap();
35 const bool domainAndColumnFitted = mapPairIsFitted(*columnMap, *domainMap);
42 int localSuccess = rangeAndRowFitted && domainAndColumnFitted;
45 Teuchos::reduceAll<int, int>(*(A.getComm()), Teuchos::REDUCE_MIN, localSuccess, Teuchos::outArg(globalSuccess));
47 return globalSuccess == 1;
50template <
class MatrixType>
51bool LocalFilter<MatrixType>::
52 mapPairIsFitted(
const map_type& map1,
const map_type& map2) {
53 return map1.isLocallyFitted(map2);
56template <
class MatrixType>
58 LocalFilter(
const Teuchos::RCP<const row_matrix_type>& A)
62 , MaxNumEntriesA_(0) {
66#ifdef HAVE_IFPACK2_DEBUG
67 if (!mapPairsAreFitted(*A)) {
68 std::cout <<
"WARNING: Ifpack2::LocalFilter:\n"
69 <<
"A's Map pairs are not fitted to each other on Process "
70 << A_->getRowMap()->getComm()->getRank() <<
" of the input matrix's "
72 "This means that LocalFilter may not work with A. "
73 "Please see discussion of Bug 5992.";
78 RCP<const Teuchos::Comm<int> > localComm;
80 localComm = rcp(
new Teuchos::MpiComm<int>(MPI_COMM_SELF));
82 localComm = rcp(
new Teuchos::SerialComm<int>());
108 const size_t numRows = A_->getRangeMap()->getLocalNumElements() / blockSize;
113 rcp(
new map_type(numRows, indexBase, localComm,
114 Tpetra::GloballyDistributed));
117 localRangeMap_ = localRowMap_;
121 if (A_->getRangeMap().getRawPtr() == A_->getDomainMap().getRawPtr()) {
124 localDomainMap_ = localRangeMap_;
126 const size_t numCols = A_->getDomainMap()->getLocalNumElements() / blockSize;
128 rcp(
new map_type(numCols, indexBase, localComm,
129 Tpetra::GloballyDistributed));
135 NumEntries_.resize(numRows);
139 MaxNumEntries_ = A_->getLocalMaxNumRowEntries();
140 MaxNumEntriesA_ = A_->getLocalMaxNumRowEntries();
143 Kokkos::resize(localIndices_, MaxNumEntries_);
144 Kokkos::resize(localIndicesForGlobalCopy_, MaxNumEntries_);
145 Kokkos::resize(Values_, MaxNumEntries_ * blockSize * blockSize);
154 size_t ActualMaxNumEntries = 0;
156 for (
size_t i = 0; i < numRows; ++i) {
158 size_t Nnz, NewNnz = 0;
159 A_->getLocalRowCopy(i, localIndices_, Values_, Nnz);
160 for (
size_t j = 0; j < Nnz; ++j) {
172 if (
static_cast<size_t>(localIndices_[j]) < numRows) {
177 if (NewNnz > ActualMaxNumEntries) {
178 ActualMaxNumEntries = NewNnz;
181 NumNonzeros_ += NewNnz;
182 NumEntries_[i] = NewNnz;
185 MaxNumEntries_ = ActualMaxNumEntries;
188template <
class MatrixType>
191template <
class MatrixType>
192Teuchos::RCP<const Teuchos::Comm<int> >
194 return localRowMap_->getComm();
197template <
class MatrixType>
198Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
199 typename MatrixType::global_ordinal_type,
200 typename MatrixType::node_type> >
205template <
class MatrixType>
206Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
207 typename MatrixType::global_ordinal_type,
208 typename MatrixType::node_type> >
213template <
class MatrixType>
214Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
215 typename MatrixType::global_ordinal_type,
216 typename MatrixType::node_type> >
218 return localDomainMap_;
221template <
class MatrixType>
222Teuchos::RCP<
const Tpetra::Map<
typename MatrixType::local_ordinal_type,
223 typename MatrixType::global_ordinal_type,
224 typename MatrixType::node_type> >
226 return localRangeMap_;
229template <
class MatrixType>
230Teuchos::RCP<
const Tpetra::RowGraph<
typename MatrixType::local_ordinal_type,
231 typename MatrixType::global_ordinal_type,
232 typename MatrixType::node_type> >
234 if (local_graph_ == Teuchos::null) {
236 Teuchos::Array<size_t> entriesPerRow(numRows);
238 entriesPerRow[i] = this->getNumEntriesInLocalRow(i);
240 Teuchos::RCP<crs_graph_type> local_graph_nc =
241 Teuchos::rcp(
new crs_graph_type(this->getRowMap(),
245 nonconst_local_inds_host_view_type indices(
"indices", this->getLocalMaxNumRowEntries());
246 nonconst_values_host_view_type values(
"values", this->getLocalMaxNumRowEntries());
248 size_t numEntries = 0;
249 this->getLocalRowCopy(i, indices, values, numEntries);
250 local_graph_nc->insertLocalIndices(i, numEntries, indices.data());
252 local_graph_nc->fillComplete(this->getDomainMap(), this->getRangeMap());
253 local_graph_ = Teuchos::rcp_const_cast<const crs_graph_type>(local_graph_nc);
258template <
class MatrixType>
260 return static_cast<global_size_t
>(localRangeMap_->getLocalNumElements());
263template <
class MatrixType>
265 return static_cast<global_size_t
>(localDomainMap_->getLocalNumElements());
268template <
class MatrixType>
270 return static_cast<size_t>(localRangeMap_->getLocalNumElements());
273template <
class MatrixType>
275 return static_cast<size_t>(localDomainMap_->getLocalNumElements());
278template <
class MatrixType>
279typename MatrixType::global_ordinal_type
281 return A_->getIndexBase();
284template <
class MatrixType>
289template <
class MatrixType>
294template <
class MatrixType>
296 return A_->getBlockSize();
299template <
class MatrixType>
304 if (localRow == Teuchos::OrdinalTraits<local_ordinal_type>::invalid()) {
312 return NumEntries_[localRow];
316template <
class MatrixType>
325 if (getRowMap()->isNodeLocalElement(localRow)) {
326 return NumEntries_[localRow];
337template <
class MatrixType>
339 return MaxNumEntries_;
342template <
class MatrixType>
344 return MaxNumEntries_;
347template <
class MatrixType>
352template <
class MatrixType>
354 return A_->isLocallyIndexed();
357template <
class MatrixType>
359 return A_->isGloballyIndexed();
362template <
class MatrixType>
364 return A_->isFillComplete();
367template <
class MatrixType>
370 nonconst_global_inds_host_view_type& globalIndices,
371 nonconst_values_host_view_type& values,
372 size_t& numEntries)
const {
374 typedef typename Teuchos::Array<LO>::size_type size_type;
376 const LO localRow = this->getRowMap()->getLocalElement(globalRow);
377 if (localRow == Teuchos::OrdinalTraits<LO>::invalid()) {
388 numEntries = this->getNumEntriesInLocalRow(localRow);
394 this->getLocalRowCopy(localRow, localIndicesForGlobalCopy_, values, numEntries);
396 const map_type& colMap = *(this->getColMap());
399 const size_type numEnt =
400 std::min(
static_cast<size_type
>(numEntries),
401 std::min((size_type)globalIndices.size(), (size_type)values.size()));
402 for (size_type k = 0; k < numEnt; ++k) {
403 globalIndices[k] = colMap.getGlobalElement(localIndicesForGlobalCopy_[k]);
408template <
class MatrixType>
411 nonconst_local_inds_host_view_type& Indices,
412 nonconst_values_host_view_type& Values,
413 size_t& NumEntries)
const {
417 if (!A_->getRowMap()->isNodeLocalElement(LocalRow)) {
423 if (A_->getRowMap()->getComm()->getSize() == 1) {
424 A_->getLocalRowCopy(LocalRow, Indices, Values, NumEntries);
428 const LO blockNumEntr = getBlockSize() * getBlockSize();
430 const size_t numEntInLclRow = NumEntries_[LocalRow];
431 if (
static_cast<size_t>(Indices.size()) < numEntInLclRow ||
432 static_cast<size_t>(Values.size()) < numEntInLclRow * blockNumEntr) {
436 TEUCHOS_TEST_FOR_EXCEPTION(
437 true, std::runtime_error,
438 "Ifpack2::LocalFilter::getLocalRowCopy: Invalid output array length. "
439 "The output arrays must each have length at least "
441 <<
" for local row " << LocalRow <<
" on Process "
442 << localRowMap_->getComm()->getRank() <<
".");
443 }
else if (numEntInLclRow ==
static_cast<size_t>(0)) {
462 size_t numEntInMat = 0;
463 A_->getLocalRowCopy(LocalRow, localIndices_, Values_, numEntInMat);
468 const map_type& matrixDomMap = *(A_->getDomainMap());
469 const map_type& matrixColMap = *(A_->getColMap());
471 const size_t capacity =
static_cast<size_t>(std::min(Indices.size(),
472 Values.size() / blockNumEntr));
474 const size_t numRows = localRowMap_->getLocalNumElements();
475 const bool buggy =
true;
476 for (
size_t j = 0; j < numEntInMat; ++j) {
482 const LO matrixLclCol = localIndices_[j];
483 const GO gblCol = matrixColMap.getGlobalElement(matrixLclCol);
492 if ((
size_t)localIndices_[j] < numRows) {
493 Indices[NumEntries] = localIndices_[j];
494 for (LO k = 0; k < blockNumEntr; ++k)
495 Values[NumEntries * blockNumEntr + k] = Values_[j * blockNumEntr + k];
499 if (matrixDomMap.isNodeGlobalElement(gblCol)) {
503 if (NumEntries < capacity) {
504 Indices[NumEntries] = matrixLclCol;
505 for (LO k = 0; k < blockNumEntr; ++k)
506 Values[NumEntries * blockNumEntr + k] = Values_[j * blockNumEntr + k];
514template <
class MatrixType>
517 global_inds_host_view_type& ,
518 values_host_view_type& )
const {
519 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
520 "Ifpack2::LocalFilter does not implement getGlobalRowView.");
523template <
class MatrixType>
526 local_inds_host_view_type& ,
527 values_host_view_type& )
const {
528 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::runtime_error,
529 "Ifpack2::LocalFilter does not implement getLocalRowView.");
532template <
class MatrixType>
534 getLocalDiagCopy(Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& diag)
const {
541 RCP<vector_type> diagView = diag.offsetViewNonConst(A_->getRowMap(), 0);
542 A_->getLocalDiagCopy(*diagView);
545template <
class MatrixType>
547 leftScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& ) {
548 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
549 "Ifpack2::LocalFilter does not implement leftScale.");
552template <
class MatrixType>
554 rightScale(
const Tpetra::Vector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& ) {
555 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
556 "Ifpack2::LocalFilter does not implement rightScale.");
559template <
class MatrixType>
561 apply(
const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
562 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
563 Teuchos::ETransp mode,
566 typedef Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type> MV;
567 TEUCHOS_TEST_FOR_EXCEPTION(
568 X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
569 "Ifpack2::LocalFilter::apply: X and Y must have the same number of columns. "
571 << X.getNumVectors() <<
" columns, but Y has "
572 << Y.getNumVectors() <<
" columns.");
574#ifdef HAVE_IFPACK2_DEBUG
576 typedef Teuchos::ScalarTraits<magnitude_type> STM;
577 Teuchos::Array<magnitude_type> norms(X.getNumVectors());
580 for (
size_t j = 0; j < X.getNumVectors(); ++j) {
581 if (STM::isnaninf(norms[j])) {
586 TEUCHOS_TEST_FOR_EXCEPTION(!good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the input X is NaN or Inf.");
590 TEUCHOS_TEST_FOR_EXCEPTION(
591 getBlockSize() > 1, std::runtime_error,
592 "Ifpack2::LocalFilter::apply: Block size greater than zero is not yet supported for "
593 "LocalFilter::apply. Please contact an Ifpack2 developer to request this feature.");
601 MV X_copy(X, Teuchos::Copy);
602 applyNonAliased(X_copy, Y, mode, alpha, beta);
604 applyNonAliased(X, Y, mode, alpha, beta);
607#ifdef HAVE_IFPACK2_DEBUG
609 typedef Teuchos::ScalarTraits<magnitude_type> STM;
610 Teuchos::Array<magnitude_type> norms(Y.getNumVectors());
613 for (
size_t j = 0; j < Y.getNumVectors(); ++j) {
614 if (STM::isnaninf(norms[j])) {
619 TEUCHOS_TEST_FOR_EXCEPTION(!good, std::runtime_error,
"Ifpack2::LocalFilter::apply: The 1-norm of the output Y is NaN or Inf.");
624template <
class MatrixType>
626 applyNonAliased(
const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
627 Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
628 Teuchos::ETransp mode,
630 scalar_type beta)
const {
631 using Teuchos::ArrayRCP;
632 using Teuchos::ArrayView;
633 typedef Teuchos::ScalarTraits<scalar_type> STS;
635 const scalar_type zero = STS::zero();
636 const scalar_type one = STS::one();
640 }
else if (beta != one) {
644 const size_t NumVectors = Y.getNumVectors();
645 const size_t numRows = localRowMap_->getLocalNumElements();
652 const bool constantStride = X.isConstantStride() && Y.isConstantStride();
653 if (constantStride) {
656 const size_t x_stride = X.getStride();
657 const size_t y_stride = Y.getStride();
658 ArrayRCP<scalar_type> y_rcp = Y.get1dViewNonConst();
659 ArrayRCP<const scalar_type> x_rcp = X.get1dView();
660 ArrayView<scalar_type> y_ptr = y_rcp();
661 ArrayView<const scalar_type> x_ptr = x_rcp();
662 for (
size_t i = 0; i < numRows; ++i) {
665 getLocalRowCopy(i, localIndices_, Values_, Nnz);
666 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
667 if (mode == Teuchos::NO_TRANS) {
668 for (
size_t j = 0; j < Nnz; ++j) {
669 const local_ordinal_type col = localIndices_[j];
670 for (
size_t k = 0; k < NumVectors; ++k) {
671 y_ptr[i + y_stride * k] +=
672 alpha * Values[j] * x_ptr[col + x_stride * k];
675 }
else if (mode == Teuchos::TRANS) {
676 for (
size_t j = 0; j < Nnz; ++j) {
677 const local_ordinal_type col = localIndices_[j];
678 for (
size_t k = 0; k < NumVectors; ++k) {
679 y_ptr[col + y_stride * k] +=
680 alpha * Values[j] * x_ptr[i + x_stride * k];
684 for (
size_t j = 0; j < Nnz; ++j) {
685 const local_ordinal_type col = localIndices_[j];
686 for (
size_t k = 0; k < NumVectors; ++k) {
687 y_ptr[col + y_stride * k] +=
688 alpha * STS::conjugate(Values[j]) * x_ptr[i + x_stride * k];
696 ArrayRCP<ArrayRCP<const scalar_type> > x_ptr = X.get2dView();
697 ArrayRCP<ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
699 for (
size_t i = 0; i < numRows; ++i) {
702 getLocalRowCopy(i, localIndices_, Values_, Nnz);
703 scalar_type* Values =
reinterpret_cast<scalar_type*
>(Values_.data());
704 if (mode == Teuchos::NO_TRANS) {
705 for (
size_t k = 0; k < NumVectors; ++k) {
706 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
707 ArrayView<scalar_type> y_local = (y_ptr())[k]();
708 for (
size_t j = 0; j < Nnz; ++j) {
709 y_local[i] += alpha * Values[j] * x_local[localIndices_[j]];
712 }
else if (mode == Teuchos::TRANS) {
713 for (
size_t k = 0; k < NumVectors; ++k) {
714 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
715 ArrayView<scalar_type> y_local = (y_ptr())[k]();
716 for (
size_t j = 0; j < Nnz; ++j) {
717 y_local[localIndices_[j]] += alpha * Values[j] * x_local[i];
721 for (
size_t k = 0; k < NumVectors; ++k) {
722 ArrayView<const scalar_type> x_local = (x_ptr())[k]();
723 ArrayView<scalar_type> y_local = (y_ptr())[k]();
724 for (
size_t j = 0; j < Nnz; ++j) {
725 y_local[localIndices_[j]] +=
726 alpha * STS::conjugate(Values[j]) * x_local[i];
734template <
class MatrixType>
739template <
class MatrixType>
744template <
class MatrixType>
745typename LocalFilter<MatrixType>::mag_type
747#if KOKKOS_VERSION >= 40799
748 typedef KokkosKernels::ArithTraits<scalar_type> STS;
750 typedef Kokkos::ArithTraits<scalar_type> STS;
752#if KOKKOS_VERSION >= 40799
753 typedef KokkosKernels::ArithTraits<mag_type> STM;
755 typedef Kokkos::ArithTraits<mag_type> STM;
757 typedef typename Teuchos::Array<scalar_type>::size_type size_type;
759 const size_type maxNumRowEnt = getLocalMaxNumRowEntries();
761 nonconst_local_inds_host_view_type ind(
"ind", maxNumRowEnt);
762 nonconst_values_host_view_type val(
"val", maxNumRowEnt * blockNumEntr);
763 const size_t numRows =
static_cast<size_t>(localRowMap_->getLocalNumElements());
766 mag_type sumSquared = STM::zero();
767 for (
size_t i = 0; i < numRows; ++i) {
768 size_t numEntries = 0;
769 this->getLocalRowCopy(i, ind, val, numEntries);
770 for (size_type k = 0; k < static_cast<size_type>(numEntries * blockNumEntr); ++k) {
771 const mag_type v_k_abs = STS::magnitude(val[k]);
772 sumSquared += v_k_abs * v_k_abs;
775 return STM::squareroot(sumSquared);
778template <
class MatrixType>
781 using Teuchos::TypeNameTraits;
782 std::ostringstream os;
784 os <<
"Ifpack2::LocalFilter: {";
785 os <<
"MatrixType: " << TypeNameTraits<MatrixType>::name();
786 if (this->getObjectLabel() !=
"") {
787 os <<
", Label: \"" << this->getObjectLabel() <<
"\"";
789 os <<
", Number of rows: " << getGlobalNumRows()
790 <<
", Number of columns: " << getGlobalNumCols()
795template <
class MatrixType>
797 describe(Teuchos::FancyOStream& out,
798 const Teuchos::EVerbosityLevel verbLevel)
const {
800 using Teuchos::OSTab;
801 using Teuchos::TypeNameTraits;
803 const Teuchos::EVerbosityLevel vl =
804 (verbLevel == Teuchos::VERB_DEFAULT) ? Teuchos::VERB_LOW : verbLevel;
806 if (vl > Teuchos::VERB_NONE) {
810 out <<
"Ifpack2::LocalFilter:" << endl;
812 out <<
"MatrixType: " << TypeNameTraits<MatrixType>::name() << endl;
813 if (this->getObjectLabel() !=
"") {
814 out <<
"Label: \"" << this->getObjectLabel() <<
"\"" << endl;
816 out <<
"Number of rows: " << getGlobalNumRows() << endl
817 <<
"Number of columns: " << getGlobalNumCols() << endl
818 <<
"Number of nonzeros: " << NumNonzeros_ << endl;
820 if (vl > Teuchos::VERB_LOW) {
821 out <<
"Row Map:" << endl;
822 localRowMap_->describe(out, vl);
823 out <<
"Domain Map:" << endl;
824 localDomainMap_->describe(out, vl);
825 out <<
"Range Map:" << endl;
826 localRangeMap_->describe(out, vl);
831template <
class MatrixType>
832Teuchos::RCP<
const Tpetra::RowMatrix<
typename MatrixType::scalar_type,
833 typename MatrixType::local_ordinal_type,
834 typename MatrixType::global_ordinal_type,
835 typename MatrixType::node_type> >
842#define IFPACK2_LOCALFILTER_INSTANT(S, LO, GO, N) \
843 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:128
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:797
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:233
virtual Teuchos::RCP< const map_type > getDomainMap() const
Returns the Map that describes the domain distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:217
virtual size_t getGlobalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on all processes.
Definition Ifpack2_LocalFilter_def.hpp:338
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:547
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:369
virtual bool isGloballyIndexed() const
Whether the underlying sparse matrix is globally (opposite of locally) indexed.
Definition Ifpack2_LocalFilter_def.hpp:358
virtual Teuchos::RCP< const row_matrix_type > getUnderlyingMatrix() const
Return matrix that LocalFilter was built on.
Definition Ifpack2_LocalFilter_def.hpp:836
MatrixType::scalar_type scalar_type
The type of the entries of the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:146
virtual Teuchos::RCP< const map_type > getRangeMap() const
Returns the Map that describes the range distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:225
virtual mag_type getFrobeniusNorm() const
The Frobenius norm of the (locally filtered) matrix.
Definition Ifpack2_LocalFilter_def.hpp:746
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:302
MatrixType::node_type node_type
The Node type used by the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:155
virtual global_size_t getGlobalNumCols() const
The number of global columns in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:264
virtual bool hasColMap() const
Whether this matrix has a well-defined column Map.
Definition Ifpack2_LocalFilter_def.hpp:348
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:516
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:152
virtual bool isFillComplete() const
Returns true if fillComplete() has been called.
Definition Ifpack2_LocalFilter_def.hpp:363
virtual bool isLocallyIndexed() const
Whether the underlying sparse matrix is locally (opposite of globally) indexed.
Definition Ifpack2_LocalFilter_def.hpp:353
virtual size_t getLocalNumCols() const
The number of columns in the (locally filtered) matrix.
Definition Ifpack2_LocalFilter_def.hpp:274
virtual Teuchos::RCP< const map_type > getColMap() const
Returns the Map that describes the column distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:209
virtual bool hasTransposeApply() const
Whether this operator supports applying the transpose or conjugate transpose.
Definition Ifpack2_LocalFilter_def.hpp:735
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:534
virtual size_t getLocalMaxNumRowEntries() const
The maximum number of entries across all rows/columns on this process.
Definition Ifpack2_LocalFilter_def.hpp:343
LocalFilter(const Teuchos::RCP< const row_matrix_type > &A)
Constructor.
Definition Ifpack2_LocalFilter_def.hpp:58
virtual global_ordinal_type getIndexBase() const
Returns the index base for global indices for this matrix.
Definition Ifpack2_LocalFilter_def.hpp:280
virtual bool supportsRowViews() const
Returns true if RowViews are supported.
Definition Ifpack2_LocalFilter_def.hpp:740
virtual std::string description() const
A one-line description of this object.
Definition Ifpack2_LocalFilter_def.hpp:780
virtual global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:285
virtual local_ordinal_type getBlockSize() const
The number of degrees of freedom per mesh point.
Definition Ifpack2_LocalFilter_def.hpp:295
virtual ~LocalFilter()
Destructor.
Definition Ifpack2_LocalFilter_def.hpp:189
virtual size_t getLocalNumRows() const
The number of rows owned on the calling process.
Definition Ifpack2_LocalFilter_def.hpp:269
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:561
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input MatrixType.
Definition Ifpack2_LocalFilter_decl.hpp:149
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:554
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:410
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:319
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:525
virtual global_size_t getGlobalNumRows() const
The number of global rows in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:259
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:185
virtual size_t getLocalNumEntries() const
Returns the local number of entries in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:290
virtual Teuchos::RCP< const Teuchos::Comm< int > > getComm() const
Returns the communicator.
Definition Ifpack2_LocalFilter_def.hpp:193
virtual Teuchos::RCP< const map_type > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
Definition Ifpack2_LocalFilter_def.hpp:201
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:40