• Main Page
  • Classes
  • Files
  • File List
  • File Members

/build/buildd/clp-1.11.1/Clp/src/ClpCholeskyBase.hpp

Go to the documentation of this file.
00001 /* $Id: ClpCholeskyBase.hpp 1458 2009-11-05 12:34:07Z forrest $ */
00002 // Copyright (C) 2003, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef ClpCholeskyBase_H
00005 #define ClpCholeskyBase_H
00006 
00007 #include "CoinPragma.hpp"
00008 #include "CoinFinite.hpp"
00009 //#define CLP_LONG_CHOLESKY 0
00010 #ifndef CLP_LONG_CHOLESKY 
00011 #define CLP_LONG_CHOLESKY 0
00012 #endif
00013 /* valid combinations are 
00014    CLP_LONG_CHOLESKY 0 and COIN_LONG_WORK 0
00015    CLP_LONG_CHOLESKY 1 and COIN_LONG_WORK 1
00016    CLP_LONG_CHOLESKY 2 and COIN_LONG_WORK 1
00017 */
00018 #if COIN_LONG_WORK==0
00019 #if CLP_LONG_CHOLESKY>0
00020 #define CHOLESKY_BAD_COMBINATION
00021 #endif
00022 #else
00023 #if CLP_LONG_CHOLESKY==0
00024 #define CHOLESKY_BAD_COMBINATION
00025 #endif
00026 #endif
00027 #ifdef CHOLESKY_BAD_COMBINATION
00028 #  warning("Bad combination of CLP_LONG_CHOLESKY and COIN_BIG_DOUBLE/COIN_LONG_WORK");
00029 "Bad combination of CLP_LONG_CHOLESKY and COIN_LONG_WORK"
00030 #endif
00031 #if CLP_LONG_CHOLESKY>1
00032 typedef long double longDouble;
00033 #define CHOL_SMALL_VALUE 1.0e-15 
00034 #elif CLP_LONG_CHOLESKY==1
00035 typedef double longDouble;
00036 #define CHOL_SMALL_VALUE 1.0e-11
00037 #else
00038 typedef double longDouble;
00039 #define CHOL_SMALL_VALUE 1.0e-11
00040 #endif
00041 class ClpInterior;
00042 class ClpCholeskyDense;
00043 class ClpMatrixBase;
00044 
00051 class ClpCholeskyBase  {
00052   
00053 public:
00062   virtual int order(ClpInterior * model);
00067   virtual int symbolic();
00070   virtual int factorize(const CoinWorkDouble * diagonal, int * rowsDropped) ;
00072   virtual void solve (CoinWorkDouble * region) ;
00075   virtual void solveKKT (CoinWorkDouble * region1, CoinWorkDouble * region2, const CoinWorkDouble * diagonal,
00076                          CoinWorkDouble diagonalScaleFactor);
00077 private:
00079   int orderAMD();
00080 public:
00082 
00085 
00086   inline int status() const 
00087   {return status_;}
00089   inline int numberRowsDropped() const 
00090   {return numberRowsDropped_;}
00092   void resetRowsDropped();
00094   inline char * rowsDropped() const 
00095   {return rowsDropped_;}
00097   inline double choleskyCondition() const 
00098   {return choleskyCondition_;}
00100   inline double goDense() const 
00101   {return goDense_;}
00103   inline void setGoDense(double value)
00104   {goDense_=value;}
00106   inline int rank() const 
00107   {return numberRows_-numberRowsDropped_;}
00109   inline int numberRows() const 
00110   {return numberRows_;}
00112   inline CoinBigIndex size() const
00113   { return sizeFactor_;}
00115   inline longDouble * sparseFactor() const
00116   { return sparseFactor_;}
00118   inline longDouble * diagonal() const
00119   { return diagonal_;}
00121   inline longDouble * workDouble() const
00122   { return workDouble_;}
00124   inline bool kkt() const
00125   { return doKKT_;}
00127   inline void setKKT(bool yesNo)
00128   { doKKT_ = yesNo;}
00130   inline void setIntegerParameter(int i,int value)
00131   { integerParameters_[i]=value;}
00133   inline int getIntegerParameter(int i)
00134   { return integerParameters_[i];}
00136   inline void setDoubleParameter(int i,double value)
00137   { doubleParameters_[i]=value;}
00139   inline double getDoubleParameter(int i)
00140   { return doubleParameters_[i];}
00142   
00143   
00144 public:
00145 
00151   ClpCholeskyBase(int denseThreshold=-1);
00153    virtual ~ClpCholeskyBase();
00155    ClpCholeskyBase(const ClpCholeskyBase&);
00157    ClpCholeskyBase& operator=(const ClpCholeskyBase&);
00159 
00160 
00161 
00162   virtual ClpCholeskyBase * clone() const;
00163  
00165   inline int type() const
00166   { if (doKKT_) return 100; else return type_;}
00167 protected:
00169   inline void setType(int type) {type_=type;}
00171   inline void setModel(ClpInterior * model)
00172   { model_=model;}
00174    
00181   int symbolic1(const CoinBigIndex * Astart, const int * Arow);
00185   void symbolic2(const CoinBigIndex * Astart, const int * Arow);
00189   void factorizePart2(int * rowsDropped) ;
00193   void solve(CoinWorkDouble * region, int type);
00195   int preOrder(bool lowerTriangular, bool includeDiagonal, bool doKKT);
00197   void updateDense(longDouble * d, /*longDouble * work,*/ int * first);
00199     
00200 protected:
00204 
00205   int type_;
00207   bool doKKT_;
00209   double goDense_;
00211   double choleskyCondition_;
00213   ClpInterior * model_;
00215   int numberTrials_;
00217   int numberRows_;
00219   int status_;
00221   char * rowsDropped_;
00223   int * permuteInverse_;
00225   int * permute_;
00227   int numberRowsDropped_;
00229   longDouble * sparseFactor_;
00231   CoinBigIndex * choleskyStart_;
00233   int * choleskyRow_;
00235   CoinBigIndex * indexStart_;
00237   longDouble * diagonal_;
00239   longDouble * workDouble_;
00241   int * link_;
00242   // Integer work array
00243   CoinBigIndex * workInteger_;
00244   // Clique information
00245   int * clique_;
00247   CoinBigIndex sizeFactor_;
00249   CoinBigIndex sizeIndex_;
00251   int firstDense_;
00253   int integerParameters_[64];
00255   double doubleParameters_[64];
00257   ClpMatrixBase * rowCopy_;
00259   char * whichDense_;
00261   longDouble * denseColumn_;
00263   ClpCholeskyDense * dense_;
00265   int denseThreshold_;
00267 };
00268 
00269 #endif

Generated on Fri Aug 20 2010 06:29:28 by  doxygen 1.7.1