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> 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)");
101 EpetraCrsMatrixT(
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
const Teuchos::RCP<
const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
size_t maxNumEntriesPerRow,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) { TEUCHOS_TEST_FOR_EXCEPTION(
true,
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with Node=Kokkos::Compat::KokkosSerialWrapperNode."); }
102 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,
ProfileType pftype=
DynamicProfile,
const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null) { TEUCHOS_TEST_FOR_EXCEPTION(
true,
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with Node=Kokkos::Compat::KokkosSerialWrapperNode."); }
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)");
157 void allocateAllValues(
size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind, ArrayRCP<Scalar> & values) { }
158 void setAllValues(
const ArrayRCP<size_t> & rowptr,
const ArrayRCP<LocalOrdinal> & colind,
const ArrayRCP<Scalar> & values) { }
159 void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values)
const { }
164 const RCP<ParameterList> ¶ms=Teuchos::null) { }
170 const RCP< const Comm< int > >
getComm()
const {
return Teuchos::null; }
171 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
return Teuchos::null; }
172 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
return Teuchos::null; }
173 RCP< const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
getCrsGraph()
const {
return Teuchos::null; }
189 typename ScalarTraits< Scalar >::magnitudeType
getFrobeniusNorm()
const {
return ScalarTraits< Scalar >::magnitude(ScalarTraits< Scalar >::zero()); }
191 void getLocalRowCopy(
LocalOrdinal LocalRow,
const ArrayView< LocalOrdinal > &Indices,
const ArrayView< Scalar > &Values,
size_t &NumEntries)
const { }
201 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 { }
202 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getDomainMap()
const {
return Teuchos::null; }
203 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getRangeMap()
const {
return Teuchos::null; }
206 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const { }
210 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
213 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const {
return Teuchos::null; }
223 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
227 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 228 #ifdef HAVE_XPETRA_TPETRA 229 local_matrix_type getLocalMatrix ()
const {
230 TEUCHOS_TEST_FOR_EXCEPTION(
isFillComplete() ==
false, std::runtime_error,
231 "Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
236 local_matrix_type localMatrix_;
239 #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." 246 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 249 :
public CrsMatrix <double, int, int, EpetraNode>
258 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 259 #ifdef HAVE_XPETRA_TPETRA 273 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
274 #ifdef HAVE_XPETRA_TPETRA
275 , isInitializedLocalMatrix_(false)
283 : isFillResumed_(false)
284 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
285 #ifdef HAVE_XPETRA_TPETRA
286 , isInitializedLocalMatrix_(false)
290 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
291 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
298 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
299 #ifdef HAVE_XPETRA_TPETRA
300 , isInitializedLocalMatrix_(false)
308 : isFillResumed_(false)
309 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
310 #ifdef HAVE_XPETRA_TPETRA
311 , isInitializedLocalMatrix_(false)
315 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
316 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
323 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
324 #ifdef HAVE_XPETRA_TPETRA
325 , isInitializedLocalMatrix_(false)
336 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null):
337 isFillResumed_(false)
338 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
339 #ifdef HAVE_XPETRA_TPETRA
340 , isInitializedLocalMatrix_(false)
347 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
348 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
351 bool restrictComm=
false;
352 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
353 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
354 if(restrictComm && mtx_->NumMyRows()==0)
365 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) :
366 isFillResumed_(false)
367 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
368 #ifdef HAVE_XPETRA_TPETRA
369 , isInitializedLocalMatrix_(false)
376 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
377 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
380 bool restrictComm=
false;
381 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
383 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
391 const Teuchos::RCP<Teuchos::ParameterList>& params) :
392 isFillResumed_(false)
393 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
394 #ifdef HAVE_XPETRA_TPETRA
395 , isInitializedLocalMatrix_(false)
403 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
404 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
407 bool restrictComm=
false;
408 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
409 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
410 if(restrictComm && mtx_->NumMyRows()==0)
419 const Teuchos::RCP<Teuchos::ParameterList>& params) :
420 isFillResumed_(false)
421 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
422 #ifdef HAVE_XPETRA_TPETRA
423 , isInitializedLocalMatrix_(false)
431 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
432 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
435 bool restrictComm=
false;
436 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
438 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
441 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 442 #ifdef HAVE_XPETRA_TPETRA 465 const local_matrix_type& lclMatrix,
466 const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
469 typedef typename local_matrix_type::value_type value_type;
470 typedef typename local_matrix_type::ordinal_type ordinal_type;
473 ordinal_type lclNumRows = lclMatrix.numRows ();
474 ordinal_type lclNumCols = lclMatrix.numCols ();
477 TEUCHOS_TEST_FOR_EXCEPTION(lclNumRows != Teuchos::as<ordinal_type>(rowMap->getNodeNumElements()),
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
478 TEUCHOS_TEST_FOR_EXCEPTION(lclNumCols != Teuchos::as<ordinal_type>(colMap->getNodeNumElements()),
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
480 std::vector<GlobalOrdinal> domainMapGids;
482 Teuchos::ArrayRCP< size_t > NumEntriesPerRowToAlloc(lclNumRows);
483 for (ordinal_type r = 0; r < lclNumRows; ++r) {
485 auto rowview = lclMatrix.row (r);
486 NumEntriesPerRowToAlloc[r] = rowview.length;
490 isFillResumed_ =
false;
491 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
492 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(
DynamicProfile)));
495 for (ordinal_type r = 0; r < lclNumRows; ++r) {
497 auto rowview = lclMatrix.row (r);
500 Teuchos::ArrayRCP<ordinal_type> indout(rowview.length,Teuchos::ScalarTraits<ordinal_type>::zero());
501 Teuchos::ArrayRCP<value_type> valout(rowview.length,Teuchos::ScalarTraits<value_type>::zero());
503 for(ordinal_type c = 0; c < rowview.length; c++) {
504 value_type value = rowview.value (c);
505 ordinal_type colidx = rowview.colidx (c);
507 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!");
514 if(rowMap->isNodeGlobalElement(gcid)) domainMapGids.push_back(gcid);
516 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
520 const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
521 std::sort(domainMapGids.begin(), domainMapGids.end());
522 domainMapGids.erase(std::unique(domainMapGids.begin(), domainMapGids.end()), domainMapGids.end());
523 Teuchos::ArrayView<GlobalOrdinal> domainMapGidsView(&domainMapGids[0], domainMapGids.size());
524 Teuchos::RCP<const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > domainMap =
531 isInitializedLocalMatrix_ =
false;
547 XPETRA_ERR_CHECK(mtx_->InsertGlobalValues(globalRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
554 XPETRA_ERR_CHECK(mtx_->InsertMyValues(localRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
562 const std::string tfecfFuncName(
"replaceGlobalValues");
563 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
564 ": Fill must be active in order to call this method. If you have already " 565 "called fillComplete(), you need to call resumeFill() before you can " 568 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
569 std::runtime_error,
": values.size() must equal indices.size().");
572 XPETRA_ERR_CHECK(mtx_->ReplaceGlobalValues(globalRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
581 const std::string tfecfFuncName(
"replaceLocalValues");
582 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
583 ": Fill must be active in order to call this method. If you have already " 584 "called fillComplete(), you need to call resumeFill() before you can " 587 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
588 std::runtime_error,
": values.size() must equal indices.size().");
591 XPETRA_ERR_CHECK(mtx_->ReplaceMyValues(localRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
604 void allocateAllValues(
size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind, ArrayRCP<Scalar>& values) {
615 bool ownMemory =
false;
619 Epetra_IntSerialDenseVector& myColind = mtx_->ExpertExtractIndices();
620 myColind.Resize(numNonZeros);
621 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
625 double *& myValues = mtx_->ExpertExtractValues();
627 myValues =
new double[numNonZeros];
628 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
632 void setAllValues(
const ArrayRCP<size_t>& rowptr,
const ArrayRCP<LocalOrdinal>& colind,
const ArrayRCP<Scalar>& values) {
637 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
639 "An exception is thrown to let you know that you mismatched your pointers.");
642 if (values.size() > 0) {
644 "An exception is thrown to let you know that you mismatched your pointers.");
646 "An exception is thrown to let you know that you mismatched your pointers.");
653 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
654 myRowptr.Resize(N+1);
655 for (
size_t i = 0; i < N+1; i++)
656 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
661 void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values)
const {
665 bool ownMemory =
false;
672 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
674 for (
size_t i = 0; i < n+1; i++)
675 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
678 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
681 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
690 const RCP<ParameterList> & params=Teuchos::null) {
693 const Epetra_Import * myimport =0;
694 const Epetra_Export * myexport =0;
696 if(!importer.is_null()) {
698 myimport = eImporter.getEpetra_Import().getRawPtr();
700 if(!exporter.is_null()) {
702 myexport = eExporter.getEpetra_Export().getRawPtr();
705 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
707 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::expertStaticFillComplete FAILED!");
715 void resumeFill(
const RCP< ParameterList > ¶ms=Teuchos::null) {
719 isFillResumed_ =
true;
727 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
729 bool doOptimizeStorage =
true;
730 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
731 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
740 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
742 bool doOptimizeStorage =
true;
743 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
744 mtx_->FillComplete(doOptimizeStorage);
753 const RCP<const Epetra_Import> & myImport = eImporter.getEpetra_Import();
755 if(myImport==Teuchos::null)
756 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
758 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
759 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::replaceDomainMapAndImporter FAILED!");
771 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRowMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->RowMap()); }
774 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getColMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->ColMap()); }
777 RCP< const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
getCrsGraph()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getCrsGraph");
return toXpetra<GlobalOrdinal,Node>(mtx_->Graph()); }
835 XPETRA_ERR_CHECK(mtx_->ExtractMyRowCopy(LocalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
836 NumEntries = numEntries;
844 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowCopy(GlobalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
845 NumEntries = numEntries;
856 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
857 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
859 indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
860 values = ArrayView<const double>(eValues, numEntries);
871 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
872 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
874 indices = ArrayView<const int>(eIndices, numEntries);
875 values = ArrayView<const double>(eValues, numEntries);
904 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 {
912 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");
916 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.");
918 RCP<Epetra_MultiVector> epY = eY.getEpetra_MultiVector();
921 RCP<Epetra_MultiVector> tmp = Teuchos::rcp(
new Epetra_MultiVector(*epY));
923 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
930 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getDomainMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getDomainMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->DomainMap()); }
933 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getRangeMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRangeMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->RangeMap()); }
945 std::ostringstream oss;
948 oss <<
"{status = fill complete" 955 oss <<
"{status = fill not complete" 965 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
971 using Teuchos::VERB_DEFAULT;
972 using Teuchos::VERB_NONE;
973 using Teuchos::VERB_LOW;
974 using Teuchos::VERB_MEDIUM;
975 using Teuchos::VERB_HIGH;
976 using Teuchos::VERB_EXTREME;
977 Teuchos::EVerbosityLevel vl = verbLevel;
978 if (vl == VERB_DEFAULT) vl = VERB_LOW;
979 RCP<const Comm<int> > comm = this->
getComm();
980 const int myImageID = comm->getRank(),
981 numImages = comm->getSize();
986 width = std::max<size_t>(width,11) + 2;
987 Teuchos::OSTab tab(out);
995 if (vl != VERB_NONE) {
996 if (myImageID == 0) out << this->
description() << std::endl;
1003 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
1004 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
1009 if (myImageID == 0) out <<
"\nColumn map is row map.";
1012 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1018 if (myImageID == 0) out <<
"\nDomain map is row map.";
1021 if (myImageID == 0) out <<
"\nDomain map is row map.";
1024 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
1030 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
1033 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
1036 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
1040 if (myImageID == 0) out << std::endl;
1043 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
1044 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1045 if (myImageID == imageCtr) {
1046 out <<
"Node ID = " << imageCtr << std::endl;
1061 out <<
"Node number of diagonals = " <<
getNodeNumDiags() << std::endl;
1071 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
1072 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1073 if (myImageID == imageCtr) {
1074 out << std::setw(width) <<
"Node ID" 1075 << std::setw(width) <<
"Global Row" 1076 << std::setw(width) <<
"Num Entries";
1077 if (vl == VERB_EXTREME) {
1078 out << std::setw(width) <<
"(Index,Value)";
1084 out << std::setw(width) << myImageID
1085 << std::setw(width) << gid
1086 << std::setw(width) << nE;
1087 if (vl == VERB_EXTREME) {
1089 ArrayView<const GlobalOrdinal> rowinds;
1090 ArrayView<const Scalar> rowvals;
1092 for (
size_t j=0; j < nE; ++j) {
1093 out <<
" (" << rowinds[j]
1094 <<
", " << rowvals[j]
1099 ArrayView<const LocalOrdinal> rowinds;
1100 ArrayView<const Scalar> rowvals;
1102 for (
size_t j=0; j < nE; ++j) {
1103 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
1104 <<
", " << rowvals[j]
1126 : mtx_(Teuchos::rcp(new Epetra_CrsMatrix(*(matrix.mtx_)))), isFillResumed_(false)
1127 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1128 #ifdef HAVE_XPETRA_TPETRA
1129 , isInitializedLocalMatrix_(false)
1139 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->Map()); }
1149 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
1150 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1151 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1162 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
1163 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1164 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1175 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
1176 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1177 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1189 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
1190 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1191 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
1205 EpetraCrsMatrixT(
const Teuchos::RCP<Epetra_CrsMatrix > &mtx) : mtx_(mtx), isFillResumed_(false) { }
1213 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1214 #ifdef HAVE_XPETRA_TPETRA 1215 local_matrix_type getLocalMatrix ()
const {
1217 TEUCHOS_TEST_FOR_EXCEPTION(
isFillComplete() ==
false, std::runtime_error,
1218 "Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
1219 if (isInitializedLocalMatrix_)
1220 return localMatrix_;
1224 const int numRows = matrix->NumMyRows();
1225 const int numCols = matrix->NumMyCols();
1226 const int nnz = matrix->NumMyNonzeros();
1231 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
1232 TEUCHOS_TEST_FOR_EXCEPTION(rv, std::runtime_error,
"Xpetra::CrsMatrix<>::getLocalMatrix: failed in ExtractCrsDataPointers");
1235 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
1236 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1237 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
1240 typename local_matrix_type::index_type kokkosColind(colind, nnz);
1241 typename local_matrix_type::values_type kokkosVals (vals, nnz);
1243 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
1244 isInitializedLocalMatrix_ =
true;
1246 return localMatrix_;
1250 #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." 1261 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1262 #ifdef HAVE_XPETRA_TPETRA 1264 local_matrix_type localMatrix_;
1266 bool isInitializedLocalMatrix_;
1269 #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." 1276 #endif //#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 1278 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 1281 :
public CrsMatrix <double, int, long long, EpetraNode>
1290 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1291 #ifdef HAVE_XPETRA_TPETRA 1305 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1306 #ifdef HAVE_XPETRA_TPETRA
1307 , isInitializedLocalMatrix_(false)
1315 : isFillResumed_(false)
1316 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1317 #ifdef HAVE_XPETRA_TPETRA
1318 , isInitializedLocalMatrix_(false)
1322 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1323 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
1330 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1331 #ifdef HAVE_XPETRA_TPETRA
1332 , isInitializedLocalMatrix_(false)
1340 : isFillResumed_(false)
1341 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1342 #ifdef HAVE_XPETRA_TPETRA
1343 , isInitializedLocalMatrix_(false)
1347 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1348 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
1355 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1356 #ifdef HAVE_XPETRA_TPETRA
1357 , isInitializedLocalMatrix_(false)
1368 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null):
1369 isFillResumed_(false)
1370 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1371 #ifdef HAVE_XPETRA_TPETRA
1372 , isInitializedLocalMatrix_(false)
1379 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1380 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1383 bool restrictComm=
false;
1384 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1385 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
1386 if(restrictComm && mtx_->NumMyRows()==0)
1397 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) :
1398 isFillResumed_(false)
1399 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1400 #ifdef HAVE_XPETRA_TPETRA
1401 , isInitializedLocalMatrix_(false)
1408 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1409 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1412 bool restrictComm=
false;
1413 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1415 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
1423 const Teuchos::RCP<Teuchos::ParameterList>& params) :
1424 isFillResumed_(false)
1425 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1426 #ifdef HAVE_XPETRA_TPETRA
1427 , isInitializedLocalMatrix_(false)
1435 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1436 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1439 bool restrictComm=
false;
1440 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1441 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
1442 if(restrictComm && mtx_->NumMyRows()==0)
1451 const Teuchos::RCP<Teuchos::ParameterList>& params) :
1452 isFillResumed_(false)
1453 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1454 #ifdef HAVE_XPETRA_TPETRA
1455 , isInitializedLocalMatrix_(false)
1463 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1464 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1467 bool restrictComm=
false;
1468 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1470 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
1473 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1474 #ifdef HAVE_XPETRA_TPETRA 1497 const local_matrix_type& lclMatrix,
1498 const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
1501 typedef typename local_matrix_type::value_type value_type;
1502 typedef typename local_matrix_type::ordinal_type ordinal_type;
1505 ordinal_type lclNumRows = lclMatrix.numRows ();
1506 ordinal_type lclNumCols = lclMatrix.numCols ();
1509 TEUCHOS_TEST_FOR_EXCEPTION(lclNumRows != Teuchos::as<ordinal_type>(rowMap->getNodeNumElements()),
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
1510 TEUCHOS_TEST_FOR_EXCEPTION(lclNumCols != Teuchos::as<ordinal_type>(colMap->getNodeNumElements()),
Xpetra::Exceptions::RuntimeError,
"Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
1512 std::vector<GlobalOrdinal> domainMapGids;
1514 Teuchos::ArrayRCP< size_t > NumEntriesPerRowToAlloc(lclNumRows);
1515 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1517 auto rowview = lclMatrix.row (r);
1518 NumEntriesPerRowToAlloc[r] = rowview.length;
1522 isFillResumed_ =
false;
1523 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1524 mtx_ = Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(
DynamicProfile)));
1527 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1529 auto rowview = lclMatrix.row (r);
1532 Teuchos::ArrayRCP<ordinal_type> indout(rowview.length,Teuchos::ScalarTraits<ordinal_type>::zero());
1533 Teuchos::ArrayRCP<value_type> valout(rowview.length,Teuchos::ScalarTraits<value_type>::zero());
1535 for(ordinal_type c = 0; c < rowview.length; c++) {
1536 value_type value = rowview.value (c);
1537 ordinal_type colidx = rowview.colidx (c);
1539 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!");
1541 indout [c] = colidx;
1546 if(rowMap->isNodeGlobalElement(gcid)) domainMapGids.push_back(gcid);
1548 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
1552 const GlobalOrdinal INVALID = Teuchos::OrdinalTraits<Xpetra::global_size_t>::invalid();
1553 std::sort(domainMapGids.begin(), domainMapGids.end());
1554 domainMapGids.erase(std::unique(domainMapGids.begin(), domainMapGids.end()), domainMapGids.end());
1555 Teuchos::ArrayView<GlobalOrdinal> domainMapGidsView(&domainMapGids[0], domainMapGids.size());
1556 Teuchos::RCP<const Xpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > domainMap =
1563 isInitializedLocalMatrix_ =
false;
1579 XPETRA_ERR_CHECK(mtx_->InsertGlobalValues(globalRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
1586 XPETRA_ERR_CHECK(mtx_->InsertMyValues(localRow, vals.size(), vals.getRawPtr(), cols.getRawPtr()));
1594 const std::string tfecfFuncName(
"replaceGlobalValues");
1595 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
1596 ": Fill must be active in order to call this method. If you have already " 1597 "called fillComplete(), you need to call resumeFill() before you can " 1600 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
1601 std::runtime_error,
": values.size() must equal indices.size().");
1604 XPETRA_ERR_CHECK(mtx_->ReplaceGlobalValues(globalRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
1613 const std::string tfecfFuncName(
"replaceLocalValues");
1614 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(!
isFillActive(), std::runtime_error,
1615 ": Fill must be active in order to call this method. If you have already " 1616 "called fillComplete(), you need to call resumeFill() before you can " 1619 TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(values.size() != indices.size(),
1620 std::runtime_error,
": values.size() must equal indices.size().");
1623 XPETRA_ERR_CHECK(mtx_->ReplaceMyValues(localRow, indices.size(), values.getRawPtr(), indices.getRawPtr()));
1636 void allocateAllValues(
size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind, ArrayRCP<Scalar>& values) {
1646 int lowerOffset = 0;
1647 bool ownMemory =
false;
1651 Epetra_IntSerialDenseVector& myColind = mtx_->ExpertExtractIndices();
1652 myColind.Resize(numNonZeros);
1653 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1657 double *& myValues = mtx_->ExpertExtractValues();
1659 myValues =
new double[numNonZeros];
1660 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
1664 void setAllValues(
const ArrayRCP<size_t>& rowptr,
const ArrayRCP<LocalOrdinal>& colind,
const ArrayRCP<Scalar>& values) {
1669 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1671 "An exception is thrown to let you know that you mismatched your pointers.");
1674 if (values.size() > 0) {
1676 "An exception is thrown to let you know that you mismatched your pointers.");
1678 "An exception is thrown to let you know that you mismatched your pointers.");
1685 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
1686 myRowptr.Resize(N+1);
1687 for (
size_t i = 0; i < N+1; i++)
1688 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1693 void getAllValues(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind, ArrayRCP<const Scalar>& values)
const {
1696 int lowerOffset = 0;
1697 bool ownMemory =
false;
1704 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
1706 for (
size_t i = 0; i < n+1; i++)
1707 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1710 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1713 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1722 const RCP<ParameterList> & params=Teuchos::null) {
1725 const Epetra_Import * myimport =0;
1726 const Epetra_Export * myexport =0;
1728 if(!importer.is_null()) {
1730 myimport = eImporter.getEpetra_Import().getRawPtr();
1732 if(!exporter.is_null()) {
1734 myexport = eExporter.getEpetra_Export().getRawPtr();
1737 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
1739 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::expertStaticFillComplete FAILED!");
1747 void resumeFill(
const RCP< ParameterList > ¶ms=Teuchos::null) {
1751 isFillResumed_ =
true;
1759 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1761 bool doOptimizeStorage =
true;
1762 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1763 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
1772 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1774 bool doOptimizeStorage =
true;
1775 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1776 mtx_->FillComplete(doOptimizeStorage);
1785 const RCP<const Epetra_Import> & myImport = eImporter.getEpetra_Import();
1787 if(myImport==Teuchos::null)
1788 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1790 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1791 TEUCHOS_TEST_FOR_EXCEPTION(rv != 0, std::runtime_error,
"Xpetra::EpetraCrsMatrixT::replaceDomainMapAndImporter FAILED!");
1803 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getRowMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRowMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->RowMap()); }
1806 const RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> >
getColMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getColMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->ColMap()); }
1809 RCP< const CrsGraph<LocalOrdinal, GlobalOrdinal, Node> >
getCrsGraph()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getCrsGraph");
return toXpetra<GlobalOrdinal,Node>(mtx_->Graph()); }
1866 int numEntries = -1;
1867 XPETRA_ERR_CHECK(mtx_->ExtractMyRowCopy(LocalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
1868 NumEntries = numEntries;
1875 int numEntries = -1;
1876 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowCopy(GlobalRow, Indices.size(), numEntries, Values.getRawPtr(), Indices.getRawPtr()));
1877 NumEntries = numEntries;
1888 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1889 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1891 indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1892 values = ArrayView<const double>(eValues, numEntries);
1903 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1904 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1906 indices = ArrayView<const int>(eIndices, numEntries);
1907 values = ArrayView<const double>(eValues, numEntries);
1936 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 {
1944 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");
1948 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.");
1950 RCP<Epetra_MultiVector> epY = eY.getEpetra_MultiVector();
1953 RCP<Epetra_MultiVector> tmp = Teuchos::rcp(
new Epetra_MultiVector(*epY));
1954 tmp->PutScalar(0.0);
1955 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
1962 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getDomainMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getDomainMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->DomainMap()); }
1965 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getRangeMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getRangeMap");
return toXpetra<GlobalOrdinal, Node>(mtx_->RangeMap()); }
1977 std::ostringstream oss;
1980 oss <<
"{status = fill complete" 1987 oss <<
"{status = fill not complete" 1997 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default)
const {
2003 using Teuchos::VERB_DEFAULT;
2004 using Teuchos::VERB_NONE;
2005 using Teuchos::VERB_LOW;
2006 using Teuchos::VERB_MEDIUM;
2007 using Teuchos::VERB_HIGH;
2008 using Teuchos::VERB_EXTREME;
2009 Teuchos::EVerbosityLevel vl = verbLevel;
2010 if (vl == VERB_DEFAULT) vl = VERB_LOW;
2011 RCP<const Comm<int> > comm = this->
getComm();
2012 const int myImageID = comm->getRank(),
2013 numImages = comm->getSize();
2018 width = std::max<size_t>(width,11) + 2;
2019 Teuchos::OSTab tab(out);
2027 if (vl != VERB_NONE) {
2028 if (myImageID == 0) out << this->
description() << std::endl;
2035 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
2036 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
2041 if (myImageID == 0) out <<
"\nColumn map is row map.";
2044 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
2050 if (myImageID == 0) out <<
"\nDomain map is row map.";
2053 if (myImageID == 0) out <<
"\nDomain map is row map.";
2056 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
2062 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
2065 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
2068 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
2072 if (myImageID == 0) out << std::endl;
2075 if (vl == VERB_MEDIUM || vl == VERB_HIGH || vl == VERB_EXTREME) {
2076 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2077 if (myImageID == imageCtr) {
2078 out <<
"Node ID = " << imageCtr << std::endl;
2093 out <<
"Node number of diagonals = " <<
getNodeNumDiags() << std::endl;
2103 if (vl == VERB_HIGH || vl == VERB_EXTREME) {
2104 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2105 if (myImageID == imageCtr) {
2106 out << std::setw(width) <<
"Node ID" 2107 << std::setw(width) <<
"Global Row" 2108 << std::setw(width) <<
"Num Entries";
2109 if (vl == VERB_EXTREME) {
2110 out << std::setw(width) <<
"(Index,Value)";
2116 out << std::setw(width) << myImageID
2117 << std::setw(width) << gid
2118 << std::setw(width) << nE;
2119 if (vl == VERB_EXTREME) {
2121 ArrayView<const GlobalOrdinal> rowinds;
2122 ArrayView<const Scalar> rowvals;
2124 for (
size_t j=0; j < nE; ++j) {
2125 out <<
" (" << rowinds[j]
2126 <<
", " << rowvals[j]
2131 ArrayView<const LocalOrdinal> rowinds;
2132 ArrayView<const Scalar> rowvals;
2134 for (
size_t j=0; j < nE; ++j) {
2135 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
2136 <<
", " << rowvals[j]
2158 : mtx_(Teuchos::rcp(new Epetra_CrsMatrix(*(matrix.mtx_)))), isFillResumed_(false)
2159 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
2160 #ifdef HAVE_XPETRA_TPETRA
2161 , isInitializedLocalMatrix_(false)
2171 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > >
getMap()
const {
XPETRA_MONITOR(
"EpetraCrsMatrixT::getMap");
return toXpetra<GlobalOrdinal,Node>(mtx_->Map()); }
2181 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
2182 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2183 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2194 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
2195 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2196 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2207 RCP<const Epetra_CrsMatrix> v = tSource.getEpetra_CrsMatrix();
2208 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2209 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2221 RCP<const Epetra_CrsMatrix> v = tDest.getEpetra_CrsMatrix();
2222 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2223 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Catch error code returned by Epetra.");
2237 EpetraCrsMatrixT(
const Teuchos::RCP<Epetra_CrsMatrix > &mtx) : mtx_(mtx), isFillResumed_(false) { }
2245 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 2246 #ifdef HAVE_XPETRA_TPETRA 2247 local_matrix_type getLocalMatrix ()
const {
2249 TEUCHOS_TEST_FOR_EXCEPTION(
isFillComplete() ==
false, std::runtime_error,
2250 "Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
2251 if (isInitializedLocalMatrix_)
2252 return localMatrix_;
2256 const int numRows = matrix->NumMyRows();
2257 const int numCols = matrix->NumMyCols();
2258 const int nnz = matrix->NumMyNonzeros();
2263 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
2264 TEUCHOS_TEST_FOR_EXCEPTION(rv, std::runtime_error,
"Xpetra::CrsMatrix<>::getLocalMatrix: failed in ExtractCrsDataPointers");
2267 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
2268 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
2269 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
2272 typename local_matrix_type::index_type kokkosColind(colind, nnz);
2273 typename local_matrix_type::values_type kokkosVals (vals, nnz);
2275 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
2276 isInitializedLocalMatrix_ =
true;
2278 return localMatrix_;
2282 #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." 2293 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 2294 #ifdef HAVE_XPETRA_TPETRA 2296 local_matrix_type localMatrix_;
2298 bool isInitializedLocalMatrix_;
2301 #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." 2308 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 2312 #define XPETRA_EPETRACRSMATRIX_SHORT 2313 #endif // XPETRA_EPETRACRSMATRIX_HPP 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...
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
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)
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)
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.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
static Teuchos::RCP< Map< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalGlobal lg=Xpetra::GloballyDistributed, const Teuchos::RCP< Node > &node=defaultArgNode())
Map constructor with Xpetra-defined contiguous uniform distribution.
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.
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 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)
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 Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
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.
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)
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void resumeFill(const RCP< ParameterList > ¶ms=Teuchos::null)
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)
RCP< Epetra_CrsMatrix > mtx_
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 resumeFill(const RCP< ParameterList > ¶ms=Teuchos::null)
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.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
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, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
bool hasMatrix() const
Does this have an underlying matrix.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra matrix.
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.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
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 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.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph.
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...
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
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 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.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
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)
Expert static fill complete.
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 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)
std::string description() const
A simple one-line description of this object.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
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.
Exception throws when you call an unimplemented method of Xpetra.
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.
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
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.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
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 scale(const Scalar &alpha)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
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)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
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.
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)
Expert static fill complete.
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)
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, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) 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...
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
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...
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)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, 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, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
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.
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
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
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.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
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)
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 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.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
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.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)