Changeset e2afced in git for Singular/Minor.cc
- Timestamp:
- Oct 8, 2009, 12:11:57 PM (15 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 0a52b49fcfbb9270ac1d60e85d52e30fd24bbd96
- Parents:
- 967a9d48cc1d702f106bf47d327d87adbaf6833c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Minor.cc
r967a9d re2afced 6 6 #include "polys.h" 7 7 #include <Minor.h> 8 #include "febase.h" 8 9 9 10 void MinorKey::reset() { … … 21 22 22 23 // allocate memory for new entries in _rowKey and _columnKey; 23 _rowKey = new unsigned long[_numberOfRowBlocks];24 _columnKey = new unsigned long[_numberOfColumnBlocks];24 _rowKey = new unsigned int[_numberOfRowBlocks]; 25 _columnKey = new unsigned int[_numberOfColumnBlocks]; 25 26 26 27 // copying values from parameter arrays to private arrays … … 43 44 44 45 // allocate memory for new entries in _rowKey and _columnKey; 45 _rowKey = new unsigned long[_numberOfRowBlocks];46 _columnKey = new unsigned long[_numberOfColumnBlocks];46 _rowKey = new unsigned int[_numberOfRowBlocks]; 47 _columnKey = new unsigned int[_numberOfColumnBlocks]; 47 48 48 49 // copying values from parameter arrays to private arrays … … 55 56 } 56 57 57 void MinorKey::set(const int lengthOfRowArray, const unsigned long* rowKey,58 const int lengthOfColumnArray, const unsigned long* columnKey) {58 void MinorKey::set(const int lengthOfRowArray, const unsigned int* rowKey, 59 const int lengthOfColumnArray, const unsigned int* columnKey) { 59 60 // free memory of _rowKey and _columnKey 60 61 if (_numberOfRowBlocks > 0) { delete [] _rowKey; } … … 65 66 66 67 // allocate memory for new entries in _rowKey and _columnKey; 67 _rowKey = new unsigned long[_numberOfRowBlocks];68 _columnKey = new unsigned long[_numberOfColumnBlocks];68 _rowKey = new unsigned int[_numberOfRowBlocks]; 69 _columnKey = new unsigned int[_numberOfColumnBlocks]; 69 70 70 71 // copying values from parameter arrays to private arrays … … 75 76 } 76 77 77 MinorKey::MinorKey(const int lengthOfRowArray, const unsigned long* const rowKey,78 const int lengthOfColumnArray, const unsigned long* const columnKey) {78 MinorKey::MinorKey(const int lengthOfRowArray, const unsigned int* const rowKey, 79 const int lengthOfColumnArray, const unsigned int* const columnKey) { 79 80 _numberOfRowBlocks = lengthOfRowArray; 80 81 _numberOfColumnBlocks = lengthOfColumnArray; 81 82 82 83 // allocate memory for new entries in _rowKey and _columnKey; 83 _rowKey = new unsigned long[_numberOfRowBlocks];84 _columnKey = new unsigned long[_numberOfColumnBlocks];84 _rowKey = new unsigned int[_numberOfRowBlocks]; 85 _columnKey = new unsigned int[_numberOfColumnBlocks]; 85 86 86 87 // copying values from parameter arrays to private arrays … … 109 110 int matchedBits = -1; // counter for matched bits; this needs to reach i, then we're done 110 111 for (int block = 0; block < getNumberOfRowBlocks(); block ++) { // start with lowest bits, i.e. in block No. 0 111 unsigned longblockBits = getRowKey(block); // the bits in this block of 32 bits112 unsigned longshiftedBit = 1;112 unsigned int blockBits = getRowKey(block); // the bits in this block of 32 bits 113 unsigned int shiftedBit = 1; 113 114 int exponent = 0; 114 115 // The invariant "shiftedBit = 2^exponent" will hold throughout the entire while loop. … … 131 132 int matchedBits = -1; // counter for matched bits; this needs to reach i, then we're done 132 133 for (int block = 0; block < getNumberOfColumnBlocks(); block ++) { // start with lowest bits, i.e. in block No. 0 133 unsigned longblockBits = getColumnKey(block); // the bits in this block of 32 bits134 unsigned longshiftedBit = 1;134 unsigned int blockBits = getColumnKey(block); // the bits in this block of 32 bits 135 unsigned int shiftedBit = 1; 135 136 int exponent = 0; 136 137 // The invariant "shiftedBit = 2^exponent" will hold throughout the entire while loop. … … 149 150 int i = 0; // index for filling the target array 150 151 for (int block = 0; block < getNumberOfRowBlocks(); block ++) { // start with lowest bits, i.e. in block No. 0 151 unsigned longblockBits = getRowKey(block); // the bits in this block of 32 bits152 unsigned longshiftedBit = 1;152 unsigned int blockBits = getRowKey(block); // the bits in this block of 32 bits 153 unsigned int shiftedBit = 1; 153 154 int exponent = 0; 154 155 // The invariant "shiftedBit = 2^exponent" will hold throughout the entire while loop. … … 165 166 int i = 0; // index for filling the target array 166 167 for (int block = 0; block < getNumberOfColumnBlocks(); block ++) { // start with lowest bits, i.e. in block No. 0 167 unsigned longblockBits = getColumnKey(block); // the bits in this block of 32 bits168 unsigned longshiftedBit = 1;168 unsigned int blockBits = getColumnKey(block); // the bits in this block of 32 bits 169 unsigned int shiftedBit = 1; 169 170 int exponent = 0; 170 171 // The invariant "shiftedBit = 2^exponent" will hold throughout the entire while loop. … … 186 187 int matchedBits = -1; // counter for matched bits; this is going to contain our return value 187 188 for (int block = 0; block < getNumberOfRowBlocks(); block ++) { // start with lowest bits, i.e. in block No. 0 188 unsigned longblockBits = getRowKey(block); // the bits in this block of 32 bits189 unsigned longshiftedBit = 1;189 unsigned int blockBits = getRowKey(block); // the bits in this block of 32 bits 190 unsigned int shiftedBit = 1; 190 191 int exponent = 0; 191 192 // The invariant "shiftedBit = 2^exponent" will hold throughout the entire while loop. … … 209 210 int matchedBits = -1; // counter for matched bits; this is going to contain our return value 210 211 for (int block = 0; block < getNumberOfColumnBlocks(); block ++) { // start with lowest bits, i.e. in block No. 0 211 unsigned longblockBits = getColumnKey(block); // the bits in this block of 32 bits212 unsigned longshiftedBit = 1;212 unsigned int blockBits = getColumnKey(block); // the bits in this block of 32 bits 213 unsigned int shiftedBit = 1; 213 214 int exponent = 0; 214 215 // The invariant "shiftedBit = 2^exponent" will hold throughout the entire while loop. … … 224 225 } 225 226 226 unsigned longMinorKey::getRowKey(const int blockIndex) const {227 unsigned int MinorKey::getRowKey(const int blockIndex) const { 227 228 return _rowKey[blockIndex]; 228 229 } 229 230 230 unsigned longMinorKey::getColumnKey(const int blockIndex) const {231 unsigned int MinorKey::getColumnKey(const int blockIndex) const { 231 232 return _columnKey[blockIndex]; 232 233 } … … 244 245 if (a == 1) { // rows 245 246 for (int i = 0; i < _numberOfRowBlocks; i++) { 246 unsigned longm = _rowKey[i];247 unsigned longk = 1;247 unsigned int m = _rowKey[i]; 248 unsigned int k = 1; 248 249 for (int j = 0; j < 32; j++) { 249 250 // k = 2^j … … 255 256 else { // columns 256 257 for (int i = 0; i < _numberOfColumnBlocks; i++) { 257 unsigned longm = _columnKey[i];258 unsigned longk = 1;258 unsigned int m = _columnKey[i]; 259 unsigned int k = 1; 259 260 for (int j = 0; j < 32; j++) { 260 261 // k = 2^j … … 271 272 int rowBlock = absoluteEraseRowIndex / 32; 272 273 int exponent = absoluteEraseRowIndex % 32; 273 unsigned longnewRowBits = getRowKey(rowBlock) - (1 << exponent);274 unsigned int newRowBits = getRowKey(rowBlock) - (1 << exponent); 274 275 int highestRowBlock = getNumberOfRowBlocks() - 1; 275 276 // highestRowBlock will finally contain the highest block index with non-zero bit pattern … … 285 286 int columnBlock = absoluteEraseColumnIndex / 32; 286 287 exponent = absoluteEraseColumnIndex % 32; 287 unsigned longnewColumnBits = getColumnKey(columnBlock) - (1 << exponent);288 unsigned int newColumnBits = getColumnKey(columnBlock) - (1 << exponent); 288 289 int highestColumnBlock = getNumberOfColumnBlocks() - 1; 289 290 // highestColumnBlock will finally contain the highest block index with non-zero bit pattern … … 318 319 } 319 320 320 void MinorKey::setRowKey (const int blockIndex, const unsigned longrowKey) {321 void MinorKey::setRowKey (const int blockIndex, const unsigned int rowKey) { 321 322 _rowKey[blockIndex] = rowKey; 322 323 } 323 324 324 void MinorKey::setColumnKey (const int blockIndex, const unsigned longcolumnKey) {325 void MinorKey::setColumnKey (const int blockIndex, const unsigned int columnKey) { 325 326 _columnKey[blockIndex] = columnKey; 326 327 } … … 369 370 int hitBits = 0; // the number of bits we have hit; in the end, this has to be equal to k, 370 371 // the dimension of the minor 371 int blockIndex = -1; // the index of the current longin mk372 unsigned long highestLong= 0; // the new highest block of this MinorKey373 // We determine which longs of mk we can copy. Their indices will be 0, 1, ..., blockIndex - 1.374 // And highest Long is going to capture the highest long(which may be only a portion of375 // the corresponding longin mk. We loop until hitBits = k:372 int blockIndex = -1; // the index of the current int in mk 373 unsigned int highestInt = 0; // the new highest block of this MinorKey 374 // We determine which ints of mk we can copy. Their indices will be 0, 1, ..., blockIndex - 1. 375 // And highestInt is going to capture the highest int (which may be only a portion of 376 // the corresponding int in mk. We loop until hitBits = k: 376 377 while (hitBits < k) { 377 378 blockIndex++; 378 highest Long= 0;379 unsigned long currentLong= mk.getRowKey(blockIndex);380 unsigned longshiftedBit = 1;379 highestInt = 0; 380 unsigned int currentInt = mk.getRowKey(blockIndex); 381 unsigned int shiftedBit = 1; 381 382 int exponent = 0; 382 383 // invariant in the loop: shiftedBit = 2^exponent 383 384 while (exponent < 32 && hitBits < k) { 384 if (shiftedBit & current Long) {385 highest Long+= shiftedBit;385 if (shiftedBit & currentInt) { 386 highestInt += shiftedBit; 386 387 hitBits++; 387 388 } … … 394 395 _numberOfRowBlocks = blockIndex + 1; 395 396 // allocate memory for new entries in _rowKey; 396 _rowKey = new unsigned long[_numberOfRowBlocks];397 _rowKey = new unsigned int[_numberOfRowBlocks]; 397 398 // copying values from mk to this MinorKey 398 399 for (int r = 0; r < blockIndex; r++) 399 400 _rowKey[r] = mk.getRowKey(r); 400 _rowKey[blockIndex] = highest Long;401 _rowKey[blockIndex] = highestInt; 401 402 } 402 403 … … 404 405 int hitBits = 0; // the number of bits we have hit; in the end, this has to be equal to k, 405 406 // the dimension of the minor 406 int blockIndex = -1; // the index of the current longin mk407 unsigned long highestLong= 0; // the new highest block of this MinorKey408 // We determine which longs of mk we can copy. Their indices will be 0, 1, ..., blockIndex - 1.409 // And highest Long is going to capture the highest long(which may be only a portion of410 // the corresponding longin mk. We loop until hitBits = k:407 int blockIndex = -1; // the index of the current int in mk 408 unsigned int highestInt = 0; // the new highest block of this MinorKey 409 // We determine which ints of mk we can copy. Their indices will be 0, 1, ..., blockIndex - 1. 410 // And highestInt is going to capture the highest int (which may be only a portion of 411 // the corresponding int in mk. We loop until hitBits = k: 411 412 while (hitBits < k) { 412 413 blockIndex++; 413 highest Long= 0;414 unsigned long currentLong= mk.getColumnKey(blockIndex);415 unsigned longshiftedBit = 1;414 highestInt = 0; 415 unsigned int currentInt = mk.getColumnKey(blockIndex); 416 unsigned int shiftedBit = 1; 416 417 int exponent = 0; 417 418 // invariant in the loop: shiftedBit = 2^exponent 418 419 while (exponent < 32 && hitBits < k) { 419 if (shiftedBit & current Long) {420 highest Long+= shiftedBit;420 if (shiftedBit & currentInt) { 421 highestInt += shiftedBit; 421 422 hitBits++; 422 423 } … … 429 430 _numberOfColumnBlocks = blockIndex + 1; 430 431 // allocate memory for new entries in _columnKey; 431 _columnKey = new unsigned long[_numberOfColumnBlocks];432 _columnKey = new unsigned int[_numberOfColumnBlocks]; 432 433 // copying values from mk to this MinorKey 433 434 for (int c = 0; c < blockIndex; c++) 434 435 _columnKey[c] = mk.getColumnKey(c); 435 _columnKey[blockIndex] = highest Long;436 _columnKey[blockIndex] = highestInt; 436 437 } 437 438 … … 453 454 // In this case, the method will return false; otherwise always true. 454 455 int newBitBlockIndex = 0; // the block index of the bit 455 unsigned longnewBitToBeSet = 0; // the bit as 2^e, where 0 <= e <= 31456 457 int blockCount = this->getNumberOfRowBlocks(); // number of longs (representing rows) in this MinorKey456 unsigned int newBitToBeSet = 0; // the bit as 2^e, where 0 <= e <= 31 457 458 int blockCount = this->getNumberOfRowBlocks(); // number of ints (representing rows) in this MinorKey 458 459 int mkBlockIndex = mk.getNumberOfRowBlocks(); // for iterating along the blocks of mk 459 460 … … 463 464 while (hitBits < k) { 464 465 mkBlockIndex--; 465 unsigned long currentLong= mk.getRowKey(mkBlockIndex);466 unsigned longshiftedBit = 1 << 31; // initially, this equals 2^31, i.e. the highest bit466 unsigned int currentInt = mk.getRowKey(mkBlockIndex); 467 unsigned int shiftedBit = 1 << 31; // initially, this equals 2^31, i.e. the highest bit 467 468 while (hitBits < k && shiftedBit > 0) { 468 if ( blockCount - 1 >= mkBlockIndex&&469 shiftedBit & this->getRowKey(mkBlockIndex)) hitBits++;470 else if (shiftedBit & current Long) {469 if ((blockCount - 1 >= mkBlockIndex) && 470 (shiftedBit & this->getRowKey(mkBlockIndex))) hitBits++; 471 else if (shiftedBit & currentInt) { 471 472 newBitToBeSet = shiftedBit; 472 473 newBitBlockIndex = mkBlockIndex; … … 496 497 _numberOfRowBlocks = newBitBlockIndex + 1; 497 498 // allocate memory for new entries in _rowKey; 498 _rowKey = new unsigned long[_numberOfRowBlocks];499 _rowKey = new unsigned int[_numberOfRowBlocks]; 499 500 } 500 501 else { 501 502 // We need to delete all bits in _rowKey[newBitBlockIndex] that are below newBitToBeSet: 502 unsigned long aLong= this->getRowKey(newBitBlockIndex);503 unsigned longdeleteBit = newBitToBeSet >> 1; // in example: = 2^5503 unsigned int anInt = this->getRowKey(newBitBlockIndex); 504 unsigned int deleteBit = newBitToBeSet >> 1; // in example: = 2^5 504 505 while (deleteBit > 0) { 505 if (a Long & deleteBit) aLong-= deleteBit;506 if (anInt & deleteBit) anInt -= deleteBit; 506 507 deleteBit = deleteBit >> 1; 507 508 }; 508 _rowKey[newBitBlockIndex] = a Long;509 _rowKey[newBitBlockIndex] = anInt; 509 510 // ...and we delete all entries in _rowKey[i] for 0 <= i < newBitBlockIndex 510 511 for (int i = 0; i < newBitBlockIndex; i++) … … 525 526 while (bitCounter < k) { 526 527 mkBlockIndex++; 527 unsigned long currentLong= mk.getRowKey(mkBlockIndex);528 unsigned longshiftedBit = 1;528 unsigned int currentInt = mk.getRowKey(mkBlockIndex); 529 unsigned int shiftedBit = 1; 529 530 int exponent = 0; 530 531 // invariant: shiftedBit = 2^exponent 531 532 while (bitCounter < k && exponent < 32) { 532 if (shiftedBit & current Long) {533 if (shiftedBit & currentInt) { 533 534 _rowKey[mkBlockIndex] += shiftedBit; 534 535 bitCounter++; … … 561 562 // In this case, the method will return false; otherwise always true. 562 563 int newBitBlockIndex = 0; // the block index of the bit 563 unsigned longnewBitToBeSet = 0; // the bit as 2^e, where 0 <= e <= 31564 565 int blockCount = this->getNumberOfColumnBlocks(); // number of longs (representing columns) in this MinorKey564 unsigned int newBitToBeSet = 0; // the bit as 2^e, where 0 <= e <= 31 565 566 int blockCount = this->getNumberOfColumnBlocks(); // number of ints (representing columns) in this MinorKey 566 567 int mkBlockIndex = mk.getNumberOfColumnBlocks(); // for iterating along the blocks of mk 567 568 … … 571 572 while (hitBits < k) { 572 573 mkBlockIndex--; 573 unsigned long currentLong= mk.getColumnKey(mkBlockIndex);574 unsigned longshiftedBit = 1 << 31; // initially, this equals 2^31, i.e. the highest bit574 unsigned int currentInt = mk.getColumnKey(mkBlockIndex); 575 unsigned int shiftedBit = 1 << 31; // initially, this equals 2^31, i.e. the highest bit 575 576 while (hitBits < k && shiftedBit > 0) { 576 if ( blockCount - 1 >= mkBlockIndex&&577 shiftedBit & this->getColumnKey(mkBlockIndex)) hitBits++;578 else if (shiftedBit & current Long) {577 if ((blockCount - 1 >= mkBlockIndex) && 578 (shiftedBit & this->getColumnKey(mkBlockIndex))) hitBits++; 579 else if (shiftedBit & currentInt) { 579 580 newBitToBeSet = shiftedBit; 580 581 newBitBlockIndex = mkBlockIndex; … … 583 584 } 584 585 shiftedBit = shiftedBit >> 1; 585 } 586 } 586 587 } 587 588 … … 604 605 _numberOfColumnBlocks = newBitBlockIndex + 1; 605 606 // allocate memory for new entries in _columnKey; 606 _columnKey = new unsigned long[_numberOfColumnBlocks];607 _columnKey = new unsigned int[_numberOfColumnBlocks]; 607 608 } 608 609 else { 609 610 // We need to delete all bits in _columnKey[newBitBlockIndex] that are below newBitToBeSet: 610 unsigned long aLong= this->getColumnKey(newBitBlockIndex);611 unsigned longdeleteBit = newBitToBeSet >> 1; // in example: = 2^5611 unsigned int anInt = this->getColumnKey(newBitBlockIndex); 612 unsigned int deleteBit = newBitToBeSet >> 1; // in example: = 2^5 612 613 while (deleteBit > 0) { 613 if (a Long & deleteBit) aLong-= deleteBit;614 if (anInt & deleteBit) anInt -= deleteBit; 614 615 deleteBit = deleteBit >> 1; 615 616 }; 616 _columnKey[newBitBlockIndex] = a Long;617 _columnKey[newBitBlockIndex] = anInt; 617 618 // ...and we delete all entries in _columnKey[i] for 0 <= i < newBitBlockIndex 618 619 for (int i = 0; i < newBitBlockIndex; i++) … … 633 634 while (bitCounter < k) { 634 635 mkBlockIndex++; 635 unsigned long currentLong= mk.getColumnKey(mkBlockIndex);636 unsigned longshiftedBit = 1;636 unsigned int currentInt = mk.getColumnKey(mkBlockIndex); 637 unsigned int shiftedBit = 1; 637 638 int exponent = 0; 638 639 // invariant: shiftedBit = 2^exponent 639 640 while (bitCounter < k && exponent < 32) { 640 if (shiftedBit & current Long) {641 if (shiftedBit & currentInt) { 641 642 _columnKey[mkBlockIndex] += shiftedBit; 642 643 bitCounter++; … … 657 658 string s = "("; 658 659 for (int r = this->getNumberOfRowBlocks() - 1; r >= 0; r--) { 659 sprintf(h, "% ld", this->getRowKey(r)); t += h;660 sprintf(h, "%du", this->getRowKey(r)); t += h; 660 661 if (r < this->getNumberOfRowBlocks() - 1) 661 662 t = string(32 - t.length(), '0') + t; … … 664 665 s += ", "; 665 666 for (int c = this->getNumberOfColumnBlocks() - 1; c >= 0; c--) { 666 sprintf(h, "% ld", this->getColumnKey(c)); t += h;667 sprintf(h, "%du", this->getColumnKey(c)); t += h; 667 668 if (c < this->getNumberOfColumnBlocks() - 1) 668 669 t = string(32 - t.length(), '0') + t; … … 675 676 int MinorValue::_RankingStrategy = -1; 676 677 677 longMinorValue::getWeight () const678 int MinorValue::getWeight () const 678 679 { 679 680 assert(false); // must be overridden in derived classes … … 701 702 } 702 703 703 longMinorValue::getRetrievals() const {704 int MinorValue::getRetrievals() const { 704 705 return _retrievals; 705 706 } … … 709 710 } 710 711 711 longMinorValue::getPotentialRetrievals() const {712 int MinorValue::getPotentialRetrievals() const { 712 713 return _potentialRetrievals; 713 714 } 714 715 715 longMinorValue::getMultiplications() const {716 int MinorValue::getMultiplications() const { 716 717 return _multiplications; 717 718 } 718 719 719 longMinorValue::getAdditions() const {720 int MinorValue::getAdditions() const { 720 721 return _additions; 721 722 } 722 723 723 longMinorValue::getAccumulatedMultiplications() const {724 int MinorValue::getAccumulatedMultiplications() const { 724 725 return _accumulatedMult; 725 726 } 726 727 727 longMinorValue::getAccumulatedAdditions() const {728 int MinorValue::getAccumulatedAdditions() const { 728 729 return _accumulatedSum; 729 730 } … … 789 790 } 790 791 791 long LongMinorValue::getWeight () const {792 int IntMinorValue::getWeight () const { 792 793 // put measure for size of MinorValue here, i.e. number of monomials in polynomial; 793 794 // so far, we use the accumulated number of multiplications (i.e., including all nested ones) … … 796 797 } 797 798 798 LongMinorValue::LongMinorValue (const longresult, const int multiplications, const int additions,799 IntMinorValue::IntMinorValue (const int result, const int multiplications, const int additions, 799 800 const int accumulatedMultiplications, const int accumulatedAdditions, 800 801 const int retrievals, const int potentialRetrievals) { … … 808 809 } 809 810 810 LongMinorValue::LongMinorValue () {811 IntMinorValue::IntMinorValue () { 811 812 _result = -1; 812 813 _multiplications = -1; … … 818 819 } 819 820 820 LongMinorValue::~LongMinorValue()821 IntMinorValue::~IntMinorValue() 821 822 { 822 823 } 823 824 824 long LongMinorValue::getResult() const {825 int IntMinorValue::getResult() const { 825 826 return _result; 826 827 } 827 828 828 string LongMinorValue::toString () const {829 string IntMinorValue::toString () const { 829 830 char h[10]; 830 831 … … 833 834 if (this->getRetrievals() == -1) cacheHasBeenUsed = false; 834 835 835 sprintf(h, "% ld", this->getResult());836 sprintf(h, "%d", this->getResult()); 836 837 string s = h; 837 838 s += " [retrievals: "; 838 if (cacheHasBeenUsed) { sprintf(h, "% ld", this->getRetrievals()); s += h; }839 if (cacheHasBeenUsed) { sprintf(h, "%d", this->getRetrievals()); s += h; } 839 840 else s += "/"; 840 841 s += " (of "; 841 if (cacheHasBeenUsed) { sprintf(h, "% ld", this->getPotentialRetrievals()); s += h; }842 if (cacheHasBeenUsed) { sprintf(h, "%d", this->getPotentialRetrievals()); s += h; } 842 843 else s += "/"; 843 844 s += "), *: "; 844 sprintf(h, "% ld", this->getMultiplications()); s += h;845 sprintf(h, "%d", this->getMultiplications()); s += h; 845 846 s += " (accumulated: "; 846 sprintf(h, "% ld", this->getAccumulatedMultiplications()); s += h;847 sprintf(h, "%d", this->getAccumulatedMultiplications()); s += h; 847 848 s += "), +: "; 848 sprintf(h, "% ld", this->getAdditions()); s += h;849 sprintf(h, "%d", this->getAdditions()); s += h; 849 850 s += " (accumulated: "; 850 sprintf(h, "% ld", this->getAccumulatedAdditions()); s += h;851 sprintf(h, "%d", this->getAccumulatedAdditions()); s += h; 851 852 s += "), rank: "; 852 853 if (cacheHasBeenUsed) { sprintf(h, "%d", this->getUtility()); s += h; } … … 856 857 } 857 858 858 LongMinorValue::LongMinorValue (const LongMinorValue& mv) {859 IntMinorValue::IntMinorValue (const IntMinorValue& mv) { 859 860 _result = mv.getResult(); 860 861 _retrievals = mv.getRetrievals(); … … 899 900 } 900 901 901 longPolyMinorValue::getWeight () const {902 int PolyMinorValue::getWeight () const { 902 903 // put measure for size of PolyMinorValue here, e.g. the number of monomials 903 904 // the cached polynomial … … 914 915 string s = pString(_result); 915 916 s += " [retrievals: "; 916 if (cacheHasBeenUsed) { sprintf(h, "% ld", this->getRetrievals()); s += h; }917 if (cacheHasBeenUsed) { sprintf(h, "%d", this->getRetrievals()); s += h; } 917 918 else s += "/"; 918 919 s += " (of "; 919 if (cacheHasBeenUsed) { sprintf(h, "% ld", this->getPotentialRetrievals()); s += h; }920 if (cacheHasBeenUsed) { sprintf(h, "%d", this->getPotentialRetrievals()); s += h; } 920 921 else s += "/"; 921 922 s += "), *: "; 922 sprintf(h, "% ld", this->getMultiplications()); s += h;923 sprintf(h, "%d", this->getMultiplications()); s += h; 923 924 s += " (accumulated: "; 924 sprintf(h, "% ld", this->getAccumulatedMultiplications()); s += h;925 sprintf(h, "%d", this->getAccumulatedMultiplications()); s += h; 925 926 s += "), +: "; 926 sprintf(h, "% ld", this->getAdditions()); s += h;927 sprintf(h, "%d", this->getAdditions()); s += h; 927 928 s += " (accumulated: "; 928 sprintf(h, "% ld", this->getAccumulatedAdditions()); s += h;929 sprintf(h, "%d", this->getAccumulatedAdditions()); s += h; 929 930 s += "), rank: "; 930 931 if (cacheHasBeenUsed) { sprintf(h, "%d", this->getUtility()); s += h; }
Note: See TracChangeset
for help on using the changeset viewer.