Changeset 3031


Ignore:
Timestamp:
May 3, 2020 5:02:37 PM (2 months ago)
Author:
unxusr
Message:

C: interface - if querying contents of rows or columns flush first

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Cbc_C_Interface.cpp

    r3030 r3031  
    20702070{
    20712071  VALIDATE_ROW_INDEX( row, model);
    2072 
    2073   if (row<model->solver_->getNumRows()) {
    2074     const CoinPackedMatrix *cpmRow = model->solver_->getMatrixByRow();
    2075     return cpmRow->getVectorLengths()[row];
    2076   } else {
    2077     int idxRowBuffer = row - model->solver_->getNumRows();
    2078     return model->rStart[idxRowBuffer+1]-model->rStart[idxRowBuffer];
    2079   }
     2072  Cbc_flush(model);
     2073
     2074  const CoinPackedMatrix *cpmRow = model->solver_->getMatrixByRow();
     2075  return cpmRow->getVectorLengths()[row];
    20802076}
    20812077
     
    20852081{
    20862082  VALIDATE_ROW_INDEX( row, model);
    2087 
    2088   if (row<model->solver_->getNumRows()) {
    2089     const CoinPackedMatrix *cpmRow = model->solver_->getMatrixByRow();
    2090     const CoinBigIndex *starts = cpmRow->getVectorStarts();
    2091     const int *ridx = cpmRow->getIndices() + starts[row];
    2092     return ridx;
    2093   } else {
    2094     int idxRowBuffer = row - model->solver_->getNumRows();
    2095     return model->rIdx + model->rStart[idxRowBuffer];
    2096   }
     2083  Cbc_flush(model);
     2084
     2085  const CoinPackedMatrix *cpmRow = model->solver_->getMatrixByRow();
     2086  const CoinBigIndex *starts = cpmRow->getVectorStarts();
     2087  const int *ridx = cpmRow->getIndices() + starts[row];
     2088  return ridx;
    20972089}
    20982090
     
    21022094{
    21032095  VALIDATE_ROW_INDEX( row, model);
    2104 
    2105   if (row<model->solver_->getNumRows()) {
    2106     const CoinPackedMatrix *cpmRow = model->solver_->getMatrixByRow();
    2107     const CoinBigIndex *starts = cpmRow->getVectorStarts();
    2108     const double *rcoef = cpmRow->getElements() + starts[row];
    2109     return rcoef;
    2110   } else {
    2111     int idxRowBuffer = row - model->solver_->getNumRows();
    2112     return model->rCoef + model->rStart[idxRowBuffer];
    2113   }
     2096  Cbc_flush(model);
     2097
     2098  const CoinPackedMatrix *cpmRow = model->solver_->getMatrixByRow();
     2099  const CoinBigIndex *starts = cpmRow->getVectorStarts();
     2100  const double *rcoef = cpmRow->getElements() + starts[row];
     2101  return rcoef;
    21142102}
    21152103
     
    21192107{
    21202108  VALIDATE_COL_INDEX( col, model );
    2121 
    2122   if (col < model->solver_->getNumCols()) {
    2123     const CoinPackedMatrix *cpmCol = model->solver_->getMatrixByCol();
    2124     return cpmCol->getVectorLengths()[col];
    2125   } else {
    2126     int ncidx = model->nCols - model->solver_->getNumCols();
    2127     return model->cStart[ncidx+1] - model->cStart[ncidx];
    2128   }
     2109  Cbc_flush(model);
     2110
     2111  const CoinPackedMatrix *cpmCol = model->solver_->getMatrixByCol();
     2112  return cpmCol->getVectorLengths()[col];
    21292113}
    21302114
     
    21342118{
    21352119  VALIDATE_COL_INDEX( col, model );
    2136 
    2137   if (col<model->solver_->getNumCols()) {
    2138     const CoinPackedMatrix *cpmCol = model->solver_->getMatrixByCol();
    2139     const CoinBigIndex *starts = cpmCol->getVectorStarts();
    2140     const int *cidx = cpmCol->getIndices() + starts[col];
    2141     return cidx;
    2142   } else {
    2143     int idxColBuffer = col - model->solver_->getNumCols();
    2144     return model->cIdx + model->cStart[idxColBuffer];
    2145   }
     2120  Cbc_flush(model);
     2121
     2122  const CoinPackedMatrix *cpmCol = model->solver_->getMatrixByCol();
     2123  const CoinBigIndex *starts = cpmCol->getVectorStarts();
     2124  const int *cidx = cpmCol->getIndices() + starts[col];
     2125  return cidx;
    21462126}
    21472127
     
    21512131{
    21522132  VALIDATE_COL_INDEX( col, model );
    2153 
    2154   if (col<model->solver_->getNumCols()) {
    2155     const CoinPackedMatrix *cpmCol = model->solver_->getMatrixByCol();
    2156     const CoinBigIndex *starts = cpmCol->getVectorStarts();
    2157     const double *ccoef = cpmCol->getElements() + starts[col];
    2158     return ccoef;
    2159   } else {
    2160     int idxColBuffer = col - model->solver_->getNumCols();
    2161     return model->cCoef + model->cStart[idxColBuffer];
    2162   }
     2133  Cbc_flush(model);
     2134
     2135  const CoinPackedMatrix *cpmCol = model->solver_->getMatrixByCol();
     2136  const CoinBigIndex *starts = cpmCol->getVectorStarts();
     2137  const double *ccoef = cpmCol->getElements() + starts[col];
     2138  return ccoef;
    21632139}
    21642140
Note: See TracChangeset for help on using the changeset viewer.