Go to the documentation of this file.
46 #ifndef XPETRA_EPETRACRSMATRIX_HPP
47 #define XPETRA_EPETRACRSMATRIX_HPP
51 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
52 #ifdef HAVE_XPETRA_TPETRA
53 #include <Kokkos_View.hpp>
61 #include <Epetra_CrsMatrix.h>
62 #include <Epetra_Map.h>
69 #include "Xpetra_MapFactory.hpp"
77 template<
class EpetraGlobalOrdinal,
class Node>
79 :
public CrsMatrix<double, int, EpetraGlobalOrdinal, Node>
85 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
86 #ifdef HAVE_XPETRA_TPETRA
95 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
99 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
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)");
212 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 { }
222 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
235 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
239 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
240 #ifdef HAVE_XPETRA_TPETRA
241 local_matrix_type getLocalMatrix ()
const {
243 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
246 void setAllValues (
const typename local_matrix_type::row_map_type& ptr,
247 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ind,
248 const typename local_matrix_type::values_type& val)
251 "Xpetra::EpetraCrsMatrix only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
255 #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."
262 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
265 :
public CrsMatrix <double, int, int, EpetraNode>
274 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
275 #ifdef HAVE_XPETRA_TPETRA
294 : isFillResumed_(false)
309 : isFillResumed_(false)
328 isFillResumed_(false)
333 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
334 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
337 bool restrictComm=
false;
338 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
339 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
340 if(restrictComm && mtx_->NumMyRows()==0)
352 isFillResumed_(false)
357 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
358 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
361 bool restrictComm=
false;
362 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
364 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
373 isFillResumed_(false)
379 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
380 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
383 bool restrictComm=
false;
384 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
385 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
386 if(restrictComm && mtx_->NumMyRows()==0)
396 isFillResumed_(false)
402 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
403 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
406 bool restrictComm=
false;
407 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
409 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
412 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
413 #ifdef HAVE_XPETRA_TPETRA
439 const local_matrix_type& lclMatrix,
445 const local_matrix_type& lclMatrix,
446 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
447 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
448 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
449 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
454 typedef typename local_matrix_type::value_type value_type;
455 typedef typename local_matrix_type::ordinal_type ordinal_type;
458 ordinal_type lclNumRows = lclMatrix.numRows ();
459 ordinal_type lclNumCols = lclMatrix.numCols ();
463 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
465 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
468 for (ordinal_type r = 0; r < lclNumRows; ++r) {
470 auto rowview = lclMatrix.row (r);
471 NumEntriesPerRowToAlloc[r] = rowview.length;
475 isFillResumed_ =
false;
476 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
480 for (ordinal_type r = 0; r < lclNumRows; ++r) {
482 auto rowview = lclMatrix.row (r);
488 for(ordinal_type c = 0; c < rowview.length; c++) {
489 value_type value = rowview.value (c);
490 ordinal_type colidx = rowview.colidx (c);
493 "Xpetra::EpetraCrsMatrixT: local matrix contains column elements which are not in the provided column map!");
498 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
502 if (!domainMap.is_null() && !rangeMap.is_null())
508 isInitializedLocalMatrix_ =
false;
539 const std::string tfecfFuncName(
"replaceGlobalValues");
541 ": Fill must be active in order to call this method. If you have already "
542 "called fillComplete(), you need to call resumeFill() before you can "
546 std::runtime_error,
": values.size() must equal indices.size().");
558 const std::string tfecfFuncName(
"replaceLocalValues");
560 ": Fill must be active in order to call this method. If you have already "
561 "called fillComplete(), you need to call resumeFill() before you can "
565 std::runtime_error,
": values.size() must equal indices.size().");
592 bool ownMemory =
false;
597 myColind.
Resize(numNonZeros);
598 colind = Teuchos::arcp(myColind.
Values(), lowerOffset, numNonZeros, ownMemory);
602 double *& myValues = mtx_->ExpertExtractValues();
604 myValues =
new double[numNonZeros];
605 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
614 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
616 "An exception is thrown to let you know that you mismatched your pointers.");
619 if (values.
size() > 0) {
621 "An exception is thrown to let you know that you mismatched your pointers.");
623 "An exception is thrown to let you know that you mismatched your pointers.");
632 for (
size_t i = 0; i < N+1; i++)
633 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
642 bool ownMemory =
false;
651 for (
size_t i = 0; i < n+1; i++)
652 (*
const_cast<size_t*
>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
655 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
658 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
673 isFillResumed_ =
false;
679 if(!importer.is_null()) {
681 myimport = eImporter.getEpetra_Import().getRawPtr();
683 if(!exporter.is_null()) {
685 myexport = eExporter.getEpetra_Export().getRawPtr();
688 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
702 isFillResumed_ =
true;
710 isFillResumed_ =
false;
712 bool doOptimizeStorage =
true;
713 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
714 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
723 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
725 bool doOptimizeStorage =
true;
726 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
727 mtx_->FillComplete(doOptimizeStorage);
738 if(myImport==Teuchos::null)
739 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
741 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
816 NumEntries = numEntries;
825 NumEntries = numEntries;
836 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
837 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
851 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
852 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
861 XPETRA_ERR_CHECK(mtx_->ExtractDiagonalCopy(toEpetra<GlobalOrdinal,Node>(diag)));
876 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
892 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 {
911 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
933 std::ostringstream oss;
936 oss <<
"{status = fill complete"
943 oss <<
"{status = fill not complete"
968 const int myImageID = comm->getRank(),
969 numImages = comm->getSize();
974 width = std::max<size_t>(width,11) + 2;
984 if (myImageID == 0) out << this->
description() << std::endl;
991 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
996 if (myImageID == 0) out <<
"\nColumn map is row map.";
999 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1005 if (myImageID == 0) out <<
"\nDomain map is row map.";
1008 if (myImageID == 0) out <<
"\nDomain map is row map.";
1011 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
1017 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
1020 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
1023 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
1027 if (myImageID == 0) out << std::endl;
1031 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1032 if (myImageID == imageCtr) {
1033 out <<
"Node ID = " << imageCtr << std::endl;
1056 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1057 if (myImageID == imageCtr) {
1058 out << std::setw(width) <<
"Node ID"
1059 << std::setw(width) <<
"Global Row"
1060 << std::setw(width) <<
"Num Entries";
1062 out << std::setw(width) <<
"(Index,Value)";
1068 out << std::setw(width) << myImageID
1069 << std::setw(width) << gid
1070 << std::setw(width) << nE;
1076 for (
size_t j=0; j < nE; ++j) {
1077 out <<
" (" << rowinds[j]
1078 <<
", " << rowvals[j]
1086 for (
size_t j=0; j < nE; ++j) {
1087 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
1088 <<
", " << rowvals[j]
1107 mtx_->SetLabel(objectLabel.c_str());
1132 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1145 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1158 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1172 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1195 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1196 #ifdef HAVE_XPETRA_TPETRA
1197 local_matrix_type getLocalMatrix ()
const {
1199 if (isInitializedLocalMatrix_)
1200 return localMatrix_;
1204 const int numRows = matrix->NumMyRows();
1205 const int numCols = matrix->NumMyCols();
1206 const int nnz = matrix->NumMyNonzeros();
1211 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
1215 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
1216 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1217 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
1220 typename local_matrix_type::index_type kokkosColind(colind, nnz);
1221 typename local_matrix_type::values_type kokkosVals (vals, nnz);
1223 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
1224 isInitializedLocalMatrix_ =
true;
1226 return localMatrix_;
1229 void setAllValues (
const typename local_matrix_type::row_map_type& ,
1230 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
1231 const typename local_matrix_type::values_type& )
1234 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
1238 mutable local_matrix_type localMatrix_;
1239 mutable bool isInitializedLocalMatrix_ =
false;
1242 #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."
1262 #endif //#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
1264 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
1267 :
public CrsMatrix <double, int, long long, EpetraNode>
1276 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1277 #ifdef HAVE_XPETRA_TPETRA
1296 : isFillResumed_(false)
1311 : isFillResumed_(false)
1330 isFillResumed_(false)
1335 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1336 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1339 bool restrictComm=
false;
1340 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1341 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
1342 if(restrictComm && mtx_->NumMyRows()==0)
1354 isFillResumed_(false)
1359 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1360 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1363 bool restrictComm=
false;
1364 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1366 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
1375 isFillResumed_(false)
1381 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1382 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1385 bool restrictComm=
false;
1386 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1387 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
1388 if(restrictComm && mtx_->NumMyRows()==0)
1398 isFillResumed_(false)
1404 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1405 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1408 bool restrictComm=
false;
1409 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1411 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
1414 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1415 #ifdef HAVE_XPETRA_TPETRA
1438 const local_matrix_type& lclMatrix,
1444 const local_matrix_type& lclMatrix,
1445 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
1446 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
1447 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
1448 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
1453 typedef typename local_matrix_type::value_type value_type;
1454 typedef typename local_matrix_type::ordinal_type ordinal_type;
1457 ordinal_type lclNumRows = lclMatrix.numRows ();
1458 ordinal_type lclNumCols = lclMatrix.numCols ();
1462 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
1464 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
1467 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1469 auto rowview = lclMatrix.row (r);
1470 NumEntriesPerRowToAlloc[r] = rowview.length;
1474 isFillResumed_ =
false;
1475 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1479 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1481 auto rowview = lclMatrix.row (r);
1487 for(ordinal_type c = 0; c < rowview.length; c++) {
1488 value_type value = rowview.value (c);
1489 ordinal_type colidx = rowview.colidx (c);
1493 indout [c] = colidx;
1496 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
1500 if (!domainMap.is_null() && !rangeMap.is_null())
1506 isInitializedLocalMatrix_ =
false;
1537 const std::string tfecfFuncName(
"replaceGlobalValues");
1539 ": Fill must be active in order to call this method. If you have already "
1540 "called fillComplete(), you need to call resumeFill() before you can "
1544 std::runtime_error,
": values.size() must equal indices.size().");
1556 const std::string tfecfFuncName(
"replaceLocalValues");
1558 ": Fill must be active in order to call this method. If you have already "
1559 "called fillComplete(), you need to call resumeFill() before you can "
1563 std::runtime_error,
": values.size() must equal indices.size().");
1589 int lowerOffset = 0;
1590 bool ownMemory =
false;
1595 myColind.
Resize(numNonZeros);
1596 colind = Teuchos::arcp(myColind.
Values(), lowerOffset, numNonZeros, ownMemory);
1600 double *& myValues = mtx_->ExpertExtractValues();
1602 myValues =
new double[numNonZeros];
1603 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
1612 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1614 "An exception is thrown to let you know that you mismatched your pointers.");
1617 if (values.
size() > 0) {
1619 "An exception is thrown to let you know that you mismatched your pointers.");
1621 "An exception is thrown to let you know that you mismatched your pointers.");
1630 for (
size_t i = 0; i < N+1; i++)
1631 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1639 int lowerOffset = 0;
1640 bool ownMemory =
false;
1649 for (
size_t i = 0; i < n+1; i++)
1650 (*
const_cast<size_t*
>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1653 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1656 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1672 isFillResumed_ =
false;
1678 if(!importer.is_null()) {
1680 myimport = eImporter.getEpetra_Import().getRawPtr();
1682 if(!exporter.is_null()) {
1684 myexport = eExporter.getEpetra_Export().getRawPtr();
1687 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
1701 isFillResumed_ =
true;
1709 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1711 bool doOptimizeStorage =
true;
1712 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1713 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
1722 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1724 bool doOptimizeStorage =
true;
1725 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1726 mtx_->FillComplete(doOptimizeStorage);
1737 if(myImport==Teuchos::null)
1738 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1740 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1813 int numEntries = -1;
1815 NumEntries = numEntries;
1822 int numEntries = -1;
1824 NumEntries = numEntries;
1835 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1836 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1850 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1851 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1872 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
1888 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 {
1906 tmp->PutScalar(0.0);
1907 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
1929 std::ostringstream oss;
1932 oss <<
"{status = fill complete"
1939 oss <<
"{status = fill not complete"
1964 const int myImageID = comm->getRank(),
1965 numImages = comm->getSize();
1970 width = std::max<size_t>(width,11) + 2;
1980 if (myImageID == 0) out << this->
description() << std::endl;
1987 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
1992 if (myImageID == 0) out <<
"\nColumn map is row map.";
1995 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
2001 if (myImageID == 0) out <<
"\nDomain map is row map.";
2004 if (myImageID == 0) out <<
"\nDomain map is row map.";
2007 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
2013 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
2016 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
2019 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
2023 if (myImageID == 0) out << std::endl;
2027 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2028 if (myImageID == imageCtr) {
2029 out <<
"Node ID = " << imageCtr << std::endl;
2052 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2053 if (myImageID == imageCtr) {
2054 out << std::setw(width) <<
"Node ID"
2055 << std::setw(width) <<
"Global Row"
2056 << std::setw(width) <<
"Num Entries";
2058 out << std::setw(width) <<
"(Index,Value)";
2064 out << std::setw(width) << myImageID
2065 << std::setw(width) << gid
2066 << std::setw(width) << nE;
2072 for (
size_t j=0; j < nE; ++j) {
2073 out <<
" (" << rowinds[j]
2074 <<
", " << rowvals[j]
2082 for (
size_t j=0; j < nE; ++j) {
2083 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
2084 <<
", " << rowvals[j]
2103 mtx_->SetLabel(objectLabel.c_str());
2128 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2141 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2154 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2168 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2191 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
2192 #ifdef HAVE_XPETRA_TPETRA
2193 local_matrix_type getLocalMatrix ()
const {
2195 if (isInitializedLocalMatrix_)
2196 return localMatrix_;
2200 const int numRows = matrix->NumMyRows();
2201 const int numCols = matrix->NumMyCols();
2202 const int nnz = matrix->NumMyNonzeros();
2207 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
2211 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
2212 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
2213 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
2216 typename local_matrix_type::index_type kokkosColind(colind, nnz);
2217 typename local_matrix_type::values_type kokkosVals (vals, nnz);
2219 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
2220 isInitializedLocalMatrix_ =
true;
2222 return localMatrix_;
2225 void setAllValues (
const typename local_matrix_type::row_map_type& ,
2226 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
2227 const typename local_matrix_type::values_type& )
2230 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
2234 mutable local_matrix_type localMatrix_;
2235 mutable bool isInitializedLocalMatrix_ =
false;
2238 #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."
2251 #endif // #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
2255 #define XPETRA_EPETRACRSMATRIX_SHORT
2256 #endif // XPETRA_EPETRACRSMATRIX_HPP
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
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.
std::string description() const
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra matrix.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
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 setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets 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.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
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 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)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Teuchos::ArrayView< const size_t > &) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets.
void 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.
bool hasMatrix() const
Does this have an underlying matrix.
RCP< Epetra_CrsMatrix > mtx_
The underlying actual matrix object.
size_t global_size_t
Global size_t object.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
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 haveGlobalConstants() const
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
bool isFillActive() const
Returns true if the matrix is in edit mode.
virtual void setObjectLabel(const std::string &objectLabel)
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
static magnitudeType magnitude(T a)
virtual ~EpetraCrsMatrixT()
bool isFillActive() const
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
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.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
bool isLocallyIndexed() const
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified (locally owned) global row.
void resumeFill(const RCP< ParameterList > ¶ms=null)
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
void allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
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.
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 resumeFill(const RCP< ParameterList > &=Teuchos::null)
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying a previously constructed graph.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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 > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
Deep copy constructor.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
bool isFillComplete() const
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
global_size_t getGlobalNumEntries() 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 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 > > 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.
const RCP< const Comm< int > > getComm() const
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.
virtual ~EpetraCrsMatrixT()
Destructor.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
CombineMode
Xpetra::Combine Mode enumerable type.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void setObjectLabel(const std::string &objectLabel)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
size_t getNodeNumCols() const
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
size_t getNodeNumRows() const
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
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< 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)
const RCP< const Comm< int > > getComm() const
Returns the communicator.
void setAllToScalar(const Scalar &alpha)
const RCP< const Comm< int > > getComm() const
Returns the communicator.
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 describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
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.
bool isGloballyIndexed() const
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
global_size_t getGlobalNumCols() const
Number of global columns in 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.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
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 Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
Exception throws to report errors in the internal logical of the program.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the 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.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using global IDs.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > DomainImporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
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.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
bool isFillActive() const
Returns true if the matrix is in edit mode.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using global IDs.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
bool supportsRowViews() const
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &)
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Exception throws when you call an unimplemented method of Xpetra.
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 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 setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
void scale(const Scalar &alpha)
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
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 removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
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.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
int Resize(int Length_in)
bool isFillResumed_
Flag to keep track of fill status.
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 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)
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
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 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 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 setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void setObjectLabel(const std::string &objectLabel)
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)
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
std::string description() const
A simple one-line description of this object.
void resize(const size_type n, const T &val=T())
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row 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)
RCP< Epetra_CrsMatrix > mtx_
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
void setObjectLabel(const std::string &objectLabel)
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
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.
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &)
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 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 doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
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
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified (locally owned) global row.
virtual ~EpetraCrsMatrixT()
Destructor.
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 haveGlobalConstants() const
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
global_size_t getGlobalNumCols() const
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 doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
global_size_t getGlobalNumRows() const
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra matrix.
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.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
void fillComplete(const RCP< ParameterList > ¶ms=null)
Signal that data entry is 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.
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.
size_t getGlobalMaxNumRowEntries() const
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
bool haveGlobalConstants() const
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 describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
#define XPETRA_ERR_CHECK(arg)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
EpetraGlobalOrdinal GlobalOrdinal
void getLocalRowCopy(LocalOrdinal LocalRow, const ArrayView< LocalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified local row of the matrix. Put into storage allocated by calli...
EpetraCrsMatrixT(const Teuchos::RCP< const 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 replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Teuchos::ArrayView< const size_t > &) const
Get a copy of the diagonal entries owned by this node, with local row indices, using row offsets.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
Gets the 1D pointer arrays of the graph.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
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.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
std::string description() const
A simple one-line description of this object.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() 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 > ¶ms=Teuchos::null)
static const EVerbosityLevel verbLevel_default
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 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 getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
LocalOrdinal local_ordinal_type
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
#define XPETRA_MONITOR(funcName)
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
size_t getNodeMaxNumRowEntries() const
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the specified global row.
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
Deep copy constructor.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
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 getNodeNumEntries() const