43 #ifndef IFPACK2_BANDEDCONTAINER_DEF_HPP 44 #define IFPACK2_BANDEDCONTAINER_DEF_HPP 46 #include "Teuchos_LAPACK.hpp" 47 #include "Tpetra_CrsMatrix.hpp" 53 # include "Teuchos_DefaultMpiComm.hpp" 55 # include "Teuchos_DefaultSerialComm.hpp" 61 template<
class MatrixType,
class LocalScalarType>
64 const Teuchos::ArrayView<const local_ordinal_type>& localRows) :
65 Container<MatrixType> (matrix, localRows),
66 numRows_ (localRows.size ()),
72 typedef Tpetra::Map<local_ordinal_type, global_ordinal_type, node_type> map_type;
73 typedef typename Teuchos::ArrayView<const local_ordinal_type>::size_type size_type;
74 TEUCHOS_TEST_FOR_EXCEPTION(
75 ! matrix->hasColMap (), std::invalid_argument,
"Ifpack2::BandedContainer: " 76 "The constructor's input matrix must have a column Map.");
79 const map_type& rowMap = * (matrix->getRowMap ());
80 const size_type numRows = localRows.size ();
81 bool rowIndicesValid =
true;
82 Teuchos::Array<local_ordinal_type> invalidLocalRowIndices;
83 for (size_type i = 0; i < numRows; ++i) {
84 if (! rowMap.isNodeLocalElement (localRows[i])) {
85 rowIndicesValid =
false;
86 invalidLocalRowIndices.push_back (localRows[i]);
90 TEUCHOS_TEST_FOR_EXCEPTION(
91 ! rowIndicesValid, std::invalid_argument,
"Ifpack2::BandedContainer: " 92 "On process " << rowMap.getComm ()->getRank () <<
" of " 93 << rowMap.getComm ()->getSize () <<
", in the given set of local row " 94 "indices localRows = " << Teuchos::toString (localRows) <<
", the following " 95 "entries are not valid local row indices on the calling process: " 96 << Teuchos::toString (invalidLocalRowIndices) <<
".");
99 Teuchos::RCP<const Teuchos::Comm<int> > localComm =
100 Teuchos::rcp (
new Teuchos::MpiComm<int> (MPI_COMM_SELF));
102 Teuchos::RCP<const Teuchos::Comm<int> > localComm =
103 Teuchos::rcp (
new Teuchos::SerialComm<int> ());
109 localMap_ = rcp (
new map_type (numRows_, indexBase, localComm));
112 template<
class MatrixType,
class LocalScalarType>
115 const Teuchos::ArrayView<const local_ordinal_type>& localRows) :
116 Container<MatrixType> (matrix, localRows)
118 TEUCHOS_TEST_FOR_EXCEPTION
119 (
true, std::logic_error,
"Ifpack2::BandedContainer: Not implemented for " 120 "LocalScalarType = " << Teuchos::TypeNameTraits<LocalScalarType>::name ()
125 template<
class MatrixType,
class LocalScalarType>
130 template<
class MatrixType,
class LocalScalarType>
135 template<
class MatrixType,
class LocalScalarType>
139 typedef typename Teuchos::ArrayView<const local_ordinal_type>::size_type size_type;
141 if(List.isParameter(
"relaxation: banded container superdiagonals")) {
142 kl_ = List.get<
int>(
"relaxation: banded container superdiagonals");
144 if(List.isParameter(
"relaxation: banded container subdiagonals")) {
145 ku_ = List.get<
int>(
"relaxation: banded container subdiagonals");
150 if (ku_ == -1 || kl_ == -1) {
152 const Teuchos::ArrayView<const local_ordinal_type> localRows = this->getLocalRows ();
154 const size_type numRows = localRows.size ();
156 Teuchos::RCP<const row_matrix_type> matrix = this->getMatrix();
159 for (size_type i = 0; i < numRows; ++i) {
160 Teuchos::ArrayView< const local_ordinal_type > indices;
161 Teuchos::ArrayView< const scalar_type > values;
162 matrix->getLocalRowView(localRows[i], indices, values);
164 size_type min_col_it = numRows > 0 ? numRows-1 : 0;
165 size_type max_col_it = 0;
167 size_type cntCols = 0;
170 for(size_type c = 0; c < indices.size(); c++) {
173 for (size_type j=0; j<numRows; ++j) {
174 if (localRows[j] == lColIdx) {
175 if (localRows[min_col_it] > lColIdx) {
178 if (localRows[max_col_it] < lColIdx) {
184 if (cntCols == numRows)
break;
199 TEUCHOS_TEST_FOR_EXCEPTION
200 (kl_==-1 || ku_==-1, std::invalid_argument,
201 "Ifpack2::BandedContainer::setParameters: the user must provide the number" 202 " of sub- and superdiagonals in the 'kl' and 'ku' parameters.");
205 template<
class MatrixType,
class LocalScalarType>
213 template<
class MatrixType,
class LocalScalarType>
221 TEUCHOS_TEST_FOR_EXCEPTION
222 (kl_==-1 || ku_==-1, std::invalid_argument,
223 "Ifpack2::BandedContainer::initialize: the user must provide the number of" 224 " sub- and superdiagonals in the 'kl' and 'ku' parameters. Make sure that " 225 "you call BandedContainer<T>::setParameters!");
228 diagBlock_ = Teuchos::rcp(
new Teuchos::SerialBandDenseMatrix<int, local_scalar_type>(numRows_, numRows_, kl_ , kl_+ku_ ));
232 IsInitialized_ =
false;
236 diagBlock_->putScalar (Teuchos::ScalarTraits<local_scalar_type>::zero ());
237 std::fill (ipiv_.begin (), ipiv_.end (), 0);
239 IsInitialized_ =
true;
242 template<
class MatrixType,
class LocalScalarType>
250 template<
class MatrixType,
class LocalScalarType>
255 TEUCHOS_TEST_FOR_EXCEPTION(
256 static_cast<size_t> (ipiv_.size ()) != numRows_, std::logic_error,
257 "Ifpack2::BandedContainer::compute: ipiv_ array has the wrong size. " 258 "Please report this bug to the Ifpack2 developers.");
261 if (! this->isInitialized ()) {
266 extract (this->getMatrix ());
272 template<
class MatrixType,
class LocalScalarType>
280 template<
class MatrixType,
class LocalScalarType>
285 Teuchos::LAPACK<int, local_scalar_type> lapack;
289 TEUCHOS_TEST_FOR_EXCEPTION(diagBlock_->values()==0, std::invalid_argument,
290 "BandedContainer<T>::factor: Diagonal block is an empty SerialBandDenseMatrix<T>!");
291 TEUCHOS_TEST_FOR_EXCEPTION(diagBlock_->upperBandwidth()<diagBlock_->lowerBandwidth(), std::invalid_argument,
292 "BandedContainer<T>::factor: Diagonal block needs kl additional superdiagonals for factorization! However, the number of superdiagonals is smaller than the number of subdiagonals!");
294 lapack.GBTRF (diagBlock_->numRows(),
295 diagBlock_->numCols(),
296 diagBlock_->lowerBandwidth(),
297 diagBlock_->upperBandwidth()-diagBlock_->lowerBandwidth(),
298 diagBlock_->values(),
299 diagBlock_->stride(),
304 TEUCHOS_TEST_FOR_EXCEPTION(
305 INFO < 0, std::logic_error,
"Ifpack2::BandedContainer::factor: " 306 "LAPACK's _GBTRF (LU factorization with partial pivoting) was called " 307 "incorrectly. INFO = " << INFO <<
" < 0. " 308 "Please report this bug to the Ifpack2 developers.");
312 TEUCHOS_TEST_FOR_EXCEPTION(
313 INFO > 0, std::runtime_error,
"Ifpack2::BandedContainer::factor: " 314 "LAPACK's _GBTRF (LU factorization with partial pivoting) reports that the " 315 "computed U factor is exactly singular. U(" << INFO <<
"," << INFO <<
") " 316 "(one-based index i) is exactly zero. This probably means that the input " 317 "matrix has a singular diagonal block.");
320 template<
class MatrixType,
class LocalScalarType>
328 template<
class MatrixType,
class LocalScalarType>
333 Teuchos::ETransp mode,
334 LocalScalarType alpha,
335 LocalScalarType beta)
const 337 using Teuchos::ArrayRCP;
340 using Teuchos::rcpFromRef;
342 TEUCHOS_TEST_FOR_EXCEPTION(
343 X.getLocalLength () != Y.getLocalLength (),
344 std::logic_error,
"Ifpack2::BandedContainer::applyImpl: X and Y have " 345 "incompatible dimensions (" << X.getLocalLength () <<
" resp. " 346 << Y.getLocalLength () <<
"). Please report this bug to " 347 "the Ifpack2 developers.");
348 TEUCHOS_TEST_FOR_EXCEPTION(
349 localMap_->getNodeNumElements () != X.getLocalLength (),
350 std::logic_error,
"Ifpack2::BandedContainer::applyImpl: The inverse " 351 "operator and X have incompatible dimensions (" <<
352 localMap_->getNodeNumElements () <<
" resp. " 353 << X.getLocalLength () <<
"). Please report this bug to " 354 "the Ifpack2 developers.");
355 TEUCHOS_TEST_FOR_EXCEPTION(
356 localMap_->getNodeNumElements () != Y.getLocalLength (),
357 std::logic_error,
"Ifpack2::BandedContainer::applyImpl: The inverse " 358 "operator and Y have incompatible dimensions (" <<
359 localMap_->getNodeNumElements () <<
" resp. " 360 << Y.getLocalLength () <<
"). Please report this bug to " 361 "the Ifpack2 developers.");
362 TEUCHOS_TEST_FOR_EXCEPTION(
363 X.getLocalLength() !=
static_cast<size_t> (mode == Teuchos::NO_TRANS ? diagBlock_->numCols() : diagBlock_->numRows()),
364 std::logic_error,
"Ifpack2::BandedContainer::applyImpl: The input " 365 "multivector X has incompatible dimensions from those of the " 366 "inverse operator (" << X.getLocalLength () <<
" vs. " 367 << (mode == Teuchos::NO_TRANS ? diagBlock_->numCols() : diagBlock_->numRows())
368 <<
"). Please report this bug to the Ifpack2 developers.");
369 TEUCHOS_TEST_FOR_EXCEPTION(
370 Y.getLocalLength() !=
static_cast<size_t> (mode == Teuchos::NO_TRANS ? diagBlock_->numRows() : diagBlock_->numCols()),
371 std::logic_error,
"Ifpack2::BandedContainer::applyImpl: The output " 372 "multivector Y has incompatible dimensions from those of the " 373 "inverse operator (" << Y.getLocalLength () <<
" vs. " 374 << (mode == Teuchos::NO_TRANS ? diagBlock_->numRows() : diagBlock_->numCols())
375 <<
"). Please report this bug to the Ifpack2 developers.");
377 typedef Teuchos::ScalarTraits<local_scalar_type> STS;
378 const int numVecs =
static_cast<int> (X.getNumVectors ());
379 if (alpha == STS::zero ()) {
380 if (beta == STS::zero ()) {
384 Y.putScalar (STS::zero ());
391 Teuchos::LAPACK<int, local_scalar_type> lapack;
395 RCP<local_mv_type> Y_tmp;
396 if (beta == STS::zero () ){
398 Y_tmp = rcpFromRef (Y);
401 Y_tmp = rcp (
new local_mv_type (X));
403 const int Y_stride =
static_cast<int> (Y_tmp->getStride ());
404 ArrayRCP<local_scalar_type> Y_view = Y_tmp->get1dViewNonConst ();
408 const char trans =(mode == Teuchos::CONJ_TRANS ?
'C' : (mode == Teuchos::TRANS ?
'T' :
'N'));
411 diagBlock_->numCols(),
412 diagBlock_->lowerBandwidth(),
413 diagBlock_->upperBandwidth()-diagBlock_->lowerBandwidth(),
415 diagBlock_->values(),
416 diagBlock_->stride(),
417 ipiv_.getRawPtr (), Y_ptr, Y_stride, &INFO);
419 TEUCHOS_TEST_FOR_EXCEPTION(
420 INFO != 0, std::runtime_error,
"Ifpack2::BandedContainer::applyImpl: " 421 "LAPACK's _GBTRS (solve using LU factorization with partial pivoting) " 422 "failed with INFO = " << INFO <<
" != 0.");
424 if (beta != STS::zero ()) {
425 Y.update (alpha, *Y_tmp, beta);
427 else if (! Y.isConstantStride ()) {
428 Tpetra::deep_copy (Y, *Y_tmp);
433 template<
class MatrixType,
class LocalScalarType>
438 Teuchos::ETransp mode,
439 LocalScalarType alpha,
440 LocalScalarType beta)
const 445 template<
class MatrixType,
class LocalScalarType>
448 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
449 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
450 Teuchos::ETransp mode,
454 using Teuchos::ArrayView;
469 const size_t numVecs = X.getNumVectors ();
471 TEUCHOS_TEST_FOR_EXCEPTION(
472 ! IsComputed_, std::runtime_error,
"Ifpack2::BandedContainer::apply: " 473 "You must have called the compute() method before you may call apply(). " 474 "You may call the apply() method as many times as you want after calling " 475 "compute() once, but you must have called compute() at least once.");
476 TEUCHOS_TEST_FOR_EXCEPTION(
477 numVecs != Y.getNumVectors (), std::runtime_error,
478 "Ifpack2::BandedContainer::apply: X and Y have different numbers of " 479 "vectors. X has " << X.getNumVectors ()
480 <<
", but Y has " << X.getNumVectors () <<
".");
512 X_ = rcp (
new local_mv_type (localMap_, numVecs));
514 RCP<local_mv_type> X_local = X_;
515 TEUCHOS_TEST_FOR_EXCEPTION(
516 X_local->getLocalLength () != numRows_, std::logic_error,
517 "Ifpack2::BandedContainer::apply: " 518 "X_local has length " << X_local->getLocalLength () <<
", which does " 519 "not match numRows_ = " << numRows_ <<
". Please report this bug to " 520 "the Ifpack2 developers.");
521 ArrayView<const local_ordinal_type> localRows = this->getLocalRows ();
522 mvgs.gather (*X_local, X, localRows);
530 Y_ = rcp (
new local_mv_type (localMap_, numVecs));
532 RCP<local_mv_type> Y_local = Y_;
533 TEUCHOS_TEST_FOR_EXCEPTION(
534 Y_local->getLocalLength () != numRows_, std::logic_error,
535 "Ifpack2::BandedContainer::apply: " 536 "Y_local has length " << X_local->getLocalLength () <<
", which does " 537 "not match numRows_ = " << numRows_ <<
". Please report this bug to " 538 "the Ifpack2 developers.");
539 mvgs.gather (*Y_local, Y, localRows);
543 this->applyImpl (*X_local, *Y_local, mode, as<local_scalar_type> (alpha),
544 as<local_scalar_type> (beta));
548 mvgs.scatter (Y, *Y_local, localRows);
551 template<
class MatrixType,
class LocalScalarType>
554 apply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ,
555 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ,
563 template<
class MatrixType,
class LocalScalarType>
566 weightedApply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
567 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
568 const Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& D,
569 Teuchos::ETransp mode,
573 using Teuchos::ArrayRCP;
574 using Teuchos::ArrayView;
575 using Teuchos::Range1D;
578 using Teuchos::rcp_const_cast;
581 typedef Teuchos::ScalarTraits<scalar_type> STS;
583 TEUCHOS_TEST_FOR_EXCEPTION(
584 true, std::runtime_error,
"Ifpack2::BandedContainer::" 585 "weightedApply: This code is not tested and not used. Expect bugs.");
601 global_ordinal_type,
node_type> local_vec_type;
604 const size_t numVecs = X.getNumVectors ();
606 TEUCHOS_TEST_FOR_EXCEPTION(
607 ! IsComputed_, std::runtime_error,
"Ifpack2::BandedContainer::" 608 "weightedApply: You must have called the compute() method before you may " 609 "call apply(). You may call the apply() method as many times as you want " 610 "after calling compute() once, but you must have called compute() at least " 612 TEUCHOS_TEST_FOR_EXCEPTION(
613 numVecs != Y.getNumVectors (), std::runtime_error,
614 "Ifpack2::BandedContainer::weightedApply: X and Y have different numbers " 615 "of vectors. X has " << X.getNumVectors () <<
", but Y has " 616 << X.getNumVectors () <<
".");
647 X_ = rcp (
new local_mv_type (localMap_, numVecs));
649 RCP<local_mv_type> X_local = X_;
650 TEUCHOS_TEST_FOR_EXCEPTION(
651 X_local->getLocalLength () != numRows_, std::logic_error,
652 "Ifpack2::BandedContainer::weightedApply: " 653 "X_local has length " << X_local->getLocalLength () <<
", which does " 654 "not match numRows_ = " << numRows_ <<
". Please report this bug to " 655 "the Ifpack2 developers.");
656 ArrayView<const local_ordinal_type> localRows = this->getLocalRows ();
657 mvgs.gather (*X_local, X, localRows);
665 Y_ = rcp (
new local_mv_type (localMap_, numVecs));
667 RCP<local_mv_type> Y_local = Y_;
668 TEUCHOS_TEST_FOR_EXCEPTION(
669 Y_local->getLocalLength () != numRows_, std::logic_error,
670 "Ifpack2::BandedContainer::weightedApply: " 671 "Y_local has length " << X_local->getLocalLength () <<
", which does " 672 "not match numRows_ = " << numRows_ <<
". Please report this bug to " 673 "the Ifpack2 developers.");
674 mvgs.gather (*Y_local, Y, localRows);
686 RCP<local_vec_type> D_local = rcp (
new local_vec_type (localMap_));
687 TEUCHOS_TEST_FOR_EXCEPTION(
688 D_local->getLocalLength () != numRows_, std::logic_error,
689 "Ifpack2::BandedContainer::weightedApply: " 690 "D_local has length " << X_local->getLocalLength () <<
", which does " 691 "not match numRows_ = " << numRows_ <<
". Please report this bug to " 692 "the Ifpack2 developers.");
693 mvgs.gather (*D_local, D, localRows);
694 RCP<local_mv_type> X_scaled = rcp (
new local_mv_type (localMap_, numVecs));
695 X_scaled->elementWiseMultiply (STS::one (), *D_local, *X_local, STS::zero ());
702 RCP<local_mv_type> Y_temp;
703 if (beta == STS::zero ()) {
706 Y_temp = rcp (
new local_mv_type (localMap_, numVecs));
710 applyImpl (*X_scaled, *Y_temp, mode, STS::one (), STS::zero ());
717 Y_local->elementWiseMultiply (alpha, *D_local, *Y_temp, beta);
721 mvgs.scatter (Y, *Y_local, localRows);
724 template<
class MatrixType,
class LocalScalarType>
727 weightedApply (
const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ,
728 Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ,
729 const Tpetra::Vector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& ,
737 template<
class MatrixType,
class LocalScalarType>
742 Teuchos::FancyOStream fos (Teuchos::rcpFromRef (os));
743 fos.setOutputToRootOnly (0);
748 template<
class MatrixType,
class LocalScalarType>
757 template<
class MatrixType,
class LocalScalarType>
762 std::ostringstream oss;
763 oss << Teuchos::Describable::description();
764 if (isInitialized()) {
766 oss <<
"{status = initialized, computed";
769 oss <<
"{status = initialized, not computed";
773 oss <<
"{status = not initialized, not computed";
780 template<
class MatrixType,
class LocalScalarType>
789 template<
class MatrixType,
class LocalScalarType>
793 const Teuchos::EVerbosityLevel verbLevel)
const 795 if(verbLevel==Teuchos::VERB_NONE)
return;
796 os <<
"================================================================================" << std::endl;
797 os <<
"Ifpack2::BandedContainer" << std::endl;
798 os <<
"Number of rows = " << numRows_ << std::endl;
799 os <<
"Number of subdiagonals = " << diagBlock_->lowerBandwidth() << std::endl;
800 os <<
"Number of superdiagonals = " << diagBlock_->upperBandwidth() << std::endl;
801 os <<
"isInitialized() = " << IsInitialized_ << std::endl;
802 os <<
"isComputed() = " << IsComputed_ << std::endl;
803 os <<
"================================================================================" << std::endl;
807 template<
class MatrixType,
class LocalScalarType>
811 const Teuchos::EVerbosityLevel verbLevel)
const 816 template<
class MatrixType,
class LocalScalarType>
819 extract (
const Teuchos::RCP<const row_matrix_type>& globalMatrix)
821 using Teuchos::Array;
822 using Teuchos::ArrayView;
823 using Teuchos::toString;
826 typedef Tpetra::Map<LO, GO, node_type> map_type;
827 const size_t inputMatrixNumRows = globalMatrix->getNodeNumRows ();
831 const int myRank = globalMatrix->getRowMap ()->getComm ()->getRank ();
832 const int numProcs = globalMatrix->getRowMap ()->getComm ()->getSize ();
836 ArrayView<const LO> localRows = this->getLocalRows ();
837 for (
size_t j = 0; j < numRows_; ++j) {
838 TEUCHOS_TEST_FOR_EXCEPTION(
840 static_cast<size_t> (localRows[j]) >= inputMatrixNumRows,
841 std::runtime_error,
"Ifpack2::BandedContainer::extract: On process " <<
842 myRank <<
" of " << numProcs <<
", localRows[j=" << j <<
"] = " <<
843 localRows[j] <<
", which is out of the valid range of local row indices " 844 "indices [0, " << (inputMatrixNumRows - 1) <<
"] for the input matrix.");
857 const map_type& globalRowMap = * (globalMatrix->getRowMap ());
858 const map_type& globalColMap = * (globalMatrix->getColMap ());
859 const map_type& globalDomMap = * (globalMatrix->getDomainMap ());
861 bool rowIndsValid =
true;
862 bool colIndsValid =
true;
863 Array<LO> localCols (numRows_);
866 Array<LO> invalidLocalRowInds;
867 Array<GO> invalidGlobalColInds;
868 for (
size_t i = 0; i < numRows_; ++i) {
870 const LO ii_local = localRows[i];
875 const GO jj_global = globalRowMap.getGlobalElement (ii_local);
876 if (jj_global == Teuchos::OrdinalTraits<GO>::invalid ()) {
882 rowIndsValid =
false;
883 invalidLocalRowInds.push_back (ii_local);
888 if (globalDomMap.isNodeGlobalElement (jj_global)) {
897 const LO jj_local = globalColMap.getLocalElement (jj_global);
898 if (jj_local == Teuchos::OrdinalTraits<local_ordinal_type>::invalid ()) {
899 colIndsValid =
false;
900 invalidGlobalColInds.push_back (jj_global);
903 localCols[i] = jj_local;
906 TEUCHOS_TEST_FOR_EXCEPTION(
907 ! rowIndsValid, std::logic_error,
"Ifpack2::BandedContainer::extract: " 908 "On process " << myRank <<
", at least one row index in the set of local " 909 "row indices given to the constructor is not a valid local row index in " 910 "the input matrix's row Map on this process. This should be impossible " 911 "because the constructor checks for this case. Here is the complete set " 912 "of invalid local row indices: " <<
toString (invalidLocalRowInds) <<
". " 913 "Please report this bug to the Ifpack2 developers.");
914 TEUCHOS_TEST_FOR_EXCEPTION(
915 ! colIndsValid, std::runtime_error,
"Ifpack2::BandedContainer::extract: " 916 "On process " << myRank <<
", " 917 "At least one row index in the set of row indices given to the constructor " 918 "does not have a corresponding column index in the input matrix's column " 919 "Map. This probably means that the column(s) in question is/are empty on " 920 "this process, which would make the submatrix to extract structurally " 921 "singular. Here is the compete set of invalid global column indices: " 922 <<
toString (invalidGlobalColInds) <<
".");
924 diagBlock_->putScalar (Teuchos::ScalarTraits<local_scalar_type>::zero ());
926 const size_t maxNumEntriesInRow = globalMatrix->getNodeMaxNumRowEntries ();
927 Array<scalar_type> val (maxNumEntriesInRow);
928 Array<local_ordinal_type> ind (maxNumEntriesInRow);
931 Teuchos::OrdinalTraits<local_ordinal_type>::invalid ();
932 for (
size_t i = 0; i < numRows_; ++i) {
935 globalMatrix->getLocalRowCopy (localRow, ind (), val (), numEntries);
937 for (
size_t k = 0; k < numEntries; ++k) {
949 if (localCol >= 0 && static_cast<size_t> (localCol) < inputMatrixNumRows) {
953 for (
size_t kk = 0; kk < numRows_; ++kk) {
954 if (localRows[kk] == localCol) {
959 (*diagBlock_) (i, jj) += val[k];
966 template<
class MatrixType,
class LocalScalarType>
969 extract (
const Teuchos::RCP<const row_matrix_type>& )
976 #define IFPACK2_BANDEDCONTAINER_INSTANT(S,LO,GO,N) \ 977 template class Ifpack2::BandedContainer< Tpetra::RowMatrix<S, LO, GO, N>, S >; 979 #endif // IFPACK2_BANDEDCONTAINER_HPP MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:131
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:340
MatrixType::node_type node_type
The Node type of the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:137
LocalScalarType local_scalar_type
The second template parameter of this class.
Definition: Ifpack2_BandedContainer_decl.hpp:333
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:133
MatrixType::global_ordinal_type global_ordinal_type
The type of global indices in the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:135
BandedContainer(const Teuchos::RCP< const row_matrix_type > &matrix, const Teuchos::ArrayView< const local_ordinal_type > &localRows)
Constructor.
Definition: Ifpack2_BandedContainer_def.hpp:63
MatrixType::local_ordinal_type local_ordinal_type
The type of local indices in the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:338
Definition: Ifpack2_Details_Amesos2Wrapper_decl.hpp:63
Interface for creating and solving a local linear problem.
Definition: Ifpack2_Container.hpp:103
LocalScalarType local_scalar_type
The second template parameter of this class.
Definition: Ifpack2_BandedContainer_decl.hpp:128
BELOS_DEPRECATED const char * toString(const StatusType status)
Preconditioners and smoothers for Tpetra sparse matrices.
Definition: Ifpack2_AdditiveSchwarz_decl.hpp:72
Store and solve a local Banded linear problem.
Definition: Ifpack2_BandedContainer_decl.hpp:108
Implementation detail of Ifpack2::Container subclasses.
Definition: Ifpack2_Details_MultiVectorLocalGatherScatter.hpp:85
MatrixType::scalar_type scalar_type
The type of entries in the input (global) matrix.
Definition: Ifpack2_BandedContainer_decl.hpp:336