/build/buildd/clp-1.12.0/Clp/src/ClpPlusMinusOneMatrix.hpp
Go to the documentation of this file.
00001 /* $Id: ClpPlusMinusOneMatrix.hpp 1525 2010-02-26 17:27:59Z mjs $ */
00002 // Copyright (C) 2003, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef ClpPlusMinusOneMatrix_H
00005 #define ClpPlusMinusOneMatrix_H
00006 
00007 
00008 #include "CoinPragma.hpp"
00009 
00010 #include "ClpMatrixBase.hpp"
00011 
00016 class ClpPlusMinusOneMatrix : public ClpMatrixBase {
00017 
00018 public:
00021 
00022      virtual CoinPackedMatrix * getPackedMatrix() const;
00024      virtual bool isColOrdered() const ;
00026      virtual  CoinBigIndex getNumElements() const;
00028      virtual int getNumCols() const {
00029           return numberColumns_;
00030      }
00032      virtual int getNumRows() const {
00033           return numberRows_;
00034      }
00035 
00040      virtual const double * getElements() const;
00046      virtual const int * getIndices() const {
00047           return indices_;
00048      }
00049      // and for advanced use
00050      int * getMutableIndices() const {
00051           return indices_;
00052      }
00053 
00054      virtual const CoinBigIndex * getVectorStarts() const;
00056      virtual const int * getVectorLengths() const;
00057 
00059      virtual void deleteCols(const int numDel, const int * indDel);
00061      virtual void deleteRows(const int numDel, const int * indDel);
00063      virtual void appendCols(int number, const CoinPackedVectorBase * const * columns);
00065      virtual void appendRows(int number, const CoinPackedVectorBase * const * rows);
00066 #ifndef SLIM_CLP
00067 
00071      virtual int appendMatrix(int number, int type,
00072                               const CoinBigIndex * starts, const int * index,
00073                               const double * element, int numberOther = -1);
00074 #endif
00075 
00076      virtual ClpMatrixBase * reverseOrderedCopy() const;
00078      virtual CoinBigIndex countBasis(
00079           const int * whichColumn,
00080           int & numberColumnBasic);
00082      virtual void fillBasis(ClpSimplex * model,
00083                             const int * whichColumn,
00084                             int & numberColumnBasic,
00085                             int * row, int * start,
00086                             int * rowCount, int * columnCount,
00087                             CoinFactorizationDouble * element);
00092      virtual CoinBigIndex * dubiousWeights(const ClpSimplex * model, int * inputWeights) const;
00096      virtual void rangeOfElements(double & smallestNegative, double & largestNegative,
00097                                   double & smallestPositive, double & largestPositive);
00100      virtual void unpack(const ClpSimplex * model, CoinIndexedVector * rowArray,
00101                          int column) const ;
00106      virtual void unpackPacked(ClpSimplex * model,
00107                                CoinIndexedVector * rowArray,
00108                                int column) const;
00111      virtual void add(const ClpSimplex * model, CoinIndexedVector * rowArray,
00112                       int column, double multiplier) const ;
00114      virtual void add(const ClpSimplex * model, double * array,
00115                       int column, double multiplier) const;
00117      virtual void releasePackedMatrix() const;
00123      virtual void setDimensions(int numrows, int numcols);
00125      void checkValid(bool detail) const;
00127 
00133      virtual void times(double scalar,
00134                         const double * x, double * y) const;
00136      virtual void times(double scalar,
00137                         const double * x, double * y,
00138                         const double * rowScale,
00139                         const double * columnScale) const;
00143      virtual void transposeTimes(double scalar,
00144                                  const double * x, double * y) const;
00146      virtual void transposeTimes(double scalar,
00147                                  const double * x, double * y,
00148                                  const double * rowScale,
00149                                  const double * columnScale, double * spare = NULL) const;
00154      virtual void transposeTimes(const ClpSimplex * model, double scalar,
00155                                  const CoinIndexedVector * x,
00156                                  CoinIndexedVector * y,
00157                                  CoinIndexedVector * z) const;
00163      virtual void transposeTimesByRow(const ClpSimplex * model, double scalar,
00164                                       const CoinIndexedVector * x,
00165                                       CoinIndexedVector * y,
00166                                       CoinIndexedVector * z) const;
00170      virtual void subsetTransposeTimes(const ClpSimplex * model,
00171                                        const CoinIndexedVector * x,
00172                                        const CoinIndexedVector * y,
00173                                        CoinIndexedVector * z) const;
00176      virtual bool canCombine(const ClpSimplex * model,
00177                              const CoinIndexedVector * pi) const;
00179      virtual void transposeTimes2(const ClpSimplex * model,
00180                                   const CoinIndexedVector * pi1, CoinIndexedVector * dj1,
00181                                   const CoinIndexedVector * pi2,
00182                                   CoinIndexedVector * spare,
00183                                   double referenceIn, double devex,
00184                                   // Array for exact devex to say what is in reference framework
00185                                   unsigned int * reference,
00186                                   double * weights, double scaleFactor);
00188      virtual void subsetTimes2(const ClpSimplex * model,
00189                                CoinIndexedVector * dj1,
00190                                const CoinIndexedVector * pi2, CoinIndexedVector * dj2,
00191                                double referenceIn, double devex,
00192                                // Array for exact devex to say what is in reference framework
00193                                unsigned int * reference,
00194                                double * weights, double scaleFactor);
00196 
00199 
00200      inline CoinBigIndex * startPositive() const {
00201           return startPositive_;
00202      }
00204      inline CoinBigIndex * startNegative() const {
00205           return startNegative_;
00206      }
00208 
00209 
00213      ClpPlusMinusOneMatrix();
00215      virtual ~ClpPlusMinusOneMatrix();
00217 
00221      ClpPlusMinusOneMatrix(const ClpPlusMinusOneMatrix&);
00228      ClpPlusMinusOneMatrix(const CoinPackedMatrix&);
00230      ClpPlusMinusOneMatrix(int numberRows, int numberColumns,
00231                            bool columnOrdered, const int * indices,
00232                            const CoinBigIndex * startPositive, const CoinBigIndex * startNegative);
00235      ClpPlusMinusOneMatrix (const ClpPlusMinusOneMatrix & wholeModel,
00236                             int numberRows, const int * whichRows,
00237                             int numberColumns, const int * whichColumns);
00238 
00239      ClpPlusMinusOneMatrix& operator=(const ClpPlusMinusOneMatrix&);
00241      virtual ClpMatrixBase * clone() const ;
00244      virtual ClpMatrixBase * subsetClone (
00245           int numberRows, const int * whichRows,
00246           int numberColumns, const int * whichColumns) const ;
00248      void passInCopy(int numberRows, int numberColumns,
00249                      bool columnOrdered, int * indices,
00250                      CoinBigIndex * startPositive, CoinBigIndex * startNegative);
00252      virtual bool canDoPartialPricing() const;
00254      virtual void partialPricing(ClpSimplex * model, double start, double end,
00255                                  int & bestSequence, int & numberWanted);
00257 
00258 
00259 protected:
00263 
00264      mutable CoinPackedMatrix * matrix_;
00265      mutable int * lengths_;
00267      CoinBigIndex * startPositive_;
00269      CoinBigIndex * startNegative_;
00271      int * indices_;
00273      int numberRows_;
00275      int numberColumns_;
00277      bool columnOrdered_;
00278 
00280 };
00281 
00282 #endif