43 #ifndef IFPACK2_CONTAINER_DEF_HPP
44 #define IFPACK2_CONTAINER_DEF_HPP
53 template<
class MatrixType>
58 inputMatrix_ (matrix),
59 inputCrsMatrix_ (Teuchos::rcp_dynamic_cast<const crs_matrix_type>(inputMatrix_)),
60 inputBlockMatrix_ (Teuchos::rcp_dynamic_cast<const block_crs_matrix_type>(inputMatrix_)),
61 pointIndexed_(pointIndexed),
62 IsInitialized_(false),
85 #ifdef HAVE_IFPACK2_DEBUG
93 LO row = blockRows[j];
100 !rowMap.isNodeLocalElement(row),
101 std::invalid_argument,
"Ifpack2::Container: "
102 "On process " << rowMap.getComm()->getRank() <<
" of "
103 << rowMap.getComm()->getSize() <<
", in the given set of local row "
105 "entries is not valid local row index on the calling process: "
112 template<
class MatrixType>
116 template<
class MatrixType>
121 (&blockRows_[blockOffsets_[blockIndex]], blockSizes_[blockIndex]);
124 template<
class MatrixType>
129 LO totalBlockRows = 0;
130 numBlocks_ = partitions.size();
131 blockSizes_.resize(numBlocks_);
132 blockOffsets_.resize(numBlocks_);
134 for(
int i = 0; i < numBlocks_; i++)
136 LO rowsInBlock = partitions[i].size();
137 blockSizes_[i] = rowsInBlock;
138 blockOffsets_[i] = totalBlockRows;
139 totalBlockRows += rowsInBlock;
140 maxBlockSize_ = std::max(maxBlockSize_, rowsInBlock * scalarsPerRow_);
142 blockRows_.resize(totalBlockRows);
145 for(
int i = 0; i < numBlocks_; i++)
147 for(
int j = 0; j < blockSizes_[i]; j++)
149 blockRows_[iter++] = partitions[i][j];
154 template<
class MatrixType>
159 Diag_ =
rcp(
new vector_type(inputMatrix_->getDomainMap()));
160 inputMatrix_->getLocalDiagCopy(*Diag_);
164 template<
class MatrixType>
166 return IsInitialized_;
169 template<
class MatrixType>
174 template<
class MatrixType>
181 template<
class MatrixType>
188 template<
class MatrixType>
195 template<
class MatrixType>
197 SC dampingFactor, LO i)
const
202 template <
class MatrixType>
206 const ISC one = STS::one();
208 size_t numVecs = X.extent(1);
210 for (LO i = 0; i < numBlocks_; i++)
213 if(blockSizes_[i] != 1 || hasBlockCrs_)
215 if(blockSizes_[i] == 0 )
221 LO LRID = blockRows_[blockOffsets_[i]];
223 HostView diagView = Diag_->getLocalViewHost();
224 ISC d = one / diagView(LRID, 0);
225 for(
size_t nv = 0; nv < numVecs; nv++)
234 template <
class MatrixType>
235 void Container<MatrixType>::DoOverlappingJacobi(HostView X, HostView Y, HostView W, SC dampingFactor)
const
239 for(LO i = 0; i < numBlocks_; i++)
242 if(blockSizes_[i] == 0)
244 if(blockSizes_[i] != 1)
251 template<
class MatrixType,
typename LocalScalarType>
254 SC dampingFactor, LO i)
const
258 size_t numVecs = X.extent(1);
259 const ISC one = STS::one();
260 if(this->blockSizes_[i] == 0)
262 if(this->hasBlockCrs_ && !this->pointIndexed_)
265 ArrayView<const LO> blockRows = this->getBlockRows(i);
266 const size_t localNumRows = this->blockSizes_[i];
267 for(
size_t j = 0; j < localNumRows; j++)
269 LO row = blockRows[j];
273 this->inputBlockMatrix_->getLocalRowView(row, colinds, values, numEntries);
274 for(
size_t m = 0; m < numVecs; m++)
276 for (
int localR = 0; localR < this->bcrsBlockSize_; localR++)
277 Resid(row * this->bcrsBlockSize_ + localR, m) = X(row * this->bcrsBlockSize_ + localR, m);
278 for (LO k = 0; k < numEntries; ++k)
280 const LO col = colinds[k];
281 for(
int localR = 0; localR < this->bcrsBlockSize_; localR++)
283 for(
int localC = 0; localC < this->bcrsBlockSize_; localC++)
285 Resid(row * this->bcrsBlockSize_ + localR, m) -=
286 values[k * this->bcrsBlockSize_ * this->bcrsBlockSize_ + localR + localC * this->bcrsBlockSize_]
287 * Y2(col * this->bcrsBlockSize_ + localC, m); }
300 else if(!this->hasBlockCrs_ && this->blockSizes_[i] == 1)
304 LO LRID = this->blockOffsets_[i];
305 HostView diagView = this->Diag_->getLocalViewHost();
306 ISC d = one / diagView(LRID, 0);
307 for(
size_t m = 0; m < numVecs; m++)
314 else if(!this->inputCrsMatrix_.is_null() &&
315 std::is_same<typename crs_matrix_type::device_type::memory_space, Kokkos::HostSpace>::value)
320 container_exec_space().fence();
321 auto localA = this->inputCrsMatrix_->getLocalMatrix();
322 using size_type =
typename crs_matrix_type::local_matrix_type::size_type;
323 const auto& rowmap = localA.graph.row_map;
324 const auto& entries = localA.graph.entries;
325 const auto& values = localA.values;
326 ArrayView<const LO> blockRows = this->getBlockRows(i);
327 for(
size_t j = 0; j < size_t(blockRows.size()); j++)
329 const LO row = blockRows[j];
330 for(
size_t m = 0; m < numVecs; m++)
333 for(size_type k = rowmap(row); k < rowmap(row + 1); k++)
335 const LO col = entries(k);
336 r -= values(k) * Y2(col, m);
353 ArrayView<const LO> blockRows = this->getBlockRows(i);
354 for(
size_t j = 0; j < size_t(blockRows.size()); j++)
356 const LO row = blockRows[j];
357 auto rowView = getInputRowView(row);
358 for(
size_t m = 0; m < numVecs; m++)
360 Resid(row, m) = X(row, m);
361 for (
size_t k = 0; k < rowView.size(); ++k)
363 const LO col = rowView.ind(k);
364 Resid(row, m) -= rowView.val(k) * Y2(col, m);
378 template<
class MatrixType>
380 DoGaussSeidel(HostView X, HostView Y, HostView Y2, SC dampingFactor)
const
388 using Teuchos::rcpFromRef;
391 auto numVecs = X.extent(1);
393 HostView Resid(
"", X.extent(0), X.extent(1));
394 for(LO i = 0; i < numBlocks_; i++)
396 DoGSBlock(X, Y, Y2, Resid, dampingFactor, i);
400 auto numMyRows = inputMatrix_->getNodeNumRows();
401 for (
size_t m = 0; m < numVecs; ++m)
403 for (
size_t i = 0; i < numMyRows * bcrsBlockSize_; ++i)
411 template<
class MatrixType>
412 void Container<MatrixType>::
413 DoSGS(HostView X, HostView Y, HostView Y2, SC dampingFactor)
const
423 using Teuchos::rcpFromRef;
424 auto numVecs = X.extent(1);
425 HostView Resid(
"", X.extent(0), X.extent(1));
427 for(LO i = 0; i < numBlocks_; i++)
429 DoGSBlock(X, Y, Y2, Resid, dampingFactor, i);
431 static_assert(std::is_signed<LO>::value,
432 "Local ordinal must be signed (unsigned breaks reverse iteration to 0)");
434 for(LO i = numBlocks_ - 1; i >= 0; --i)
436 DoGSBlock(X, Y, Y2, Resid, dampingFactor, i);
440 auto numMyRows = inputMatrix_->getNodeNumRows();
441 for (
size_t m = 0; m < numVecs; ++m)
443 for (
size_t i = 0; i < numMyRows * bcrsBlockSize_; ++i)
451 template<
class MatrixType>
452 void Container<MatrixType>::
458 blockOffsets_.clear();
459 Diag_ = Teuchos::null;
464 template<
class MatrixType,
class LocalScalarType>
465 ContainerImpl<MatrixType, LocalScalarType>::
470 : Container<MatrixType>(matrix, partitions, pointIndexed) {}
472 template<
class MatrixType,
class LocalScalarType>
476 template<
class MatrixType,
class LocalScalarType>
480 template<
class MatrixType,
class LocalScalarType>
490 template<
class MatrixType,
class LocalScalarType>
494 HostView XView = X.getLocalViewHost();
495 HostView YView = Y.getLocalViewHost();
496 this->apply (XView, YView, 0);
499 template<
class MatrixType,
class LocalScalarType>
503 vector_type& W)
const
505 HostView XView = X.getLocalViewHost();
506 HostView YView = Y.getLocalViewHost();
507 HostView WView = W.getLocalViewHost();
508 weightedApply (XView, YView, WView, 0);
511 template<
class MatrixType,
class LocalScalarType>
518 template<
class MatrixType,
class LocalScalarType>
525 const LSC beta)
const
530 template<
class MatrixType,
class LocalScalarType>
531 typename ContainerImpl<MatrixType, LocalScalarType>::LO
537 const map_type& globalRowMap = *(this->inputMatrix_->getRowMap());
538 const map_type& globalColMap = *(this->inputMatrix_->getColMap());
541 if(this->pointIndexed_)
543 rowLID = row / this->bcrsBlockSize_;
544 dofOffset = row % this->bcrsBlockSize_;
546 GO diagGID = globalRowMap.getGlobalElement(rowLID);
548 diagGID == GO_INVALID,
549 std::runtime_error,
"Ifpack2::Container::translateRowToCol: "
550 "On process " << this->inputMatrix_->getRowMap()->getComm()->getRank() <<
551 ", at least one row index in the set of local "
552 "row indices given to the constructor is not a valid local row index in "
553 "the input matrix's row Map on this process. This should be impossible "
554 "because the constructor checks for this case. Here is the complete set "
555 "of invalid local row indices: " << rowLID <<
". "
556 "Please report this bug to the Ifpack2 developers.");
558 LO colLID = globalColMap.getLocalElement(diagGID);
560 colLID == LO_INVALID,
561 std::runtime_error,
"Ifpack2::Container::translateRowToCol: "
562 "On process " << this->inputMatrix_->getRowMap()->getComm()->getRank() <<
", "
563 "at least one row index in the set of row indices given to the constructor "
564 "does not have a corresponding column index in the input matrix's column "
565 "Map. This probably means that the column(s) in question is/are empty on "
566 "this process, which would make the submatrix to extract structurally "
567 "singular. The invalid global column index is " << diagGID <<
".");
569 if(this->pointIndexed_)
570 return colLID * this->bcrsBlockSize_ + dofOffset;
574 template<
class MatrixType,
class LocalScalarType>
597 ! this->IsComputed_, std::runtime_error,
"Ifpack2::Container::apply: "
598 "You must have called the compute() method before you may call apply(). "
599 "You may call the apply() method as many times as you want after calling "
600 "compute() once, but you must have called compute() at least once.");
602 const size_t numVecs = X.extent(1);
633 if(X_localBlocks_.size() == 0 || X.extent(1) != X_local_.extent(1))
636 X_localBlocks_.clear();
637 Y_localBlocks_.clear();
638 X_localBlocks_.reserve(this->numBlocks_);
639 Y_localBlocks_.reserve(this->numBlocks_);
641 X_local_ = HostViewLocal(
"X_local", this->blockRows_.size() * this->scalarsPerRow_, numVecs);
642 Y_local_ = HostViewLocal(
"Y_local", this->blockRows_.size() * this->scalarsPerRow_, numVecs);
646 for(
int i = 0; i < this->numBlocks_; i++)
648 auto blockBounds = std::make_pair(this->blockOffsets_[i] * this->scalarsPerRow_,
649 (this->blockOffsets_[i] + this->blockSizes_[i]) * this->scalarsPerRow_);
650 X_localBlocks_.emplace_back(X_local_, blockBounds, Kokkos::ALL());
651 Y_localBlocks_.emplace_back(Y_local_, blockBounds, Kokkos::ALL());
655 const ArrayView<const LO> blockRows = this->getBlockRows(blockIndex);
657 if(this->scalarsPerRow_ == 1)
658 mvgs.gatherViewToView (X_localBlocks_[blockIndex], X, blockRows);
660 mvgs.gatherViewToViewBlock (X_localBlocks_[blockIndex], X, blockRows, this->scalarsPerRow_);
667 if(this->scalarsPerRow_ == 1)
668 mvgs.gatherViewToView (Y_localBlocks_[blockIndex], Y, blockRows);
670 mvgs.gatherViewToViewBlock (Y_localBlocks_[blockIndex], Y, blockRows, this->scalarsPerRow_);
674 this->solveBlock (X_localBlocks_[blockIndex], Y_localBlocks_[blockIndex], blockIndex, mode,
679 if(this->scalarsPerRow_ == 1)
680 mvgs.scatterViewToView (Y, Y_localBlocks_[blockIndex], blockRows);
682 mvgs.scatterViewToViewBlock (Y, Y_localBlocks_[blockIndex], blockRows, this->scalarsPerRow_);
685 template<
class MatrixType,
class LocalScalarType>
702 using Teuchos::rcp_const_cast;
713 const char prefix[] =
"Ifpack2::Container::weightedApply: ";
715 ! this->IsComputed_, std::runtime_error, prefix <<
"You must have called the "
716 "compute() method before you may call this method. You may call "
717 "weightedApply() as many times as you want after calling compute() once, "
718 "but you must have called compute() at least once first.");
722 this->scalarsPerRow_ > 1, std::logic_error, prefix <<
"Use of block rows isn't allowed "
723 "in overlapping Jacobi (the only method that uses weightedApply");
725 const size_t numVecs = X.extent(1);
728 X.extent(1) != Y.extent(1), std::runtime_error,
729 prefix <<
"X and Y have different numbers of vectors (columns). X has "
730 << X.extent(1) <<
", but Y has " << Y.extent(1) <<
".");
736 const size_t numRows = this->blockSizes_[blockIndex];
761 if(X_localBlocks_.size() == 0 || X.extent(1) != X_local_.extent(1))
764 X_localBlocks_.clear();
765 Y_localBlocks_.clear();
766 X_localBlocks_.reserve(this->numBlocks_);
767 Y_localBlocks_.reserve(this->numBlocks_);
769 X_local_ = HostViewLocal(
"X_local", this->blockRows_.size() * this->scalarsPerRow_, numVecs);
770 Y_local_ = HostViewLocal(
"Y_local", this->blockRows_.size() * this->scalarsPerRow_, numVecs);
774 for(
int i = 0; i < this->numBlocks_; i++)
776 auto blockBounds = std::make_pair(this->blockOffsets_[i] * this->scalarsPerRow_,
777 (this->blockOffsets_[i] + this->blockSizes_[i]) * this->scalarsPerRow_);
778 X_localBlocks_.emplace_back(X_local_, blockBounds, Kokkos::ALL());
779 Y_localBlocks_.emplace_back(Y_local_, blockBounds, Kokkos::ALL());
782 if(
int(weightedApplyScratch_.extent(0)) != 3 * this->maxBlockSize_ ||
783 weightedApplyScratch_.extent(1) != numVecs)
785 weightedApplyScratch_ = HostViewLocal(
"weightedApply scratch", 3 * this->maxBlockSize_, numVecs);
788 ArrayView<const LO> blockRows = this->getBlockRows(blockIndex);
793 mvgs.gatherViewToView (X_localBlocks_[blockIndex], X, blockRows);
799 mvgs.gatherViewToView (Y_localBlocks_[blockIndex], Y, blockRows);
810 auto maxBS = this->maxBlockSize_;
811 auto bs = this->blockSizes_[blockIndex] * this->scalarsPerRow_;
813 HostSubviewLocal D_local(weightedApplyScratch_, std::make_pair(0, bs), std::make_pair(0, 1));
814 mvgs.gatherViewToView (D_local, D, blockRows);
815 HostSubviewLocal X_scaled(weightedApplyScratch_, std::make_pair(maxBS, maxBS + bs), Kokkos::ALL());
816 for(
size_t j = 0; j < numVecs; j++)
817 for(
size_t i = 0; i < numRows; i++)
818 X_scaled(i, j) = X_localBlocks_[blockIndex](i, j) * D_local(i, 0);
820 HostSubviewLocal Y_temp(weightedApplyScratch_, std::make_pair(maxBS * 2, maxBS * 2 + bs), Kokkos::ALL());
822 this->solveBlock (X_scaled, Y_temp, blockIndex, mode, STS::one(), STS::zero());
830 for(
size_t j = 0; j < numVecs; j++)
831 for(
size_t i = 0; i < numRows; i++)
832 Y_localBlocks_[blockIndex](i, j) = b * Y_localBlocks_[blockIndex](i, j) + a * Y_temp(i, j) * D_local(i, 0);
836 mvgs.scatterViewToView (Y, Y_localBlocks_[blockIndex], blockRows);
839 template<
class MatrixType,
class LocalScalarType>
841 typename ContainerImpl<MatrixType, LocalScalarType>::SC,
842 typename ContainerImpl<MatrixType, LocalScalarType>::LO,
843 typename ContainerImpl<MatrixType, LocalScalarType>::GO,
844 typename ContainerImpl<MatrixType, LocalScalarType>::NO>
848 if(this->hasBlockCrs_)
853 this->inputBlockMatrix_->getLocalRowView(row / this->bcrsBlockSize_, colinds, values, numEntries);
854 return StridedRowView(values + row % this->bcrsBlockSize_, colinds, this->bcrsBlockSize_, numEntries * this->bcrsBlockSize_);
856 else if(!this->inputMatrix_->supportsRowViews())
858 size_t maxEntries = this->inputMatrix_->getNodeMaxNumRowEntries();
862 this->inputMatrix_->getLocalRowCopy(row, indsCopy, valsCopy, numEntries);
863 indsCopy.
resize(numEntries);
864 valsCopy.
resize(numEntries);
872 this->inputMatrix_->getLocalRowViewRaw(row, numEntries, colinds, values);
877 template<
class MatrixType,
class LocalScalarType>
881 X_localBlocks_.clear();
882 Y_localBlocks_.clear();
883 X_local_ = HostViewLocal();
884 Y_local_ = HostViewLocal();
891 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
894 : vals(vals_), inds(inds_), blockSize(blockSize_), nnz(nnz_)
897 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
900 : vals(nullptr), inds(nullptr), blockSize(1), nnz(vals_.size())
902 valsCopy.
swap(vals_);
903 indsCopy.
swap(inds_);
906 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
910 #ifdef HAVE_IFPACK2_DEBUG
912 "Out-of-bounds access into Ifpack2::Container::StridedRowView");
919 return vals[i * blockSize];
925 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
926 LocalOrdinal StridedRowView<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
929 #ifdef HAVE_IFPACK2_DEBUG
931 "Out-of-bounds access into Ifpack2::Container::StridedRowView");
939 return inds[i / blockSize] * blockSize + i % blockSize;
945 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
946 size_t StridedRowView<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
955 template <
class MatrixType>
956 std::ostream& operator<<(std::ostream& os, const Ifpack2::Container<MatrixType>& obj)
958 return obj.print(os);
961 #define IFPACK2_CONTAINER_INSTANT(S,LO,GO,N) \
962 template class Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N>>; \
963 template class Ifpack2::ContainerImpl<Tpetra::RowMatrix<S, LO, GO, N>, S>; \
964 template class Ifpack2::Details::StridedRowView<S, LO, GO, N>; \
965 template std::ostream& operator<< <Tpetra::RowMatrix<S, LO, GO, N>>( \
966 std::ostream& os, const Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N>>& obj);
bool isComputed() const
Whether the container has been successfully computed.
Definition: Ifpack2_Container_def.hpp:170
void setBlockSizes(const Teuchos::Array< Teuchos::Array< LO > > &partitions)
Initialize arrays with information about block sizes.
Definition: Ifpack2_Container_def.hpp:125
Teuchos::Array< LO > blockSizes_
Number of rows in each block.
Definition: Ifpack2_Container_decl.hpp:295
void applyMV(mv_type &X, mv_type &Y) const
Wrapper for apply with MVs, used in unit tests (never called by BlockRelaxation)
Definition: Ifpack2_Container_def.hpp:492
bool pointIndexed_
(If hasBlockCrs_) Whether the blocks are described using sub-block row indices instead of full block ...
Definition: Ifpack2_Container_decl.hpp:313
int numBlocks_
The number of blocks (partitions) in the container.
Definition: Ifpack2_Container_decl.hpp:291
The implementation of the numerical features of Container (Jacobi, Gauss-Seidel, SGS). This class allows a custom scalar type (LocalScalarType) to be used for storing blocks and solving the block systems. Hiding this template parameter from the Container interface simplifies the BlockRelaxation and ContainerFactory classes.
Definition: Ifpack2_Container_decl.hpp:342
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void setParameters(const Teuchos::ParameterList &List)
Set parameters, if any.
Definition: Ifpack2_Container_def.hpp:478
bool isInitialized() const
Whether the container has been successfully initialized.
Definition: Ifpack2_Container_def.hpp:165
LO scalarsPerRow_
Definition: Ifpack2_Container_decl.hpp:316
virtual ~Container()
Destructor.
Definition: Ifpack2_Container_def.hpp:114
bool hasBlockCrs_
Whether the input matrix is a BlockCRS matrix.
Definition: Ifpack2_Container_decl.hpp:309
Details::StridedRowView< SC, LO, GO, NO > getInputRowView(LO row) const
View a row of the input matrix.
Definition: Ifpack2_Container_def.hpp:846
virtual void apply(HostView X, HostView Y, int blockIndex, Teuchos::ETransp mode=Teuchos::NO_TRANS, SC alpha=Teuchos::ScalarTraits< SC >::one(), SC beta=Teuchos::ScalarTraits< SC >::zero()) const
Compute Y := alpha * M^{-1} X + beta*Y.
Definition: Ifpack2_Container_def.hpp:576
LocalScalarType LSC
The internal representation of LocalScalarType in Kokkos::View.
Definition: Ifpack2_Container_decl.hpp:362
Declaration and definition of the Ifpack2::Details::MultiVectorLocalGatherScatter class...
typename Kokkos::Details::ArithTraits< SC >::val_type ISC
Internal representation of Scalar in Kokkos::View.
Definition: Ifpack2_Container_decl.hpp:135
Container(const Teuchos::RCP< const row_matrix_type > &matrix, const Teuchos::Array< Teuchos::Array< LO > > &partitions, bool pointIndexed)
Constructor.
Definition: Ifpack2_Container_def.hpp:54
int bcrsBlockSize_
If hasBlockCrs_, the number of DOFs per vertex. Otherwise 1.
Definition: Ifpack2_Container_decl.hpp:311
virtual void DoGSBlock(HostView X, HostView Y, HostView Y2, HostView Resid, SC dampingFactor, LO i) const
Do one step of Gauss-Seidel on block i (used by DoGaussSeidel and DoSGS)
Definition: Ifpack2_Container_def.hpp:196
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
#define TEUCHOS_TEST_FOR_EXCEPT_MSG(throw_exception_test, msg)
StridedRowView(const SC *vals_, const LO *inds_, int blockSize_, size_t nnz_)
Constructor for row views (preferred)
Definition: Ifpack2_Container_def.hpp:893
LO translateRowToCol(LO row)
Definition: Ifpack2_Container_def.hpp:533
Teuchos::RCP< const block_crs_matrix_type > inputBlockMatrix_
The input matrix, dynamic cast to BlockCrsMatrix. May be null.
Definition: Ifpack2_Container_decl.hpp:288
Teuchos::RCP< const row_matrix_type > inputMatrix_
The input matrix to the constructor.
Definition: Ifpack2_Container_decl.hpp:282
virtual void applyInverseJacobi(const mv_type &, mv_type &, SC dampingFactor, bool, int) const
Compute Y := (1 - a) Y + a D^{-1} (X - R*Y).
Definition: Ifpack2_Container_def.hpp:482
typename mv_type::dual_view_type::t_host HostView
Definition: Ifpack2_Container_decl.hpp:139
virtual void weightedApplyMV(mv_type &X, mv_type &Y, vector_type &W) const
Wrapper for weightedApply with MultiVector.
Definition: Ifpack2_Container_def.hpp:183
virtual void solveBlock(HostSubviewLocal X, HostSubviewLocal Y, int blockIndex, Teuchos::ETransp mode, const LSC alpha, const LSC beta) const
Definition: Ifpack2_Container_def.hpp:520
void resize(size_type new_size, const value_type &x=value_type())
virtual void applyMV(mv_type &X, mv_type &Y) const
Wrapper for apply with MultiVector.
Definition: Ifpack2_Container_def.hpp:176
virtual ~ContainerImpl()
Destructor.
Definition: Ifpack2_Container_def.hpp:474
bool IsParallel_
Whether the problem is distributed across multiple MPI processes.
Definition: Ifpack2_Container_decl.hpp:301
void DoGSBlock(HostView X, HostView Y, HostView Y2, HostView Resid, SC dampingFactor, LO i) const
Do one step of Gauss-Seidel on block i (used by DoGaussSeidel and DoSGS)
Definition: Ifpack2_Container_def.hpp:252
virtual void weightedApply(HostView X, HostView Y, HostView D, int blockIndex, Teuchos::ETransp mode=Teuchos::NO_TRANS, SC alpha=Teuchos::ScalarTraits< SC >::one(), SC beta=Teuchos::ScalarTraits< SC >::zero()) const
Compute Y := alpha * diag(D) * M^{-1} (diag(D) * X) + beta*Y.
Definition: Ifpack2_Container_def.hpp:687
static std::string getName()
Definition: Ifpack2_Container_def.hpp:513
TypeTo as(const TypeFrom &t)
Interface for creating and solving a set of local linear problems.
Definition: Ifpack2_Container_decl.hpp:112
Teuchos::ArrayView< const LO > getBlockRows(int blockIndex) const
Local indices of the rows of the input matrix that belong to this block.
Definition: Ifpack2_Container_def.hpp:118
Structure for read-only views of general matrix rows.
Definition: Ifpack2_Container_decl.hpp:329
void weightedApplyMV(mv_type &X, mv_type &Y, vector_type &W) const
Wrapper for weightedApply with MVs, used in unit tests (never called by BlockRelaxation) ...
Definition: Ifpack2_Container_def.hpp:501
static std::string getName()
Definition: Ifpack2_Container_def.hpp:190
GO NumGlobalRows_
Number of global rows in input matrix.
Definition: Ifpack2_Container_decl.hpp:305
GO NumGlobalNonzeros_
Number of nonzeros in input matrix.
Definition: Ifpack2_Container_decl.hpp:307
LO NumLocalRows_
Number of local rows in input matrix.
Definition: Ifpack2_Container_decl.hpp:303
Implementation detail of Ifpack2::Container subclasses.
Definition: Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:85
std::string toString(const T &t)