Changeset e90881 in git
- Timestamp:
- Mar 29, 2009, 7:17:09 PM (14 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- c6512c014a0813cb992533ab4dd571597c561ea4
- Parents:
- 53e33d93f45a825808d84cade536120482dc46c3
- Location:
- kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5data.h
r53e33d9 re90881 3 3 * Computer Algebra System SINGULAR * 4 4 ****************************************/ 5 /* $Id: f5data.h,v 1. 9 2009-03-05 14:30:23ederc Exp $ */5 /* $Id: f5data.h,v 1.10 2009-03-29 17:17:09 ederc Exp $ */ 6 6 /* 7 7 * ABSTRACT: labeled polynomial interface … … 33 33 poly polynomial; //standard polynomial data 34 34 Rule* _rule; 35 bool del; 35 36 public: 36 37 inline LPoly(poly t, int i, poly p, Rule* r=NULL); … … 43 44 inline void setRule(Rule* r); 44 45 inline Rule* getRule(); 46 inline void setDel(bool d); 47 inline bool getDel(); 45 48 inline void set(poly t, int i, poly p, Rule* r); 46 49 inline LPoly* get(); … … 49 52 LPoly::LPoly(poly t,int i,poly p, Rule* r) { 50 53 set(t,i,p,r); 54 del = 0; 51 55 } 52 56 … … 71 75 } 72 76 77 void LPoly::setDel(bool d) { 78 del = d; 79 } 80 73 81 poly LPoly::getPoly() { 74 82 return polynomial; … … 85 93 Rule* LPoly::getRule() { 86 94 return _rule; 95 } 96 97 bool LPoly::getDel() { 98 return del; 87 99 } 88 100 -
kernel/f5gb.cc
r53e33d9 re90881 26 26 #include "f5lists.h" 27 27 #include "timer.h" 28 int reductionsToZero = 0; 29 28 int reductionsToZero = 0; 29 int reductionTime = 0; 30 int spolsTime = 0; 31 int highestDegree = 0; 30 32 /* 31 33 ==================================================================== … … 91 93 // computation of critical pairs with checking of criterion 1 and criterion 2 and saving them 92 94 // in the list critPairs 93 Print("END F5INC\n");94 95 criticalPair(gPrev, critPairs, lTag, rTag, rules); 95 96 static LList* sPolyList = new LList(); … … 108 109 // NOTE: inside there is a second check of criterion 2 if new rules are 109 110 // added 111 int timer4 = initTimer(); 112 startTimer(); 110 113 computeSPols(critPairsMinDeg,rTag,rules,sPolyList); 114 timer4 = getTimer(); 115 Print("SPOLS TIMER: %d\n",timer4); 116 spolsTime = spolsTime + timer4; 111 117 // DEBUG STUFF FOR SPOLYLIST 112 118 LNode* temp = sPolyList->getFirst(); … … 117 123 //} 118 124 // reduction process of new S-polynomials and also adds new critical pairs to critPairs 125 int timer3 = initTimer(); 126 startTimer(); 119 127 reduction(sPolyList, critPairs, gPrev, rules, lTag, rTag, gbPrev); 120 128 timer3 = getTimer(); 129 reductionTime = reductionTime + timer3; 130 Print("REDUCTION TIMER: %d\n",timer3); 121 131 // DEBUG STUFF FOR GPREV 122 132 //temp = gPrev->getFirst(); … … 173 183 */ 174 184 //gPrev->print(); 185 Print("COMPLETE REDUCTION TIME UNTIL NOW: %d\n",reductionTime); 186 Print("COMPLETE SPOLS TIME UNTIL NOW: %d\n",spolsTime); 175 187 return gPrev; 176 188 } … … 510 522 // the second component is tested only when it has the actual index, otherwise there is 511 523 // no new rule to test since the last test in subalgorithm criticalPair() 524 if(highestDegree < pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly()))) { 525 highestDegree = pDeg(ppMult_qq(temp->getT1(),temp->getLp1Poly())); 526 //pWrite(pHead(ppMult_qq(temp->getT1(),temp->getLp1Poly()))); 527 } 512 528 if(temp->getLp2Index() == temp->getLp1Index()) { 513 529 if(!criterion2(temp->getT2(),temp->getAdLp2(),rules,temp->getTestedRule())) { … … 719 735 pNorm(temp); 720 736 tempRed->setPoly(temp); 721 //pWrite(tempRed->getPoly());737 tempRed->setDel(1); 722 738 // for debugging 723 739 //pWrite(tempRed->getPoly()); … … 900 916 //Print("LTAG BEGINNING: %p\n",lTag); 901 917 902 // DEBUGGING STUFF START918 // DEBUGGING STUFF START 903 919 //Print("NUMBER: %d\n",r->N); 904 int* ev = new int[r->N]; 905 for(i=0;i<IDELEMS(id);i++) { 906 pGetExpV(id->m[i],ev); 907 pWrite(id->m[i]); 908 Print("EXP1: %d\n",ev[1]); 909 Print("EXP2: %d\n",ev[2]); 910 Print("EXP3: %d\n\n",ev[3]); 911 } 920 921 //int* ev = new int[r->N]; 922 //int ev2; 923 //for(i=0;i<IDELEMS(id);i++) { 924 //pGetExpV(id->m[i],ev); 925 //ev2 = pGetExp(id->m[i],1); 926 //pWrite(id->m[i]); 927 //Print("%d\n",ev2); 928 //Print("EXP1: %d\n",ev[1]); 929 //Print("EXP2: %d\n",ev[2]); 930 //Print("EXP3: %d\n\n",ev[3]); 931 //} 912 932 //delete ev; 913 //DEBUGGING STUFF END 933 934 /*DEBUGGING STUFF END */ 914 935 915 936 // first element in rTag is first element of rules which is NULL RNode, … … 957 978 //pWrite(gPrevTag->getPoly()); 958 979 gPrev = F5inc(i, id->m[i-1], gPrev, gbPrev, ONE, lTag, rules, rTag); 980 Print("%d\n",gPrev->count(gPrevTag->getNext())); 981 Print("%d\n",gPrev->getLength()); 959 982 //Print("____________________________________ITERATION STEP DONE________________________________________\n"); 960 983 … … 963 986 // computing new groebner basis gbPrev 964 987 if(gPrev->getLength() > gbLength) { 965 ideal gbAdd = idInit(gPrev->getLength()-gbLength,1); 966 LNode* temp = gPrevTag; 967 //Print("%p\n",gPrevTag); 968 //Print("%p\n",gPrev->getLast()); 969 //pWrite(temp->getPoly()); 970 //Print("LENGTH OF GPREV LIST: %d\n",gPrev->getLength()); 971 //Print("%d\n",gbLength); 972 //Print("%d\n",gPrev->getLength()-gbLength-1); 973 for(j=0;j<=gPrev->getLength()-gbLength-1;j++) { 974 //Print("YES\n"); 975 temp = temp->getNext(); 976 if(temp) { 977 //Print("%p\n",temp); 978 //pWrite(temp->getPoly()); 979 //Print("%p\n",temp->getNext()); 988 if(i < IDELEMS(id)) { 989 ideal gbAdd = idInit(gPrev->getLength()-gbLength,1); 990 LNode* temp = gPrevTag; 991 int counter = 0; 992 for(j=0;j<=gPrev->getLength()-gbLength-1;j++) { 993 temp = temp->getNext(); 994 if(0 == temp->getDel()) { 995 counter++; 996 gbAdd->m[j] = temp->getPoly(); 997 } 998 //if(1 == temp->getDel()) { 999 // pWrite(temp->getPoly()); 1000 //} 980 1001 } 981 gbAdd->m[j] = temp->getPoly(); 982 //pWrite(temp->getPoly()); 983 } 984 //Print("HIER AUCH\n"); 985 gbPrev = idAdd(gbPrev,gbAdd); 986 987 1002 if(counter != gPrev->count(gPrevTag->getNext())) { 1003 Print("----------------------------------WRONG COUNTING---------------------------\n"); 1004 } 1005 gbPrev = idAdd(gbPrev,gbAdd); 1006 //idShow(gbPrev); 1007 } 1008 else { 1009 ideal gbAdd = idInit(gPrev->getLength()-gbLength,1); 1010 LNode* temp = gPrevTag; 1011 for(j=0;j<=gPrev->getLength()-gbLength-1;j++) { 1012 temp = temp->getNext(); 1013 gbAdd->m[j] = temp->getPoly(); 1014 } 1015 gbPrev = idAdd(gbPrev,gbAdd); 1016 } 988 1017 // interreduction stuff 989 1018 if(i<IDELEMS(id)) { 1019 int timer2 = initTimer(); 1020 startTimer(); 990 1021 ideal tempId = kInterRed(gbPrev); 1022 991 1023 //idShow(tempId); 992 1024 gbPrev = tempId; 1025 timer2 = getTimer(); 1026 Print("Timer INTERREDUCTION: %d\n",timer2); 1027 //idShow(gbPrev); 993 1028 //qsortDegree(&gbPrev->m[0],&gbPrev->m[IDELEMS(gbPrev)-1]); 994 1029 delete gPrev; … … 1035 1070 } 1036 1071 } 1037 1038 1072 gbLength = gPrev->getLength(); 1039 1073 //Print("HIER\n"); … … 1053 1087 //Print("===================================================\n"); 1054 1088 //Print("JA\n"); 1089 Print("LENGTH OF GPREV: %d\n",gPrev->getLength()); 1055 1090 } 1056 1091 //idShow(gbPrev); 1057 1092 Print("\n\nNumber of zero-reductions: %d\n",reductionsToZero); 1058 1093 timer = getTimer(); 1094 Print("Highest Degree during computations: %d\n",highestDegree); 1059 1095 Print("Time for computations: %d/1000 seconds\n",timer); 1060 1096 //LNode* temp = gPrev->getFirst(); … … 1067 1103 //delete rTag; 1068 1104 //delete gPrev; 1105 reductionTime = 0; 1106 spolsTime = 0; 1069 1107 return(gbPrev); 1070 1108 -
kernel/f5lists.cc
r53e33d9 re90881 151 151 } 152 152 153 inline LNode* LNode::insertByLabel(LNode* l) { 154 //Print("ADDING SOLYS TO THE LIST\n"); 155 //Print("new element: "); 156 //pWrite(t); 157 if(NULL == this) { // || NULL == data) { 158 l->next = this; 159 return l; 160 } 161 else { 162 //Print("tested element1: "); 163 //pWrite(this->getTerm()); 164 if(-1 == pLmCmp(l->getTerm(),this->getTerm())) { 165 //Print("HIERDRIN\n"); 166 l->next = this; 167 //Print("%p\n",this); 168 //Print("%p\n",newElement->next); 169 return l; 170 } 171 else { 172 LNode* temp = this; 173 while(NULL != temp->next && NULL != temp->next->data) { 174 //Print("tested element: "); 175 //pWrite(temp->getTerm()); 176 if(-1 == pLmCmp(l->getTerm(),temp->next->getTerm())) { 177 l->next = temp->next; 178 temp->next = l; 179 return this; 180 } 181 else { 182 temp = temp->next; 183 //Print("%p\n",temp); 184 //Print("%p\n",temp->data); 185 186 //Print("%p\n",temp->next); 187 } 188 } 189 //Print("HIER\n"); 190 l->next = temp->next; 191 temp->next = l; 192 return this; 193 } 194 } 195 } 196 153 197 // deletes the first elements of the list with the same degree 154 198 // only used for the S-polys, which are already sorted by increasing degree by CList … … 184 228 } 185 229 230 bool LNode::getDel() { 231 return data->getDel(); 232 } 233 186 234 // set the data from the LPoly saved in LNode 187 235 void LNode::setPoly(poly p) { … … 199 247 void LNode::setNext(LNode* l) { 200 248 next = l; 249 } 250 251 void LNode::setDel(bool d) { 252 data->setDel(d); 201 253 } 202 254 … … 229 281 pWrite(temp->getPoly()); 230 282 Print("%p\n",temp->next); 283 Print("DELETE? %d\n",temp->getDel()); 231 284 temp = temp->next; 232 285 } … … 234 287 } 235 288 289 int LNode::count(LNode* l) { 290 int nonDel = 0; 291 LNode* temp = l; 292 while(NULL != temp) { 293 if(!temp->getDel()) { 294 nonDel++; 295 temp = temp->next; 296 } 297 else { 298 temp = temp->next; 299 } 300 } 301 return nonDel; 302 } 236 303 237 304 /* … … 304 371 305 372 void LList::insertByLabel(LNode* l) { 306 first = first->insertByLabel(l ->getTerm(),l->getIndex(),l->getPoly(),l->getRule());373 first = first->insertByLabel(l); 307 374 length++; 308 375 //Print("LENGTH %d\n",length); … … 340 407 } 341 408 409 int LList::count(LNode* l) { 410 return first->count(l); 411 } 342 412 /* 343 413 ======================================= -
kernel/f5lists.h
r53e33d9 re90881 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5lists.h,v 1.1 5 2009-03-12 09:43:53ederc Exp $ */4 /* $Id: f5lists.h,v 1.16 2009-03-29 17:17:09 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: list interface … … 60 60 // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label) 61 61 LNode* insertByLabel(poly t, int i, poly p, Rule* r); 62 LNode* insertByLabel(LNode* l); 62 63 // deletes the first elements of the list with the same degree 63 64 // get next & prev from current LNode … … 73 74 int getIndex(); 74 75 Rule* getRule(); 76 bool getDel(); 75 77 // set the data from the LPoly saved in LNode 76 78 void setPoly(poly p); … … 78 80 void setIndex(int i); 79 81 void setNext(LNode* l); 82 void setDel(bool d); 80 83 // test if for any list element the polynomial part of the data is equal to *p 81 84 bool polyTest(poly* p); 82 85 LNode* getNext(LNode* l); 83 86 void print(); 87 int count(LNode* l); 84 88 }; 85 89 … … 117 121 void setFirst(LNode* l); 118 122 void print(); 123 int count(LNode* l); 119 124 }; 120 125
Note: See TracChangeset
for help on using the changeset viewer.