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

formatting

File:
1 edited

Legend:

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

    r1910 r2385  
    1414#include "CoinHelperFunctions.hpp"
    1515#include "CoinAbcHelperFunctions.hpp"
    16 #if CILK_CONFLICT>0
     16#if CILK_CONFLICT > 0
    1717// for conflicts
    1818extern int cilk_conflict;
     
    2121
    2222/* Updates one column for dual steepest edge weights (FTRAN) */
    23 void
    24 CoinAbcTypeFactorization::updateWeights ( CoinIndexedVector & regionSparse) const
    25 {
    26   toLongArray(&regionSparse,1);
     23void CoinAbcTypeFactorization::updateWeights(CoinIndexedVector &regionSparse) const
     24{
     25  toLongArray(&regionSparse, 1);
    2726#ifdef ABC_ORDERED_FACTORIZATION
    2827  // Permute in for Ftran
     
    3029#endif
    3130  //  ******* L
    32   updateColumnL ( &regionSparse
    33 #if ABC_SMALL<2
    34                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    35 #endif
    36 #if ABC_PARALLEL
    37                   // can re-use 0 which would have been used for btran
    38                   ,0
    39 #endif
    40                   );
     31  updateColumnL(&regionSparse
     32#if ABC_SMALL < 2
     33    ,
     34    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     35#endif
     36#if ABC_PARALLEL
     37    // can re-use 0 which would have been used for btran
     38    ,
     39    0
     40#endif
     41  );
    4142  //row bits here
    42   updateColumnR ( &regionSparse
    43 #if ABC_SMALL<2
    44                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    45 #endif
    46 #if ABC_PARALLEL
    47                   ,0
    48 #endif
    49                   );
     43  updateColumnR(&regionSparse
     44#if ABC_SMALL < 2
     45    ,
     46    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     47#endif
     48#if ABC_PARALLEL
     49      ,
     50    0
     51#endif
     52  );
    5053  //update counts
    5154  //  ******* U
    52   updateColumnU ( &regionSparse
    53 #if ABC_SMALL<2
    54                   , reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    55 #endif
    56 #if ABC_PARALLEL
    57                   ,0
    58 #endif
    59                   );
     55  updateColumnU(&regionSparse
     56#if ABC_SMALL < 2
     57    ,
     58    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     59#endif
     60#if ABC_PARALLEL
     61      ,
     62    0
     63#endif
     64  );
    6065#if ABC_DEBUG
    6166  regionSparse.checkClean();
    6267#endif
    6368}
    64 CoinSimplexInt CoinAbcTypeFactorization::updateColumn ( CoinIndexedVector & regionSparse)
     69CoinSimplexInt CoinAbcTypeFactorization::updateColumn(CoinIndexedVector &regionSparse)
    6570  const
    6671{
    67   toLongArray(&regionSparse,0);
     72  toLongArray(&regionSparse, 0);
    6873#ifdef ABC_ORDERED_FACTORIZATION
    6974  // Permute in for Ftran
     
    7176#endif
    7277  //  ******* L
    73   updateColumnL ( &regionSparse
    74 #if ABC_SMALL<2
    75                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    76 #endif
    77                   );
     78  updateColumnL(&regionSparse
     79#if ABC_SMALL < 2
     80    ,
     81    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     82#endif
     83  );
    7884  //row bits here
    79   updateColumnR ( &regionSparse
    80 #if ABC_SMALL<2
    81                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    82 #endif
    83                   );
     85  updateColumnR(&regionSparse
     86#if ABC_SMALL < 2
     87    ,
     88    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     89#endif
     90  );
    8491  //update counts
    8592  //  ******* U
    86   updateColumnU ( &regionSparse
    87 #if ABC_SMALL<2
    88                   , reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    89 #endif
    90                   );
     93  updateColumnU(&regionSparse
     94#if ABC_SMALL < 2
     95    ,
     96    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     97#endif
     98  );
    9199#if ABC_DEBUG
    92100  regionSparse.checkClean();
     
    95103}
    96104/* Updates one full column (FTRAN) */
    97 void
    98 CoinAbcTypeFactorization::updateFullColumn ( CoinIndexedVector & regionSparse) const
     105void CoinAbcTypeFactorization::updateFullColumn(CoinIndexedVector &regionSparse) const
    99106{
    100107#ifndef ABC_ORDERED_FACTORIZATION
    101108  regionSparse.setNumElements(0);
    102   regionSparse.scan(0,numberRows_);
    103 #else
    104   permuteInForFtran(regionSparse,true);
     109  regionSparse.scan(0, numberRows_);
     110#else
     111  permuteInForFtran(regionSparse, true);
    105112#endif
    106113  if (regionSparse.getNumElements()) {
    107     toLongArray(&regionSparse,1);
     114    toLongArray(&regionSparse, 1);
    108115    //  ******* L
    109     updateColumnL ( &regionSparse
    110 #if ABC_SMALL<2
    111               ,reinterpret_cast<CoinAbcStatistics &>(ftranFullCountInput_)
    112 #endif
    113 #if ABC_PARALLEL
    114                     ,1
    115 #endif
    116                     );
     116    updateColumnL(&regionSparse
     117#if ABC_SMALL < 2
     118      ,
     119      reinterpret_cast< CoinAbcStatistics & >(ftranFullCountInput_)
     120#endif
     121#if ABC_PARALLEL
     122        ,
     123      1
     124#endif
     125    );
    117126    //row bits here
    118     updateColumnR ( &regionSparse
    119 #if ABC_SMALL<2
    120               ,reinterpret_cast<CoinAbcStatistics &>(ftranFullCountInput_)
    121 #endif
    122 #if ABC_PARALLEL
    123                     ,1
    124 #endif
    125                     );
     127    updateColumnR(&regionSparse
     128#if ABC_SMALL < 2
     129      ,
     130      reinterpret_cast< CoinAbcStatistics & >(ftranFullCountInput_)
     131#endif
     132#if ABC_PARALLEL
     133        ,
     134      1
     135#endif
     136    );
    126137    //update counts
    127138    //  ******* U
    128     updateColumnU ( &regionSparse
    129 #if ABC_SMALL<2
    130               , reinterpret_cast<CoinAbcStatistics &>(ftranFullCountInput_)
    131 #endif
    132 #if ABC_PARALLEL
    133                     ,1
    134 #endif
    135                     );
     139    updateColumnU(&regionSparse
     140#if ABC_SMALL < 2
     141      ,
     142      reinterpret_cast< CoinAbcStatistics & >(ftranFullCountInput_)
     143#endif
     144#if ABC_PARALLEL
     145        ,
     146      1
     147#endif
     148    );
    136149    fromLongArray(1);
    137150#if ABC_DEBUG
     
    142155// move stuff like this into CoinAbcHelperFunctions.hpp
    143156inline void multiplyIndexed(CoinSimplexInt number,
    144                             const CoinFactorizationDouble *  COIN_RESTRICT multiplier,
    145                             const CoinSimplexInt *  COIN_RESTRICT thisIndex,
    146                             CoinFactorizationDouble *  COIN_RESTRICT region)
    147 {
    148   for (CoinSimplexInt i = 0; i < number; i ++ ) {
     157  const CoinFactorizationDouble *COIN_RESTRICT multiplier,
     158  const CoinSimplexInt *COIN_RESTRICT thisIndex,
     159  CoinFactorizationDouble *COIN_RESTRICT region)
     160{
     161  for (CoinSimplexInt i = 0; i < number; i++) {
    149162    CoinSimplexInt iRow = thisIndex[i];
    150163    CoinSimplexDouble value = region[iRow];
     
    154167}
    155168/* Updates one full column (BTRAN) */
    156 void
    157 CoinAbcTypeFactorization::updateFullColumnTranspose ( CoinIndexedVector & regionSparse) const
    158 {
    159   int numberNonZero=0;
     169void CoinAbcTypeFactorization::updateFullColumnTranspose(CoinIndexedVector &regionSparse) const
     170{
     171  int numberNonZero = 0;
    160172  // Should pass in statistics
    161   toLongArray(&regionSparse,0);
    162   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
    163   CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse.getIndices();
     173  toLongArray(&regionSparse, 0);
     174  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     175  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse.getIndices();
    164176#ifndef ABC_ORDERED_FACTORIZATION
    165   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    166   for (int iRow=0;iRow<numberRows_;iRow++) {
     177  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     178  for (int iRow = 0; iRow < numberRows_; iRow++) {
    167179    double value = region[iRow];
    168180    if (value) {
    169       region[iRow] = value*pivotRegion[iRow];
    170       regionIndex[numberNonZero++]=iRow;
     181      region[iRow] = value * pivotRegion[iRow];
     182      regionIndex[numberNonZero++] = iRow;
    171183    }
    172184  }
     
    174186  if (!numberNonZero)
    175187    return;
    176   //regionSparse.setNumElements(0);
    177   //regionSparse.scan(0,numberRows_);
    178 #else
    179   permuteInForBtranAndMultiply(regionSparse,true);
     188    //regionSparse.setNumElements(0);
     189    //regionSparse.scan(0,numberRows_);
     190#else
     191  permuteInForBtranAndMultiply(regionSparse, true);
    180192  if (!regionSparse.getNumElements()) {
    181193    permuteOutForBtran(regionSparse);
     
    187199  // Apply pivot region - could be combined for speed
    188200  // Can only combine/move inside vector for sparse
    189   CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1];
    190 #if ABC_SMALL<2
     201  CoinSimplexInt smallestIndex = pivotLinkedForwardsAddress_[-1];
     202#if ABC_SMALL < 2
    191203  // copy of code inside transposeU
    192   bool goSparse=false;
     204  bool goSparse = false;
    193205#else
    194206#define goSparse false
    195207#endif
    196 #if ABC_SMALL<2
     208#if ABC_SMALL < 2
    197209  // Guess at number at end
    198210  if (gotUCopy()) {
    199     assert (btranFullAverageAfterU_);
    200     CoinSimplexInt newNumber =
    201       static_cast<CoinSimplexInt> (numberNonZero*btranFullAverageAfterU_*twiddleBtranFullFactor1());
    202     if (newNumber< sparseThreshold_)
     211    assert(btranFullAverageAfterU_);
     212    CoinSimplexInt newNumber = static_cast< CoinSimplexInt >(numberNonZero * btranFullAverageAfterU_ * twiddleBtranFullFactor1());
     213    if (newNumber < sparseThreshold_)
    203214      goSparse = true;
    204215  }
    205216#endif
    206   if (numberNonZero<40&&(numberNonZero<<4)<numberRows_&&!goSparse) {
    207     CoinSimplexInt *  COIN_RESTRICT pivotRowForward = pivotColumnAddress_;
    208     CoinSimplexInt smallest=numberRowsExtra_;
    209     for (CoinSimplexInt j = 0; j < numberNonZero; j++ ) {
     217  if (numberNonZero < 40 && (numberNonZero << 4) < numberRows_ && !goSparse) {
     218    CoinSimplexInt *COIN_RESTRICT pivotRowForward = pivotColumnAddress_;
     219    CoinSimplexInt smallest = numberRowsExtra_;
     220    for (CoinSimplexInt j = 0; j < numberNonZero; j++) {
    210221      CoinSimplexInt iRow = regionIndex[j];
    211       if (pivotRowForward[iRow]<smallest) {
    212         smallest=pivotRowForward[iRow];
    213         smallestIndex=iRow;
     222      if (pivotRowForward[iRow] < smallest) {
     223        smallest = pivotRowForward[iRow];
     224        smallestIndex = iRow;
    214225      }
    215226    }
    216227  }
    217   updateColumnTransposeU ( &regionSparse,smallestIndex
    218 #if ABC_SMALL<2
    219                   ,reinterpret_cast<CoinAbcStatistics &>(btranFullCountInput_)
    220 #endif
    221 #if ABC_PARALLEL
    222                     ,0
    223 #endif
    224                            );
     228  updateColumnTransposeU(&regionSparse, smallestIndex
     229#if ABC_SMALL < 2
     230    ,
     231    reinterpret_cast< CoinAbcStatistics & >(btranFullCountInput_)
     232#endif
     233#if ABC_PARALLEL
     234      ,
     235    0
     236#endif
     237  );
    225238  //row bits here
    226   updateColumnTransposeR ( &regionSparse
    227 #if ABC_SMALL<2
    228               ,reinterpret_cast<CoinAbcStatistics &>(btranFullCountInput_)
    229 #endif
    230                                                          );
     239  updateColumnTransposeR(&regionSparse
     240#if ABC_SMALL < 2
     241    ,
     242    reinterpret_cast< CoinAbcStatistics & >(btranFullCountInput_)
     243#endif
     244  );
    231245  //  ******* L
    232   updateColumnTransposeL ( &regionSparse
    233 #if ABC_SMALL<2
    234                   ,reinterpret_cast<CoinAbcStatistics &>(btranFullCountInput_)
    235 #endif
    236 #if ABC_PARALLEL
    237                                       ,0
    238 #endif
    239                            );
     246  updateColumnTransposeL(&regionSparse
     247#if ABC_SMALL < 2
     248    ,
     249    reinterpret_cast< CoinAbcStatistics & >(btranFullCountInput_)
     250#endif
     251#if ABC_PARALLEL
     252      ,
     253    0
     254#endif
     255  );
    240256  fromLongArray(0);
    241 #if ABC_SMALL<3
     257#if ABC_SMALL < 3
    242258#ifdef ABC_ORDERED_FACTORIZATION
    243259  permuteOutForBtran(regionSparse);
     
    247263#endif
    248264#else
    249   numberNonZero=0;
    250   for (CoinSimplexInt i=0;i<numberRows_;i++) {
    251     CoinExponent expValue=ABC_EXPONENT(region[i]);
     265  numberNonZero = 0;
     266  for (CoinSimplexInt i = 0; i < numberRows_; i++) {
     267    CoinExponent expValue = ABC_EXPONENT(region[i]);
    252268    if (expValue) {
    253269      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    254         regionIndex[numberNonZero++]=i;
     270        regionIndex[numberNonZero++] = i;
    255271      } else {
    256         region[i]=0.0;
     272        region[i] = 0.0;
    257273      }
    258274    }
     
    262278}
    263279//  updateColumnL.  Updates part of column (FTRANL)
    264 void
    265 CoinAbcTypeFactorization::updateColumnL ( CoinIndexedVector * regionSparse
    266 #if ABC_SMALL<2
    267                                       ,CoinAbcStatistics & statistics
    268 #endif
    269 #if ABC_PARALLEL
    270                                       ,int whichSparse
    271 #endif
    272                                       ) const
    273 {
    274 #if CILK_CONFLICT>0
     280void CoinAbcTypeFactorization::updateColumnL(CoinIndexedVector *regionSparse
     281#if ABC_SMALL < 2
     282  ,
     283  CoinAbcStatistics &statistics
     284#endif
     285#if ABC_PARALLEL
     286  ,
     287  int whichSparse
     288#endif
     289  ) const
     290{
     291#if CILK_CONFLICT > 0
    275292#if ABC_PARALLEL
    276293  // for conflicts
    277 #if CILK_CONFLICT>1
    278   printf("file %s line %d which %d\n",__FILE__,__LINE__,whichSparse);
    279 #endif
    280   abc_assert((cilk_conflict&(1<<whichSparse))==0);
    281   cilk_conflict |= (1<<whichSparse);
    282 #else
    283   abc_assert((cilk_conflict&(1<<0))==0);
    284   cilk_conflict |= (1<<0);
    285 #endif
    286 #endif
    287 #if ABC_SMALL<2
    288   CoinSimplexInt number = regionSparse->getNumElements (  );
     294#if CILK_CONFLICT > 1
     295  printf("file %s line %d which %d\n", __FILE__, __LINE__, whichSparse);
     296#endif
     297  abc_assert((cilk_conflict & (1 << whichSparse)) == 0);
     298  cilk_conflict |= (1 << whichSparse);
     299#else
     300  abc_assert((cilk_conflict & (1 << 0)) == 0);
     301  cilk_conflict |= (1 << 0);
     302#endif
     303#endif
     304#if ABC_SMALL < 2
     305  CoinSimplexInt number = regionSparse->getNumElements();
    289306  if (factorizationStatistics()) {
    290307    statistics.numberCounts_++;
     
    293310#endif
    294311  if (numberL_) {
    295 #if ABC_SMALL<2
     312#if ABC_SMALL < 2
    296313    int goSparse;
    297314    // Guess at number at end
    298315    if (gotSparse()) {
    299       double average = statistics.averageAfterL_*twiddleFactor1S();
    300       assert (average);
    301       CoinSimplexInt newNumber = static_cast<CoinSimplexInt> (number*average);
    302       if (newNumber< sparseThreshold_&&(numberL_<<2)>newNumber*1.0*twiddleFactor2S())
    303         goSparse = 1;
    304       else if (3*newNumber < numberRows_)
    305         goSparse = 0;
     316      double average = statistics.averageAfterL_ * twiddleFactor1S();
     317      assert(average);
     318      CoinSimplexInt newNumber = static_cast< CoinSimplexInt >(number * average);
     319      if (newNumber < sparseThreshold_ && (numberL_ << 2) > newNumber * 1.0 * twiddleFactor2S())
     320        goSparse = 1;
     321      else if (3 * newNumber < numberRows_)
     322        goSparse = 0;
    306323      else
    307         goSparse = -1;
     324        goSparse = -1;
    308325    } else {
    309       goSparse=0;
     326      goSparse = 0;
    310327    } //if(goSparse==1) goSparse=0;
    311328    if (!goSparse) {
    312329      // densish
    313330      updateColumnLDensish(regionSparse);
    314     } else if (goSparse<0) {
     331    } else if (goSparse < 0) {
    315332      // densish
    316333      updateColumnLDense(regionSparse);
     
    319336      updateColumnLSparse(regionSparse
    320337#if ABC_PARALLEL
    321                           ,whichSparse
    322 #endif
    323                           );
     338        ,
     339        whichSparse
     340#endif
     341      );
    324342    }
    325343#else
     
    327345#endif
    328346  }
    329 #if ABC_SMALL<4
    330 #if ABC_DENSE_CODE>0
     347#if ABC_SMALL < 4
     348#if ABC_DENSE_CODE > 0
    331349  if (numberDense_) {
    332     instrument_do("CoinAbcFactorizationDense",0.3*numberDense_*numberDense_);
     350    instrument_do("CoinAbcFactorizationDense", 0.3 * numberDense_ * numberDense_);
    333351    //take off list
    334     CoinSimplexInt lastSparse = numberRows_-numberDense_;
    335     CoinFactorizationDouble * COIN_RESTRICT region = denseVector (regionSparse);
    336     CoinFactorizationDouble *  COIN_RESTRICT denseArea = denseAreaAddress_;
    337     CoinFactorizationDouble * COIN_RESTRICT denseRegion =
    338       denseArea+leadingDimension_*numberDense_;
    339     CoinSimplexInt *  COIN_RESTRICT densePermute=
    340       reinterpret_cast<CoinSimplexInt *>(denseRegion+FACTOR_CPU*numberDense_);
     352    CoinSimplexInt lastSparse = numberRows_ - numberDense_;
     353    CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     354    CoinFactorizationDouble *COIN_RESTRICT denseArea = denseAreaAddress_;
     355    CoinFactorizationDouble *COIN_RESTRICT denseRegion = denseArea + leadingDimension_ * numberDense_;
     356    CoinSimplexInt *COIN_RESTRICT densePermute = reinterpret_cast< CoinSimplexInt * >(denseRegion + FACTOR_CPU * numberDense_);
    341357    //for (int i=0;i<numberDense_;i++) {
    342       //printf("perm %d %d\n",i,densePermute[i]);
    343       //assert (densePermute[i]>=0&&densePermute[i]<numberRows_);
    344     //} 
     358    //printf("perm %d %d\n",i,densePermute[i]);
     359    //assert (densePermute[i]>=0&&densePermute[i]<numberRows_);
     360    //}
    345361#if ABC_PARALLEL
    346362    if (whichSparse)
    347       denseRegion+=whichSparse*numberDense_;
    348     //printf("PP %d %d %s region %x\n",whichSparse,__LINE__,__FILE__,denseRegion);
    349 #endif
    350     CoinFactorizationDouble * COIN_RESTRICT densePut =
    351       denseRegion-lastSparse;
    352     CoinZeroN(denseRegion,numberDense_);
    353     bool doDense=false;
    354 #if ABC_SMALL<3
    355 #if ABC_DENSE_CODE==2
    356               //short * COIN_RESTRICT forFtran = reinterpret_cast<short *>(densePermute+numberDense_)-lastSparse;
    357     short * COIN_RESTRICT forFtran2 = reinterpret_cast<short *>(densePermute+numberDense_)+2*numberDense_;
    358 #else
    359     const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
     363      denseRegion += whichSparse * numberDense_;
     364      //printf("PP %d %d %s region %x\n",whichSparse,__LINE__,__FILE__,denseRegion);
     365#endif
     366    CoinFactorizationDouble *COIN_RESTRICT densePut = denseRegion - lastSparse;
     367    CoinZeroN(denseRegion, numberDense_);
     368    bool doDense = false;
     369#if ABC_SMALL < 3
     370#if ABC_DENSE_CODE == 2
     371    //short * COIN_RESTRICT forFtran = reinterpret_cast<short *>(densePermute+numberDense_)-lastSparse;
     372    short *COIN_RESTRICT forFtran2 = reinterpret_cast< short * >(densePermute + numberDense_) + 2 * numberDense_;
     373#else
     374    const CoinSimplexInt *COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
    360375#endif
    361376    CoinSimplexInt number = regionSparse->getNumElements();
    362     CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices();
    363     CoinSimplexInt i=0;
    364     while (i<number) {
     377    CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     378    CoinSimplexInt i = 0;
     379    while (i < number) {
    365380      CoinSimplexInt iRow = regionIndex[i];
    366 #if ABC_DENSE_CODE==2
     381#if ABC_DENSE_CODE == 2
    367382      int kRow = forFtran2[iRow];
    368       if (kRow!=-1) {
    369         doDense=true;
    370         regionIndex[i] = regionIndex[--number];
    371         denseRegion[kRow]=region[iRow];
     383      if (kRow != -1) {
     384        doDense = true;
     385        regionIndex[i] = regionIndex[--number];
     386        denseRegion[kRow] = region[iRow];
    372387#else
    373388      CoinSimplexInt jRow = pivotLBackwardOrder[iRow];
    374       if (jRow>=lastSparse) {
    375         doDense=true;
    376         regionIndex[i] = regionIndex[--number];
    377         densePut[jRow]=region[iRow];
    378 #endif
    379         region[iRow]=0.0;
     389      if (jRow >= lastSparse) {
     390        doDense = true;
     391        regionIndex[i] = regionIndex[--number];
     392        densePut[jRow] = region[iRow];
     393#endif
     394        region[iRow] = 0.0;
    380395      } else {
    381         i++;
     396        i++;
    382397      }
    383398    }
    384399#else
    385     CoinSimplexInt * COIN_RESTRICT forFtran = densePermute+numberDense_-lastSparse;
    386     const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
    387     for (CoinSimplexInt jRow=lastSparse;jRow<numberRows_;jRow++) {
     400    CoinSimplexInt *COIN_RESTRICT forFtran = densePermute + numberDense_ - lastSparse;
     401    const CoinSimplexInt *COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
     402    for (CoinSimplexInt jRow = lastSparse; jRow < numberRows_; jRow++) {
    388403      CoinSimplexInt iRow = pivotLOrder[jRow];
    389404      if (region[iRow]) {
    390         doDense=true;
    391         //densePut[jRow]=region[iRow];
    392 #if ABC_DENSE_CODE==2
    393         int kRow=forFtran[jRow];
    394         denseRegion[kRow]=region[iRow];
    395 #endif
    396         region[iRow]=0.0;
     405        doDense = true;
     406        //densePut[jRow]=region[iRow];
     407#if ABC_DENSE_CODE == 2
     408        int kRow = forFtran[jRow];
     409        denseRegion[kRow] = region[iRow];
     410#endif
     411        region[iRow] = 0.0;
    397412      }
    398413    }
    399414#endif
    400415    if (doDense) {
    401 #if ABC_DENSE_CODE==1
     416#if ABC_DENSE_CODE == 1
    402417#ifndef CLAPACK
    403418      char trans = 'N';
    404       CoinSimplexInt ione=1;
     419      CoinSimplexInt ione = 1;
    405420      CoinSimplexInt info;
    406       F77_FUNC(dgetrs,DGETRS)(&trans,&numberDense_,&ione,denseArea,&leadingDimension_,
    407                               densePermute,denseRegion,&numberDense_,&info,1);
    408 #else
    409       clapack_dgetrs(CblasColMajor, CblasNoTrans,numberDense_,1,
    410                      denseArea, leadingDimension_,densePermute,denseRegion,numberDense_);
    411 #endif
    412 #elif ABC_DENSE_CODE==2
    413       CoinAbcDgetrs('N',numberDense_,denseArea,denseRegion);
    414 #endif
    415       const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
    416       for (CoinSimplexInt i=lastSparse;i<numberRows_;i++) {
    417         if (!TEST_LESS_THAN_TOLERANCE(densePut[i])) {
     421      F77_FUNC(dgetrs, DGETRS)
     422      (&trans, &numberDense_, &ione, denseArea, &leadingDimension_,
     423        densePermute, denseRegion, &numberDense_, &info, 1);
     424#else
     425      clapack_dgetrs(CblasColMajor, CblasNoTrans, numberDense_, 1,
     426        denseArea, leadingDimension_, densePermute, denseRegion, numberDense_);
     427#endif
     428#elif ABC_DENSE_CODE == 2
     429      CoinAbcDgetrs('N', numberDense_, denseArea, denseRegion);
     430#endif
     431      const CoinSimplexInt *COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
     432      for (CoinSimplexInt i = lastSparse; i < numberRows_; i++) {
     433        if (!TEST_LESS_THAN_TOLERANCE(densePut[i])) {
    418434#ifndef ABC_ORDERED_FACTORIZATION
    419           CoinSimplexInt iRow=pivotLOrder[i];
    420 #else
    421           CoinSimplexInt iRow=i;
    422 #endif
    423           region[iRow]=densePut[i];
    424 #if ABC_SMALL<3
    425           regionIndex[number++] = iRow;
    426 #endif
    427         }
     435          CoinSimplexInt iRow = pivotLOrder[i];
     436#else
     437          CoinSimplexInt iRow = i;
     438#endif
     439          region[iRow] = densePut[i];
     440#if ABC_SMALL < 3
     441          regionIndex[number++] = iRow;
     442#endif
     443        }
    428444      }
    429 #if ABC_SMALL<3
     445#if ABC_SMALL < 3
    430446      regionSparse->setNumElements(number);
    431447#endif
     
    435451#endif
    436452#endif
    437 #if ABC_SMALL<2
    438   if (factorizationStatistics()) 
     453#if ABC_SMALL < 2
     454  if (factorizationStatistics())
    439455    statistics.countAfterL_ += regionSparse->getNumElements();
    440456#endif
    441 #if CILK_CONFLICT>0
     457#if CILK_CONFLICT > 0
    442458#if ABC_PARALLEL
    443459  // for conflicts
    444   abc_assert((cilk_conflict&(1<<whichSparse))!=0);
    445   cilk_conflict &= ~(1<<whichSparse);
    446 #else
    447   abc_assert((cilk_conflict&(1<<0))!=0);
    448   cilk_conflict &= ~(1<<0);
     460  abc_assert((cilk_conflict & (1 << whichSparse)) != 0);
     461  cilk_conflict &= ~(1 << whichSparse);
     462#else
     463  abc_assert((cilk_conflict & (1 << 0)) != 0);
     464  cilk_conflict &= ~(1 << 0);
    449465#endif
    450466#endif
     
    454470//#define INLINE_IT2
    455471inline void scatterUpdateInline(CoinSimplexInt number,
    456                           CoinFactorizationDouble pivotValue,
    457                           const CoinFactorizationDouble *  COIN_RESTRICT thisElement,
    458                           const CoinSimplexInt *  COIN_RESTRICT thisIndex,
    459                           CoinFactorizationDouble *  COIN_RESTRICT region)
    460 {
    461 #if UNROLL==0
    462   for (CoinBigIndex j=number-1 ; j >=0; j-- ) {
     472  CoinFactorizationDouble pivotValue,
     473  const CoinFactorizationDouble *COIN_RESTRICT thisElement,
     474  const CoinSimplexInt *COIN_RESTRICT thisIndex,
     475  CoinFactorizationDouble *COIN_RESTRICT region)
     476{
     477#if UNROLL == 0
     478  for (CoinBigIndex j = number - 1; j >= 0; j--) {
    463479    CoinSimplexInt iRow = thisIndex[j];
    464480    CoinFactorizationDouble regionValue = region[iRow];
    465481    CoinFactorizationDouble value = thisElement[j];
    466     assert (value);
     482    assert(value);
    467483    region[iRow] = regionValue - value * pivotValue;
    468484  }
    469 #elif UNROLL==1
    470   if ((number&1)!=0) {
     485#elif UNROLL == 1
     486  if ((number & 1) != 0) {
    471487    number--;
    472488    CoinSimplexInt iRow = thisIndex[number];
     
    475491    region[iRow] = regionValue - value * pivotValue;
    476492  }
    477   for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) {
     493  for (CoinBigIndex j = number - 1; j >= 0; j -= 2) {
    478494    CoinSimplexInt iRow0 = thisIndex[j];
    479     CoinSimplexInt iRow1 = thisIndex[j-1];
     495    CoinSimplexInt iRow1 = thisIndex[j - 1];
    480496    CoinFactorizationDouble regionValue0 = region[iRow0];
    481497    CoinFactorizationDouble regionValue1 = region[iRow1];
    482498    region[iRow0] = regionValue0 - thisElement[j] * pivotValue;
    483     region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue;
    484   }
    485 #elif UNROLL==2
     499    region[iRow1] = regionValue1 - thisElement[j - 1] * pivotValue;
     500  }
     501#elif UNROLL == 2
    486502  CoinSimplexInt iRow0;
    487503  CoinSimplexInt iRow1;
    488504  CoinFactorizationDouble regionValue0;
    489505  CoinFactorizationDouble regionValue1;
    490   switch(static_cast<unsigned int>(number)) {
     506  switch (static_cast< unsigned int >(number)) {
    491507  case 0:
    492508    break;
     
    616632    break;
    617633  default:
    618     if ((number&1)!=0) {
     634    if ((number & 1) != 0) {
    619635      number--;
    620636      CoinSimplexInt iRow = thisIndex[number];
     
    623639      region[iRow] = regionValue - value * pivotValue;
    624640    }
    625     for (CoinBigIndex j=number-1 ; j >=0; j-=2 ) {
     641    for (CoinBigIndex j = number - 1; j >= 0; j -= 2) {
    626642      CoinSimplexInt iRow0 = thisIndex[j];
    627       CoinSimplexInt iRow1 = thisIndex[j-1];
     643      CoinSimplexInt iRow1 = thisIndex[j - 1];
    628644      CoinFactorizationDouble regionValue0 = region[iRow0];
    629645      CoinFactorizationDouble regionValue1 = region[iRow1];
    630646      region[iRow0] = regionValue0 - thisElement[j] * pivotValue;
    631       region[iRow1] = regionValue1 - thisElement[j-1] * pivotValue;
     647      region[iRow1] = regionValue1 - thisElement[j - 1] * pivotValue;
    632648    }
    633649    break;
     
    636652}
    637653inline CoinFactorizationDouble gatherUpdate(CoinSimplexInt number,
    638                           const CoinFactorizationDouble *  COIN_RESTRICT thisElement,
    639                           const CoinSimplexInt *  COIN_RESTRICT thisIndex,
    640                           CoinFactorizationDouble *  COIN_RESTRICT region)
    641 {
    642   CoinFactorizationDouble pivotValue=0.0;
    643   for (CoinBigIndex j = 0; j < number; j ++ ) {
     654  const CoinFactorizationDouble *COIN_RESTRICT thisElement,
     655  const CoinSimplexInt *COIN_RESTRICT thisIndex,
     656  CoinFactorizationDouble *COIN_RESTRICT region)
     657{
     658  CoinFactorizationDouble pivotValue = 0.0;
     659  for (CoinBigIndex j = 0; j < number; j++) {
    644660    CoinFactorizationDouble value = thisElement[j];
    645661    CoinSimplexInt jRow = thisIndex[j];
     
    650666}
    651667// Updates part of column (FTRANL) when densish
    652 void
    653 CoinAbcTypeFactorization::updateColumnLDensish ( CoinIndexedVector * regionSparse) const
    654 {
    655   CoinSimplexInt * COIN_RESTRICT regionIndex=regionSparse->getIndices();
    656   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
    657   CoinSimplexInt number = regionSparse->getNumElements (  );
    658 #if ABC_SMALL<3
     668void CoinAbcTypeFactorization::updateColumnLDensish(CoinIndexedVector *regionSparse) const
     669{
     670  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     671  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     672  CoinSimplexInt number = regionSparse->getNumElements();
     673#if ABC_SMALL < 3
    659674  CoinSimplexInt numberNonZero = 0;
    660675#endif
    661  
    662   const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_;
    663   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_;
    664   const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_;
    665   const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
    666   const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
     676
     677  const CoinBigIndex *COIN_RESTRICT startColumn = startColumnLAddress_;
     678  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowLAddress_;
     679  const CoinFactorizationDouble *COIN_RESTRICT element = elementLAddress_;
     680  const CoinSimplexInt *COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
     681  const CoinSimplexInt *COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
    667682  CoinSimplexInt last = numberRows_;
    668   assert ( last == baseL_ + numberL_);
    669 #if ABC_DENSE_CODE>0
     683  assert(last == baseL_ + numberL_);
     684#if ABC_DENSE_CODE > 0
    670685  //can take out last bit of sparse L as empty
    671686  last -= numberDense_;
     
    673688  CoinSimplexInt smallestIndex = numberRowsExtra_;
    674689  // do easy ones
    675   for (CoinSimplexInt k=0;k<number;k++) {
    676     CoinSimplexInt iPivot=regionIndex[k];
     690  for (CoinSimplexInt k = 0; k < number; k++) {
     691    CoinSimplexInt iPivot = regionIndex[k];
    677692#ifndef ABC_ORDERED_FACTORIZATION
    678     CoinSimplexInt jPivot=pivotLBackwardOrder[iPivot];
    679 #else
    680     CoinSimplexInt jPivot=iPivot;
    681 #endif
    682 #if ABC_SMALL<3
    683     if (jPivot>=baseL_)
    684       smallestIndex = CoinMin(jPivot,smallestIndex);
     693    CoinSimplexInt jPivot = pivotLBackwardOrder[iPivot];
     694#else
     695    CoinSimplexInt jPivot = iPivot;
     696#endif
     697#if ABC_SMALL < 3
     698    if (jPivot >= baseL_)
     699      smallestIndex = CoinMin(jPivot, smallestIndex);
    685700    else
    686       regionIndex[numberNonZero++]=iPivot;
    687 #else
    688     if (jPivot>=baseL_)
    689       smallestIndex = CoinMin(jPivot,smallestIndex);
    690 #endif     
    691   }
    692   instrument_start("CoinAbcFactorizationUpdateLDensish",number+(last-smallestIndex));
     701      regionIndex[numberNonZero++] = iPivot;
     702#else
     703    if (jPivot >= baseL_)
     704      smallestIndex = CoinMin(jPivot, smallestIndex);
     705#endif
     706  }
     707  instrument_start("CoinAbcFactorizationUpdateLDensish", number + (last - smallestIndex));
    693708  // now others
    694   for (CoinSimplexInt k = smallestIndex; k < last; k++ ) {
     709  for (CoinSimplexInt k = smallestIndex; k < last; k++) {
    695710#if 0
    696711    for (int j=0;j<numberRows_;j+=10) {
     
    701716#endif
    702717#ifndef ABC_ORDERED_FACTORIZATION
    703     CoinSimplexInt i=pivotLOrder[k];
    704 #else
    705     CoinSimplexInt i=k;
    706 #endif
    707     CoinExponent expValue=ABC_EXPONENT(region[i]);
     718    CoinSimplexInt i = pivotLOrder[k];
     719#else
     720    CoinSimplexInt i = k;
     721#endif
     722    CoinExponent expValue = ABC_EXPONENT(region[i]);
    708723    if (expValue) {
    709724      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    710         CoinBigIndex start = startColumn[k];
    711         CoinBigIndex end = startColumn[k + 1];
    712         instrument_add(end-start);
    713         if (TEST_INT_NONZERO(end-start)) {
    714           CoinFactorizationDouble pivotValue = region[i];
     725        CoinBigIndex start = startColumn[k];
     726        CoinBigIndex end = startColumn[k + 1];
     727        instrument_add(end - start);
     728        if (TEST_INT_NONZERO(end - start)) {
     729          CoinFactorizationDouble pivotValue = region[i];
    715730#ifndef INLINE_IT
    716           for (CoinBigIndex j = start; j < end; j ++ ) {
    717             CoinSimplexInt iRow = indexRow[j];
    718             CoinFactorizationDouble result = region[iRow];
    719             CoinFactorizationDouble value = element[j];
    720             region[iRow] = result - value * pivotValue;
    721           }     
    722 #else
    723           CoinAbcScatterUpdate(end-start,pivotValue,element+start,indexRow+start,region);
    724 #endif
    725         }
    726 #if ABC_SMALL<3
    727         regionIndex[numberNonZero++] = i;
     731          for (CoinBigIndex j = start; j < end; j++) {
     732            CoinSimplexInt iRow = indexRow[j];
     733            CoinFactorizationDouble result = region[iRow];
     734            CoinFactorizationDouble value = element[j];
     735            region[iRow] = result - value * pivotValue;
     736          }
     737#else
     738          CoinAbcScatterUpdate(end - start, pivotValue, element + start, indexRow + start, region);
     739#endif
     740        }
     741#if ABC_SMALL < 3
     742        regionIndex[numberNonZero++] = i;
    728743      } else {
    729         region[i] = 0.0;
    730 #endif
    731       }       
    732     }
    733   }     
     744        region[i] = 0.0;
     745#endif
     746      }
     747    }
     748  }
    734749  // and dense
    735 #if ABC_SMALL<3
    736   for (CoinSimplexInt k = last; k < numberRows_; k++ ) {
     750#if ABC_SMALL < 3
     751  for (CoinSimplexInt k = last; k < numberRows_; k++) {
    737752#ifndef ABC_ORDERED_FACTORIZATION
    738     CoinSimplexInt i=pivotLOrder[k];
    739 #else
    740     CoinSimplexInt i=k;
    741 #endif
    742     CoinExponent expValue=ABC_EXPONENT(region[i]);
     753    CoinSimplexInt i = pivotLOrder[k];
     754#else
     755    CoinSimplexInt i = k;
     756#endif
     757    CoinExponent expValue = ABC_EXPONENT(region[i]);
    743758    if (expValue) {
    744759      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    745         regionIndex[numberNonZero++] = i;
     760        regionIndex[numberNonZero++] = i;
    746761      } else {
    747         region[i] = 0.0;
    748       }       
    749     }
    750   }     
    751   regionSparse->setNumElements ( numberNonZero );
     762        region[i] = 0.0;
     763      }
     764    }
     765  }
     766  regionSparse->setNumElements(numberNonZero);
    752767#endif
    753768  instrument_end();
    754769}
    755770// Updates part of column (FTRANL) when dense
    756 void
    757 CoinAbcTypeFactorization::updateColumnLDense ( CoinIndexedVector * regionSparse) const
    758 {
    759   CoinSimplexInt * COIN_RESTRICT regionIndex=regionSparse->getIndices();
    760   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
    761   CoinSimplexInt number = regionSparse->getNumElements (  );
    762 #if ABC_SMALL<3
     771void CoinAbcTypeFactorization::updateColumnLDense(CoinIndexedVector *regionSparse) const
     772{
     773  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     774  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     775  CoinSimplexInt number = regionSparse->getNumElements();
     776#if ABC_SMALL < 3
    763777  CoinSimplexInt numberNonZero = 0;
    764778#endif
    765  
    766   const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_;
    767   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_;
    768   const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_;
    769   const CoinSimplexInt * COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
    770   const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
     779
     780  const CoinBigIndex *COIN_RESTRICT startColumn = startColumnLAddress_;
     781  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowLAddress_;
     782  const CoinFactorizationDouble *COIN_RESTRICT element = elementLAddress_;
     783  const CoinSimplexInt *COIN_RESTRICT pivotLOrder = pivotLOrderAddress_;
     784  const CoinSimplexInt *COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
    771785  CoinSimplexInt last = numberRows_;
    772   assert ( last == baseL_ + numberL_);
    773 #if ABC_DENSE_CODE>0
     786  assert(last == baseL_ + numberL_);
     787#if ABC_DENSE_CODE > 0
    774788  //can take out last bit of sparse L as empty
    775789  last -= numberDense_;
     
    777791  CoinSimplexInt smallestIndex = numberRowsExtra_;
    778792  // do easy ones
    779   for (CoinSimplexInt k=0;k<number;k++) {
    780     CoinSimplexInt iPivot=regionIndex[k];
     793  for (CoinSimplexInt k = 0; k < number; k++) {
     794    CoinSimplexInt iPivot = regionIndex[k];
    781795#ifndef ABC_ORDERED_FACTORIZATION
    782     CoinSimplexInt jPivot=pivotLBackwardOrder[iPivot];
    783 #else
    784     CoinSimplexInt jPivot=iPivot;
    785 #endif
    786 #if ABC_SMALL<3
    787     if (jPivot>=baseL_)
    788       smallestIndex = CoinMin(jPivot,smallestIndex);
     796    CoinSimplexInt jPivot = pivotLBackwardOrder[iPivot];
     797#else
     798    CoinSimplexInt jPivot = iPivot;
     799#endif
     800#if ABC_SMALL < 3
     801    if (jPivot >= baseL_)
     802      smallestIndex = CoinMin(jPivot, smallestIndex);
    789803    else
    790       regionIndex[numberNonZero++]=iPivot;
    791 #else
    792     if (jPivot>=baseL_)
    793       smallestIndex = CoinMin(jPivot,smallestIndex);
    794 #endif     
    795   }
    796   instrument_start("CoinAbcFactorizationUpdateLDensish",number+(last-smallestIndex));
     804      regionIndex[numberNonZero++] = iPivot;
     805#else
     806    if (jPivot >= baseL_)
     807      smallestIndex = CoinMin(jPivot, smallestIndex);
     808#endif
     809  }
     810  instrument_start("CoinAbcFactorizationUpdateLDensish", number + (last - smallestIndex));
    797811  // now others
    798   for (CoinSimplexInt k = smallestIndex; k < last; k++ ) {
     812  for (CoinSimplexInt k = smallestIndex; k < last; k++) {
    799813#ifndef ABC_ORDERED_FACTORIZATION
    800     CoinSimplexInt i=pivotLOrder[k];
    801 #else
    802     CoinSimplexInt i=k;
    803 #endif
    804     CoinExponent expValue=ABC_EXPONENT(region[i]);
     814    CoinSimplexInt i = pivotLOrder[k];
     815#else
     816    CoinSimplexInt i = k;
     817#endif
     818    CoinExponent expValue = ABC_EXPONENT(region[i]);
    805819    if (expValue) {
    806820      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    807         CoinBigIndex start = startColumn[k];
    808         CoinBigIndex end = startColumn[k + 1];
    809         instrument_add(end-start);
    810         if (TEST_INT_NONZERO(end-start)) {
    811           CoinFactorizationDouble pivotValue = region[i];
     821        CoinBigIndex start = startColumn[k];
     822        CoinBigIndex end = startColumn[k + 1];
     823        instrument_add(end - start);
     824        if (TEST_INT_NONZERO(end - start)) {
     825          CoinFactorizationDouble pivotValue = region[i];
    812826#ifndef INLINE_IT
    813           for (CoinBigIndex j = start; j < end; j ++ ) {
    814             CoinSimplexInt iRow = indexRow[j];
    815             CoinFactorizationDouble result = region[iRow];
    816             CoinFactorizationDouble value = element[j];
    817             region[iRow] = result - value * pivotValue;
    818           }     
    819 #else
    820           CoinAbcScatterUpdate(end-start,pivotValue,element+start,indexRow+start,region);
    821 #endif
    822         }
    823 #if ABC_SMALL<3
    824         regionIndex[numberNonZero++] = i;
     827          for (CoinBigIndex j = start; j < end; j++) {
     828            CoinSimplexInt iRow = indexRow[j];
     829            CoinFactorizationDouble result = region[iRow];
     830            CoinFactorizationDouble value = element[j];
     831            region[iRow] = result - value * pivotValue;
     832          }
     833#else
     834          CoinAbcScatterUpdate(end - start, pivotValue, element + start, indexRow + start, region);
     835#endif
     836        }
     837#if ABC_SMALL < 3
     838        regionIndex[numberNonZero++] = i;
    825839      } else {
    826         region[i] = 0.0;
    827 #endif
    828       }       
    829     }
    830   }     
     840        region[i] = 0.0;
     841#endif
     842      }
     843    }
     844  }
    831845  // and dense
    832 #if ABC_SMALL<3
    833   for (CoinSimplexInt k = last; k < numberRows_; k++ ) {
     846#if ABC_SMALL < 3
     847  for (CoinSimplexInt k = last; k < numberRows_; k++) {
    834848#ifndef ABC_ORDERED_FACTORIZATION
    835     CoinSimplexInt i=pivotLOrder[k];
    836 #else
    837     CoinSimplexInt i=k;
    838 #endif
    839     CoinExponent expValue=ABC_EXPONENT(region[i]);
     849    CoinSimplexInt i = pivotLOrder[k];
     850#else
     851    CoinSimplexInt i = k;
     852#endif
     853    CoinExponent expValue = ABC_EXPONENT(region[i]);
    840854    if (expValue) {
    841855      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    842         regionIndex[numberNonZero++] = i;
     856        regionIndex[numberNonZero++] = i;
    843857      } else {
    844         region[i] = 0.0;
    845       }       
    846     }
    847   }     
    848   regionSparse->setNumElements ( numberNonZero );
     858        region[i] = 0.0;
     859      }
     860    }
     861  }
     862  regionSparse->setNumElements(numberNonZero);
    849863#endif
    850864  instrument_end();
    851865}
    852 #if ABC_SMALL<2
     866#if ABC_SMALL < 2
    853867// Updates part of column (FTRANL) when sparse
    854 void
    855 CoinAbcTypeFactorization::updateColumnLSparse ( CoinIndexedVector * regionSparse
    856 #if ABC_PARALLEL
    857                                                 ,int whichSparse
    858 #endif
    859                                                 ) const
    860 {
    861   CoinSimplexInt * COIN_RESTRICT regionIndex=regionSparse->getIndices();
    862   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
    863   CoinSimplexInt number = regionSparse->getNumElements (  );
     868void CoinAbcTypeFactorization::updateColumnLSparse(CoinIndexedVector *regionSparse
     869#if ABC_PARALLEL
     870  ,
     871  int whichSparse
     872#endif
     873  ) const
     874{
     875  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     876  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     877  CoinSimplexInt number = regionSparse->getNumElements();
    864878  CoinSimplexInt numberNonZero;
    865  
     879
    866880  numberNonZero = 0;
    867  
    868   const CoinBigIndex * COIN_RESTRICT startColumn = startColumnLAddress_;
    869   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowLAddress_;
    870   const CoinFactorizationDouble * COIN_RESTRICT element = elementLAddress_;
    871   const CoinSimplexInt * COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
     881
     882  const CoinBigIndex *COIN_RESTRICT startColumn = startColumnLAddress_;
     883  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowLAddress_;
     884  const CoinFactorizationDouble *COIN_RESTRICT element = elementLAddress_;
     885  const CoinSimplexInt *COIN_RESTRICT pivotLBackwardOrder = permuteAddress_;
    872886  CoinSimplexInt nList;
    873887  // use sparse_ as temporary area
    874888  // need to redo if this fails (just means using CoinAbcStack to compute sizes)
    875   assert (sizeof(CoinSimplexInt)==sizeof(CoinBigIndex));
    876   CoinAbcStack * COIN_RESTRICT stackList = reinterpret_cast<CoinAbcStack *>(sparseAddress_);
    877   CoinSimplexInt * COIN_RESTRICT list = listAddress_;
     889  assert(sizeof(CoinSimplexInt) == sizeof(CoinBigIndex));
     890  CoinAbcStack *COIN_RESTRICT stackList = reinterpret_cast< CoinAbcStack * >(sparseAddress_);
     891  CoinSimplexInt *COIN_RESTRICT list = listAddress_;
    878892#define DO_CHAR1 1
    879893#if DO_CHAR1 // CHAR
    880   CoinCheckZero * COIN_RESTRICT mark = markRowAddress_;
     894  CoinCheckZero *COIN_RESTRICT mark = markRowAddress_;
    881895#else
    882896  //BIT
    883   CoinSimplexUnsignedInt * COIN_RESTRICT mark = reinterpret_cast<CoinSimplexUnsignedInt *>
    884     (markRowAddress_);
     897  CoinSimplexUnsignedInt *COIN_RESTRICT mark = reinterpret_cast< CoinSimplexUnsignedInt * >(markRowAddress_);
    885898#endif
    886899#if ABC_PARALLEL
     
    888901  if (whichSparse) {
    889902    //printf("alternative sparse\n");
    890     int addAmount=whichSparse*sizeSparseArray_;
    891     stackList=reinterpret_cast<CoinAbcStack *>(reinterpret_cast<char *>(stackList)+addAmount);
    892     list=reinterpret_cast<CoinSimplexInt *>(reinterpret_cast<char *>(list)+addAmount);
     903    int addAmount = whichSparse * sizeSparseArray_;
     904    stackList = reinterpret_cast< CoinAbcStack * >(reinterpret_cast< char * >(stackList) + addAmount);
     905    list = reinterpret_cast< CoinSimplexInt * >(reinterpret_cast< char * >(list) + addAmount);
    893906#if DO_CHAR1 // CHAR
    894     mark=reinterpret_cast<CoinCheckZero *>(reinterpret_cast<char *>(mark)+addAmount);
    895 #else
    896     mark=reinterpret_cast<CoinSimplexUnsignedInt *>(reinterpret_cast<char *>(mark)+addAmount);
     907    mark = reinterpret_cast< CoinCheckZero * >(reinterpret_cast< char * >(mark) + addAmount);
     908#else
     909    mark = reinterpret_cast< CoinSimplexUnsignedInt * >(reinterpret_cast< char * >(mark) + addAmount);
    897910#endif
    898911  }
     
    901914#ifdef COIN_DEBUG
    902915#if DO_CHAR1 // CHAR
    903   for (CoinSimplexInt i=0;i<maximumRowsExtra_;i++) {
    904     assert (!mark[i]);
     916  for (CoinSimplexInt i = 0; i < maximumRowsExtra_; i++) {
     917    assert(!mark[i]);
    905918  }
    906919#else
    907920  //BIT
    908   for (CoinSimplexInt i=0;i<numberRows_>>COINFACTORIZATION_SHIFT_PER_INT;i++) {
    909     assert (!mark[i]);
    910   }
    911 #endif
    912 #endif
    913   nList=0;
    914   for (CoinSimplexInt k=0;k<number;k++) {
    915     CoinSimplexInt kPivot=regionIndex[k];
     921  for (CoinSimplexInt i = 0; i< numberRows_ >> COINFACTORIZATION_SHIFT_PER_INT; i++) {
     922    assert(!mark[i]);
     923  }
     924#endif
     925#endif
     926  nList = 0;
     927  for (CoinSimplexInt k = 0; k < number; k++) {
     928    CoinSimplexInt kPivot = regionIndex[k];
    916929#ifndef ABC_ORDERED_FACTORIZATION
    917     CoinSimplexInt iPivot=pivotLBackwardOrder[kPivot];
    918 #else
    919     CoinSimplexInt iPivot=kPivot;
    920 #endif
    921     if (iPivot>=baseL_) {
     930    CoinSimplexInt iPivot = pivotLBackwardOrder[kPivot];
     931#else
     932    CoinSimplexInt iPivot = kPivot;
     933#endif
     934    if (iPivot >= baseL_) {
    922935#if DO_CHAR1 // CHAR
    923936      CoinCheckZero mark_k = mark[kPivot];
     
    925938      CoinSimplexUnsignedInt wordK = kPivot >> COINFACTORIZATION_SHIFT_PER_INT;
    926939      CoinSimplexUnsignedInt bitK = (kPivot & COINFACTORIZATION_MASK_PER_INT);
    927       CoinSimplexUnsignedInt mark_k=(mark[wordK]>>bitK)&1;
    928 #endif
    929       if(!mark_k) {
    930         CoinBigIndex j=startColumn[iPivot+1]-1;
    931         stackList[0].stack=kPivot;
    932         CoinBigIndex start=startColumn[iPivot];
    933         stackList[0].next=j;
    934         stackList[0].start=start;
    935         CoinSimplexInt nStack=0;
    936         while (nStack>=0) {
    937           /* take off stack */
     940      CoinSimplexUnsignedInt mark_k = (mark[wordK] >> bitK) & 1;
     941#endif
     942      if (!mark_k) {
     943        CoinBigIndex j = startColumn[iPivot + 1] - 1;
     944        stackList[0].stack = kPivot;
     945        CoinBigIndex start = startColumn[iPivot];
     946        stackList[0].next = j;
     947        stackList[0].start = start;
     948        CoinSimplexInt nStack = 0;
     949        while (nStack >= 0) {
     950          /* take off stack */
    938951#ifndef ABC_ORDERED_FACTORIZATION
    939           iPivot=pivotLBackwardOrder[kPivot]; // put startColumn on stackstuff
    940 #else
    941           iPivot=kPivot;
     952          iPivot = pivotLBackwardOrder[kPivot]; // put startColumn on stackstuff
     953#else
     954          iPivot = kPivot;
    942955#endif
    943956#if 1 //0 // what went wrong??
    944           CoinBigIndex startThis=startColumn[iPivot];
    945           for (;j>=startThis;j--) {
    946             CoinSimplexInt jPivot=indexRow[j];
     957          CoinBigIndex startThis = startColumn[iPivot];
     958          for (; j >= startThis; j--) {
     959            CoinSimplexInt jPivot = indexRow[j];
    947960#if DO_CHAR1 // CHAR
    948             CoinCheckZero mark_j = mark[jPivot];
    949 #else
    950             CoinSimplexUnsignedInt word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT;
    951             CoinSimplexUnsignedInt bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT);
    952             CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&1;
    953 #endif
    954             if (!mark_j) {
     961            CoinCheckZero mark_j = mark[jPivot];
     962#else
     963            CoinSimplexUnsignedInt word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT;
     964            CoinSimplexUnsignedInt bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT);
     965            CoinSimplexUnsignedInt mark_j = (mark[word0] >> bit0) & 1;
     966#endif
     967            if (!mark_j) {
    955968#if DO_CHAR1 // CHAR
    956               mark[jPivot]=1;
    957 #else
    958               mark[word0]|=(1<<bit0);
    959 #endif
    960               /* and new one */
    961               kPivot=jPivot;
    962               break;
    963             }
    964           }
    965           if (j>=startThis) {
    966             /* put back on stack */
    967             stackList[nStack].next =j-1;
     969              mark[jPivot] = 1;
     970#else
     971              mark[word0] |= (1 << bit0);
     972#endif
     973              /* and new one */
     974              kPivot = jPivot;
     975              break;
     976            }
     977          }
     978          if (j >= startThis) {
     979            /* put back on stack */
     980            stackList[nStack].next = j - 1;
    968981#ifndef ABC_ORDERED_FACTORIZATION
    969             iPivot=pivotLBackwardOrder[kPivot];
    970 #else
    971             iPivot=kPivot;
    972 #endif
    973             j = startColumn[iPivot+1]-1;
    974             nStack++;
    975             stackList[nStack].stack=kPivot;
    976             assert (kPivot<numberRowsExtra_);
    977             CoinBigIndex start=startColumn[iPivot];
    978             stackList[nStack].next=j;
    979             stackList[nStack].start=start;
    980 #else
    981           if (j>=startColumn[iPivot]/*stackList[nStack].start*/) {
    982             CoinSimplexInt jPivot=indexRow[j--];
    983             /* put back on stack */
    984             stackList[nStack].next =j;
     982            iPivot = pivotLBackwardOrder[kPivot];
     983#else
     984            iPivot = kPivot;
     985#endif
     986            j = startColumn[iPivot + 1] - 1;
     987            nStack++;
     988            stackList[nStack].stack = kPivot;
     989            assert(kPivot < numberRowsExtra_);
     990            CoinBigIndex start = startColumn[iPivot];
     991            stackList[nStack].next = j;
     992            stackList[nStack].start = start;
     993#else
     994          if (j >= startColumn[iPivot] /*stackList[nStack].start*/) {
     995            CoinSimplexInt jPivot = indexRow[j--];
     996            /* put back on stack */
     997            stackList[nStack].next = j;
    985998#if DO_CHAR1 // CHAR
    986             CoinCheckZero mark_j = mark[jPivot];
    987 #else
    988             CoinSimplexUnsignedInt word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT;
    989             CoinSimplexUnsignedInt bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT);
    990             CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&1;
    991 #endif
    992             if (!mark_j) {
    993               /* and new one */
    994               kPivot=jPivot;
     999            CoinCheckZero mark_j = mark[jPivot];
     1000#else
     1001            CoinSimplexUnsignedInt word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT;
     1002            CoinSimplexUnsignedInt bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT);
     1003            CoinSimplexUnsignedInt mark_j = (mark[word0] >> bit0) & 1;
     1004#endif
     1005            if (!mark_j) {
     1006              /* and new one */
     1007              kPivot = jPivot;
    9951008#ifndef ABC_ORDERED_FACTORIZATION
    996               iPivot=pivotLBackwardOrder[kPivot];
    997 #else
    998               iPivot=kPivot;
    999 #endif
    1000               j = startColumn[iPivot+1]-1;
    1001               nStack++;
    1002               stackList[nStack].stack=kPivot;
    1003               assert (kPivot<numberRowsExtra_);
    1004               CoinBigIndex start=startColumn[iPivot];
    1005               stackList[nStack].next=j;
    1006               stackList[nStack].start=start;
     1009              iPivot = pivotLBackwardOrder[kPivot];
     1010#else
     1011              iPivot = kPivot;
     1012#endif
     1013              j = startColumn[iPivot + 1] - 1;
     1014              nStack++;
     1015              stackList[nStack].stack = kPivot;
     1016              assert(kPivot < numberRowsExtra_);
     1017              CoinBigIndex start = startColumn[iPivot];
     1018              stackList[nStack].next = j;
     1019              stackList[nStack].start = start;
    10071020#if DO_CHAR1 // CHAR
    1008               mark[jPivot]=1;
    1009 #else
    1010               mark[word0]|=(1<<bit0);
    1011 #endif
    1012             }
    1013 #endif
    1014           } else {
    1015             /* finished so mark */
    1016             list[nList++]=kPivot;
     1021              mark[jPivot] = 1;
     1022#else
     1023              mark[word0] |= (1 << bit0);
     1024#endif
     1025            }
     1026#endif
     1027          } else {
     1028            /* finished so mark */
     1029            list[nList++] = kPivot;
    10171030#if DO_CHAR1 // CHAR
    1018             mark[kPivot]=1;
    1019 #else
    1020             CoinSimplexUnsignedInt wordB = kPivot >> COINFACTORIZATION_SHIFT_PER_INT;
    1021             CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT);
    1022             mark[wordB]|=(1<<bitB);
    1023 #endif
    1024             --nStack;
    1025             if (nStack>=0) {
    1026               kPivot=stackList[nStack].stack;
     1031            mark[kPivot] = 1;
     1032#else
     1033            CoinSimplexUnsignedInt wordB = kPivot >> COINFACTORIZATION_SHIFT_PER_INT;
     1034            CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT);
     1035            mark[wordB] |= (1 << bitB);
     1036#endif
     1037            --nStack;
     1038            if (nStack >= 0) {
     1039              kPivot = stackList[nStack].stack;
    10271040#ifndef ABC_ORDERED_FACTORIZATION
    1028               iPivot=pivotLBackwardOrder[kPivot];
    1029 #else
    1030               iPivot=kPivot;
    1031 #endif
    1032               assert (kPivot<numberRowsExtra_);
    1033               j=stackList[nStack].next;
    1034             }
    1035           }
    1036         }
     1041              iPivot = pivotLBackwardOrder[kPivot];
     1042#else
     1043              iPivot = kPivot;
     1044#endif
     1045              assert(kPivot < numberRowsExtra_);
     1046              j = stackList[nStack].next;
     1047            }
     1048          }
     1049        }
    10371050      }
    10381051    } else {
    10391052      if (!TEST_LESS_THAN_TOLERANCE(region[kPivot])) {
    1040         // just put on list
    1041         regionIndex[numberNonZero++]=kPivot;
     1053        // just put on list
     1054        regionIndex[numberNonZero++] = kPivot;
    10421055      } else {
    1043         region[kPivot]=0.0;
     1056        region[kPivot] = 0.0;
    10441057      }
    10451058    }
     
    10691082  }
    10701083#endif
    1071   instrument_start("CoinAbcFactorizationUpdateLSparse",number+nList);
     1084  instrument_start("CoinAbcFactorizationUpdateLSparse", number + nList);
    10721085#if 0 //ndef NDEBUG
    10731086  char * test = new char[numberRows_];
     
    10901103  delete [] test;
    10911104#endif
    1092   for (CoinSimplexInt i=nList-1;i>=0;i--) {
     1105  for (CoinSimplexInt i = nList - 1; i >= 0; i--) {
    10931106    CoinSimplexInt iPivot = list[i];
    10941107#ifndef ABC_ORDERED_FACTORIZATION
    1095     CoinSimplexInt kPivot=pivotLBackwardOrder[iPivot];
    1096 #else
    1097     CoinSimplexInt kPivot=iPivot;
     1108    CoinSimplexInt kPivot = pivotLBackwardOrder[iPivot];
     1109#else
     1110    CoinSimplexInt kPivot = iPivot;
    10981111#endif
    10991112#if DO_CHAR1 // CHAR
    1100     mark[iPivot]=0;
     1113    mark[iPivot] = 0;
    11011114#else
    11021115    CoinSimplexUnsignedInt word0 = iPivot >> COINFACTORIZATION_SHIFT_PER_INT;
    11031116    //CoinSimplexUnsignedInt bit0 = (iPivot & COINFACTORIZATION_MASK_PER_INT);
    11041117    //mark[word0]&=(~(1<<bit0));
    1105     mark[word0]=0;
    1106 #endif
    1107     if ( !TEST_LESS_THAN_TOLERANCE( region[iPivot] ) ) {
     1118    mark[word0] = 0;
     1119#endif
     1120    if (!TEST_LESS_THAN_TOLERANCE(region[iPivot])) {
    11081121      CoinFactorizationDouble pivotValue = region[iPivot];
    1109       regionIndex[numberNonZero++]=iPivot;
    1110       CoinBigIndex start=startColumn[kPivot];
    1111       CoinBigIndex end=startColumn[kPivot+1];
    1112       instrument_add(end-start);
    1113       if (TEST_INT_NONZERO(end-start)) {
     1122      regionIndex[numberNonZero++] = iPivot;
     1123      CoinBigIndex start = startColumn[kPivot];
     1124      CoinBigIndex end = startColumn[kPivot + 1];
     1125      instrument_add(end - start);
     1126      if (TEST_INT_NONZERO(end - start)) {
    11141127#ifndef INLINE_IT
    1115         for (CoinBigIndex j = start;j < end; j ++ ) {
    1116           CoinSimplexInt iRow = indexRow[j];
    1117           CoinFactorizationDouble value = element[j];
    1118           region[iRow] -= value * pivotValue;
    1119         }
    1120 #else
    1121         CoinAbcScatterUpdate(end-start,pivotValue,element+start,indexRow+start,region);
     1128        for (CoinBigIndex j = start; j < end; j++) {
     1129          CoinSimplexInt iRow = indexRow[j];
     1130          CoinFactorizationDouble value = element[j];
     1131          region[iRow] -= value * pivotValue;
     1132        }
     1133#else
     1134        CoinAbcScatterUpdate(end - start, pivotValue, element + start, indexRow + start, region);
    11221135#endif
    11231136      }
    11241137    } else {
    1125       region[iPivot]=0.0;
     1138      region[iPivot] = 0.0;
    11261139    }
    11271140  }
     
    11331146  }
    11341147#endif
    1135   regionSparse->setNumElements ( numberNonZero );
     1148  regionSparse->setNumElements(numberNonZero);
    11361149  instrument_end_and_adjust(1.3);
    11371150}
     
    11401153extern double twoThresholdX;
    11411154#endif
    1142 CoinSimplexInt 
    1143 CoinAbcTypeFactorization::updateTwoColumnsFT ( CoinIndexedVector & regionFTX,
    1144                                        CoinIndexedVector & regionOtherX)
    1145 {
    1146   CoinIndexedVector * regionFT = &regionFTX;
    1147   CoinIndexedVector * regionOther = &regionOtherX;
     1155CoinSimplexInt
     1156CoinAbcTypeFactorization::updateTwoColumnsFT(CoinIndexedVector &regionFTX,
     1157  CoinIndexedVector &regionOtherX)
     1158{
     1159  CoinIndexedVector *regionFT = &regionFTX;
     1160  CoinIndexedVector *regionOther = &regionOtherX;
    11481161#if ABC_DEBUG
    11491162  regionFT->checkClean();
    11501163  regionOther->checkClean();
    11511164#endif
    1152   toLongArray(regionFT,0);
    1153   toLongArray(regionOther,1);
     1165  toLongArray(regionFT, 0);
     1166  toLongArray(regionOther, 1);
    11541167#ifdef ABC_ORDERED_FACTORIZATION
    11551168  // Permute in for Ftran
     
    11571170  permuteInForFtran(regionOtherX);
    11581171#endif
    1159   CoinSimplexInt numberNonZero=regionOther->getNumElements();
    1160   CoinSimplexInt numberNonZeroFT=regionFT->getNumElements();
     1172  CoinSimplexInt numberNonZero = regionOther->getNumElements();
     1173  CoinSimplexInt numberNonZeroFT = regionFT->getNumElements();
    11611174  //  ******* L
    1162   updateColumnL ( regionFT
    1163 #if ABC_SMALL<2
    1164                   ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    1165 #endif
    1166                   );
    1167   updateColumnL ( regionOther
    1168 #if ABC_SMALL<2
    1169                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    1170 #endif
    1171                   );
     1175  updateColumnL(regionFT
     1176#if ABC_SMALL < 2
     1177    ,
     1178    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     1179#endif
     1180  );
     1181  updateColumnL(regionOther
     1182#if ABC_SMALL < 2
     1183    ,
     1184    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     1185#endif
     1186  );
    11721187  //row bits here
    1173   updateColumnR ( regionFT
    1174 #if ABC_SMALL<2
    1175                   ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    1176 #endif
    1177                   );
    1178   updateColumnR ( regionOther
    1179 #if ABC_SMALL<2
    1180                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    1181 #endif
    1182                   );
    1183   bool doFT=storeFT(regionFT);
     1188  updateColumnR(regionFT
     1189#if ABC_SMALL < 2
     1190    ,
     1191    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     1192#endif
     1193  );
     1194  updateColumnR(regionOther
     1195#if ABC_SMALL < 2
     1196    ,
     1197    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     1198#endif
     1199  );
     1200  bool doFT = storeFT(regionFT);
    11841201  //update counts
    11851202  //  ******* U - see if densish
    1186 #if ABC_SMALL<2
     1203#if ABC_SMALL < 2
    11871204  // Guess at number at end
    1188   CoinSimplexInt goSparse=0;
     1205  CoinSimplexInt goSparse = 0;
    11891206  if (gotSparse()) {
    1190     CoinSimplexInt numberNonZero = (regionOther->getNumElements (  )+
    1191                          regionFT->getNumElements())>>1;
    1192     double average = 0.25*(ftranAverageAfterL_*twiddleFtranFactor1()
    1193                            + ftranFTAverageAfterL_*twiddleFtranFTFactor1());
    1194     assert (average);
    1195     CoinSimplexInt newNumber = static_cast<CoinSimplexInt> (numberNonZero*average);
    1196     if (newNumber< sparseThreshold_)
     1207    CoinSimplexInt numberNonZero = (regionOther->getNumElements() + regionFT->getNumElements()) >> 1;
     1208    double average = 0.25 * (ftranAverageAfterL_ * twiddleFtranFactor1() + ftranFTAverageAfterL_ * twiddleFtranFTFactor1());
     1209    assert(average);
     1210    CoinSimplexInt newNumber = static_cast< CoinSimplexInt >(numberNonZero * average);
     1211    if (newNumber < sparseThreshold_)
    11971212      goSparse = 2;
    11981213  }
    11991214#if FACTORIZATION_STATISTICS
    1200   int twoThreshold=twoThresholdX;
     1215  int twoThreshold = twoThresholdX;
    12011216#else
    12021217#define twoThreshold 1000
     
    12061221#define twoThreshold 1000
    12071222#endif
    1208   if (!goSparse&&numberRows_<twoThreshold) {
    1209     CoinFactorizationDouble * COIN_RESTRICT arrayFT = denseVector (regionFT );
    1210     CoinSimplexInt * COIN_RESTRICT indexFT = regionFT->getIndices();
    1211     CoinFactorizationDouble * COIN_RESTRICT arrayUpdate = denseVector (regionOther);
    1212     CoinSimplexInt * COIN_RESTRICT indexUpdate = regionOther->getIndices();
    1213     updateTwoColumnsUDensish(numberNonZeroFT,arrayFT,indexFT,
    1214                              numberNonZero,arrayUpdate,indexUpdate);
    1215     regionFT->setNumElements ( numberNonZeroFT );
    1216     regionOther->setNumElements ( numberNonZero );
     1223  if (!goSparse && numberRows_ < twoThreshold) {
     1224    CoinFactorizationDouble *COIN_RESTRICT arrayFT = denseVector(regionFT);
     1225    CoinSimplexInt *COIN_RESTRICT indexFT = regionFT->getIndices();
     1226    CoinFactorizationDouble *COIN_RESTRICT arrayUpdate = denseVector(regionOther);
     1227    CoinSimplexInt *COIN_RESTRICT indexUpdate = regionOther->getIndices();
     1228    updateTwoColumnsUDensish(numberNonZeroFT, arrayFT, indexFT,
     1229      numberNonZero, arrayUpdate, indexUpdate);
     1230    regionFT->setNumElements(numberNonZeroFT);
     1231    regionOther->setNumElements(numberNonZero);
    12171232  } else {
    1218     // sparse
    1219     updateColumnU ( regionFT
    1220 #if ABC_SMALL<2
    1221                     , reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    1222 #endif
    1223                     );
    1224     numberNonZeroFT=regionFT->getNumElements();
    1225     updateColumnU ( regionOther
    1226 #if ABC_SMALL<2
    1227                     , reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    1228 #endif
    1229                     );
    1230     numberNonZero=regionOther->getNumElements();
     1233    // sparse
     1234    updateColumnU(regionFT
     1235#if ABC_SMALL < 2
     1236      ,
     1237      reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     1238#endif
     1239    );
     1240    numberNonZeroFT = regionFT->getNumElements();
     1241    updateColumnU(regionOther
     1242#if ABC_SMALL < 2
     1243      ,
     1244      reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     1245#endif
     1246    );
     1247    numberNonZero = regionOther->getNumElements();
    12311248  }
    12321249  fromLongArray(0);
     
    12361253  regionOther->checkClean();
    12371254#endif
    1238   if ( doFT )
     1255  if (doFT)
    12391256    return numberNonZeroFT;
    1240   else 
     1257  else
    12411258    return -numberNonZeroFT;
    12421259}
    12431260// Updates part of 2 columns (FTRANU) real work
    1244 void
    1245 CoinAbcTypeFactorization::updateTwoColumnsUDensish (
    1246                                              CoinSimplexInt & numberNonZero1,
    1247                                              CoinFactorizationDouble * COIN_RESTRICT region1,
    1248                                              CoinSimplexInt * COIN_RESTRICT index1,
    1249                                              CoinSimplexInt & numberNonZero2,
    1250                                              CoinFactorizationDouble * COIN_RESTRICT region2,
    1251                                              CoinSimplexInt * COIN_RESTRICT index2) const
     1261void CoinAbcTypeFactorization::updateTwoColumnsUDensish(
     1262  CoinSimplexInt &numberNonZero1,
     1263  CoinFactorizationDouble *COIN_RESTRICT region1,
     1264  CoinSimplexInt *COIN_RESTRICT index1,
     1265  CoinSimplexInt &numberNonZero2,
     1266  CoinFactorizationDouble *COIN_RESTRICT region2,
     1267  CoinSimplexInt *COIN_RESTRICT index2) const
    12521268{
    12531269#ifdef ABC_USE_FUNCTION_POINTERS
    1254   scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn();
    1255   CoinFactorizationDouble *  COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
    1256 #else
    1257   const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_;
    1258   const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_;
    1259   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_;
    1260   const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_;
     1270  scatterStruct *COIN_RESTRICT scatterPointer = scatterUColumn();
     1271  CoinFactorizationDouble *COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
     1272#else
     1273  const CoinSimplexInt *COIN_RESTRICT numberInColumn = numberInColumnAddress_;
     1274  const CoinBigIndex *COIN_RESTRICT startColumn = startColumnUAddress_;
     1275  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowUAddress_;
     1276  const CoinFactorizationDouble *COIN_RESTRICT element = elementUAddress_;
    12611277#endif
    12621278  CoinSimplexInt numberNonZeroA = 0;
    12631279  CoinSimplexInt numberNonZeroB = 0;
    1264   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    1265   const CoinSimplexInt *  COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_;
    1266   CoinSimplexInt jRow=pivotLinked[numberRows_];
    1267   instrument_start("CoinAbcFactorizationUpdateTwoUDense",2*numberRows_);
     1280  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     1281  const CoinSimplexInt *COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_;
     1282  CoinSimplexInt jRow = pivotLinked[numberRows_];
     1283  instrument_start("CoinAbcFactorizationUpdateTwoUDense", 2 * numberRows_);
    12681284#if 1 //def DONT_USE_SLACKS
    1269   while (jRow!=-1/*lastSlack_*/) {
    1270 #else
    1271     // would need extra code
    1272   while (jRow!=lastSlack_) {
     1285  while (jRow != -1 /*lastSlack_*/) {
     1286#else
     1287  // would need extra code
     1288  while (jRow != lastSlack_) {
    12731289#endif
    12741290    bool nonZero2 = (TEST_DOUBLE_NONZERO(region2[jRow]));
    12751291    bool nonZero1 = (TEST_DOUBLE_NONZERO(region1[jRow]));
    12761292#ifndef ABC_USE_FUNCTION_POINTERS
    1277     int numberIn=numberInColumn[jRow];
    1278 #else
    1279     scatterStruct & COIN_RESTRICT scatter = scatterPointer[jRow];
     1293    int numberIn = numberInColumn[jRow];
     1294#else
     1295    scatterStruct &COIN_RESTRICT scatter = scatterPointer[jRow];
    12801296    CoinSimplexInt numberIn = scatter.number;
    12811297#endif
    1282     if (nonZero1||nonZero2) {
     1298    if (nonZero1 || nonZero2) {
    12831299#ifndef ABC_USE_FUNCTION_POINTERS
    12841300      CoinBigIndex start = startColumn[jRow];
    1285       const CoinFactorizationDouble * COIN_RESTRICT thisElement = element+start;
    1286       const CoinSimplexInt * COIN_RESTRICT thisIndex = indexRow+start;
    1287 #else
    1288       const CoinFactorizationDouble * COIN_RESTRICT thisElement = elementUColumnPlus+scatter.offset;
    1289       const CoinSimplexInt * COIN_RESTRICT thisIndex = reinterpret_cast<const CoinSimplexInt *>(thisElement+numberIn);
     1301      const CoinFactorizationDouble *COIN_RESTRICT thisElement = element + start;
     1302      const CoinSimplexInt *COIN_RESTRICT thisIndex = indexRow + start;
     1303#else
     1304      const CoinFactorizationDouble *COIN_RESTRICT thisElement = elementUColumnPlus + scatter.offset;
     1305      const CoinSimplexInt *COIN_RESTRICT thisIndex = reinterpret_cast< const CoinSimplexInt * >(thisElement + numberIn);
    12901306#endif
    12911307      CoinFactorizationDouble pivotValue2 = region2[jRow];
    12921308      CoinFactorizationDouble pivotMult = pivotRegion[jRow];
    1293       assert (pivotMult);
     1309      assert(pivotMult);
    12941310      CoinFactorizationDouble pivotValue2a = pivotValue2 * pivotMult;
    1295       bool do2 = !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 );
     1311      bool do2 = !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue2);
    12961312      region2[jRow] = 0.0;
    12971313      CoinFactorizationDouble pivotValue1 = region1[jRow];
    12981314      region1[jRow] = 0.0;
    12991315      CoinFactorizationDouble pivotValue1a = pivotValue1 * pivotMult;
    1300       bool do1 = !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue1 );
     1316      bool do1 = !TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue1);
    13011317      if (do2) {
    1302         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2a ) ) {
    1303           region2[jRow]=pivotValue2a;
    1304           index2[numberNonZeroB++]=jRow;
    1305         }
     1318        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue2a)) {
     1319          region2[jRow] = pivotValue2a;
     1320          index2[numberNonZeroB++] = jRow;
     1321        }
    13061322      }
    13071323      if (do1) {
    1308         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue1a ) ) {
    1309           region1[jRow]=pivotValue1a;
    1310           index1[numberNonZeroA++]=jRow;
    1311         }
     1324        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue1a)) {
     1325          region1[jRow] = pivotValue1a;
     1326          index1[numberNonZeroA++] = jRow;
     1327        }
    13121328      }
    13131329      instrument_add(numberIn);
    1314       if (numberIn) { 
    1315         if (do2) {
    1316           if (!do1) {
    1317             // just region 2
    1318             for (CoinBigIndex j=numberIn-1 ; j >=0; j-- ) {
    1319               CoinSimplexInt iRow = thisIndex[j];
    1320               CoinFactorizationDouble value = thisElement[j];
    1321               assert (value);
     1330      if (numberIn) {
     1331        if (do2) {
     1332          if (!do1) {
     1333            // just region 2
     1334            for (CoinBigIndex j = numberIn - 1; j >= 0; j--) {
     1335              CoinSimplexInt iRow = thisIndex[j];
     1336              CoinFactorizationDouble value = thisElement[j];
     1337              assert(value);
    13221338#ifdef NO_LOAD
    1323               region2[iRow] -= value * pivotValue2;
    1324 #else
    1325               CoinFactorizationDouble regionValue2 = region2[iRow];
    1326               region2[iRow] = regionValue2 - value * pivotValue2;
    1327 #endif
    1328             }
    1329           } else {
    1330             // both
    1331             instrument_add(numberIn);
    1332             for (CoinBigIndex j=numberIn-1 ; j >=0; j-- ) {
    1333               CoinSimplexInt iRow = thisIndex[j];
    1334               CoinFactorizationDouble value = thisElement[j];
     1339              region2[iRow] -= value * pivotValue2;
     1340#else
     1341              CoinFactorizationDouble regionValue2 = region2[iRow];
     1342              region2[iRow] = regionValue2 - value * pivotValue2;
     1343#endif
     1344            }
     1345          } else {
     1346            // both
     1347            instrument_add(numberIn);
     1348            for (CoinBigIndex j = numberIn - 1; j >= 0; j--) {
     1349              CoinSimplexInt iRow = thisIndex[j];
     1350              CoinFactorizationDouble value = thisElement[j];
    13351351#ifdef NO_LOAD
    1336               region1[iRow] -= value * pivotValue1;
    1337               region2[iRow] -= value * pivotValue2;
    1338 #else
    1339               CoinFactorizationDouble regionValue1 = region1[iRow];
    1340               CoinFactorizationDouble regionValue2 = region2[iRow];
    1341               region1[iRow] = regionValue1 - value * pivotValue1;
    1342               region2[iRow] = regionValue2 - value * pivotValue2;
    1343 #endif
    1344             }
    1345           }
    1346         } else if (do1 ) {
    1347           // just region 1
    1348           for (CoinBigIndex j=numberIn-1 ; j >=0; j-- ) {
    1349             CoinSimplexInt iRow = thisIndex[j];
    1350             CoinFactorizationDouble value = thisElement[j];
    1351             assert (value);
     1352              region1[iRow] -= value * pivotValue1;
     1353              region2[iRow] -= value * pivotValue2;
     1354#else
     1355              CoinFactorizationDouble regionValue1 = region1[iRow];
     1356              CoinFactorizationDouble regionValue2 = region2[iRow];
     1357              region1[iRow] = regionValue1 - value * pivotValue1;
     1358              region2[iRow] = regionValue2 - value * pivotValue2;
     1359#endif
     1360            }
     1361          }
     1362        } else if (do1) {
     1363          // just region 1
     1364          for (CoinBigIndex j = numberIn - 1; j >= 0; j--) {
     1365            CoinSimplexInt iRow = thisIndex[j];
     1366            CoinFactorizationDouble value = thisElement[j];
     1367            assert(value);
    13521368#ifdef NO_LOAD
    1353             region1[iRow] -= value * pivotValue1;
    1354 #else
    1355             CoinFactorizationDouble regionValue1 = region1[iRow];
    1356             region1[iRow] = regionValue1 - value * pivotValue1;
    1357 #endif
    1358           }
    1359         }
     1369            region1[iRow] -= value * pivotValue1;
     1370#else
     1371            CoinFactorizationDouble regionValue1 = region1[iRow];
     1372            region1[iRow] = regionValue1 - value * pivotValue1;
     1373#endif
     1374          }
     1375        }
    13601376      } else {
    1361         // no elements in column
     1377        // no elements in column
    13621378      }
    13631379    }
    1364     jRow=pivotLinked[jRow];
    1365   }
    1366   numberNonZero1=numberNonZeroA;
    1367   numberNonZero2=numberNonZeroB;
    1368 #if ABC_SMALL<2
     1380    jRow = pivotLinked[jRow];
     1381  }
     1382  numberNonZero1 = numberNonZeroA;
     1383  numberNonZero2 = numberNonZeroB;
     1384#if ABC_SMALL < 2
    13691385  if (factorizationStatistics()) {
    13701386    ftranFTCountAfterU_ += numberNonZeroA;
     
    13751391}
    13761392//  updateColumnU.  Updates part of column (FTRANU)
    1377 void
    1378 CoinAbcTypeFactorization::updateColumnU ( CoinIndexedVector * regionSparse
    1379 #if ABC_SMALL<2
    1380                                           ,CoinAbcStatistics & statistics
    1381 #endif
    1382 #if ABC_PARALLEL
    1383                                           ,int whichSparse
    1384 #endif
    1385                                           ) const
    1386 {
    1387 #if CILK_CONFLICT>0
     1393void CoinAbcTypeFactorization::updateColumnU(CoinIndexedVector *regionSparse
     1394#if ABC_SMALL < 2
     1395  ,
     1396  CoinAbcStatistics &statistics
     1397#endif
     1398#if ABC_PARALLEL
     1399  ,
     1400  int whichSparse
     1401#endif
     1402  ) const
     1403{
     1404#if CILK_CONFLICT > 0
    13881405#if ABC_PARALLEL
    13891406  // for conflicts
    1390 #if CILK_CONFLICT>1
    1391   printf("file %s line %d which %d\n",__FILE__,__LINE__,whichSparse);
    1392 #endif
    1393   abc_assert((cilk_conflict&(1<<whichSparse))==0);
    1394   cilk_conflict |= (1<<whichSparse);
    1395 #else
    1396   abc_assert((cilk_conflict&(1<<0))==0);
    1397   cilk_conflict |= (1<<0);
    1398 #endif
    1399 #endif
    1400 #if ABC_SMALL<2
    1401   CoinSimplexInt numberNonZero = regionSparse->getNumElements (  );
     1407#if CILK_CONFLICT > 1
     1408  printf("file %s line %d which %d\n", __FILE__, __LINE__, whichSparse);
     1409#endif
     1410  abc_assert((cilk_conflict & (1 << whichSparse)) == 0);
     1411  cilk_conflict |= (1 << whichSparse);
     1412#else
     1413  abc_assert((cilk_conflict & (1 << 0)) == 0);
     1414  cilk_conflict |= (1 << 0);
     1415#endif
     1416#endif
     1417#if ABC_SMALL < 2
     1418  CoinSimplexInt numberNonZero = regionSparse->getNumElements();
    14021419  int goSparse;
    14031420  // Guess at number at end
    1404   if (gotSparse()) { 
    1405     double average = statistics.averageAfterU_*twiddleFactor1S();
    1406     assert (average);
    1407     CoinSimplexInt newNumber = static_cast<CoinSimplexInt> (numberNonZero*average);
    1408     if (newNumber< sparseThreshold_)
     1421  if (gotSparse()) {
     1422    double average = statistics.averageAfterU_ * twiddleFactor1S();
     1423    assert(average);
     1424    CoinSimplexInt newNumber = static_cast< CoinSimplexInt >(numberNonZero * average);
     1425    if (newNumber < sparseThreshold_)
    14091426      goSparse = 1;
    1410     else if (numberNonZero*3<numberRows_)
     1427    else if (numberNonZero * 3 < numberRows_)
    14111428      goSparse = 0;
    14121429    else
    14131430      goSparse = -1;
    14141431  } else {
    1415     goSparse=0;
     1432    goSparse = 0;
    14161433  }
    14171434#endif
     
    14191436    // densish
    14201437    updateColumnUDensish(regionSparse);
    1421 #if ABC_SMALL<2
    1422   } else if (goSparse<0) {
     1438#if ABC_SMALL < 2
     1439  } else if (goSparse < 0) {
    14231440    // dense
    14241441    updateColumnUDense(regionSparse);
     
    14271444    updateColumnUSparse(regionSparse
    14281445#if ABC_PARALLEL
    1429                         ,whichSparse
    1430 #endif
    1431                         );
    1432 #endif
    1433   }
    1434 #if ABC_SMALL<2
     1446      ,
     1447      whichSparse
     1448#endif
     1449    );
     1450#endif
     1451  }
     1452#if ABC_SMALL < 2
    14351453  if (factorizationStatistics()) {
    1436     statistics.countAfterU_ += regionSparse->getNumElements (  );
    1437   }
    1438 #endif
    1439 #if CILK_CONFLICT>0
     1454    statistics.countAfterU_ += regionSparse->getNumElements();
     1455  }
     1456#endif
     1457#if CILK_CONFLICT > 0
    14401458#if ABC_PARALLEL
    14411459  // for conflicts
    1442   abc_assert((cilk_conflict&(1<<whichSparse))!=0);
    1443   cilk_conflict &= ~(1<<whichSparse);
    1444 #else
    1445   abc_assert((cilk_conflict&(1<<0))!=0);
    1446   cilk_conflict &= ~(1<<0);
     1460  abc_assert((cilk_conflict & (1 << whichSparse)) != 0);
     1461  cilk_conflict &= ~(1 << whichSparse);
     1462#else
     1463  abc_assert((cilk_conflict & (1 << 0)) != 0);
     1464  cilk_conflict &= ~(1 << 0);
    14471465#endif
    14481466#endif
     
    14501468//#define COUNT_U
    14511469#ifdef COUNT_U
    1452 static int nUDense[12]={0,0,0,0,0,0,0,0,0,0,0,0};
    1453 static int nUSparse[12]={0,0,0,0,0,0,0,0,0,0,0,0};
     1470static int nUDense[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
     1471static int nUSparse[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    14541472#endif
    14551473//  updateColumnU.  Updates part of column (FTRANU)
    14561474// Updates part of column (FTRANU) real work
    1457 void
    1458 CoinAbcTypeFactorization::updateColumnUDensish (  CoinIndexedVector * regionSparse ) const
    1459 {
    1460   instrument_start("CoinAbcFactorizationUpdateUDensish",2*numberRows_);
    1461   CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices();
    1462   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
     1475void CoinAbcTypeFactorization::updateColumnUDensish(CoinIndexedVector *regionSparse) const
     1476{
     1477  instrument_start("CoinAbcFactorizationUpdateUDensish", 2 * numberRows_);
     1478  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     1479  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
    14631480  CoinSimplexInt numberNonZero = 0;
    1464   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     1481  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    14651482#ifdef ABC_USE_FUNCTION_POINTERS
    1466   scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn();
    1467   CoinFactorizationDouble *  COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
    1468 #else
    1469   const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_;
    1470   const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_;
    1471   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_;
    1472   const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_;
    1473 #endif
    1474  
    1475   const CoinSimplexInt *  COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_;
    1476   CoinSimplexInt jRow=pivotLinked[numberRows_];
     1483  scatterStruct *COIN_RESTRICT scatterPointer = scatterUColumn();
     1484  CoinFactorizationDouble *COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
     1485#else
     1486  const CoinSimplexInt *COIN_RESTRICT numberInColumn = numberInColumnAddress_;
     1487  const CoinBigIndex *COIN_RESTRICT startColumn = startColumnUAddress_;
     1488  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowUAddress_;
     1489  const CoinFactorizationDouble *COIN_RESTRICT element = elementUAddress_;
     1490#endif
     1491
     1492  const CoinSimplexInt *COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_;
     1493  CoinSimplexInt jRow = pivotLinked[numberRows_];
    14771494#define ETAS_1 2
    14781495#define TEST_BEFORE
    14791496#ifdef TEST_BEFORE
    1480   CoinExponent expValue=ABC_EXPONENT(region[jRow]);
     1497  CoinExponent expValue = ABC_EXPONENT(region[jRow]);
    14811498#endif
    14821499#ifdef DONT_USE_SLACKS
    1483   while (jRow!=-1/*lastSlack_*/) {
    1484 #else
    1485   while (jRow!=lastSlack_) {
     1500  while (jRow != -1 /*lastSlack_*/) {
     1501#else
     1502  while (jRow != lastSlack_) {
    14861503#endif
    14871504#ifndef TEST_BEFORE
    1488     CoinExponent expValue=ABC_EXPONENT(region[jRow]);
     1505    CoinExponent expValue = ABC_EXPONENT(region[jRow]);
    14891506#endif
    14901507    if (expValue) {
    14911508      if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) {
    1492         CoinFactorizationDouble pivotValue = region[jRow];
    1493 #if ETAS_1>1
    1494         CoinFactorizationDouble pivotValue2 = pivotValue*pivotRegion[jRow];
     1509        CoinFactorizationDouble pivotValue = region[jRow];
     1510#if ETAS_1 > 1
     1511        CoinFactorizationDouble pivotValue2 = pivotValue * pivotRegion[jRow];
    14951512#endif
    14961513#ifndef ABC_USE_FUNCTION_POINTERS
    1497         int number=numberInColumn[jRow];
    1498 #else
    1499         scatterStruct & COIN_RESTRICT scatter = scatterPointer[jRow];
    1500         CoinSimplexInt number = scatter.number;
    1501 #endif
    1502         instrument_add(number);
    1503         if (TEST_INT_NONZERO(number)) {
     1514        int number = numberInColumn[jRow];
     1515#else
     1516        scatterStruct &COIN_RESTRICT scatter = scatterPointer[jRow];
     1517        CoinSimplexInt number = scatter.number;
     1518#endif
     1519        instrument_add(number);
     1520        if (TEST_INT_NONZERO(number)) {
    15041521#ifdef COUNT_U
    1505           {
    1506             int k=numberInColumn[jRow];
    1507             if (k>10)
    1508               k=11;
    1509             nUDense[k]++;
    1510             int kk=0;
    1511             for (int k=0;k<12;k++)
    1512               kk+=nUDense[k];
    1513             if (kk%1000000==0) {
    1514               printf("ZZ");
    1515               for (int k=0;k<12;k++)
    1516                 printf(" %d",nUDense[k]);
    1517               printf("\n");
    1518             }
    1519           }
     1522          {
     1523            int k = numberInColumn[jRow];
     1524            if (k > 10)
     1525              k = 11;
     1526            nUDense[k]++;
     1527            int kk = 0;
     1528            for (int k = 0; k < 12; k++)
     1529              kk += nUDense[k];
     1530            if (kk % 1000000 == 0) {
     1531              printf("ZZ");
     1532              for (int k = 0; k < 12; k++)
     1533                printf(" %d", nUDense[k]);
     1534              printf("\n");
     1535            }
     1536          }
    15201537#endif
    15211538#ifndef ABC_USE_FUNCTION_POINTERS
    1522           CoinBigIndex start = startColumn[jRow];
     1539          CoinBigIndex start = startColumn[jRow];
    15231540#ifndef INLINE_IT
    1524           const CoinFactorizationDouble *  COIN_RESTRICT thisElement = element+start;
    1525           const CoinSimplexInt *  COIN_RESTRICT thisIndex = indexRow+start;
    1526           for (CoinBigIndex j=number-1 ; j >=0; j-- ) {
    1527             CoinSimplexInt iRow = thisIndex[j];
    1528             CoinFactorizationDouble regionValue = region[iRow];
    1529             CoinFactorizationDouble value = thisElement[j];
    1530             assert (value);
    1531             region[iRow] = regionValue - value * pivotValue;
    1532           }
    1533 #else
    1534           CoinAbcScatterUpdate(number,pivotValue,element+start,indexRow+start,region);
    1535 #endif
    1536 #else
    1537           CoinBigIndex start = scatter.offset;
     1541          const CoinFactorizationDouble *COIN_RESTRICT thisElement = element + start;
     1542          const CoinSimplexInt *COIN_RESTRICT thisIndex = indexRow + start;
     1543          for (CoinBigIndex j = number - 1; j >= 0; j--) {
     1544            CoinSimplexInt iRow = thisIndex[j];
     1545            CoinFactorizationDouble regionValue = region[iRow];
     1546            CoinFactorizationDouble value = thisElement[j];
     1547            assert(value);
     1548            region[iRow] = regionValue - value * pivotValue;
     1549          }
     1550#else
     1551          CoinAbcScatterUpdate(number, pivotValue, element + start, indexRow + start, region);
     1552#endif
     1553#else
     1554          CoinBigIndex start = scatter.offset;
    15381555#if ABC_USE_FUNCTION_POINTERS
    1539           (*(scatter.functionPointer))(number,pivotValue,elementUColumnPlus+start,region);
    1540 #else
    1541           CoinAbcScatterUpdate(number,pivotValue,elementUColumnPlus+start,region);
    1542 #endif
    1543 #endif
    1544         }
    1545         CoinSimplexInt kRow=jRow;
    1546         jRow=pivotLinked[jRow];
     1556          (*(scatter.functionPointer))(number, pivotValue, elementUColumnPlus + start, region);
     1557#else
     1558          CoinAbcScatterUpdate(number, pivotValue, elementUColumnPlus + start, region);
     1559#endif
     1560#endif
     1561        }
     1562        CoinSimplexInt kRow = jRow;
     1563        jRow = pivotLinked[jRow];
    15471564#ifdef TEST_BEFORE
    1548         expValue=ABC_EXPONENT(region[jRow]);
    1549 #endif
    1550 #if ETAS_1<2
    1551         pivotValue *= pivotRegion[kRow];
    1552         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) {
    1553           region[kRow]=pivotValue;
    1554           regionIndex[numberNonZero++]=kRow;
    1555         } else {
    1556           region[kRow]=0.0;
    1557         }
    1558 #else
    1559         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ) ) {
    1560           region[kRow]=pivotValue2;
    1561           regionIndex[numberNonZero++]=kRow;
    1562         } else {
    1563           region[kRow]=0.0;
    1564         }
     1565        expValue = ABC_EXPONENT(region[jRow]);
     1566#endif
     1567#if ETAS_1 < 2
     1568        pivotValue *= pivotRegion[kRow];
     1569        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue)) {
     1570          region[kRow] = pivotValue;
     1571          regionIndex[numberNonZero++] = kRow;
     1572        } else {
     1573          region[kRow] = 0.0;
     1574        }
     1575#else
     1576        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue2)) {
     1577          region[kRow] = pivotValue2;
     1578          regionIndex[numberNonZero++] = kRow;
     1579        } else {
     1580          region[kRow] = 0.0;
     1581        }
    15651582#endif
    15661583      } else {
    1567         CoinSimplexInt kRow=jRow;
    1568         jRow=pivotLinked[jRow];
     1584        CoinSimplexInt kRow = jRow;
     1585        jRow = pivotLinked[jRow];
    15691586#ifdef TEST_BEFORE
    1570         expValue=ABC_EXPONENT(region[jRow]);
    1571 #endif
    1572         region[kRow]=0.0;
     1587        expValue = ABC_EXPONENT(region[jRow]);
     1588#endif
     1589        region[kRow] = 0.0;
    15731590      }
    15741591    } else {
    1575       jRow=pivotLinked[jRow];
     1592      jRow = pivotLinked[jRow];
    15761593#ifdef TEST_BEFORE
    1577       expValue=ABC_EXPONENT(region[jRow]);
     1594      expValue = ABC_EXPONENT(region[jRow]);
    15781595#endif
    15791596    }
    15801597  }
    15811598#ifndef DONT_USE_SLACKS
    1582   while (jRow!=-1) {
     1599  while (jRow != -1) {
    15831600#ifndef TEST_BEFORE
    1584     CoinExponent expValue=ABC_EXPONENT(region[jRow]);
     1601    CoinExponent expValue = ABC_EXPONENT(region[jRow]);
    15851602#endif
    15861603    if (expValue) {
    15871604      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    1588 #if SLACK_VALUE==-1
    1589         CoinFactorizationDouble pivotValue = region[jRow];
    1590         assert (pivotRegion[jRow]==SLACK_VALUE);
    1591         region[jRow]=-pivotValue;
    1592 #endif
    1593         regionIndex[numberNonZero++]=jRow;
     1605#if SLACK_VALUE == -1
     1606        CoinFactorizationDouble pivotValue = region[jRow];
     1607        assert(pivotRegion[jRow] == SLACK_VALUE);
     1608        region[jRow] = -pivotValue;
     1609#endif
     1610        regionIndex[numberNonZero++] = jRow;
    15941611      } else {
    1595         region[jRow] = 0.0;
     1612        region[jRow] = 0.0;
    15961613      }
    15971614    }
    1598     jRow=pivotLinked[jRow];
     1615    jRow = pivotLinked[jRow];
    15991616#ifdef TEST_BEFORE
    1600     expValue=ABC_EXPONENT(region[jRow]);
    1601 #endif
    1602   }
    1603 #endif
    1604   regionSparse->setNumElements ( numberNonZero );
     1617    expValue = ABC_EXPONENT(region[jRow]);
     1618#endif
     1619  }
     1620#endif
     1621  regionSparse->setNumElements(numberNonZero);
    16051622  instrument_end();
    16061623}
    16071624//  updateColumnU.  Updates part of column (FTRANU)
    16081625// Updates part of column (FTRANU) real work
    1609 void
    1610 CoinAbcTypeFactorization::updateColumnUDense (  CoinIndexedVector * regionSparse ) const
    1611 {
    1612   instrument_start("CoinAbcFactorizationUpdateUDensish",2*numberRows_);
    1613   CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices();
    1614   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
    1615   const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_;
     1626void CoinAbcTypeFactorization::updateColumnUDense(CoinIndexedVector *regionSparse) const
     1627{
     1628  instrument_start("CoinAbcFactorizationUpdateUDensish", 2 * numberRows_);
     1629  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     1630  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     1631  const CoinSimplexInt *COIN_RESTRICT numberInColumn = numberInColumnAddress_;
    16161632  CoinSimplexInt numberNonZero = 0;
    1617   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    1618  
     1633  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     1634
    16191635#ifdef ABC_USE_FUNCTION_POINTERS
    1620   scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn();
    1621   CoinFactorizationDouble *  COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
    1622 #else
    1623   const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_;
    1624   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_;
    1625   const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_;
    1626 #endif
    1627   const CoinSimplexInt *  COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_;
    1628   CoinSimplexInt jRow=pivotLinked[numberRows_];
     1636  scatterStruct *COIN_RESTRICT scatterPointer = scatterUColumn();
     1637  CoinFactorizationDouble *COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
     1638#else
     1639  const CoinBigIndex *COIN_RESTRICT startColumn = startColumnUAddress_;
     1640  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowUAddress_;
     1641  const CoinFactorizationDouble *COIN_RESTRICT element = elementUAddress_;
     1642#endif
     1643  const CoinSimplexInt *COIN_RESTRICT pivotLinked = pivotLinkedBackwardsAddress_;
     1644  CoinSimplexInt jRow = pivotLinked[numberRows_];
    16291645#define ETAS_1 2
    16301646#define TEST_BEFORE
    16311647#ifdef TEST_BEFORE
    1632   CoinExponent expValue=ABC_EXPONENT(region[jRow]);
     1648  CoinExponent expValue = ABC_EXPONENT(region[jRow]);
    16331649#endif
    16341650  //int ixxxxxx=0;
    16351651#ifdef DONT_USE_SLACKS
    1636   while (jRow!=-1/*lastSlack_*/) {
    1637 #else
    1638   while (jRow!=lastSlack_) {
     1652  while (jRow != -1 /*lastSlack_*/) {
     1653#else
     1654  while (jRow != lastSlack_) {
    16391655#endif
    16401656#if 0
     
    16521668#endif
    16531669#ifndef TEST_BEFORE
    1654     CoinExponent expValue=ABC_EXPONENT(region[jRow]);
     1670    CoinExponent expValue = ABC_EXPONENT(region[jRow]);
    16551671#endif
    16561672    if (expValue) {
    16571673      if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) {
    1658         CoinFactorizationDouble pivotValue = region[jRow];
    1659 #if ETAS_1>1
    1660         CoinFactorizationDouble pivotValue2 = pivotValue*pivotRegion[jRow];
     1674        CoinFactorizationDouble pivotValue = region[jRow];
     1675#if ETAS_1 > 1
     1676        CoinFactorizationDouble pivotValue2 = pivotValue * pivotRegion[jRow];
    16611677#endif
    16621678#ifndef ABC_USE_FUNCTION_POINTERS
    1663         int number=numberInColumn[jRow];
    1664 #else
    1665         scatterStruct & COIN_RESTRICT scatter = scatterPointer[jRow];
    1666         CoinSimplexInt number = scatter.number;
    1667 #endif
    1668         instrument_add(number);
    1669         if (TEST_INT_NONZERO(number)) {
     1679        int number = numberInColumn[jRow];
     1680#else
     1681        scatterStruct &COIN_RESTRICT scatter = scatterPointer[jRow];
     1682        CoinSimplexInt number = scatter.number;
     1683#endif
     1684        instrument_add(number);
     1685        if (TEST_INT_NONZERO(number)) {
    16701686#ifdef COUNT_U
    1671           {
    1672             int k=numberInColumn[jRow];
    1673             if (k>10)
    1674               k=11;
    1675             nUDense[k]++;
    1676             int kk=0;
    1677             for (int k=0;k<12;k++)
    1678               kk+=nUDense[k];
    1679             if (kk%1000000==0) {
    1680               printf("ZZ");
    1681               for (int k=0;k<12;k++)
    1682                 printf(" %d",nUDense[k]);
    1683               printf("\n");
    1684             }
    1685           }
     1687          {
     1688            int k = numberInColumn[jRow];
     1689            if (k > 10)
     1690              k = 11;
     1691            nUDense[k]++;
     1692            int kk = 0;
     1693            for (int k = 0; k < 12; k++)
     1694              kk += nUDense[k];
     1695            if (kk % 1000000 == 0) {
     1696              printf("ZZ");
     1697              for (int k = 0; k < 12; k++)
     1698                printf(" %d", nUDense[k]);
     1699              printf("\n");
     1700            }
     1701          }
    16861702#endif
    16871703#ifndef ABC_USE_FUNCTION_POINTERS
    1688           CoinBigIndex start = startColumn[jRow];
     1704          CoinBigIndex start = startColumn[jRow];
    16891705#ifndef INLINE_IT
    1690           const CoinFactorizationDouble *  COIN_RESTRICT thisElement = element+start;
    1691           const CoinSimplexInt *  COIN_RESTRICT thisIndex = indexRow+start;
    1692           for (CoinBigIndex j=number-1 ; j >=0; j-- ) {
    1693             CoinSimplexInt iRow = thisIndex[j];
    1694             CoinFactorizationDouble regionValue = region[iRow];
    1695             CoinFactorizationDouble value = thisElement[j];
    1696             assert (value);
    1697             region[iRow] = regionValue - value * pivotValue;
    1698           }
    1699 #else
    1700           CoinAbcScatterUpdate(number,pivotValue,element+start,indexRow+start,region);
    1701 #endif
    1702 #else
    1703           CoinBigIndex start = scatter.offset;
     1706          const CoinFactorizationDouble *COIN_RESTRICT thisElement = element + start;
     1707          const CoinSimplexInt *COIN_RESTRICT thisIndex = indexRow + start;
     1708          for (CoinBigIndex j = number - 1; j >= 0; j--) {
     1709            CoinSimplexInt iRow = thisIndex[j];
     1710            CoinFactorizationDouble regionValue = region[iRow];
     1711            CoinFactorizationDouble value = thisElement[j];
     1712            assert(value);
     1713            region[iRow] = regionValue - value * pivotValue;
     1714          }
     1715#else
     1716          CoinAbcScatterUpdate(number, pivotValue, element + start, indexRow + start, region);
     1717#endif
     1718#else
     1719          CoinBigIndex start = scatter.offset;
    17041720#if ABC_USE_FUNCTION_POINTERS
    1705           (*(scatter.functionPointer))(number,pivotValue,elementUColumnPlus+start,region);
    1706 #else
    1707           CoinAbcScatterUpdate(number,pivotValue,elementUColumnPlus+start,region);
    1708 #endif
    1709 #endif
    1710         }
    1711         CoinSimplexInt kRow=jRow;
    1712         jRow=pivotLinked[jRow];
     1721          (*(scatter.functionPointer))(number, pivotValue, elementUColumnPlus + start, region);
     1722#else
     1723          CoinAbcScatterUpdate(number, pivotValue, elementUColumnPlus + start, region);
     1724#endif
     1725#endif
     1726        }
     1727        CoinSimplexInt kRow = jRow;
     1728        jRow = pivotLinked[jRow];
    17131729#ifdef TEST_BEFORE
    1714         expValue=ABC_EXPONENT(region[jRow]);
    1715 #endif
    1716 #if ETAS_1<2
    1717         pivotValue *= pivotRegion[kRow];
    1718         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) {
    1719           region[kRow]=pivotValue;
    1720           regionIndex[numberNonZero++]=kRow;
    1721         } else {
    1722           region[kRow]=0.0;
    1723         }
    1724 #else
    1725         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ) ) {
    1726           region[kRow]=pivotValue2;
    1727           regionIndex[numberNonZero++]=kRow;
    1728         } else {
    1729           region[kRow]=0.0;
    1730         }
     1730        expValue = ABC_EXPONENT(region[jRow]);
     1731#endif
     1732#if ETAS_1 < 2
     1733        pivotValue *= pivotRegion[kRow];
     1734        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue)) {
     1735          region[kRow] = pivotValue;
     1736          regionIndex[numberNonZero++] = kRow;
     1737        } else {
     1738          region[kRow] = 0.0;
     1739        }
     1740#else
     1741        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue2)) {
     1742          region[kRow] = pivotValue2;
     1743          regionIndex[numberNonZero++] = kRow;
     1744        } else {
     1745          region[kRow] = 0.0;
     1746        }
    17311747#endif
    17321748      } else {
    1733         CoinSimplexInt kRow=jRow;
    1734         jRow=pivotLinked[jRow];
     1749        CoinSimplexInt kRow = jRow;
     1750        jRow = pivotLinked[jRow];
    17351751#ifdef TEST_BEFORE
    1736         expValue=ABC_EXPONENT(region[jRow]);
    1737 #endif
    1738         region[kRow]=0.0;
     1752        expValue = ABC_EXPONENT(region[jRow]);
     1753#endif
     1754        region[kRow] = 0.0;
    17391755      }
    17401756    } else {
    1741       jRow=pivotLinked[jRow];
     1757      jRow = pivotLinked[jRow];
    17421758#ifdef TEST_BEFORE
    1743       expValue=ABC_EXPONENT(region[jRow]);
     1759      expValue = ABC_EXPONENT(region[jRow]);
    17441760#endif
    17451761    }
    17461762  }
    17471763#ifndef DONT_USE_SLACKS
    1748   while (jRow!=-1) {
     1764  while (jRow != -1) {
    17491765#ifndef TEST_BEFORE
    1750     CoinExponent expValue=ABC_EXPONENT(region[jRow]);
     1766    CoinExponent expValue = ABC_EXPONENT(region[jRow]);
    17511767#endif
    17521768    if (expValue) {
    17531769      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    1754 #if SLACK_VALUE==-1
    1755         CoinFactorizationDouble pivotValue = region[jRow];
    1756         assert (pivotRegion[jRow]==SLACK_VALUE);
    1757         region[jRow]=-pivotValue;
    1758 #endif
    1759         regionIndex[numberNonZero++]=jRow;
     1770#if SLACK_VALUE == -1
     1771        CoinFactorizationDouble pivotValue = region[jRow];
     1772        assert(pivotRegion[jRow] == SLACK_VALUE);
     1773        region[jRow] = -pivotValue;
     1774#endif
     1775        regionIndex[numberNonZero++] = jRow;
    17601776      } else {
    1761         region[jRow] = 0.0;
     1777        region[jRow] = 0.0;
    17621778      }
    17631779    }
    1764     jRow=pivotLinked[jRow];
     1780    jRow = pivotLinked[jRow];
    17651781#ifdef TEST_BEFORE
    1766     expValue=ABC_EXPONENT(region[jRow]);
    1767 #endif
    1768   }
    1769 #endif
    1770   regionSparse->setNumElements ( numberNonZero );
     1782    expValue = ABC_EXPONENT(region[jRow]);
     1783#endif
     1784  }
     1785#endif
     1786  regionSparse->setNumElements(numberNonZero);
    17711787  instrument_end();
    17721788}
    1773 #if ABC_SMALL<2
     1789#if ABC_SMALL < 2
    17741790//  updateColumnU.  Updates part of column (FTRANU)
    17751791/*
     
    17791795  but that would lead to other inefficiencies.
    17801796*/
    1781 void
    1782 CoinAbcTypeFactorization::updateColumnUSparse ( CoinIndexedVector * regionSparse
    1783 #if ABC_PARALLEL
    1784                                                 ,int whichSparse
    1785 #endif
    1786                                                 ) const
    1787 {
    1788   CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse->getIndices();
    1789   CoinFactorizationDouble * COIN_RESTRICT region = denseVector(regionSparse);
    1790   CoinSimplexInt numberNonZero = regionSparse->getNumElements (  );
     1797void CoinAbcTypeFactorization::updateColumnUSparse(CoinIndexedVector *regionSparse
     1798#if ABC_PARALLEL
     1799  ,
     1800  int whichSparse
     1801#endif
     1802  ) const
     1803{
     1804  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse->getIndices();
     1805  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     1806  CoinSimplexInt numberNonZero = regionSparse->getNumElements();
    17911807  //const CoinBigIndex * COIN_RESTRICT startColumn = startColumnUAddress_;
    17921808  //const CoinSimplexInt * COIN_RESTRICT numberInColumn = numberInColumnAddress_;
    17931809  //const CoinFactorizationDouble * COIN_RESTRICT element = elementUAddress_;
    1794   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     1810  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    17951811  // use sparse_ as temporary area
    17961812  // mark known to be zero
    1797 #define COINFACTORIZATION_SHIFT_PER_INT2 (COINFACTORIZATION_SHIFT_PER_INT-1)
    1798 #define COINFACTORIZATION_MASK_PER_INT2 (COINFACTORIZATION_MASK_PER_INT>>1)
     1813#define COINFACTORIZATION_SHIFT_PER_INT2 (COINFACTORIZATION_SHIFT_PER_INT - 1)
     1814#define COINFACTORIZATION_MASK_PER_INT2 (COINFACTORIZATION_MASK_PER_INT >> 1)
    17991815  // need to redo if this fails (just means using CoinAbcStack to compute sizes)
    1800   assert (sizeof(CoinSimplexInt)==sizeof(CoinBigIndex));
    1801   CoinAbcStack * COIN_RESTRICT stackList = reinterpret_cast<CoinAbcStack *>(sparseAddress_);
    1802   CoinSimplexInt * COIN_RESTRICT list = listAddress_;
     1816  assert(sizeof(CoinSimplexInt) == sizeof(CoinBigIndex));
     1817  CoinAbcStack *COIN_RESTRICT stackList = reinterpret_cast< CoinAbcStack * >(sparseAddress_);
     1818  CoinSimplexInt *COIN_RESTRICT list = listAddress_;
    18031819#ifndef ABC_USE_FUNCTION_POINTERS
    1804   const CoinSimplexInt * COIN_RESTRICT indexRow = indexRowUAddress_;
    1805 #else
    1806   scatterStruct * COIN_RESTRICT scatterPointer = scatterUColumn();
    1807   const CoinFactorizationDouble *  COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
    1808   const CoinSimplexInt *  COIN_RESTRICT indexRow = reinterpret_cast<const CoinSimplexInt *>(elementUColumnPlusAddress_);
     1820  const CoinSimplexInt *COIN_RESTRICT indexRow = indexRowUAddress_;
     1821#else
     1822  scatterStruct *COIN_RESTRICT scatterPointer = scatterUColumn();
     1823  const CoinFactorizationDouble *COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
     1824  const CoinSimplexInt *COIN_RESTRICT indexRow = reinterpret_cast< const CoinSimplexInt * >(elementUColumnPlusAddress_);
    18091825#endif
    18101826  //#define DO_CHAR2 1
    18111827#if DO_CHAR2 // CHAR
    1812   CoinCheckZero * COIN_RESTRICT mark = markRowAddress_;
     1828  CoinCheckZero *COIN_RESTRICT mark = markRowAddress_;
    18131829#else
    18141830  //BIT
    1815   CoinSimplexUnsignedInt * COIN_RESTRICT mark = reinterpret_cast<CoinSimplexUnsignedInt *>
    1816     (markRowAddress_);
     1831  CoinSimplexUnsignedInt *COIN_RESTRICT mark = reinterpret_cast< CoinSimplexUnsignedInt * >(markRowAddress_);
    18171832#endif
    18181833#if ABC_PARALLEL
    18191834  //printf("PP %d %d %s\n",whichSparse,__LINE__,__FILE__);
    18201835  if (whichSparse) {
    1821     int addAmount=whichSparse*sizeSparseArray_;
    1822     stackList=reinterpret_cast<CoinAbcStack *>(reinterpret_cast<char *>(stackList)+addAmount);
    1823     list=reinterpret_cast<CoinSimplexInt *>(reinterpret_cast<char *>(list)+addAmount);
     1836    int addAmount = whichSparse * sizeSparseArray_;
     1837    stackList = reinterpret_cast< CoinAbcStack * >(reinterpret_cast< char * >(stackList) + addAmount);
     1838    list = reinterpret_cast< CoinSimplexInt * >(reinterpret_cast< char * >(list) + addAmount);
    18241839#if DO_CHAR2 // CHAR
    1825     mark=reinterpret_cast<CoinCheckZero *>(reinterpret_cast<char *>(mark)+addAmount);
    1826 #else
    1827     mark=reinterpret_cast<CoinSimplexUnsignedInt *>(reinterpret_cast<char *>(mark)+addAmount);
     1840    mark = reinterpret_cast< CoinCheckZero * >(reinterpret_cast< char * >(mark) + addAmount);
     1841#else
     1842    mark = reinterpret_cast< CoinSimplexUnsignedInt * >(reinterpret_cast< char * >(mark) + addAmount);
    18281843#endif
    18291844  }
     
    18311846#ifdef COIN_DEBUG
    18321847#if DO_CHAR2 // CHAR
    1833   for (CoinSimplexInt i=0;i<maximumRowsExtra_;i++) {
    1834     assert (!mark[i]);
     1848  for (CoinSimplexInt i = 0; i < maximumRowsExtra_; i++) {
     1849    assert(!mark[i]);
    18351850  }
    18361851#else
    18371852  //BIT
    1838   for (CoinSimplexInt i=0;i<numberRows_>>COINFACTORIZATION_SHIFT_PER_INT;i++) {
    1839     assert (!mark[i]);
     1853  for (CoinSimplexInt i = 0; i< numberRows_ >> COINFACTORIZATION_SHIFT_PER_INT; i++) {
     1854    assert(!mark[i]);
    18401855  }
    18411856#endif
     
    18431858  CoinSimplexInt nList = 0;
    18441859  // move slacks to end of stack list
    1845   int * COIN_RESTRICT putLast = list+numberRows_;
    1846   int * COIN_RESTRICT put = putLast;
    1847   for (CoinSimplexInt i=0;i<numberNonZero;i++) {
    1848     CoinSimplexInt kPivot=regionIndex[i];
     1860  int *COIN_RESTRICT putLast = list + numberRows_;
     1861  int *COIN_RESTRICT put = putLast;
     1862  for (CoinSimplexInt i = 0; i < numberNonZero; i++) {
     1863    CoinSimplexInt kPivot = regionIndex[i];
    18491864#if DO_CHAR2 // CHAR
    18501865    CoinCheckZero mark_B = mark[kPivot];
    18511866#else
    18521867    CoinSimplexUnsignedInt wordB = kPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
    1853     CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT2)<<1;
    1854     CoinSimplexUnsignedInt mark_B=(mark[wordB]>>bitB)&3;
     1868    CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT2) << 1;
     1869    CoinSimplexUnsignedInt mark_B = (mark[wordB] >> bitB) & 3;
    18551870#endif
    18561871    if (!mark_B) {
    18571872#if DO_CHAR2 // CHAR
    1858       mark[kPivot]=1;
    1859 #else
    1860       mark[wordB]|=(1<<bitB);
     1873      mark[kPivot] = 1;
     1874#else
     1875      mark[wordB] |= (1 << bitB);
    18611876#endif
    18621877#ifndef ABC_USE_FUNCTION_POINTERS
    1863       CoinBigIndex start=startColumn[kPivot];
    1864       CoinSimplexInt number=numberInColumn[kPivot];
    1865 #else
    1866       scatterStruct & COIN_RESTRICT scatter = scatterPointer[kPivot];
     1878      CoinBigIndex start = startColumn[kPivot];
     1879      CoinSimplexInt number = numberInColumn[kPivot];
     1880#else
     1881      scatterStruct &COIN_RESTRICT scatter = scatterPointer[kPivot];
    18671882      CoinSimplexInt number = scatter.number;
    1868       CoinBigIndex start = (scatter.offset+number)<<1;
    1869 #endif
    1870       stackList[0].stack=kPivot;
    1871       stackList[0].next=start+number;
    1872       stackList[0].start=start;
    1873       CoinSimplexInt nStack=0;
    1874       while (nStack>=0) {
    1875         /* take off stack */
    1876         CoinBigIndex j=stackList[nStack].next-1;
    1877         CoinBigIndex start=stackList[nStack].start;
    1878 #if DO_CHAR2==0 // CHAR
    1879         CoinSimplexUnsignedInt word0;
    1880         CoinSimplexUnsignedInt bit0;
    1881 #endif
    1882         CoinSimplexInt jPivot;
    1883         for (;j>=start;j--) {
    1884           jPivot=indexRow[j];
     1883      CoinBigIndex start = (scatter.offset + number) << 1;
     1884#endif
     1885      stackList[0].stack = kPivot;
     1886      stackList[0].next = start + number;
     1887      stackList[0].start = start;
     1888      CoinSimplexInt nStack = 0;
     1889      while (nStack >= 0) {
     1890        /* take off stack */
     1891        CoinBigIndex j = stackList[nStack].next - 1;
     1892        CoinBigIndex start = stackList[nStack].start;
     1893#if DO_CHAR2 == 0 // CHAR
     1894        CoinSimplexUnsignedInt word0;
     1895        CoinSimplexUnsignedInt bit0;
     1896#endif
     1897        CoinSimplexInt jPivot;
     1898        for (; j >= start; j--) {
     1899          jPivot = indexRow[j];
    18851900#if DO_CHAR2 // CHAR
    1886           CoinCheckZero mark_j = mark[jPivot];
    1887 #else
    1888           word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
    1889           bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT2)<<1;
    1890           CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&3;
    1891 #endif
    1892           if (!mark_j)
    1893             break;
    1894         }
    1895         if (j>=start) {
    1896           /* put back on stack */
    1897           stackList[nStack].next =j;
    1898           /* and new one */
     1901          CoinCheckZero mark_j = mark[jPivot];
     1902#else
     1903          word0 = jPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
     1904          bit0 = (jPivot & COINFACTORIZATION_MASK_PER_INT2) << 1;
     1905          CoinSimplexUnsignedInt mark_j = (mark[word0] >> bit0) & 3;
     1906#endif
     1907          if (!mark_j)
     1908            break;
     1909        }
     1910        if (j >= start) {
     1911          /* put back on stack */
     1912          stackList[nStack].next = j;
     1913          /* and new one */
    18991914#ifndef ABC_USE_FUNCTION_POINTERS
    1900           CoinBigIndex start=startColumn[jPivot];
    1901           CoinSimplexInt number=numberInColumn[jPivot];
    1902 #else
    1903           scatterStruct & COIN_RESTRICT scatter = scatterPointer[jPivot];
    1904           CoinSimplexInt number = scatter.number;
    1905           CoinBigIndex start = (scatter.offset+number)<<1;
    1906 #endif
    1907           if (number) {
    1908             nStack++;
    1909             stackList[nStack].stack=jPivot;
    1910             stackList[nStack].next=start+number;
    1911             stackList[nStack].start=start;
     1915          CoinBigIndex start = startColumn[jPivot];
     1916          CoinSimplexInt number = numberInColumn[jPivot];
     1917#else
     1918          scatterStruct &COIN_RESTRICT scatter = scatterPointer[jPivot];
     1919          CoinSimplexInt number = scatter.number;
     1920          CoinBigIndex start = (scatter.offset + number) << 1;
     1921#endif
     1922          if (number) {
     1923            nStack++;
     1924            stackList[nStack].stack = jPivot;
     1925            stackList[nStack].next = start + number;
     1926            stackList[nStack].start = start;
    19121927#if DO_CHAR2 // CHAR
    1913             mark[jPivot]=1;
    1914 #else
    1915             mark[word0]|=(1<<bit0);
    1916 #endif
    1917           } else {
    1918             // can do at once
     1928            mark[jPivot] = 1;
     1929#else
     1930            mark[word0] |= (1 << bit0);
     1931#endif
     1932          } else {
     1933            // can do at once
    19191934#ifndef NDEBUG
    19201935#if DO_CHAR2 // CHAR
    1921             CoinCheckZero mark_j = mark[jPivot];
    1922 #else
    1923             CoinSimplexUnsignedInt mark_j=(mark[word0]>>bit0)&3;
    1924 #endif
    1925             assert (mark_j!=3);
    1926 #endif
    1927 #if ABC_SMALL<2
    1928             if (!start) {
    1929               // slack - put at end
    1930               --put;
    1931               *put=jPivot;
    1932               assert(pivotRegion[jPivot]==1.0);
    1933             } else {
    1934               list[nList++]=jPivot;
    1935             }
    1936 #else
    1937             list[nList++]=jPivot;
     1936            CoinCheckZero mark_j = mark[jPivot];
     1937#else
     1938            CoinSimplexUnsignedInt mark_j = (mark[word0] >> bit0) & 3;
     1939#endif
     1940            assert(mark_j != 3);
     1941#endif
     1942#if ABC_SMALL < 2
     1943            if (!start) {
     1944              // slack - put at end
     1945              --put;
     1946              *put = jPivot;
     1947              assert(pivotRegion[jPivot] == 1.0);
     1948            } else {
     1949              list[nList++] = jPivot;
     1950            }
     1951#else
     1952            list[nList++] = jPivot;
    19381953#endif
    19391954#if DO_CHAR2 // CHAR
    1940             mark[jPivot]=3;
    1941 #else
    1942             mark[word0]|=(3<<bit0);
    1943 #endif
    1944           }
    1945         } else {
    1946           /* finished so mark */
    1947           CoinSimplexInt kPivot=stackList[nStack].stack;
     1955            mark[jPivot] = 3;
     1956#else
     1957            mark[word0] |= (3 << bit0);
     1958#endif
     1959          }
     1960        } else {
     1961          /* finished so mark */
     1962          CoinSimplexInt kPivot = stackList[nStack].stack;
    19481963#if DO_CHAR2 // CHAR
    1949           CoinCheckZero mark_B = mark[kPivot];
    1950 #else
    1951           CoinSimplexUnsignedInt wordB = kPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
    1952           CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT2)<<1;
    1953           CoinSimplexUnsignedInt mark_B=(mark[wordB]>>bitB)&3;
    1954 #endif
    1955           assert (mark_B!=3);
    1956           //if (mark_B!=3) {
    1957             list[nList++]=kPivot;
     1964          CoinCheckZero mark_B = mark[kPivot];
     1965#else
     1966          CoinSimplexUnsignedInt wordB = kPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
     1967          CoinSimplexUnsignedInt bitB = (kPivot & COINFACTORIZATION_MASK_PER_INT2) << 1;
     1968          CoinSimplexUnsignedInt mark_B = (mark[wordB] >> bitB) & 3;
     1969#endif
     1970          assert(mark_B != 3);
     1971          //if (mark_B!=3) {
     1972          list[nList++] = kPivot;
    19581973#if DO_CHAR2 // CHAR
    1959             mark[kPivot]=3;
    1960 #else
    1961             mark[wordB]|=(3<<bitB);
    1962 #endif
    1963             //}
    1964           --nStack;
    1965         }
     1974          mark[kPivot] = 3;
     1975#else
     1976          mark[wordB] |= (3 << bitB);
     1977#endif
     1978          //}
     1979          --nStack;
     1980        }
    19661981      }
    19671982    }
    19681983  }
    1969   instrument_start("CoinAbcFactorizationUpdateUSparse",numberNonZero+2*nList);
    1970   numberNonZero=0;
    1971   list[-1]=-1;
     1984  instrument_start("CoinAbcFactorizationUpdateUSparse", numberNonZero + 2 * nList);
     1985  numberNonZero = 0;
     1986  list[-1] = -1;
    19721987  //assert (nList);
    1973   for (CoinSimplexInt i=nList-1;i>=0;i--) {
     1988  for (CoinSimplexInt i = nList - 1; i >= 0; i--) {
    19741989    CoinSimplexInt iPivot = list[i];
    1975     CoinExponent expValue=ABC_EXPONENT(region[iPivot]);
     1990    CoinExponent expValue = ABC_EXPONENT(region[iPivot]);
    19761991#if DO_CHAR2 // CHAR
    1977     mark[iPivot]=0;
     1992    mark[iPivot] = 0;
    19781993#else
    19791994    CoinSimplexInt word0 = iPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
    1980     mark[word0]=0;
     1995    mark[word0] = 0;
    19811996#endif
    19821997    if (expValue) {
    19831998      if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) {
    1984         CoinFactorizationDouble pivotValue = region[iPivot];
    1985 #if ETAS_1>1
    1986         CoinFactorizationDouble pivotValue2 = pivotValue*pivotRegion[iPivot];
     1999        CoinFactorizationDouble pivotValue = region[iPivot];
     2000#if ETAS_1 > 1
     2001        CoinFactorizationDouble pivotValue2 = pivotValue * pivotRegion[iPivot];
    19872002#endif
    19882003#ifndef ABC_USE_FUNCTION_POINTERS
    1989         CoinSimplexInt number = numberInColumn[iPivot];
    1990 #else
    1991         scatterStruct & COIN_RESTRICT scatter = scatterPointer[iPivot];
    1992         CoinSimplexInt number = scatter.number;
    1993 #endif
    1994         if (TEST_INT_NONZERO(number)) {
     2004        CoinSimplexInt number = numberInColumn[iPivot];
     2005#else
     2006        scatterStruct &COIN_RESTRICT scatter = scatterPointer[iPivot];
     2007        CoinSimplexInt number = scatter.number;
     2008#endif
     2009        if (TEST_INT_NONZERO(number)) {
    19952010#ifdef COUNT_U
    1996           {
    1997             int k=numberInColumn[iPivot];
    1998             if (k>10)
    1999               k=11;
    2000             nUSparse[k]++;
    2001             int kk=0;
    2002             for (int k=0;k<12;k++)
    2003               kk+=nUSparse[k];
    2004             if (kk%1000000==0) {
    2005               printf("ZZsparse");
    2006               for (int k=0;k<12;k++)
    2007                 printf(" %d",nUSparse[k]);
    2008               printf("\n");
    2009             }
    2010           }
     2011          {
     2012            int k = numberInColumn[iPivot];
     2013            if (k > 10)
     2014              k = 11;
     2015            nUSparse[k]++;
     2016            int kk = 0;
     2017            for (int k = 0; k < 12; k++)
     2018              kk += nUSparse[k];
     2019            if (kk % 1000000 == 0) {
     2020              printf("ZZsparse");
     2021              for (int k = 0; k < 12; k++)
     2022                printf(" %d", nUSparse[k]);
     2023              printf("\n");
     2024            }
     2025          }
    20112026#endif
    20122027#ifndef ABC_USE_FUNCTION_POINTERS
    2013           CoinBigIndex start = startColumn[iPivot];
    2014 #else
    2015           //CoinBigIndex start = startColumn[iPivot];
    2016           CoinBigIndex start = scatter.offset;
    2017 #endif
    2018           instrument_add(number);
     2028          CoinBigIndex start = startColumn[iPivot];
     2029#else
     2030          //CoinBigIndex start = startColumn[iPivot];
     2031          CoinBigIndex start = scatter.offset;
     2032#endif
     2033          instrument_add(number);
    20192034#ifndef INLINE_IT
    2020           CoinBigIndex j;
    2021           for ( j = start; j < start+number; j++ ) {
    2022             CoinFactorizationDouble value = element[j];
    2023             assert (value);
    2024             CoinSimplexInt iRow = indexRow[j];
    2025             region[iRow] -= value * pivotValue;
    2026         }
     2035          CoinBigIndex j;
     2036          for (j = start; j < start + number; j++) {
     2037            CoinFactorizationDouble value = element[j];
     2038            assert(value);
     2039            CoinSimplexInt iRow = indexRow[j];
     2040            region[iRow] -= value * pivotValue;
     2041          }
    20272042#else
    20282043#ifdef ABC_USE_FUNCTION_POINTERS
    20292044#if ABC_USE_FUNCTION_POINTERS
    2030           (*(scatter.functionPointer))(number,pivotValue,elementUColumnPlus+start,region);
    2031 #else
    2032           CoinAbcScatterUpdate(number,pivotValue,elementUColumnPlus+start,region);
    2033 #endif
    2034 #else
    2035           CoinAbcScatterUpdate(number,pivotValue,element+start,indexRow+start,region);
    2036 #endif
    2037 #endif
    2038         }
    2039 #if ETAS_1<2
    2040         pivotValue *= pivotRegion[iPivot];
    2041         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) {
    2042           region[iPivot]=pivotValue;
    2043           regionIndex[numberNonZero++]=iPivot;
    2044         }
    2045 #else
    2046         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue2 ) ) {
    2047           region[iPivot]=pivotValue2;
    2048           regionIndex[numberNonZero++]=iPivot;
    2049         } else {
    2050           region[iPivot]=0.0;
    2051         }
     2045          (*(scatter.functionPointer))(number, pivotValue, elementUColumnPlus + start, region);
     2046#else
     2047          CoinAbcScatterUpdate(number, pivotValue, elementUColumnPlus + start, region);
     2048#endif
     2049#else
     2050          CoinAbcScatterUpdate(number, pivotValue, element + start, indexRow + start, region);
     2051#endif
     2052#endif
     2053        }
     2054#if ETAS_1 < 2
     2055        pivotValue *= pivotRegion[iPivot];
     2056        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue)) {
     2057          region[iPivot] = pivotValue;
     2058          regionIndex[numberNonZero++] = iPivot;
     2059        }
     2060#else
     2061        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue2)) {
     2062          region[iPivot] = pivotValue2;
     2063          regionIndex[numberNonZero++] = iPivot;
     2064        } else {
     2065          region[iPivot] = 0.0;
     2066        }
    20522067#endif
    20532068      } else {
    2054         region[iPivot]=0.0;
     2069        region[iPivot] = 0.0;
    20552070      }
    20562071    }
    20572072  }
    2058 #if ABC_SMALL<2
     2073#if ABC_SMALL < 2
    20592074  // slacks
    2060   for (;put<putLast;put++) {
     2075  for (; put < putLast; put++) {
    20612076    int iPivot = *put;
    2062     CoinExponent expValue=ABC_EXPONENT(region[iPivot]);
     2077    CoinExponent expValue = ABC_EXPONENT(region[iPivot]);
    20632078#if DO_CHAR2 // CHAR
    2064     mark[iPivot]=0;
     2079    mark[iPivot] = 0;
    20652080#else
    20662081    CoinSimplexInt word0 = iPivot >> COINFACTORIZATION_SHIFT_PER_INT2;
    2067     mark[word0]=0;
     2082    mark[word0] = 0;
    20682083#endif
    20692084    if (expValue) {
    20702085      if (!TEST_EXPONENT_LESS_THAN_UPDATE_TOLERANCE(expValue)) {
    2071         CoinFactorizationDouble pivotValue = region[iPivot];
    2072         if ( !TEST_LESS_THAN_TOLERANCE_REGISTER( pivotValue ) ) {
    2073           region[iPivot]=pivotValue;
    2074           regionIndex[numberNonZero++]=iPivot;
    2075         }
     2086        CoinFactorizationDouble pivotValue = region[iPivot];
     2087        if (!TEST_LESS_THAN_TOLERANCE_REGISTER(pivotValue)) {
     2088          region[iPivot] = pivotValue;
     2089          regionIndex[numberNonZero++] = iPivot;
     2090        }
    20762091      } else {
    2077         region[iPivot]=0.0;
     2092        region[iPivot] = 0.0;
    20782093      }
    20792094    }
     
    20812096#endif
    20822097#ifdef COIN_DEBUG
    2083   for (CoinSimplexInt i=0;i<maximumRowsExtra_>>COINFACTORIZATION_SHIFT_PER_INT2;i++) {
    2084     assert (!mark[i]);
    2085   }
    2086 #endif
    2087   regionSparse->setNumElements ( numberNonZero );
     2098  for (CoinSimplexInt i = 0; i< maximumRowsExtra_ >> COINFACTORIZATION_SHIFT_PER_INT2; i++) {
     2099    assert(!mark[i]);
     2100  }
     2101#endif
     2102  regionSparse->setNumElements(numberNonZero);
    20882103  instrument_end_and_adjust(1.3);
    20892104}
    20902105#endif
    20912106// Store update after doing L and R - retuns false if no room
    2092 bool
    2093 CoinAbcTypeFactorization::storeFT(
    2094 #if ABC_SMALL<3
    2095                               const
    2096 #endif
    2097                               CoinIndexedVector * updateFT)
    2098 {
    2099 #if ABC_SMALL<3
    2100   CoinSimplexInt numberNonZero = updateFT->getNumElements (  );
     2107bool CoinAbcTypeFactorization::storeFT(
     2108#if ABC_SMALL < 3
     2109  const
     2110#endif
     2111  CoinIndexedVector *updateFT)
     2112{
     2113#if ABC_SMALL < 3
     2114  CoinSimplexInt numberNonZero = updateFT->getNumElements();
    21012115#else
    21022116  CoinSimplexInt numberNonZero = numberRows_;
    21032117#endif
    21042118#ifndef ABC_USE_FUNCTION_POINTERS
    2105   if (lengthAreaU_>=lastEntryByColumnU_+numberNonZero) {
    2106 #else
    2107     if (lengthAreaUPlus_>=lastEntryByColumnUPlus_+(3*numberNonZero+1)/2) {
    2108     scatterStruct & scatter = scatterUColumn()[numberRows_];
    2109     CoinFactorizationDouble *  COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
    2110 #endif
    2111 #if ABC_SMALL<3
    2112     const CoinFactorizationDouble * COIN_RESTRICT region = denseVector(updateFT);
    2113     const CoinSimplexInt * COIN_RESTRICT regionIndex = updateFT->getIndices();
    2114 #else
    2115     CoinSimplexDouble * COIN_RESTRICT region = updateFT->denseVector (  );
     2119  if (lengthAreaU_ >= lastEntryByColumnU_ + numberNonZero) {
     2120#else
     2121  if (lengthAreaUPlus_ >= lastEntryByColumnUPlus_ + (3 * numberNonZero + 1) / 2) {
     2122    scatterStruct &scatter = scatterUColumn()[numberRows_];
     2123    CoinFactorizationDouble *COIN_RESTRICT elementUColumnPlus = elementUColumnPlusAddress_;
     2124#endif
     2125#if ABC_SMALL < 3
     2126    const CoinFactorizationDouble *COIN_RESTRICT region = denseVector(updateFT);
     2127    const CoinSimplexInt *COIN_RESTRICT regionIndex = updateFT->getIndices();
     2128#else
     2129    CoinSimplexDouble *COIN_RESTRICT region = updateFT->denseVector();
    21162130#endif
    21172131#ifndef ABC_USE_FUNCTION_POINTERS
    2118     CoinBigIndex * COIN_RESTRICT startColumnU = startColumnUAddress_;
     2132    CoinBigIndex *COIN_RESTRICT startColumnU = startColumnUAddress_;
    21192133    //we are going to save at end of U
    2120     startColumnU[numberRows_] = lastEntryByColumnU_; 
    2121     CoinSimplexInt * COIN_RESTRICT putIndex = indexRowUAddress_ + lastEntryByColumnU_;
    2122     CoinFactorizationDouble * COIN_RESTRICT putElement = elementUAddress_ + lastEntryByColumnU_;
    2123 #else
    2124     scatter.offset=lastEntryByColumnUPlus_;
    2125     CoinFactorizationDouble * COIN_RESTRICT putElement = elementUColumnPlus + lastEntryByColumnUPlus_;
    2126     CoinSimplexInt * COIN_RESTRICT putIndex = reinterpret_cast<CoinSimplexInt *>(putElement+numberNonZero);
    2127 #endif
    2128 #if ABC_SMALL<3
    2129     for (CoinSimplexInt i=0;i<numberNonZero;i++) {
     2134    startColumnU[numberRows_] = lastEntryByColumnU_;
     2135    CoinSimplexInt *COIN_RESTRICT putIndex = indexRowUAddress_ + lastEntryByColumnU_;
     2136    CoinFactorizationDouble *COIN_RESTRICT putElement = elementUAddress_ + lastEntryByColumnU_;
     2137#else
     2138    scatter.offset = lastEntryByColumnUPlus_;
     2139    CoinFactorizationDouble *COIN_RESTRICT putElement = elementUColumnPlus + lastEntryByColumnUPlus_;
     2140    CoinSimplexInt *COIN_RESTRICT putIndex = reinterpret_cast< CoinSimplexInt * >(putElement + numberNonZero);
     2141#endif
     2142#if ABC_SMALL < 3
     2143    for (CoinSimplexInt i = 0; i < numberNonZero; i++) {
    21302144      CoinSimplexInt indexValue = regionIndex[i];
    21312145      CoinSimplexDouble value = region[indexValue];
    2132       putElement[i]=value;
    2133       putIndex[i]=indexValue;
    2134     }
    2135 #else
    2136     numberNonZero=0;
    2137     for (CoinSimplexInt i=0;i<numberRows_;i++) {
    2138       CoinExponent expValue=ABC_EXPONENT(region[i]);
     2146      putElement[i] = value;
     2147      putIndex[i] = indexValue;
     2148    }
     2149#else
     2150    numberNonZero = 0;
     2151    for (CoinSimplexInt i = 0; i < numberRows_; i++) {
     2152      CoinExponent expValue = ABC_EXPONENT(region[i]);
    21392153      if (expValue) {
    2140         if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    2141           putElement[numberNonZero]=region[i];
    2142           putIndex[numberNonZero++]=i;
    2143         } else {
    2144           region[i]=0.0;
    2145         }
     2154        if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
     2155          putElement[numberNonZero] = region[i];
     2156          putIndex[numberNonZero++] = i;
     2157        } else {
     2158          region[i] = 0.0;
     2159        }
    21462160      }
    21472161    }
     
    21512165    lastEntryByColumnU_ += numberNonZero;
    21522166#else
    2153     scatter.number=numberNonZero;
     2167    scatter.number = numberNonZero;
    21542168#endif
    21552169    return true;
     
    21582172  }
    21592173}
    2160 CoinSimplexInt CoinAbcTypeFactorization::updateColumnFT ( CoinIndexedVector & regionSparseX)
    2161 {
    2162   CoinIndexedVector * regionSparse = &regionSparseX;
    2163   CoinSimplexInt numberNonZero=regionSparse->getNumElements();
    2164   toLongArray(regionSparse,0);
     2174CoinSimplexInt CoinAbcTypeFactorization::updateColumnFT(CoinIndexedVector &regionSparseX)
     2175{
     2176  CoinIndexedVector *regionSparse = &regionSparseX;
     2177  CoinSimplexInt numberNonZero = regionSparse->getNumElements();
     2178  toLongArray(regionSparse, 0);
    21652179#ifdef ABC_ORDERED_FACTORIZATION
    21662180  // Permute in for Ftran
     
    21702184  //printf("a\n");
    21712185  //regionSparse->checkClean();
    2172   updateColumnL ( regionSparse
    2173 #if ABC_SMALL<2
    2174               ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2175 #endif
    2176                   );
     2186  updateColumnL(regionSparse
     2187#if ABC_SMALL < 2
     2188    ,
     2189    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2190#endif
     2191  );
    21772192  //printf("b\n");
    21782193  //regionSparse->checkClean();
    21792194  //row bits here
    2180   updateColumnR ( regionSparse
    2181 #if ABC_SMALL<2
    2182               ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2183 #endif
    2184 );
     2195  updateColumnR(regionSparse
     2196#if ABC_SMALL < 2
     2197    ,
     2198    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2199#endif
     2200  );
    21852201
    21862202  //printf("c\n");
    21872203  //regionSparse->checkClean();
    2188   bool doFT=storeFT(regionSparse);
     2204  bool doFT = storeFT(regionSparse);
    21892205  //printf("d\n");
    21902206  //regionSparse->checkClean();
    21912207  //update counts
    21922208  //  ******* U
    2193   updateColumnU ( regionSparse
    2194 #if ABC_SMALL<2
    2195               , reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2196 #endif
    2197                   );
     2209  updateColumnU(regionSparse
     2210#if ABC_SMALL < 2
     2211    ,
     2212    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2213#endif
     2214  );
    21982215  //printf("e\n");
    21992216#if ABC_DEBUG
    22002217  regionSparse->checkClean();
    22012218#endif
    2202   numberNonZero=regionSparse->getNumElements();
     2219  numberNonZero = regionSparse->getNumElements();
    22032220  // will be negative if no room
    2204   if ( doFT )
     2221  if (doFT)
    22052222    return numberNonZero;
    22062223  else
    22072224    return -numberNonZero;
    22082225}
    2209 void CoinAbcTypeFactorization::updateColumnFT ( CoinIndexedVector & regionSparseX,
    2210                                                 CoinIndexedVector & partialUpdate,
    2211                                                 int whichSparse)
    2212 {
    2213   CoinIndexedVector * regionSparse = &regionSparseX;
    2214   CoinSimplexInt numberNonZero=regionSparse->getNumElements();
    2215   toLongArray(regionSparse,whichSparse);
     2226void CoinAbcTypeFactorization::updateColumnFT(CoinIndexedVector &regionSparseX,
     2227  CoinIndexedVector &partialUpdate,
     2228  int whichSparse)
     2229{
     2230  CoinIndexedVector *regionSparse = &regionSparseX;
     2231  CoinSimplexInt numberNonZero = regionSparse->getNumElements();
     2232  toLongArray(regionSparse, whichSparse);
    22162233#ifdef ABC_ORDERED_FACTORIZATION
    22172234  // Permute in for Ftran
     
    22212238  //printf("a\n");
    22222239  //regionSparse->checkClean();
    2223   updateColumnL ( regionSparse
    2224 #if ABC_SMALL<2
    2225               ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2226 #endif
    2227 #if ABC_PARALLEL
    2228                                           ,whichSparse
    2229 #endif
    2230                   );
     2240  updateColumnL(regionSparse
     2241#if ABC_SMALL < 2
     2242    ,
     2243    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2244#endif
     2245#if ABC_PARALLEL
     2246      ,
     2247    whichSparse
     2248#endif
     2249  );
    22312250  //printf("b\n");
    22322251  //regionSparse->checkClean();
    22332252  //row bits here
    2234   updateColumnR ( regionSparse
    2235 #if ABC_SMALL<2
    2236               ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2237 #endif
    2238 #if ABC_PARALLEL
    2239                                           ,whichSparse
    2240 #endif
    2241 );
    2242   numberNonZero = regionSparse->getNumElements (  );
    2243   CoinSimplexInt * COIN_RESTRICT indexSave=partialUpdate.getIndices();
    2244   CoinSimplexDouble * COIN_RESTRICT regionSave=partialUpdate.denseVector();
     2253  updateColumnR(regionSparse
     2254#if ABC_SMALL < 2
     2255    ,
     2256    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2257#endif
     2258#if ABC_PARALLEL
     2259      ,
     2260    whichSparse
     2261#endif
     2262  );
     2263  numberNonZero = regionSparse->getNumElements();
     2264  CoinSimplexInt *COIN_RESTRICT indexSave = partialUpdate.getIndices();
     2265  CoinSimplexDouble *COIN_RESTRICT regionSave = partialUpdate.denseVector();
    22452266  partialUpdate.setNumElements(numberNonZero);
    2246   memcpy(indexSave,regionSparse->getIndices(),numberNonZero*sizeof(CoinSimplexInt));
     2267  memcpy(indexSave, regionSparse->getIndices(), numberNonZero * sizeof(CoinSimplexInt));
    22472268  partialUpdate.setPackedMode(false);
    2248   CoinFactorizationDouble * COIN_RESTRICT region=denseVector(regionSparse);
    2249   for (int i=0;i<numberNonZero;i++) {
    2250     int iRow=indexSave[i];
    2251     regionSave[iRow]=region[iRow];
     2269  CoinFactorizationDouble *COIN_RESTRICT region = denseVector(regionSparse);
     2270  for (int i = 0; i < numberNonZero; i++) {
     2271    int iRow = indexSave[i];
     2272    regionSave[iRow] = region[iRow];
    22522273  }
    22532274  //  ******* U
    2254   updateColumnU ( regionSparse
    2255 #if ABC_SMALL<2
    2256               , reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2257 #endif
    2258 #if ABC_PARALLEL
    2259                                           ,whichSparse
    2260 #endif
    2261                   );
     2275  updateColumnU(regionSparse
     2276#if ABC_SMALL < 2
     2277    ,
     2278    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2279#endif
     2280#if ABC_PARALLEL
     2281      ,
     2282    whichSparse
     2283#endif
     2284  );
    22622285  //printf("e\n");
    22632286#if ABC_DEBUG
     
    22652288#endif
    22662289}
    2267  int
    2268   CoinAbcTypeFactorization::updateColumnFTPart1 ( CoinIndexedVector & regionSparse)
    2269 {
    2270   toLongArray(&regionSparse,0);
     2290int CoinAbcTypeFactorization::updateColumnFTPart1(CoinIndexedVector &regionSparse)
     2291{
     2292  toLongArray(&regionSparse, 0);
    22712293#ifdef ABC_ORDERED_FACTORIZATION
    22722294  // Permute in for Ftran
     
    22762298  //  ******* L
    22772299  //regionSparse.checkClean();
    2278   updateColumnL ( &regionSparse
    2279 #if ABC_SMALL<2
    2280               ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2281 #endif
    2282 #if ABC_PARALLEL
    2283                                           ,2
    2284 #endif
    2285                   );
     2300  updateColumnL(&regionSparse
     2301#if ABC_SMALL < 2
     2302    ,
     2303    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2304#endif
     2305#if ABC_PARALLEL
     2306      ,
     2307    2
     2308#endif
     2309  );
    22862310  //regionSparse.checkClean();
    22872311  //row bits here
    2288   updateColumnR ( &regionSparse
    2289 #if ABC_SMALL<2
    2290               ,reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2291 #endif
    2292 #if ABC_PARALLEL
    2293                                           ,2
    2294 #endif
    2295 );
     2312  updateColumnR(&regionSparse
     2313#if ABC_SMALL < 2
     2314    ,
     2315    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2316#endif
     2317#if ABC_PARALLEL
     2318      ,
     2319    2
     2320#endif
     2321  );
    22962322
    22972323  //regionSparse.checkClean();
    2298   bool doFT=storeFT(&regionSparse);
     2324  bool doFT = storeFT(&regionSparse);
    22992325  // will be negative if no room
    2300   if ( doFT )
     2326  if (doFT)
    23012327    return 1;
    23022328  else
    23032329    return -1;
    23042330}
    2305  void
    2306 CoinAbcTypeFactorization::updateColumnFTPart2 ( CoinIndexedVector & regionSparse)
    2307 {
    2308   toLongArray(&regionSparse,0);
     2331void CoinAbcTypeFactorization::updateColumnFTPart2(CoinIndexedVector &regionSparse)
     2332{
     2333  toLongArray(&regionSparse, 0);
    23092334  //CoinSimplexInt numberNonZero=regionSparse.getNumElements();
    23102335  //  ******* U
    2311   updateColumnU ( &regionSparse
    2312 #if ABC_SMALL<2
    2313               , reinterpret_cast<CoinAbcStatistics &>(ftranFTCountInput_)
    2314 #endif
    2315 #if ABC_PARALLEL
    2316                                           ,2
    2317 #endif
    2318                   );
     2336  updateColumnU(&regionSparse
     2337#if ABC_SMALL < 2
     2338    ,
     2339    reinterpret_cast< CoinAbcStatistics & >(ftranFTCountInput_)
     2340#endif
     2341#if ABC_PARALLEL
     2342      ,
     2343    2
     2344#endif
     2345  );
    23192346#if ABC_DEBUG
    23202347  regionSparse.checkClean();
     
    23222349}
    23232350/* Updates one column (FTRAN) */
    2324 void
    2325 CoinAbcTypeFactorization::updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const
    2326 {
    2327   toLongArray(&regionSparse,whichCpu);
     2351void CoinAbcTypeFactorization::updateColumnCpu(CoinIndexedVector &regionSparse, int whichCpu) const
     2352{
     2353  toLongArray(&regionSparse, whichCpu);
    23282354#ifdef ABC_ORDERED_FACTORIZATION
    23292355  // Permute in for Ftran
     
    23312357#endif
    23322358  //  ******* L
    2333   updateColumnL ( &regionSparse
    2334 #if ABC_SMALL<2
    2335                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    2336 #endif
    2337 #if ABC_PARALLEL
    2338                   ,whichCpu
    2339 #endif
    2340                   );
     2359  updateColumnL(&regionSparse
     2360#if ABC_SMALL < 2
     2361    ,
     2362    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     2363#endif
     2364#if ABC_PARALLEL
     2365      ,
     2366    whichCpu
     2367#endif
     2368  );
    23412369  //row bits here
    2342   updateColumnR ( &regionSparse
    2343 #if ABC_SMALL<2
    2344                   ,reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    2345 #endif
    2346 #if ABC_PARALLEL
    2347                   ,whichCpu
    2348 #endif
    2349                   );
     2370  updateColumnR(&regionSparse
     2371#if ABC_SMALL < 2
     2372    ,
     2373    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     2374#endif
     2375#if ABC_PARALLEL
     2376      ,
     2377    whichCpu
     2378#endif
     2379  );
    23502380  //update counts
    23512381  //  ******* U
    2352   updateColumnU ( &regionSparse
    2353 #if ABC_SMALL<2
    2354                   , reinterpret_cast<CoinAbcStatistics &>(ftranCountInput_)
    2355 #endif
    2356 #if ABC_PARALLEL
    2357                   ,whichCpu
    2358 #endif
    2359                   );
     2382  updateColumnU(&regionSparse
     2383#if ABC_SMALL < 2
     2384    ,
     2385    reinterpret_cast< CoinAbcStatistics & >(ftranCountInput_)
     2386#endif
     2387#if ABC_PARALLEL
     2388      ,
     2389    whichCpu
     2390#endif
     2391  );
    23602392  fromLongArray(whichCpu);
    23612393#if ABC_DEBUG
     
    23642396}
    23652397/* Updates one column (BTRAN) */
    2366  void
    2367 CoinAbcTypeFactorization::updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const
    2368  {
    2369   toLongArray(&regionSparse,whichCpu);
    2370      
    2371   CoinSimplexDouble * COIN_RESTRICT region = regionSparse.denseVector();
    2372   CoinSimplexInt * COIN_RESTRICT regionIndex = regionSparse.getIndices();
     2398void CoinAbcTypeFactorization::updateColumnTransposeCpu(CoinIndexedVector &regionSparse, int whichCpu) const
     2399{
     2400  toLongArray(&regionSparse, whichCpu);
     2401
     2402  CoinSimplexDouble *COIN_RESTRICT region = regionSparse.denseVector();
     2403  CoinSimplexInt *COIN_RESTRICT regionIndex = regionSparse.getIndices();
    23732404  CoinSimplexInt numberNonZero = regionSparse.getNumElements();
    23742405  //#if COIN_BIG_DOUBLE==1
    23752406  //const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegion_.array()+1;
    23762407  //#else
    2377   const CoinFactorizationDouble * COIN_RESTRICT pivotRegion = pivotRegionAddress_;
     2408  const CoinFactorizationDouble *COIN_RESTRICT pivotRegion = pivotRegionAddress_;
    23782409  //#endif
    23792410
     
    23812412  // can I move this
    23822413#ifndef INLINE_IT3
    2383   for (CoinSimplexInt i = 0; i < numberNonZero; i ++ ) {
     2414  for (CoinSimplexInt i = 0; i < numberNonZero; i++) {
    23842415    CoinSimplexInt iRow = regionIndex[i];
    23852416    CoinSimplexDouble value = region[iRow];
     
    23882419  }
    23892420#else
    2390   multiplyIndexed(numberNonZero,pivotRegion,
    2391                   regionIndex,region);
     2421  multiplyIndexed(numberNonZero, pivotRegion,
     2422    regionIndex, region);
    23922423#endif
    23932424#else
     
    23982429  // Apply pivot region - could be combined for speed
    23992430  // Can only combine/move inside vector for sparse
    2400   CoinSimplexInt smallestIndex=pivotLinkedForwardsAddress_[-1];
    2401 #if ABC_SMALL<2
     2431  CoinSimplexInt smallestIndex = pivotLinkedForwardsAddress_[-1];
     2432#if ABC_SMALL < 2
    24022433  // copy of code inside transposeU
    2403   bool goSparse=false;
     2434  bool goSparse = false;
    24042435#else
    24052436#define goSparse false
    24062437#endif
    2407 #if ABC_SMALL<2
     2438#if ABC_SMALL < 2
    24082439  // Guess at number at end
    24092440  if (gotUCopy()) {
    2410     assert (btranAverageAfterU_);
    2411     CoinSimplexInt newNumber =
    2412       static_cast<CoinSimplexInt> (numberNonZero*btranAverageAfterU_*twiddleBtranFactor1());
    2413     if (newNumber< sparseThreshold_)
     2441    assert(btranAverageAfterU_);
     2442    CoinSimplexInt newNumber = static_cast< CoinSimplexInt >(numberNonZero * btranAverageAfterU_ * twiddleBtranFactor1());
     2443    if (newNumber < sparseThreshold_)
    24142444      goSparse = true;
    24152445  }
    24162446#endif
    2417   if (numberNonZero<40&&(numberNonZero<<4)<numberRows_&&!goSparse) {
    2418     CoinSimplexInt *  COIN_RESTRICT pivotRowForward = pivotColumnAddress_;
    2419     CoinSimplexInt smallest=numberRowsExtra_;
    2420     for (CoinSimplexInt j = 0; j < numberNonZero; j++ ) {
     2447  if (numberNonZero < 40 && (numberNonZero << 4) < numberRows_ && !goSparse) {
     2448    CoinSimplexInt *COIN_RESTRICT pivotRowForward = pivotColumnAddress_;
     2449    CoinSimplexInt smallest = numberRowsExtra_;
     2450    for (CoinSimplexInt j = 0; j < numberNonZero; j++) {
    24212451      CoinSimplexInt iRow = regionIndex[j];
    2422       if (pivotRowForward[iRow]<smallest) {
    2423         smallest=pivotRowForward[iRow];
    2424         smallestIndex=iRow;
     2452      if (pivotRowForward[iRow] < smallest) {
     2453        smallest = pivotRowForward[iRow];
     2454        smallestIndex = iRow;
    24252455      }
    24262456    }
    24272457  }
    2428   updateColumnTransposeU ( &regionSparse,smallestIndex
    2429 #if ABC_SMALL<2
    2430                   ,reinterpret_cast<CoinAbcStatistics &>(btranCountInput_)
    2431 #endif
    2432 #if ABC_PARALLEL
    2433                   ,whichCpu
    2434 #endif
    2435                            );
     2458  updateColumnTransposeU(&regionSparse, smallestIndex
     2459#if ABC_SMALL < 2
     2460    ,
     2461    reinterpret_cast< CoinAbcStatistics & >(btranCountInput_)
     2462#endif
     2463#if ABC_PARALLEL
     2464      ,
     2465    whichCpu
     2466#endif
     2467  );
    24362468  //row bits here
    2437   updateColumnTransposeR ( &regionSparse
    2438 #if ABC_SMALL<2
    2439                   ,reinterpret_cast<CoinAbcStatistics &>(btranCountInput_)
    2440 #endif
    2441                            );
     2469  updateColumnTransposeR(&regionSparse
     2470#if ABC_SMALL < 2
     2471    ,
     2472    reinterpret_cast< CoinAbcStatistics & >(btranCountInput_)
     2473#endif
     2474  );
    24422475  //  ******* L
    2443   updateColumnTransposeL ( &regionSparse
    2444 #if ABC_SMALL<2
    2445                   ,reinterpret_cast<CoinAbcStatistics &>(btranCountInput_)
    2446 #endif
    2447 #if ABC_PARALLEL
    2448                            , whichCpu
    2449 #endif
    2450                            );
    2451 #if ABC_SMALL<3
     2476  updateColumnTransposeL(&regionSparse
     2477#if ABC_SMALL < 2
     2478    ,
     2479    reinterpret_cast< CoinAbcStatistics & >(btranCountInput_)
     2480#endif
     2481#if ABC_PARALLEL
     2482      ,
     2483    whichCpu
     2484#endif
     2485  );
     2486#if ABC_SMALL < 3
    24522487#ifdef ABC_ORDERED_FACTORIZATION
    24532488  // Permute out for Btran
     
    24572492  regionSparse.checkClean();
    24582493#endif
    2459   numberNonZero = regionSparse.getNumElements (  );
    2460 #else
    2461   numberNonZero=0;
    2462   for (CoinSimplexInt i=0;i<numberRows_;i++) {
    2463     CoinExponent expValue=ABC_EXPONENT(region[i]);
     2494  numberNonZero = regionSparse.getNumElements();
     2495#else
     2496  numberNonZero = 0;
     2497  for (CoinSimplexInt i = 0; i < numberRows_; i++) {
     2498    CoinExponent expValue = ABC_EXPONENT(region[i]);
    24642499    if (expValue) {
    24652500      if (!TEST_EXPONENT_LESS_THAN_TOLERANCE(expValue)) {
    2466         regionIndex[numberNonZero++]=i;
     2501        regionIndex[numberNonZero++] = i;
    24672502      } else {
    2468         region[i]=0.0;
     2503        region[i] = 0.0;
    24692504      }
    24702505    }
     
    24722507  regionSparse.setNumElements(numberNonZero);
    24732508#endif
    2474  }
    2475 #if ABC_SMALL<2
     2509}
     2510#if ABC_SMALL < 2
    24762511//  getRowSpaceIterate.  Gets space for one Row with given length
    24772512//may have to do compression  (returns true)
    24782513//also moves existing vector
    2479 bool
    2480 CoinAbcTypeFactorization::getRowSpaceIterate ( CoinSimplexInt iRow,
    2481                                       CoinSimplexInt extraNeeded )
    2482 {
    2483   const CoinSimplexInt *  COIN_RESTRICT numberInRow = numberInRowAddress_;
     2514bool CoinAbcTypeFactorization::getRowSpaceIterate(CoinSimplexInt iRow,
     2515  CoinSimplexInt extraNeeded)
     2516{
     2517  const CoinSimplexInt *COIN_RESTRICT numberInRow = numberInRowAddress_;
    24842518  CoinSimplexInt number = numberInRow[iRow];
    2485   CoinBigIndex * COIN_RESTRICT startRow = startRowUAddress_;
    2486   CoinSimplexInt * COIN_RESTRICT indexColumnU = indexColumnUAddress_;
     2519  CoinBigIndex *COIN_RESTRICT startRow = startRowUAddress_;
     2520  CoinSimplexInt *COIN_RESTRICT indexColumnU = indexColumnUAddress_;
    24872521#if CONVERTROW
    2488   CoinBigIndex * COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_;
    2489 #if CONVERTROW>2
    2490   CoinBigIndex * COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_;
    2491 #endif
    2492 #endif
    2493   CoinFactorizationDouble * COIN_RESTRICT elementRowU = elementRowUAddress_;
     2522  CoinBigIndex *COIN_RESTRICT convertRowToColumn = convertRowToColumnUAddress_;
     2523#if CONVERTROW > 2
     2524  CoinBigIndex *COIN_RESTRICT convertColumnToRow = convertColumnToRowUAddress_;
     2525#endif
     2526#endif
     2527  CoinFactorizationDouble *COIN_RESTRICT elementRowU = elementRowUAddress_;
    24942528  CoinBigIndex space = lengthAreaU_ - lastEntryByRowU_;
    2495   CoinSimplexInt * COIN_RESTRICT nextRow = nextRowAddress_;
    2496   CoinSimplexInt * COIN_RESTRICT lastRow = lastRowAddress_;
    2497   if ( space < extraNeeded + number + 2 ) {
     2529  CoinSimplexInt *COIN_RESTRICT nextRow = nextRowAddress_;
     2530  CoinSimplexInt *COIN_RESTRICT lastRow = lastRowAddress_;
     2531  if (space < extraNeeded + number + 2) {
    24982532    //compression
    24992533    CoinSimplexInt iRow = nextRow[numberRows_];
    25002534    CoinBigIndex put = 0;
    2501     while ( iRow != numberRows_ ) {
     2535    while (iRow != numberRows_) {
    25022536      //move
    25032537      CoinBigIndex get = startRow[iRow];
    25042538      CoinBigIndex getEnd = startRow[iRow] + numberInRow[iRow];
    2505      
     2539
    25062540      startRow[iRow] = put;
    25072541      CoinBigIndex i;
    2508       for ( i = get; i < getEnd; i++ ) {
    2509         indexColumnU[put] = indexColumnU[i];
     2542      for (i = get; i < getEnd; i++) {
     2543        indexColumnU[put] = indexColumnU[i];
    25102544#if CONVERTROW
    2511         convertRowToColumn[put] = convertRowToColumn[i];
    2512 #if CONVERTROW>2
    2513         convertColumnToRow[i] = convertColumnToRow[put];
    2514 #endif
    2515 #endif
    2516         elementRowU[put] = elementRowU[i];
    2517         put++;
    2518       }       
     2545        convertRowToColumn[put] = convertRowToColumn[i];
     2546#if CONVERTROW > 2
     2547        convertColumnToRow[i] = convertColumnToRow[put];
     2548#endif
     2549#endif
     2550        elementRowU[put] = elementRowU[i];
     2551        put++;
     2552      }
    25192553      iRow = nextRow[iRow];
    2520     }       /* endwhile */
     2554    } /* endwhile */
    25212555    numberCompressions_++;
    25222556    lastEntryByRowU_ = put;
    25232557    space = lengthAreaU_ - put;
    2524     if ( space < extraNeeded + number + 2 ) {
     2558    if (space < extraNeeded + number + 2) {
    25252559      //need more space
    25262560      //if we can allocate bigger then do so and copy
    25272561      //if not then return so code can start again
    25282562      status_ = -99;
    2529       return false;    }       
    2530   }       
     2563      return false;
     2564    }
     2565  }
    25312566  CoinBigIndex put = lastEntryByRowU_;
    25322567  CoinSimplexInt next = nextRow[iRow];
    25332568  CoinSimplexInt last = lastRow[iRow];
    2534  
     2569
    25352570  //out
    25362571  nextRow[last] = next;
     
    25452580  CoinBigIndex get = startRow[iRow];
    25462581  startRow[iRow] = put;
    2547   while ( number ) {
     2582  while (number) {
    25482583    number--;
    25492584    indexColumnU[put] = indexColumnU[get];
    25502585#if CONVERTROW
    25512586    convertRowToColumn[put] = convertRowToColumn[get];
    2552 #if CONVERTROW>2
     2587#if CONVERTROW > 2
    25532588    convertColumnToRow[get] = convertColumnToRow[put];
    25542589#endif
     
    25572592    put++;
    25582593    get++;
    2559   }       /* endwhile */
     2594  } /* endwhile */
    25602595  //add four for luck
    25612596  lastEntryByRowU_ = put + extraNeeded + 4;
     
    25632598}
    25642599#endif
    2565 void
    2566 CoinAbcTypeFactorization::printRegion(const CoinIndexedVector & vector,const char * where) const
     2600void CoinAbcTypeFactorization::printRegion(const CoinIndexedVector &vector, const char *where) const
    25672601{
    25682602  //return;
    2569   CoinSimplexInt numberNonZero = vector.getNumElements (  );
     2603  CoinSimplexInt numberNonZero = vector.getNumElements();
    25702604  //CoinSimplexInt * COIN_RESTRICT regionIndex = vector.getIndices (  );
    2571   const CoinSimplexDouble * COIN_RESTRICT region = vector.denseVector (  );
    2572   int n=0;
    2573   for (int i=0;i<numberRows_;i++) {
     2605  const CoinSimplexDouble *COIN_RESTRICT region = vector.denseVector();
     2606  int n = 0;
     2607  for (int i = 0; i < numberRows_; i++) {
    25742608    if (region[i])
    25752609      n++;
    25762610  }
    2577   printf("==== %d nonzeros (%d in count) %s ====\n",n,numberNonZero,where);
    2578   for (int i=0;i<numberRows_;i++) {
     2611  printf("==== %d nonzeros (%d in count) %s ====\n", n, numberNonZero, where);
     2612  for (int i = 0; i < numberRows_; i++) {
    25792613    if (region[i])
    2580       printf("%d %g\n",i,region[i]);
    2581   }
    2582   printf("====            %s ====\n",where);
    2583 }
    2584 void
    2585 CoinAbcTypeFactorization::unpack ( CoinIndexedVector * regionFrom,
    2586                            CoinIndexedVector * regionTo) const
    2587 {
    2588   // move
    2589   CoinSimplexInt * COIN_RESTRICT regionIndex = regionTo->getIndices (  );
     2614      printf("%d %g\n", i, region[i]);
     2615  }
     2616  printf("====            %s ====\n", where);
     2617}
     2618void CoinAbcTypeFactorization::unpack(CoinIndexedVector *regionFrom,
     2619  CoinIndexedVector *regionTo) const
     2620{
     2621  // move
     2622  CoinSimplexInt *COIN_RESTRICT regionIndex = regionTo->getIndices();
    25902623  CoinSimplexInt numberNonZero = regionFrom->getNumElements();
    2591   CoinSimplexInt * COIN_RESTRICT index = regionFrom->getIndices();
    2592   CoinSimplexDouble * COIN_RESTRICT region = regionTo->denseVector();
    2593   CoinSimplexDouble * COIN_RESTRICT array = regionFrom->denseVector();
    2594   for (CoinSimplexInt j = 0; j < numberNonZero; j ++ ) {
     2624  CoinSimplexInt *COIN_RESTRICT index = regionFrom->getIndices();
     2625  CoinSimplexDouble *COIN_RESTRICT region = regionTo->denseVector();
     2626  CoinSimplexDouble *COIN_RESTRICT array = regionFrom->denseVector();
     2627  for (CoinSimplexInt j = 0; j < numberNonZero; j++) {
    25952628    CoinSimplexInt iRow = index[j];
    25962629    CoinSimplexDouble value = array[j];
    2597     array[j]=0.0;
     2630    array[j] = 0.0;
    25982631    region[iRow] = value;
    25992632    regionIndex[j] = iRow;
     
    26012634  regionTo->setNumElements(numberNonZero);
    26022635}
    2603 void
    2604 CoinAbcTypeFactorization::pack ( CoinIndexedVector * regionFrom,
    2605                          CoinIndexedVector * regionTo) const
    2606 {
    2607   // move
    2608   CoinSimplexInt * COIN_RESTRICT regionIndex = regionFrom->getIndices (  );
     2636void CoinAbcTypeFactorization::pack(CoinIndexedVector *regionFrom,
     2637  CoinIndexedVector *regionTo) const
     2638{
     2639  // move
     2640  CoinSimplexInt *COIN_RESTRICT regionIndex = regionFrom->getIndices();
    26092641  CoinSimplexInt numberNonZero = regionFrom->getNumElements();
    2610   CoinSimplexInt * COIN_RESTRICT index = regionTo->getIndices();
    2611   CoinSimplexDouble * COIN_RESTRICT region = regionFrom->denseVector();
    2612   CoinSimplexDouble * COIN_RESTRICT array = regionTo->denseVector();
    2613   for (CoinSimplexInt j = 0; j < numberNonZero; j ++ ) {
     2642  CoinSimplexInt *COIN_RESTRICT index = regionTo->getIndices();
     2643  CoinSimplexDouble *COIN_RESTRICT region = regionFrom->denseVector();
     2644  CoinSimplexDouble *COIN_RESTRICT array = regionTo->denseVector();
     2645  for (CoinSimplexInt j = 0; j < numberNonZero; j++) {
    26142646    CoinSimplexInt iRow = regionIndex[j];
    26152647    CoinSimplexDouble value = region[iRow];
    2616     region[iRow]=0.0;
     2648    region[iRow] = 0.0;
    26172649    array[j] = value;
    26182650    index[j] = iRow;
     
    26212653}
    26222654// Set up addresses from arrays
    2623 void
    2624 CoinAbcTypeFactorization::doAddresses()
     2655void CoinAbcTypeFactorization::doAddresses()
    26252656{
    26262657  pivotColumnAddress_ = pivotColumn_.array();
    26272658  permuteAddress_ = permute_.array();
    2628   pivotRegionAddress_ = pivotRegion_.array()+1;
     2659  pivotRegionAddress_ = pivotRegion_.array() + 1;
    26292660  elementUAddress_ = elementU_.array();
    26302661  indexRowUAddress_ = indexRowU_.array();
     
    26322663  numberInColumnPlusAddress_ = numberInColumnPlus_.array();
    26332664#ifdef ABC_USE_FUNCTION_POINTERS
    2634   scatterPointersUColumnAddress_ = reinterpret_cast<scatterStruct *>(scatterUColumn_.array());
     2665  scatterPointersUColumnAddress_ = reinterpret_cast< scatterStruct * >(scatterUColumn_.array());
    26352666#endif
    26362667  startColumnUAddress_ = startColumnU_.array();
    26372668#if CONVERTROW
    26382669  convertRowToColumnUAddress_ = convertRowToColumnU_.array();
    2639 #if CONVERTROW>1
     2670#if CONVERTROW > 1
    26402671  convertColumnToRowUAddress_ = convertColumnToRowU_.array();
    26412672#endif
    26422673#endif
    2643 #if ABC_SMALL<2
     2674#if ABC_SMALL < 2
    26442675  elementRowUAddress_ = elementRowU_.array();
    26452676#endif
     
    26592690  indexRowLAddress_ = indexRowL_.array();
    26602691  startColumnLAddress_ = startColumnL_.array();
    2661 #if ABC_SMALL<2
     2692#if ABC_SMALL < 2
    26622693  startRowLAddress_ = startRowL_.array();
    26632694#endif
     
    26692700  elementRAddress_ = elementL_.array() + lengthL_;
    26702701  indexRowRAddress_ = indexRowL_.array() + lengthL_;
    2671 #if ABC_SMALL<2
     2702#if ABC_SMALL < 2
    26722703  indexColumnLAddress_ = indexColumnL_.array();
    26732704  elementByRowLAddress_ = elementByRowL_.array();
     
    26782709  workAreaAddress_ = workArea_.array();
    26792710  workArea2Address_ = workArea2_.array();
    2680 #if ABC_SMALL<2
     2711#if ABC_SMALL < 2
    26812712  sparseAddress_ = sparse_.array();
    2682   CoinAbcStack * stackList = reinterpret_cast<CoinAbcStack *>(sparseAddress_);
    2683   listAddress_ = reinterpret_cast<CoinSimplexInt *>(stackList+numberRows_);
    2684   markRowAddress_ = reinterpret_cast<CoinCheckZero *> (listAddress_ + numberRows_);
    2685 #endif
    2686 }
    2687 #endif
     2713  CoinAbcStack *stackList = reinterpret_cast< CoinAbcStack * >(sparseAddress_);
     2714  listAddress_ = reinterpret_cast< CoinSimplexInt * >(stackList + numberRows_);
     2715  markRowAddress_ = reinterpret_cast< CoinCheckZero * >(listAddress_ + numberRows_);
     2716#endif
     2717}
     2718#endif
     2719
     2720/* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2
     2721*/
Note: See TracChangeset for help on using the changeset viewer.