Tpetra Matrix/Vector Services  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TpetraExt_MatrixMatrix_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_MATRIXMATRIX_DECL_HPP
43 #define TPETRA_MATRIXMATRIX_DECL_HPP
44 
45 #include <Teuchos_RCP.hpp>
46 #include <Teuchos_Array.hpp>
47 #include "Tpetra_ConfigDefs.hpp"
48 #include "Tpetra_CrsMatrix.hpp"
49 #include "TpetraExt_MMHelpers.hpp"
50 
56 namespace Tpetra {
57 namespace MatrixMatrix {
58 
89 template <class Scalar,
90  class LocalOrdinal,
91  class GlobalOrdinal,
92  class Node,
93  class SpMatOps >
94 void Multiply(
95  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& A,
96  bool transposeA,
97  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& B,
98  bool transposeB,
99  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& C,
100  bool call_FillComplete_on_result=true);
101 
115 template <class Scalar,
116  class LocalOrdinal,
117  class GlobalOrdinal,
118  class Node,
119  class SpMatOps >
120 void Add(
121  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& A,
122  bool transposeA,
123  Scalar scalarA,
124  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& B,
125  Scalar scalarB );
126 
127 
157 template <class Scalar,
158  class LocalOrdinal,
159  class GlobalOrdinal,
160  class Node,
161  class SpMatOps >
162 Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps> >
163 add (const Scalar& alpha,
164  const bool transposeA,
165  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& A,
166  const Scalar& beta,
167  const bool transposeB,
168  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& B,
169  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& domainMap=Teuchos::null,
170  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& rangeMap=Teuchos::null,
171  const Teuchos::RCP<Teuchos::ParameterList>& params=Teuchos::null);
172 
202 template <class Scalar,
203  class LocalOrdinal,
204  class GlobalOrdinal,
205  class Node,
206  class SpMatOps>
207 void Add(
208  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& A,
209  bool transposeA,
210  Scalar scalarA,
211  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& B,
212  bool transposeB,
213  Scalar scalarB,
214  RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps> > C);
215 } // namespace MatrixMatrix
216 
217 namespace MMdetails{
218 
219 template<class Scalar,
220  class LocalOrdinal,
221  class GlobalOrdinal,
222  class Node,
223  class SpMatOps>
224 void mult_A_B(
225  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& Aview,
226  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& Bview,
227  CrsWrapper<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
228  bool onlyCalculateStructure=false);
229 
230 template<class Scalar,
231  class LocalOrdinal,
232  class GlobalOrdinal,
233  class Node,
234  class SpMatOps>
235 void import_and_extract_views(
236  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& M,
237  RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > targetMap,
238  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& Mview);
239 
240 template<class Scalar,
241  class LocalOrdinal,
242  class GlobalOrdinal,
243  class Node,
244  class SpMatOps>
245 void setMaxNumEntriesPerRow(
246  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node, SpMatOps>& Mview);
247 
248 }//end namespace MMdetails
249 
250 } // end of Tpetra namespace
251 
252 #endif // TPETRA_MATRIXMATRIX_DECL_HPP
253