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."); }
110 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
118 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
127 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
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,
145 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
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 { }
210 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
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 {
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 272 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
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)
291 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
297 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap),
toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
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)
316 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
322 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(graph)))), isFillResumed_(false)
323 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
324 #ifdef HAVE_XPETRA_TPETRA
325 , isInitializedLocalMatrix_(false)
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)
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));
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)
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,
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 ();
480 std::vector<GlobalOrdinal> domainMapGids;
483 for (ordinal_type r = 0; r < lclNumRows; ++r) {
485 auto rowview = lclMatrix.row (r);
486 NumEntriesPerRowToAlloc[r] = rowview.length;
490 isFillResumed_ =
false;
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);
503 for(ordinal_type c = 0; c < rowview.length; c++) {
504 value_type value = rowview.value (c);
505 ordinal_type colidx = rowview.colidx (c);
513 GlobalOrdinal gcid = colMap->getGlobalElement(c);
514 if(rowMap->isNodeGlobalElement(gcid)) domainMapGids.push_back(gcid);
521 std::sort(domainMapGids.begin(), domainMapGids.end());
522 domainMapGids.erase(std::unique(domainMapGids.begin(), domainMapGids.end()), domainMapGids.end());
531 isInitializedLocalMatrix_ =
false;
562 const std::string tfecfFuncName(
"replaceGlobalValues");
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 " 569 std::runtime_error,
": values.size() must equal indices.size().");
581 const std::string tfecfFuncName(
"replaceLocalValues");
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 " 588 std::runtime_error,
": values.size() must equal indices.size().");
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);
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]);
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);
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);
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);
755 if(myImport==Teuchos::null)
756 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
758 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
836 NumEntries = numEntries;
845 NumEntries = numEntries;
854 GlobalOrdinal * eIndices;
856 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
857 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
871 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
872 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
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 {
923 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
945 std::ostringstream oss;
948 oss <<
"{status = fill complete" 955 oss <<
"{status = fill not complete" 980 const int myImageID = comm->getRank(),
981 numImages = comm->getSize();
986 width = std::max<size_t>(width,11) + 2;
996 if (myImageID == 0) out << this->
description() << std::endl;
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;
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;
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";
1078 out << std::setw(width) <<
"(Index,Value)";
1083 GlobalOrdinal gid =
getRowMap()->getGlobalElement(r);
1084 out << std::setw(width) << myImageID
1085 << std::setw(width) << gid
1086 << std::setw(width) << nE;
1092 for (
size_t j=0; j < nE; ++j) {
1093 out <<
" (" << rowinds[j]
1094 <<
", " << rowvals[j]
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)
1150 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1163 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1176 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1190 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1213 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1214 #ifdef HAVE_XPETRA_TPETRA 1215 local_matrix_type getLocalMatrix ()
const {
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);
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 1304 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
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)
1323 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
1329 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap),
toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
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)
1348 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
1354 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(graph)))), isFillResumed_(false)
1355 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1356 #ifdef HAVE_XPETRA_TPETRA
1357 , isInitializedLocalMatrix_(false)
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)
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));
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)
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,
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 ();
1512 std::vector<GlobalOrdinal> domainMapGids;
1515 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1517 auto rowview = lclMatrix.row (r);
1518 NumEntriesPerRowToAlloc[r] = rowview.length;
1522 isFillResumed_ =
false;
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);
1535 for(ordinal_type c = 0; c < rowview.length; c++) {
1536 value_type value = rowview.value (c);
1537 ordinal_type colidx = rowview.colidx (c);
1541 indout [c] = colidx;
1545 GlobalOrdinal gcid = colMap->getGlobalElement(c);
1546 if(rowMap->isNodeGlobalElement(gcid)) domainMapGids.push_back(gcid);
1553 std::sort(domainMapGids.begin(), domainMapGids.end());
1554 domainMapGids.erase(std::unique(domainMapGids.begin(), domainMapGids.end()), domainMapGids.end());
1563 isInitializedLocalMatrix_ =
false;
1594 const std::string tfecfFuncName(
"replaceGlobalValues");
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 " 1601 std::runtime_error,
": values.size() must equal indices.size().");
1613 const std::string tfecfFuncName(
"replaceLocalValues");
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 " 1620 std::runtime_error,
": values.size() must equal indices.size().");
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);
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]);
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);
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);
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);
1787 if(myImport==Teuchos::null)
1788 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1790 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1866 int numEntries = -1;
1868 NumEntries = numEntries;
1875 int numEntries = -1;
1877 NumEntries = numEntries;
1886 GlobalOrdinal * eIndices;
1888 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1889 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1903 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1904 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
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 {
1954 tmp->PutScalar(0.0);
1955 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
1977 std::ostringstream oss;
1980 oss <<
"{status = fill complete" 1987 oss <<
"{status = fill not complete" 2012 const int myImageID = comm->getRank(),
2013 numImages = comm->getSize();
2018 width = std::max<size_t>(width,11) + 2;
2028 if (myImageID == 0) out << this->
description() << std::endl;
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;
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;
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";
2110 out << std::setw(width) <<
"(Index,Value)";
2115 GlobalOrdinal gid =
getRowMap()->getGlobalElement(r);
2116 out << std::setw(width) << myImageID
2117 << std::setw(width) << gid
2118 << std::setw(width) << nE;
2124 for (
size_t j=0; j < nE; ++j) {
2125 out <<
" (" << rowinds[j]
2126 <<
", " << rowvals[j]
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)
2182 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2195 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2208 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2222 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2245 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 2246 #ifdef HAVE_XPETRA_TPETRA 2247 local_matrix_type getLocalMatrix ()
const {
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);
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_
T & get(const std::string &name, T def_value)
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.
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
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.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
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 resize(const size_type n, const T &val=T())
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.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.
static const EVerbosityLevel verbLevel_default
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.
static magnitudeType magnitude(T a)
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.
ArrayView< T > view(size_type lowerOffset, size_type size) const
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)