Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TpetraExt_TripleMatrixMultiply_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_TRIPLEMATRIXMULTIPLY_DECL_HPP
11 #define TPETRA_TRIPLEMATRIXMULTIPLY_DECL_HPP
12 
13 #include <string>
14 #include <Teuchos_RCP.hpp>
15 #include <Teuchos_Array.hpp>
16 #include "Tpetra_ConfigDefs.hpp"
17 #include "Tpetra_CrsMatrix.hpp"
18 #include "Tpetra_Vector.hpp"
19 #include "TpetraExt_MMHelpers.hpp"
20 
21 
27 namespace Tpetra {
28 
29  namespace TripleMatrixMultiply {
30 
63  template <class Scalar,
64  class LocalOrdinal,
65  class GlobalOrdinal,
66  class Node>
67  void MultiplyRAP(
68  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& R,
69  bool transposeR,
70  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
71  bool transposeA,
72  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& P,
73  bool transposeP,
74  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
75  bool call_FillComplete_on_result = true,
76  const std::string& label = std::string(),
77  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
78 
79 
80  } // namespace TripleMatrixMultiply
81 
82  namespace MMdetails{
83 
84  template<class Scalar,
85  class LocalOrdinal,
86  class GlobalOrdinal,
87  class Node>
88  void mult_R_A_P_newmatrix(
89  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Rview,
90  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
91  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
92  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
93  const std::string& label = std::string(),
94  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
95 
96  template<class Scalar,
97  class LocalOrdinal,
98  class GlobalOrdinal,
99  class Node>
100  void mult_R_A_P_reuse(
101  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Rview,
102  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
103  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
104  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
105  const std::string& label = std::string(),
106  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
107 
108  template<class Scalar,
109  class LocalOrdinal,
110  class GlobalOrdinal,
111  class Node>
112  void mult_PT_A_P_newmatrix(
113  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
114  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
115  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
116  const std::string& label = std::string(),
117  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
118 
119  template<class Scalar,
120  class LocalOrdinal,
121  class GlobalOrdinal,
122  class Node>
123  void mult_PT_A_P_reuse(
124  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
125  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
126  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
127  const std::string& label = std::string(),
128  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
129 
130 
131 
132  // Kernel wrappers struct (for non-specialized kernels)
133  // Because C++ doesn't support partial template specialization of functions.
134  template<class Scalar,
135  class LocalOrdinal,
136  class GlobalOrdinal,
137  class Node>
138  struct KernelWrappers3MMM {
139 
140  static inline void mult_PT_A_P_newmatrix_kernel_wrapper_2pass(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
141  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
142  const Teuchos::Array<LocalOrdinal> & Acol2PRow,
143  const Teuchos::Array<LocalOrdinal> & Acol2PRowImport,
144  const Teuchos::Array<LocalOrdinal> & Pcol2Accol,
145  const Teuchos::Array<LocalOrdinal> & PIcol2Accol,
146  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
147  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Acimport,
148  const std::string& label = std::string(),
149  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
150  };
151 
152  }//end namespace MMdetails
153 
154 } // end of Tpetra namespace
155 
156 #endif // TPETRA_TRIPLEMATRIXMULTIPLY_DECL_HPP
void MultiplyRAP(const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &R, bool transposeR, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, bool transposeA, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &P, bool transposeP, CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Ac, bool call_FillComplete_on_result=true, const std::string &label=std::string(), const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Sparse matrix-matrix multiply.