Ignore:
Timestamp:
Jan 6, 2019 2:43:06 PM (4 months ago)
Author:
unxusr
Message:

formatting

File:
1 edited

Legend:

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

    r1910 r2385  
    1414#include "CoinHelperFunctions.hpp"
    1515#include "CoinAbcHelperFunctions.hpp"
    16 #if ABC_NORMAL_DEBUG>0
     16#if ABC_NORMAL_DEBUG > 0
    1717// for conflicts
    1818extern int cilk_conflict;
     
    2222//#define INLINE_IT2
    2323inline void scatterUpdateInline(CoinSimplexInt number,
    24                           CoinFactorizationDouble pivotValue,
    25                           const CoinFactorizationDouble *  COIN_RESTRICT thisElement,
    26                           const CoinSimplexInt *  COIN_RESTRICT thisIndex,
    27                           CoinFactorizationDouble *  COIN_RESTRICT region)
    28 {
    29 #if UNROLL==0
    30   for (CoinBigIndex j=number-1 ; j >=0; j-- ) {
     24  CoinFactorizationDouble pivotValue,
     25  const CoinFactorizationDouble *COIN_RESTRICT thisElement,
     26  const CoinSimplexInt *COIN_RESTRICT thisIndex,
     27  CoinFactorizationDouble *COIN_RESTRICT region)
     28{
     29#if UNROLL == 0
     30  for (CoinBigIndex j = number - 1; j >= 0; j--) {
    3131    CoinSimplexInt iRow = thisIndex[j];
    3232    CoinFactorizationDouble regionValue = region[iRow];
    3333    CoinFactorizationDouble value = thisElement[j];
    34     assert (value);
     34    assert(value);
    3535    region[iRow] = regionValue - value * pivotValue;
    3636  }
    37 #elif UNROLL==1
    38   if ((number&1)!=0) {
     37#elif UNROLL == 1
     38  if ((number & 1) != 0) {
    3939    number--;
    4040    CoinSimplexInt iRow = thisIndex[number];
     
    4343    region[iRow] = regionValue - value * pivotValue;
    4444  }
    45   for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) {
     45  for (CoinBigIndex j = number - 1; j >= 0; j -= 2) {
    4646    CoinSimplexInt iRow0 = thisIndex[j];
    47     CoinSimplexInt iRow1 = thisIndex[j-1];
     47    CoinSimplexInt iRow1 = thisIndex[j - 1];
    4848    CoinFactorizationDouble regionValue0 = region[iRow0];
    4949    CoinFactorizationDouble regionValue1 = region[iRow1];
    5050    region[iRow0] = regionValue0 - thisElement[j] * pivotValue;
    51     region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue;
    52   }
    53 #elif UNROLL==2
     51    region[iRow1] = regionValue1 - thisElement[j - 1] * pivotValue;
     52  }
     53#elif UNROLL == 2
    5454  CoinSimplexInt iRow0;
    5555  CoinSimplexInt iRow1;
    5656  CoinFactorizationDouble regionValue0;
    5757  CoinFactorizationDouble regionValue1;
    58   switch(static_cast<unsigned int>(number)) {
     58  switch (static_cast< unsigned int >(number)) {
    5959  case 0:
    6060    break;
     
    184184    break;
    185185  default:
    186     if ((number&1)!=0) {
     186    if ((number & 1) != 0) {
    187187      number--;
    188188      CoinSimplexInt iRow = thisIndex[number];
     
    191191      region[iRow] = regionValue - value * pivotValue;
    192192    }
    193     for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) {
     193    for (CoinBigIndex j = number - 1; j >= 0; j -= 2) {
    194194      CoinSimplexInt iRow0 = thisIndex[j];
    195       CoinSimplexInt iRow1 = thisIndex[j-1];
     195      CoinSimplexInt iRow1 = thisIndex[j - 1];
    196196      CoinFactorizationDouble regionValue0 = region[iRow0];
    197197      CoinFactorizationDouble regionValue1 = region[iRow1];
    198198      region[iRow0] = regionValue0 - thisElement[j] * pivotValue;
    199       region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue;
     199      region[iRow1] = regionValue1 - thisElement[j - 1] * pivotValue;
    200200    }
    201201    break;
     
    204204}
    205205inline CoinFactorizationDouble gatherUpdate(CoinSimplexInt number,
    206                           const CoinFactorizationDouble *  COIN_RESTRICT thisElement,
    207                           const CoinSimplexInt *  COIN_RESTRICT thisIndex,
    208                           CoinFactorizationDouble *  COIN_RESTRICT region)
    209 {
    210   CoinFactorizationDouble pivotValue=0.0;
    211   for (CoinBigIndex j = 0; j < number; j ++ ) {
     206  const CoinFactorizationDouble *COIN_RESTRICT thisElement,
     207  const CoinSimplexInt *COIN_RESTRICT thisIndex,
     208  CoinFactorizationDouble *COIN_RESTRICT region)
     209{
     210  CoinFactorizationDouble pivotValue = 0.0;
     211  for (CoinBigIndex j = 0; j < number; j++) {
    212212    CoinFactorizationDouble value = thisElement[j];
    213213    CoinSimplexInt jRow = thisIndex[j];
     
    219219#undef INLINE_IT
    220220//  updateColumnR.  Updates part of column (FTRANR)
    221 void
    222 CoinAbcTypeFactorization::updateColumnR ( CoinIndexedVector * regionSparse
    223 #if ABC_SMALL<2
    224                                       , CoinAbcStatistics & statistics
     221void CoinAbcTypeFactorization::updateColumnR(CoinIndexedVector *regionSparse
     222#if ABC_SMALL < 2
     223  ,
     224  CoinAbcStatistics &statistics
    225225#endif
    226226#if ABC_PARALLEL
    227                                           ,int whichSparse
    228 #endif
    229                                       ) const
     227  ,
     228  int whichSparse
     229#endif
     230  ) const
    230231{
    231232
    232   if ( numberR_ ) {
    233     CoinSimplexDouble * COIN_RESTRICT region = regionSparse->denseVector (  );
    234 #if ABC_SMALL<3
    235     CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices (  );
    236     CoinSimplexInt numberNonZero = regionSparse->getNumElements (  );
    237 #endif
    238    
    239     const CoinBigIndex *  COIN_RESTRICT startColumn = startColumnRAddress_-numberRows_;
    240     const CoinSimplexInt *  COIN_RESTRICT indexRow = indexRowRAddress_;
    241     CoinSimplexInt * COIN_RESTRICT indexRowR2 = indexRowRAddress_+lengthAreaR_;
    242     if (gotRCopy()) 
     233  if (numberR_) {
     234    CoinSimplexDouble *COIN_RESTRICT region = regionSparse->denseVector();
     235#if ABC_SMALL < 3
     236    CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     237    CoinSimplexInt numberNonZero = regionSparse->getNumElements();
     238#endif
     239
     240    const CoinBigIndex *COIN_RESTRICT startColumn = startColumnRAddress_ - numberRows_;
     241    const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowRAddress_;
     242    CoinSimplexInt *COIN_RESTRICT indexRowR2 = indexRowRAddress_ + lengthAreaR_;
     243    if (gotRCopy())
    243244      indexRowR2 += lengthAreaR_;
    244     const CoinFactorizationDouble *  COIN_RESTRICT element = elementRAddress_;
    245     const CoinSimplexInt *  COIN_RESTRICT permute = permuteAddress_;
    246     instrument_do("CoinAbcFactorizationUpdateR",sizeR);
    247 #if ABC_SMALL<2
     245    const CoinFactorizationDouble *COIN_RESTRICT element = elementRAddress_;
     246    const CoinSimplexInt *COIN_RESTRICT permute = permuteAddress_;
     247    instrument_do("CoinAbcFactorizationUpdateR", sizeR);
     248#if ABC_SMALL < 2
    248249    // Size of R
    249     CoinSimplexDouble sizeR=startColumnRAddress_[numberR_];
     250    CoinSimplexDouble sizeR = startColumnRAddress_[numberR_];
    250251    // Work out very dubious idea of what would be fastest
    251252    // Average
    252     CoinSimplexDouble averageR = sizeR/(static_cast<CoinSimplexDouble> (numberRowsExtra_));
     253    CoinSimplexDouble averageR = sizeR / (static_cast< CoinSimplexDouble >(numberRowsExtra_));
    253254    // weights (relative to actual work)
    254255    CoinSimplexDouble setMark = 0.1; // setting mark
    255     CoinSimplexDouble test1= 1.0; // starting ftran (without testPivot)
     256    CoinSimplexDouble test1 = 1.0; // starting ftran (without testPivot)
    256257    CoinSimplexDouble testPivot = 2.0; // Seeing if zero etc
    257     CoinSimplexDouble startDot=2.0; // For starting dot product version
     258    CoinSimplexDouble startDot = 2.0; // For starting dot product version
    258259    // For final scan
    259     CoinSimplexDouble final = numberNonZero*1.0;
     260    CoinSimplexDouble final = numberNonZero * 1.0;
    260261    CoinSimplexDouble methodTime0;
    261262    // For first type
    262     methodTime0 = numberPivots_ * (testPivot + ((static_cast<double> (numberNonZero))/(static_cast<double> (numberRows_))
    263                                                 * averageR));
    264     methodTime0 += numberNonZero *(test1 + averageR);
    265     methodTime0 += (numberNonZero+numberPivots_)*setMark;
     263    methodTime0 = numberPivots_ * (testPivot + ((static_cast< double >(numberNonZero)) / (static_cast< double >(numberRows_)) * averageR));
     264    methodTime0 += numberNonZero * (test1 + averageR);
     265    methodTime0 += (numberNonZero + numberPivots_) * setMark;
    266266    // third
    267     CoinSimplexDouble methodTime2 = sizeR + numberPivots_*startDot + numberNonZero*final;
     267    CoinSimplexDouble methodTime2 = sizeR + numberPivots_ * startDot + numberNonZero * final;
    268268    // switch off if necessary
    269     CoinSimplexInt method=0;
    270     if (!gotRCopy()||!gotSparse()||methodTime2<methodTime0) {
    271       method=2;
    272     } 
     269    CoinSimplexInt method = 0;
     270    if (!gotRCopy() || !gotSparse() || methodTime2 < methodTime0) {
     271      method = 2;
     272    }
    273273    /*
    274274       IF we have row copy of R then always store in old way -
     
    276276    */
    277277#endif
    278 #if ABC_SMALL<2
    279     const CoinSimplexInt * numberInColumnPlus = numberInColumnPlusAddress_;
    280 #endif
    281     const CoinSimplexInt * pivotRowBack = pivotColumnAddress_;
    282 #if ABC_SMALL<2
     278#if ABC_SMALL < 2
     279    const CoinSimplexInt *numberInColumnPlus = numberInColumnPlusAddress_;
     280#endif
     281    const CoinSimplexInt *pivotRowBack = pivotColumnAddress_;
     282#if ABC_SMALL < 2
    283283    switch (method) {
    284     case 0:
    285       {
    286         instrument_start("CoinAbcFactorizationUpdateRSparse1",numberRows_);
    287         // mark known to be zero
    288         CoinCheckZero * COIN_RESTRICT mark = markRowAddress_;
     284    case 0: {
     285      instrument_start("CoinAbcFactorizationUpdateRSparse1", numberRows_);
     286      // mark known to be zero
     287      CoinCheckZero *COIN_RESTRICT mark = markRowAddress_;
    289288#if ABC_PARALLEL
    290         if (whichSparse) {
    291           mark=reinterpret_cast<CoinCheckZero *>(reinterpret_cast<char *>(mark)+whichSparse*sizeSparseArray_);
    292         }
    293 #endif
    294         // mark all rows which will be permuted
    295         for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) {
    296           CoinSimplexInt iRow = permute[i];
    297           mark[iRow]=1;
    298         }
    299         // we have another copy of R in R
    300         const CoinFactorizationDouble *  COIN_RESTRICT elementR = elementRAddress_ + lengthAreaR_;
    301         const CoinSimplexInt *  COIN_RESTRICT indexRowR = indexRowRAddress_ + lengthAreaR_;
    302         const CoinBigIndex *  COIN_RESTRICT startR = startColumnRAddress_+maximumPivots_+1;
    303         // For current list order does not matter as
    304         // only affects end
    305         CoinSimplexInt newNumber=0;
    306         for (CoinSimplexInt i = 0; i < numberNonZero; i++ ) {
    307           CoinSimplexInt iRow = regionIndex[i];
    308           CoinFactorizationDouble pivotValue = region[iRow];
    309           assert (region[iRow]);
    310           if (!mark[iRow]) {
    311             regionIndex[newNumber++]=iRow;
    312           }
    313           CoinSimplexInt kRow=permute[iRow];
    314           CoinSimplexInt number = numberInColumnPlus[kRow];
    315           instrument_add(number);
    316           if (TEST_INT_NONZERO(number)) {
    317             CoinBigIndex start=startR[kRow];
     289      if (whichSparse) {
     290        mark = reinterpret_cast< CoinCheckZero * >(reinterpret_cast< char * >(mark) + whichSparse * sizeSparseArray_);
     291      }
     292#endif
     293      // mark all rows which will be permuted
     294      for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++) {
     295        CoinSimplexInt iRow = permute[i];
     296        mark[iRow] = 1;
     297      }
     298      // we have another copy of R in R
     299      const CoinFactorizationDouble *COIN_RESTRICT elementR = elementRAddress_ + lengthAreaR_;
     300      const CoinSimplexInt *COIN_RESTRICT indexRowR = indexRowRAddress_ + lengthAreaR_;
     301      const CoinBigIndex *COIN_RESTRICT startR = startColumnRAddress_ + maximumPivots_ + 1;
     302      // For current list order does not matter as
     303      // only affects end
     304      CoinSimplexInt newNumber = 0;
     305      for (CoinSimplexInt i = 0; i < numberNonZero; i++) {
     306        CoinSimplexInt iRow = regionIndex[i];
     307        CoinFactorizationDouble pivotValue = region[iRow];
     308        assert(region[iRow]);
     309        if (!mark[iRow]) {
     310          regionIndex[newNumber++] = iRow;
     311        }
     312        CoinSimplexInt kRow = permute[iRow];
     313        CoinSimplexInt number = numberInColumnPlus[kRow];
     314        instrument_add(number);
     315        if (TEST_INT_NONZERO(number)) {
     316          CoinBigIndex start = startR[kRow];
    318317#ifndef INLINE_IT
    319             CoinBigIndex end = start+number;
    320             for (CoinBigIndex j = start; j < end; j ++ ) {
    321               CoinFactorizationDouble value = elementR[j];
    322               CoinSimplexInt jRow = indexRowR[j];
    323               region[jRow] -= pivotValue*value;
    324             }
     318          CoinBigIndex end = start + number;
     319          for (CoinBigIndex j = start; j < end; j++) {
     320            CoinFactorizationDouble value = elementR[j];
     321            CoinSimplexInt jRow = indexRowR[j];
     322            region[jRow] -= pivotValue * value;
     323          }
    325324#else
    326             CoinAbcScatterUpdate(number,pivotValue,elementR+start,indexRowR+start,region);
    327 #endif
    328           }
    329         }
    330         instrument_start("CoinAbcFactorizationUpdateRSparse2",numberRows_);
    331         numberNonZero = newNumber;
    332         for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) {
    333           //move using permute_ (stored in inverse fashion)
    334           CoinSimplexInt iRow = permute[i];
    335           CoinFactorizationDouble pivotValue = region[iRow]+region[i];
    336           //zero out pre-permuted
    337           region[iRow] = 0.0;
    338           region[i]=0.0;
    339           if ( !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue )  ) {
    340             int jRow=pivotRowBack[i];
    341             assert (!region[jRow]);
    342             region[jRow]=pivotValue;
    343             CoinSimplexInt number = numberInColumnPlus[i];
    344             instrument_add(number);
    345             if (TEST_INT_NONZERO(number)) {
    346               CoinBigIndex start=startR[i];
     325          CoinAbcScatterUpdate(number, pivotValue, elementR + start, indexRowR + start, region);
     326#endif
     327        }
     328      }
     329      instrument_start("CoinAbcFactorizationUpdateRSparse2", numberRows_);
     330      numberNonZero = newNumber;
     331      for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++) {
     332        //move using permute_ (stored in inverse fashion)
     333        CoinSimplexInt iRow = permute[i];
     334        CoinFactorizationDouble pivotValue = region[iRow] + region[i];
     335        //zero out pre-permuted
     336        region[iRow] = 0.0;
     337        region[i] = 0.0;
     338        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue)) {
     339          int jRow = pivotRowBack[i];
     340          assert(!region[jRow]);
     341          region[jRow] = pivotValue;
     342          CoinSimplexInt number = numberInColumnPlus[i];
     343          instrument_add(number);
     344          if (TEST_INT_NONZERO(number)) {
     345            CoinBigIndex start = startR[i];
    347346#ifndef INLINE_IT
    348               CoinBigIndex end = start+number;
    349               for (CoinBigIndex j = start; j < end; j ++ ) {
    350                 CoinFactorizationDouble value = elementR[j];
    351                 CoinSimplexInt jRow = indexRowR[j];
    352                 region[jRow] -= pivotValue*value;
    353               }
     347            CoinBigIndex end = start + number;
     348            for (CoinBigIndex j = start; j < end; j++) {
     349              CoinFactorizationDouble value = elementR[j];
     350              CoinSimplexInt jRow = indexRowR[j];
     351              region[jRow] -= pivotValue * value;
     352            }
    354353#else
    355               CoinAbcScatterUpdate(number,pivotValue,elementR+start,indexRowR+start,region);
    356 #endif
    357             }
    358           }
    359         }
    360         instrument_end();
    361         for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) {
    362           CoinSimplexInt iRow = permute[i];
    363           assert (iRow<numberRows_);
    364           if (mark[iRow]) {
    365             mark[iRow]=0;
    366             CoinExponent expValue=ABC_EXPONENT(region[iRow]);
    367             if (expValue) {
    368               if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    369                 regionIndex[numberNonZero++]=iRow;
    370               } else {
    371                 region[iRow]=0.0;
    372               }
    373             }
    374           }
    375         }
    376       }
    377       break;
     354            CoinAbcScatterUpdate(number, pivotValue, elementR + start, indexRowR + start, region);
     355#endif
     356          }
     357        }
     358      }
     359      instrument_end();
     360      for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++) {
     361        CoinSimplexInt iRow = permute[i];
     362        assert(iRow < numberRows_);
     363        if (mark[iRow]) {
     364          mark[iRow] = 0;
     365          CoinExponent expValue = ABC_EXPONENT(region[iRow]);
     366          if (expValue) {
     367            if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
     368              regionIndex[numberNonZero++] = iRow;
     369            } else {
     370              region[iRow] = 0.0;
     371            }
     372          }
     373        }
     374      }
     375    } break;
    378376    case 2:
    379377#endif
    380       {
    381         instrument_start("CoinAbcFactorizationUpdateRDense",numberRows_);
    382         CoinBigIndex start = startColumn[numberRows_];
    383         for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++ ) {
    384           //move using permute_ (stored in inverse fashion)
    385           CoinBigIndex end = startColumn[i+1];
    386           CoinSimplexInt iRow = pivotRowBack[i];
    387           assert (iRow<numberRows_);
    388           CoinFactorizationDouble pivotValue = region[iRow];
    389           instrument_add(end-start);
    390           if (TEST_INT_NONZERO(end-start)) {
     378    {
     379      instrument_start("CoinAbcFactorizationUpdateRDense", numberRows_);
     380      CoinBigIndex start = startColumn[numberRows_];
     381      for (CoinSimplexInt i = numberRows_; i < numberRowsExtra_; i++) {
     382        //move using permute_ (stored in inverse fashion)
     383        CoinBigIndex end = startColumn[i + 1];
     384        CoinSimplexInt iRow = pivotRowBack[i];
     385        assert(iRow < numberRows_);
     386        CoinFactorizationDouble pivotValue = region[iRow];
     387        instrument_add(end - start);
     388        if (TEST_INT_NONZERO(end - start)) {
    391389#ifndef INLINE_IT2
    392             for (CoinBigIndex j = start; j < end; j ++ ) {
    393               CoinFactorizationDouble value = element[j];
    394               CoinSimplexInt jRow = indexRow[j];
    395               value *= region[jRow];
    396               pivotValue -= value;
    397             }
     390          for (CoinBigIndex j = start; j < end; j++) {
     391            CoinFactorizationDouble value = element[j];
     392            CoinSimplexInt jRow = indexRow[j];
     393            value *= region[jRow];
     394            pivotValue -= value;
     395          }
    398396#else
    399             pivotValue+=CoinAbcGatherUpdate(end-start,element+start,indexRow+start,region);
    400 #endif
    401             start=end;
    402           }
    403 #if ABC_SMALL<3
    404           if ( !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue ) ) {
    405             if (!region[iRow])
    406               regionIndex[numberNonZero++] = iRow;
    407             region[iRow] = pivotValue;
    408           } else {
    409             if (region[iRow])
    410               region[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT;
    411           }
     397          pivotValue += CoinAbcGatherUpdate(end - start, element + start, indexRow + start, region);
     398#endif
     399          start = end;
     400        }
     401#if ABC_SMALL < 3
     402        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue)) {
     403          if (!region[iRow])
     404            regionIndex[numberNonZero++] = iRow;
     405          region[iRow] = pivotValue;
     406        } else {
     407          if (region[iRow])
     408            region[iRow] = COIN_INDEXED_REALLY_TINY_ELEMENT;
     409        }
    412410#else
    413             region[iRow] = pivotValue;
    414 #endif
    415         }
    416         instrument_end();
    417 #if ABC_SMALL<3
    418         // pack down
    419         CoinSimplexInt n=numberNonZero;
    420         numberNonZero=0;
    421         for (CoinSimplexInt i=0;i<n;i++) {
    422           CoinSimplexInt indexValue = regionIndex[i];
    423           CoinExponent expValue=ABC_EXPONENT(region[indexValue]);
    424           if (expValue) {
    425             if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    426               regionIndex[numberNonZero++]=indexValue; // needed? is region used
    427             } else {
    428               region[indexValue]=0.0;
    429             }
    430           }
    431         }
    432 #endif
    433       }
    434 #if ABC_SMALL<2
    435       break;
    436     }
    437 #endif
    438 #if ABC_SMALL<3
     411        region[iRow] = pivotValue;
     412#endif
     413      }
     414      instrument_end();
     415#if ABC_SMALL < 3
     416      // pack down
     417      CoinSimplexInt n = numberNonZero;
     418      numberNonZero = 0;
     419      for (CoinSimplexInt i = 0; i < n; i++) {
     420        CoinSimplexInt indexValue = regionIndex[i];
     421        CoinExponent expValue = ABC_EXPONENT(region[indexValue]);
     422        if (expValue) {
     423          if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
     424            regionIndex[numberNonZero++] = indexValue; // needed? is region used
     425          } else {
     426            region[indexValue] = 0.0;
     427          }
     428        }
     429      }
     430#endif
     431    }
     432#if ABC_SMALL < 2
     433    break;
     434    }
     435#endif
     436#if ABC_SMALL < 3
    439437    //set counts
    440     regionSparse->setNumElements ( numberNonZero );
    441 #endif
    442   }
    443 #if ABC_SMALL<2
    444   if (factorizationStatistics()) 
     438    regionSparse->setNumElements(numberNonZero);
     439#endif
     440  }
     441#if ABC_SMALL < 2
     442  if (factorizationStatistics())
    445443    statistics.countAfterR_ += regionSparse->getNumElements();
    446444#endif
     
    450448#include "AbcMatrix.hpp"
    451449// Returns -2 if can't, -1 if singular, -99 memory, 0 OK
    452 int
    453 CoinAbcTypeFactorization::factorize (AbcSimplex * model, CoinIndexedVector & stuff)
    454 {
    455   AbcMatrix * matrix = model->abcMatrix();
     450int CoinAbcTypeFactorization::factorize(AbcSimplex *model, CoinIndexedVector &stuff)
     451{
     452  AbcMatrix *matrix = model->abcMatrix();
    456453  setStatus(-99);
    457   int * COIN_RESTRICT pivotTemp = stuff.getIndices();
     454  int *COIN_RESTRICT pivotTemp = stuff.getIndices();
    458455  int numberColumnBasic = stuff.getNumElements();
    459456  // compute how much in basis
    460457  int numberSlacks = numberRows_ - numberColumnBasic;
    461  
    462   CoinBigIndex numberElements = numberSlacks+matrix->countBasis(pivotTemp + numberSlacks,
    463                                          numberColumnBasic);
     458
     459  CoinBigIndex numberElements = numberSlacks + matrix->countBasis(pivotTemp + numberSlacks, numberColumnBasic);
    464460  // Not needed for dense
    465461  numberElements = 3 * numberRows_ + 3 * numberElements + 20000;
    466   getAreas ( numberRows_, numberSlacks + numberColumnBasic, numberElements,
    467              2 * numberElements );
    468   numberSlacks_=numberSlacks;
     462  getAreas(numberRows_, numberSlacks + numberColumnBasic, numberElements,
     463    2 * numberElements);
     464  numberSlacks_ = numberSlacks;
    469465  // Fill in counts so we can skip part of preProcess
    470466  // This is NOT needed for dense but would be needed for later versions
    471   CoinFactorizationDouble *  COIN_RESTRICT elementU;
    472   int *  COIN_RESTRICT indexRowU;
    473   CoinBigIndex *  COIN_RESTRICT startColumnU;
    474   int *  COIN_RESTRICT numberInRow;
    475   int *  COIN_RESTRICT numberInColumn;
     467  CoinFactorizationDouble *COIN_RESTRICT elementU;
     468  int *COIN_RESTRICT indexRowU;
     469  CoinBigIndex *COIN_RESTRICT startColumnU;
     470  int *COIN_RESTRICT numberInRow;
     471  int *COIN_RESTRICT numberInColumn;
    476472  elementU = this->elements();
    477473  indexRowU = this->indices();
     
    479475  numberInRow = this->numberInRow();
    480476  numberInColumn = this->numberInColumn();
    481   CoinZeroN ( numberInRow, numberRows_+1  );
    482   CoinZeroN ( numberInColumn, numberRows_ );
     477  CoinZeroN(numberInRow, numberRows_ + 1);
     478  CoinZeroN(numberInColumn, numberRows_);
    483479  for (int i = 0; i < numberSlacks_; i++) {
    484480    int iRow = pivotTemp[i];
     
    491487  startColumnU[numberSlacks_] = numberSlacks_;
    492488  matrix->fillBasis(pivotTemp + numberSlacks_,
    493                     numberColumnBasic,
    494                     indexRowU,
    495                     startColumnU + numberSlacks_,
    496                     numberInRow,
    497                     numberInColumn + numberSlacks_,
    498                     elementU);
    499   numberElements = startColumnU[numberRows_-1]
    500     + numberInColumn[numberRows_-1];
    501   preProcess ( );
    502   factor (model);
    503   if (status() == 0 ) {
     489    numberColumnBasic,
     490    indexRowU,
     491    startColumnU + numberSlacks_,
     492    numberInRow,
     493    numberInColumn + numberSlacks_,
     494    elementU);
     495  numberElements = startColumnU[numberRows_ - 1]
     496    + numberInColumn[numberRows_ - 1];
     497  preProcess();
     498  factor(model);
     499  if (status() == 0) {
    504500    // Put sequence numbers in workArea
    505     int * savePivots = reinterpret_cast<int *>(workAreaAddress_);
    506     CoinAbcMemcpy(savePivots,pivotTemp,numberRows_);
     501    int *savePivots = reinterpret_cast< int * >(workAreaAddress_);
     502    CoinAbcMemcpy(savePivots, pivotTemp, numberRows_);
    507503    postProcess(pivotTemp, savePivots);
    508504    return 0;
     
    512508}
    513509// 0 success, -1 can't +1 accuracy problems
    514 int
    515 CoinAbcTypeFactorization::replaceColumns ( const AbcSimplex * model,
    516                                            CoinIndexedVector & stuff,
    517                                            int firstPivot,int lastPivot,
    518                                            bool cleanUp)
     510int CoinAbcTypeFactorization::replaceColumns(const AbcSimplex *model,
     511  CoinIndexedVector &stuff,
     512  int firstPivot, int lastPivot,
     513  bool cleanUp)
    519514{
    520515  // Could skip some if goes in and out (only if easy as then no alpha check)
    521516  // Put sequence numbers in workArea
    522   int * savePivots = reinterpret_cast<int *>(workAreaAddress_);
    523   const int * pivotIndices = stuff.getIndices();
    524   CoinSimplexDouble * pivotValues = stuff.denseVector();
     517  int *savePivots = reinterpret_cast< int * >(workAreaAddress_);
     518  const int *pivotIndices = stuff.getIndices();
     519  CoinSimplexDouble *pivotValues = stuff.denseVector();
    525520  int savePivot = stuff.capacity();
    526521  savePivot--;
    527   savePivot -= 2*firstPivot;
    528   int numberDo=lastPivot-firstPivot;
     522  savePivot -= 2 * firstPivot;
     523  int numberDo = lastPivot - firstPivot;
    529524  // Say clear
    530525  stuff.setNumElements(0);
    531   bool badUpdates=false;
    532   for (int iPivot=0;iPivot<numberDo;iPivot++) {
     526  bool badUpdates = false;
     527  for (int iPivot = 0; iPivot < numberDo; iPivot++) {
    533528    int sequenceOut = pivotIndices[--savePivot];
    534     CoinSimplexDouble alpha=pivotValues[savePivot];
     529    CoinSimplexDouble alpha = pivotValues[savePivot];
    535530    int sequenceIn = pivotIndices[--savePivot];
    536     CoinSimplexDouble btranAlpha=pivotValues[savePivot];
     531    CoinSimplexDouble btranAlpha = pivotValues[savePivot];
    537532    int pivotRow;
    538     for (pivotRow=0;pivotRow<numberRows_;pivotRow++) {
    539       if (sequenceOut==savePivots[pivotRow])
    540         break;
    541     }
    542     assert (pivotRow<numberRows_);
    543     savePivots[pivotRow]=sequenceIn;
    544     model->unpack(stuff,sequenceIn);
     533    for (pivotRow = 0; pivotRow < numberRows_; pivotRow++) {
     534      if (sequenceOut == savePivots[pivotRow])
     535        break;
     536    }
     537    assert(pivotRow < numberRows_);
     538    savePivots[pivotRow] = sequenceIn;
     539    model->unpack(stuff, sequenceIn);
    545540    updateColumnFTPart1(stuff);
    546541    stuff.clear();
    547542    //checkReplacePart1a(&stuff,pivotRow);
    548     CoinSimplexDouble ftAlpha=checkReplacePart1(&stuff,pivotRow);
     543    CoinSimplexDouble ftAlpha = checkReplacePart1(&stuff, pivotRow);
    549544    // may need better check
    550     if (checkReplacePart2(pivotRow,btranAlpha,alpha,ftAlpha)>1) {
    551       badUpdates=true;
     545    if (checkReplacePart2(pivotRow, btranAlpha, alpha, ftAlpha) > 1) {
     546      badUpdates = true;
    552547      printf("Inaccuracy ? btranAlpha %g ftranAlpha %g ftAlpha %g\n",
    553              btranAlpha,alpha,ftAlpha);
     548        btranAlpha, alpha, ftAlpha);
    554549      break;
    555550    }
    556     replaceColumnPart3(model,&stuff,NULL,pivotRow,ftAlpha);
     551    replaceColumnPart3(model, &stuff, NULL, pivotRow, ftAlpha);
    557552  }
    558553  int flag;
    559554  if (!badUpdates) {
    560     flag=1;
     555    flag = 1;
    561556    if (cleanUp) {
    562       CoinAbcMemcpy(model->pivotVariable(),savePivots,numberRows_);
     557      CoinAbcMemcpy(model->pivotVariable(), savePivots, numberRows_);
    563558    }
    564559  } else {
    565     flag=-1;
     560    flag = -1;
    566561  }
    567562  stuff.setNumElements(flag);
    568   return flag >0 ? 0 : flag;
     563  return flag > 0 ? 0 : flag;
    569564}
    570565#endif
    571566#ifdef ABC_ORDERED_FACTORIZATION
    572567// Permute in for Ftran
    573 void
    574 CoinAbcTypeFactorization::permuteInForFtran(CoinIndexedVector & regionSparse,
    575                                             bool full) const
    576 {
    577   int numberNonZero=regionSparse.getNumElements();
    578   const int * COIN_RESTRICT permuteIn = permuteAddress_+maximumRowsExtra_+1;
    579   double * COIN_RESTRICT region = regionSparse.denseVector();
    580   double * COIN_RESTRICT tempRegion = region+numberRows_;
    581   int * COIN_RESTRICT index = regionSparse.getIndices();
    582   if ((numberNonZero<<1)>numberRows_||full) {
    583     CoinAbcMemcpy(tempRegion,region,numberRows_);
    584     CoinAbcMemset0(region,numberRows_);
    585     numberNonZero=0;
    586     for (int i=0;i<numberRows_;i++) {
    587       double value=tempRegion[i];
     568void CoinAbcTypeFactorization::permuteInForFtran(CoinIndexedVector &regionSparse,
     569  bool full) const
     570{
     571  int numberNonZero = regionSparse.getNumElements();
     572  const int *COIN_RESTRICT permuteIn = permuteAddress_ + maximumRowsExtra_ + 1;
     573  double *COIN_RESTRICT region = regionSparse.denseVector();
     574  double *COIN_RESTRICT tempRegion = region + numberRows_;
     575  int *COIN_RESTRICT index = regionSparse.getIndices();
     576  if ((numberNonZero << 1) > numberRows_ || full) {
     577    CoinAbcMemcpy(tempRegion, region, numberRows_);
     578    CoinAbcMemset0(region, numberRows_);
     579    numberNonZero = 0;
     580    for (int i = 0; i < numberRows_; i++) {
     581      double value = tempRegion[i];
    588582      if (value) {
    589         tempRegion[i]=0.0;
    590         int iRow=permuteIn[i];
    591         region[iRow]=value;
    592         index[numberNonZero++]=iRow;
     583        tempRegion[i] = 0.0;
     584        int iRow = permuteIn[i];
     585        region[iRow] = value;
     586        index[numberNonZero++] = iRow;
    593587      }
    594588    }
    595589    regionSparse.setNumElements(numberNonZero);
    596590  } else {
    597     for (int i=0;i<numberNonZero;i++) {
    598       int iRow=index[i];
    599       double value=region[iRow];
    600       region[iRow]=0.0;
    601       iRow=permuteIn[iRow];
    602       tempRegion[iRow]=value;
    603       index[i]=iRow;
     591    for (int i = 0; i < numberNonZero; i++) {
     592      int iRow = index[i];
     593      double value = region[iRow];
     594      region[iRow] = 0.0;
     595      iRow = permuteIn[iRow];
     596      tempRegion[iRow] = value;
     597      index[i] = iRow;
    604598    }
    605599    // and back
    606     for (int i=0;i<numberNonZero;i++) {
    607       int iRow=index[i];
    608       double value=tempRegion[iRow];
    609       tempRegion[iRow]=0.0;
    610       region[iRow]=value;
     600    for (int i = 0; i < numberNonZero; i++) {
     601      int iRow = index[i];
     602      double value = tempRegion[iRow];
     603      tempRegion[iRow] = 0.0;
     604      region[iRow] = value;
    611605    }
    612606  }
    613607}
    614608// Permute in for Btran and multiply by pivot Region
    615 void
    616 CoinAbcTypeFactorization::permuteInForBtranAndMultiply(CoinIndexedVector & regionSparse,
    617                                                        bool full) const
    618 {
    619   int numberNonZero=regionSparse.getNumElements();
    620   double * COIN_RESTRICT region = regionSparse.denseVector();
    621   double * COIN_RESTRICT tempRegion = region+numberRows_;
    622   int * COIN_RESTRICT index = regionSparse.getIndices();
    623   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     609void CoinAbcTypeFactorization::permuteInForBtranAndMultiply(CoinIndexedVector &regionSparse,
     610  bool full) const
     611{
     612  int numberNonZero = regionSparse.getNumElements();
     613  double *COIN_RESTRICT region = regionSparse.denseVector();
     614  double *COIN_RESTRICT tempRegion = region + numberRows_;
     615  int *COIN_RESTRICT index = regionSparse.getIndices();
     616  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    624617  if (full) {
    625     numberNonZero=0;
    626     for (int iRow=0;iRow<numberRows_;iRow++) {
     618    numberNonZero = 0;
     619    for (int iRow = 0; iRow < numberRows_; iRow++) {
    627620      double value = region[iRow];
    628621      if (value) {
    629         region[iRow]=0.0;
    630         tempRegion[iRow] = value*pivotRegion[iRow];
    631         index[numberNonZero++]=iRow;
     622        region[iRow] = 0.0;
     623        tempRegion[iRow] = value * pivotRegion[iRow];
     624        index[numberNonZero++] = iRow;
    632625      }
    633626    }
    634627    regionSparse.setNumElements(numberNonZero);
    635628  } else {
    636     for (int i=0;i<numberNonZero;i++) {
    637       int iRow=index[i];
     629    for (int i = 0; i < numberNonZero; i++) {
     630      int iRow = index[i];
    638631      double value = region[iRow];
    639       region[iRow]=0.0;
    640       tempRegion[iRow] = value*pivotRegion[iRow];
     632      region[iRow] = 0.0;
     633      tempRegion[iRow] = value * pivotRegion[iRow];
    641634    }
    642635  }
     
    652645}
    653646// Permute out for Btran
    654 void
    655 CoinAbcTypeFactorization::permuteOutForBtran(CoinIndexedVector & regionSparse) const
    656 {
    657   int numberNonZero=regionSparse.getNumElements();
    658   const int * COIN_RESTRICT permuteIn = permuteAddress_+maximumRowsExtra_+1;
    659   const int * COIN_RESTRICT permuteOut = permuteIn+numberRows_;
    660   CoinFactorizationDouble * COIN_RESTRICT tempRegion = denseVector(regionSparse);
    661   CoinFactorizationDouble * COIN_RESTRICT region = tempRegion-numberRows_;
    662   CoinSimplexInt * COIN_RESTRICT index = regionSparse.getIndices();
     647void CoinAbcTypeFactorization::permuteOutForBtran(CoinIndexedVector &regionSparse) const
     648{
     649  int numberNonZero = regionSparse.getNumElements();
     650  const int *COIN_RESTRICT permuteIn = permuteAddress_ + maximumRowsExtra_ + 1;
     651  const int *COIN_RESTRICT permuteOut = permuteIn + numberRows_;
     652  CoinFactorizationDouble *COIN_RESTRICT tempRegion = denseVector(regionSparse);
     653  CoinFactorizationDouble *COIN_RESTRICT region = tempRegion - numberRows_;
     654  CoinSimplexInt *COIN_RESTRICT index = regionSparse.getIndices();
    663655  regionSparse.setDenseVector(region);
    664656  //printf("BtranOut vector %p region %p regionTemp %p\n",
    665657  //     &regionSparse,region,tempRegion);
    666   for (int i=0;i<numberNonZero;i++) {
    667     int iRow=index[i];
    668     double value=tempRegion[iRow];
    669     tempRegion[iRow]=0.0;
    670     iRow=permuteOut[iRow];
    671     region[iRow]=value;
    672     index[i]=iRow;
    673   }
    674 }
    675 #endif
    676 #if COIN_BIG_DOUBLE==1
     658  for (int i = 0; i < numberNonZero; i++) {
     659    int iRow = index[i];
     660    double value = tempRegion[iRow];
     661    tempRegion[iRow] = 0.0;
     662    iRow = permuteOut[iRow];
     663    region[iRow] = value;
     664    index[i] = iRow;
     665  }
     666}
     667#endif
     668#if COIN_BIG_DOUBLE == 1
    677669// To a work array and associate vector
    678 void
    679 CoinAbcTypeFactorization::toLongArray(CoinIndexedVector * vector,int which) const
    680 {
    681   assert (which>=0&&which<FACTOR_CPU);
    682   assert (!associatedVector_[which]);
    683   associatedVector_[which]=vector;
    684   CoinSimplexDouble * COIN_RESTRICT region = vector->denseVector (  );
    685   CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices (  );
    686   CoinSimplexInt numberNonZero = vector->getNumElements (  );
    687   long double * COIN_RESTRICT longRegion = longArray_[which].array();
    688   assert (!vector->packedMode());
     670void CoinAbcTypeFactorization::toLongArray(CoinIndexedVector *vector, int which) const
     671{
     672  assert(which >= 0 && which < FACTOR_CPU);
     673  assert(!associatedVector_[which]);
     674  associatedVector_[which] = vector;
     675  CoinSimplexDouble *COIN_RESTRICT region = vector->denseVector();
     676  CoinSimplexInt *COIN_RESTRICT regionIndex = vector->getIndices();
     677  CoinSimplexInt numberNonZero = vector->getNumElements();
     678  long double *COIN_RESTRICT longRegion = longArray_[which].array();
     679  assert(!vector->packedMode());
    689680  // could check all of longRegion for zero but this should trap most errors
    690   for (int i=0;i<numberNonZero;i++) {
    691     int iRow=regionIndex[i];
    692     assert (!longRegion[iRow]);
    693     longRegion[iRow]=region[iRow];
    694     region[iRow]=0.0;
     681  for (int i = 0; i < numberNonZero; i++) {
     682    int iRow = regionIndex[i];
     683    assert(!longRegion[iRow]);
     684    longRegion[iRow] = region[iRow];
     685    region[iRow] = 0.0;
    695686  }
    696687}
    697688// From a work array and dis-associate vector
    698 void
    699 CoinAbcTypeFactorization::fromLongArray(CoinIndexedVector * vector) const
     689void CoinAbcTypeFactorization::fromLongArray(CoinIndexedVector *vector) const
    700690{
    701691  int which;
    702   for (which=0;which<FACTOR_CPU;which++)
    703     if (vector==associatedVector_[which])
     692  for (which = 0; which < FACTOR_CPU; which++)
     693    if (vector == associatedVector_[which])
    704694      break;
    705   assert (which<FACTOR_CPU);
    706   associatedVector_[which]=NULL;
    707   CoinSimplexDouble * COIN_RESTRICT region = vector->denseVector (  );
    708   CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices (  );
    709   CoinSimplexInt numberNonZero = vector->getNumElements (  );
    710   long double * COIN_RESTRICT longRegion = longArray_[which].array();
    711   assert (!vector->packedMode());
     695  assert(which < FACTOR_CPU);
     696  associatedVector_[which] = NULL;
     697  CoinSimplexDouble *COIN_RESTRICT region = vector->denseVector();
     698  CoinSimplexInt *COIN_RESTRICT regionIndex = vector->getIndices();
     699  CoinSimplexInt numberNonZero = vector->getNumElements();
     700  long double *COIN_RESTRICT longRegion = longArray_[which].array();
     701  assert(!vector->packedMode());
    712702  // could check all of region for zero but this should trap most errors
    713   for (int i=0;i<numberNonZero;i++) {
    714     int iRow=regionIndex[i];
    715     assert (!region[iRow]);
    716     region[iRow]=longRegion[iRow];
    717     longRegion[iRow]=0.0;
     703  for (int i = 0; i < numberNonZero; i++) {
     704    int iRow = regionIndex[i];
     705    assert(!region[iRow]);
     706    region[iRow] = longRegion[iRow];
     707    longRegion[iRow] = 0.0;
    718708  }
    719709}
    720710// From a work array and dis-associate vector
    721 void
    722 CoinAbcTypeFactorization::fromLongArray(int which) const
    723 {
    724   assert (which<FACTOR_CPU);
    725   CoinIndexedVector * vector = associatedVector_[which];
    726   associatedVector_[which]=NULL;
    727   CoinSimplexDouble * COIN_RESTRICT region = vector->denseVector (  );
    728   CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices (  );
    729   CoinSimplexInt numberNonZero = vector->getNumElements (  );
    730   long double * COIN_RESTRICT longRegion = longArray_[which].array();
    731   assert (!vector->packedMode());
     711void CoinAbcTypeFactorization::fromLongArray(int which) const
     712{
     713  assert(which < FACTOR_CPU);
     714  CoinIndexedVector *vector = associatedVector_[which];
     715  associatedVector_[which] = NULL;
     716  CoinSimplexDouble *COIN_RESTRICT region = vector->denseVector();
     717  CoinSimplexInt *COIN_RESTRICT regionIndex = vector->getIndices();
     718  CoinSimplexInt numberNonZero = vector->getNumElements();
     719  long double *COIN_RESTRICT longRegion = longArray_[which].array();
     720  assert(!vector->packedMode());
    732721  // could check all of region for zero but this should trap most errors
    733   for (int i=0;i<numberNonZero;i++) {
    734     int iRow=regionIndex[i];
    735     assert (!region[iRow]);
    736     region[iRow]=longRegion[iRow];
    737     longRegion[iRow]=0.0;
     722  for (int i = 0; i < numberNonZero; i++) {
     723    int iRow = regionIndex[i];
     724    assert(!region[iRow]);
     725    region[iRow] = longRegion[iRow];
     726    longRegion[iRow] = 0.0;
    738727  }
    739728}
    740729// Returns long double * associated with vector
    741 long double * 
    742 CoinAbcTypeFactorization::denseVector(CoinIndexedVector * vector) const
     730long double *
     731CoinAbcTypeFactorization::denseVector(CoinIndexedVector *vector) const
    743732{
    744733  int which;
    745   for (which=0;which<FACTOR_CPU;which++)
    746     if (vector==associatedVector_[which])
     734  for (which = 0; which < FACTOR_CPU; which++)
     735    if (vector == associatedVector_[which])
    747736      break;
    748   assert (which<FACTOR_CPU);
     737  assert(which < FACTOR_CPU);
    749738  return longArray_[which].array();
    750739}
    751740// Returns long double * associated with vector
    752 long double * 
    753 CoinAbcTypeFactorization::denseVector(CoinIndexedVector & vector) const
     741long double *
     742CoinAbcTypeFactorization::denseVector(CoinIndexedVector &vector) const
    754743{
    755744  int which;
    756   for (which=0;which<FACTOR_CPU;which++)
    757     if (&vector==associatedVector_[which])
     745  for (which = 0; which < FACTOR_CPU; which++)
     746    if (&vector == associatedVector_[which])
    758747      break;
    759   assert (which<FACTOR_CPU);
     748  assert(which < FACTOR_CPU);
    760749  return longArray_[which].array();
    761750}
    762751// Returns long double * associated with vector
    763 const long double * 
    764 CoinAbcTypeFactorization::denseVector(const CoinIndexedVector * vector) const
     752const long double *
     753CoinAbcTypeFactorization::denseVector(const CoinIndexedVector *vector) const
    765754{
    766755  int which;
    767   for (which=0;which<FACTOR_CPU;which++)
    768     if (vector==associatedVector_[which])
     756  for (which = 0; which < FACTOR_CPU; which++)
     757    if (vector == associatedVector_[which])
    769758      break;
    770   assert (which<FACTOR_CPU);
     759  assert(which < FACTOR_CPU);
    771760  return longArray_[which].array();
    772761}
    773 void
    774 CoinAbcTypeFactorization::scan(CoinIndexedVector * vector) const
    775 {
    776   int numberNonZero=0;
    777   int * COIN_RESTRICT index = vector->getIndices();
    778   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(vector);
    779   for (int i=0;i<numberRows_;i++) {
    780     if (fabs(region[i])>zeroTolerance_)
    781       index[numberNonZero++]=i;
     762void CoinAbcTypeFactorization::scan(CoinIndexedVector *vector) const
     763{
     764  int numberNonZero = 0;
     765  int *COIN_RESTRICT index = vector->getIndices();
     766  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(vector);
     767  for (int i = 0; i < numberRows_; i++) {
     768    if (fabs(region[i]) > zeroTolerance_)
     769      index[numberNonZero++] = i;
    782770    else
    783       region[i]=0.0;
     771      region[i] = 0.0;
    784772  }
    785773  vector->setNumElements(numberNonZero);
    786774}
    787775// Clear all hidden arrays
    788 void
    789 CoinAbcTypeFactorization::clearHiddenArrays()
    790 {
    791   for (int which=0;which<FACTOR_CPU;which++) {
     776void CoinAbcTypeFactorization::clearHiddenArrays()
     777{
     778  for (int which = 0; which < FACTOR_CPU; which++) {
    792779    if (associatedVector_[which]) {
    793       CoinIndexedVector * vector = associatedVector_[which];
    794       associatedVector_[which]=NULL;
    795       CoinFactorizationDouble * COIN_RESTRICT region = longArray_[which].array();
    796       CoinSimplexInt * COIN_RESTRICT regionIndex = vector->getIndices (  );
    797       CoinSimplexInt numberNonZero = vector->getNumElements (  );
    798     }
    799   }
    800 }
    801 #endif
    802 #endif
     780      CoinIndexedVector *vector = associatedVector_[which];
     781      associatedVector_[which] = NULL;
     782      CoinFactorizationDouble *COIN_RESTRICT region = longArray_[which].array();
     783      CoinSimplexInt *COIN_RESTRICT regionIndex = vector->getIndices();
     784      CoinSimplexInt numberNonZero = vector->getNumElements();
     785    }
     786  }
     787}
     788#endif
     789#endif
     790
     791/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     792*/
Note: See TracChangeset for help on using the changeset viewer.