EpetraExt Development
EpetraExt_MatrixMatrix.h
Go to the documentation of this file.
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 TMultiply(const Epetra_CrsMatrix& A,
00202       bool transposeA,
00203       const Epetra_CrsMatrix& B,
00204       bool transposeB,
00205       Epetra_CrsMatrix& C,
00206                         bool call_FillComplete_on_result);
00207 
00208     template<typename int_type>
00209     static int TAdd(const Epetra_CrsMatrix& A,
00210                    bool transposeA,
00211                    double scalarA,
00212                    Epetra_CrsMatrix& B,
00213                    double scalarB);
00214 
00215     template<typename int_type>
00216     static int TAdd(const Epetra_CrsMatrix& A,
00217                       bool transposeA,
00218                       double scalarA,
00219                       const Epetra_CrsMatrix & B,
00220                       bool transposeB,
00221                       double scalarB,
00222                       Epetra_CrsMatrix * & C);
00223 
00224     template<typename int_type>
00225     static int Tjacobi_A_B(double omega,
00226          const Epetra_Vector & Dinv,
00227          const Epetra_CrsMatrix & A,
00228          CrsMatrixStruct & Aview,
00229          const Epetra_CrsMatrix & B,
00230          CrsMatrixStruct& Bview,
00231          Epetra_CrsMatrix& C,
00232          bool call_FillComplete_on_result);
00233     
00234     static int jacobi_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     template<typename int_type>
00244     static int TJacobi(double omega,
00245            const Epetra_Vector & Dinv,
00246            const Epetra_CrsMatrix& A,
00247            const Epetra_CrsMatrix& B,
00248            Epetra_CrsMatrix& C,
00249            bool call_FillComplete_on_result);
00250     
00251 
00252 };//class MatrixMatrix
00253 
00254 
00260  template<typename int_type>
00261  double sparsedot(double* u, int_type* u_ind, int u_len,
00262       double* v, int_type* v_ind, int v_len);
00263 }//namespace EpetraExt
00264 
00265 #endif
00266 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines