364 const Matrix& A,
bool transposeA,
365 const Matrix& P,
bool transposeP,
367 bool call_FillComplete_on_result =
true,
368 bool doOptimizeStorage =
true,
369 const std::string & label = std::string(),
373 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as row map of R");
375 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as domain map of R");
381 bool haveMultiplyDoFillComplete = call_FillComplete_on_result && doOptimizeStorage;
386#ifdef HAVE_XPETRA_TPETRA
387# if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
388 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
391 using helpers = Xpetra::Helpers<SC,LO,GO,NO>;
392 if(helpers::isTpetraCrs(R) && helpers::isTpetraCrs(A) && helpers::isTpetraCrs(P)) {
394 const Tpetra::CrsMatrix<SC,LO,GO,NO> & tpR = Xpetra::Helpers<SC,LO,GO,NO>::Op2TpetraCrs(R);
395 const Tpetra::CrsMatrix<SC,LO,GO,NO> & tpA = Xpetra::Helpers<SC,LO,GO,NO>::Op2TpetraCrs(A);
396 const Tpetra::CrsMatrix<SC,LO,GO,NO> & tpP = Xpetra::Helpers<SC,LO,GO,NO>::Op2TpetraCrs(P);
397 Tpetra::CrsMatrix<SC,LO,GO,NO> & tpAc = Xpetra::Helpers<SC,LO,GO,NO>::Op2NonConstTpetraCrs(Ac);
401 Tpetra::TripleMatrixMultiply::MultiplyRAP(tpR, transposeR, tpA, transposeA, tpP, transposeP, tpAc, haveMultiplyDoFillComplete, label, params);
403 else if (helpers::isTpetraBlockCrs(R) && helpers::isTpetraBlockCrs(A) && helpers::isTpetraBlockCrs(P)) {
408 std::cout<<
"WARNING: Using inefficient BlockCrs Multiply Placeholder"<<std::endl;
410 const Tpetra::BlockCrsMatrix<SC,LO,GO,NO> & tpR = Xpetra::Helpers<SC,LO,GO,NO>::Op2TpetraBlockCrs(R);
411 const Tpetra::BlockCrsMatrix<SC,LO,GO,NO> & tpA = Xpetra::Helpers<SC,LO,GO,NO>::Op2TpetraBlockCrs(A);
412 const Tpetra::BlockCrsMatrix<SC,LO,GO,NO> & tpP = Xpetra::Helpers<SC,LO,GO,NO>::Op2TpetraBlockCrs(P);
415 using CRS=Tpetra::CrsMatrix<SC,LO,GO,NO>;
423 const bool do_fill_complete=
true;
424 Tpetra::TripleMatrixMultiply::MultiplyRAP(*Rcrs, transposeR, *Acrs, transposeA, *Pcrs, transposeP, *Accrs, do_fill_complete, label, params);
433 Ac_w->replaceCrsMatrix(Ac_p);
444 if (call_FillComplete_on_result && !haveMultiplyDoFillComplete) {
446 fillParams->set(
"Optimize Storage", doOptimizeStorage);
456 const std::string stridedViewLabel(
"stridedMaps");
457 const size_t blkSize = 1;
458 std::vector<size_t> stridingInfo(1, blkSize);
461 if (R.
IsView(stridedViewLabel)) {
462 rangeMap = transposeR ? R.
getColMap(stridedViewLabel) : R.
getRowMap(stridedViewLabel);
468 if (P.
IsView(stridedViewLabel)) {
469 domainMap = transposeP ? P.
getRowMap(stridedViewLabel) : P.
getColMap(stridedViewLabel);
474 Ac.
CreateView(stridedViewLabel, rangeMap, domainMap);