10#ifndef IFPACK2_CONTAINER_DEF_HPP
11#define IFPACK2_CONTAINER_DEF_HPP
14#include <Teuchos_Time.hpp>
20template <
class MatrixType>
22 const Teuchos::RCP<const row_matrix_type>& matrix,
23 const Teuchos::Array<Teuchos::Array<LO>>& partitions,
32 using Teuchos::ArrayView;
51#ifdef HAVE_IFPACK2_DEBUG
55 Teuchos::ArrayView<const LO> blockRows =
getBlockRows(i);
57 LO row = blockRows[j];
62 TEUCHOS_TEST_FOR_EXCEPTION(
63 !rowMap.isNodeLocalElement(row),
64 std::invalid_argument,
65 "Ifpack2::Container: "
67 << rowMap.getComm()->getRank() <<
" of "
68 << rowMap.getComm()->getSize() <<
", in the given set of local row "
69 "indices blockRows = "
70 << Teuchos::toString(blockRows) <<
", the following "
71 "entries is not valid local row index on the calling process: "
78template <
class MatrixType>
82template <
class MatrixType>
83Teuchos::ArrayView<const typename MatrixType::local_ordinal_type>
88template <
class MatrixType>
92 LO totalBlockRows = 0;
98 LO rowsInBlock = partitions[i].size();
101 totalBlockRows += rowsInBlock;
102 maxBlockSize_ = std::max(maxBlockSize_, rowsInBlock *
scalarsPerRow_);
114template <
class MatrixType>
115void Container<MatrixType>::getMatDiag()
const {
116 if (Diag_.is_null()) {
117 Diag_ = rcp(
new vector_type(inputMatrix_->getDomainMap()));
118 inputMatrix_->getLocalDiagCopy(*Diag_);
122template <
class MatrixType>
127template <
class MatrixType>
132template <
class MatrixType>
134 applyMV(
const mv_type& X, mv_type& Y)
const {
135 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Not implemented.");
138template <
class MatrixType>
141 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Not implemented.");
144template <
class MatrixType>
150template <
class MatrixType>
152 SC dampingFactor, LO i)
const {
153 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Not implemented.");
156template <
class MatrixType>
158 using STS = Teuchos::ScalarTraits<ISC>;
159 const ISC one = STS::one();
161 size_t numVecs = X.extent(1);
163 for (LO i = 0; i < numBlocks_; i++) {
165 if (blockSizes_[i] != 1 || hasBlockCrs_) {
166 if (blockSizes_[i] == 0)
168 apply(X, Y, i, Teuchos::NO_TRANS, dampingFactor, one);
171 LO LRID = blockRows_[blockOffsets_[i]];
173 auto diagView = Diag_->getLocalViewHost(Tpetra::Access::ReadOnly);
174 ISC d = one * (
static_cast<ISC
>(dampingFactor)) / diagView(LRID, 0);
175 for (
size_t nv = 0; nv < numVecs; nv++) {
177 Y(LRID, nv) += x * d;
183template <
class MatrixType>
185 using STS = Teuchos::ScalarTraits<SC>;
187 for (LO i = 0; i < numBlocks_; i++) {
189 if (blockSizes_[i] == 0)
191 if (blockSizes_[i] != 1) {
193 weightedApply(X, Y, W, i, Teuchos::NO_TRANS, dampingFactor, STS::one());
200 HostView tempo(
"", X.extent(0), X.extent(1));
201 size_t numVecs = X.extent(1);
202 LO bOffset = blockOffsets_[i];
203 for (LO ii = 0; ii < blockSizes_[i]; ii++) {
204 LO LRID = blockRows_[bOffset++];
205 for (
size_t jj = 0; jj < numVecs; jj++) tempo(LRID, jj) = X(LRID, jj) / W(LRID, 0);
207 weightedApply(tempo, Y, W, i, Teuchos::NO_TRANS, dampingFactor, STS::one());
211 const ISC one = STS::one();
212 size_t numVecs = X.extent(1);
213 LO LRID = blockRows_[blockOffsets_[i]];
215 auto diagView = Diag_->getLocalViewHost(Tpetra::Access::ReadOnly);
216 ISC recip = one / diagView(LRID, 0);
217 ISC wval = W(LRID, 0);
218 ISC combo = wval * recip;
219 ISC d = combo * (
static_cast<ISC
>(dampingFactor));
220 for (
size_t nv = 0; nv < numVecs; nv++) {
222 Y(LRID, nv) = x * d + Y(LRID, nv);
230template <
class MatrixType,
typename LocalScalarType>
233 SC dampingFactor, LO i)
const {
234 using Teuchos::ArrayView;
235 using STS = Teuchos::ScalarTraits<ISC>;
236 size_t numVecs = X.extent(1);
237 const ISC one = STS::one();
238 if (this->blockSizes_[i] == 0)
243 const size_t localNumRows = this->blockSizes_[i];
244 using inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
245 using vals_type =
typename block_crs_matrix_type::values_host_view_type;
246 for (
size_t j = 0; j < localNumRows; j++) {
247 LO row = blockRows[j];
251 LO numEntries = (LO)colinds.size();
252 for (
size_t m = 0; m < numVecs; m++) {
254 Resid(row * this->bcrsBlockSize_ + localR, m) = X(row * this->bcrsBlockSize_ + localR, m);
255 for (LO k = 0; k < numEntries; ++k) {
256 const LO col = colinds[k];
257 for (
int localR = 0; localR < this->bcrsBlockSize_; localR++) {
258 for (
int localC = 0; localC < this->bcrsBlockSize_; localC++) {
259 Resid(row * this->bcrsBlockSize_ + localR, m) -=
260 values[k * this->bcrsBlockSize_ * this->bcrsBlockSize_ + localR + localC * this->bcrsBlockSize_] * Y2(col * this->bcrsBlockSize_ + localC, m);
272 apply(Resid, Y2, i, Teuchos::NO_TRANS, dampingFactor, one);
273 }
else if (!this->
hasBlockCrs_ && this->blockSizes_[i] == 1) {
279 using container_exec_space =
typename ContainerImpl<MatrixType, LocalScalarType>::crs_matrix_type::execution_space;
280 container_exec_space().fence();
282 using size_type =
typename crs_matrix_type::local_matrix_host_type::size_type;
283 const auto& rowmap = localA.graph.row_map;
284 const auto& entries = localA.graph.entries;
285 const auto& values = localA.values;
287 auto diagView = this->
Diag_->getLocalViewHost(Tpetra::Access::ReadOnly);
288 ISC d = (
static_cast<ISC>(dampingFactor)) / diagView(LRID, 0);
289 for (
size_t m = 0; m < numVecs; m++) {
292 for (size_type k = rowmap(LRID); k < rowmap(LRID + 1); k++) {
293 const LO col = entries(k);
294 r -= values(k) * Y2(col, m);
301 std::is_same<typename crs_matrix_type::device_type::memory_space, Kokkos::HostSpace>::value) {
304 using container_exec_space =
typename ContainerImpl<MatrixType, LocalScalarType>::crs_matrix_type::execution_space;
305 container_exec_space().fence();
307 using size_type =
typename crs_matrix_type::local_matrix_host_type::size_type;
308 const auto& rowmap = localA.graph.row_map;
309 const auto& entries = localA.graph.entries;
310 const auto& values = localA.values;
312 for (
size_t j = 0; j < size_t(blockRows.size()); j++) {
313 const LO row = blockRows[j];
314 for (
size_t m = 0; m < numVecs; m++) {
316 for (size_type k = rowmap(row); k < rowmap(row + 1); k++) {
317 const LO col = entries(k);
318 r -= values(k) * Y2(col, m);
329 apply(Resid, Y2, i, Teuchos::NO_TRANS, dampingFactor, one);
334 for (
size_t j = 0; j < size_t(blockRows.size()); j++) {
335 const LO row = blockRows[j];
337 for (
size_t m = 0; m < numVecs; m++) {
338 Resid(row, m) = X(row, m);
339 for (
size_t k = 0; k < rowView.size(); ++k) {
340 const LO col = rowView.ind(k);
341 Resid(row, m) -= rowView.val(k) * Y2(col, m);
351 apply(Resid, Y2, i, Teuchos::NO_TRANS, dampingFactor, one);
355template <
class MatrixType>
358 using Teuchos::Array;
359 using Teuchos::ArrayRCP;
360 using Teuchos::ArrayView;
364 using Teuchos::rcpFromRef;
367 auto numVecs = X.extent(1);
369 HostView Resid(
"", X.extent(0), X.extent(1));
371 DoGSBlock(X, Y, Y2, Resid, dampingFactor, i);
375 for (
size_t m = 0; m < numVecs; ++m) {
383template <
class MatrixType>
384void Container<MatrixType>::
385 DoSGS(ConstHostView X, HostView Y, HostView Y2, SC dampingFactor)
const {
387 using Teuchos::Array;
388 using Teuchos::ArrayRCP;
389 using Teuchos::ArrayView;
394 using Teuchos::rcpFromRef;
395 auto numVecs = X.extent(1);
399 DoGSBlock(X, Y, Y2, Resid, dampingFactor, i);
401 static_assert(std::is_signed<LO>::value,
402 "Local ordinal must be signed (unsigned breaks reverse iteration to 0)");
404 for (LO i = numBlocks_ - 1; i >= 0; --i) {
405 DoGSBlock(X, Y, Y2, Resid, dampingFactor, i);
408 auto numMyRows = inputMatrix_->getLocalNumRows();
409 for (
size_t m = 0; m < numVecs; ++m) {
410 for (
size_t i = 0; i < numMyRows * bcrsBlockSize_; ++i) {
417template <
class MatrixType>
424 Diag_ = Teuchos::null;
429template <
class MatrixType,
class LocalScalarType>
432 const Teuchos::RCP<const row_matrix_type>& matrix,
433 const Teuchos::Array<Teuchos::Array<LO>>& partitions,
435 :
Container<MatrixType>(matrix, partitions, pointIndexed) {}
437template <
class MatrixType,
class LocalScalarType>
441template <
class MatrixType,
class LocalScalarType>
445template <
class MatrixType,
class LocalScalarType>
451 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Not implemented.");
454template <
class MatrixType,
class LocalScalarType>
457 ConstHostView XView = X.getLocalViewHost(Tpetra::Access::ReadOnly);
458 HostView YView = Y.getLocalViewHost(Tpetra::Access::ReadWrite);
459 this->
apply(XView, YView, 0);
462template <
class MatrixType,
class LocalScalarType>
466 vector_type& W)
const {
467 ConstHostView XView = X.getLocalViewHost(Tpetra::Access::ReadOnly);
468 HostView YView = Y.getLocalViewHost(Tpetra::Access::ReadWrite);
469 ConstHostView WView = W.getLocalViewHost(Tpetra::Access::ReadOnly);
473template <
class MatrixType,
class LocalScalarType>
479template <
class MatrixType,
class LocalScalarType>
484 Teuchos::ETransp mode,
486 const LSC beta)
const {
487 TEUCHOS_TEST_FOR_EXCEPT_MSG(
true,
"Not implemented.");
490template <
class MatrixType,
class LocalScalarType>
491typename ContainerImpl<MatrixType, LocalScalarType>::LO
494 LO LO_INVALID = Teuchos::OrdinalTraits<LO>::invalid();
495 GO GO_INVALID = Teuchos::OrdinalTraits<GO>::invalid();
496 const map_type& globalRowMap = *(this->
inputMatrix_->getRowMap());
497 const map_type& globalColMap = *(this->
inputMatrix_->getColMap());
504 GO diagGID = globalRowMap.getGlobalElement(rowLID);
505 TEUCHOS_TEST_FOR_EXCEPTION(
506 diagGID == GO_INVALID,
508 "Ifpack2::Container::translateRowToCol: "
510 << this->
inputMatrix_->getRowMap()->getComm()->getRank() <<
", at least one row index in the set of local "
511 "row indices given to the constructor is not a valid local row index in "
512 "the input matrix's row Map on this process. This should be impossible "
513 "because the constructor checks for this case. Here is the complete set "
514 "of invalid local row indices: "
516 "Please report this bug to the Ifpack2 developers.");
518 LO colLID = globalColMap.getLocalElement(diagGID);
519 TEUCHOS_TEST_FOR_EXCEPTION(
520 colLID == LO_INVALID,
522 "Ifpack2::Container::translateRowToCol: "
524 << this->
inputMatrix_->getRowMap()->getComm()->getRank() <<
", "
525 "at least one row index in the set of row indices given to the constructor "
526 "does not have a corresponding column index in the input matrix's column "
527 "Map. This probably means that the column(s) in question is/are empty on "
528 "this process, which would make the submatrix to extract structurally "
529 "singular. The invalid global column index is "
537template <
class MatrixType,
class LocalScalarType>
539 apply(ConstHostView X,
542 Teuchos::ETransp mode,
545 using Teuchos::ArrayView;
558 TEUCHOS_TEST_FOR_EXCEPTION(
560 "Ifpack2::Container::apply: "
561 "You must have called the compute() method before you may call apply(). "
562 "You may call the apply() method as many times as you want after calling "
563 "compute() once, but you must have called compute() at least once.");
565 const size_t numVecs = X.extent(1);
603 X_local_ = HostViewLocal(
"X_local", this->
blockRows_.size() * this->scalarsPerRow_, numVecs);
604 Y_local_ = HostViewLocal(
"Y_local", this->
blockRows_.size() * this->scalarsPerRow_, numVecs);
608 for (
int i = 0; i < this->numBlocks_; i++) {
610 (this->
blockOffsets_[i] + this->blockSizes_[i]) * this->scalarsPerRow_);
612 Y_localBlocks_.emplace_back(Y_local_, blockBounds, Kokkos::ALL());
616 const ArrayView<const LO> blockRows = this->
getBlockRows(blockIndex);
646template <
class MatrixType,
class LocalScalarType>
652 Teuchos::ETransp mode,
656 using Teuchos::ArrayRCP;
657 using Teuchos::ArrayView;
660 using Teuchos::Range1D;
663 using Teuchos::rcp_const_cast;
664 using STS = Teuchos::ScalarTraits<SC>;
673 const char prefix[] =
"Ifpack2::Container::weightedApply: ";
674 TEUCHOS_TEST_FOR_EXCEPTION(
675 !this->
IsComputed_, std::runtime_error, prefix <<
"You must have called the "
676 "compute() method before you may call this method. You may call "
677 "weightedApply() as many times as you want after calling compute() once, "
678 "but you must have called compute() at least once first.");
681 TEUCHOS_TEST_FOR_EXCEPTION(
682 this->
scalarsPerRow_ > 1, std::logic_error, prefix <<
"Use of block rows isn't allowed "
683 "in overlapping Jacobi (the only method that uses weightedApply");
685 const size_t numVecs = X.extent(1);
687 TEUCHOS_TEST_FOR_EXCEPTION(
688 X.extent(1) != Y.extent(1), std::runtime_error,
689 prefix <<
"X and Y have different numbers of vectors (columns). X has "
690 << X.extent(1) <<
", but Y has " << Y.extent(1) <<
".");
696 const size_t numRows = this->blockSizes_[blockIndex];
728 X_local_ = HostViewLocal(
"X_local", this->
blockRows_.size() * this->scalarsPerRow_, numVecs);
729 Y_local_ = HostViewLocal(
"Y_local", this->
blockRows_.size() * this->scalarsPerRow_, numVecs);
733 for (
int i = 0; i < this->numBlocks_; i++) {
735 (this->
blockOffsets_[i] + this->blockSizes_[i]) * this->scalarsPerRow_);
737 Y_localBlocks_.emplace_back(Y_local_, blockBounds, Kokkos::ALL());
745 ArrayView<const LO> blockRows = this->
getBlockRows(blockIndex);
767 auto maxBS = this->maxBlockSize_;
771 mvgs.gatherViewToView(D_local, D, blockRows);
773 for (
size_t j = 0; j < numVecs; j++)
774 for (
size_t i = 0; i < numRows; i++)
775 X_scaled(i, j) =
X_localBlocks_[blockIndex](i, j) * D_local(i, 0);
777 HostSubviewLocal Y_temp(
weightedApplyScratch_, std::make_pair(maxBS * 2, maxBS * 2 + bs), Kokkos::ALL());
779 this->
solveBlock(X_scaled, Y_temp, blockIndex, mode, STS::one(), STS::zero());
787 for (
size_t j = 0; j < numVecs; j++)
788 for (
size_t i = 0; i < numRows; i++)
796template <
class MatrixType,
class LocalScalarType>
798 typename ContainerImpl<MatrixType, LocalScalarType>::SC,
799 typename ContainerImpl<MatrixType, LocalScalarType>::LO,
800 typename ContainerImpl<MatrixType, LocalScalarType>::GO,
801 typename ContainerImpl<MatrixType, LocalScalarType>::NO>
804 typedef typename MatrixType::nonconst_local_inds_host_view_type nonconst_local_inds_host_view_type;
805 typedef typename MatrixType::nonconst_values_host_view_type nonconst_values_host_view_type;
807 typedef typename MatrixType::local_inds_host_view_type local_inds_host_view_type;
808 typedef typename MatrixType::values_host_view_type values_host_view_type;
809 using IST =
typename row_matrix_type::impl_scalar_type;
812 using h_inds_type =
typename block_crs_matrix_type::local_inds_host_view_type;
813 using h_vals_type =
typename block_crs_matrix_type::values_host_view_type;
817 size_t numEntries = colinds.size();
820 h_vals_type subvals = Kokkos::subview(values, std::pair<size_t, size_t>(row % this->
bcrsBlockSize_, values.size()));
821 return StridedRowView(subvals, colinds, this->bcrsBlockSize_, numEntries * this->bcrsBlockSize_);
823 size_t maxEntries = this->
inputMatrix_->getLocalMaxNumRowEntries();
824 Teuchos::Array<LO> inds(maxEntries);
825 Teuchos::Array<SC> vals(maxEntries);
826 nonconst_local_inds_host_view_type inds_v(inds.data(), maxEntries);
827 nonconst_values_host_view_type vals_v(
reinterpret_cast<IST*
>(vals.data()), maxEntries);
829 this->
inputMatrix_->getLocalRowCopy(row, inds_v, vals_v, numEntries);
830 vals.resize(numEntries);
831 inds.resize(numEntries);
832 return StridedRowView(vals, inds);
835 local_inds_host_view_type colinds;
836 values_host_view_type values;
837 this->
inputMatrix_->getLocalRowView(row, colinds, values);
838 return StridedRowView(values, colinds, 1, colinds.size());
842template <
class MatrixType,
class LocalScalarType>
845 X_localBlocks_.clear();
846 Y_localBlocks_.clear();
847 X_local_ = HostViewLocal();
848 Y_local_ = HostViewLocal();
849 Container<MatrixType>::clearBlocks();
855template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
857 StridedRowView(h_vals_type vals_, h_inds_type inds_,
int blockSize_,
size_t nnz_)
860 , blockSize(blockSize_)
863template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
865 StridedRowView(Teuchos::Array<SC>& vals_, Teuchos::Array<LO>& inds_)
869 , nnz(vals_.size()) {
870 valsCopy.swap(vals_);
871 indsCopy.swap(inds_);
874template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
876 val(
size_t i)
const {
877#ifdef HAVE_IFPACK2_DEBUG
878 TEUCHOS_TEST_FOR_EXCEPTION(i >= nnz, std::runtime_error,
879 "Out-of-bounds access into Ifpack2::Container::StridedRowView");
881 if (vals.size() > 0) {
885 return vals[i * blockSize];
890template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
891LocalOrdinal StridedRowView<Scalar, LocalOrdinal, GlobalOrdinal, Node>::
892 ind(
size_t i)
const {
893#ifdef HAVE_IFPACK2_DEBUG
894 TEUCHOS_TEST_FOR_EXCEPTION(i >= nnz, std::runtime_error,
895 "Out-of-bounds access into Ifpack2::Container::StridedRowView");
898 if (inds.size() > 0) {
902 return inds[i / blockSize] * blockSize + i % blockSize;
907template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
916template <
class MatrixType>
918 return obj.
print(os);
921#define IFPACK2_CONTAINER_INSTANT(S, LO, GO, N) \
922 template class Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N>>; \
923 template class Ifpack2::ContainerImpl<Tpetra::RowMatrix<S, LO, GO, N>, S>; \
924 template class Ifpack2::Details::StridedRowView<S, LO, GO, N>; \
925 template std::ostream& operator<< <Tpetra::RowMatrix<S, LO, GO, N>>( \
926 std::ostream& os, const Ifpack2::Container<Tpetra::RowMatrix<S, LO, GO, N>>& obj);
Declaration and definition of the Ifpack2::Details::MultiVectorLocalGatherScatter class.
virtual ~Container()
Destructor.
Definition Ifpack2_Container_def.hpp:80
bool hasBlockCrs_
Whether the input matrix is a BlockCRS matrix.
Definition Ifpack2_Container_decl.hpp:279
Teuchos::RCP< const crs_matrix_type > inputCrsMatrix_
The input matrix, dynamic cast to CrsMatrix. May be null.
Definition Ifpack2_Container_decl.hpp:255
bool IsParallel_
Whether the problem is distributed across multiple MPI processes.
Definition Ifpack2_Container_decl.hpp:271
int numBlocks_
The number of blocks (partitions) in the container.
Definition Ifpack2_Container_decl.hpp:261
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:84
static std::string getName()
Definition Ifpack2_Container_def.hpp:146
typename Kokkos::ArithTraits< SC >::val_type ISC
Internal representation of Scalar in Kokkos::View.
Definition Ifpack2_Container_decl.hpp:104
Teuchos::RCP< vector_type > Diag_
Diagonal elements.
Definition Ifpack2_Container_decl.hpp:269
int bcrsBlockSize_
If hasBlockCrs_, the number of DOFs per vertex. Otherwise 1.
Definition Ifpack2_Container_decl.hpp:281
Teuchos::RCP< const block_crs_matrix_type > inputBlockMatrix_
The input matrix, dynamic cast to BlockCrsMatrix. May be null.
Definition Ifpack2_Container_decl.hpp:258
virtual void DoGSBlock(ConstHostView 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:151
virtual void applyMV(const mv_type &X, mv_type &Y) const
Wrapper for apply with MultiVector.
Definition Ifpack2_Container_def.hpp:134
LO NumLocalRows_
Number of local rows in input matrix.
Definition Ifpack2_Container_decl.hpp:273
bool isInitialized() const
Whether the container has been successfully initialized.
Definition Ifpack2_Container_def.hpp:123
void setBlockSizes(const Teuchos::Array< Teuchos::Array< LO > > &partitions)
Initialize arrays with information about block sizes.
Definition Ifpack2_Container_def.hpp:89
LO scalarsPerRow_
Definition Ifpack2_Container_decl.hpp:286
Teuchos::Array< LO > blockSizes_
Number of rows in each block.
Definition Ifpack2_Container_decl.hpp:265
GO NumGlobalNonzeros_
Number of nonzeros in input matrix.
Definition Ifpack2_Container_decl.hpp:277
Container(const Teuchos::RCP< const row_matrix_type > &matrix, const Teuchos::Array< Teuchos::Array< LO > > &partitions, bool pointIndexed)
Constructor.
Definition Ifpack2_Container_def.hpp:21
virtual std::ostream & print(std::ostream &os) const =0
Print basic information about the container to os.
virtual void weightedApplyMV(const mv_type &X, mv_type &Y, vector_type &W) const
Wrapper for weightedApply with MultiVector.
Definition Ifpack2_Container_def.hpp:140
Teuchos::RCP< const row_matrix_type > inputMatrix_
The input matrix to the constructor.
Definition Ifpack2_Container_decl.hpp:252
bool pointIndexed_
(If hasBlockCrs_) Whether the blocks are described using sub-block row indices instead of full block ...
Definition Ifpack2_Container_decl.hpp:283
bool IsInitialized_
If true, the container has been successfully initialized.
Definition Ifpack2_Container_decl.hpp:289
Teuchos::Array< LO > blockRows_
Local indices of the rows of the input matrix that belong to this block.
Definition Ifpack2_Container_decl.hpp:263
GO NumGlobalRows_
Number of global rows in input matrix.
Definition Ifpack2_Container_decl.hpp:275
bool isComputed() const
Whether the container has been successfully computed.
Definition Ifpack2_Container_def.hpp:128
typename mv_type::dual_view_type::t_host HostView
Definition Ifpack2_Container_decl.hpp:109
Teuchos::Array< LO > blockOffsets_
Starting index in blockRows_ of local row indices for each block.
Definition Ifpack2_Container_decl.hpp:267
bool IsComputed_
If true, the container has been successfully computed.
Definition Ifpack2_Container_decl.hpp:291
The implementation of the numerical features of Container (Jacobi, Gauss-Seidel, SGS)....
Definition Ifpack2_Container_decl.hpp:311
std::vector< HostSubviewLocal > X_localBlocks_
Views for holding pieces of X corresponding to each block.
Definition Ifpack2_Container_decl.hpp:493
HostViewLocal X_local_
Scratch vectors used in apply().
Definition Ifpack2_Container_decl.hpp:477
virtual void setParameters(const Teuchos::ParameterList &List)
Set parameters, if any.
Definition Ifpack2_Container_def.hpp:443
Details::StridedRowView< SC, LO, GO, NO > getInputRowView(LO row) const
View a row of the input matrix.
Definition Ifpack2_Container_def.hpp:803
std::vector< HostSubviewLocal > Y_localBlocks_
Views for holding pieces of Y corresponding to each block.
Definition Ifpack2_Container_decl.hpp:496
virtual void weightedApply(ConstHostView X, HostView Y, ConstHostView D, int blockIndex, Teuchos::ETransp mode=Teuchos::NO_TRANS, SC alpha=Teuchos::ScalarTraits< SC >::one(), SC beta=Teuchos::ScalarTraits< SC >::zero()) const
Definition Ifpack2_Container_def.hpp:648
void applyMV(const 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:456
virtual void apply(ConstHostView 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:539
LocalScalarType LSC
The internal representation of LocalScalarType in Kokkos::View.
Definition Ifpack2_Container_decl.hpp:330
void DoGSBlock(ConstHostView 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:231
virtual void solveBlock(ConstHostSubviewLocal X, HostSubviewLocal Y, int blockIndex, Teuchos::ETransp mode, const LSC alpha, const LSC beta) const
Definition Ifpack2_Container_def.hpp:481
HostViewLocal weightedApplyScratch_
Definition Ifpack2_Container_decl.hpp:490
static std::string getName()
Definition Ifpack2_Container_def.hpp:475
LO translateRowToCol(LO row)
Definition Ifpack2_Container_def.hpp:493
virtual ~ContainerImpl()
Destructor.
Definition Ifpack2_Container_def.hpp:439
void weightedApplyMV(const 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:464
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:447
Implementation detail of Ifpack2::Container subclasses.
Definition Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:52
Ifpack2 implementation details.
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:40
Structure for read-only views of general matrix rows.
Definition Ifpack2_Container_decl.hpp:506
StridedRowView(h_vals_type vals_, h_inds_type inds_, int blockSize_, size_t nnz_)
Constructor for row views (preferred).
Definition Ifpack2_Container_def.hpp:857