Ignore:
Timestamp:
Oct 9, 2002 3:32:58 PM (18 years ago)
Author:
forrest
Message:

Allow Presolve to work with gaps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-1/PresolveMatrix.cpp

    r33 r34  
    265265                                             int nrows_in,
    266266                                             int nelems_in) :
    267   originalModel_(&si),
    268267  ncols_(si.getNumCols()),
    269268  ncols0_(ncols_in),
     
    441440  // Do the copy here to try to avoid running out of memory.
    442441
    443   if (! isGapFree(*m)) {
    444     PresolveAction::throwCoinError("getMatrixByCol not gap free",
    445                                       "PrePostsolveMatrix");
    446   }
    447 
    448   CoinDisjointCopyN<int>(m->getVectorStarts(), ncols_, mcstrt_);
    449   mcstrt_[ncols_] = nelems_;
     442  const int * start = m->getVectorStarts();
     443  const int * length = m->getVectorLengths();
     444  const int * row = m->getIndices();
     445  const double * element = m->getElements();
     446  int icol,nel=0;
     447  mcstrt_[0]=0;
     448  for (icol=0;icol<ncols_;icol++) {
     449    int j;
     450    for (j=start[icol];j<start[icol]+length[icol];j++) {
     451      hrow_[nel]=row[j];
     452      colels_[nel++]=element[j];
     453    }
     454    mcstrt_[icol+1]=nel;
     455  }
     456  assert(mcstrt_[ncols_] == nelems_);
    450457  CoinDisjointCopyN(m->getVectorLengths(),ncols_,  hincol_);
    451   CoinDisjointCopyN(m->getIndices(),      nelems_, hrow_);
    452   CoinDisjointCopyN(m->getElements(),     nelems_, colels_);
    453458
    454459  // same thing for row rep
     
    495500
    496501#if 0
    497   for (int i=0; i<nrows; ++i)
     502  for (i=0; i<nrows; ++i)
    498503    printf("NR: %6d\n", hinrow[i]);
    499504  for (int i=0; i<ncols; ++i)
Note: See TracChangeset for help on using the changeset viewer.