Ignore:
Timestamp:
Jan 11, 2008 5:03:37 PM (12 years ago)
Author:
forrest
Message:

try and make a bit faster

File:
1 edited

Legend:

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

    r1147 r1150  
    6262  matrix_(NULL),
    6363  rowCopy_(NULL),
     64  scaledMatrix_(NULL),
    6465  ray_(NULL),
    6566  rowScale_(NULL),
     
    175176  delete rowCopy_;
    176177  rowCopy_=NULL;
     178  delete scaledMatrix_;
     179  scaledMatrix_=NULL,
    177180  delete [] ray_;
    178181  ray_ = NULL;
     
    653656    delete rowCopy_; // in case odd
    654657    rowCopy_=NULL;
     658    delete scaledMatrix_;
     659    scaledMatrix_=NULL;
    655660    if (scalingMode&&!matrix_->scale(this)) {
    656661      // scaling worked - now apply
     
    790795        rowCopy_=NULL;
    791796      }
     797      if (rhs.scaledMatrix_) {
     798        scaledMatrix_ = new ClpPackedMatrix(*rhs.scaledMatrix_);
     799      } else {
     800        scaledMatrix_=NULL;
     801      }
    792802      matrix_=NULL;
    793803      if (rhs.matrix_) {
     
    842852      } else {
    843853        rowCopy_=NULL;
     854      }
     855      delete scaledMatrix_;
     856      if (rhs.scaledMatrix_) {
     857        scaledMatrix_ = new ClpPackedMatrix(*rhs.scaledMatrix_);
     858      } else {
     859        scaledMatrix_=NULL;
    844860      }
    845861      delete matrix_;
     
    880896    matrix_ = rhs.matrix_;
    881897    rowCopy_ = NULL;
     898    scaledMatrix_ = NULL;
    882899    ray_ = rhs.ray_;
    883900    //rowScale_ = rhs.rowScale_;
     
    932949  delete [] rhs.ray_;
    933950  rhs.ray_=NULL;
     951  // make sure scaled matrix not copied
     952  ClpPackedMatrix * save = rhs.scaledMatrix_;
     953  rhs.scaledMatrix_ = NULL;
     954  delete scaledMatrix_;
     955  scaledMatrix_=NULL;
    934956  gutsOfCopy(rhs,0);
     957  rhs.scaledMatrix_ = save;
    935958  specialOptions_ = rhs.specialOptions_ & ~65536;
    936959  savedRowScale_=NULL;
     
    957980  matrix_ = NULL;
    958981  rowCopy_ = NULL;
     982  delete scaledMatrix_;
     983  scaledMatrix_ = NULL;
    959984  delete [] otherModel.ray_;
    960985  otherModel.ray_ = ray_;
     
    14781503    delete rowCopy_;
    14791504    rowCopy_=NULL;
     1505    delete scaledMatrix_;
     1506    scaledMatrix_=NULL;
    14801507    if (!matrix_)
    14811508      createEmptyMatrix();
     
    15661593  delete rowCopy_;
    15671594  rowCopy_=NULL;
     1595  delete scaledMatrix_;
     1596  scaledMatrix_=NULL;
    15681597  if (!matrix_)
    15691598    createEmptyMatrix();
     
    19551984    delete rowCopy_;
    19561985    rowCopy_=NULL;
     1986    delete scaledMatrix_;
     1987    scaledMatrix_=NULL;
    19571988    if (!matrix_)
    19581989      createEmptyMatrix();
     
    20552086  delete rowCopy_;
    20562087  rowCopy_=NULL;
     2088  delete scaledMatrix_;
     2089  scaledMatrix_=NULL;
    20572090  if (!matrix_)
    20582091    createEmptyMatrix();
     
    30713104  scalingFlag_ = rhs->scalingFlag_;
    30723105  rowCopy_=NULL;
     3106  scaledMatrix_=NULL;
    30733107  matrix_=NULL;
    30743108  if (rhs->matrix_) {
     
    35603594                  const double * x, double * y) const
    35613595{
    3562   if (rowScale_)
    3563     matrix_->times(scalar,x,y,rowScale_,columnScale_);
    3564   else
    3565     matrix_->times(scalar,x,y);
     3596  if (!scaledMatrix_||!rowScale_) {
     3597    if (rowScale_)
     3598      matrix_->times(scalar,x,y,rowScale_,columnScale_);
     3599    else
     3600      matrix_->times(scalar,x,y);
     3601  } else {
     3602    scaledMatrix_->times(scalar,x,y);
     3603  }
    35663604}
    35673605void
     
    35693607                           const double * x, double * y) const
    35703608{
    3571   if (rowScale_)
    3572     matrix_->transposeTimes(scalar,x,y,rowScale_,columnScale_);
    3573   else
    3574     matrix_->transposeTimes(scalar,x,y);
     3609  if (!scaledMatrix_||!rowScale_) {
     3610    if (rowScale_)
     3611      matrix_->transposeTimes(scalar,x,y,rowScale_,columnScale_);
     3612    else
     3613      matrix_->transposeTimes(scalar,x,y);
     3614  } else {
     3615    scaledMatrix_->transposeTimes(scalar,x,y);
     3616  }
    35753617}
    35763618// Does much of scaling
Note: See TracChangeset for help on using the changeset viewer.