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)");
202 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 { }
211 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
224 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
228 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 229 #ifdef HAVE_XPETRA_TPETRA 230 local_matrix_type getLocalMatrix ()
const {
232 "Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
237 local_matrix_type localMatrix_;
240 #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." 247 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 250 :
public CrsMatrix <double, int, int, EpetraNode>
259 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 260 #ifdef HAVE_XPETRA_TPETRA 273 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
274 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
275 #ifdef HAVE_XPETRA_TPETRA
276 , isInitializedLocalMatrix_(false)
284 : isFillResumed_(false)
285 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
286 #ifdef HAVE_XPETRA_TPETRA
287 , isInitializedLocalMatrix_(false)
292 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
298 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap),
toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
299 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
300 #ifdef HAVE_XPETRA_TPETRA
301 , isInitializedLocalMatrix_(false)
309 : isFillResumed_(false)
310 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
311 #ifdef HAVE_XPETRA_TPETRA
312 , isInitializedLocalMatrix_(false)
317 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
323 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(graph)))), isFillResumed_(false)
324 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
325 #ifdef HAVE_XPETRA_TPETRA
326 , isInitializedLocalMatrix_(false)
338 isFillResumed_(false)
339 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
340 #ifdef HAVE_XPETRA_TPETRA
341 , isInitializedLocalMatrix_(false)
348 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
349 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
352 bool restrictComm=
false;
353 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
354 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
355 if(restrictComm && mtx_->NumMyRows()==0)
367 isFillResumed_(false)
368 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
369 #ifdef HAVE_XPETRA_TPETRA
370 , isInitializedLocalMatrix_(false)
377 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
378 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
381 bool restrictComm=
false;
382 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
384 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
393 isFillResumed_(false)
394 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
395 #ifdef HAVE_XPETRA_TPETRA
396 , isInitializedLocalMatrix_(false)
404 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
405 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
408 bool restrictComm=
false;
409 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
410 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
411 if(restrictComm && mtx_->NumMyRows()==0)
421 isFillResumed_(false)
422 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
423 #ifdef HAVE_XPETRA_TPETRA
424 , isInitializedLocalMatrix_(false)
432 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
433 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
436 bool restrictComm=
false;
437 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
439 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
442 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 443 #ifdef HAVE_XPETRA_TPETRA 466 const local_matrix_type& lclMatrix,
470 typedef typename local_matrix_type::value_type value_type;
471 typedef typename local_matrix_type::ordinal_type ordinal_type;
474 ordinal_type lclNumRows = lclMatrix.numRows ();
475 ordinal_type lclNumCols = lclMatrix.numCols ();
481 std::vector<GlobalOrdinal> domainMapGids;
484 for (ordinal_type r = 0; r < lclNumRows; ++r) {
486 auto rowview = lclMatrix.row (r);
487 NumEntriesPerRowToAlloc[r] = rowview.length;
491 isFillResumed_ =
false;
493 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(
DynamicProfile)));
496 for (ordinal_type r = 0; r < lclNumRows; ++r) {
498 auto rowview = lclMatrix.row (r);
504 for(ordinal_type c = 0; c < rowview.length; c++) {
505 value_type value = rowview.value (c);
506 ordinal_type colidx = rowview.colidx (c);
514 GlobalOrdinal gcid = colMap->getGlobalElement(c);
515 if(rowMap->isNodeGlobalElement(gcid)) domainMapGids.push_back(gcid);
522 std::sort(domainMapGids.begin(), domainMapGids.end());
523 domainMapGids.erase(std::unique(domainMapGids.begin(), domainMapGids.end()), domainMapGids.end());
532 isInitializedLocalMatrix_ =
false;
563 const std::string tfecfFuncName(
"replaceGlobalValues");
565 ": Fill must be active in order to call this method. If you have already " 566 "called fillComplete(), you need to call resumeFill() before you can " 570 std::runtime_error,
": values.size() must equal indices.size().");
582 const std::string tfecfFuncName(
"replaceLocalValues");
584 ": Fill must be active in order to call this method. If you have already " 585 "called fillComplete(), you need to call resumeFill() before you can " 589 std::runtime_error,
": values.size() must equal indices.size().");
616 bool ownMemory =
false;
620 Epetra_IntSerialDenseVector& myColind = mtx_->ExpertExtractIndices();
621 myColind.Resize(numNonZeros);
622 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
626 double *& myValues = mtx_->ExpertExtractValues();
628 myValues =
new double[numNonZeros];
629 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
638 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
640 "An exception is thrown to let you know that you mismatched your pointers.");
643 if (values.
size() > 0) {
645 "An exception is thrown to let you know that you mismatched your pointers.");
647 "An exception is thrown to let you know that you mismatched your pointers.");
654 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
655 myRowptr.Resize(N+1);
656 for (
size_t i = 0; i < N+1; i++)
657 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
666 bool ownMemory =
false;
673 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
675 for (
size_t i = 0; i < n+1; i++)
676 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
679 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
682 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
696 const Epetra_Import * myimport =0;
697 const Epetra_Export * myexport =0;
699 if(!importer.is_null()) {
701 myimport = eImporter.getEpetra_Import().getRawPtr();
703 if(!exporter.is_null()) {
705 myexport = eExporter.getEpetra_Export().getRawPtr();
708 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
722 isFillResumed_ =
true;
730 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
732 bool doOptimizeStorage =
true;
733 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
734 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
743 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
745 bool doOptimizeStorage =
true;
746 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
747 mtx_->FillComplete(doOptimizeStorage);
758 if(myImport==Teuchos::null)
759 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
761 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
839 NumEntries = numEntries;
848 NumEntries = numEntries;
857 GlobalOrdinal * eIndices;
859 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
860 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
874 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
875 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
907 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 {
926 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
948 std::ostringstream oss;
951 oss <<
"{status = fill complete" 958 oss <<
"{status = fill not complete" 983 const int myImageID = comm->getRank(),
984 numImages = comm->getSize();
989 width = std::max<size_t>(width,11) + 2;
999 if (myImageID == 0) out << this->
description() << std::endl;
1007 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
1012 if (myImageID == 0) out <<
"\nColumn map is row map.";
1015 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1021 if (myImageID == 0) out <<
"\nDomain map is row map.";
1024 if (myImageID == 0) out <<
"\nDomain map is row map.";
1027 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
1033 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
1036 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
1039 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
1043 if (myImageID == 0) out << std::endl;
1047 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1048 if (myImageID == imageCtr) {
1049 out <<
"Node ID = " << imageCtr << std::endl;
1064 out <<
"Node number of diagonals = " <<
getNodeNumDiags() << std::endl;
1075 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1076 if (myImageID == imageCtr) {
1077 out << std::setw(width) <<
"Node ID" 1078 << std::setw(width) <<
"Global Row" 1079 << std::setw(width) <<
"Num Entries";
1081 out << std::setw(width) <<
"(Index,Value)";
1086 GlobalOrdinal gid =
getRowMap()->getGlobalElement(r);
1087 out << std::setw(width) << myImageID
1088 << std::setw(width) << gid
1089 << std::setw(width) << nE;
1095 for (
size_t j=0; j < nE; ++j) {
1096 out <<
" (" << rowinds[j]
1097 <<
", " << rowvals[j]
1105 for (
size_t j=0; j < nE; ++j) {
1106 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
1107 <<
", " << rowvals[j]
1129 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(*(matrix.mtx_)))), isFillResumed_(false)
1130 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1131 #ifdef HAVE_XPETRA_TPETRA
1132 , isInitializedLocalMatrix_(false)
1153 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1166 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1179 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1193 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1216 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1217 #ifdef HAVE_XPETRA_TPETRA 1218 local_matrix_type getLocalMatrix ()
const {
1221 "Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
1222 if (isInitializedLocalMatrix_)
1223 return localMatrix_;
1227 const int numRows = matrix->NumMyRows();
1228 const int numCols = matrix->NumMyCols();
1229 const int nnz = matrix->NumMyNonzeros();
1234 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
1238 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
1239 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1240 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
1243 typename local_matrix_type::index_type kokkosColind(colind, nnz);
1244 typename local_matrix_type::values_type kokkosVals (vals, nnz);
1246 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
1247 isInitializedLocalMatrix_ =
true;
1249 return localMatrix_;
1253 #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." 1264 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1265 #ifdef HAVE_XPETRA_TPETRA 1267 local_matrix_type localMatrix_;
1269 bool isInitializedLocalMatrix_;
1272 #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." 1279 #endif //#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 1281 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 1284 :
public CrsMatrix <double, int, long long, EpetraNode>
1293 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1294 #ifdef HAVE_XPETRA_TPETRA 1307 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
1308 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1309 #ifdef HAVE_XPETRA_TPETRA
1310 , isInitializedLocalMatrix_(false)
1318 : isFillResumed_(false)
1319 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1320 #ifdef HAVE_XPETRA_TPETRA
1321 , isInitializedLocalMatrix_(false)
1326 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
1332 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(rowMap),
toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow,
toEpetra(pftype)))), isFillResumed_(false)
1333 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1334 #ifdef HAVE_XPETRA_TPETRA
1335 , isInitializedLocalMatrix_(false)
1343 : isFillResumed_(false)
1344 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1345 #ifdef HAVE_XPETRA_TPETRA
1346 , isInitializedLocalMatrix_(false)
1351 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(pftype)));
1357 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(
Copy,
toEpetra<GlobalOrdinal,Node>(graph)))), isFillResumed_(false)
1358 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1359 #ifdef HAVE_XPETRA_TPETRA
1360 , isInitializedLocalMatrix_(false)
1372 isFillResumed_(false)
1373 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1374 #ifdef HAVE_XPETRA_TPETRA
1375 , isInitializedLocalMatrix_(false)
1382 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1383 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1386 bool restrictComm=
false;
1387 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1388 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
1389 if(restrictComm && mtx_->NumMyRows()==0)
1401 isFillResumed_(false)
1402 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1403 #ifdef HAVE_XPETRA_TPETRA
1404 , isInitializedLocalMatrix_(false)
1411 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1412 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1415 bool restrictComm=
false;
1416 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1418 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
1427 isFillResumed_(false)
1428 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1429 #ifdef HAVE_XPETRA_TPETRA
1430 , isInitializedLocalMatrix_(false)
1438 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1439 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1442 bool restrictComm=
false;
1443 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1444 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
1445 if(restrictComm && mtx_->NumMyRows()==0)
1455 isFillResumed_(false)
1456 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1457 #ifdef HAVE_XPETRA_TPETRA
1458 , isInitializedLocalMatrix_(false)
1466 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1467 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1470 bool restrictComm=
false;
1471 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1473 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
1476 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1477 #ifdef HAVE_XPETRA_TPETRA 1500 const local_matrix_type& lclMatrix,
1504 typedef typename local_matrix_type::value_type value_type;
1505 typedef typename local_matrix_type::ordinal_type ordinal_type;
1508 ordinal_type lclNumRows = lclMatrix.numRows ();
1509 ordinal_type lclNumCols = lclMatrix.numCols ();
1515 std::vector<GlobalOrdinal> domainMapGids;
1518 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1520 auto rowview = lclMatrix.row (r);
1521 NumEntriesPerRowToAlloc[r] = rowview.length;
1525 isFillResumed_ =
false;
1527 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(
Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
toEpetra(
DynamicProfile)));
1530 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1532 auto rowview = lclMatrix.row (r);
1538 for(ordinal_type c = 0; c < rowview.length; c++) {
1539 value_type value = rowview.value (c);
1540 ordinal_type colidx = rowview.colidx (c);
1544 indout [c] = colidx;
1548 GlobalOrdinal gcid = colMap->getGlobalElement(c);
1549 if(rowMap->isNodeGlobalElement(gcid)) domainMapGids.push_back(gcid);
1556 std::sort(domainMapGids.begin(), domainMapGids.end());
1557 domainMapGids.erase(std::unique(domainMapGids.begin(), domainMapGids.end()), domainMapGids.end());
1566 isInitializedLocalMatrix_ =
false;
1597 const std::string tfecfFuncName(
"replaceGlobalValues");
1599 ": Fill must be active in order to call this method. If you have already " 1600 "called fillComplete(), you need to call resumeFill() before you can " 1604 std::runtime_error,
": values.size() must equal indices.size().");
1616 const std::string tfecfFuncName(
"replaceLocalValues");
1618 ": Fill must be active in order to call this method. If you have already " 1619 "called fillComplete(), you need to call resumeFill() before you can " 1623 std::runtime_error,
": values.size() must equal indices.size().");
1649 int lowerOffset = 0;
1650 bool ownMemory =
false;
1654 Epetra_IntSerialDenseVector& myColind = mtx_->ExpertExtractIndices();
1655 myColind.Resize(numNonZeros);
1656 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1660 double *& myValues = mtx_->ExpertExtractValues();
1662 myValues =
new double[numNonZeros];
1663 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
1672 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1674 "An exception is thrown to let you know that you mismatched your pointers.");
1677 if (values.
size() > 0) {
1679 "An exception is thrown to let you know that you mismatched your pointers.");
1681 "An exception is thrown to let you know that you mismatched your pointers.");
1688 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
1689 myRowptr.Resize(N+1);
1690 for (
size_t i = 0; i < N+1; i++)
1691 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1699 int lowerOffset = 0;
1700 bool ownMemory =
false;
1707 Epetra_IntSerialDenseVector& myRowptr = mtx_->ExpertExtractIndexOffset();
1709 for (
size_t i = 0; i < n+1; i++)
1710 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1713 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1716 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1731 const Epetra_Import * myimport =0;
1732 const Epetra_Export * myexport =0;
1734 if(!importer.is_null()) {
1736 myimport = eImporter.getEpetra_Import().getRawPtr();
1738 if(!exporter.is_null()) {
1740 myexport = eExporter.getEpetra_Export().getRawPtr();
1743 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
1757 isFillResumed_ =
true;
1765 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1767 bool doOptimizeStorage =
true;
1768 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1769 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
1778 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1780 bool doOptimizeStorage =
true;
1781 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1782 mtx_->FillComplete(doOptimizeStorage);
1793 if(myImport==Teuchos::null)
1794 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1796 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1872 int numEntries = -1;
1874 NumEntries = numEntries;
1881 int numEntries = -1;
1883 NumEntries = numEntries;
1892 GlobalOrdinal * eIndices;
1894 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1895 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1909 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1910 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1942 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 {
1960 tmp->PutScalar(0.0);
1961 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
1983 std::ostringstream oss;
1986 oss <<
"{status = fill complete" 1993 oss <<
"{status = fill not complete" 2018 const int myImageID = comm->getRank(),
2019 numImages = comm->getSize();
2024 width = std::max<size_t>(width,11) + 2;
2034 if (myImageID == 0) out << this->
description() << std::endl;
2042 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
2047 if (myImageID == 0) out <<
"\nColumn map is row map.";
2050 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
2056 if (myImageID == 0) out <<
"\nDomain map is row map.";
2059 if (myImageID == 0) out <<
"\nDomain map is row map.";
2062 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
2068 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
2071 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
2074 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
2078 if (myImageID == 0) out << std::endl;
2082 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2083 if (myImageID == imageCtr) {
2084 out <<
"Node ID = " << imageCtr << std::endl;
2099 out <<
"Node number of diagonals = " <<
getNodeNumDiags() << std::endl;
2110 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2111 if (myImageID == imageCtr) {
2112 out << std::setw(width) <<
"Node ID" 2113 << std::setw(width) <<
"Global Row" 2114 << std::setw(width) <<
"Num Entries";
2116 out << std::setw(width) <<
"(Index,Value)";
2121 GlobalOrdinal gid =
getRowMap()->getGlobalElement(r);
2122 out << std::setw(width) << myImageID
2123 << std::setw(width) << gid
2124 << std::setw(width) << nE;
2130 for (
size_t j=0; j < nE; ++j) {
2131 out <<
" (" << rowinds[j]
2132 <<
", " << rowvals[j]
2140 for (
size_t j=0; j < nE; ++j) {
2141 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
2142 <<
", " << rowvals[j]
2164 : mtx_(
Teuchos::
rcp(new Epetra_CrsMatrix(*(matrix.mtx_)))), isFillResumed_(false)
2165 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
2166 #ifdef HAVE_XPETRA_TPETRA
2167 , isInitializedLocalMatrix_(false)
2188 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2201 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2214 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2228 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2251 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 2252 #ifdef HAVE_XPETRA_TPETRA 2253 local_matrix_type getLocalMatrix ()
const {
2256 "Xpetra::EpetraCrsMatrix::getLocalMatrix: matrix must be filled and completed before you can access the data through the Kokkos interface!");
2257 if (isInitializedLocalMatrix_)
2258 return localMatrix_;
2262 const int numRows = matrix->NumMyRows();
2263 const int numCols = matrix->NumMyCols();
2264 const int nnz = matrix->NumMyNonzeros();
2269 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
2273 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
2274 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
2275 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
2278 typename local_matrix_type::index_type kokkosColind(colind, nnz);
2279 typename local_matrix_type::values_type kokkosVals (vals, nnz);
2281 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
2282 isInitializedLocalMatrix_ =
true;
2284 return localMatrix_;
2288 #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." 2299 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 2300 #ifdef HAVE_XPETRA_TPETRA 2302 local_matrix_type localMatrix_;
2304 bool isInitializedLocalMatrix_;
2307 #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." 2314 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 2318 #define XPETRA_EPETRACRSMATRIX_SHORT 2319 #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)
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
EpetraCrsMatrixT(const Teuchos::RCP< const 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)
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
#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 haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
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)