Changeset 2385 for trunk/Clp/src/CoinAbcBaseFactorization.hpp
 Timestamp:
 Jan 6, 2019 2:43:06 PM (4 months ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/Clp/src/CoinAbcBaseFactorization.hpp
r1910 r2385 23 23 #define FACTOR_CPU 1 24 24 #endif 25 #define LARGE_SET COIN_INT_MAX10 26 #define LARGE_UNSET (LARGE_SET+1) 27 28 class CoinAbcTypeFactorization : public 29 CoinAbcAnyFactorization 30 { 31 friend void CoinAbcFactorizationUnitTest( const std::string & mpsDir ); 25 #define LARGE_SET COIN_INT_MAX  10 26 #define LARGE_UNSET (LARGE_SET + 1) 27 28 class CoinAbcTypeFactorization : public CoinAbcAnyFactorization { 29 friend void CoinAbcFactorizationUnitTest(const std::string &mpsDir); 32 30 33 31 public: 34 35 32 /**@name Constructors and destructor and copy */ 36 33 //@{ 37 34 /// Default constructor 38 CoinAbcTypeFactorization ();39 /// Copy constructor 40 CoinAbcTypeFactorization (const CoinAbcTypeFactorization &other);41 /// Copy constructor 42 CoinAbcTypeFactorization (const CoinFactorization &other);35 CoinAbcTypeFactorization(); 36 /// Copy constructor 37 CoinAbcTypeFactorization(const CoinAbcTypeFactorization &other); 38 /// Copy constructor 39 CoinAbcTypeFactorization(const CoinFactorization &other); 43 40 44 41 /// Destructor 45 virtual ~CoinAbcTypeFactorization ();42 virtual ~CoinAbcTypeFactorization(); 46 43 /// Clone 47 virtual CoinAbcAnyFactorization * clone() const;44 virtual CoinAbcAnyFactorization *clone() const; 48 45 /// Delete all stuff (leaves as after CoinAbcFactorization()) 49 46 void almostDestructor(); 50 47 /// Debug show object (shows one representation) 51 void show_self () const;48 void show_self() const; 52 49 /// Debug  sort so can compare 53 void sort () const;50 void sort() const; 54 51 /// = copy 55 CoinAbcTypeFactorization & operator = ( const CoinAbcTypeFactorization & other);52 CoinAbcTypeFactorization &operator=(const CoinAbcTypeFactorization &other); 56 53 //@} 57 54 … … 60 57 /// Condition number  product of pivots after factorization 61 58 CoinSimplexDouble conditionNumber() const; 62 59 63 60 //@} 64 61 65 62 /**@name general stuff such as permutation or status */ 66 //@{ 63 //@{ 67 64 /// Returns address of permute region 68 inline CoinSimplexInt *permute ( ) const { 65 inline CoinSimplexInt *permute() const 66 { 69 67 return NULL; //permute_.array(); 70 68 } 71 69 /// Returns array to put basis indices in 72 virtual inline CoinSimplexInt * indices() const 73 { return indexRowU_.array();} 70 virtual inline CoinSimplexInt *indices() const 71 { 72 return indexRowU_.array(); 73 } 74 74 /// Returns address of pivotColumn region (also used for permuting) 75 virtual inline CoinSimplexInt *pivotColumn ( ) const { 75 virtual inline CoinSimplexInt *pivotColumn() const 76 { 76 77 return pivotColumn_.array(); 77 78 } 78 79 /// Returns address of pivot region 79 virtual inline CoinFactorizationDouble *pivotRegion ( ) const { 80 virtual inline CoinFactorizationDouble *pivotRegion() const 81 { 80 82 return pivotRegionAddress_; 81 83 } 82 #if ABC_SMALL <284 #if ABC_SMALL < 2 83 85 /// Start of each row in L 84 inline CoinBigIndex * startRowL() const 85 { return startRowL_.array();} 86 inline CoinBigIndex *startRowL() const 87 { 88 return startRowL_.array(); 89 } 86 90 #endif 87 91 88 92 /// Start of each column in L 89 inline CoinBigIndex * startColumnL() const 90 { return startColumnL_.array();} 91 92 #if ABC_SMALL<2 93 inline CoinBigIndex *startColumnL() const 94 { 95 return startColumnL_.array(); 96 } 97 98 #if ABC_SMALL < 2 93 99 /// Index of column in row for L 94 inline CoinSimplexInt * indexColumnL() const 95 { return indexColumnL_.array();} 100 inline CoinSimplexInt *indexColumnL() const 101 { 102 return indexColumnL_.array(); 103 } 96 104 #endif 97 105 98 106 /// Row indices of L 99 inline CoinSimplexInt * indexRowL() const 100 { return indexRowL_.array();} 101 102 #if ABC_SMALL<2 107 inline CoinSimplexInt *indexRowL() const 108 { 109 return indexRowL_.array(); 110 } 111 112 #if ABC_SMALL < 2 103 113 /// Elements in L (row copy) 104 inline CoinFactorizationDouble * elementByRowL() const 105 { return elementByRowL_.array();} 114 inline CoinFactorizationDouble *elementByRowL() const 115 { 116 return elementByRowL_.array(); 117 } 106 118 #endif 107 119 /** 108 120 Forward and backward linked lists (numberRows_+2) 109 121 **/ 110 inline CoinSimplexInt * pivotLinkedBackwards() const 111 { return firstCount_.array()+numberRows_+1;} 112 inline CoinSimplexInt * pivotLinkedForwards() const 113 { return firstCount_.array()+2*numberRows_+3;} 114 inline CoinSimplexInt * pivotLOrder() const 115 { return firstCount_.array();} 116 #if ABC_SMALL<0 122 inline CoinSimplexInt *pivotLinkedBackwards() const 123 { 124 return firstCount_.array() + numberRows_ + 1; 125 } 126 inline CoinSimplexInt *pivotLinkedForwards() const 127 { 128 return firstCount_.array() + 2 * numberRows_ + 3; 129 } 130 inline CoinSimplexInt *pivotLOrder() const 131 { 132 return firstCount_.array(); 133 } 134 #if ABC_SMALL < 0 117 135 #define ABC_USE_FUNCTION_POINTERS 0 118 136 #define SMALL_PERMUTE 119 137 #endif 120 138 #ifdef ABC_USE_FUNCTION_POINTERS 121 typedef void (*scatterUpdate) (int,CoinFactorizationDouble,const CoinFactorizationDouble *, CoinFactorizationDouble *);139 typedef void (*scatterUpdate)(int, CoinFactorizationDouble, const CoinFactorizationDouble *, CoinFactorizationDouble *); 122 140 #if ABC_USE_FUNCTION_POINTERS 123 141 typedef struct { … … 133 151 #endif 134 152 /// Array of function pointers PLUS for U Column 135 inline scatterStruct * scatterUColumn() const 136 { return scatterPointersUColumnAddress_;} 153 inline scatterStruct *scatterUColumn() const 154 { 155 return scatterPointersUColumnAddress_; 156 } 137 157 #endif 138 158 … … 141 161 can tell which by offset  Rows then Columns 142 162 actually comes before nextCount*/ 143 inline CoinSimplexInt * firstCount() const 144 { return firstCount_.array();} 163 inline CoinSimplexInt *firstCount() const 164 { 165 return firstCount_.array(); 166 } 145 167 146 168 /// Next Row/Column with count 147 inline CoinSimplexInt * nextCount() const 148 { return firstCount_.array()+numberRows_+2;} 169 inline CoinSimplexInt *nextCount() const 170 { 171 return firstCount_.array() + numberRows_ + 2; 172 } 149 173 150 174 /// Previous Row/Column with count 151 inline CoinSimplexInt * lastCount() const 152 { return firstCount_.array()+3*numberRows_+2;} 175 inline CoinSimplexInt *lastCount() const 176 { 177 return firstCount_.array() + 3 * numberRows_ + 2; 178 } 153 179 154 180 /// Number of Rows after iterating 155 inline CoinSimplexInt numberRowsExtra ( ) const { 181 inline CoinSimplexInt numberRowsExtra() const 182 { 156 183 return numberRowsExtra_; 157 184 } 158 185 /// Number in L 159 186 inline CoinBigIndex numberL() const 160 { return numberL_;} 187 { 188 return numberL_; 189 } 161 190 162 191 /// Base of L 163 192 inline CoinBigIndex baseL() const 164 { return baseL_;} 193 { 194 return baseL_; 195 } 165 196 /// Maximum of Rows after iterating 166 inline CoinSimplexInt maximumRowsExtra ( ) const { 197 inline CoinSimplexInt maximumRowsExtra() const 198 { 167 199 return maximumRowsExtra_; 168 200 } 169 201 /// Total number of elements in factorization 170 virtual inline CoinBigIndex numberElements ( ) const { 202 virtual inline CoinBigIndex numberElements() const 203 { 171 204 return totalElements_; 172 205 } 173 206 /// Length of FT vector 174 inline CoinSimplexInt numberForrestTomlin ( ) const { 207 inline CoinSimplexInt numberForrestTomlin() const 208 { 175 209 return numberInColumn_.array()[numberRowsExtra_]; 176 210 } … … 178 212 CoinSimplexDouble adjustedAreaFactor() const; 179 213 /// Level of detail of messages 180 inline CoinSimplexInt messageLevel ( ) const { 181 return messageLevel_ ; 182 } 183 void messageLevel ( CoinSimplexInt value ); 214 inline CoinSimplexInt messageLevel() const 215 { 216 return messageLevel_; 217 } 218 void messageLevel(CoinSimplexInt value); 184 219 /// Set maximum pivots 185 virtual void maximumPivots ( CoinSimplexInt value);186 187 #if ABC_SMALL <4220 virtual void maximumPivots(CoinSimplexInt value); 221 222 #if ABC_SMALL < 4 188 223 /// Gets dense threshold 189 inline CoinSimplexInt denseThreshold() const 190 { return denseThreshold_;} 224 inline CoinSimplexInt denseThreshold() const 225 { 226 return denseThreshold_; 227 } 191 228 /// Sets dense threshold 192 229 inline void setDenseThreshold(CoinSimplexInt value) 193 { denseThreshold_ = value;} 230 { 231 denseThreshold_ = value; 232 } 194 233 #endif 195 234 /// Returns maximum absolute value in factorization … … 206 245 { 207 246 CoinBigIndex start = lastEntryByColumnU_; 208 CoinBigIndex space = lengthAreaU_  ( start + numberRowsExtra_);209 return (space >=0); //&&doForrestTomlin_;247 CoinBigIndex space = lengthAreaU_  (start + numberRowsExtra_); 248 return (space >= 0); //&&doForrestTomlin_; 210 249 } 211 250 //@} … … 214 253 //@{ 215 254 216 217 255 /// Returns number in U area 218 inline CoinBigIndex numberElementsU ( ) const { 256 inline CoinBigIndex numberElementsU() const 257 { 219 258 return lengthU_; 220 259 } 221 260 /// Setss number in U area 222 261 inline void setNumberElementsU(CoinBigIndex value) 223 { lengthU_ = value; } 262 { 263 lengthU_ = value; 264 } 224 265 /// Returns length of U area 225 inline CoinBigIndex lengthAreaU ( ) const { 266 inline CoinBigIndex lengthAreaU() const 267 { 226 268 return lengthAreaU_; 227 269 } 228 270 /// Returns number in L area 229 inline CoinBigIndex numberElementsL ( ) const { 271 inline CoinBigIndex numberElementsL() const 272 { 230 273 return lengthL_; 231 274 } 232 275 /// Returns length of L area 233 inline CoinBigIndex lengthAreaL ( ) const { 276 inline CoinBigIndex lengthAreaL() const 277 { 234 278 return lengthAreaL_; 235 279 } 236 280 /// Returns number in R area 237 inline CoinBigIndex numberElementsR ( ) const { 281 inline CoinBigIndex numberElementsR() const 282 { 238 283 return lengthR_; 239 284 } 240 285 /// Number of compressions done 241 286 inline CoinBigIndex numberCompressions() const 242 { return numberCompressions_;} 243 /// Returns pivot row 287 { 288 return numberCompressions_; 289 } 290 /// Returns pivot row 244 291 //virtual CoinSimplexInt * pivotRow() const; 245 292 /// Returns work area … … 248 295 //virtual CoinSimplexInt * intWorkArea() const; 249 296 /// Returns array to put basis starts in 250 virtual inline CoinBigIndex * starts() const 251 { return startColumnU_.array();} 297 virtual inline CoinBigIndex *starts() const 298 { 299 return startColumnU_.array(); 300 } 252 301 /// Number of entries in each row 253 virtual inline CoinSimplexInt * numberInRow() const 254 { return numberInRow_.array();} 302 virtual inline CoinSimplexInt *numberInRow() const 303 { 304 return numberInRow_.array(); 305 } 255 306 /// Number of entries in each column 256 virtual inline CoinSimplexInt * numberInColumn() const 257 { return numberInColumn_.array();} 307 virtual inline CoinSimplexInt *numberInColumn() const 308 { 309 return numberInColumn_.array(); 310 } 258 311 /// Returns array to put basis elements in 259 virtual inline CoinFactorizationDouble * elements() const 260 { return elementU_.array();} 312 virtual inline CoinFactorizationDouble *elements() const 313 { 314 return elementU_.array(); 315 } 261 316 /// Start of columns for R 262 inline CoinBigIndex * startColumnR() const 263 {return reinterpret_cast<CoinBigIndex *>(firstCount_.array()+3*numberRows_+4);} 317 inline CoinBigIndex *startColumnR() const 318 { 319 return reinterpret_cast< CoinBigIndex * >(firstCount_.array() + 3 * numberRows_ + 4); 320 } 264 321 /// Elements of U 265 inline CoinFactorizationDouble * elementU() const 266 { return elementU_.array();} 322 inline CoinFactorizationDouble *elementU() const 323 { 324 return elementU_.array(); 325 } 267 326 /// Row indices of U 268 inline CoinSimplexInt * indexRowU() const 269 { return indexRowU_.array();} 327 inline CoinSimplexInt *indexRowU() const 328 { 329 return indexRowU_.array(); 330 } 270 331 /// Start of each column in U 271 inline CoinBigIndex * startColumnU() const 272 { return startColumnU_.array();} 273 #if COIN_BIG_DOUBLE==1 332 inline CoinBigIndex *startColumnU() const 333 { 334 return startColumnU_.array(); 335 } 336 #if COIN_BIG_DOUBLE == 1 274 337 /// To a work array and associate vector 275 void toLongArray(CoinIndexedVector * vector,int which) const;338 void toLongArray(CoinIndexedVector *vector, int which) const; 276 339 /// From a work array and disassociate vector 277 void fromLongArray(CoinIndexedVector * 340 void fromLongArray(CoinIndexedVector *vector) const; 278 341 /// From a work array and disassociate vector 279 342 void fromLongArray(int which) const; 280 343 /// Returns long double * associated with vector 281 long double * denseVector(CoinIndexedVector *vector) const;344 long double *denseVector(CoinIndexedVector *vector) const; 282 345 /// Returns long double * associated with vector 283 long double * denseVector(CoinIndexedVector &vector) const;346 long double *denseVector(CoinIndexedVector &vector) const; 284 347 /// Returns long double * associated with vector 285 const long double * denseVector(const CoinIndexedVector *vector) const;348 const long double *denseVector(const CoinIndexedVector *vector) const; 286 349 /// Returns long double * associated with vector 287 const long double * denseVector(const CoinIndexedVector &vector) const;350 const long double *denseVector(const CoinIndexedVector &vector) const; 288 351 /// Scans region to find nonzeros 289 void scan(CoinIndexedVector * 352 void scan(CoinIndexedVector *vector) const; 290 353 /// Clear all hidden arrays 291 354 void clearHiddenArrays(); 292 355 #else 293 356 /// Returns double * associated with vector 294 inline double * denseVector(CoinIndexedVector * vector) const 295 {return vector>denseVector();} 296 inline double * denseVector(CoinIndexedVector & vector) const 297 {return vector.denseVector();} 357 inline double *denseVector(CoinIndexedVector *vector) const 358 { 359 return vector>denseVector(); 360 } 361 inline double *denseVector(CoinIndexedVector &vector) const 362 { 363 return vector.denseVector(); 364 } 298 365 /// Returns double * associated with vector 299 inline const double * denseVector(const CoinIndexedVector * vector) const 300 {return vector>denseVector();} 301 inline const double * denseVector(const CoinIndexedVector & vector) const 302 {return vector.denseVector();} 366 inline const double *denseVector(const CoinIndexedVector *vector) const 367 { 368 return vector>denseVector(); 369 } 370 inline const double *denseVector(const CoinIndexedVector &vector) const 371 { 372 return vector.denseVector(); 373 } 303 374 /// To a work array and associate vector 304 inline void toLongArray(CoinIndexedVector * vector,int which) const {}375 inline void toLongArray(CoinIndexedVector *vector, int which) const {} 305 376 /// From a work array and disassociate vector 306 inline void fromLongArray(CoinIndexedVector * 377 inline void fromLongArray(CoinIndexedVector *vector) const {} 307 378 /// From a work array and disassociate vector 308 379 inline void fromLongArray(int which) const {} 309 380 /// Scans region to find nonzeros 310 inline void scan(CoinIndexedVector * vector) const 311 {vector>scan(0,numberRows_,zeroTolerance_);} 381 inline void scan(CoinIndexedVector *vector) const 382 { 383 vector>scan(0, numberRows_, zeroTolerance_); 384 } 312 385 #endif 313 386 #ifdef ABC_ORDERED_FACTORIZATION 314 387 /// Permute in for Ftran 315 void permuteInForFtran(CoinIndexedVector & regionSparse,bool full=false) const;388 void permuteInForFtran(CoinIndexedVector ®ionSparse, bool full = false) const; 316 389 /// Permute in for Btran and multiply by pivot Region 317 void permuteInForBtranAndMultiply(CoinIndexedVector & regionSparse, bool full=false) const;390 void permuteInForBtranAndMultiply(CoinIndexedVector ®ionSparse, bool full = false) const; 318 391 /// Permute out for Btran 319 void permuteOutForBtran(CoinIndexedVector & regionSparse) const;392 void permuteOutForBtran(CoinIndexedVector ®ionSparse) const; 320 393 #endif 321 394 /** Array persistence flag … … 354 427 Fills in region for use later 355 428 partial update already in U */ 356 virtual 357 #ifdef ABC_LONG_FACTORIZATION 358 long 359 #endif 360 double checkReplacePart1 ( CoinIndexedVector * regionSparse, 361 int pivotRow); 429 virtual 430 #ifdef ABC_LONG_FACTORIZATION 431 long 432 #endif 433 double 434 checkReplacePart1(CoinIndexedVector *regionSparse, 435 int pivotRow); 362 436 /** Checks if can replace one Column to basis, 363 437 returns update alpha 364 438 Fills in region for use later 365 439 partial update in vector */ 366 virtual 367 #ifdef ABC_LONG_FACTORIZATION 368 long 369 #endif 370 double checkReplacePart1 ( CoinIndexedVector * regionSparse, 371 CoinIndexedVector * partialUpdate, 372 int pivotRow); 440 virtual 441 #ifdef ABC_LONG_FACTORIZATION 442 long 443 #endif 444 double 445 checkReplacePart1(CoinIndexedVector *regionSparse, 446 CoinIndexedVector *partialUpdate, 447 int pivotRow); 373 448 #ifdef MOVE_REPLACE_PART1A 374 449 /** Checks if can replace one Column to basis, … … 376 451 Fills in region for use later 377 452 partial update already in U */ 378 virtual void checkReplacePart1a ( CoinIndexedVector * regionSparse, 379 int pivotRow); 380 virtual 381 #ifdef ABC_LONG_FACTORIZATION 382 long 383 #endif 384 double checkReplacePart1b ( CoinIndexedVector * regionSparse, 385 int pivotRow); 453 virtual void checkReplacePart1a(CoinIndexedVector *regionSparse, 454 int pivotRow); 455 virtual 456 #ifdef ABC_LONG_FACTORIZATION 457 long 458 #endif 459 double 460 checkReplacePart1b(CoinIndexedVector *regionSparse, 461 int pivotRow); 386 462 #endif 387 463 /** Checks if can replace one Column to basis, 388 464 returns 0=OK, 1=Probably OK, 2=singular, 3=no room, 5 max pivots */ 389 virtual int checkReplacePart2 (int pivotRow,390 CoinSimplexDouble btranAlpha, 391 double ftranAlpha, 392 #ifdef ABC_LONG_FACTORIZATION 393 394 #endif 395 396 465 virtual int checkReplacePart2(int pivotRow, 466 CoinSimplexDouble btranAlpha, 467 double ftranAlpha, 468 #ifdef ABC_LONG_FACTORIZATION 469 long 470 #endif 471 double ftAlpha, 472 double acceptablePivot = 1.0e8); 397 473 /** Replaces one Column to basis, 398 474 partial update already in U */ 399 virtual void replaceColumnPart3 ( const AbcSimplex *model,400 CoinIndexedVector *regionSparse,401 CoinIndexedVector *tableauColumn,402 403 #ifdef ABC_LONG_FACTORIZATION 404 405 #endif 406 double alpha);475 virtual void replaceColumnPart3(const AbcSimplex *model, 476 CoinIndexedVector *regionSparse, 477 CoinIndexedVector *tableauColumn, 478 int pivotRow, 479 #ifdef ABC_LONG_FACTORIZATION 480 long 481 #endif 482 double alpha); 407 483 /** Replaces one Column to basis, 408 484 partial update in vector */ 409 virtual void replaceColumnPart3 ( const AbcSimplex *model,410 CoinIndexedVector *regionSparse,411 CoinIndexedVector *tableauColumn,412 CoinIndexedVector *partialUpdate,413 414 #ifdef ABC_LONG_FACTORIZATION 415 416 #endif 417 double alpha);485 virtual void replaceColumnPart3(const AbcSimplex *model, 486 CoinIndexedVector *regionSparse, 487 CoinIndexedVector *tableauColumn, 488 CoinIndexedVector *partialUpdate, 489 int pivotRow, 490 #ifdef ABC_LONG_FACTORIZATION 491 long 492 #endif 493 double alpha); 418 494 #ifdef EARLY_FACTORIZE 419 495 /// 0 success, 1 can't +1 accuracy problems 420 virtual int replaceColumns ( const AbcSimplex *model,421 CoinIndexedVector &stuff,422 int firstPivot,int lastPivot,bool cleanUp);496 virtual int replaceColumns(const AbcSimplex *model, 497 CoinIndexedVector &stuff, 498 int firstPivot, int lastPivot, bool cleanUp); 423 499 #endif 424 500 /// Update partial Ftran by R update 425 void updatePartialUpdate(CoinIndexedVector & 501 void updatePartialUpdate(CoinIndexedVector &partialUpdate); 426 502 /// Returns true if wants tableauColumn in replaceColumn 427 503 inline virtual bool wantsTableauColumn() const 428 {return false;} 504 { 505 return false; 506 } 429 507 /** Combines BtranU and store which elements are to be deleted 430 508 returns number to be deleted 431 509 */ 432 int replaceColumnU ( CoinIndexedVector *regionSparse,433 CoinBigIndex *deletedPosition,434 CoinSimplexInt *deletedColumns,435 510 int replaceColumnU(CoinIndexedVector *regionSparse, 511 CoinBigIndex *deletedPosition, 512 CoinSimplexInt *deletedColumns, 513 CoinSimplexInt pivotRow); 436 514 //@} 437 515 438 516 /**@name various uses of factorization (return code number elements) 439 517 which user may want to know about */ 440 /// Later take out return codes (apart from + 1 on FT) 518 /// Later take out return codes (apart from + 1 on FT) 441 519 //@{ 442 520 /** Updates one column (FTRAN) from regionSparse2 … … 446 524 Note  if regionSparse2 packed on input  will be packed on output 447 525 */ 448 virtual CoinSimplexInt updateColumnFT ( CoinIndexedVector ®ionSparse);449 virtual int updateColumnFTPart1 ( CoinIndexedVector & regionSparse);450 virtual void updateColumnFTPart2 ( CoinIndexedVector & regionSparse);526 virtual CoinSimplexInt updateColumnFT(CoinIndexedVector ®ionSparse); 527 virtual int updateColumnFTPart1(CoinIndexedVector ®ionSparse); 528 virtual void updateColumnFTPart2(CoinIndexedVector ®ionSparse); 451 529 /** Updates one column (FTRAN) 452 530 Tries to do FT update 453 531 puts partial update in vector */ 454 virtual void updateColumnFT ( CoinIndexedVector ®ionSparseFT,455 CoinIndexedVector &partialUpdate,456 532 virtual void updateColumnFT(CoinIndexedVector ®ionSparseFT, 533 CoinIndexedVector &partialUpdate, 534 int which); 457 535 /** This version has same effect as above with FTUpdate==false 458 536 so number returned is always >=0 */ 459 virtual CoinSimplexInt updateColumn ( CoinIndexedVector ®ionSparse) const;537 virtual CoinSimplexInt updateColumn(CoinIndexedVector ®ionSparse) const; 460 538 /** Updates one column (FTRAN) from region2 461 539 Tries to do FT update … … 463 541 Also updates region3 464 542 region1 starts as zero and is zero at end */ 465 virtual CoinSimplexInt updateTwoColumnsFT ( CoinIndexedVector ®ionFT,466 CoinIndexedVector ®ionOther);543 virtual CoinSimplexInt updateTwoColumnsFT(CoinIndexedVector ®ionFT, 544 CoinIndexedVector ®ionOther); 467 545 /** Updates one column (BTRAN) from regionSparse2 468 546 regionSparse starts as zero and is zero at end 469 547 Note  if regionSparse2 packed on input  will be packed on output 470 548 */ 471 virtual CoinSimplexInt updateColumnTranspose ( CoinIndexedVector ®ionSparse) const;549 virtual CoinSimplexInt updateColumnTranspose(CoinIndexedVector ®ionSparse) const; 472 550 /** Updates one full column (FTRAN) */ 473 virtual void updateFullColumn ( CoinIndexedVector ®ionSparse) const;551 virtual void updateFullColumn(CoinIndexedVector ®ionSparse) const; 474 552 /** Updates one full column (BTRAN) */ 475 virtual void updateFullColumnTranspose ( CoinIndexedVector ®ionSparse) const;553 virtual void updateFullColumnTranspose(CoinIndexedVector ®ionSparse) const; 476 554 /** Updates one column for dual steepest edge weights (FTRAN) */ 477 virtual void updateWeights ( CoinIndexedVector ®ionSparse) const;555 virtual void updateWeights(CoinIndexedVector ®ionSparse) const; 478 556 /** Updates one column (FTRAN) */ 479 virtual void updateColumnCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;557 virtual void updateColumnCpu(CoinIndexedVector ®ionSparse, int whichCpu) const; 480 558 /** Updates one column (BTRAN) */ 481 virtual void updateColumnTransposeCpu ( CoinIndexedVector & regionSparse,int whichCpu) const;482 void unpack ( CoinIndexedVector *regionFrom,483 CoinIndexedVector *regionTo) const;484 void pack ( CoinIndexedVector *regionFrom,485 CoinIndexedVector *regionTo) const;559 virtual void updateColumnTransposeCpu(CoinIndexedVector ®ionSparse, int whichCpu) const; 560 void unpack(CoinIndexedVector *regionFrom, 561 CoinIndexedVector *regionTo) const; 562 void pack(CoinIndexedVector *regionFrom, 563 CoinIndexedVector *regionTo) const; 486 564 /** makes a row copy of L for speed and to allow very sparse problems */ 487 565 inline void goSparse() {} … … 490 568 virtual void checkMarkArrays() const; 491 569 #endif 492 #if ABC_SMALL <2570 #if ABC_SMALL < 2 493 571 /** get sparse threshold */ 494 inline CoinSimplexInt sparseThreshold ( ) const 495 { return sparseThreshold_;} 572 inline CoinSimplexInt sparseThreshold() const 573 { 574 return sparseThreshold_; 575 } 496 576 #endif 497 577 /** set sparse threshold */ 498 void sparseThreshold ( CoinSimplexInt value);578 void sparseThreshold(CoinSimplexInt value); 499 579 //@} 500 580 /// *** Below this user may not want to know about … … 505 585 /// Get rid of all memory 506 586 inline void clearArrays() 507 { gutsOfDestructor();} 587 { 588 gutsOfDestructor(); 589 } 508 590 //@} 509 591 /**@name used by ClpFactorization */ 510 592 /// See if worth going sparse 511 593 void checkSparse(); 512 /// The real work of constructors etc 0 just scalars, 1 bit normal 513 void gutsOfDestructor(CoinSimplexInt type =1);594 /// The real work of constructors etc 0 just scalars, 1 bit normal 595 void gutsOfDestructor(CoinSimplexInt type = 1); 514 596 /// 1 bit  tolerances etc, 2 more, 4 dummy arrays 515 597 void gutsOfInitialize(CoinSimplexInt type); … … 518 600 /// Reset all sparsity etc statistics 519 601 void resetStatistics(); 520 void printRegion(const CoinIndexedVector & vector, const char *where) const;602 void printRegion(const CoinIndexedVector &vector, const char *where) const; 521 603 522 604 //@} … … 524 606 /**@name used by factorization */ 525 607 /// Gets space for a factorization, called by constructors 526 virtual void getAreas (CoinSimplexInt numberRows,527 528 529 CoinBigIndex maximumU);608 virtual void getAreas(CoinSimplexInt numberRows, 609 CoinSimplexInt numberColumns, 610 CoinBigIndex maximumL, 611 CoinBigIndex maximumU); 530 612 531 613 /// PreProcesses column ordered copy of basis 532 virtual void preProcess ();533 void preProcess (CoinSimplexInt);614 virtual void preProcess(); 615 void preProcess(CoinSimplexInt); 534 616 /// Return largest element 535 double preProcess3 ();536 void preProcess4 ();617 double preProcess3(); 618 void preProcess4(); 537 619 /// Does most of factorization 538 virtual CoinSimplexInt factor (AbcSimplex *model);620 virtual CoinSimplexInt factor(AbcSimplex *model); 539 621 #ifdef EARLY_FACTORIZE 540 622 /// Returns 2 if can't, 1 if singular, 99 memory, 0 OK 541 virtual int factorize (AbcSimplex * model, CoinIndexedVector &stuff);623 virtual int factorize(AbcSimplex *model, CoinIndexedVector &stuff); 542 624 #endif 543 625 /// Does post processing on valid factorization  putting variables on correct rows 544 virtual void postProcess(const CoinSimplexInt * sequence, CoinSimplexInt *pivotVariable);626 virtual void postProcess(const CoinSimplexInt *sequence, CoinSimplexInt *pivotVariable); 545 627 /// Makes a nonsingular basis by replacing variables 546 virtual void makeNonSingular(CoinSimplexInt * sequence); 628 virtual void makeNonSingular(CoinSimplexInt *sequence); 629 547 630 protected: 548 631 /** Does sparse phase of factorization 549 632 return code is <0 error, 0= finished */ 550 CoinSimplexInt factorSparse ();633 CoinSimplexInt factorSparse(); 551 634 /** Does dense phase of factorization 552 635 return code is <0 error, 0= finished */ 553 CoinSimplexInt factorDense ();636 CoinSimplexInt factorDense(); 554 637 555 638 /// Pivots when just one other row so faster? 556 bool pivotOneOtherRow (CoinSimplexInt pivotRow,557 CoinSimplexInt pivotColumn);639 bool pivotOneOtherRow(CoinSimplexInt pivotRow, 640 CoinSimplexInt pivotColumn); 558 641 /// Does one pivot on Row Singleton in factorization 559 bool pivotRowSingleton (CoinSimplexInt pivotRow,560 CoinSimplexInt pivotColumn);642 bool pivotRowSingleton(CoinSimplexInt pivotRow, 643 CoinSimplexInt pivotColumn); 561 644 /// Does one pivot on Column Singleton in factorization (can't return false) 562 void pivotColumnSingleton (CoinSimplexInt pivotRow,563 CoinSimplexInt pivotColumn);645 void pivotColumnSingleton(CoinSimplexInt pivotRow, 646 CoinSimplexInt pivotColumn); 564 647 /// After pivoting 565 void afterPivot( 566 CoinSimplexInt pivotColumn);648 void afterPivot(CoinSimplexInt pivotRow, 649 CoinSimplexInt pivotColumn); 567 650 /// After pivoting  returns true if need to go dense 568 651 int wantToGoDense(); … … 572 655 also moves existing vector, 573 656 extraNeeded is over and above present */ 574 bool getColumnSpace (CoinSimplexInt iColumn,575 CoinSimplexInt extraNeeded);657 bool getColumnSpace(CoinSimplexInt iColumn, 658 CoinSimplexInt extraNeeded); 576 659 577 660 /** Reorders U so contiguous and in order (if there is space) … … 581 664 may have to do compression (returns true) 582 665 also moves existing vector */ 583 bool getColumnSpaceIterateR (CoinSimplexInt iColumn, CoinFactorizationDouble value,584 666 bool getColumnSpaceIterateR(CoinSimplexInt iColumn, CoinFactorizationDouble value, 667 CoinSimplexInt iRow); 585 668 /** getColumnSpaceIterate. Gets space for one extra U element in Column 586 669 may have to do compression (returns true) … … 588 671 Returns 1 if no memory or where element was put 589 672 Used by replaceRow (turns off R version) */ 590 CoinBigIndex getColumnSpaceIterate (CoinSimplexInt iColumn, CoinFactorizationDouble value,591 673 CoinBigIndex getColumnSpaceIterate(CoinSimplexInt iColumn, CoinFactorizationDouble value, 674 CoinSimplexInt iRow); 592 675 /** Gets space for one Row with given length, 593 676 may have to do compression (returns True if successful), 594 677 also moves existing vector */ 595 bool getRowSpace ( CoinSimplexInt iRow, CoinSimplexInt extraNeeded);678 bool getRowSpace(CoinSimplexInt iRow, CoinSimplexInt extraNeeded); 596 679 597 680 /** Gets space for one Row with given length while iterating, 598 681 may have to do compression (returns True if successful), 599 682 also moves existing vector */ 600 bool getRowSpaceIterate (CoinSimplexInt iRow,601 CoinSimplexInt extraNeeded);683 bool getRowSpaceIterate(CoinSimplexInt iRow, 684 CoinSimplexInt extraNeeded); 602 685 /// Checks that row and column copies look OK 603 void checkConsistency ();686 void checkConsistency(); 604 687 //#define CHECK_LINKS 605 688 #ifdef CHECK_LINKS 606 void checkLinks(int x =0);689 void checkLinks(int x = 0); 607 690 #else 608 # define checkLinks(x)691 #define checkLinks(x) 609 692 #endif 610 693 /// Adds a link in chain of equal counts 611 inline void addLink ( CoinSimplexInt index, CoinSimplexInt count ) { 612 CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_; 613 CoinSimplexInt * COIN_RESTRICT firstCount = this>firstCount(); 614 CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_; 694 inline void addLink(CoinSimplexInt index, CoinSimplexInt count) 695 { 696 CoinSimplexInt *COIN_RESTRICT nextCount = nextCountAddress_; 697 CoinSimplexInt *COIN_RESTRICT firstCount = this>firstCount(); 698 CoinSimplexInt *COIN_RESTRICT lastCount = lastCountAddress_; 615 699 CoinSimplexInt next = firstCount[count]; 616 700 firstCount[count] = index; 617 701 nextCount[index] = next; 618 lastCount[index] = count numberRows_2; // points to firstCount[count]619 if (next >=0)702 lastCount[index] = count  numberRows_  2; // points to firstCount[count] 703 if (next >= 0) 620 704 lastCount[next] = index; 621 705 } 622 706 /// Deletes a link in chain of equal counts 623 inline void deleteLink ( CoinSimplexInt index ) { 624 CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_; 625 CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_; 707 inline void deleteLink(CoinSimplexInt index) 708 { 709 CoinSimplexInt *COIN_RESTRICT nextCount = nextCountAddress_; 710 CoinSimplexInt *COIN_RESTRICT lastCount = lastCountAddress_; 626 711 CoinSimplexInt next = nextCount[index]; 627 712 CoinSimplexInt last = lastCount[index]; 628 assert (next!=index);629 assert (last!=index);630 if (next >=0)713 assert(next != index); 714 assert(last != index); 715 if (next >= 0) 631 716 lastCount[next] = last; 632 if (last >=0) {717 if (last >= 0) { 633 718 nextCount[last] = next; 634 719 } else { 635 int count =last+numberRows_+2;636 CoinSimplexInt * 637 firstCount[count] =next;720 int count = last + numberRows_ + 2; 721 CoinSimplexInt *COIN_RESTRICT firstCount = this>firstCount(); 722 firstCount[count] = next; 638 723 } 639 724 } 640 725 /// Modifies links in chain of equal counts 641 inline void modifyLink ( CoinSimplexInt index, CoinSimplexInt count ) { 642 CoinSimplexInt * COIN_RESTRICT nextCount = nextCountAddress_; 643 CoinSimplexInt * COIN_RESTRICT lastCount = lastCountAddress_; 644 CoinSimplexInt * COIN_RESTRICT firstCount = this>firstCount(); 726 inline void modifyLink(CoinSimplexInt index, CoinSimplexInt count) 727 { 728 CoinSimplexInt *COIN_RESTRICT nextCount = nextCountAddress_; 729 CoinSimplexInt *COIN_RESTRICT lastCount = lastCountAddress_; 730 CoinSimplexInt *COIN_RESTRICT firstCount = this>firstCount(); 645 731 CoinSimplexInt next2 = firstCount[count]; 646 if (next2 ==index)732 if (next2 == index) 647 733 return; 648 734 firstCount[count] = index; 649 735 CoinSimplexInt next = nextCount[index]; 650 736 CoinSimplexInt last = lastCount[index]; 651 assert (next!=index);652 assert (last!=index);737 assert(next != index); 738 assert(last != index); 653 739 nextCount[index] = next2; 654 lastCount[index] = count numberRows_2; // points to firstCount[count]655 if (next >=0)740 lastCount[index] = count  numberRows_  2; // points to firstCount[count] 741 if (next >= 0) 656 742 lastCount[next] = last; 657 if (next2 >=0)743 if (next2 >= 0) 658 744 lastCount[next2] = index; 659 if (last >=0) {745 if (last >= 0) { 660 746 nextCount[last] = next; 661 747 } else { 662 int count =last+numberRows_+2;663 firstCount[count] =next;748 int count = last + numberRows_ + 2; 749 firstCount[count] = next; 664 750 } 665 751 } 666 752 /// Separate out links with same row/column count 667 753 void separateLinks(); 668 void separateLinks(CoinSimplexInt, CoinSimplexInt);754 void separateLinks(CoinSimplexInt, CoinSimplexInt); 669 755 /// Cleans up at end of factorization 670 void cleanup ();756 void cleanup(); 671 757 /// Set up addresses from arrays 672 758 void doAddresses(); 673 759 674 760 /// Updates part of column (FTRANL) 675 void updateColumnL ( CoinIndexedVector * region 676 #if ABC_SMALL<2 677 , CoinAbcStatistics & statistics 761 void updateColumnL(CoinIndexedVector *region 762 #if ABC_SMALL < 2 763 , 764 CoinAbcStatistics &statistics 678 765 #endif 679 766 #if ABC_PARALLEL 680 ,int whichSparse=0 681 #endif 682 ) const; 767 , 768 int whichSparse = 0 769 #endif 770 ) const; 683 771 /// Updates part of column (FTRANL) when densish 684 void updateColumnLDensish ( CoinIndexedVector * region) const;772 void updateColumnLDensish(CoinIndexedVector *region) const; 685 773 /// Updates part of column (FTRANL) when dense (i.e. do as inner products) 686 void updateColumnLDense ( CoinIndexedVector * region) const;774 void updateColumnLDense(CoinIndexedVector *region) const; 687 775 /// Updates part of column (FTRANL) when sparse 688 void updateColumnLSparse ( CoinIndexedVector * region776 void updateColumnLSparse(CoinIndexedVector *region 689 777 #if ABC_PARALLEL 690 ,int whichSparse 691 #endif 692 ) const; 778 , 779 int whichSparse 780 #endif 781 ) const; 693 782 694 783 /// Updates part of column (FTRANR) without FT update 695 void updateColumnR ( CoinIndexedVector * region 696 #if ABC_SMALL<2 697 , CoinAbcStatistics & statistics 784 void updateColumnR(CoinIndexedVector *region 785 #if ABC_SMALL < 2 786 , 787 CoinAbcStatistics &statistics 698 788 #endif 699 789 #if ABC_PARALLEL 700 ,int whichSparse=0 701 #endif 702 ) const; 790 , 791 int whichSparse = 0 792 #endif 793 ) const; 703 794 /// Store update after doing L and R  retuns false if no room 704 795 bool storeFT( 705 #if ABC_SMALL <3706 const 707 #endif 708 CoinIndexedVector *regionFT);796 #if ABC_SMALL < 3 797 const 798 #endif 799 CoinIndexedVector *regionFT); 709 800 /// Updates part of column (FTRANU) 710 void updateColumnU ( CoinIndexedVector * region 711 #if ABC_SMALL<2 712 , CoinAbcStatistics & statistics 801 void updateColumnU(CoinIndexedVector *region 802 #if ABC_SMALL < 2 803 , 804 CoinAbcStatistics &statistics 713 805 #endif 714 806 #if ABC_PARALLEL 715 ,int whichSparse=0 716 #endif 717 ) const; 807 , 808 int whichSparse = 0 809 #endif 810 ) const; 718 811 719 812 /// Updates part of column (FTRANU) when sparse 720 void updateColumnUSparse ( CoinIndexedVector *regionSparse813 void updateColumnUSparse(CoinIndexedVector *regionSparse 721 814 #if ABC_PARALLEL 722 ,int whichSparse 723 #endif 724 ) const; 815 , 816 int whichSparse 817 #endif 818 ) const; 725 819 /// Updates part of column (FTRANU) 726 void updateColumnUDensish ( CoinIndexedVector *regionSparse) const;820 void updateColumnUDensish(CoinIndexedVector *regionSparse) const; 727 821 /// Updates part of column (FTRANU) when dense (i.e. do as inner products) 728 void updateColumnUDense ( CoinIndexedVector *regionSparse) const;822 void updateColumnUDense(CoinIndexedVector *regionSparse) const; 729 823 /// Updates part of 2 columns (FTRANU) real work 730 void updateTwoColumnsUDensish 731 CoinSimplexInt &numberNonZero1,732 CoinFactorizationDouble * COIN_RESTRICT region1, 733 CoinSimplexInt *COIN_RESTRICT index1,734 CoinSimplexInt &numberNonZero2,735 CoinFactorizationDouble * COIN_RESTRICT region2, 736 CoinSimplexInt *COIN_RESTRICT index2) const;824 void updateTwoColumnsUDensish( 825 CoinSimplexInt &numberNonZero1, 826 CoinFactorizationDouble *COIN_RESTRICT region1, 827 CoinSimplexInt *COIN_RESTRICT index1, 828 CoinSimplexInt &numberNonZero2, 829 CoinFactorizationDouble *COIN_RESTRICT region2, 830 CoinSimplexInt *COIN_RESTRICT index2) const; 737 831 /// Updates part of column PFI (FTRAN) (after rest) 738 void updateColumnPFI ( CoinIndexedVector * regionSparse) const;832 void updateColumnPFI(CoinIndexedVector *regionSparse) const; 739 833 /// Updates part of column transpose PFI (BTRAN) (before rest) 740 void updateColumnTransposePFI ( CoinIndexedVector *region) const;834 void updateColumnTransposePFI(CoinIndexedVector *region) const; 741 835 /** Updates part of column transpose (BTRANU), 742 836 assumes index is sorted i.e. region is correct */ 743 void updateColumnTransposeU ( CoinIndexedVector * region, 744 CoinSimplexInt smallestIndex 745 #if ABC_SMALL<2 746 , CoinAbcStatistics & statistics 837 void updateColumnTransposeU(CoinIndexedVector *region, 838 CoinSimplexInt smallestIndex 839 #if ABC_SMALL < 2 840 , 841 CoinAbcStatistics &statistics 747 842 #endif 748 843 #if ABC_PARALLEL 749 ,int whichCpu 750 #endif 751 ) const; 844 , 845 int whichCpu 846 #endif 847 ) const; 752 848 /** Updates part of column transpose (BTRANU) when densish, 753 849 assumes index is sorted i.e. region is correct */ 754 void updateColumnTransposeUDensish ( CoinIndexedVector *region,755 850 void updateColumnTransposeUDensish(CoinIndexedVector *region, 851 CoinSimplexInt smallestIndex) const; 756 852 /** Updates part of column transpose (BTRANU) when sparse, 757 853 assumes index is sorted i.e. region is correct */ 758 void updateColumnTransposeUSparse ( CoinIndexedVector *region854 void updateColumnTransposeUSparse(CoinIndexedVector *region 759 855 #if ABC_PARALLEL 760 ,int whichSparse 761 #endif 762 ) const; 856 , 857 int whichSparse 858 #endif 859 ) const; 763 860 /** Updates part of column transpose (BTRANU) by column 764 861 assumes index is sorted i.e. region is correct */ 765 void updateColumnTransposeUByColumn ( CoinIndexedVector *region,766 862 void updateColumnTransposeUByColumn(CoinIndexedVector *region, 863 CoinSimplexInt smallestIndex) const; 767 864 768 865 /// Updates part of column transpose (BTRANR) 769 void updateColumnTransposeR ( CoinIndexedVector * region 770 #if ABC_SMALL<2 771 , CoinAbcStatistics & statistics 772 #endif 773 ) const; 866 void updateColumnTransposeR(CoinIndexedVector *region 867 #if ABC_SMALL < 2 868 , 869 CoinAbcStatistics &statistics 870 #endif 871 ) const; 774 872 /// Updates part of column transpose (BTRANR) when dense 775 void updateColumnTransposeRDensish ( CoinIndexedVector * region) const;873 void updateColumnTransposeRDensish(CoinIndexedVector *region) const; 776 874 /// Updates part of column transpose (BTRANR) when sparse 777 void updateColumnTransposeRSparse ( CoinIndexedVector * region) const;875 void updateColumnTransposeRSparse(CoinIndexedVector *region) const; 778 876 779 877 /// Updates part of column transpose (BTRANL) 780 void updateColumnTransposeL ( CoinIndexedVector * region 781 #if ABC_SMALL<2 782 , CoinAbcStatistics & statistics 878 void updateColumnTransposeL(CoinIndexedVector *region 879 #if ABC_SMALL < 2 880 , 881 CoinAbcStatistics &statistics 783 882 #endif 784 883 #if ABC_PARALLEL 785 ,int whichSparse 786 #endif 787 ) const; 884 , 885 int whichSparse 886 #endif 887 ) const; 788 888 /// Updates part of column transpose (BTRANL) when densish by column 789 void updateColumnTransposeLDensish ( CoinIndexedVector * region) const;889 void updateColumnTransposeLDensish(CoinIndexedVector *region) const; 790 890 /// Updates part of column transpose (BTRANL) when densish by row 791 void updateColumnTransposeLByRow ( CoinIndexedVector * region) const;891 void updateColumnTransposeLByRow(CoinIndexedVector *region) const; 792 892 /// Updates part of column transpose (BTRANL) when sparse (by Row) 793 void updateColumnTransposeLSparse ( CoinIndexedVector * region893 void updateColumnTransposeLSparse(CoinIndexedVector *region 794 894 #if ABC_PARALLEL 795 ,int whichSparse 796 #endif 797 ) const; 895 , 896 int whichSparse 897 #endif 898 ) const; 798 899 public: 799 900 /** Replaces one Column to basis for PFI … … 801 902 In this case region is not empty  it is incoming variable (updated) 802 903 */ 803 CoinSimplexInt replaceColumnPFI ( CoinIndexedVector * regionSparse, 804 CoinSimplexInt pivotRow, CoinSimplexDouble alpha); 904 CoinSimplexInt replaceColumnPFI(CoinIndexedVector *regionSparse, 905 CoinSimplexInt pivotRow, CoinSimplexDouble alpha); 906 805 907 protected: 806 908 /** Returns accuracy status of replaceColumn … … 808 910 CoinSimplexInt checkPivot(CoinSimplexDouble saveFromU, CoinSimplexDouble oldPivot) const; 809 911 /// 0 fine, 99 singular, 2 dense 810 int pivot (CoinSimplexInt pivotRow,811 812 813 814 CoinFactorizationDouble *COIN_RESTRICT work,815 CoinSimplexUnsignedInt *COIN_RESTRICT workArea2,816 817 int * COIN_RESTRICT markRow);818 int pivot ( CoinSimplexInt &pivotRow,819 CoinSimplexInt &pivotColumn,820 821 822 int * COIN_RESTRICT markRow);823 #if ABC_SMALL <2912 int pivot(CoinSimplexInt pivotRow, 913 CoinSimplexInt pivotColumn, 914 CoinBigIndex pivotRowPosition, 915 CoinBigIndex pivotColumnPosition, 916 CoinFactorizationDouble *COIN_RESTRICT work, 917 CoinSimplexUnsignedInt *COIN_RESTRICT workArea2, 918 CoinSimplexInt increment2, 919 int *COIN_RESTRICT markRow); 920 int pivot(CoinSimplexInt &pivotRow, 921 CoinSimplexInt &pivotColumn, 922 CoinBigIndex pivotRowPosition, 923 CoinBigIndex pivotColumnPosition, 924 int *COIN_RESTRICT markRow); 925 #if ABC_SMALL < 2 824 926 #define CONVERTROW 2 825 #elif ABC_SMALL <4927 #elif ABC_SMALL < 4 826 928 #else 827 929 #undef ABC_DENSE_CODE … … 830 932 831 933 //@} 832 ////////////////// data //////////////////934 ////////////////// data ////////////////// 833 935 protected: 834 835 936 /**@name data */ 836 937 //@{ 837 CoinSimplexInt * 838 CoinSimplexInt * 839 CoinFactorizationDouble * 840 CoinFactorizationDouble * 841 CoinSimplexInt * 842 CoinSimplexInt * 843 CoinSimplexInt * 938 CoinSimplexInt *pivotColumnAddress_; 939 CoinSimplexInt *permuteAddress_; 940 CoinFactorizationDouble *pivotRegionAddress_; 941 CoinFactorizationDouble *elementUAddress_; 942 CoinSimplexInt *indexRowUAddress_; 943 CoinSimplexInt *numberInColumnAddress_; 944 CoinSimplexInt *numberInColumnPlusAddress_; 844 945 #ifdef ABC_USE_FUNCTION_POINTERS 845 946 /// Array of function pointers 846 scatterStruct * 847 CoinFactorizationDouble * 848 #endif 849 CoinBigIndex * 947 scatterStruct *scatterPointersUColumnAddress_; 948 CoinFactorizationDouble *elementUColumnPlusAddress_; 949 #endif 950 CoinBigIndex *startColumnUAddress_; 850 951 #if CONVERTROW 851 CoinBigIndex * 852 #if CONVERTROW >1853 CoinBigIndex * 854 #endif 855 #endif 856 #if ABC_SMALL <2857 CoinFactorizationDouble * 858 #endif 859 CoinBigIndex * 860 CoinSimplexInt * 861 CoinSimplexInt * 862 CoinSimplexInt * 952 CoinBigIndex *convertRowToColumnUAddress_; 953 #if CONVERTROW > 1 954 CoinBigIndex *convertColumnToRowUAddress_; 955 #endif 956 #endif 957 #if ABC_SMALL < 2 958 CoinFactorizationDouble *elementRowUAddress_; 959 #endif 960 CoinBigIndex *startRowUAddress_; 961 CoinSimplexInt *numberInRowAddress_; 962 CoinSimplexInt *indexColumnUAddress_; 963 CoinSimplexInt *firstCountAddress_; 863 964 /// Next Row/Column with count 864 CoinSimplexInt * 965 CoinSimplexInt *nextCountAddress_; 865 966 /// Previous Row/Column with count 866 CoinSimplexInt * 867 CoinSimplexInt * 868 CoinSimplexInt * 869 CoinSimplexInt * 870 CoinSimplexInt * 871 CoinSimplexInt * 967 CoinSimplexInt *lastCountAddress_; 968 CoinSimplexInt *nextColumnAddress_; 969 CoinSimplexInt *lastColumnAddress_; 970 CoinSimplexInt *nextRowAddress_; 971 CoinSimplexInt *lastRowAddress_; 972 CoinSimplexInt *saveColumnAddress_; 872 973 //CoinSimplexInt * saveColumnAddress2_; 873 CoinCheckZero * 874 CoinSimplexInt * 875 CoinFactorizationDouble * 876 CoinSimplexInt * 877 CoinBigIndex * 878 #if ABC_SMALL <2879 CoinBigIndex * 880 #endif 881 CoinSimplexInt * 882 CoinSimplexInt * 883 CoinSimplexInt * 884 CoinBigIndex * 974 CoinCheckZero *markRowAddress_; 975 CoinSimplexInt *listAddress_; 976 CoinFactorizationDouble *elementLAddress_; 977 CoinSimplexInt *indexRowLAddress_; 978 CoinBigIndex *startColumnLAddress_; 979 #if ABC_SMALL < 2 980 CoinBigIndex *startRowLAddress_; 981 #endif 982 CoinSimplexInt *pivotLinkedBackwardsAddress_; 983 CoinSimplexInt *pivotLinkedForwardsAddress_; 984 CoinSimplexInt *pivotLOrderAddress_; 985 CoinBigIndex *startColumnRAddress_; 885 986 /// Elements of R 886 987 CoinFactorizationDouble *elementRAddress_; 887 988 /// Row indices for R 888 989 CoinSimplexInt *indexRowRAddress_; 889 CoinSimplexInt * 890 CoinFactorizationDouble * 891 #if ABC_SMALL <4892 CoinFactorizationDouble * 893 #endif 894 CoinFactorizationDouble * 895 CoinSimplexUnsignedInt * 896 mutable CoinSimplexInt * 990 CoinSimplexInt *indexColumnLAddress_; 991 CoinFactorizationDouble *elementByRowLAddress_; 992 #if ABC_SMALL < 4 993 CoinFactorizationDouble *denseAreaAddress_; 994 #endif 995 CoinFactorizationDouble *workAreaAddress_; 996 CoinSimplexUnsignedInt *workArea2Address_; 997 mutable CoinSimplexInt *sparseAddress_; 897 998 #ifdef SMALL_PERMUTE 898 CoinSimplexInt * 899 CoinSimplexInt * 900 #endif 999 CoinSimplexInt *fromSmallToBigRow_; 1000 CoinSimplexInt *fromSmallToBigColumn_; 1001 #endif 901 1002 /// Number of Rows after iterating 902 1003 CoinSimplexInt numberRowsExtra_; … … 914 1015 /// First place in funny copy zeroed out 915 1016 CoinBigIndex firstZeroed_; 916 #if ABC_SMALL <21017 #if ABC_SMALL < 2 917 1018 /// Below this use sparse technology  if 0 then no L row copy 918 1019 CoinSimplexInt sparseThreshold_; … … 952 1053 /// Number of trials before rejection 953 1054 CoinSimplexInt numberTrials_; 954 #if ABC_SMALL <41055 #if ABC_SMALL < 4 955 1056 /// Leading dimension for dense 956 1057 CoinSimplexInt leadingDimension_; 957 1058 #endif 958 #if COIN_BIG_DOUBLE ==11059 #if COIN_BIG_DOUBLE == 1 959 1060 /// Work arrays 960 1061 mutable CoinFactorizationLongDoubleArrayWithLength longArray_[FACTOR_CPU]; 961 1062 /// Associated CoinIndexedVector 962 mutable CoinIndexedVector * 1063 mutable CoinIndexedVector *associatedVector_[FACTOR_CPU]; 963 1064 #endif 964 1065 /// Pivot order for each Column … … 1004 1105 #endif 1005 1106 #if CONVERTROW 1006 /// Converts rows to columns in U 1107 /// Converts rows to columns in U 1007 1108 CoinBigIndexArrayWithLength convertRowToColumnU_; 1008 #if CONVERTROW >11009 /// Converts columns to rows in U 1109 #if CONVERTROW > 1 1110 /// Converts columns to rows in U 1010 1111 CoinBigIndexArrayWithLength convertColumnToRowU_; 1011 1112 #endif 1012 1113 #endif 1013 #if ABC_SMALL <21114 #if ABC_SMALL < 2 1014 1115 /// Elements of U by row 1015 1116 CoinFactorizationDoubleArrayWithLength elementRowU_; … … 1021 1122 /// Start of each column in L 1022 1123 CoinBigIndexArrayWithLength startColumnL_; 1023 #if ABC_SMALL <41124 #if ABC_SMALL < 4 1024 1125 /// Dense area 1025 1126 CoinFactorizationDoubleArrayWithLength denseArea_; … … 1029 1130 /// Second work area 1030 1131 CoinUnsignedIntArrayWithLength workArea2_; 1031 #if ABC_SMALL <21132 #if ABC_SMALL < 2 1032 1133 /// Start of each row in L 1033 1134 CoinBigIndexArrayWithLength startRowL_; … … 1045 1146 // last slack pivot row 1046 1147 CoinSimplexInt lastSlack_; 1047 #if ABC_SMALL <21148 #if ABC_SMALL < 2 1048 1149 /// To decide how to solve 1049 1150 mutable double ftranCountInput_; … … 1057 1158 double ftranTwiddleFactor1_; 1058 1159 double ftranTwiddleFactor2_; 1059 #endif 1160 #endif 1060 1161 mutable CoinSimplexInt numberFtranCounts_; 1061 1162 #endif 1062 1163 /// Maximum rows (ever) (here to use double alignment) 1063 1164 CoinSimplexInt maximumRows_; 1064 #if ABC_SMALL <21165 #if ABC_SMALL < 2 1065 1166 mutable double ftranFTCountInput_; 1066 1167 mutable double ftranFTCountAfterL_; … … 1073 1174 double ftranFTTwiddleFactor1_; 1074 1175 double ftranFTTwiddleFactor2_; 1075 #endif 1176 #endif 1076 1177 mutable CoinSimplexInt numberFtranFTCounts_; 1077 1178 #endif 1078 #if ABC_SMALL <41179 #if ABC_SMALL < 4 1079 1180 /// Dense threshold (here to use double alignment) 1080 1181 CoinSimplexInt denseThreshold_; 1081 1182 #endif 1082 #if ABC_SMALL <21183 #if ABC_SMALL < 2 1083 1184 mutable double btranCountInput_; 1084 1185 mutable double btranCountAfterU_; … … 1091 1192 double btranTwiddleFactor1_; 1092 1193 double btranTwiddleFactor2_; 1093 #endif 1194 #endif 1094 1195 mutable CoinSimplexInt numberBtranCounts_; 1095 1196 #endif 1096 1197 /// Maximum maximum pivots 1097 1198 CoinSimplexInt maximumMaximumPivots_; 1098 #if ABC_SMALL <21199 #if ABC_SMALL < 2 1099 1200 /// To decide how to solve 1100 1201 mutable double ftranFullCountInput_; … … 1108 1209 double ftranFullTwiddleFactor1_; 1109 1210 double ftranFullTwiddleFactor2_; 1110 #endif 1211 #endif 1111 1212 mutable CoinSimplexInt numberFtranFullCounts_; 1112 1213 #endif 1113 1214 /// Rows first time nonzero 1114 1215 CoinSimplexInt initialNumberRows_; 1115 #if ABC_SMALL <21216 #if ABC_SMALL < 2 1116 1217 /// To decide how to solve 1117 1218 mutable double btranFullCountInput_; … … 1125 1226 double btranFullTwiddleFactor1_; 1126 1227 double btranFullTwiddleFactor2_; 1127 #endif 1228 #endif 1128 1229 mutable CoinSimplexInt numberBtranFullCounts_; 1129 1230 #endif … … 1137 1238 /// Size in bytes of a sparseArray 1138 1239 CoinBigIndex sizeSparseArray_; 1240 1139 1241 public: 1140 #if ABC_SMALL<2 1141 #if ABC_SMALL>=0 1142 inline bool gotLCopy() const {return ((state_&ABC_FAC_GOT_LCOPY)!=0);} 1143 inline void setNoGotLCopy() {state_ &= ~ABC_FAC_GOT_LCOPY;} 1144 inline void setYesGotLCopy() {state_ = ABC_FAC_GOT_LCOPY;} 1145 inline bool gotRCopy() const {return ((state_&ABC_FAC_GOT_RCOPY)!=0);} 1146 inline void setNoGotRCopy() {state_ &= ~ABC_FAC_GOT_RCOPY;} 1147 inline void setYesGotRCopy() {state_ = ABC_FAC_GOT_RCOPY;} 1148 inline bool gotUCopy() const {return ((state_&ABC_FAC_GOT_UCOPY)!=0);} 1149 inline void setNoGotUCopy() {state_ &= ~ABC_FAC_GOT_UCOPY;} 1150 inline void setYesGotUCopy() {state_ = ABC_FAC_GOT_UCOPY;} 1151 inline bool gotSparse() const {return ((state_&ABC_FAC_GOT_SPARSE)!=0);} 1152 inline void setNoGotSparse() {state_ &= ~ABC_FAC_GOT_SPARSE;} 1153 inline void setYesGotSparse() {state_ = ABC_FAC_GOT_SPARSE;} 1242 #if ABC_SMALL < 2 1243 #if ABC_SMALL >= 0 1244 inline bool gotLCopy() const 1245 { 1246 return ((state_ & ABC_FAC_GOT_LCOPY) != 0); 1247 } 1248 inline void setNoGotLCopy() { state_ &= ~ABC_FAC_GOT_LCOPY; } 1249 inline void setYesGotLCopy() { state_ = ABC_FAC_GOT_LCOPY; } 1250 inline bool gotRCopy() const { return ((state_ & ABC_FAC_GOT_RCOPY) != 0); } 1251 inline void setNoGotRCopy() { state_ &= ~ABC_FAC_GOT_RCOPY; } 1252 inline void setYesGotRCopy() { state_ = ABC_FAC_GOT_RCOPY; } 1253 inline bool gotUCopy() const { return ((state_ & ABC_FAC_GOT_UCOPY) != 0); } 1254 inline void setNoGotUCopy() { state_ &= ~ABC_FAC_GOT_UCOPY; } 1255 inline void setYesGotUCopy() { state_ = ABC_FAC_GOT_UCOPY; } 1256 inline bool gotSparse() const { return ((state_ & ABC_FAC_GOT_SPARSE) != 0); } 1257 inline void setNoGotSparse() { state_ &= ~ABC_FAC_GOT_SPARSE; } 1258 inline void setYesGotSparse() { state_ = ABC_FAC_GOT_SPARSE; } 1154 1259 #else 1155 1260 // force use of copies 1156 inline bool gotLCopy() const { return true;}1261 inline bool gotLCopy() const { return true; } 1157 1262 inline void setNoGotLCopy() {} 1158 1263 inline void setYesGotLCopy() {} 1159 inline bool gotRCopy() const { return true;}1264 inline bool gotRCopy() const { return true; } 1160 1265 inline void setNoGotRCopy() {} 1161 1266 inline void setYesGotRCopy() {} 1162 inline bool gotUCopy() const { return true;}1267 inline bool gotUCopy() const { return true; } 1163 1268 inline void setNoGotUCopy() {} 1164 1269 inline void setYesGotUCopy() {} 1165 inline bool gotSparse() const { return true;}1270 inline bool gotSparse() const { return true; } 1166 1271 inline void setNoGotSparse() {} 1167 1272 inline void setYesGotSparse() {} … … 1169 1274 #else 1170 1275 // force no use of copies 1171 inline bool gotLCopy() const { return false;}1276 inline bool gotLCopy() const { return false; } 1172 1277 inline void setNoGotLCopy() {} 1173 1278 inline void setYesGotLCopy() {} 1174 inline bool gotRCopy() const { return false;}1279 inline bool gotRCopy() const { return false; } 1175 1280 inline void setNoGotRCopy() {} 1176 1281 inline void setYesGotRCopy() {} 1177 inline bool gotUCopy() const { return false;}1282 inline bool gotUCopy() const { return false; } 1178 1283 inline void setNoGotUCopy() {} 1179 1284 inline void setYesGotUCopy() {} 1180 inline bool gotSparse() const { return false;}1285 inline bool gotSparse() const { return false; } 1181 1286 inline void setNoGotSparse() {} 1182 1287 inline void setYesGotSparse() {} … … 1191 1296 }; 1192 1297 1193 1298 /* vi: softtabstop=2 shiftwidth=2 expandtab tabstop=2 1299 */
Note: See TracChangeset
for help on using the changeset viewer.