EpetraExt Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EpetraExt_MatrixMatrix.h
Go to the documentation of this file.
1 //@HEADER
2 // ***********************************************************************
3 //
4 // EpetraExt: Epetra Extended - Linear Algebra Services Package
5 // Copyright (2011) 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 #ifndef EPETRAEXT_MATRIXMATRIX_H
42 #define EPETRAEXT_MATRIXMATRIX_H
43 
44 #if defined(EpetraExt_SHOW_DEPRECATED_WARNINGS)
45 #ifdef __GNUC__
46 #warning "The EpetraExt package is deprecated"
47 #endif
48 #endif
49 
50 #include <EpetraExt_ConfigDefs.h>
51 
52 class Epetra_CrsMatrix;
53 class Epetra_Map;
54 class Epetra_Vector;
55 
56 #ifdef HAVE_VECTOR
57 #include <vector>
58 #endif
59 
60 namespace EpetraExt {
61  class CrsMatrixStruct;
62 
63 
69 class MatrixMatrix {
70 
71  public:
73  virtual ~MatrixMatrix(){}
74 
107  static int Multiply(const Epetra_CrsMatrix& A,
108  bool transposeA,
109  const Epetra_CrsMatrix& B,
110  bool transposeB,
112  bool call_FillComplete_on_result=true,
113  bool keep_all_hard_zeros=false);
114 
130  static int Add(const Epetra_CrsMatrix& A,
131  bool transposeA,
132  double scalarA,
134  double scalarB);
135 
157  static int Add(const Epetra_CrsMatrix& A,
158  bool transposeA,
159  double scalarA,
160  const Epetra_CrsMatrix & B,
161  bool transposeB,
162  double scalarB,
163  Epetra_CrsMatrix * & C);
164 
165 
191  static int Jacobi(double omega,
192  const Epetra_Vector & Dinv,
193  const Epetra_CrsMatrix& A,
194  const Epetra_CrsMatrix& B,
196  bool call_FillComplete_on_result=true);
197 
198  private:
199  template<typename int_type>
200  static int Tmult_A_B(const Epetra_CrsMatrix & A,
201  CrsMatrixStruct & Aview,
202  const Epetra_CrsMatrix & B,
203  CrsMatrixStruct& Bview,
205  bool call_FillComplete_on_result,
206  bool keep_all_hard_zeros);
207 
208  static int mult_A_B(const Epetra_CrsMatrix & A,
209  CrsMatrixStruct & Aview,
210  const Epetra_CrsMatrix & B,
211  CrsMatrixStruct& Bview,
213  bool call_FillComplete_on_result,
214  bool keep_all_hard_zeros);
215 
216  template<typename int_type>
217  static int Tmult_AT_B_newmatrix(const CrsMatrixStruct & Atransview,
218  const CrsMatrixStruct & Bview,
220  bool keep_all_hard_zeros);
221 
222  static int mult_AT_B_newmatrix(const CrsMatrixStruct & Atransview,
223  const CrsMatrixStruct & Bview,
225  bool keep_all_hard_zeros);
226 
227  template<typename int_type>
228  static int TMultiply(const Epetra_CrsMatrix& A,
229  bool transposeA,
230  const Epetra_CrsMatrix& B,
231  bool transposeB,
233  bool call_FillComplete_on_result,
234  bool keep_all_hard_zeros);
235 
236  template<typename int_type>
237  static int TAdd(const Epetra_CrsMatrix& A,
238  bool transposeA,
239  double scalarA,
241  double scalarB);
242 
243  template<typename int_type>
244  static int TAdd(const Epetra_CrsMatrix& A,
245  bool transposeA,
246  double scalarA,
247  const Epetra_CrsMatrix & B,
248  bool transposeB,
249  double scalarB,
250  Epetra_CrsMatrix * & C);
251 
252  template<typename int_type>
253  static int Tjacobi_A_B(double omega,
254  const Epetra_Vector & Dinv,
255  const Epetra_CrsMatrix & A,
256  CrsMatrixStruct & Aview,
257  const Epetra_CrsMatrix & B,
258  CrsMatrixStruct& Bview,
260  bool call_FillComplete_on_result);
261 
262  static int jacobi_A_B(double omega,
263  const Epetra_Vector & Dinv,
264  const Epetra_CrsMatrix & A,
265  CrsMatrixStruct & Aview,
266  const Epetra_CrsMatrix & B,
267  CrsMatrixStruct& Bview,
269  bool call_FillComplete_on_result);
270 
271  template<typename int_type>
272  static int TJacobi(double omega,
273  const Epetra_Vector & Dinv,
274  const Epetra_CrsMatrix& A,
275  const Epetra_CrsMatrix& B,
277  bool call_FillComplete_on_result);
278 
279 
280 };//class MatrixMatrix
281 
282 
288  template<typename int_type>
289  double sparsedot(double* u, int_type* u_ind, int u_len,
290  double* v, int_type* v_ind, int v_len);
291 }//namespace EpetraExt
292 
293 #endif
static int jacobi_A_B(double omega, const Epetra_Vector &Dinv, const Epetra_CrsMatrix &A, CrsMatrixStruct &Aview, const Epetra_CrsMatrix &B, CrsMatrixStruct &Bview, Epetra_CrsMatrix &C, bool call_FillComplete_on_result)
static int TMultiply(const Epetra_CrsMatrix &A, bool transposeA, const Epetra_CrsMatrix &B, bool transposeB, Epetra_CrsMatrix &C, bool call_FillComplete_on_result, bool keep_all_hard_zeros)
static int Multiply(const Epetra_CrsMatrix &A, bool transposeA, const Epetra_CrsMatrix &B, bool transposeB, Epetra_CrsMatrix &C, bool call_FillComplete_on_result=true, bool keep_all_hard_zeros=false)
Given Epetra_CrsMatrix objects A, B and C, form the product C = A*B.
virtual ~MatrixMatrix()
destructor
Collection of matrix-matrix operations.
static int mult_A_B(const Epetra_CrsMatrix &A, CrsMatrixStruct &Aview, const Epetra_CrsMatrix &B, CrsMatrixStruct &Bview, Epetra_CrsMatrix &C, bool call_FillComplete_on_result, bool keep_all_hard_zeros)
static int TAdd(const Epetra_CrsMatrix &A, bool transposeA, double scalarA, Epetra_CrsMatrix &B, double scalarB)
static int Add(const Epetra_CrsMatrix &A, bool transposeA, double scalarA, Epetra_CrsMatrix &B, double scalarB)
Given Epetra_CrsMatrix objects A and B, form the sum B = a*A + b*B.
double sparsedot(double *u, int_type *u_ind, int u_len, double *v, int_type *v_ind, int v_len)
Method for internal use...
static int Jacobi(double omega, const Epetra_Vector &Dinv, const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B, Epetra_CrsMatrix &C, bool call_FillComplete_on_result=true)
Given Epetra_CrsMatrix objects A, B and C, and Epetra_Vector Dinv, form the product C = (I-omega * Di...
static int Tjacobi_A_B(double omega, const Epetra_Vector &Dinv, const Epetra_CrsMatrix &A, CrsMatrixStruct &Aview, const Epetra_CrsMatrix &B, CrsMatrixStruct &Bview, Epetra_CrsMatrix &C, bool call_FillComplete_on_result)
static int Tmult_A_B(const Epetra_CrsMatrix &A, CrsMatrixStruct &Aview, const Epetra_CrsMatrix &B, CrsMatrixStruct &Bview, Epetra_CrsMatrix &C, bool call_FillComplete_on_result, bool keep_all_hard_zeros)
static int Tmult_AT_B_newmatrix(const CrsMatrixStruct &Atransview, const CrsMatrixStruct &Bview, Epetra_CrsMatrix &C, bool keep_all_hard_zeros)
static int mult_AT_B_newmatrix(const CrsMatrixStruct &Atransview, const CrsMatrixStruct &Bview, Epetra_CrsMatrix &C, bool keep_all_hard_zeros)
static int TJacobi(double omega, const Epetra_Vector &Dinv, const Epetra_CrsMatrix &A, const Epetra_CrsMatrix &B, Epetra_CrsMatrix &C, bool call_FillComplete_on_result)