Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_MatrixMatrix_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Xpetra: A linear algebra interface package
4//
5// Copyright 2012 NTESS and the Xpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef PACKAGES_XPETRA_SUP_UTILS_XPETRA_MATRIXMATRIX_DECL_HPP_
11#define PACKAGES_XPETRA_SUP_UTILS_XPETRA_MATRIXMATRIX_DECL_HPP_
12
13#include "Xpetra_ConfigDefs.hpp"
14
15#include "Xpetra_BlockedCrsMatrix.hpp"
16#include "Xpetra_CrsMatrixWrap.hpp"
17#include "Xpetra_MapExtractor.hpp"
18#include "Xpetra_Map.hpp"
19#include "Xpetra_MatrixFactory.hpp"
20#include "Xpetra_Matrix.hpp"
21#include "Xpetra_StridedMapFactory.hpp"
22#include "Xpetra_StridedMap.hpp"
23
24#include "Xpetra_Helpers.hpp"
25
26#include <TpetraExt_MatrixMatrix.hpp>
27#include <Tpetra_RowMatrixTransposer.hpp>
29#include <Xpetra_TpetraCrsMatrix.hpp>
30#include <Xpetra_TpetraBlockCrsMatrix.hpp>
31#include <Tpetra_BlockCrsMatrix_Helpers.hpp>
32#include <Xpetra_TpetraMultiVector.hpp>
33#include <Xpetra_TpetraVector.hpp>
34
35namespace Xpetra {
36
37template <class Scalar,
38 class LocalOrdinal /*= int*/,
39 class GlobalOrdinal /*= LocalOrdinal*/,
40 class Node /*= Tpetra::KokkosClassic::DefaultNode::DefaultNodeType*/>
41class MatrixMatrix {
42#undef XPETRA_MATRIXMATRIX_SHORT
44
45 public:
57 FillComplete() has already been called on C or not. If it has,
58 then C's graph must already contain all nonzero locations that
59 will be produced when forming the product A*B. On exit,
60 C.FillComplete() will have been called, unless the last argument
61 to this function is specified to be false.
62 @param call_FillComplete_on_result Optional argument, defaults to true.
63 Power users may specify this argument to be false if they *DON'T*
64 want this function to call C.FillComplete. (It is often useful
65 to allow this function to call C.FillComplete, in cases where
66 one or both of the input matrices are rectangular and it is not
67 trivial to know which maps to use for the domain- and range-maps.)
68
69*/
70 static void Multiply(const Matrix& A, bool transposeA,
71 const Matrix& B, bool transposeB,
72 Matrix& C,
73 bool call_FillComplete_on_result = true,
74 bool doOptimizeStorage = true,
75 const std::string& label = std::string(),
76 const RCP<ParameterList>& params = null);
77
100 static RCP<Matrix> Multiply(const Matrix& A, bool transposeA, const Matrix& B, bool transposeB, RCP<Matrix> C_in,
102 bool doFillComplete = true,
103 bool doOptimizeStorage = true,
104 const std::string& label = std::string(),
105 const RCP<ParameterList>& params = null);
106
117 static RCP<Matrix> Multiply(const Matrix& A, bool transposeA, const Matrix& B, bool transposeB, Teuchos::FancyOStream& fos,
118 bool callFillCompleteOnResult = true, bool doOptimizeStorage = true, const std::string& label = std::string(),
119 const RCP<ParameterList>& params = null);
120
131 static RCP<BlockedCrsMatrix> TwoMatrixMultiplyBlock(const BlockedCrsMatrix& A, bool transposeA,
132 const BlockedCrsMatrix& B, bool transposeB,
134 bool doFillComplete = true,
135 bool doOptimizeStorage = true);
136
140 @param transposeA indicate whether to use transpose of A
141 @param alpha scalar multiplier for A
142 @param B right matrix operand
143 @param beta scalar multiplier for B
144
145 @return sum in B.
147 Note that B does not have to be fill-completed.
148 */
149 static void TwoMatrixAdd(const Matrix& A, bool transposeA, SC alpha, Matrix& B, SC beta);
150
153 @param A left matrix operand
154 @param transposeA indicate whether to use transpose of A
155 @param alpha scalar multiplier for A, defaults to 1.0
156 @param B right matrix operand
157 @param transposeB indicate whether to use transpose of B
158 @param beta scalar multiplier for B, defaults to 1.0
159 @param C resulting sum
160 @param fos output stream for printing to screen
161 @param AHasFixedNnzPerRow
162
163 It is up to the caller to ensure that the resulting matrix sum is fillComplete'd.
164 */
165 static void TwoMatrixAdd(const Matrix& A, bool transposeA, const SC& alpha,
166 const Matrix& B, bool transposeB, const SC& beta,
167 RCP<Matrix>& C, Teuchos::FancyOStream& fos, bool AHasFixedNnzPerRow = false);
168
169}; // class MatrixMatrix
170
171} // end namespace Xpetra
172
173#define XPETRA_MATRIXMATRIX_SHORT
174
175#endif /* PACKAGES_XPETRA_SUP_UTILS_XPETRA_MATRIXMATRIX_DECL_HPP_ */
Xpetra-specific matrix class.
basic_FancyOStream< char > FancyOStream