Epetra Package Browser (Single Doxygen Collection) Development
Epetra_OskiMatrix.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright 2001 Sandia Corporation
00007 // 
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00039 // 
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 // Author: Ian Karlin ikarlin@sandia.gov 05-28-2008
00045 
00046 #ifndef EPETRA_OSKIMATRIX_H
00047 #define EPETRA_OSKIMATRIX_H
00048 
00049 #include "Epetra_OskiMultiVector.h"
00050 #include "Epetra_OskiVector.h"
00051 #include "Epetra_CrsMatrix.h"
00052 #include "Epetra_OskiPermutation.h"
00053 #include "Teuchos_ParameterList.hpp"
00054 #include "Epetra_Comm.h"
00055 extern "C" {
00056   #include "oski/oski.h"
00057 }
00058 
00059 class Epetra_OskiVector;
00060 class Epetra_OskiMultiVector;
00061 class Teuchos_ParameterList;
00062 class Epetra_OskiPermutation;
00063 
00065 
00094 class Epetra_OskiMatrix: public Epetra_CrsMatrix{
00095  public:
00097 
00098 
00099         Epetra_OskiMatrix(const Epetra_OskiMatrix& Source); //not in use for now
00100  
00102 
00116   Epetra_OskiMatrix(const Epetra_CrsMatrix& Source, const Teuchos::ParameterList& List);
00117   
00119   virtual ~Epetra_OskiMatrix();
00121 
00123 
00124 
00125 
00144   int ReplaceMyValues(int MyRow, 
00145           int NumEntries, 
00146           double* Values, 
00147           int* Indices);
00148 
00150 
00167   int SumIntoMyValues(int MyRow, 
00168           int NumEntries, 
00169           double* Values, 
00170           int* Indices);
00171 
00172 
00174 
00179   int ExtractDiagonalCopy(Epetra_Vector& Diagonal) const;
00180   
00182 
00192   int ReplaceDiagonalValues(const Epetra_OskiVector& Diagonal);
00194 
00196 
00197 
00198 
00207     int Multiply(bool TransA,
00208              const Epetra_Vector& x, 
00209          Epetra_Vector& y) const;
00210   
00212 
00223     int Multiply(bool TransA,
00224              const Epetra_Vector& x, 
00225          Epetra_Vector& y,
00226          double Alpha,
00227          double Beta = 0.0) const;
00228   
00230 
00239     int Multiply(bool TransA,
00240                const Epetra_MultiVector& X, 
00241              Epetra_MultiVector& Y) const;
00242 
00244 
00255     int Multiply(bool TransA,
00256                const Epetra_MultiVector& X, 
00257              Epetra_MultiVector& Y,
00258          double Alpha,
00259              double Beta = 0.0) const;
00260 
00262 
00273         int Solve(bool Upper, bool TransA, bool UnitDiagonal, const Epetra_Vector& x, Epetra_Vector &y) const;
00274         
00276 
00286         int Solve(bool TransA, const Epetra_Vector& x, Epetra_Vector& y, double Alpha = 1.0) const;
00287         
00289 
00300         int Solve(bool Upper, bool TransA, bool UnitDiagonal, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00301         
00303 
00313         int Solve(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y, double Alpha = 1.0) const;
00314         
00315 
00317 
00334   int MatTransMatMultiply(bool ATA, 
00335         const Epetra_Vector& x,
00336         Epetra_Vector& y,
00337         Epetra_Vector* t,
00338         double Alpha = 1.0,
00339         double Beta = 0.0) const;
00340 
00342 
00359   int MatTransMatMultiply(bool ATA, 
00360         const Epetra_MultiVector& X,
00361         Epetra_MultiVector& Y,
00362         Epetra_MultiVector* T,
00363         double Alpha = 1.0,
00364         double Beta = 0.0) const;
00365   
00367 
00383   int MultiplyAndMatTransMultiply(bool TransA,
00384           const Epetra_Vector& x,
00385           Epetra_Vector& y,
00386           const Epetra_Vector& w,
00387           Epetra_Vector& z,
00388           double Alpha = 1.0,
00389           double Beta = 0.0,
00390           double Omega = 1.0,
00391           double Zeta = 0.0) const;
00392 
00394 
00410   int MultiplyAndMatTransMultiply(bool TransA,
00411           const Epetra_MultiVector& X,
00412           Epetra_MultiVector& Y,
00413           const Epetra_MultiVector& W,
00414           Epetra_MultiVector& Z,
00415           double Alpha = 1.0,
00416           double Beta = 0.0,
00417           double Omega = 1.0,
00418           double Zeta = 0.0) const;
00419 
00421 
00439   int MatPowMultiply(bool TransA,
00440          const Epetra_Vector& x,
00441          Epetra_Vector& y,
00442          Epetra_MultiVector& T,
00443          int Power = 2,
00444          double Alpha = 1.0,
00445          double Beta = 0.0) const;
00446 
00448 
00463   int MatPowMultiply(bool TransA,
00464          const Epetra_Vector& x,
00465          Epetra_Vector& y,
00466          int Power = 2,
00467          double Alpha = 1.0,
00468          double Beta = 0.0) const;
00470 
00472 
00473 
00474 
00507   int SetHint(const Teuchos::ParameterList& List);
00508 
00509   
00511 
00545   int SetHintMultiply(bool TransA,
00546           double Alpha,
00547           const Epetra_OskiMultiVector& InVec,
00548           double Beta,
00549           const Epetra_OskiMultiVector& OutVec,
00550           int NumCalls,
00551           const Teuchos::ParameterList& List);
00552   
00554 
00583   int SetHintSolve(bool TransA,
00584              double Alpha,
00585              const Epetra_OskiMultiVector& Vector,
00586          int NumCalls,
00587          const Teuchos::ParameterList& List);
00588   
00590 
00630   int SetHintMatTransMatMultiply(bool ATA,
00631                      double Alpha,
00632                  const Epetra_OskiMultiVector& InVec,
00633                  double Beta,
00634                const Epetra_OskiMultiVector& OutVec,
00635                const Epetra_OskiMultiVector& Intermediate,
00636                  int NumCalls,
00637                  const Teuchos::ParameterList& List);
00638 
00640 
00687   int SetHintMultiplyAndMatTransMultiply(bool TransA,
00688                          double Alpha,
00689                      const Epetra_OskiMultiVector& InVec,
00690                      double Beta,
00691                      const Epetra_OskiMultiVector& OutVec,
00692                          double Omega,
00693                      const Epetra_OskiMultiVector& InVec2,
00694                      double Zeta,
00695                      const Epetra_OskiMultiVector& OutVec2,
00696                      int NumCalls,
00697                      const Teuchos::ParameterList& List);
00698 
00700 
00741   int SetHintPowMultiply(bool TransA,
00742              double Alpha,
00743              const Epetra_OskiMultiVector& InVec,
00744              double Beta,
00745              const Epetra_OskiMultiVector& OutVec,
00746              const Epetra_OskiMultiVector& Intermediate,
00747              int Power,
00748              int NumCalls,
00749              const Teuchos::ParameterList& List);
00750 
00752 
00757   int TuneMatrix();
00759 
00761 
00762 
00763   int IsMatrixTransformed() const;
00764 
00766   const Epetra_OskiMatrix& ViewTransformedMat() const;
00767 
00769   const Epetra_OskiPermutation& ViewRowPermutation() const;
00770   
00772   const Epetra_OskiPermutation& ViewColumnPermutation() const;
00773   
00775 
00780   char* GetMatrixTransforms() const;
00781 
00783 
00791   int ApplyMatrixTransforms(const char* Transforms);
00793 
00794  protected:
00795 
00796  private:
00797   const Epetra_CrsMatrix* Epetra_View_;
00798   oski_matrix_t A_tunable_;
00799   bool Copy_Created_; 
00800 };
00801 #endif /* EPETRA_OSKIMATRIX_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines