46 #ifndef XPETRA_EPETRACRSMATRIX_HPP 47 #define XPETRA_EPETRACRSMATRIX_HPP 51 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 52 #ifdef HAVE_XPETRA_TPETRA 53 #include <Kokkos_View.hpp> 61 #include <Epetra_CrsMatrix.h> 62 #include <Epetra_Map.h> 69 #include "Xpetra_MapFactory.hpp" 77 template<
class EpetraGlobalOrdinal,
class Node>
79 :
public CrsMatrix<double, int, EpetraGlobalOrdinal, Node>
85 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 86 #ifdef HAVE_XPETRA_TPETRA 95 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
99 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
108 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
110 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
116 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
118 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
125 const Teuchos::RCP<Teuchos::ParameterList>& params) {
127 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
134 const Teuchos::RCP<Teuchos::ParameterList>& params) {
136 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
138 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 139 #ifdef HAVE_XPETRA_TPETRA 142 const local_matrix_type& lclMatrix,
143 const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
145 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
148 const local_matrix_type& lclMatrix,
149 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
150 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
151 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
152 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
153 const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
155 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
167 void allocateAllValues(
size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values) { }
168 void setAllValues(
const ArrayRCP<size_t> & rowptr,
const ArrayRCP<LocalOrdinal> & colind,
const ArrayRCP<Scalar> & values) { }
169 void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values)
const { }
176 const RCP<ParameterList> ¶ms=Teuchos::null) { }
182 const RCP< const Comm< int > >
getComm()
const {
return Teuchos::null; }
183 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
return Teuchos::null; }
184 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
return Teuchos::null; }
185 RCP< const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
getCrsGraph()
const {
return Teuchos::null; }
200 typename ScalarTraits< Scalar >::magnitudeType
getFrobeniusNorm()
const {
return ScalarTraits< Scalar >::magnitude(ScalarTraits< Scalar >::zero()); }
202 void getLocalRowCopy(
LocalOrdinal LocalRow,
const ArrayView< LocalOrdinal > &Indices,
const ArrayView< Scalar > &Values,
size_t &NumEntries)
const { }
213 void apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS,
Scalar alpha=ScalarTraits< Scalar >::one(),
Scalar beta=ScalarTraits< Scalar >::zero())
const { }
214 void apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode,
Scalar alpha,
Scalar beta,
bool sumInterfaceValues,
const RCP<
Import<LocalOrdinal, GlobalOrdinal, Node> >& regionInterfaceImporter,
const Teuchos::ArrayRCP<LocalOrdinal>& regionInterfaceLIDs)
const { }
215 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getDomainMap()
const {
return Teuchos::null; }
216 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getRangeMap()
const {
return Teuchos::null; }
219 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
224 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
227 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const {
return Teuchos::null; }
237 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
241 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 242 #ifdef HAVE_XPETRA_TPETRA 243 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 244 local_matrix_type getLocalMatrix ()
const {
246 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
249 local_matrix_type getLocalMatrixDevice ()
const {
251 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
253 typename local_matrix_type::HostMirror getLocalMatrixHost ()
const {
255 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
260 void setAllValues (
const typename local_matrix_type::row_map_type& ptr,
261 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ind,
262 const typename local_matrix_type::values_type& val)
265 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
269 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too." 277 Scalar one = Teuchos::ScalarTraits<Scalar>::one(), negone = -one;
284 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 287 :
public CrsMatrix <double, int, int, EpetraNode>
296 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 297 #ifdef HAVE_XPETRA_TPETRA 315 : mtx_(Teuchos::rcp(new Epetra_CrsMatrix(Copy,
toEpetra<
GlobalOrdinal,
Node>(rowMap), maxNumEntriesPerRow, true))), isFillResumed_(false)
321 : isFillResumed_(false)
323 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
324 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
336 : isFillResumed_(false)
338 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
339 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
354 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null):
355 isFillResumed_(false)
360 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
361 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
364 bool restrictComm=
false;
365 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
366 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
367 if(restrictComm && mtx_->NumMyRows()==0)
378 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) :
379 isFillResumed_(false)
384 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
385 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
388 bool restrictComm=
false;
389 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
391 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
399 const Teuchos::RCP<Teuchos::ParameterList>& params) :
400 isFillResumed_(false)
406 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
407 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
410 bool restrictComm=
false;
411 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
412 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
413 if(restrictComm && mtx_->NumMyRows()==0)
422 const Teuchos::RCP<Teuchos::ParameterList>& params) :
423 isFillResumed_(false)
429 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
430 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
433 bool restrictComm=
false;
434 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
436 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
439 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 440 #ifdef HAVE_XPETRA_TPETRA 466 const local_matrix_type& lclMatrix,
467 const Teuchos::RCP<Teuchos::ParameterList>& params = null) :
468 EpetraCrsMatrixT(lclMatrix, rowMap, colMap, Teuchos::null, Teuchos::null, params)
472 const local_matrix_type& lclMatrix,
473 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
474 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
475 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
476 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
477 const Teuchos::RCP<Teuchos::ParameterList>& params = null)
481 typedef typename local_matrix_type::value_type value_type;
482 typedef typename local_matrix_type::ordinal_type ordinal_type;
485 ordinal_type lclNumRows = lclMatrix.numRows ();
486 ordinal_type lclNumCols = lclMatrix.numCols ();
490 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
492 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
494 Teuchos::ArrayRCP< size_t > NumEntriesPerRowToAlloc(lclNumRows);
495 for (ordinal_type r = 0; r < lclNumRows; ++r) {
497 auto rowview = lclMatrix.row (r);
498 NumEntriesPerRowToAlloc[r] = rowview.length;
502 isFillResumed_ =
false;
503 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
504 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
507 for (ordinal_type r = 0; r < lclNumRows; ++r) {
509 auto rowview = lclMatrix.row (r);
512 Teuchos::ArrayRCP<ordinal_type> indout(rowview.length,Teuchos::ScalarTraits<ordinal_type>::zero());
513 Teuchos::ArrayRCP<value_type> valout(rowview.length,Teuchos::ScalarTraits<value_type>::zero());
515 for(ordinal_type c = 0; c < rowview.length; c++) {
516 value_type value = rowview.value (c);
517 ordinal_type colidx = rowview.colidx (c);
520 "Xpetra::EpetraCrsMatrixT: local matrix contains column elements which are not in the provided column map!");
525 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
529 if (!domainMap.is_null() && !rangeMap.is_null())
535 isInitializedLocalMatrix_ =
false;
551 XPETRA_ERR_CHECK(mtx_->InsertGlobalValues(globalRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
558 XPETRA_ERR_CHECK(mtx_->InsertMyValues(localRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
566 const std::string tfecfFuncName(
"replaceGlobalValues");
567 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
568 ": Fill must be active in order to call this method. If you have already " 569 "called fillComplete(), you need to call resumeFill() before you can " 572 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
573 std::runtime_error,
": values.size() must equal indices.size().");
576 XPETRA_ERR_CHECK(mtx_->ReplaceGlobalValues(globalRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
585 const std::string tfecfFuncName(
"replaceLocalValues");
586 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
587 ": Fill must be active in order to call this method. If you have already " 588 "called fillComplete(), you need to call resumeFill() before you can " 591 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
592 std::runtime_error,
": values.size() must equal indices.size().");
595 XPETRA_ERR_CHECK(mtx_->ReplaceMyValues(localRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
608 void allocateAllValues(
size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind, ArrayRCP<Scalar>& values) {
619 bool ownMemory =
false;
623 Epetra_IntSerialDenseVector& myColind = mtx_->ExpertExtractIndices();
624 myColind.Resize(numNonZeros);
625 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
629 double *& myValues = mtx_->ExpertExtractValues();
631 myValues =
new double[numNonZeros];
632 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
636 void setAllValues(
const ArrayRCP<size_t>& rowptr,
const ArrayRCP<LocalOrdinal>& colind,
const ArrayRCP<Scalar>& values) {
641 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
643 "An exception is thrown to let you know that you mismatched your pointers.");
646 if (values.size() > 0) {
648 "An exception is thrown to let you know that you mismatched your pointers.");
650 "An exception is thrown to let you know that you mismatched your pointers.");
657 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
658 myRowptr.Resize(N+1);
659 for (
size_t i = 0; i < N+1; i++)
660 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
665 void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values)
const {
669 bool ownMemory =
false;
676 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
678 for (
size_t i = 0; i < n+1; i++)
679 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
682 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
685 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
693 bool ownMemory =
false;
697 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
708 const RCP<ParameterList> & =Teuchos::null) {
712 isFillResumed_ =
false;
715 const Epetra_Import * myimport =0;
716 const Epetra_Export * myexport =0;
718 if(!importer.is_null()) {
720 myimport = eImporter.getEpetra_Import().getRawPtr();
722 if(!exporter.is_null()) {
724 myexport = eExporter.getEpetra_Export().getRawPtr();
727 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
729 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::expertStaticFillComplete FAILED!");
737 void resumeFill(
const RCP< ParameterList > &=Teuchos::null) {
741 isFillResumed_ =
true;
749 isFillResumed_ =
false;
751 bool doOptimizeStorage =
true;
752 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
753 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
762 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
764 bool doOptimizeStorage =
true;
765 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
766 mtx_->FillComplete(doOptimizeStorage);
775 const RCP<const Epetra_Import> & myImport = eImporter.getEpetra_Import();
777 if(myImport==Teuchos::null)
778 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
780 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
781 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::replaceDomainMapAndImporter FAILED!");
793 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRowMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->RowMap()); }
796 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getColMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->ColMap()); }
799 RCP< const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
getCrsGraph()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getCrsGraph");
return toXpetra<GlobalOrdinal,Node>(mtx_->Graph()); }
854 XPETRA_ERR_CHECK(mtx_->ExtractMyRowCopy(LocalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
855 NumEntries = numEntries;
863 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowCopy(GlobalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
864 NumEntries = numEntries;
875 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
876 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
878 indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
879 values = ArrayView<const double>(eValues, numEntries);
890 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
891 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
893 indices = ArrayView<const int>(eIndices, numEntries);
894 values = ArrayView<const double>(eValues, numEntries);
900 XPETRA_ERR_CHECK(mtx_->ExtractDiagonalCopy(toEpetra<GlobalOrdinal,Node>(diag)));
915 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
931 void apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS,
Scalar alpha=ScalarTraits< Scalar >::one(),
Scalar beta=ScalarTraits< Scalar >::zero())
const {
939 TEUCHOS_TEST_FOR_EXCEPTION((mode != Teuchos::NO_TRANS) && (mode != Teuchos::TRANS),
Xpetra::Exceptions::NotImplemented,
"Xpetra::EpetraCrsMatrixT->apply() only accept mode == NO_TRANS or mode == TRANS");
943 TEUCHOS_TEST_FOR_EXCEPTION(mtx_->UseTranspose(),
Xpetra::Exceptions::NotImplemented,
"An exception is throw to let you know that Xpetra::EpetraCrsMatrixT->apply() do not take into account the UseTranspose() parameter of Epetra_CrsMatrix.");
945 RCP<Epetra_MultiVector> epY = eY.getEpetra_MultiVector();
948 RCP<Epetra_MultiVector> tmp = Teuchos::rcp(
new Epetra_MultiVector(*epY));
950 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
957 void apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode,
Scalar alpha,
Scalar beta,
bool sumInterfaceValues,
const RCP<
Import<LocalOrdinal, GlobalOrdinal, Node> >& regionInterfaceImporter,
const Teuchos::ArrayRCP<LocalOrdinal>& regionInterfaceLIDs)
const {
962 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getDomainMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getDomainMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->DomainMap()); }
965 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getRangeMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRangeMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->RangeMap()); }
977 std::ostringstream oss;
980 oss <<
"{status = fill complete" 987 oss <<
"{status = fill not complete" 997 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
1003 using Teuchos::VERB_DEFAULT;
1004 using Teuchos::VERB_NONE;
1005 using Teuchos::VERB_LOW;
1006 using Teuchos::VERB_MEDIUM;
1007 using Teuchos::VERB_HIGH;
1008 using Teuchos::VERB_EXTREME;
1009 Teuchos::EVerbosityLevel vl = verbLevel;
1010 if (vl == VERB_DEFAULT) vl = VERB_LOW;
1011 RCP<const Comm<int> > comm = this->
getComm();
1012 const int myImageID = comm->getRank(),
1013 numImages = comm->getSize();
1018 width = std::max<size_t>(width,11) + 2;
1019 Teuchos::OSTab tab(out);
1027 if (vl != VERB_NONE) {
1028 if (myImageID == 0) out << this->
description() << std::endl;
1034 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
1035 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
1040 if (myImageID == 0) out <<
"\nColumn map is row map.";
1043 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1049 if (myImageID == 0) out <<
"\nDomain map is row map.";
1052 if (myImageID == 0) out <<
"\nDomain map is row map.";
1055 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
1061 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
1064 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
1067 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
1071 if (myImageID == 0) out << std::endl;
1074 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
1075 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1076 if (myImageID == imageCtr) {
1077 out <<
"Node ID = " << imageCtr << std::endl;
1099 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
1100 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1101 if (myImageID == imageCtr) {
1102 out << std::setw(width) <<
"Node ID" 1103 << std::setw(width) <<
"Global Row" 1104 << std::setw(width) <<
"Num Entries";
1105 if (vl == VERB_EXTREME) {
1106 out << std::setw(width) <<
"(Index,Value)";
1112 out << std::setw(width) << myImageID
1113 << std::setw(width) << gid
1114 << std::setw(width) << nE;
1115 if (vl == VERB_EXTREME) {
1117 ArrayView<const GlobalOrdinal> rowinds;
1118 ArrayView<const Scalar> rowvals;
1120 for (
size_t j=0; j < nE; ++j) {
1121 out <<
" (" << rowinds[j]
1122 <<
", " << rowvals[j]
1127 ArrayView<const LocalOrdinal> rowinds;
1128 ArrayView<const Scalar> rowvals;
1130 for (
size_t j=0; j < nE; ++j) {
1131 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
1132 <<
", " << rowvals[j]
1150 Teuchos::LabeledObject::setObjectLabel(objectLabel);
1151 mtx_->SetLabel(objectLabel.c_str());
1157 : mtx_(Teuchos::rcp(new Epetra_CrsMatrix(*(matrix.mtx_)))), isFillResumed_(false)
1165 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->Map()); }
1175 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
1176 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1177 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1188 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
1189 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1190 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1201 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
1202 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1203 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1215 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
1216 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1217 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Caught nonzero error code " + std::to_string(err) +
" returned by Epetra.");
1222 const Epetra_Map* newMapEpetra = (!newMap.is_null())? &toEpetra<GlobalOrdinal,Node>(newMap) : 0;
1223 int err = mtx_->RemoveEmptyProcessesInPlace(newMapEpetra);
1224 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Caught nonzero error code " + std::to_string(err) +
" returned by Epetra.");
1236 EpetraCrsMatrixT(
const Teuchos::RCP<Epetra_CrsMatrix > &mtx) : mtx_(mtx), isFillResumed_(false) { }
1244 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1245 #ifdef HAVE_XPETRA_TPETRA 1246 #ifdef TPETRA_ENABLE_DEPRECATED_CODE 1249 local_matrix_type getLocalMatrix ()
const {
1250 return getLocalMatrixDevice();
1254 local_matrix_type getLocalMatrixDevice ()
const {
1257 "Xpetra::EpetraCrsMatrx only available on host for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
1258 TEUCHOS_UNREACHABLE_RETURN((local_matrix_type()));
1260 return getLocalMatrixHost();
1264 typename local_matrix_type::HostMirror getLocalMatrixHost ()
const {
1265 if (isInitializedLocalMatrix_)
1266 return localMatrix_;
1270 const int numRows = matrix->NumMyRows();
1271 const int numCols = matrix->NumMyCols();
1272 const int nnz = matrix->NumMyNonzeros();
1277 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
1278 TEUCHOS_TEST_FOR_EXCEPTION(rv, std::runtime_error,
"Xpetra::CrsMatrix<>::getLocalMatrix: failed in ExtractCrsDataPointers");
1281 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
1282 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1283 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
1286 typename local_matrix_type::index_type kokkosColind(colind, nnz);
1287 typename local_matrix_type::values_type kokkosVals (vals, nnz);
1289 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
1290 isInitializedLocalMatrix_ =
true;
1292 return localMatrix_;
1295 void setAllValues (
const typename local_matrix_type::row_map_type& ,
1296 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
1297 const typename local_matrix_type::values_type& )
1300 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
1306 mutable local_matrix_type localMatrix_;
1307 mutable bool isInitializedLocalMatrix_ =
false;
1310 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too." 1319 Scalar one = Teuchos::ScalarTraits<Scalar>::one(), negone = -one;
1339 #endif //#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 1341 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 1344 :
public CrsMatrix <double, int, long long, EpetraNode>
1353 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1354 #ifdef HAVE_XPETRA_TPETRA 1367 : mtx_(Teuchos::rcp(new Epetra_CrsMatrix(Copy,
toEpetra<
GlobalOrdinal,
Node>(rowMap), maxNumEntriesPerRow, true))), isFillResumed_(false)
1373 : isFillResumed_(false)
1375 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1376 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
1388 : isFillResumed_(false)
1390 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1391 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
1406 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null):
1407 isFillResumed_(false)
1412 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1413 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1416 bool restrictComm=
false;
1417 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1418 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
1419 if(restrictComm && mtx_->NumMyRows()==0)
1430 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) :
1431 isFillResumed_(false)
1436 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1437 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1440 bool restrictComm=
false;
1441 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1443 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
1451 const Teuchos::RCP<Teuchos::ParameterList>& params) :
1452 isFillResumed_(false)
1458 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1459 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1462 bool restrictComm=
false;
1463 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1464 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
1465 if(restrictComm && mtx_->NumMyRows()==0)
1474 const Teuchos::RCP<Teuchos::ParameterList>& params) :
1475 isFillResumed_(false)
1481 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1482 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1485 bool restrictComm=
false;
1486 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1488 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
1491 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1492 #ifdef HAVE_XPETRA_TPETRA 1515 const local_matrix_type& lclMatrix,
1516 const Teuchos::RCP<Teuchos::ParameterList>& params = null) :
1517 EpetraCrsMatrixT(lclMatrix, rowMap, colMap, Teuchos::null, Teuchos::null, params)
1521 const local_matrix_type& lclMatrix,
1522 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
1523 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
1524 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
1525 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
1526 const Teuchos::RCP<Teuchos::ParameterList>& params = null)
1530 typedef typename local_matrix_type::value_type value_type;
1531 typedef typename local_matrix_type::ordinal_type ordinal_type;
1534 ordinal_type lclNumRows = lclMatrix.numRows ();
1535 ordinal_type lclNumCols = lclMatrix.numCols ();
1539 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
1541 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
1543 Teuchos::ArrayRCP< size_t > NumEntriesPerRowToAlloc(lclNumRows);
1544 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1546 auto rowview = lclMatrix.row (r);
1547 NumEntriesPerRowToAlloc[r] = rowview.length;
1551 isFillResumed_ =
false;
1552 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1553 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
1556 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1558 auto rowview = lclMatrix.row (r);
1561 Teuchos::ArrayRCP<ordinal_type> indout(rowview.length,Teuchos::ScalarTraits<ordinal_type>::zero());
1562 Teuchos::ArrayRCP<value_type> valout(rowview.length,Teuchos::ScalarTraits<value_type>::zero());
1564 for(ordinal_type c = 0; c < rowview.length; c++) {
1565 value_type value = rowview.value (c);
1566 ordinal_type colidx = rowview.colidx (c);
1568 TEUCHOS_TEST_FOR_EXCEPTION(colMap->isNodeLocalElement(colidx) ==
false,
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrixT: local matrix contains column elements which are not in the provided column map!");
1570 indout [c] = colidx;
1573 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
1577 if (!domainMap.is_null() && !rangeMap.is_null())
1583 isInitializedLocalMatrix_ =
false;
1599 XPETRA_ERR_CHECK(mtx_->InsertGlobalValues(globalRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
1606 XPETRA_ERR_CHECK(mtx_->InsertMyValues(localRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
1614 const std::string tfecfFuncName(
"replaceGlobalValues");
1615 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
1616 ": Fill must be active in order to call this method. If you have already " 1617 "called fillComplete(), you need to call resumeFill() before you can " 1620 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
1621 std::runtime_error,
": values.size() must equal indices.size().");
1624 XPETRA_ERR_CHECK(mtx_->ReplaceGlobalValues(globalRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
1633 const std::string tfecfFuncName(
"replaceLocalValues");
1634 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
1635 ": Fill must be active in order to call this method. If you have already " 1636 "called fillComplete(), you need to call resumeFill() before you can " 1639 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
1640 std::runtime_error,
": values.size() must equal indices.size().");
1643 XPETRA_ERR_CHECK(mtx_->ReplaceMyValues(localRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
1656 void allocateAllValues(
size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind, ArrayRCP<Scalar>& values) {
1666 int lowerOffset = 0;
1667 bool ownMemory =
false;
1671 Epetra_IntSerialDenseVector& myColind = mtx_->ExpertExtractIndices();
1672 myColind.Resize(numNonZeros);
1673 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1677 double *& myValues = mtx_->ExpertExtractValues();
1679 myValues =
new double[numNonZeros];
1680 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
1684 void setAllValues(
const ArrayRCP<size_t>& rowptr,
const ArrayRCP<LocalOrdinal>& colind,
const ArrayRCP<Scalar>& values) {
1689 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1691 "An exception is thrown to let you know that you mismatched your pointers.");
1694 if (values.size() > 0) {
1696 "An exception is thrown to let you know that you mismatched your pointers.");
1698 "An exception is thrown to let you know that you mismatched your pointers.");
1705 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
1706 myRowptr.Resize(N+1);
1707 for (
size_t i = 0; i < N+1; i++)
1708 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1713 void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values)
const {
1716 int lowerOffset = 0;
1717 bool ownMemory =
false;
1724 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
1726 for (
size_t i = 0; i < n+1; i++)
1727 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1730 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1733 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1741 int lowerOffset = 0;
1742 bool ownMemory =
false;
1746 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1759 const RCP<ParameterList> & =Teuchos::null) {
1763 isFillResumed_ =
false;
1766 const Epetra_Import * myimport =0;
1767 const Epetra_Export * myexport =0;
1769 if(!importer.is_null()) {
1771 myimport = eImporter.getEpetra_Import().getRawPtr();
1773 if(!exporter.is_null()) {
1775 myexport = eExporter.getEpetra_Export().getRawPtr();
1778 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
1780 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::expertStaticFillComplete FAILED!");
1792 isFillResumed_ =
true;
1800 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1802 bool doOptimizeStorage =
true;
1803 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1804 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
1813 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1815 bool doOptimizeStorage =
true;
1816 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1817 mtx_->FillComplete(doOptimizeStorage);
1826 const RCP<const Epetra_Import> & myImport = eImporter.getEpetra_Import();
1828 if(myImport==Teuchos::null)
1829 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1831 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1832 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::replaceDomainMapAndImporter FAILED!");
1844 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRowMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->RowMap()); }
1847 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getColMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->ColMap()); }
1850 RCP< const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
getCrsGraph()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getCrsGraph");
return toXpetra<GlobalOrdinal,Node>(mtx_->Graph()); }
1904 int numEntries = -1;
1905 XPETRA_ERR_CHECK(mtx_->ExtractMyRowCopy(LocalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
1906 NumEntries = numEntries;
1913 int numEntries = -1;
1914 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowCopy(GlobalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
1915 NumEntries = numEntries;
1926 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1927 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1929 indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1930 values = ArrayView<const double>(eValues, numEntries);
1941 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1942 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1944 indices = ArrayView<const int>(eIndices, numEntries);
1945 values = ArrayView<const double>(eValues, numEntries);
1963 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
1979 void apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS,
Scalar alpha=ScalarTraits< Scalar >::one(),
Scalar beta=ScalarTraits< Scalar >::zero())
const {
1987 TEUCHOS_TEST_FOR_EXCEPTION((mode != Teuchos::NO_TRANS) && (mode != Teuchos::TRANS),
Xpetra::Exceptions::NotImplemented,
"Xpetra::EpetraCrsMatrixT->apply() only accept mode == NO_TRANS or mode == TRANS");
1991 TEUCHOS_TEST_FOR_EXCEPTION(mtx_->UseTranspose(),
Xpetra::Exceptions::NotImplemented,
"An exception is throw to let you know that Xpetra::EpetraCrsMatrixT->apply() do not take into account the UseTranspose() parameter of Epetra_CrsMatrix.");
1993 RCP<Epetra_MultiVector> epY = eY.getEpetra_MultiVector();
1996 RCP<Epetra_MultiVector> tmp = Teuchos::rcp(
new Epetra_MultiVector(*epY));
1997 tmp->PutScalar(0.0);
1998 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
2004 void apply(
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X,
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode,
Scalar alpha,
Scalar beta,
bool sumInterfaceValues,
const RCP<
Import<LocalOrdinal, GlobalOrdinal, Node> >& regionInterfaceImporter,
const Teuchos::ArrayRCP<LocalOrdinal>& regionInterfaceLIDs)
const {
2009 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getDomainMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getDomainMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->DomainMap()); }
2012 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getRangeMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRangeMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->RangeMap()); }
2024 std::ostringstream oss;
2027 oss <<
"{status = fill complete" 2034 oss <<
"{status = fill not complete" 2044 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
2050 using Teuchos::VERB_DEFAULT;
2051 using Teuchos::VERB_NONE;
2052 using Teuchos::VERB_LOW;
2053 using Teuchos::VERB_MEDIUM;
2054 using Teuchos::VERB_HIGH;
2055 using Teuchos::VERB_EXTREME;
2056 Teuchos::EVerbosityLevel vl = verbLevel;
2057 if (vl == VERB_DEFAULT) vl = VERB_LOW;
2058 RCP<const Comm<int> > comm = this->
getComm();
2059 const int myImageID = comm->getRank(),
2060 numImages = comm->getSize();
2065 width = std::max<size_t>(width,11) + 2;
2066 Teuchos::OSTab tab(out);
2074 if (vl != VERB_NONE) {
2075 if (myImageID == 0) out << this->
description() << std::endl;
2081 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
2082 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
2087 if (myImageID == 0) out <<
"\nColumn map is row map.";
2090 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
2096 if (myImageID == 0) out <<
"\nDomain map is row map.";
2099 if (myImageID == 0) out <<
"\nDomain map is row map.";
2102 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
2108 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
2111 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
2114 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
2118 if (myImageID == 0) out << std::endl;
2121 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
2122 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2123 if (myImageID == imageCtr) {
2124 out <<
"Node ID = " << imageCtr << std::endl;
2146 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
2147 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2148 if (myImageID == imageCtr) {
2149 out << std::setw(width) <<
"Node ID" 2150 << std::setw(width) <<
"Global Row" 2151 << std::setw(width) <<
"Num Entries";
2152 if (vl == VERB_EXTREME) {
2153 out << std::setw(width) <<
"(Index,Value)";
2159 out << std::setw(width) << myImageID
2160 << std::setw(width) << gid
2161 << std::setw(width) << nE;
2162 if (vl == VERB_EXTREME) {
2164 ArrayView<const GlobalOrdinal> rowinds;
2165 ArrayView<const Scalar> rowvals;
2167 for (
size_t j=0; j < nE; ++j) {
2168 out <<
" (" << rowinds[j]
2169 <<
", " << rowvals[j]
2174 ArrayView<const LocalOrdinal> rowinds;
2175 ArrayView<const Scalar> rowvals;
2177 for (
size_t j=0; j < nE; ++j) {
2178 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
2179 <<
", " << rowvals[j]
2197 Teuchos::LabeledObject::setObjectLabel(objectLabel);
2198 mtx_->SetLabel(objectLabel.c_str());
2204 : mtx_(Teuchos::rcp(new Epetra_CrsMatrix(*(matrix.mtx_)))), isFillResumed_(false)
2212 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->Map()); }
2222 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
2223 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2224 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2235 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
2236 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2237 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2248 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
2249 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2250 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2262 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
2263 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2264 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2269 const Epetra_Map* newMapEpetra = (!newMap.is_null())? &toEpetra<GlobalOrdinal,Node>(newMap) : 0;
2270 int err = mtx_->RemoveEmptyProcessesInPlace(newMapEpetra);
2271 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Caught nonzero error code " + std::to_string(err) +
" returned by Epetra.");
2283 EpetraCrsMatrixT(
const Teuchos::RCP<Epetra_CrsMatrix > &mtx) : mtx_(mtx), isFillResumed_(false) { }
2291 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 2292 #ifdef HAVE_XPETRA_TPETRA 2293 local_matrix_type getLocalMatrix ()
const {
2295 if (isInitializedLocalMatrix_)
2296 return localMatrix_;
2300 const int numRows = matrix->NumMyRows();
2301 const int numCols = matrix->NumMyCols();
2302 const int nnz = matrix->NumMyNonzeros();
2307 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
2308 TEUCHOS_TEST_FOR_EXCEPTION(rv, std::runtime_error,
"Xpetra::CrsMatrix<>::getLocalMatrix: failed in ExtractCrsDataPointers");
2311 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
2312 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
2313 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
2316 typename local_matrix_type::index_type kokkosColind(colind, nnz);
2317 typename local_matrix_type::values_type kokkosVals (vals, nnz);
2319 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
2320 isInitializedLocalMatrix_ =
true;
2322 return localMatrix_;
2325 void setAllValues (
const typename local_matrix_type::row_map_type& ,
2326 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
2327 const typename local_matrix_type::values_type& )
2330 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
2335 mutable local_matrix_type localMatrix_;
2336 mutable bool isInitializedLocalMatrix_ =
false;
2339 #warning "Xpetra Kokkos interface for CrsMatrix is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too." 2348 Scalar one = Teuchos::ScalarTraits<Scalar>::one(), negone = -one;
2360 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 2364 #define XPETRA_EPETRACRSMATRIX_SHORT 2365 #endif // XPETRA_EPETRACRSMATRIX_HPP EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void setObjectLabel(const std::string &objectLabel)
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
std::string description() const
A simple one-line description of this object.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
bool isFillActive() const
Returns true if the matrix is in edit mode.
bool isFillActive() const
Returns true if the matrix is in edit mode.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying row and column Maps and number of entries in each row.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
virtual ~EpetraCrsMatrixT()
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor for a fused import.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > ®ionInterfaceImporter, const Teuchos::ArrayRCP< LocalOrdinal > ®ionInterfaceLIDs) const
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
const RCP< const Comm< int > > getComm() const
Returns the communicator.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
void resumeFill(const RCP< ParameterList > ¶ms=null)
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > ®ionInterfaceImporter, const Teuchos::ArrayRCP< LocalOrdinal > ®ionInterfaceLIDs) const
void getAllValues(ArrayRCP< Scalar > &values)
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > &=Teuchos::null)
Expert static fill complete.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
RCP< Epetra_CrsMatrix > mtx_
The underlying actual matrix object.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor for a fused export.
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
bool hasMatrix() const
Does this have an underlying matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Teuchos::ArrayView< const size_t > &) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
Exception throws to report errors in the internal logical of the program.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
LocalOrdinal local_ordinal_type
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
virtual ~EpetraCrsMatrixT()
Destructor.
bool isFillActive() const
Returns true if the matrix is in edit mode.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
Deep copy constructor.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
Computes the sparse matrix-multivector multiplication.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
bool hasMatrix() const
Does this have an underlying matrix.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)=0
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra matrix.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified (locally owned) global row...
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra matrix.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using global IDs.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
Replaces the current domainMap and importer with the user-specified objects.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
size_t getNodeNumCols() const
Returns the number of matrix columns owned on the calling node.
void setAllToScalar(const Scalar &alpha)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > &=Teuchos::null)
Expert static fill complete.
virtual ~EpetraCrsMatrixT()
Destructor.
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
const RCP< const Comm< int > > getComm() const
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode, Scalar alpha, Scalar beta, bool sumInterfaceValues, const RCP< Import< LocalOrdinal, GlobalOrdinal, Node > > ®ionInterfaceImporter, const Teuchos::ArrayRCP< LocalOrdinal > ®ionInterfaceLIDs) const
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
const RCP< const Comm< int > > getComm() const
Returns the communicator.
#define XPETRA_ERR_CHECK(arg)
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
bool hasMatrix() const
Does this have an underlying matrix.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void getAllValues(ArrayRCP< Scalar > &values)
Gets the 1D pointer arrays of the graph.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
Deep copy constructor.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
void getAllValues(ArrayRCP< Scalar > &values)
Gets the 1D pointer arrays of the graph.
std::string description() const
A simple one-line description of this object.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
Exception throws when you call an unimplemented method of Xpetra.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
size_t global_size_t
Global size_t object.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > ¶ms=Teuchos::null)
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void fillComplete(const RCP< ParameterList > ¶ms=null)
Signal that data entry is complete.
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of local indices in a specified row of the matrix.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor for a fused import.
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
void setObjectLabel(const std::string &objectLabel)
void scale(const Scalar &alpha)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
void apply(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Y, Teuchos::ETransp mode=Teuchos::NO_TRANS, Scalar alpha=ScalarTraits< Scalar >::one(), Scalar beta=ScalarTraits< Scalar >::zero()) const
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using global IDs.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified (locally owned) global row...
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null)
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying a previously constructed graph.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying a previously constructed graph.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
std::string description() const
A simple one-line description of this object.
CombineMode
Xpetra::Combine Mode enumerable type.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
#define XPETRA_MONITOR(funcName)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage...
RCP< Epetra_CrsMatrix > mtx_
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap)
Constructor for empty DynamicProfile matrix (no space is preallocated).
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete, specifying domain and range maps.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete, specifying domain and range maps.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the range of this operator, which must be compatible with Y...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
bool isFillResumed_
Flag to keep track of fill status.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the specified global row.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
Constructor for a fused export.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
void setObjectLabel(const std::string &objectLabel)
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
EpetraGlobalOrdinal GlobalOrdinal
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Teuchos::ArrayView< const size_t > &) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)