Changeset 1836 for trunk


Ignore:
Timestamp:
Dec 15, 2011 3:22:39 PM (8 years ago)
Author:
lou
Message:

Fix bug of r1679 again, plus a few other changes to set ClpPackedMatrix::flags_
correctly.

Location:
trunk/Clp/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Clp/src/ClpPackedMatrix.cpp

    r1780 r1836  
    7070{
    7171#ifndef COIN_SPARSE_MATRIX
    72      matrix_ = new CoinPackedMatrix(*(rhs.matrix_), -1, -1);
     72     // Guaranteed no gaps or small elements
     73     matrix_ = new CoinPackedMatrix(*(rhs.matrix_),-1,0) ;
     74     flags_ = rhs.flags_&(~0x02) ;
    7375#else
    74      matrix_ = new CoinPackedMatrix(*(rhs.matrix_), -0, -0);
     76     // Gaps & small elements preserved
     77     matrix_ = new CoinPackedMatrix(*(rhs.matrix_),0,0) ;
     78     flags_ = rhs.flags_ ;
     79     if (matrix_->hasGaps()) flags_ |= 0x02 ;
    7580#endif
    7681     numberActiveColumns_ = rhs.numberActiveColumns_;
    77      flags_ = rhs.flags_ & (~2);
    7882     int numberRows = matrix_->getNumRows();
    7983     if (rhs.rhsOffset_ && numberRows) {
     
    102106{
    103107     matrix_ = rhs;
    104      flags_ = matrix_->hasGaps() ? 2 : 0;
     108     flags_ = ((matrix_->hasGaps())?0x02:0) ;
    105109     numberActiveColumns_ = matrix_->getNumCols();
    106110     rowCopy_ = NULL;
     
    114118{
    115119#ifndef COIN_SPARSE_MATRIX
    116      matrix_ = new CoinPackedMatrix(rhs, -1, -1);
     120     matrix_ = new CoinPackedMatrix(rhs,-1,0) ;
     121     flags_ = 0 ;
    117122#else
    118      matrix_ = new CoinPackedMatrix(rhs, -0, -0);
     123     matrix_ = new CoinPackedMatrix(rhs,0,0) ;
     124     flags_ = ((matrix_->hasGaps())?0x02:0) ;
    119125#endif
    120126     numberActiveColumns_ = matrix_->getNumCols();
    121127     rowCopy_ = NULL;
    122      flags_ = 0;
    123128     columnCopy_ = NULL;
    124129     setType(1);
     
    146151          delete matrix_;
    147152#ifndef COIN_SPARSE_MATRIX
    148           matrix_ = new CoinPackedMatrix(*(rhs.matrix_));
     153          matrix_ = new CoinPackedMatrix(*(rhs.matrix_),-1,0) ;
     154          flags_ = rhs.flags_&(~0x02) ;
    149155#else
    150           matrix_ = new CoinPackedMatrix(*(rhs.matrix_), -0, -0);
     156          matrix_ = new CoinPackedMatrix(*(rhs.matrix_),0,0) ;
     157          flags_ = rhs.flags_ ;
     158          if (matrix_->hasGaps()) flags_ |= 0x02 ;
    151159#endif
    152160          numberActiveColumns_ = rhs.numberActiveColumns_;
    153           flags_ = rhs.flags_;
    154161          delete rowCopy_;
    155162          delete columnCopy_;
     
    207214     numberActiveColumns_ = matrix_->getNumCols();
    208215     rowCopy_ = NULL;
    209      flags_ = rhs.flags_ & (~2); // no gaps
     216     flags_ = rhs.flags_&(~0x02) ; // no gaps
    210217     columnCopy_ = NULL;
    211218}
     
    220227     numberActiveColumns_ = matrix_->getNumCols();
    221228     rowCopy_ = NULL;
    222      flags_ = 2;
     229     flags_ = 0 ;  // no gaps
    223230     columnCopy_ = NULL;
    224231     setType(1);
     
    236243     //copy->matrix_->removeGaps();
    237244     copy->numberActiveColumns_ = copy->matrix_->getNumCols();
    238      copy->flags_ = flags_ & (~2); // no gaps
     245     copy->flags_ = flags_&(~0x02) ; // no gaps
    239246     return copy;
    240247}
     
    250257     const double * elementByColumn = matrix_->getElements();
    251258     //memset(y,0,matrix_->getNumRows()*sizeof(double));
    252      assert (((flags_ & 2) != 0) == matrix_->hasGaps());
     259     assert (((flags_&0x02) != 0) == matrix_->hasGaps());
    253260     if (!(flags_ & 2)) {
    254261          for (iColumn = 0; iColumn < numberActiveColumns_; iColumn++) {
     
    33323339          }
    33333340     }
    3334      if (deletedElements)
     3341     if (deletedElements) {
    33353342       matrix_->setNumElements(matrix_->getNumElements()-deletedElements);
     3343       flags_ |= 0x02 ;
     3344     }
    33363345     model->messageHandler()->message(CLP_PACKEDSCALE_INITIAL, *model->messagesPointer())
    33373346               << smallest << largest
  • trunk/Clp/src/ClpPackedMatrix.hpp

    r1825 r1836  
    475475         16 - wants special column copy
    476476     */
    477      int flags_;
     477     mutable int flags_;
    478478     /// Special row copy
    479479     ClpPackedMatrix2 * rowCopy_;
Note: See TracChangeset for help on using the changeset viewer.