Epetra Package Browser (Single Doxygen Collection) Development
Epetra_SerialDenseSolver.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 #ifndef EPETRA_SERIALDENSESOLVER_H
00045 #define EPETRA_SERIALDENSESOLVER_H
00046 class Epetra_SerialDenseMatrix;
00047 #include "Epetra_Object.h" 
00048 #include "Epetra_CompObject.h"
00049 #include "Epetra_BLAS.h"
00050 #include "Epetra_LAPACK.h"
00051 
00052 
00054 
00131 //=========================================================================
00132 class EPETRA_LIB_DLL_EXPORT Epetra_SerialDenseSolver : 
00133   public Epetra_CompObject, public Epetra_BLAS,
00134   public Epetra_LAPACK, public Epetra_Object    {
00135   public:
00136   
00138 
00139 
00140   Epetra_SerialDenseSolver();
00141   
00142 
00144   virtual ~Epetra_SerialDenseSolver();
00146 
00148 
00149 
00151   int SetMatrix(Epetra_SerialDenseMatrix & A);
00152 
00154 
00157   int SetVectors(Epetra_SerialDenseMatrix & X, Epetra_SerialDenseMatrix & B);
00159 
00161 
00162 
00164 
00166   void FactorWithEquilibration(bool Flag) {Equilibrate_ = Flag; return;};
00167 
00169   void SolveWithTranspose(bool Flag) {Transpose_ = Flag; if (Flag) TRANS_ = 'T'; else TRANS_ = 'N'; return;};
00170 
00172   void SolveToRefinedSolution(bool Flag) {RefineSolution_ = Flag; return;};
00173 
00175 
00178   void EstimateSolutionErrors(bool Flag) ;
00180 
00182 
00183 
00185 
00188   virtual int Factor(void);
00189 
00191 
00194   virtual int Solve(void);
00195 
00197 
00200   virtual int Invert(void);
00201 
00203 
00206   virtual int ComputeEquilibrateScaling(void);
00207 
00209 
00212   virtual int EquilibrateMatrix(void);
00213 
00215 
00218   int EquilibrateRHS(void);
00219 
00220 
00222 
00225   virtual int ApplyRefinement(void);
00226 
00228 
00231   int UnequilibrateLHS(void);
00232 
00234 
00240   virtual int ReciprocalConditionEstimate(double & Value);
00242 
00244 
00245 
00247   bool Transpose() {return(Transpose_);};
00248 
00250   bool Factored() {return(Factored_);};
00251 
00253   bool A_Equilibrated() {return(A_Equilibrated_);};
00254 
00256   bool B_Equilibrated() {return(B_Equilibrated_);};
00257 
00259   virtual bool ShouldEquilibrate() {ComputeEquilibrateScaling(); return(ShouldEquilibrate_);};
00260 
00262   bool SolutionErrorsEstimated() {return(SolutionErrorsEstimated_);};
00263 
00265   bool Inverted() {return(Inverted_);};
00266 
00268   bool ReciprocalConditionEstimated() {return(ReciprocalConditionEstimated_);};
00269 
00271   bool Solved() {return(Solved_);};
00272 
00274   bool SolutionRefined() {return(SolutionRefined_);};
00276 
00278 
00279     
00281    Epetra_SerialDenseMatrix * Matrix()  const {return(Matrix_);};
00282        
00284    Epetra_SerialDenseMatrix * FactoredMatrix()  const {return(Factor_);};
00285 
00287   Epetra_SerialDenseMatrix * LHS()  const {return(LHS_);};
00288     
00290   Epetra_SerialDenseMatrix * RHS()  const {return(RHS_);};
00291     
00293   int M()  const {return(M_);};
00294 
00296   int N()  const {return(N_);};
00297 
00299   double * A()  const {return(A_);};
00300 
00302   int LDA()  const {return(LDA_);};
00303 
00305   double * B()  const {return(B_);};
00306 
00308   int LDB()  const {return(LDB_);};
00309 
00311   int NRHS()  const {return(NRHS_);};
00312 
00314   double * X()  const {return(X_);};
00315 
00317   int LDX()  const {return(LDX_);};
00318 
00320   double * AF()  const {return(AF_);};
00321 
00323   int LDAF()  const {return(LDAF_);};
00324 
00326   int * IPIV()  const {return(IPIV_);};
00327 
00329   double ANORM()  const {return(ANORM_);};
00330 
00332   double RCOND()  const {return(RCOND_);};
00333 
00335 
00337   double ROWCND()  const {return(ROWCND_);};
00338 
00340 
00342   double COLCND()  const {return(COLCND_);};
00343 
00345   double AMAX()  const {return(AMAX_);};
00346 
00348   double * FERR()  const {return(FERR_);};
00349 
00351   double * BERR()  const {return(BERR_);};
00352 
00354   double * R()  const {return(R_);};
00355 
00357   double * C()  const {return(C_);};
00359 
00361 
00362 
00363   virtual void Print(ostream& os) const;
00365  protected:
00366   
00367   void AllocateWORK() {if (WORK_==0) {LWORK_ = 4*N_; WORK_ = new double[LWORK_];} return;};
00368   void AllocateIWORK() {if (IWORK_==0) IWORK_ = new int[N_]; return;};
00369   void InitPointers();
00370   void DeleteArrays();
00371   void ResetMatrix();
00372   void ResetVectors();
00373 
00374 
00375   bool Equilibrate_;
00376   bool ShouldEquilibrate_;
00377   bool A_Equilibrated_;
00378   bool B_Equilibrated_;
00379   bool Transpose_;
00380   bool Factored_;
00381   bool EstimateSolutionErrors_;
00382   bool SolutionErrorsEstimated_;
00383   bool Solved_;
00384   bool Inverted_;
00385   bool ReciprocalConditionEstimated_;
00386   bool RefineSolution_;
00387   bool SolutionRefined_;
00388 
00389   char TRANS_;
00390 
00391   int M_;
00392   int N_;
00393   int Min_MN_;
00394   int NRHS_;
00395   int LDA_;
00396   int LDAF_;
00397   int LDB_;
00398   int LDX_;
00399   int INFO_;
00400   int LWORK_;
00401 
00402   int * IPIV_;
00403   int * IWORK_;
00404 
00405   double ANORM_;
00406   double RCOND_;
00407   double ROWCND_;
00408   double COLCND_;
00409   double AMAX_;
00410 
00411   Epetra_SerialDenseMatrix * Matrix_;
00412   Epetra_SerialDenseMatrix * LHS_;
00413   Epetra_SerialDenseMatrix * RHS_;
00414   Epetra_SerialDenseMatrix * Factor_;
00415   
00416   double * A_;
00417   double * FERR_;
00418   double * BERR_;
00419   double * AF_;
00420   double * WORK_;
00421   double * R_;
00422   double * C_;
00423 
00424   double * B_;
00425   double * X_;
00426 
00427 
00428  private:
00429   // Epetra_SerialDenseSolver copy constructor (put here because we don't want user access)
00430   
00431   Epetra_SerialDenseSolver(const Epetra_SerialDenseSolver& Source);
00432   Epetra_SerialDenseSolver & operator=(const Epetra_SerialDenseSolver& Source);
00433 };
00434 
00435 #endif /* EPETRA_SERIALDENSESOLVER_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines