Epetra_SerialDenseSolver.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_SERIALDENSESOLVER_H
00033 #define EPETRA_SERIALDENSESOLVER_H
00034 class Epetra_SerialDenseMatrix;
00035 #include "Epetra_Object.h" 
00036 #include "Epetra_CompObject.h"
00037 #include "Epetra_BLAS.h"
00038 #include "Epetra_LAPACK.h"
00039 
00040 
00042 
00119 //=========================================================================
00120 class Epetra_SerialDenseSolver : public Epetra_CompObject, public Epetra_BLAS,
00121          public Epetra_LAPACK, public Epetra_Object    {
00122   public:
00123   
00125 
00126 
00127   Epetra_SerialDenseSolver();
00128   
00129 
00131   virtual ~Epetra_SerialDenseSolver();
00133 
00135 
00136 
00138   int SetMatrix(Epetra_SerialDenseMatrix & A);
00139 
00141 
00144   int SetVectors(Epetra_SerialDenseMatrix & X, Epetra_SerialDenseMatrix & B);
00146 
00148 
00149 
00151 
00153   void FactorWithEquilibration(bool Flag) {Equilibrate_ = Flag; return;};
00154 
00156   void SolveWithTranspose(bool Flag) {Transpose_ = Flag; if (Flag) TRANS_ = 'T'; else TRANS_ = 'N'; return;};
00157 
00159   void SolveToRefinedSolution(bool Flag) {RefineSolution_ = Flag; return;};
00160 
00162 
00165   void EstimateSolutionErrors(bool Flag) ;
00167 
00169 
00170 
00172 
00175   virtual int Factor(void);
00176 
00178 
00181   virtual int Solve(void);
00182 
00184 
00187   virtual int Invert(void);
00188 
00190 
00193   virtual int ComputeEquilibrateScaling(void);
00194 
00196 
00199   virtual int EquilibrateMatrix(void);
00200 
00202 
00205   int EquilibrateRHS(void);
00206 
00207 
00209 
00212   virtual int ApplyRefinement(void);
00213 
00215 
00218   int UnequilibrateLHS(void);
00219 
00221 
00227   virtual int ReciprocalConditionEstimate(double & Value);
00229 
00231 
00232 
00234   bool Transpose() {return(Transpose_);};
00235 
00237   bool Factored() {return(Factored_);};
00238 
00240   bool A_Equilibrated() {return(A_Equilibrated_);};
00241 
00243   bool B_Equilibrated() {return(B_Equilibrated_);};
00244 
00246   virtual bool ShouldEquilibrate() {ComputeEquilibrateScaling(); return(ShouldEquilibrate_);};
00247 
00249   bool SolutionErrorsEstimated() {return(SolutionErrorsEstimated_);};
00250 
00252   bool Inverted() {return(Inverted_);};
00253 
00255   bool ReciprocalConditionEstimated() {return(ReciprocalConditionEstimated_);};
00256 
00258   bool Solved() {return(Solved_);};
00259 
00261   bool SolutionRefined() {return(SolutionRefined_);};
00263 
00265 
00266     
00268    Epetra_SerialDenseMatrix * Matrix()  const {return(Matrix_);};
00269        
00271    Epetra_SerialDenseMatrix * FactoredMatrix()  const {return(Factor_);};
00272 
00274   Epetra_SerialDenseMatrix * LHS()  const {return(LHS_);};
00275     
00277   Epetra_SerialDenseMatrix * RHS()  const {return(RHS_);};
00278     
00280   int M()  const {return(M_);};
00281 
00283   int N()  const {return(N_);};
00284 
00286   double * A()  const {return(A_);};
00287 
00289   int LDA()  const {return(LDA_);};
00290 
00292   double * B()  const {return(B_);};
00293 
00295   int LDB()  const {return(LDB_);};
00296 
00298   int NRHS()  const {return(NRHS_);};
00299 
00301   double * X()  const {return(X_);};
00302 
00304   int LDX()  const {return(LDX_);};
00305 
00307   double * AF()  const {return(AF_);};
00308 
00310   int LDAF()  const {return(LDAF_);};
00311 
00313   int * IPIV()  const {return(IPIV_);};
00314 
00316   double ANORM()  const {return(ANORM_);};
00317 
00319   double RCOND()  const {return(RCOND_);};
00320 
00322 
00324   double ROWCND()  const {return(ROWCND_);};
00325 
00327 
00329   double COLCND()  const {return(COLCND_);};
00330 
00332   double AMAX()  const {return(AMAX_);};
00333 
00335   double * FERR()  const {return(FERR_);};
00336 
00338   double * BERR()  const {return(BERR_);};
00339 
00341   double * R()  const {return(R_);};
00342 
00344   double * C()  const {return(C_);};
00346 
00348 
00349 
00350   virtual void Print(ostream& os) const;
00352  protected:
00353   
00354   void AllocateWORK() {if (WORK_==0) {LWORK_ = 4*N_; WORK_ = new double[LWORK_];} return;};
00355   void AllocateIWORK() {if (IWORK_==0) IWORK_ = new int[N_]; return;};
00356   void InitPointers();
00357   void DeleteArrays();
00358   void ResetMatrix();
00359   void ResetVectors();
00360 
00361 
00362   bool Equilibrate_;
00363   bool ShouldEquilibrate_;
00364   bool A_Equilibrated_;
00365   bool B_Equilibrated_;
00366   bool Transpose_;
00367   bool Factored_;
00368   bool EstimateSolutionErrors_;
00369   bool SolutionErrorsEstimated_;
00370   bool Solved_;
00371   bool Inverted_;
00372   bool ReciprocalConditionEstimated_;
00373   bool RefineSolution_;
00374   bool SolutionRefined_;
00375 
00376   char TRANS_;
00377 
00378   int M_;
00379   int N_;
00380   int Min_MN_;
00381   int NRHS_;
00382   int LDA_;
00383   int LDAF_;
00384   int LDB_;
00385   int LDX_;
00386   int INFO_;
00387   int LWORK_;
00388 
00389   int * IPIV_;
00390   int * IWORK_;
00391 
00392   double ANORM_;
00393   double RCOND_;
00394   double ROWCND_;
00395   double COLCND_;
00396   double AMAX_;
00397 
00398   Epetra_SerialDenseMatrix * Matrix_;
00399   Epetra_SerialDenseMatrix * LHS_;
00400   Epetra_SerialDenseMatrix * RHS_;
00401   Epetra_SerialDenseMatrix * Factor_;
00402   
00403   double * A_;
00404   double * FERR_;
00405   double * BERR_;
00406   double * AF_;
00407   double * WORK_;
00408   double * R_;
00409   double * C_;
00410 
00411   double * B_;
00412   double * X_;
00413 
00414 
00415  private:
00416   // Epetra_SerialDenseSolver copy constructor (put here because we don't want user access)
00417   
00418   Epetra_SerialDenseSolver(const Epetra_SerialDenseSolver& Source);
00419   Epetra_SerialDenseSolver & operator=(const Epetra_SerialDenseSolver& Source);
00420 };
00421 
00422 #endif /* EPETRA_SERIALDENSESOLVER_H */

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