Changeset 461 for trunk/ClpNetworkMatrix.cpp
 Timestamp:
 Oct 1, 2004 4:01:01 PM (15 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/ClpNetworkMatrix.cpp
r451 r461 525 525 } 526 526 } 527 /* If element NULL returns number of elements in column part of basis, 528 If not NULL fills in as well */ 527 /// returns number of elements in column part of basis, 529 528 CoinBigIndex 530 ClpNetworkMatrix:: fillBasis(ClpSimplex * model,529 ClpNetworkMatrix::countBasis(ClpSimplex * model, 531 530 const int * whichColumn, 532 531 int numberBasic, 533 int & numberColumnBasic, 534 int * indexRowU, int * indexColumnU, 535 double * elementU) 532 int & numberColumnBasic) 536 533 { 537 534 int i; 538 535 CoinBigIndex numberElements=0; 539 if (elementU!=NULL) { 540 if (trueNetwork_) { 541 for (i=0;i<numberColumnBasic;i++) { 542 int iColumn = whichColumn[i]; 543 CoinBigIndex j=iColumn<<1; 544 int iRowM = indices_[j]; 545 int iRowP = indices_[j+1]; 536 if (trueNetwork_) { 537 numberElements = 2*numberColumnBasic; 538 } else { 539 for (i=0;i<numberColumnBasic;i++) { 540 int iColumn = whichColumn[i]; 541 CoinBigIndex j=iColumn<<1; 542 int iRowM = indices_[j]; 543 int iRowP = indices_[j+1]; 544 if (iRowM>=0) 545 numberElements ++; 546 if (iRowP>=0) 547 numberElements ++; 548 } 549 } 550 return numberElements; 551 } 552 void 553 ClpNetworkMatrix::fillBasis(ClpSimplex * model, 554 const int * whichColumn, 555 int & numberColumnBasic, 556 int * indexRowU, int * start, 557 int * rowCount, int * columnCount, 558 double * elementU) 559 { 560 int i; 561 CoinBigIndex numberElements=start[0]; 562 if (trueNetwork_) { 563 for (i=0;i<numberColumnBasic;i++) { 564 int iColumn = whichColumn[i]; 565 CoinBigIndex j=iColumn<<1; 566 int iRowM = indices_[j]; 567 int iRowP = indices_[j+1]; 568 indexRowU[numberElements]=iRowM; 569 rowCount[iRowM++]; 570 elementU[numberElements]=1.0; 571 indexRowU[numberElements+1]=iRowP; 572 rowCount[iRowP++]; 573 elementU[numberElements+1]=1.0; 574 numberElements+=2; 575 start[i+1]=numberElements; 576 columnCount[i]=2; 577 } 578 } else { 579 for (i=0;i<numberColumnBasic;i++) { 580 int iColumn = whichColumn[i]; 581 CoinBigIndex j=iColumn<<1; 582 int iRowM = indices_[j]; 583 int iRowP = indices_[j+1]; 584 if (iRowM>=0) { 546 585 indexRowU[numberElements]=iRowM; 547 indexColumnU[numberElements]=numberBasic; 548 elementU[numberElements]=1.0; 549 indexRowU[numberElements+1]=iRowP; 550 indexColumnU[numberElements+1]=numberBasic; 551 elementU[numberElements+1]=1.0; 552 numberElements+=2; 553 numberBasic++; 554 } 555 } else { 556 for (i=0;i<numberColumnBasic;i++) { 557 int iColumn = whichColumn[i]; 558 CoinBigIndex j=iColumn<<1; 559 int iRowM = indices_[j]; 560 int iRowP = indices_[j+1]; 561 if (iRowM>=0) { 562 indexRowU[numberElements]=iRowM; 563 indexColumnU[numberElements]=numberBasic; 564 elementU[numberElements++]=1.0; 565 } 566 if (iRowP>=0) { 567 indexRowU[numberElements]=iRowP; 568 indexColumnU[numberElements]=numberBasic; 569 elementU[numberElements++]=1.0; 570 } 571 numberBasic++; 572 } 573 } 574 } else { 575 if (trueNetwork_) { 576 numberElements = 2*numberColumnBasic; 577 } else { 578 for (i=0;i<numberColumnBasic;i++) { 579 int iColumn = whichColumn[i]; 580 CoinBigIndex j=iColumn<<1; 581 int iRowM = indices_[j]; 582 int iRowP = indices_[j+1]; 583 if (iRowM>=0) 584 numberElements ++; 585 if (iRowP>=0) 586 numberElements ++; 587 } 588 } 589 } 590 return numberElements; 586 rowCount[iRowM++]; 587 elementU[numberElements++]=1.0; 588 } 589 if (iRowP>=0) { 590 indexRowU[numberElements]=iRowP; 591 rowCount[iRowP++]; 592 elementU[numberElements++]=1.0; 593 } 594 start[i+1]=numberElements; 595 columnCount[i]=numberElementsstart[i]; 596 } 597 } 591 598 } 592 599 /* Unpacks a column into an CoinIndexedvector
Note: See TracChangeset
for help on using the changeset viewer.