|
EpetraExt
Development
|
00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // EpetraExt: Epetra Extended - Linear Algebra Services Package 00005 // Copyright (2011) Sandia Corporation 00006 // 00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00008 // the U.S. Government retains certain rights in this software. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 #ifndef EPETRAEXT_MATRIXMATRIX_H 00042 #define EPETRAEXT_MATRIXMATRIX_H 00043 00044 #include <EpetraExt_ConfigDefs.h> 00045 00046 class Epetra_CrsMatrix; 00047 class Epetra_Map; 00048 class Epetra_Vector; 00049 00050 #ifdef HAVE_VECTOR 00051 #include <vector> 00052 #endif 00053 00054 namespace EpetraExt { 00055 class CrsMatrixStruct; 00056 00057 00063 class MatrixMatrix { 00064 00065 public: 00067 virtual ~MatrixMatrix(){} 00068 00094 static int Multiply(const Epetra_CrsMatrix& A, 00095 bool transposeA, 00096 const Epetra_CrsMatrix& B, 00097 bool transposeB, 00098 Epetra_CrsMatrix& C, 00099 bool call_FillComplete_on_result=true); 00100 00116 static int Add(const Epetra_CrsMatrix& A, 00117 bool transposeA, 00118 double scalarA, 00119 Epetra_CrsMatrix& B, 00120 double scalarB); 00121 00143 static int Add(const Epetra_CrsMatrix& A, 00144 bool transposeA, 00145 double scalarA, 00146 const Epetra_CrsMatrix & B, 00147 bool transposeB, 00148 double scalarB, 00149 Epetra_CrsMatrix * & C); 00150 00151 00177 static int Jacobi(double omega, 00178 const Epetra_Vector & Dinv, 00179 const Epetra_CrsMatrix& A, 00180 const Epetra_CrsMatrix& B, 00181 Epetra_CrsMatrix& C, 00182 bool call_FillComplete_on_result=true); 00183 00184 private: 00185 template<typename int_type> 00186 static int Tmult_A_B(const Epetra_CrsMatrix & A, 00187 CrsMatrixStruct & Aview, 00188 const Epetra_CrsMatrix & B, 00189 CrsMatrixStruct& Bview, 00190 Epetra_CrsMatrix& C, 00191 bool call_FillComplete_on_result); 00192 00193 static int mult_A_B(const Epetra_CrsMatrix & A, 00194 CrsMatrixStruct & Aview, 00195 const Epetra_CrsMatrix & B, 00196 CrsMatrixStruct& Bview, 00197 Epetra_CrsMatrix& C, 00198 bool call_FillComplete_on_result); 00199 00200 template<typename int_type> 00201 static int Tmult_AT_B_newmatrix(const CrsMatrixStruct & Atransview, 00202 const CrsMatrixStruct & Bview, 00203 Epetra_CrsMatrix & C); 00204 00205 static int mult_AT_B_newmatrix(const CrsMatrixStruct & Atransview, 00206 const CrsMatrixStruct & Bview, 00207 Epetra_CrsMatrix & C); 00208 00209 template<typename int_type> 00210 static int TMultiply(const Epetra_CrsMatrix& A, 00211 bool transposeA, 00212 const Epetra_CrsMatrix& B, 00213 bool transposeB, 00214 Epetra_CrsMatrix& C, 00215 bool call_FillComplete_on_result); 00216 00217 template<typename int_type> 00218 static int TAdd(const Epetra_CrsMatrix& A, 00219 bool transposeA, 00220 double scalarA, 00221 Epetra_CrsMatrix& B, 00222 double scalarB); 00223 00224 template<typename int_type> 00225 static int TAdd(const Epetra_CrsMatrix& A, 00226 bool transposeA, 00227 double scalarA, 00228 const Epetra_CrsMatrix & B, 00229 bool transposeB, 00230 double scalarB, 00231 Epetra_CrsMatrix * & C); 00232 00233 template<typename int_type> 00234 static int Tjacobi_A_B(double omega, 00235 const Epetra_Vector & Dinv, 00236 const Epetra_CrsMatrix & A, 00237 CrsMatrixStruct & Aview, 00238 const Epetra_CrsMatrix & B, 00239 CrsMatrixStruct& Bview, 00240 Epetra_CrsMatrix& C, 00241 bool call_FillComplete_on_result); 00242 00243 static int jacobi_A_B(double omega, 00244 const Epetra_Vector & Dinv, 00245 const Epetra_CrsMatrix & A, 00246 CrsMatrixStruct & Aview, 00247 const Epetra_CrsMatrix & B, 00248 CrsMatrixStruct& Bview, 00249 Epetra_CrsMatrix& C, 00250 bool call_FillComplete_on_result); 00251 00252 template<typename int_type> 00253 static int TJacobi(double omega, 00254 const Epetra_Vector & Dinv, 00255 const Epetra_CrsMatrix& A, 00256 const Epetra_CrsMatrix& B, 00257 Epetra_CrsMatrix& C, 00258 bool call_FillComplete_on_result); 00259 00260 00261 };//class MatrixMatrix 00262 00263 00269 template<typename int_type> 00270 double sparsedot(double* u, int_type* u_ind, int u_len, 00271 double* v, int_type* v_ind, int v_len); 00272 }//namespace EpetraExt 00273 00274 #endif 00275
1.7.6.1