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)");
148 const local_matrix_type& lclMatrix,
149 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
150 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
151 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
152 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
155 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
211 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 { }
221 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
234 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
238 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
239 #ifdef HAVE_XPETRA_TPETRA
240 local_matrix_type getLocalMatrix ()
const {
242 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
245 void setAllValues (
const typename local_matrix_type::row_map_type& ptr,
246 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ind,
247 const typename local_matrix_type::values_type& val)
250 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
254 #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."
261 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
264 :
public CrsMatrix <double, int, int, EpetraNode>
273 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
274 #ifdef HAVE_XPETRA_TPETRA
293 : isFillResumed_(false)
308 : isFillResumed_(false)
327 isFillResumed_(false)
332 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
333 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
336 bool restrictComm=
false;
337 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
338 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
339 if(restrictComm && mtx_->NumMyRows()==0)
351 isFillResumed_(false)
356 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
357 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
360 bool restrictComm=
false;
361 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
363 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
372 isFillResumed_(false)
378 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
379 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
382 bool restrictComm=
false;
383 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
384 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
385 if(restrictComm && mtx_->NumMyRows()==0)
395 isFillResumed_(false)
401 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
402 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
405 bool restrictComm=
false;
406 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
408 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
411 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
412 #ifdef HAVE_XPETRA_TPETRA
438 const local_matrix_type& lclMatrix,
440 EpetraCrsMatrixT(lclMatrix, rowMap, colMap, Teuchos::null, Teuchos::null, params)
444 const local_matrix_type& lclMatrix,
445 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
446 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
447 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
448 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
453 typedef typename local_matrix_type::value_type value_type;
454 typedef typename local_matrix_type::ordinal_type ordinal_type;
457 ordinal_type lclNumRows = lclMatrix.numRows ();
458 ordinal_type lclNumCols = lclMatrix.numCols ();
462 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
464 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
467 for (ordinal_type r = 0; r < lclNumRows; ++r) {
469 auto rowview = lclMatrix.row (r);
470 NumEntriesPerRowToAlloc[r] = rowview.length;
474 isFillResumed_ =
false;
475 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
479 for (ordinal_type r = 0; r < lclNumRows; ++r) {
481 auto rowview = lclMatrix.row (r);
487 for(ordinal_type c = 0; c < rowview.length; c++) {
488 value_type value = rowview.value (c);
489 ordinal_type colidx = rowview.colidx (c);
492 "Xpetra::EpetraCrsMatrixT: local matrix contains column elements which are not in the provided column map!");
497 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
501 if (!domainMap.is_null() && !rangeMap.is_null())
507 isInitializedLocalMatrix_ =
false;
538 const std::string tfecfFuncName(
"replaceGlobalValues");
540 ": Fill must be active in order to call this method. If you have already "
541 "called fillComplete(), you need to call resumeFill() before you can "
545 std::runtime_error,
": values.size() must equal indices.size().");
557 const std::string tfecfFuncName(
"replaceLocalValues");
559 ": Fill must be active in order to call this method. If you have already "
560 "called fillComplete(), you need to call resumeFill() before you can "
564 std::runtime_error,
": values.size() must equal indices.size().");
591 bool ownMemory =
false;
596 myColind.
Resize(numNonZeros);
597 colind = Teuchos::arcp(myColind.
Values(), lowerOffset, numNonZeros, ownMemory);
601 double *& myValues = mtx_->ExpertExtractValues();
603 myValues =
new double[numNonZeros];
604 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
613 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
615 "An exception is thrown to let you know that you mismatched your pointers.");
618 if (values.
size() > 0) {
620 "An exception is thrown to let you know that you mismatched your pointers.");
622 "An exception is thrown to let you know that you mismatched your pointers.");
631 for (
size_t i = 0; i < N+1; i++)
632 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
641 bool ownMemory =
false;
650 for (
size_t i = 0; i < n+1; i++)
651 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
654 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
657 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
672 isFillResumed_ =
false;
678 if(!importer.is_null()) {
680 myimport = eImporter.getEpetra_Import().getRawPtr();
682 if(!exporter.is_null()) {
684 myexport = eExporter.getEpetra_Export().getRawPtr();
687 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
701 isFillResumed_ =
true;
709 isFillResumed_ =
false;
711 bool doOptimizeStorage =
true;
712 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
713 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
722 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
724 bool doOptimizeStorage =
true;
725 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
726 mtx_->FillComplete(doOptimizeStorage);
737 if(myImport==Teuchos::null)
738 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
740 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
812 NumEntries = numEntries;
821 NumEntries = numEntries;
832 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
833 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
847 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
848 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
857 XPETRA_ERR_CHECK(mtx_->ExtractDiagonalCopy(toEpetra<GlobalOrdinal,Node>(diag)));
872 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
888 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 {
907 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
929 std::ostringstream oss;
932 oss <<
"{status = fill complete"
939 oss <<
"{status = fill not complete"
964 const int myImageID = comm->getRank(),
965 numImages = comm->getSize();
970 width = std::max<size_t>(width,11) + 2;
980 if (myImageID == 0) out << this->
description() << std::endl;
987 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
992 if (myImageID == 0) out <<
"\nColumn map is row map.";
995 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1001 if (myImageID == 0) out <<
"\nDomain map is row map.";
1004 if (myImageID == 0) out <<
"\nDomain map is row map.";
1007 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
1013 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
1016 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
1019 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
1023 if (myImageID == 0) out << std::endl;
1027 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1028 if (myImageID == imageCtr) {
1029 out <<
"Node ID = " << imageCtr << std::endl;
1052 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1053 if (myImageID == imageCtr) {
1054 out << std::setw(width) <<
"Node ID"
1055 << std::setw(width) <<
"Global Row"
1056 << std::setw(width) <<
"Num Entries";
1058 out << std::setw(width) <<
"(Index,Value)";
1064 out << std::setw(width) << myImageID
1065 << std::setw(width) << gid
1066 << std::setw(width) << nE;
1072 for (
size_t j=0; j < nE; ++j) {
1073 out <<
" (" << rowinds[j]
1074 <<
", " << rowvals[j]
1082 for (
size_t j=0; j < nE; ++j) {
1083 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
1084 <<
", " << rowvals[j]
1102 Teuchos::LabeledObject::setObjectLabel(objectLabel);
1103 mtx_->SetLabel(objectLabel.c_str());
1128 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1141 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1154 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1168 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1191 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1192 #ifdef HAVE_XPETRA_TPETRA
1193 local_matrix_type getLocalMatrix ()
const {
1195 if (isInitializedLocalMatrix_)
1196 return localMatrix_;
1200 const int numRows = matrix->
NumMyRows();
1201 const int numCols = matrix->
NumMyCols();
1211 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
1212 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1213 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
1216 typename local_matrix_type::index_type kokkosColind(colind, nnz);
1217 typename local_matrix_type::values_type kokkosVals (vals, nnz);
1219 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
1220 isInitializedLocalMatrix_ =
true;
1222 return localMatrix_;
1225 void setAllValues (
const typename local_matrix_type::row_map_type& ,
1226 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
1227 const typename local_matrix_type::values_type& )
1230 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
1234 mutable local_matrix_type localMatrix_;
1235 mutable bool isInitializedLocalMatrix_ =
false;
1238 #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."
1258 #endif //#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
1260 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
1263 :
public CrsMatrix <double, int, long long, EpetraNode>
1272 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1273 #ifdef HAVE_XPETRA_TPETRA
1292 : isFillResumed_(false)
1307 : isFillResumed_(false)
1326 isFillResumed_(false)
1331 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1332 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1335 bool restrictComm=
false;
1336 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1337 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
1338 if(restrictComm && mtx_->NumMyRows()==0)
1350 isFillResumed_(false)
1355 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1356 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1359 bool restrictComm=
false;
1360 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1362 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
1371 isFillResumed_(false)
1377 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1378 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1381 bool restrictComm=
false;
1382 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1383 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
1384 if(restrictComm && mtx_->NumMyRows()==0)
1394 isFillResumed_(false)
1400 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1401 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1404 bool restrictComm=
false;
1405 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1407 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
1410 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1411 #ifdef HAVE_XPETRA_TPETRA
1434 const local_matrix_type& lclMatrix,
1436 EpetraCrsMatrixT(lclMatrix, rowMap, colMap, Teuchos::null, Teuchos::null, params)
1440 const local_matrix_type& lclMatrix,
1441 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
1442 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
1443 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
1444 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
1449 typedef typename local_matrix_type::value_type value_type;
1450 typedef typename local_matrix_type::ordinal_type ordinal_type;
1453 ordinal_type lclNumRows = lclMatrix.numRows ();
1454 ordinal_type lclNumCols = lclMatrix.numCols ();
1458 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
1460 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
1463 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1465 auto rowview = lclMatrix.row (r);
1466 NumEntriesPerRowToAlloc[r] = rowview.length;
1470 isFillResumed_ =
false;
1471 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1475 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1477 auto rowview = lclMatrix.row (r);
1483 for(ordinal_type c = 0; c < rowview.length; c++) {
1484 value_type value = rowview.value (c);
1485 ordinal_type colidx = rowview.colidx (c);
1489 indout [c] = colidx;
1492 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
1496 if (!domainMap.is_null() && !rangeMap.is_null())
1502 isInitializedLocalMatrix_ =
false;
1533 const std::string tfecfFuncName(
"replaceGlobalValues");
1535 ": Fill must be active in order to call this method. If you have already "
1536 "called fillComplete(), you need to call resumeFill() before you can "
1540 std::runtime_error,
": values.size() must equal indices.size().");
1552 const std::string tfecfFuncName(
"replaceLocalValues");
1554 ": Fill must be active in order to call this method. If you have already "
1555 "called fillComplete(), you need to call resumeFill() before you can "
1559 std::runtime_error,
": values.size() must equal indices.size().");
1585 int lowerOffset = 0;
1586 bool ownMemory =
false;
1591 myColind.
Resize(numNonZeros);
1592 colind = Teuchos::arcp(myColind.
Values(), lowerOffset, numNonZeros, ownMemory);
1596 double *& myValues = mtx_->ExpertExtractValues();
1598 myValues =
new double[numNonZeros];
1599 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
1608 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1610 "An exception is thrown to let you know that you mismatched your pointers.");
1613 if (values.
size() > 0) {
1615 "An exception is thrown to let you know that you mismatched your pointers.");
1617 "An exception is thrown to let you know that you mismatched your pointers.");
1626 for (
size_t i = 0; i < N+1; i++)
1627 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1635 int lowerOffset = 0;
1636 bool ownMemory =
false;
1645 for (
size_t i = 0; i < n+1; i++)
1646 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1649 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1652 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1668 isFillResumed_ =
false;
1674 if(!importer.is_null()) {
1676 myimport = eImporter.getEpetra_Import().getRawPtr();
1678 if(!exporter.is_null()) {
1680 myexport = eExporter.getEpetra_Export().getRawPtr();
1683 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
1697 isFillResumed_ =
true;
1705 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1707 bool doOptimizeStorage =
true;
1708 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1709 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
1718 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1720 bool doOptimizeStorage =
true;
1721 if (params != null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1722 mtx_->FillComplete(doOptimizeStorage);
1733 if(myImport==Teuchos::null)
1734 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1736 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1806 int numEntries = -1;
1808 NumEntries = numEntries;
1815 int numEntries = -1;
1817 NumEntries = numEntries;
1828 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1829 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1843 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1844 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1865 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
1881 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 {
1899 tmp->PutScalar(0.0);
1900 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
1922 std::ostringstream oss;
1925 oss <<
"{status = fill complete"
1932 oss <<
"{status = fill not complete"
1957 const int myImageID = comm->getRank(),
1958 numImages = comm->getSize();
1963 width = std::max<size_t>(width,11) + 2;
1973 if (myImageID == 0) out << this->
description() << std::endl;
1980 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
1985 if (myImageID == 0) out <<
"\nColumn map is row map.";
1988 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1994 if (myImageID == 0) out <<
"\nDomain map is row map.";
1997 if (myImageID == 0) out <<
"\nDomain map is row map.";
2000 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
2006 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
2009 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
2012 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
2016 if (myImageID == 0) out << std::endl;
2020 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2021 if (myImageID == imageCtr) {
2022 out <<
"Node ID = " << imageCtr << std::endl;
2045 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2046 if (myImageID == imageCtr) {
2047 out << std::setw(width) <<
"Node ID"
2048 << std::setw(width) <<
"Global Row"
2049 << std::setw(width) <<
"Num Entries";
2051 out << std::setw(width) <<
"(Index,Value)";
2057 out << std::setw(width) << myImageID
2058 << std::setw(width) << gid
2059 << std::setw(width) << nE;
2065 for (
size_t j=0; j < nE; ++j) {
2066 out <<
" (" << rowinds[j]
2067 <<
", " << rowvals[j]
2075 for (
size_t j=0; j < nE; ++j) {
2076 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
2077 <<
", " << rowvals[j]
2095 Teuchos::LabeledObject::setObjectLabel(objectLabel);
2096 mtx_->SetLabel(objectLabel.c_str());
2121 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2134 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2147 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2161 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2184 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
2185 #ifdef HAVE_XPETRA_TPETRA
2186 local_matrix_type getLocalMatrix ()
const {
2188 if (isInitializedLocalMatrix_)
2189 return localMatrix_;
2193 const int numRows = matrix->
NumMyRows();
2194 const int numCols = matrix->
NumMyCols();
2204 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
2205 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
2206 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
2209 typename local_matrix_type::index_type kokkosColind(colind, nnz);
2210 typename local_matrix_type::values_type kokkosVals (vals, nnz);
2212 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
2213 isInitializedLocalMatrix_ =
true;
2215 return localMatrix_;
2218 void setAllValues (
const typename local_matrix_type::row_map_type& ,
2219 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
2220 const typename local_matrix_type::values_type& )
2223 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
2227 mutable local_matrix_type localMatrix_;
2228 mutable bool isInitializedLocalMatrix_ =
false;
2231 #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."
2244 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
2248 #define XPETRA_EPETRACRSMATRIX_SHORT
2249 #endif // XPETRA_EPETRACRSMATRIX_HPP
void setObjectLabel(const std::string &objectLabel)
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
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).
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)
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
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)
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
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)
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)
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra matrix.
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 getNodeNumEntries() const
Returns the local number of entries in this matrix.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
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.
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 leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
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)
int Resize(int Length_in)
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)
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
void resumeFill(const RCP< ParameterList > ¶ms=null)
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...
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 > &=Teuchos::null)
Constructor specifying fixed number of entries for 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 > &=Teuchos::null)
Expert static fill complete.
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 > &=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
const RCP< const Comm< int > > getComm() const
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
bool hasMatrix() const
Does this have an underlying matrix.
RCP< Epetra_CrsMatrix > mtx_
The underlying actual matrix object.
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...
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
T & get(const std::string &name, T def_value)
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
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.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
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
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
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...
size_t getNodeNumEntries() const
Returns the local number of entries in 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.
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 doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
EpetraCrsMatrixT(const EpetraCrsMatrixT &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...
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 > &=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
virtual ~EpetraCrsMatrixT()
Destructor.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of 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.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
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)
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
std::string description() const
A simple one-line description of this object.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Teuchos::ArrayView< const size_t > &) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
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.
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 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.
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 setAllToScalar(const Scalar &alpha)
bool hasMatrix() const
Does this have an underlying matrix.
void expertStaticFillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=Teuchos::null, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const RCP< ParameterList > &=Teuchos::null)
Expert static fill complete.
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.
virtual ~EpetraCrsMatrixT()
Destructor.
void setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
std::string description() const
A simple one-line description of this object.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
#define XPETRA_ERR_CHECK(arg)
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 > &=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
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< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
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.
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.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
size_t getNodeNumCols() const
Returns the number of matrix columns owned on the calling node.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra 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.
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)
bool isFillActive() const
Returns true if the matrix is in edit mode.
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
Deep copy constructor.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
void 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
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
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.
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
Exception throws when you call an unimplemented method of Xpetra.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
const RCP< const Comm< int > > getComm() const
Returns the communicator.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
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 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.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
size_t global_size_t
Global size_t object.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
static const EVerbosityLevel verbLevel_default
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 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.
static magnitudeType magnitude(T a)
void fillComplete(const RCP< ParameterList > ¶ms=null)
Signal that data entry is complete.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
global_size_t getGlobalNumCols() const
Number of global columns in the 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...
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 setObjectLabel(const std::string &objectLabel)
void scale(const Scalar &alpha)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
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.
const RCP< const Comm< int > > getComm() const
Returns the communicator.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
bool hasMatrix() const
Does this have an underlying matrix.
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...
bool isFillActive() const
Returns true if the matrix is in edit mode.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &)
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
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)
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying a previously constructed graph.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying a previously constructed graph.
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.
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)
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
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 doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
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.
RCP< Epetra_CrsMatrix > mtx_
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &)
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Teuchos::ArrayView< const size_t > &) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets...
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
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 fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete, specifying domain and range maps.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
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 getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
bool isFillResumed_
Flag to keep track of fill status.
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.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
void setObjectLabel(const std::string &objectLabel)
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
int ExtractCrsDataPointers(int *&IndexOffset, int *&Indices, double *&Values_in) const
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
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 > &=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix. ...
int NumMyNonzeros() const
EpetraGlobalOrdinal GlobalOrdinal
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)