18void TripleMatrixMultiply<Scalar, LocalOrdinal, GlobalOrdinal, Node>::MultiplyRAP(
const Matrix& R,
bool transposeR,
19 const Matrix& A,
bool transposeA,
20 const Matrix& P,
bool transposeP,
22 bool call_FillComplete_on_result,
23 bool doOptimizeStorage,
24 const std::string& label,
27 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as row map of R");
29 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as domain map of R");
35 bool haveMultiplyDoFillComplete = call_FillComplete_on_result && doOptimizeStorage;
40#ifdef HAVE_XPETRA_TPETRA
41 using helpers = Xpetra::Helpers<SC, LO, GO, NO>;
42 if (helpers::isTpetraCrs(R) && helpers::isTpetraCrs(A) && helpers::isTpetraCrs(P)) {
44 const Tpetra::CrsMatrix<SC, LO, GO, NO>& tpR = Xpetra::Helpers<SC, LO, GO, NO>::Op2TpetraCrs(R);
45 const Tpetra::CrsMatrix<SC, LO, GO, NO>& tpA = Xpetra::Helpers<SC, LO, GO, NO>::Op2TpetraCrs(A);
46 const Tpetra::CrsMatrix<SC, LO, GO, NO>& tpP = Xpetra::Helpers<SC, LO, GO, NO>::Op2TpetraCrs(P);
47 Tpetra::CrsMatrix<SC, LO, GO, NO>& tpAc = Xpetra::Helpers<SC, LO, GO, NO>::Op2NonConstTpetraCrs(Ac);
51 Tpetra::TripleMatrixMultiply::MultiplyRAP(tpR, transposeR, tpA, transposeA, tpP, transposeP, tpAc, haveMultiplyDoFillComplete, label, params);
52 }
else if (helpers::isTpetraBlockCrs(R) && helpers::isTpetraBlockCrs(A) && helpers::isTpetraBlockCrs(P)) {
58 std::cout <<
"WARNING: Using inefficient BlockCrs Multiply Placeholder" << std::endl;
60 const Tpetra::BlockCrsMatrix<SC, LO, GO, NO>& tpR = Xpetra::Helpers<SC, LO, GO, NO>::Op2TpetraBlockCrs(R);
61 const Tpetra::BlockCrsMatrix<SC, LO, GO, NO>& tpA = Xpetra::Helpers<SC, LO, GO, NO>::Op2TpetraBlockCrs(A);
62 const Tpetra::BlockCrsMatrix<SC, LO, GO, NO>& tpP = Xpetra::Helpers<SC, LO, GO, NO>::Op2TpetraBlockCrs(P);
65 using CRS = Tpetra::CrsMatrix<SC, LO, GO, NO>;
73 const bool do_fill_complete =
true;
74 Tpetra::TripleMatrixMultiply::MultiplyRAP(*Rcrs, transposeR, *Acrs, transposeA, *Pcrs, transposeP, *Accrs, do_fill_complete, label, params);
83 Ac_w->replaceCrsMatrix(Ac_p);
93 if (call_FillComplete_on_result && !haveMultiplyDoFillComplete) {
95 fillParams->set(
"Optimize Storage", doOptimizeStorage);
105 const std::string stridedViewLabel(
"stridedMaps");
106 const size_t blkSize = 1;
107 std::vector<size_t> stridingInfo(1, blkSize);
108 LocalOrdinal stridedBlockId = -1;
110 if (R.
IsView(stridedViewLabel)) {
111 rangeMap = transposeR ? R.
getColMap(stridedViewLabel) : R.
getRowMap(stridedViewLabel);
117 if (P.
IsView(stridedViewLabel)) {
118 domainMap = transposeP ? P.
getRowMap(stridedViewLabel) : P.
getColMap(stridedViewLabel);
123 Ac.
CreateView(stridedViewLabel, rangeMap, domainMap);
static RCP< Xpetra::StridedMap< LocalOrdinal, GlobalOrdinal, Node > > Build(UnderlyingLib lib, global_size_t numGlobalElements, GlobalOrdinal indexBase, std::vector< size_t > &stridingInfo, const Teuchos::RCP< const Teuchos::Comm< int > > &comm, LocalOrdinal stridedBlockId=-1, GlobalOrdinal offset=0, LocalGlobal lg=Xpetra::GloballyDistributed)
Map constructor with Xpetra-defined contiguous uniform distribution.