Epetra_JadMatrix.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_JADMATRIX_H
00033 #define EPETRA_JADMATRIX_H
00034 
00035 #include "Epetra_BasicRowMatrix.h"
00036 #include "Epetra_Map.h"
00037 #include "Epetra_Comm.h"
00038 #include "Epetra_SerialDenseVector.h"
00039 #include "Epetra_IntSerialDenseVector.h"
00040 
00041 
00042 class Epetra_Vector;
00043 class Epetra_MultiVector;
00044 class Epetra_Import;
00045 class Epetra_Export;
00046 
00048 
00056 class Epetra_JadMatrix: public Epetra_BasicRowMatrix {
00057       
00058  public:
00059 
00061 
00062 
00063   /* The constructor for this class requires a fully constructed instance of an Epetra_RowMatrix
00064      object.
00065      \param Matrix (In) An existing Epetra_RowMatrix.
00066      \pre Matrix must have Matrix.Filled()==true.
00067   */
00068   Epetra_JadMatrix(const Epetra_RowMatrix & Matrix);
00069 
00071   virtual ~Epetra_JadMatrix();
00073   
00075 
00076 
00077   /* Updates the values only using a matrix that has exactly the same structure as
00078      the matrix used to construct this Epetra_JadMatrix object.  Once the constructor
00079      is called, the Matrix argument is no longer needed.
00080      \param Matrix (In) An existing Epetra_RowMatrix with \e identical structure to 
00081             the matrix used to create this Epetra_JadMatrix.
00082      \param CheckStructure (In) Optional argument, by default is false.  If set to true, 
00083             the method will check to see if the structure of Matrix is compatible with
00084       the structure of matrix used to create this Epetra_JadMatrix.  Performing
00085       this check has signficant overhead, so it should only be turned on for debugging.
00086      \pre Matrix must have Matrix.Filled()==true.
00087   */ 
00088   int UpdateValues(const Epetra_RowMatrix & Matrix, bool CheckStructure = false);
00090   
00092 
00093 
00095 
00104     int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const;
00105 
00107 
00115     int ExtractMyEntryView(int CurEntry, double * &Value, int & RowIndex, int & ColIndex) { 
00116       if (CurEntry>=NumMyNonzeros_) EPETRA_CHK_ERR(-1); 
00117       Value = &Values_[CurEntry];
00118       ColIndex = Indices_[CurEntry];
00119       for (int j=0; j<NumJaggedDiagonals_; j++) if (CurEntry<IndexOffset_[j+1]) {RowIndex = RowPerm_[CurEntry-IndexOffset_[j]]; break;}
00120       return(0);
00121     }
00122 
00124 
00132     int ExtractMyEntryView(int CurEntry, double const * & Value, int & RowIndex, int & ColIndex) const { 
00133       if (CurEntry>=NumMyNonzeros_) EPETRA_CHK_ERR(-1); 
00134       Value = &Values_[CurEntry];
00135       ColIndex = Indices_[CurEntry];
00136       for (int j=0; j<NumJaggedDiagonals_; j++) if (CurEntry<IndexOffset_[j+1]) RowIndex = RowPerm_[CurEntry-IndexOffset_[j]];
00137       return(0);
00138     }
00139 
00141 
00150     int NumMyRowEntries(int MyRow, int & NumEntries) const;
00151 
00153 
00155 
00156 
00158 
00168     int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
00169 
00171 
00185     int Solve(bool Upper, bool Trans, bool UnitDiagonal,
00186               const Epetra_MultiVector& X,
00187               Epetra_MultiVector& Y) const
00188     {
00189       (void)Upper;
00190       (void)Trans;
00191       (void)UnitDiagonal;
00192       (void)X;
00193       (void)Y;
00194       return(-1);
00195     }
00197 
00198 
00199 
00200  protected:
00201 
00202   void GeneralMV(bool TransA, double * x, double * y) const;
00203   void GeneralMM(bool TransA, double ** X, int LDX, double ** Y, int LDY, int NumVectors) const;
00204   void GeneralMM3RHS(bool TransA, double ** X, int LDX, double ** Y, int LDY, int NumVectors) const;
00205   void GeneralMM2RHS(bool TransA, double * x, int ldx, double * y, int ldy) const;
00206   void Allocate(const Epetra_RowMatrix & Matrix);
00207 
00208   Epetra_SerialDenseVector Values_;
00209   Epetra_IntSerialDenseVector Indices_;
00210   Epetra_IntSerialDenseVector IndexOffset_;
00211   Epetra_IntSerialDenseVector Profile_;
00212   Epetra_IntSerialDenseVector RowPerm_;
00213   Epetra_IntSerialDenseVector InvRowPerm_;
00214   int NumJaggedDiagonals_;
00215 
00216 };
00217 #endif /* EPETRA_JADMATRIX_H */

Generated on Thu Sep 18 12:37:57 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1