Changeset 308a766 in git
- Timestamp:
- Nov 29, 2012, 11:02:36 PM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- 05c3b87378ab3e8310b306f10a0eec4bd579ca9c894604cd8e2bd80d9c29cfc35d194404eaa0d476
- Parents:
- 4b5098278b256cb9f73dc0b32dedd20101972d76
- git-author:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-11-29 23:02:36+01:00
- git-committer:
- Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-11-29 23:08:28+01:00
- Location:
- Singular
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/Cache.h
r4b5098 r308a766 4 4 #include <string> 5 5 #include <list> 6 #include <assert.h> 7 8 using namespace std;6 7 // #include <assert.h> 8 // using namespace std; 9 9 10 10 /*! \class Cache … … 75 75 * as long as the pair <c>key(_rank(i)) --> value(_rank(i))</c>. 76 76 */ 77 77 std::list<int> _rank; 78 78 79 79 /** … … 83 83 * in KeyClass. 84 84 */ 85 list<KeyClass> _key;85 std::list<KeyClass> _key; 86 86 87 87 /** … … 91 91 * argument \c _key[i]). 92 92 */ 93 list<ValueClass> _value;93 std::list<ValueClass> _value; 94 94 95 95 /** 96 96 * container for the weights of all cached values 97 97 */ 98 list<int> _weights;98 std::list<int> _weights; 99 99 100 100 /** … … 104 104 * const, as the user would expect for these methods. 105 105 */ 106 mutable typename list<KeyClass>::const_iterator _itKey;106 mutable typename std::list<KeyClass>::const_iterator _itKey; 107 107 108 108 /** … … 112 112 * const, as the user would expect for these methods. 113 113 */ 114 mutable typename list<ValueClass>::const_iterator _itValue;114 mutable typename std::list<ValueClass>::const_iterator _itValue; 115 115 116 116 /** … … 314 314 * string 315 315 */ 316 316 std::string toString () const; 317 317 318 318 /** … … 324 324 }; 325 325 326 #include <CacheImplementation.h>326 #include "CacheImplementation.h" 327 327 328 328 #endif -
Singular/CacheImplementation.h
r4b5098 r308a766 1 1 #ifndef CACHE_IMPLEMENTATION_H 2 2 #define CACHE_IMPLEMENTATION_H 3 4 #include <reporter/reporter.h> 3 5 4 6 #include <cstdio> // for sprintf … … 53 55 { 54 56 _itKey = _key.end(); // referring to past-the-end element in the list 55 typenamelist<KeyClass>::const_iterator itKey;57 typename std::list<KeyClass>::const_iterator itKey; 56 58 _itValue = _value.begin(); 57 59 /* As _key is a sorted list, the following could actually be implemented … … 80 82 thus, getValue has been called although hasKey 81 83 produced no match */ 82 ass ert(false);84 assume(false); 83 85 84 86 return *_itValue; … … 123 125 erasing the last entry which is only implemented for forward 124 126 iterators by std::list. */ 125 list<int>::iterator itRank;127 std::list<int>::iterator itRank; 126 128 for (itRank = _rank.begin(); itRank != _rank.end(); itRank++) { } 127 129 itRank--; /* Now, this forward iterator points to the last list entry. */ … … 132 134 /* now delete entries in _key and _value with index deleteIndex */ 133 135 int k = 0; 134 typename list<KeyClass>::iterator itKey;135 typename list<ValueClass>::iterator itValue = _value.begin();136 typename list<int>::iterator itWeights = _weights.begin();136 typename std::list<KeyClass>::iterator itKey; 137 typename std::list<ValueClass>::iterator itValue = _value.begin(); 138 typename std::list<int>::iterator itWeights = _weights.begin(); 137 139 for (itKey = _key.begin(); itKey != _key.end(); itKey++) 138 140 { … … 176 178 keyWasContained == false */ 177 179 int k = 0; 178 typename list<KeyClass>::iterator itKey;180 typename std::list<KeyClass>::iterator itKey; 179 181 // itOldValue will later only be used in the case keyWasContained == true: */ 180 typename list<ValueClass>::iterator itOldValue = _value.begin();182 typename std::list<ValueClass>::iterator itOldValue = _value.begin(); 181 183 /* itOldWeights will later only be used in the case 182 184 keyWasContained == true */ 183 typename list<int>::iterator itOldWeights = _weights.begin();185 typename std::list<int>::iterator itOldWeights = _weights.begin(); 184 186 for (itKey = _key.begin(); itKey != _key.end(); itKey++) 185 187 { … … 203 205 int newWeight = value.getWeight(); 204 206 k = 0; 205 typename list<ValueClass>::iterator itValue = _value.begin();207 typename std::list<ValueClass>::iterator itValue = _value.begin(); 206 208 for (itValue = _value.begin(); itValue != _value.end(); itValue++) 207 209 { … … 229 231 _rank[oldIndexInRank] == oldIndexInKey, i.e. 230 232 _key[_rank[oldIndexInRank]] == key: */ 231 list<int>::iterator itRank;233 std::list<int>::iterator itRank; 232 234 k = 0; 233 235 for (itRank = _rank.begin(); itRank != _rank.end(); itRank++) … … 306 308 Let's make room for the assignment 307 309 _rank[newIndexInRank] := newIndexInKey: */ 308 list<int>::iterator itRank;310 std::list<int>::iterator itRank; 309 311 for (itRank = _rank.begin(); itRank != _rank.end(); itRank++) 310 312 { … … 323 325 /* let's insert new key and new value at index newIndexInKey: */ 324 326 itValue = _value.begin(); 325 typename list<int>::iterator itWeights = _weights.begin();327 typename std::list<int>::iterator itWeights = _weights.begin(); 326 328 k = 0; 327 329 for (itKey = _key.begin(); itKey != _key.end(); itKey++) … … 344 346 new (key, value)-pair */ 345 347 346 ass ert(_rank.size() == _key.size());347 ass ert(_rank.size() == _value.size());348 assume(_rank.size() == _key.size()); 349 assume(_rank.size() == _value.size()); 348 350 return !result; /* true iff the new (key --> value) pair is 349 351 actually in the cache now */ … … 351 353 352 354 template<class KeyClass, class ValueClass> 353 st ring Cache<KeyClass, ValueClass>::toString() const355 std::string Cache<KeyClass, ValueClass>::toString() const 354 356 { 355 357 char h[10]; 356 st ring s = "Cache:";358 std::string s = "Cache:"; 357 359 s += "\n entries: "; 358 360 sprintf(h, "%d", getNumberOfEntries()); s += h; … … 371 373 int k = 1; 372 374 s += "\n (key --> value) pairs in ascending order of keys:"; 373 typename list<KeyClass>::const_iterator itKey;374 typename list<ValueClass>::const_iterator itValue = _value.begin();375 typename std::list<KeyClass>::const_iterator itKey; 376 typename std::list<ValueClass>::const_iterator itValue = _value.begin(); 375 377 for (itKey = _key.begin(); itKey != _key.end(); itKey++) 376 378 { … … 385 387 } 386 388 s += "\n (key --> value) pairs in descending order of ranks:"; 387 list<int>::const_iterator itRank;389 std::list<int>::const_iterator itRank; 388 390 int r = 1; 389 391 for (itRank = _rank.begin(); itRank != _rank.end(); itRank++) … … 413 415 void Cache<KeyClass, ValueClass>::print() const 414 416 { 415 cout << this->toString();417 PrintS(this->toString().c_str()); 416 418 } 417 419 -
Singular/Minor.cc
r4b5098 r308a766 1 #include <iostream>2 3 1 #include "config.h" 4 2 #include <kernel/mod2.h> 3 4 #include "Minor.h" 5 5 6 #include <kernel/structs.h> 6 7 #include <kernel/polys.h> 7 #include <Minor.h>8 8 #include <kernel/febase.h> 9 9 10 using namespace std; 10 11 11 12 void MinorKey::reset() … … 114 115 void MinorKey::print() const 115 116 { 116 cout << this->toString();117 PrintS(this->toString().c_str()); 117 118 } 118 119 … … 145 146 } 146 147 /* We should never reach this line of code. */ 147 ass ert(false);148 assume(false); 148 149 } 149 150 … … 176 177 } 177 178 /* We should never reach this line of code. */ 178 ass ert(false);179 assume(false); 179 180 } 180 181 … … 198 199 } 199 200 } 200 return;201 201 } 202 202 … … 220 220 } 221 221 } 222 return;223 222 } 224 223 … … 251 250 } 252 251 /* We should never reach this line of code. */ 253 ass ert(false);252 assume(false); 254 253 } 255 254 … … 282 281 } 283 282 /* We should never reach this line of code. */ 284 ass ert(false);283 assume(false); 285 284 } 286 285 … … 439 438 bool MinorKey::operator==(const MinorKey& mk) const 440 439 { 441 ass ert(false);440 assume(false); 442 441 return this->compare(mk) == 0; 443 442 } … … 447 446 bool MinorKey::operator<(const MinorKey& mk) const 448 447 { 449 ass ert(false);448 assume(false); 450 449 return this->compare(mk) == -1; 451 450 } … … 833 832 int MinorValue::getWeight () const 834 833 { 835 ass ert(false); /* must be overridden in derived classes */834 assume(false); /* must be overridden in derived classes */ 836 835 return 0; 837 836 } … … 841 840 bool MinorValue::operator==(const MinorValue& mv) const 842 841 { 843 ass ert(false);842 assume(false); 844 843 return (this == &mv); /* compare addresses of both objects */ 845 844 } … … 847 846 string MinorValue::toString () const 848 847 { 849 ass ert(false); /* must be overridden in derived classes */848 assume(false); /* must be overridden in derived classes */ 850 849 return ""; 851 850 } … … 855 854 bool MinorValue::operator<(const MinorValue& mv) const 856 855 { 857 ass ert(false);856 assume(false); 858 857 return (this < &mv); /* compare addresses of both objects */ 859 858 } … … 896 895 void MinorValue::print() const 897 896 { 898 cout << this->toString();897 PrintS(this->toString().c_str()); 899 898 } 900 899 -
Singular/Minor.h
r4b5098 r308a766 2 2 #define MINOR_H 3 3 4 #include <assert.h>4 // #include <assert.h> 5 5 #include <string> 6 6 7 #include <kernel/polys.h> 8 9 using namespace std; 7 struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly; 8 struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring; 9 10 struct sip_sideal; typedef struct sip_sideal * ideal; 11 12 // using namespace std; 10 13 11 14 /*! \class MinorKey … … 391 394 * string 392 395 */ 393 396 std::string toString () const; 394 397 395 398 /** … … 683 686 * string 684 687 */ 685 virtualstring toString () const;688 virtual std::string toString () const; 686 689 687 690 /** … … 771 774 * string 772 775 */ 773 776 std::string toString () const; 774 777 }; 775 778 … … 858 861 * string 859 862 */ 860 863 std::string toString () const; 861 864 }; 862 865 -
Singular/MinorInterface.cc
r4b5098 r308a766 1 #include "config.h" 2 #include <kernel/mod2.h> 3 1 4 // include before anything to avoid clashes with stdio.h included elsewhere 2 #include <cstdio> 3 4 #include <MinorInterface.h> 5 #include <MinorProcessor.h> 5 // #include <cstdio> 6 7 #include "MinorInterface.h" 8 #include "MinorProcessor.h" 9 10 #include <polys/simpleideals.h> 6 11 7 12 #include <kernel/polys.h> 8 13 #include <kernel/structs.h> 9 10 #include "config.h" 11 #include <kernel/mod2.h> 14 #include <kernel/kstd1.h> 12 15 #include <kernel/ideals.h> 13 #include <kernel/kstd1.h> 16 17 using namespace std; 14 18 15 19 bool currRingIsOverIntegralDomain () … … 172 176 #if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1) 173 177 qqq++; 174 printf("after %d", qqq);178 Print("after %d", qqq); 175 179 printCounters ("-th minor", false); 176 180 #endif … … 401 405 #if (defined COUNT_AND_PRINT_OPERATIONS) && (COUNT_AND_PRINT_OPERATIONS > 1) 402 406 qqq++; 403 printf("after %d", qqq);407 Print("after %d", qqq); 404 408 printCounters ("-th minor", false); 405 409 #endif -
Singular/MinorInterface.h
r4b5098 r308a766 3 3 4 4 5 #include <polys/simpleideals.h> 6 #include <kernel/polys.h> 5 struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly; 6 struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring; 7 8 struct sip_sideal; typedef struct sip_sideal * ideal; 9 10 class ip_smatrix; typedef ip_smatrix * matrix; 7 11 8 12 /* all computations are module char, if char <> 0; -
Singular/MinorProcessor.cc
r4b5098 r308a766 1 #include <MinorProcessor.h>2 3 1 #include "config.h" 4 2 #include <kernel/mod2.h> 3 4 #include "MinorProcessor.h" 5 6 #include <polys/kbuckets.h> 7 5 8 #include <kernel/structs.h> 6 9 #include <kernel/polys.h> 7 10 #include <kernel/febase.h> 8 11 #include <kernel/kstd1.h> 9 #include <polys/kbuckets.h> 12 13 #include <kernel/ideals.h> 14 15 using namespace std; 10 16 11 17 #ifdef COUNT_AND_PRINT_OPERATIONS … … 213 219 { 214 220 /* This is a non-recursive implementation. */ 215 ass ert( (i >= 0) && (j >= 0) && (i >= j));221 assume( (i >= 0) && (j >= 0) && (i >= j)); 216 222 if (j == 0 || i == j) return 1; 217 223 int result = 1; … … 227 233 { 228 234 /* This is a non-recursive implementation. */ 229 ass ert(i >= 0);235 assume(i >= 0); 230 236 int result = 1; 231 237 for (int j = 1; j <= i; j++) result *= j; … … 444 450 const ideal& iSB) 445 451 { 446 ass ert(k > 0); /* k is the minor's dimension; the minor must be at least452 assume(k > 0); /* k is the minor's dimension; the minor must be at least 447 453 1x1 */ 448 454 /* The method works by recursion, and using Lapace's Theorem along the … … 561 567 const ideal& iSB) 562 568 { 563 ass ert(k > 0); /* k is the minor's dimension; the minor must be at least569 assume(k > 0); /* k is the minor's dimension; the minor must be at least 564 570 1x1 */ 565 571 int *theRows=new int[k]; mk.getAbsoluteRowIndices(theRows); … … 652 658 const int characteristic, const ideal& iSB) 653 659 { 654 ass ert(k > 0); /* k is the minor's dimension; the minor must be at least660 assume(k > 0); /* k is the minor's dimension; the minor must be at least 655 661 1x1 */ 656 662 /* The method works by recursion, and using Lapace's Theorem along … … 944 950 const ideal& iSB) 945 951 { 946 ass ert(k > 0); /* k is the minor's dimension; the minor must be at least952 assume(k > 0); /* k is the minor's dimension; the minor must be at least 947 953 1x1 */ 948 954 /* The method works by recursion, and using Lapace's Theorem along the … … 1081 1087 const ideal& iSB) 1082 1088 { 1083 ass ert(k > 0); /* k is the minor's dimension; the minor must be at least1089 assume(k > 0); /* k is the minor's dimension; the minor must be at least 1084 1090 1x1 */ 1085 1091 /* The method works by recursion, and using Lapace's Theorem along … … 1384 1390 const ideal& iSB) 1385 1391 { 1386 ass ert(k > 0); /* k is the minor's dimension; the minor must be at least1392 assume(k > 0); /* k is the minor's dimension; the minor must be at least 1387 1393 1x1 */ 1388 1394 int *theRows=new int[k]; mk.getAbsoluteRowIndices(theRows); -
Singular/MinorProcessor.h
r4b5098 r308a766 2 2 #define MINOR_PROCESSOR_H 3 3 4 #include <Cache.h> 5 #include <Minor.h> 6 #include <assert.h> 4 #include "Cache.h" 5 #include "Minor.h" 6 7 struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly; 8 struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring; 9 10 struct sip_sideal; typedef struct sip_sideal * ideal; 11 12 // #include <assert.h> 7 13 #include <string> 8 14 … … 279 285 * string 280 286 */ 281 virtualstring toString () const;287 virtual std::string toString () const; 282 288 283 289 /** … … 546 552 * string 547 553 */ 548 554 std::string toString () const; 549 555 }; 550 556 … … 760 766 * string 761 767 */ 762 768 std::string toString () const; 763 769 }; 764 770
Note: See TracChangeset
for help on using the changeset viewer.