Changeset 706 for trunk/ClpModel.cpp


Ignore:
Timestamp:
Jan 11, 2006 10:09:50 AM (15 years ago)
Author:
forrest
Message:

for names

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ClpModel.cpp

    r701 r706  
    188188  reducedCost_=new double[numberColumns_];
    189189
    190   ClpFillN(dual_,numberRows_,0.0);
    191   ClpFillN(reducedCost_,numberColumns_,0.0);
     190  CoinZeroN(dual_,numberRows_);
     191  CoinZeroN(reducedCost_,numberColumns_);
    192192  int iRow,iColumn;
    193193
     
    678678    }
    679679#endif
    680     if (rhs.integerType_) {
    681       integerType_ = new char[numberColumns_];
    682       memcpy(integerType_,rhs.integerType_,numberColumns_*sizeof(char));
    683     } else {
    684       integerType_ = NULL;
    685     }
     680    integerType_ = CoinCopyOfArray(rhs.integerType_,numberColumns_);
    686681    if (rhs.rowActivity_) {
    687682      rowActivity_=new double[numberRows_];
     
    898893    double * newArray = new double[newSize];
    899894    if (array)
    900       memcpy(newArray,array,CoinMin(newSize,size)*sizeof(double));
     895      CoinMemcpyN(array,CoinMin(newSize,size),newArray);
    901896    delete [] array;
    902897    array = newArray;
     
    914909    char * deleted = new char[size];
    915910    int numberDeleted=0;
    916     memset(deleted,0,size*sizeof(char));
     911    CoinZeroN(deleted,size);
    917912    for (i=0;i<number;i++) {
    918913      int j = which[i];
     
    944939    char * deleted = new char[size];
    945940    int numberDeleted=0;
    946     memset(deleted,0,size*sizeof(char));
     941    CoinZeroN(deleted,size);
    947942    for (i=0;i<number;i++) {
    948943      int j = which[i];
     
    10521047  if (integerType_) {
    10531048    char * temp = new char [newNumberColumns];
    1054     memset(temp,0,newNumberColumns*sizeof(char));
    1055     memcpy(temp,integerType_,
    1056            CoinMin(newNumberColumns,numberColumns_)*sizeof(char));
     1049    CoinZeroN(temp,newNumberColumns);
     1050    CoinMemcpyN(integerType_,
     1051           CoinMin(newNumberColumns,numberColumns_),temp);
    10571052    delete [] integerType_;
    10581053    integerType_ = temp;
     
    10621057  if (lengthNames_) {
    10631058    // reduce row and column names vectors only if necessary
    1064     if (rowNames_.size() < (unsigned int)numberRows_)
     1059    if (rowNames_.size() < (unsigned int)numberRows_) {
     1060      int oldSize = rowNames_.size();
    10651061      rowNames_.resize(numberRows_);
    1066     if (columnNames_.size() < (unsigned int)numberColumns_)
     1062      lengthNames_ = CoinMax(lengthNames_,8);
     1063      char name[9];
     1064      for (int iRow = oldSize;iRow<numberRows_;iRow++) {
     1065        sprintf(name,"R%7.7d",iRow);
     1066        rowNames_[iRow]=name;
     1067      }
     1068    }
     1069    if (columnNames_.size() < (unsigned int)numberColumns_) {
     1070      int oldSize = columnNames_.size();
    10671071      columnNames_.resize(numberColumns_);
     1072      lengthNames_ = CoinMax(lengthNames_,8);
     1073      char name[9];
     1074      for (int iColumn = oldSize;iColumn<numberColumns_;iColumn++) {
     1075        sprintf(name,"C%7.7d",iColumn);
     1076        columnNames_[iColumn]=name;
     1077      }
     1078    }
    10681079  }
    10691080#endif
     
    11121123  if (lengthNames_) {
    11131124    char * mark = new char [numberRows_];
    1114     memset(mark,0,numberRows_);
     1125    CoinZeroN(mark,numberRows_);
    11151126    int i;
    11161127    for (i=0;i<number;i++)
     
    11931204  if (lengthNames_) {
    11941205    char * mark = new char [numberColumns_];
    1195     memset(mark,0,numberColumns_);
     1206    CoinZeroN(mark,numberColumns_);
    11961207    int i;
    11971208    for (i=0;i<number;i++)
     
    13051316      int iStart = rowStarts[iRow];
    13061317      int length = rowLengths[iRow];
    1307       memcpy(newIndex+numberElements,columns+iStart,length*sizeof(int));
    1308       memcpy(newElements+numberElements,elements+iStart,length*sizeof(double));
     1318      CoinMemcpyN(columns+iStart,length,newIndex+numberElements);
     1319      CoinMemcpyN(elements+iStart,length,newElements+numberElements);
    13091320      numberElements += length;
    13101321      newStarts[iRow+1]=numberElements;
     
    14401451      if (checkDuplicates) {
    14411452        which = new char[numberColumns_];
    1442         memset(which,0,numberColumns_);
     1453        CoinZeroN(which,numberColumns_);
    14431454      }
    14441455      // build +-1 matrix
     
    14481459      CoinBigIndex * startNegative = new CoinBigIndex [numberColumns_];
    14491460      int * indices = new int [size];
    1450       memset(startPositive,0,numberColumns_*sizeof(int));
    1451       memset(startNegative,0,numberColumns_*sizeof(int));
     1461      CoinZeroN(startPositive,numberColumns_);
     1462      CoinZeroN(startNegative,numberColumns_);
    14521463      int maxColumn=-1;
    14531464      // need two passes
     
    17871798      int iStart = columnStarts[iColumn];
    17881799      int length = columnLengths[iColumn];
    1789       memcpy(newIndex+numberElements,rows+iStart,length*sizeof(int));
    1790       memcpy(newElements+numberElements,elements+iStart,length*sizeof(double));
     1800      CoinMemcpyN(rows+iStart,length,newIndex+numberElements);
     1801      CoinMemcpyN(elements+iStart,length,newElements+numberElements);
    17911802      numberElements += length;
    17921803      newStarts[iColumn+1]=numberElements;
     
    19381949      if (checkDuplicates) {
    19391950        which = new char[numberRows_];
    1940         memset(which,0,numberRows_);
     1951        CoinZeroN(which,numberRows_);
    19411952      }
    19421953      // build +-1 matrix
     
    19801991        std::sort(neg,neg+nNeg);
    19811992        startNegative[iColumn]=size;
    1982         memcpy(indices+size,neg,nNeg*sizeof(int));
     1993        CoinMemcpyN(neg,nNeg,indices+size);
    19831994        size += nNeg;
    19841995        startPositive[iColumn+1]=size;
     
    23442355    if (m.integerColumns()) {
    23452356      integerType_ = new char[numberColumns_];
    2346       memcpy(integerType_,m.integerColumns(),numberColumns_*sizeof(char));
     2357      CoinMemcpyN(m.integerColumns(),numberColumns_,integerType_);
    23472358    } else {
    23482359      integerType_ = NULL;
     
    24422453    if (m.integerColumns()) {
    24432454      integerType_ = new char[numberColumns_];
    2444       memcpy(integerType_,m.integerColumns(),numberColumns_*sizeof(char));
     2455      CoinMemcpyN(m.integerColumns(),numberColumns_,integerType_);
    24452456    } else {
    24462457      integerType_ = NULL;
     
    25342545  if (information) {
    25352546    integerType_ = new char[numberColumns_];
    2536     memcpy(integerType_,information,numberColumns_*sizeof(char));
     2547    CoinMemcpyN(information,numberColumns_,integerType_);
    25372548  } else {
    25382549    integerType_ = NULL;
     
    25582569  if (!integerType_) {
    25592570    integerType_ = new char[numberColumns_];
    2560     CoinFillN ( integerType_, numberColumns_,(char) 0);
     2571    CoinZeroN ( integerType_, numberColumns_);
    25612572  }
    25622573#ifndef NDEBUG
     
    28212832  unsigned char * columnStatus = whichUnsignedChar(rhs->status_,
    28222833                                                numberColumns_,whichColumn);
    2823   memcpy(status_+numberColumns_,rowStatus,numberRows_);
     2834  CoinMemcpyN(rowStatus,numberRows_,status_+numberColumns_);
    28242835  delete [] rowStatus;
    2825   memcpy(status_,columnStatus,numberColumns_);
     2836  CoinMemcpyN(columnStatus,numberColumns_,status_);
    28262837  delete [] columnStatus;
    28272838  ray_ = NULL;
     
    30353046    if (!status_) {
    30363047      status_ = new unsigned char[numberRows_+numberColumns_];
    3037       memset(status_,0,numberRows_+numberColumns_);
     3048      CoinZeroN(status_,numberRows_+numberColumns_);
    30383049    }
    30393050  }
     
    31623173  // Get multiplier for objective function - default 1.0
    31633174  double * objective = new double[numberColumns_];
    3164   memcpy(objective,getObjCoefficients(),numberColumns_*sizeof(double));
     3175  CoinMemcpyN(getObjCoefficients(),numberColumns_,objective);
    31653176  if (objSense*getObjSense()<0.0) {
    31663177    for (int i = 0; i < numberColumns_; ++i)
Note: See TracChangeset for help on using the changeset viewer.