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)");
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."
270 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
273 :
public CrsMatrix <double, int, int, EpetraNode>
282 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
283 #ifdef HAVE_XPETRA_TPETRA
307 : isFillResumed_(false)
322 : isFillResumed_(false)
341 isFillResumed_(false)
346 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
347 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
350 bool restrictComm=
false;
351 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
352 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
353 if(restrictComm && mtx_->NumMyRows()==0)
365 isFillResumed_(false)
370 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
371 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
374 bool restrictComm=
false;
375 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
377 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
386 isFillResumed_(false)
392 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
393 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
396 bool restrictComm=
false;
397 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
398 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
399 if(restrictComm && mtx_->NumMyRows()==0)
409 isFillResumed_(false)
415 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
416 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
419 bool restrictComm=
false;
420 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
422 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
425 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
426 #ifdef HAVE_XPETRA_TPETRA
452 const local_matrix_type& lclMatrix,
458 const local_matrix_type& lclMatrix,
459 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
460 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
461 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
462 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
467 typedef typename local_matrix_type::value_type value_type;
468 typedef typename local_matrix_type::ordinal_type ordinal_type;
471 ordinal_type lclNumRows = lclMatrix.numRows ();
472 ordinal_type lclNumCols = lclMatrix.numCols ();
476 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
478 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
481 for (ordinal_type r = 0; r < lclNumRows; ++r) {
483 auto rowview = lclMatrix.row (r);
484 NumEntriesPerRowToAlloc[r] = rowview.length;
488 isFillResumed_ =
false;
489 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
490 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
493 for (ordinal_type r = 0; r < lclNumRows; ++r) {
495 auto rowview = lclMatrix.row (r);
501 for(ordinal_type c = 0; c < rowview.length; c++) {
502 value_type value = rowview.value (c);
503 ordinal_type colidx = rowview.colidx (c);
506 "Xpetra::EpetraCrsMatrixT: local matrix contains column elements which are not in the provided column map!");
511 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
515 if (!domainMap.is_null() && !rangeMap.is_null())
521 isInitializedLocalMatrix_ =
false;
552 const std::string tfecfFuncName(
"replaceGlobalValues");
554 ": Fill must be active in order to call this method. If you have already "
555 "called fillComplete(), you need to call resumeFill() before you can "
559 std::runtime_error,
": values.size() must equal indices.size().");
571 const std::string tfecfFuncName(
"replaceLocalValues");
573 ": Fill must be active in order to call this method. If you have already "
574 "called fillComplete(), you need to call resumeFill() before you can "
578 std::runtime_error,
": values.size() must equal indices.size().");
605 bool ownMemory =
false;
610 myColind.
Resize(numNonZeros);
611 colind = Teuchos::arcp(myColind.
Values(), lowerOffset, numNonZeros, ownMemory);
615 double *& myValues = mtx_->ExpertExtractValues();
617 myValues =
new double[numNonZeros];
618 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
627 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
629 "An exception is thrown to let you know that you mismatched your pointers.");
632 if (values.
size() > 0) {
634 "An exception is thrown to let you know that you mismatched your pointers.");
636 "An exception is thrown to let you know that you mismatched your pointers.");
645 for (
size_t i = 0; i < N+1; i++)
646 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
655 bool ownMemory =
false;
664 for (
size_t i = 0; i < n+1; i++)
665 (*
const_cast<size_t*
>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
668 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
671 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
686 isFillResumed_ =
false;
692 if(!importer.is_null()) {
694 myimport = eImporter.getEpetra_Import().getRawPtr();
696 if(!exporter.is_null()) {
698 myexport = eExporter.getEpetra_Export().getRawPtr();
701 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
715 isFillResumed_ =
true;
723 isFillResumed_ =
false;
725 bool doOptimizeStorage =
true;
726 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
727 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
736 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
738 bool doOptimizeStorage =
true;
739 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
740 mtx_->FillComplete(doOptimizeStorage);
751 if(myImport==Teuchos::null)
752 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
754 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
829 NumEntries = numEntries;
838 NumEntries = numEntries;
849 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
850 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
864 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
865 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
874 XPETRA_ERR_CHECK(mtx_->ExtractDiagonalCopy(toEpetra<GlobalOrdinal,Node>(diag)));
889 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
905 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 {
924 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
946 std::ostringstream oss;
949 oss <<
"{status = fill complete"
956 oss <<
"{status = fill not complete"
981 const int myImageID = comm->getRank(),
982 numImages = comm->getSize();
987 width = std::max<size_t>(width,11) + 2;
997 if (myImageID == 0) out << this->
description() << std::endl;
1004 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
1009 if (myImageID == 0) out <<
"\nColumn map is row map.";
1012 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
1018 if (myImageID == 0) out <<
"\nDomain map is row map.";
1021 if (myImageID == 0) out <<
"\nDomain map is row map.";
1024 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
1030 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
1033 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
1036 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
1040 if (myImageID == 0) out << std::endl;
1044 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1045 if (myImageID == imageCtr) {
1046 out <<
"Node ID = " << imageCtr << std::endl;
1069 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
1070 if (myImageID == imageCtr) {
1071 out << std::setw(width) <<
"Node ID"
1072 << std::setw(width) <<
"Global Row"
1073 << std::setw(width) <<
"Num Entries";
1075 out << std::setw(width) <<
"(Index,Value)";
1081 out << std::setw(width) << myImageID
1082 << std::setw(width) << gid
1083 << std::setw(width) << nE;
1089 for (
size_t j=0; j < nE; ++j) {
1090 out <<
" (" << rowinds[j]
1091 <<
", " << rowvals[j]
1099 for (
size_t j=0; j < nE; ++j) {
1100 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
1101 <<
", " << rowvals[j]
1120 mtx_->SetLabel(objectLabel.c_str());
1145 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1158 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
1171 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1185 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
1186 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error,
"Caught nonzero error code " + std::to_string(err) +
" returned by Epetra.");
1208 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1209 #ifdef HAVE_XPETRA_TPETRA
1211 local_matrix_type getLocalMatrix ()
const {
1212 if (isInitializedLocalMatrix_)
1213 return localMatrix_;
1217 const int numRows = matrix->NumMyRows();
1218 const int numCols = matrix->NumMyCols();
1219 const int nnz = matrix->NumMyNonzeros();
1224 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
1228 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
1229 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
1230 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
1233 typename local_matrix_type::index_type kokkosColind(colind, nnz);
1234 typename local_matrix_type::values_type kokkosVals (vals, nnz);
1236 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
1237 isInitializedLocalMatrix_ =
true;
1239 return localMatrix_;
1242 void setAllValues (
const typename local_matrix_type::row_map_type& ,
1243 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
1244 const typename local_matrix_type::values_type& )
1247 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
1253 mutable local_matrix_type localMatrix_;
1254 mutable bool isInitializedLocalMatrix_ =
false;
1257 #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."
1288 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
1291 :
public CrsMatrix <double, int, long long, EpetraNode>
1300 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1301 #ifdef HAVE_XPETRA_TPETRA
1320 : isFillResumed_(false)
1335 : isFillResumed_(false)
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);
1365 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),myDomainMap,myRangeMap,restrictComm));
1366 if(restrictComm && mtx_->NumMyRows()==0)
1378 isFillResumed_(false)
1383 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1384 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1387 bool restrictComm=
false;
1388 if(!params.is_null()) restrictComm = params->get(
"Restrict Communicator",restrictComm);
1390 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),myDomainMap,myRangeMap,restrictComm));
1399 isFillResumed_(false)
1405 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1406 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1409 bool restrictComm=
false;
1410 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1411 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tImporter.getEpetra_Import(),tdImporter->getEpetra_Import().get(),myDomainMap,myRangeMap,restrictComm));
1412 if(restrictComm && mtx_->NumMyRows()==0)
1422 isFillResumed_(false)
1428 const Epetra_Map* myDomainMap = (domainMap!=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(domainMap): 0;
1429 const Epetra_Map* myRangeMap = (rangeMap !=Teuchos::null)? &toEpetra<GlobalOrdinal,Node>(rangeMap) : 0;
1432 bool restrictComm=
false;
1433 if(!params.
is_null()) restrictComm = params->
get(
"Restrict Communicator",restrictComm);
1435 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(*tSourceMatrix.getEpetra_CrsMatrix(),*tExporter.getEpetra_Export(),tdExporter->getEpetra_Export().get(),myDomainMap,myRangeMap,restrictComm));
1438 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1439 #ifdef HAVE_XPETRA_TPETRA
1462 const local_matrix_type& lclMatrix,
1468 const local_matrix_type& lclMatrix,
1469 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rowMap,
1470 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& colMap,
1471 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& domainMap = Teuchos::null,
1472 const Teuchos::RCP<
const Map<LocalOrdinal,GlobalOrdinal,Node> >& rangeMap = Teuchos::null,
1477 typedef typename local_matrix_type::value_type value_type;
1478 typedef typename local_matrix_type::ordinal_type ordinal_type;
1481 ordinal_type lclNumRows = lclMatrix.numRows ();
1482 ordinal_type lclNumCols = lclMatrix.numCols ();
1486 "Xpetra::EpetraCrsMatrixT: number of rows in local matrix and number of local entries in row map do not match!");
1488 "Xpetra::EpetraCrsMatrixT: number of columns in local matrix and number of local entries in column map do not match!");
1491 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1493 auto rowview = lclMatrix.row (r);
1494 NumEntriesPerRowToAlloc[r] = rowview.length;
1498 isFillResumed_ =
false;
1499 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end());
1500 mtx_ =
Teuchos::rcp(
new Epetra_CrsMatrix(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(),
true));
1503 for (ordinal_type r = 0; r < lclNumRows; ++r) {
1505 auto rowview = lclMatrix.row (r);
1511 for(ordinal_type c = 0; c < rowview.length; c++) {
1512 value_type value = rowview.value (c);
1513 ordinal_type colidx = rowview.colidx (c);
1517 indout [c] = colidx;
1520 insertLocalValues(r, indout.view(0,indout.size()), valout.view(0,valout.size()));
1524 if (!domainMap.is_null() && !rangeMap.is_null())
1530 isInitializedLocalMatrix_ =
false;
1561 const std::string tfecfFuncName(
"replaceGlobalValues");
1563 ": Fill must be active in order to call this method. If you have already "
1564 "called fillComplete(), you need to call resumeFill() before you can "
1568 std::runtime_error,
": values.size() must equal indices.size().");
1580 const std::string tfecfFuncName(
"replaceLocalValues");
1582 ": Fill must be active in order to call this method. If you have already "
1583 "called fillComplete(), you need to call resumeFill() before you can "
1587 std::runtime_error,
": values.size() must equal indices.size().");
1613 int lowerOffset = 0;
1614 bool ownMemory =
false;
1619 myColind.
Resize(numNonZeros);
1620 colind = Teuchos::arcp(myColind.
Values(), lowerOffset, numNonZeros, ownMemory);
1624 double *& myValues = mtx_->ExpertExtractValues();
1626 myValues =
new double[numNonZeros];
1627 values = Teuchos::arcp(myValues,lowerOffset,numNonZeros,ownMemory);
1636 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1638 "An exception is thrown to let you know that you mismatched your pointers.");
1641 if (values.
size() > 0) {
1643 "An exception is thrown to let you know that you mismatched your pointers.");
1645 "An exception is thrown to let you know that you mismatched your pointers.");
1654 for (
size_t i = 0; i < N+1; i++)
1655 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1663 int lowerOffset = 0;
1664 bool ownMemory =
false;
1673 for (
size_t i = 0; i < n+1; i++)
1674 (*
const_cast<size_t*
>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1677 colind = Teuchos::arcp(mtx_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1680 values = Teuchos::arcp(mtx_->ExpertExtractValues(), lowerOffset, nnz, ownMemory);
1696 isFillResumed_ =
false;
1702 if(!importer.is_null()) {
1704 myimport = eImporter.getEpetra_Import().getRawPtr();
1706 if(!exporter.is_null()) {
1708 myexport = eExporter.getEpetra_Export().getRawPtr();
1711 rv=mtx_->ExpertStaticFillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), myimport, myexport);
1725 isFillResumed_ =
true;
1733 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1735 bool doOptimizeStorage =
true;
1736 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1737 mtx_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap), doOptimizeStorage);
1746 if (isFillResumed_ ==
true) { isFillResumed_ =
false;
return; }
1748 bool doOptimizeStorage =
true;
1749 if (params !=
null && params->get(
"Optimize Storage",
true) ==
false) doOptimizeStorage =
false;
1750 mtx_->FillComplete(doOptimizeStorage);
1761 if(myImport==Teuchos::null)
1762 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),0);
1764 rv=mtx_->ReplaceDomainMapAndImporter( toEpetra<GlobalOrdinal,Node>(newDomainMap),&*myImport);
1837 int numEntries = -1;
1839 NumEntries = numEntries;
1846 int numEntries = -1;
1848 NumEntries = numEntries;
1859 XPETRA_ERR_CHECK(mtx_->ExtractGlobalRowView(GlobalRow, numEntries, eValues, eIndices));
1860 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1874 XPETRA_ERR_CHECK(mtx_->ExtractMyRowView(LocalRow, numEntries, eValues, eIndices));
1875 if (numEntries == 0) { eValues = NULL; eIndices = NULL; }
1896 mtx_->ReplaceDiagonalValues (toEpetra<GlobalOrdinal,Node>(diag));
1912 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 {
1930 tmp->PutScalar(0.0);
1931 XPETRA_ERR_CHECK(mtx_->Multiply(eTrans, *eX.getEpetra_MultiVector(), *tmp));
1953 std::ostringstream oss;
1956 oss <<
"{status = fill complete"
1963 oss <<
"{status = fill not complete"
1988 const int myImageID = comm->getRank(),
1989 numImages = comm->getSize();
1994 width = std::max<size_t>(width,11) + 2;
2004 if (myImageID == 0) out << this->
description() << std::endl;
2011 if (myImageID == 0) out <<
"\nRow map: " << std::endl;
2016 if (myImageID == 0) out <<
"\nColumn map is row map.";
2019 if (myImageID == 0) out <<
"\nColumn map: " << std::endl;
2025 if (myImageID == 0) out <<
"\nDomain map is row map.";
2028 if (myImageID == 0) out <<
"\nDomain map is row map.";
2031 if (myImageID == 0) out <<
"\nDomain map: " << std::endl;
2037 if (myImageID == 0) out <<
"\nRange map is domain map." << std::endl;
2040 if (myImageID == 0) out <<
"\nRange map is row map." << std::endl;
2043 if (myImageID == 0) out <<
"\nRange map: " << std::endl;
2047 if (myImageID == 0) out << std::endl;
2051 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2052 if (myImageID == imageCtr) {
2053 out <<
"Node ID = " << imageCtr << std::endl;
2076 for (
int imageCtr = 0; imageCtr < numImages; ++imageCtr) {
2077 if (myImageID == imageCtr) {
2078 out << std::setw(width) <<
"Node ID"
2079 << std::setw(width) <<
"Global Row"
2080 << std::setw(width) <<
"Num Entries";
2082 out << std::setw(width) <<
"(Index,Value)";
2088 out << std::setw(width) << myImageID
2089 << std::setw(width) << gid
2090 << std::setw(width) << nE;
2096 for (
size_t j=0; j < nE; ++j) {
2097 out <<
" (" << rowinds[j]
2098 <<
", " << rowvals[j]
2106 for (
size_t j=0; j < nE; ++j) {
2107 out <<
" (" <<
getColMap()->getGlobalElement(rowinds[j])
2108 <<
", " << rowvals[j]
2127 mtx_->SetLabel(objectLabel.c_str());
2152 int err = mtx_->Import(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2165 int err = mtx_->Export(*v, *tImporter.getEpetra_Import(),
toEpetra(CM));
2178 int err = mtx_->Import(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2192 int err = mtx_->Export(*v, *tExporter.getEpetra_Export(),
toEpetra(CM));
2215 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
2216 #ifdef HAVE_XPETRA_TPETRA
2218 local_matrix_type getLocalMatrix ()
const {
2219 if (isInitializedLocalMatrix_)
2220 return localMatrix_;
2224 const int numRows = matrix->NumMyRows();
2225 const int numCols = matrix->NumMyCols();
2226 const int nnz = matrix->NumMyNonzeros();
2231 int rv = matrix->ExtractCrsDataPointers(rowptr, colind, vals);
2235 typename local_matrix_type::row_map_type::non_const_type kokkosRowPtr(
"local row map", numRows+1);
2236 for (
size_t i = 0; i < kokkosRowPtr.size(); i++)
2237 kokkosRowPtr(i) = Teuchos::asSafe<typename local_matrix_type::row_map_type::value_type>(rowptr[i]);
2240 typename local_matrix_type::index_type kokkosColind(colind, nnz);
2241 typename local_matrix_type::values_type kokkosVals (vals, nnz);
2243 localMatrix_ = local_matrix_type(
"LocalMatrix", numRows, numCols, nnz, kokkosVals, kokkosRowPtr, kokkosColind);
2244 isInitializedLocalMatrix_ =
true;
2246 return localMatrix_;
2249 void setAllValues (
const typename local_matrix_type::row_map_type& ,
2250 const typename local_matrix_type::StaticCrsGraphType::entries_type::non_const_type& ,
2251 const typename local_matrix_type::values_type& )
2254 "Xpetra::EpetraCrsMatrix::setAllValues is not implemented");
2259 mutable local_matrix_type localMatrix_;
2260 mutable bool isInitializedLocalMatrix_ =
false;
2263 #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."
2288 #define XPETRA_EPETRACRSMATRIX_SHORT
#define XPETRA_MONITOR(funcName)
#define XPETRA_ERR_CHECK(arg)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
int Resize(int Length_in)
void resize(const size_type n, const T &val=T())
static const EVerbosityLevel verbLevel_default
virtual void setObjectLabel(const std::string &objectLabel)
LocalOrdinal local_ordinal_type
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in 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.
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 getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
Deep copy constructor.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
const RCP< const Comm< int > > getComm() const
Returns the communicator.
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
Get a copy of the diagonal entries owned by this node, with local row indices.
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 removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &)
bool isFillResumed_
Flag to keep track of fill status.
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
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 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.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries 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< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra 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.
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 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...
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
RCP< Epetra_CrsMatrix > mtx_
The underlying actual matrix object.
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.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void setObjectLabel(const std::string &objectLabel)
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 > > getDomainMap() const
Returns the Map associated with the domain of this operator. This will be null until fillComplete() i...
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified (locally owned) global row.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using global IDs.
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
Implements DistObject interface.
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 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 setAllToScalar(const Scalar &alpha)
Set all matrix entries equal to scalarThis.
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 ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
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, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying row and column Maps and number of entries in each row.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap)
Constructor for empty DynamicProfile matrix (no space is preallocated).
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
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 rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
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.
std::string description() const
A simple one-line description of this object.
void scale(const Scalar &alpha)
Scale the current values of a matrix, this = alpha*this.
virtual ~EpetraCrsMatrixT()
Destructor.
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
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.
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.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, 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.
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
bool hasMatrix() const
Does this have an underlying matrix.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &) const
Get offsets of the diagonal entries in the matrix.
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &)
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
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
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.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
bool hasMatrix() const
Does this have an underlying 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.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert matrix entries, using local IDs.
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 Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified (locally owned) global row.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using local IDs.
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
Get the underlying Epetra 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.
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
Get the underlying Epetra matrix.
void fillComplete(const RCP< ParameterList > ¶ms=Teuchos::null)
Signal that data entry is complete.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
RCP< Epetra_CrsMatrix > mtx_
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > DomainExporter, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices, const ArrayView< const Scalar > &values)
Replace matrix entries, using global IDs.
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
Extract a list of entries in a specified global row of this matrix. Put into pre-allocated storage.
void resumeFill(const RCP< ParameterList > &=Teuchos::null)
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this matrix.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
EpetraCrsMatrixT constructor to wrap a Epetra_CrsMatrix object.
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
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 Comm< int > > getComm() const
Returns the communicator.
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
Extract a const, non-persisting view of global indices in a specified row of the matrix.
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
bool isFillActive() const
Returns true if the matrix is in edit mode.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &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 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 EpetraCrsMatrixT &matrix)
Deep copy constructor.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
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....
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...
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
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 replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
Replace the diagonal entries of the matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
size_t getNodeNumEntries() const
Returns the local number of entries in this matrix.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
Insert 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)
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
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.
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 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.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying a previously constructed graph.
std::string description() const
A simple one-line description of this object.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
virtual ~EpetraCrsMatrixT()
Destructor.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
Sets the 1D pointer arrays of the graph.
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 setObjectLabel(const std::string &objectLabel)
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.
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
size_t getNodeNumRows() const
Returns the number of matrix rows owned on the calling node.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries in the specified global row.
void fillComplete(const RCP< ParameterList > ¶ms=null)
Signal that data entry is complete.
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....
void getGlobalRowCopy(GlobalOrdinal GlobalRow, const ArrayView< GlobalOrdinal > &Indices, const ArrayView< Scalar > &Values, size_t &NumEntries) const
void resumeFill(const RCP< ParameterList > ¶ms=null)
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)
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > ¶ms=null)
void replaceGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
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 getLocalDiagOffsets(Teuchos::ArrayRCP< size_t > &offsets) const
Get offsets of the diagonal entries in the matrix.
bool isLocallyIndexed() const
If matrix indices are in the local range, this function returns true. Otherwise, this function return...
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 allocateAllValues(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind, ArrayRCP< Scalar > &values)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag) const
void setAllToScalar(const Scalar &alpha)
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)
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, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
RCP< const Epetra_CrsMatrix > getEpetra_CrsMatrix() const
global_size_t getGlobalNumRows() const
Number of global elements in the row map of this matrix.
CrsMatrix< double, int, GlobalOrdinal, Node >::local_ordinal_type LocalOrdinal
const RCP< const Comm< int > > getComm() const
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
CrsMatrix< double, int, GlobalOrdinal, Node >::scalar_type Scalar
bool haveGlobalConstants() const
Returns true if globalConstants have been computed; false otherwise.
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
EpetraGlobalOrdinal GlobalOrdinal
void setAllValues(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind, const ArrayRCP< Scalar > &values)
virtual ~EpetraCrsMatrixT()
void leftScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this matrix.
void residual(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &X, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R) const
global_size_t getGlobalNumEntries() const
Returns the global number of entries in this matrix.
void insertLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
bool isFillActive() const
Returns true if the matrix is in edit mode.
RCP< Epetra_CrsMatrix > getEpetra_CrsMatrixNonConst() const
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void removeEmptyProcessesInPlace(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newMap)
global_size_t getGlobalNumCols() const
Number of global columns in the matrix.
RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getCrsGraph() const
Returns the CrsGraph associated with this matrix.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
void rightScale(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &x)
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices, ArrayView< const Scalar > &values) const
void doExport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
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)
const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this matrix.
bool supportsRowViews() const
Returns true if getLocalRowView() and getGlobalRowView() are valid for this class.
void insertGlobalValues(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void replaceLocalValues(LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &cols, const ArrayView< const Scalar > &vals)
void getLocalDiagCopy(Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag, const Teuchos::ArrayView< const size_t > &offsets) const
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &indices, ArrayView< const Scalar > &values) const
void doImport(const DistObject< char, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
bool isGloballyIndexed() const
If matrix indices are in the global range, this function returns true. Otherwise, this function retur...
size_t getNodeMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on this node.
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.
ScalarTraits< Scalar >::magnitudeType getFrobeniusNorm() const
Returns the Frobenius norm of the matrix.
void getAllValues(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind, ArrayRCP< const Scalar > &values) const
bool hasMatrix() const
Does this have an underlying matrix.
EpetraCrsMatrixT(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void replaceDiag(const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &diag)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
bool isFillComplete() const
Returns true if the matrix is in compute mode, i.e. if fillComplete() has been called.
EpetraCrsMatrixT(const Teuchos::RCP< Epetra_CrsMatrix > &mtx)
std::string description() const
A simple one-line description of this object.
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
void replaceDomainMapAndImporter(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &newDomainMap, Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &newImporter)
EpetraCrsMatrixT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > ¶ms=Teuchos::null)
size_t getNodeNumCols() const
Returns the number of matrix columns owned on the calling node.
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
Returns the local number of entries in this matrix.
EpetraCrsMatrixT(const EpetraCrsMatrixT &matrix)
size_t getGlobalMaxNumRowEntries() const
Returns the maximum number of entries across all rows/columns on all nodes.
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.
Exception throws to report errors in the internal logical of the program.
virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)=0
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
size_t global_size_t
Global size_t object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
CombineMode
Xpetra::Combine Mode enumerable type.
static magnitudeType magnitude(T a)