48 #ifndef PACKAGES_XPETRA_SUP_UTILS_XPETRA_TRIPLEMATRIXMULTIPLY_HPP_
49 #define PACKAGES_XPETRA_SUP_UTILS_XPETRA_TRIPLEMATRIXMULTIPLY_HPP_
62 #ifdef HAVE_XPETRA_TPETRA
63 #include <TpetraExt_TripleMatrixMultiply.hpp>
67 #endif // HAVE_XPETRA_TPETRA
71 template <
class Scalar,
76 #undef XPETRA_TRIPLEMATRIXMULTIPLY_SHORT
106 const Matrix& A,
bool transposeA,
107 const Matrix& P,
bool transposeP,
109 bool call_FillComplete_on_result =
true,
110 bool doOptimizeStorage =
true,
111 const std::string & label = std::string(),
115 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as row map of R");
117 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as domain map of R");
123 bool haveMultiplyDoFillComplete = call_FillComplete_on_result && doOptimizeStorage;
128 #ifdef HAVE_XPETRA_TPETRA
136 Tpetra::TripleMatrixMultiply::MultiplyRAP(tpR, transposeR, tpA, transposeA, tpP, transposeP, tpAc, haveMultiplyDoFillComplete, label, params);
142 if (call_FillComplete_on_result && !haveMultiplyDoFillComplete) {
144 fillParams->
set(
"Optimize Storage", doOptimizeStorage);
154 const std::string stridedViewLabel(
"stridedMaps");
155 const size_t blkSize = 1;
156 std::vector<size_t> stridingInfo(1, blkSize);
157 LocalOrdinal stridedBlockId = -1;
159 if (R.
IsView(stridedViewLabel)) {
160 rangeMap = transposeR ? R.
getColMap(stridedViewLabel) : R.
getRowMap(stridedViewLabel);
166 if (P.
IsView(stridedViewLabel)) {
167 domainMap = transposeP ? P.
getRowMap(stridedViewLabel) : P.
getColMap(stridedViewLabel);
172 Ac.
CreateView(stridedViewLabel, rangeMap, domainMap);
178 #ifdef HAVE_XPETRA_EPETRA
191 const Matrix& A,
bool transposeA,
192 const Matrix& P,
bool transposeP,
194 bool call_FillComplete_on_result =
true,
195 bool doOptimizeStorage =
true,
196 const std::string & label = std::string(),
200 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as row map of R");
202 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as domain map of R");
208 bool haveMultiplyDoFillComplete = call_FillComplete_on_result && doOptimizeStorage;
213 #ifdef HAVE_XPETRA_TPETRA
214 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
215 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
225 Tpetra::TripleMatrixMultiply::MultiplyRAP(tpR, transposeR, tpA, transposeA, tpP, transposeP, tpAc, haveMultiplyDoFillComplete, label, params);
230 if (call_FillComplete_on_result && !haveMultiplyDoFillComplete) {
232 fillParams->
set(
"Optimize Storage", doOptimizeStorage);
242 const std::string stridedViewLabel(
"stridedMaps");
243 const size_t blkSize = 1;
244 std::vector<size_t> stridingInfo(1, blkSize);
247 if (R.
IsView(stridedViewLabel)) {
248 rangeMap = transposeR ? R.
getColMap(stridedViewLabel) : R.
getRowMap(stridedViewLabel);
254 if (P.
IsView(stridedViewLabel)) {
255 domainMap = transposeP ? P.
getRowMap(stridedViewLabel) : P.
getColMap(stridedViewLabel);
260 Ac.
CreateView(stridedViewLabel, rangeMap, domainMap);
279 const Matrix& A,
bool transposeA,
280 const Matrix& P,
bool transposeP,
282 bool call_FillComplete_on_result =
true,
283 bool doOptimizeStorage =
true,
284 const std::string & label = std::string(),
288 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as row map of R");
290 Exceptions::RuntimeError,
"XpetraExt::TripleMatrixMultiply::MultiplyRAP: row map of Ac is not same as domain map of R");
296 bool haveMultiplyDoFillComplete = call_FillComplete_on_result && doOptimizeStorage;
301 #ifdef HAVE_XPETRA_TPETRA
302 # if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
303 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
313 Tpetra::TripleMatrixMultiply::MultiplyRAP(tpR, transposeR, tpA, transposeA, tpP, transposeP, tpAc, haveMultiplyDoFillComplete, label, params);
318 if (call_FillComplete_on_result && !haveMultiplyDoFillComplete) {
320 fillParams->
set(
"Optimize Storage", doOptimizeStorage);
330 const std::string stridedViewLabel(
"stridedMaps");
331 const size_t blkSize = 1;
332 std::vector<size_t> stridingInfo(1, blkSize);
335 if (R.
IsView(stridedViewLabel)) {
336 rangeMap = transposeR ? R.
getColMap(stridedViewLabel) : R.
getRowMap(stridedViewLabel);
342 if (P.
IsView(stridedViewLabel)) {
343 domainMap = transposeP ? P.
getRowMap(stridedViewLabel) : P.
getColMap(stridedViewLabel);
348 Ac.
CreateView(stridedViewLabel, rangeMap, domainMap);
358 #define XPETRA_TRIPLEMATRIXMULTIPLY_SHORT