Ignore:
Timestamp:
Jan 6, 2019 2:43:06 PM (4 months ago)
Author:
unxusr
Message:

formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/AbcMatrix.hpp

    r1910 r2385  
    2121class AbcMatrix3;
    2222class AbcMatrix {
    23  
     23
    2424public:
    2525  /**@name Useful methods */
    2626  //@{
    2727  /// Return a complete CoinPackedMatrix
    28   inline CoinPackedMatrix * getPackedMatrix() const {
     28  inline CoinPackedMatrix *getPackedMatrix() const
     29  {
    2930    return matrix_;
    3031  }
    3132  /** Whether the packed matrix is column major ordered or not. */
    32   inline bool isColOrdered() const {
     33  inline bool isColOrdered() const
     34  {
    3335    return true;
    3436  }
    3537  /** Number of entries in the packed matrix. */
    36   inline CoinBigIndex getNumElements() const {
     38  inline CoinBigIndex getNumElements() const
     39  {
    3740    return matrix_->getNumElements();
    3841  }
    3942  /** Number of columns. */
    40   inline int getNumCols() const {
    41     assert(matrix_->getNumCols()==model_->numberColumns());return matrix_->getNumCols();
     43  inline int getNumCols() const
     44  {
     45    assert(matrix_->getNumCols() == model_->numberColumns());
     46    return matrix_->getNumCols();
    4247  }
    4348  /** Number of rows. */
    44   inline int getNumRows() const {
    45     assert(matrix_->getNumRows()==model_->numberRows());return matrix_->getNumRows();
     49  inline int getNumRows() const
     50  {
     51    assert(matrix_->getNumRows() == model_->numberRows());
     52    return matrix_->getNumRows();
    4653  }
    4754  /// Sets model
    48   void setModel(AbcSimplex * model);
     55  void setModel(AbcSimplex *model);
    4956  /// A vector containing the elements in the packed matrix.
    50   inline const double * getElements() const {
     57  inline const double *getElements() const
     58  {
    5159    return matrix_->getElements();
    5260  }
    5361  /// Mutable elements
    54   inline double * getMutableElements() const {
     62  inline double *getMutableElements() const
     63  {
    5564    return matrix_->getMutableElements();
    5665  }
    57   /// A vector containing the minor indices of the elements in the packed matrix.
    58   inline const int * getIndices() const {
     66  /// A vector containing the minor indices of the elements in the packed matrix.
     67  inline const int *getIndices() const
     68  {
    5969    return matrix_->getIndices();
    6070  }
    61   /// A vector containing the minor indices of the elements in the packed matrix.
    62   inline int * getMutableIndices() const {
     71  /// A vector containing the minor indices of the elements in the packed matrix.
     72  inline int *getMutableIndices() const
     73  {
    6374    return matrix_->getMutableIndices();
    6475  }
    6576  /// Starts
    66   inline const CoinBigIndex * getVectorStarts() const {
     77  inline const CoinBigIndex *getVectorStarts() const
     78  {
    6779    return matrix_->getVectorStarts();
    6880  }
    69   inline  CoinBigIndex * getMutableVectorStarts() const {
     81  inline CoinBigIndex *getMutableVectorStarts() const
     82  {
    7083    return matrix_->getMutableVectorStarts();
    7184  }
    7285  /** The lengths of the major-dimension vectors. */
    73   inline const int * getVectorLengths() const {
     86  inline const int *getVectorLengths() const
     87  {
    7488    return matrix_->getVectorLengths();
    7589  }
    7690  /** The lengths of the major-dimension vectors. */
    77   inline int * getMutableVectorLengths() const {
     91  inline int *getMutableVectorLengths() const
     92  {
    7893    return matrix_->getMutableVectorLengths();
    7994  }
    8095  /// Row starts
    81   CoinBigIndex * rowStart() const;
     96  CoinBigIndex *rowStart() const;
    8297  /// Row ends
    83   CoinBigIndex * rowEnd() const;
     98  CoinBigIndex *rowEnd() const;
    8499  /// Row elements
    85   double * rowElements() const;
     100  double *rowElements() const;
    86101  /// Row columns
    87   CoinSimplexInt * rowColumns() const;
     102  CoinSimplexInt *rowColumns() const;
    88103  /** Returns a new matrix in reverse order without gaps */
    89   CoinPackedMatrix * reverseOrderedCopy() const;
     104  CoinPackedMatrix *reverseOrderedCopy() const;
    90105  /// Returns number of elements in column part of basis
    91   CoinBigIndex countBasis(const int * whichColumn,
    92                           int & numberColumnBasic);
     106  CoinBigIndex countBasis(const int *whichColumn,
     107    int &numberColumnBasic);
    93108  /// Fills in column part of basis
    94   void fillBasis(const int * whichColumn,
    95                  int & numberColumnBasic,
    96                  int * row, int * start,
    97                  int * rowCount, int * columnCount,
    98                  CoinSimplexDouble * element);
     109  void fillBasis(const int *whichColumn,
     110    int &numberColumnBasic,
     111    int *row, int *start,
     112    int *rowCount, int *columnCount,
     113    CoinSimplexDouble *element);
    99114  /// Fills in column part of basis
    100   void fillBasis(const int * whichColumn,
    101                  int & numberColumnBasic,
    102                  int * row, int * start,
    103                  int * rowCount, int * columnCount,
    104                  long double * element);
     115  void fillBasis(const int *whichColumn,
     116    int &numberColumnBasic,
     117    int *row, int *start,
     118    int *rowCount, int *columnCount,
     119    long double *element);
    105120  /** Scales and creates row copy
    106121  */
     
    109124  void createRowCopy();
    110125  /// Take out of useful
    111   void takeOutOfUseful(int sequence,CoinIndexedVector & spare);
     126  void takeOutOfUseful(int sequence, CoinIndexedVector &spare);
    112127  /// Put into useful
    113   void putIntofUseful(int sequence,CoinIndexedVector & spare);
     128  void putIntofUseful(int sequence, CoinIndexedVector &spare);
    114129  /// Put in and out for useful
    115   void inOutUseful(int sequenceIn,int sequenceOut);
     130  void inOutUseful(int sequenceIn, int sequenceOut);
    116131  /// Make all useful
    117   void makeAllUseful(CoinIndexedVector & spare);
     132  void makeAllUseful(CoinIndexedVector &spare);
    118133  /// Sort into useful
    119   void sortUseful(CoinIndexedVector & spare);
     134  void sortUseful(CoinIndexedVector &spare);
    120135  /// Move largest in column to beginning (not used as doesn't help factorization)
    121136  void moveLargestToStart();
    122  
     137
    123138  /** Unpacks a column into an CoinIndexedVector
    124139   */
    125   void unpack(CoinIndexedVector & rowArray,
    126               int column) const ;
     140  void unpack(CoinIndexedVector &rowArray,
     141    int column) const;
    127142  /** Adds multiple of a column (or slack) into an CoinIndexedvector
    128143      You can use quickAdd to add to vector */
    129   void add(CoinIndexedVector & rowArray, int column, double multiplier) const ;
    130   //@}
    131  
     144  void add(CoinIndexedVector &rowArray, int column, double multiplier) const;
     145  //@}
     146
    132147  /**@name Matrix times vector methods */
    133148  //@{
     
    136151      @pre <code>y</code> must be of size <code>numRows()</code> */
    137152  void timesModifyExcludingSlacks(double scalar,
    138              const double * x, double * y) const;
     153    const double *x, double *y) const;
    139154  /** Return <code>y + A * scalar(+-1) *x</code> in <code>y</code>.
    140155      @pre <code>x</code> must be of size <code>numColumns()+numRows()</code>
    141156      @pre <code>y</code> must be of size <code>numRows()</code> */
    142157  void timesModifyIncludingSlacks(double scalar,
    143              const double * x, double * y) const;
     158    const double *x, double *y) const;
    144159  /** Return <code>A * scalar(+-1) *x</code> in <code>y</code>.
    145160      @pre <code>x</code> must be of size <code>numColumns()+numRows()</code>
    146161      @pre <code>y</code> must be of size <code>numRows()</code> */
    147162  void timesIncludingSlacks(double scalar,
    148              const double * x, double * y) const;
     163    const double *x, double *y) const;
    149164  /** Return A * scalar(+-1) *x + y</code> in <code>y</code>.
    150165      @pre <code>x</code> must be of size <code>numRows()</code>
    151166      @pre <code>y</code> must be of size <code>numRows()+numColumns()</code> */
    152167  void transposeTimesNonBasic(double scalar,
    153                             const double * x, double * y) const;
     168    const double *x, double *y) const;
    154169  /** Return y - A * x</code> in <code>y</code>.
    155170      @pre <code>x</code> must be of size <code>numRows()</code>
    156171      @pre <code>y</code> must be of size <code>numRows()+numColumns()</code> */
    157   void transposeTimesAll(const double * x, double * y) const;
     172  void transposeTimesAll(const double *x, double *y) const;
    158173  /** Return y + A * scalar(+-1) *x</code> in <code>y</code>.
    159174      @pre <code>x</code> must be of size <code>numRows()</code>
    160175      @pre <code>y</code> must be of size <code>numRows()</code> */
    161176  void transposeTimesBasic(double scalar,
    162                             const double * x, double * y) const;
     177    const double *x, double *y) const;
    163178  /** Return <code>x * scalar * A/code> in <code>z</code>.
    164179      Note - x unpacked mode - z packed mode including slacks
     
    172187      Squashes small elements and knows about AbcSimplex */
    173188  int transposeTimesNonBasic(double scalar,
    174                       const CoinIndexedVector & x,
    175                       CoinIndexedVector & z) const;
     189    const CoinIndexedVector &x,
     190    CoinIndexedVector &z) const;
    176191  /// gets sorted tableau row and a possible value of theta
    177   double dualColumn1(const CoinIndexedVector & update,
    178                      CoinPartitionedVector & tableauRow,
    179                      CoinPartitionedVector & candidateList) const;
     192  double dualColumn1(const CoinIndexedVector &update,
     193    CoinPartitionedVector &tableauRow,
     194    CoinPartitionedVector &candidateList) const;
    180195  /// gets sorted tableau row and a possible value of theta
    181   double dualColumn1Row(int iBlock, double upperThetaSlack, int & freeSequence,
    182                         const CoinIndexedVector & update,
    183                         CoinPartitionedVector & tableauRow,
    184                         CoinPartitionedVector & candidateList) const;
     196  double dualColumn1Row(int iBlock, double upperThetaSlack, int &freeSequence,
     197    const CoinIndexedVector &update,
     198    CoinPartitionedVector &tableauRow,
     199    CoinPartitionedVector &candidateList) const;
    185200  /// gets sorted tableau row and a possible value of theta
    186   double dualColumn1RowFew(int iBlock, double upperThetaSlack, int & freeSequence,
    187                          const CoinIndexedVector & update,
    188                          CoinPartitionedVector & tableauRow,
    189                          CoinPartitionedVector & candidateList) const;
     201  double dualColumn1RowFew(int iBlock, double upperThetaSlack, int &freeSequence,
     202    const CoinIndexedVector &update,
     203    CoinPartitionedVector &tableauRow,
     204    CoinPartitionedVector &candidateList) const;
    190205  /// gets sorted tableau row and a possible value of theta
    191   double dualColumn1Row2(double upperThetaSlack, int & freeSequence,
    192                          const CoinIndexedVector & update,
    193                          CoinPartitionedVector & tableauRow,
    194                          CoinPartitionedVector & candidateList) const;
     206  double dualColumn1Row2(double upperThetaSlack, int &freeSequence,
     207    const CoinIndexedVector &update,
     208    CoinPartitionedVector &tableauRow,
     209    CoinPartitionedVector &candidateList) const;
    195210  /// gets sorted tableau row and a possible value of theta
    196   double dualColumn1Row1(double upperThetaSlack, int & freeSequence,
    197                          const CoinIndexedVector & update,
    198                          CoinPartitionedVector & tableauRow,
    199                          CoinPartitionedVector & candidateList) const;
     211  double dualColumn1Row1(double upperThetaSlack, int &freeSequence,
     212    const CoinIndexedVector &update,
     213    CoinPartitionedVector &tableauRow,
     214    CoinPartitionedVector &candidateList) const;
    200215  /** gets sorted tableau row and a possible value of theta
    201216      On input first,last give what to scan
    202217      On output is number in tableauRow and candidateList */
    203   void dualColumn1Part(int iBlock,int & sequenceIn, double & upperTheta,
    204                          const CoinIndexedVector & update,
    205                          CoinPartitionedVector & tableauRow,
    206                          CoinPartitionedVector & candidateList) const;
     218  void dualColumn1Part(int iBlock, int &sequenceIn, double &upperTheta,
     219    const CoinIndexedVector &update,
     220    CoinPartitionedVector &tableauRow,
     221    CoinPartitionedVector &candidateList) const;
    207222  /// rebalance for parallel
    208223  void rebalance() const;
    209224  /// Get sequenceIn when Dantzig
    210   int pivotColumnDantzig(const CoinIndexedVector & updates,
    211                          CoinPartitionedVector & spare) const;
     225  int pivotColumnDantzig(const CoinIndexedVector &updates,
     226    CoinPartitionedVector &spare) const;
    212227  /// Get sequenceIn when Dantzig (One block)
    213   int pivotColumnDantzig(int iBlock,bool doByRow,const CoinIndexedVector & updates,
    214                          CoinPartitionedVector & spare,
    215                          double & bestValue) const;
    216   /// gets tableau row - returns number of slacks in block 
    217   int primalColumnRow(int iBlock,bool doByRow,const CoinIndexedVector & update,
    218                           CoinPartitionedVector & tableauRow) const;
    219   /// gets tableau row and dj row - returns number of slacks in block 
    220   int primalColumnRowAndDjs(int iBlock,const CoinIndexedVector & updateTableau,
    221                           const CoinIndexedVector & updateDjs,
    222                             CoinPartitionedVector & tableauRow) const;
     228  int pivotColumnDantzig(int iBlock, bool doByRow, const CoinIndexedVector &updates,
     229    CoinPartitionedVector &spare,
     230    double &bestValue) const;
     231  /// gets tableau row - returns number of slacks in block
     232  int primalColumnRow(int iBlock, bool doByRow, const CoinIndexedVector &update,
     233    CoinPartitionedVector &tableauRow) const;
     234  /// gets tableau row and dj row - returns number of slacks in block
     235  int primalColumnRowAndDjs(int iBlock, const CoinIndexedVector &updateTableau,
     236    const CoinIndexedVector &updateDjs,
     237    CoinPartitionedVector &tableauRow) const;
    223238  /** Chooses best weighted dj
    224239   */
    225   int chooseBestDj(int iBlock,const CoinIndexedVector & infeasibilities,
    226                    const double * weights) const;
     240  int chooseBestDj(int iBlock, const CoinIndexedVector &infeasibilities,
     241    const double *weights) const;
    227242  /** does steepest edge double or triple update
    228243      If scaleFactor!=0 then use with tableau row to update djs
     
    230245      Returns best sequence
    231246   */
    232   int primalColumnDouble(int iBlock,CoinPartitionedVector & updateForTableauRow,
    233                           CoinPartitionedVector & updateForDjs,
    234                           const CoinIndexedVector & updateForWeights,
    235                           CoinPartitionedVector & spareColumn1,
    236                           double * infeasibilities,
    237                           double referenceIn, double devex,
    238                           // Array for exact devex to say what is in reference framework
    239                           unsigned int * reference,
    240                           double * weights, double scaleFactor) const;
     247  int primalColumnDouble(int iBlock, CoinPartitionedVector &updateForTableauRow,
     248    CoinPartitionedVector &updateForDjs,
     249    const CoinIndexedVector &updateForWeights,
     250    CoinPartitionedVector &spareColumn1,
     251    double *infeasibilities,
     252    double referenceIn, double devex,
     253    // Array for exact devex to say what is in reference framework
     254    unsigned int *reference,
     255    double *weights, double scaleFactor) const;
    241256  /** does steepest edge double or triple update
    242257      If scaleFactor!=0 then use with tableau row to update djs
     
    244259      Returns best sequence
    245260   */
    246   int primalColumnSparseDouble(int iBlock,CoinPartitionedVector & updateForTableauRow,
    247                           CoinPartitionedVector & updateForDjs,
    248                           const CoinIndexedVector & updateForWeights,
    249                           CoinPartitionedVector & spareColumn1,
    250                           double * infeasibilities,
    251                           double referenceIn, double devex,
    252                           // Array for exact devex to say what is in reference framework
    253                           unsigned int * reference,
    254                           double * weights, double scaleFactor) const;
     261  int primalColumnSparseDouble(int iBlock, CoinPartitionedVector &updateForTableauRow,
     262    CoinPartitionedVector &updateForDjs,
     263    const CoinIndexedVector &updateForWeights,
     264    CoinPartitionedVector &spareColumn1,
     265    double *infeasibilities,
     266    double referenceIn, double devex,
     267    // Array for exact devex to say what is in reference framework
     268    unsigned int *reference,
     269    double *weights, double scaleFactor) const;
    255270  /** does steepest edge double or triple update
    256271      If scaleFactor!=0 then use with tableau row to update djs
     
    258273      Returns best sequence
    259274   */
    260   int primalColumnDouble(CoinPartitionedVector & updateForTableauRow,
    261                          CoinPartitionedVector & updateForDjs,
    262                          const CoinIndexedVector & updateForWeights,
    263                          CoinPartitionedVector & spareColumn1,
    264                          CoinIndexedVector & infeasible,
    265                         double referenceIn, double devex,
    266                         // Array for exact devex to say what is in reference framework
    267                          unsigned int * reference,
    268                          double * weights, double scaleFactor) const;
     275  int primalColumnDouble(CoinPartitionedVector &updateForTableauRow,
     276    CoinPartitionedVector &updateForDjs,
     277    const CoinIndexedVector &updateForWeights,
     278    CoinPartitionedVector &spareColumn1,
     279    CoinIndexedVector &infeasible,
     280    double referenceIn, double devex,
     281    // Array for exact devex to say what is in reference framework
     282    unsigned int *reference,
     283    double *weights, double scaleFactor) const;
    269284  /// gets subset updates
    270   void primalColumnSubset(int iBlock,const CoinIndexedVector & update,
    271                           const CoinPartitionedVector & tableauRow,
    272                           CoinPartitionedVector & weights) const;
     285  void primalColumnSubset(int iBlock, const CoinIndexedVector &update,
     286    const CoinPartitionedVector &tableauRow,
     287    CoinPartitionedVector &weights) const;
    273288  /// Partial pricing
    274289  void partialPricing(double startFraction, double endFraction,
    275                       int & bestSequence, int & numberWanted);
     290    int &bestSequence, int &numberWanted);
    276291  /** Return <code>x *A</code> in <code>z</code> but
    277292      just for indices Already in z.
    278293      Note - z always packed mode */
    279   void subsetTransposeTimes(const CoinIndexedVector & x,
    280                             CoinIndexedVector & z) const;
     294  void subsetTransposeTimes(const CoinIndexedVector &x,
     295    CoinIndexedVector &z) const;
    281296  /// Return <code>-x *A</code> in <code>z</code>
    282   void transposeTimes(const CoinIndexedVector & x,
    283                             CoinIndexedVector & z) const;
    284   //@}
    285  
     297  void transposeTimes(const CoinIndexedVector &x,
     298    CoinIndexedVector &z) const;
     299  //@}
     300
    286301  /**@name Other */
    287302  //@{
    288303  /// Returns CoinPackedMatrix (non const)
    289   inline CoinPackedMatrix * matrix() const {
     304  inline CoinPackedMatrix *matrix() const
     305  {
    290306    return matrix_;
    291307  }
    292308  /** Partial pricing tuning parameter - minimum number of "objects" to scan.
    293309      e.g. number of Gub sets but could be number of variables */
    294   inline int minimumObjectsScan() const {
     310  inline int minimumObjectsScan() const
     311  {
    295312    return minimumObjectsScan_;
    296313  }
    297   inline void setMinimumObjectsScan(int value) {
     314  inline void setMinimumObjectsScan(int value)
     315  {
    298316    minimumObjectsScan_ = value;
    299317  }
    300318  /// Partial pricing tuning parameter - minimum number of negative reduced costs to get
    301   inline int minimumGoodReducedCosts() const {
     319  inline int minimumGoodReducedCosts() const
     320  {
    302321    return minimumGoodReducedCosts_;
    303322  }
    304   inline void setMinimumGoodReducedCosts(int value) {
     323  inline void setMinimumGoodReducedCosts(int value)
     324  {
    305325    minimumGoodReducedCosts_ = value;
    306326  }
    307327  /// Current start of search space in matrix (as fraction)
    308   inline double startFraction() const {
     328  inline double startFraction() const
     329  {
    309330    return startFraction_;
    310331  }
    311   inline void setStartFraction(double value) {
     332  inline void setStartFraction(double value)
     333  {
    312334    startFraction_ = value;
    313335  }
    314336  /// Current end of search space in matrix (as fraction)
    315   inline double endFraction() const {
     337  inline double endFraction() const
     338  {
    316339    return endFraction_;
    317340  }
    318   inline void setEndFraction(double value) {
     341  inline void setEndFraction(double value)
     342  {
    319343    endFraction_ = value;
    320344  }
    321345  /// Current best reduced cost
    322   inline double savedBestDj() const {
     346  inline double savedBestDj() const
     347  {
    323348    return savedBestDj_;
    324349  }
    325   inline void setSavedBestDj(double value) {
     350  inline void setSavedBestDj(double value)
     351  {
    326352    savedBestDj_ = value;
    327353  }
    328354  /// Initial number of negative reduced costs wanted
    329   inline int originalWanted() const {
     355  inline int originalWanted() const
     356  {
    330357    return originalWanted_;
    331358  }
    332   inline void setOriginalWanted(int value) {
     359  inline void setOriginalWanted(int value)
     360  {
    333361    originalWanted_ = value;
    334362  }
    335363  /// Current number of negative reduced costs which we still need
    336   inline int currentWanted() const {
     364  inline int currentWanted() const
     365  {
    337366    return currentWanted_;
    338367  }
    339   inline void setCurrentWanted(int value) {
     368  inline void setCurrentWanted(int value)
     369  {
    340370    currentWanted_ = value;
    341371  }
    342372  /// Current best sequence
    343   inline int savedBestSequence() const {
     373  inline int savedBestSequence() const
     374  {
    344375    return savedBestSequence_;
    345376  }
    346   inline void setSavedBestSequence(int value) {
     377  inline void setSavedBestSequence(int value)
     378  {
    347379    savedBestSequence_ = value;
    348380  }
    349381  /// Start of each column block
    350   inline int * startColumnBlock() const
    351   {return startColumnBlock_;}
     382  inline int *startColumnBlock() const
     383  {
     384    return startColumnBlock_;
     385  }
    352386  /// Start of each block (in stored)
    353   inline const int * blockStart() const
    354   { return blockStart_;}
     387  inline const int *blockStart() const
     388  {
     389    return blockStart_;
     390  }
    355391  inline bool gotRowCopy() const
    356   { return rowStart_!=0;}
     392  {
     393    return rowStart_ != 0;
     394  }
    357395  /// Start of each block (in stored)
    358396  inline int blockStart(int block) const
    359   { return blockStart_[block];}
     397  {
     398    return blockStart_[block];
     399  }
    360400  /// Number of actual column blocks
    361401  inline int numberColumnBlocks() const
    362   { return numberColumnBlocks_;}
     402  {
     403    return numberColumnBlocks_;
     404  }
    363405  /// Number of actual row blocks
    364406  inline int numberRowBlocks() const
    365   { return numberRowBlocks_;}
    366   //@}
    367  
    368  
     407  {
     408    return numberRowBlocks_;
     409  }
     410  //@}
     411
    369412  /**@name Constructors, destructor */
    370413  //@{
     
    374417  ~AbcMatrix();
    375418  //@}
    376  
     419
    377420  /**@name Copy method */
    378421  //@{
    379422  /** The copy constructor. */
    380   AbcMatrix(const AbcMatrix&);
     423  AbcMatrix(const AbcMatrix &);
    381424  /** The copy constructor from an CoinPackedMatrix. */
    382   AbcMatrix(const CoinPackedMatrix&);
     425  AbcMatrix(const CoinPackedMatrix &);
    383426  /** Subset constructor (without gaps).  Duplicates are allowed
    384427      and order is as given */
    385   AbcMatrix (const AbcMatrix & wholeModel,
    386              int numberRows, const int * whichRows,
    387              int numberColumns, const int * whichColumns);
    388   AbcMatrix (const CoinPackedMatrix & wholeModel,
    389              int numberRows, const int * whichRows,
    390              int numberColumns, const int * whichColumns);
    391  
    392   AbcMatrix& operator=(const AbcMatrix&);
     428  AbcMatrix(const AbcMatrix &wholeModel,
     429    int numberRows, const int *whichRows,
     430    int numberColumns, const int *whichColumns);
     431  AbcMatrix(const CoinPackedMatrix &wholeModel,
     432    int numberRows, const int *whichRows,
     433    int numberColumns, const int *whichColumns);
     434
     435  AbcMatrix &operator=(const AbcMatrix &);
    393436  /// Copy contents - resizing if necessary - otherwise re-use memory
    394   void copy(const AbcMatrix * from);
     437  void copy(const AbcMatrix *from);
    395438  //@}
    396439private:
    397  
    398440protected:
    399441  /**@name Data members
     
    401443  //@{
    402444  /// Data
    403   CoinPackedMatrix * matrix_;
     445  CoinPackedMatrix *matrix_;
    404446  /// Model
    405   mutable AbcSimplex * model_;
    406 #if ABC_PARALLEL==0
     447  mutable AbcSimplex *model_;
     448#if ABC_PARALLEL == 0
    407449#define NUMBER_ROW_BLOCKS 1
    408450#define NUMBER_COLUMN_BLOCKS 1
    409 #elif ABC_PARALLEL==1
     451#elif ABC_PARALLEL == 1
    410452#define NUMBER_ROW_BLOCKS 4
    411453#define NUMBER_COLUMN_BLOCKS 4
     
    417459      first all row starts for block 0, then for block2
    418460      so NUMBER_ROW_BLOCKS+2 times number rows */
    419   CoinBigIndex * rowStart_;
     461  CoinBigIndex *rowStart_;
    420462  /// Values by row
    421   double * element_;
     463  double *element_;
    422464  /// Columns
    423   int * column_;
     465  int *column_;
    424466  /// Start of each column block
    425   mutable int startColumnBlock_[NUMBER_COLUMN_BLOCKS+1];
     467  mutable int startColumnBlock_[NUMBER_COLUMN_BLOCKS + 1];
    426468  /// Start of each block (in stored)
    427   int blockStart_[NUMBER_ROW_BLOCKS+1];
     469  int blockStart_[NUMBER_ROW_BLOCKS + 1];
    428470  /// Number of actual column blocks
    429471  mutable int numberColumnBlocks_;
     
    434476#define MAX_COUNT 13
    435477  /// Start in elements etc
    436   CoinBigIndex countStart_[MAX_COUNT+1];
     478  CoinBigIndex countStart_[MAX_COUNT + 1];
    437479  /// First column
    438   int countFirst_[MAX_COUNT+1];
     480  int countFirst_[MAX_COUNT + 1];
    439481  // later int countEndUseful_[MAX_COUNT+1];
    440   int * countRealColumn_;
     482  int *countRealColumn_;
    441483  // later int * countInverseRealColumn_;
    442   CoinBigIndex * countStartLarge_;
    443   int * countRow_;
    444   double * countElement_;
     484  CoinBigIndex *countStartLarge_;
     485  int *countRow_;
     486  double *countElement_;
    445487  int smallestCount_;
    446488  int largestCount_;
    447 #endif 
     489#endif
    448490  /// Special row copy
    449491  //AbcMatrix2 * rowCopy_;
     
    472514typedef struct {
    473515  double acceptablePivot;
    474   const AbcSimplex * model;
    475   double * spare;
    476   int * spareIndex;
    477   double * arrayTemp;
    478   int * indexTemp;
    479   int * numberInPtr;
    480   double * bestPossiblePtr;
    481   double * upperThetaPtr;
    482   int * posFreePtr;
    483   double * freePivotPtr;
    484   int * numberOutPtr;
    485   const unsigned short * count;
    486   const double * pi;
    487   const CoinBigIndex * rowStart;
    488   const double * element;
    489   const unsigned short * column;
     516  const AbcSimplex *model;
     517  double *spare;
     518  int *spareIndex;
     519  double *arrayTemp;
     520  int *indexTemp;
     521  int *numberInPtr;
     522  double *bestPossiblePtr;
     523  double *upperThetaPtr;
     524  int *posFreePtr;
     525  double *freePivotPtr;
     526  int *numberOutPtr;
     527  const unsigned short *count;
     528  const double *pi;
     529  const CoinBigIndex *rowStart;
     530  const double *element;
     531  const unsigned short *column;
    490532  int offset;
    491533  int numberInRowArray;
     
    494536#endif
    495537class AbcMatrix2 {
    496  
     538
    497539public:
    498540  /**@name Useful methods */
     
    501543      Note - x packed and z will be packed mode
    502544      Squashes small elements and knows about AbcSimplex */
    503   void transposeTimes(const AbcSimplex * model,
    504                       const CoinPackedMatrix * rowCopy,
    505                       const CoinIndexedVector & x,
    506                       CoinIndexedVector & spareArray,
    507                       CoinIndexedVector & z) const;
     545  void transposeTimes(const AbcSimplex *model,
     546    const CoinPackedMatrix *rowCopy,
     547    const CoinIndexedVector &x,
     548    CoinIndexedVector &spareArray,
     549    CoinIndexedVector &z) const;
    508550  /// Returns true if copy has useful information
    509   inline bool usefulInfo() const {
     551  inline bool usefulInfo() const
     552  {
    510553    return rowStart_ != NULL;
    511554  }
    512555  //@}
    513  
    514  
     556
    515557  /**@name Constructors, destructor */
    516558  //@{
     
    518560  AbcMatrix2();
    519561  /** Constructor from copy. */
    520   AbcMatrix2(AbcSimplex * model, const CoinPackedMatrix * rowCopy);
     562  AbcMatrix2(AbcSimplex *model, const CoinPackedMatrix *rowCopy);
    521563  /** Destructor */
    522564  ~AbcMatrix2();
    523565  //@}
    524  
     566
    525567  /**@name Copy method */
    526568  //@{
    527569  /** The copy constructor. */
    528   AbcMatrix2(const AbcMatrix2&);
    529   AbcMatrix2& operator=(const AbcMatrix2&);
    530   //@}
    531  
    532  
     570  AbcMatrix2(const AbcMatrix2 &);
     571  AbcMatrix2 &operator=(const AbcMatrix2 &);
     572  //@}
     573
    533574protected:
    534575  /**@name Data members
     
    540581  int numberRows_;
    541582  /// Column offset for each block (plus one at end)
    542   int * offset_;
     583  int *offset_;
    543584  /// Counts of elements in each part of row
    544   mutable unsigned short * count_;
     585  mutable unsigned short *count_;
    545586  /// Row starts
    546   mutable CoinBigIndex * rowStart_;
     587  mutable CoinBigIndex *rowStart_;
    547588  /// columns within block
    548   unsigned short * column_;
     589  unsigned short *column_;
    549590  /// work arrays
    550   double * work_;
     591  double *work_;
    551592#ifdef THREAD
    552   pthread_t * threadId_;
    553   dualColumn0Struct * info_;
     593  pthread_t *threadId_;
     594  dualColumn0Struct *info_;
    554595#endif
    555596  //@}
     
    563604} blockStruct3;
    564605class AbcMatrix3 {
    565  
     606
    566607public:
    567608  /**@name Useful methods */
     
    570611      Note - x packed and z will be packed mode
    571612      Squashes small elements and knows about AbcSimplex */
    572   void transposeTimes(const AbcSimplex * model,
    573                       const double * pi,
    574                       CoinIndexedVector & output) const;
     613  void transposeTimes(const AbcSimplex *model,
     614    const double *pi,
     615    CoinIndexedVector &output) const;
    575616  /// Updates two arrays for steepest
    576   void transposeTimes2(const AbcSimplex * model,
    577                        const double * pi, CoinIndexedVector & dj1,
    578                        const double * piWeight,
    579                        double referenceIn, double devex,
    580                        // Array for exact devex to say what is in reference framework
    581                        unsigned int * reference,
    582                        double * weights, double scaleFactor);
    583   //@}
    584  
    585  
     617  void transposeTimes2(const AbcSimplex *model,
     618    const double *pi, CoinIndexedVector &dj1,
     619    const double *piWeight,
     620    double referenceIn, double devex,
     621    // Array for exact devex to say what is in reference framework
     622    unsigned int *reference,
     623    double *weights, double scaleFactor);
     624  //@}
     625
    586626  /**@name Constructors, destructor */
    587627  //@{
     
    589629  AbcMatrix3();
    590630  /** Constructor from copy. */
    591   AbcMatrix3(AbcSimplex * model, const CoinPackedMatrix * columnCopy);
     631  AbcMatrix3(AbcSimplex *model, const CoinPackedMatrix *columnCopy);
    592632  /** Destructor */
    593633  ~AbcMatrix3();
    594634  //@}
    595  
     635
    596636  /**@name Copy method */
    597637  //@{
    598638  /** The copy constructor. */
    599   AbcMatrix3(const AbcMatrix3&);
    600   AbcMatrix3& operator=(const AbcMatrix3&);
     639  AbcMatrix3(const AbcMatrix3 &);
     640  AbcMatrix3 &operator=(const AbcMatrix3 &);
    601641  //@}
    602642  /**@name Sort methods */
    603643  //@{
    604644  /** Sort blocks */
    605   void sortBlocks(const AbcSimplex * model);
     645  void sortBlocks(const AbcSimplex *model);
    606646  /// Swap one variable
    607   void swapOne(const AbcSimplex * model, const AbcMatrix * matrix,
    608                int iColumn);
    609   //@}
    610  
    611  
     647  void swapOne(const AbcSimplex *model, const AbcMatrix *matrix,
     648    int iColumn);
     649  //@}
     650
    612651protected:
    613652  /**@name Data members
     
    619658  int numberColumns_;
    620659  /// Column indices and reverse lookup (within block)
    621   int * column_;
     660  int *column_;
    622661  /// Starts for odd/long vectors
    623   CoinBigIndex * start_;
     662  CoinBigIndex *start_;
    624663  /// Rows
    625   int * row_;
     664  int *row_;
    626665  /// Elements
    627   double * element_;
     666  double *element_;
    628667  /// Blocks (ordinary start at 0 and go to first block)
    629   blockStruct * block_;
     668  blockStruct *block_;
    630669  //@}
    631670};
    632671
    633672#endif
     673
     674/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     675*/
Note: See TracChangeset for help on using the changeset viewer.