Changeset 7c81165 in git
- Timestamp:
- Mar 12, 2009, 10:43:53 AM (14 years ago)
- Branches:
- (u'spielwiese', 'f6c3dc58b0df4bd712574325fe76d0626174ad97')
- Children:
- 75e2e50e5ba0dbb6681ecbf8664330997a24b5e9
- Parents:
- 47ca23dae2b0131537f61842055e75beb7836f77
- Location:
- kernel
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/f5gb.cc
r47ca23 r7c81165 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5gb.cc,v 1.4 2 2009-03-09 14:51:42ederc Exp $ */4 /* $Id: f5gb.cc,v 1.43 2009-03-12 09:43:53 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: f5gb interface … … 96 96 static LList* reducedLPolys = new LList(); 97 97 // while there are critical pairs to be further checked and deleted/computed 98 while(NULL != critPairs->getFirst() ->getData()) {98 while(NULL != critPairs->getFirst()) { 99 99 // critPairs->getMinDeg() deletes the first elements of minimal degree from 100 100 // critPairs, thus the while loop is not infinite. … … 105 105 // added 106 106 computeSPols(critPairsMinDeg,rTag,rules,sPolyList); 107 107 //Print("HIER2\n"); 108 108 // DEBUG STUFF FOR SPOLYLIST 109 109 LNode* temp = sPolyList->getFirst(); … … 180 180 Rule* testedRule = rules->getFirst()->getRule(); 181 181 // computation of critical pairs 182 //critPairs->print(); 182 183 while( gPrev->getLast() != temp) { 183 184 //pWrite( *(gPrev->getFirst()->getPoly()) ); … … 206 207 -1 == pLmCmp(ppMult_qq(u1, newElement->getTerm()),ppMult_qq(u2, temp->getTerm()))) { 207 208 //Print("zweites groesser\n"); 209 208 210 CPair* cp = new CPair(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u2, 209 211 temp->getLPoly(), u1, newElement->getLPoly(), testedRule); 210 212 critPairs->insert(cp); 213 //Print("LALA %p\n",critPairs->getFirst()); 214 //sleep(5); 211 215 } 212 216 else { 213 //Print("erstes groesser\n");214 217 CPair* cp = new CPair(pDeg(ppMult_qq(u2,pHead(temp->getPoly()))), u1, 215 218 newElement->getLPoly(), u2, temp->getLPoly(), testedRule); 219 //Print("erstes groesser\n"); 216 220 critPairs->insert(cp); 221 //Print("LALA %p\n",critPairs->getFirst()); 222 //sleep(5); 217 223 } 218 224 } … … 228 234 //sleep(5); 229 235 //} 236 //Print("END CRITPAIRS\n"); 230 237 } 231 238 … … 280 287 inline bool criterion2(poly t, LNode* l, RList* rules, RTagList* rTag) { 281 288 //Print("------------------------------IN CRITERION 2/1-----------------------------------------\n"); 282 //Print("RULES: \n"); 283 //RNode* tempR = rules->getFirst(); 284 //while(NULL != tempR->getRule()) { 285 //Print("ADDRESS OF RNODE: %p\n",tempR); 286 //Print("ADDRESS OF RULE: %p\n",tempR->getRule()); 287 //pWrite(tempR->getRuleTerm()); 288 //Print("ADDRESS OF TERM: %p\n",tempR->getRuleTerm()); 289 //Print("%d\n\n",tempR->getRuleIndex()); 290 //tempR = tempR->getNext(); 291 //} 289 /* 290 Print("RULES: \n"); 291 RNode* tempR = rules->getFirst(); 292 int i = 1; 293 while(NULL != tempR->getRule()) { 294 Print("ADDRESS OF %d RNODE: %p\n",i,tempR); 295 Print("ADDRESS OF RULE: %p\n",tempR->getRule()); 296 pWrite(tempR->getRuleTerm()); 297 Print("ADDRESS OF TERM: %p\n",tempR->getRuleTerm()); 298 Print("%d\n\n",tempR->getRuleIndex()); 299 tempR = tempR->getNext(); 300 i++; 301 } 302 292 303 //Print("TESTED ELEMENT: "); 293 304 //pWrite(l->getPoly()); … … 295 306 //pWrite(ppMult_qq(t,l->getTerm())); 296 307 //Print("%d\n\n",l->getIndex()); 308 */ 297 309 // start at the previously added element to gPrev, as all other elements will have the same index for sure 298 310 RNode* testNode = new RNode(); … … 376 388 //Print("LAST RULE TESTED: %p",testedRule); 377 389 //Print("RULES: \n"); 378 RNode* tempR = rules->getFirst();390 //RNode* tempR = rules->getFirst(); 379 391 //while(NULL != tempR->getRule()) { 380 392 //pWrite(tempR->getRuleTerm()); … … 418 430 poly sp = pInit(); 419 431 //Print("###############################IN SPOLS##############################\n"); 420 while(NULL != temp->getData()) { 432 //first->print(); 433 434 while(NULL != temp) { 435 //Print("JA\n"); 421 436 // only if a new rule was added since the last test in subalgorithm criticalPair() 422 437 //if(rules->getFirst() != rTag->getFirst()) { 423 438 if(!criterion2(temp->getT1(),temp->getAdLp1(),rules,temp->getTestedRule())) { 424 439 // the second component is tested only when it has the actual index, otherwise there is 425 440 // no new rule to test since the last test in subalgorithm criticalPair() … … 495 510 } 496 511 //} 512 //Print("%p\n",temp); 497 513 temp = temp->getNext(); 514 //Print("%p\n",temp); 515 //Print("%p\n",temp->getData()); 516 //pWrite(temp->getLp1Poly()); 498 517 } 499 518 // these critical pairs can be deleted now as they are either useless for further computations or … … 854 873 //pWrite(gPrevTag->getPoly()); 855 874 gPrev = F5inc(i, id->m[i-1], gPrev, gbPrev, ONE, lTag, rules, rTag); 875 //Print("____________________________________ITERATION STEP DONE________________________________________\n"); 856 876 857 877 // DEBUGGING STUFF -
kernel/f5lists.cc
r47ca23 r7c81165 489 489 // working only with linked, but not doubly linked lists due to memory usage we have to check the 490 490 // insertion around the first element separately from the insertion around all other elements in the list 491 CNode* CNode::insert(CPair* c , CNode* last) {492 if(NULL == this ->data) {491 CNode* CNode::insert(CPair* c) { 492 if(NULL == this) { 493 493 CNode* newElement = new CNode(c, this); 494 494 return newElement; … … 511 511 //Print("Insert Deg\n"); 512 512 CNode* temp = this; 513 while( NULL != temp->next ->data) {513 while( NULL != temp->next) { 514 514 if(temp->next->data->getDeg() == c->getDeg() ) { 515 515 if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) { … … 528 528 } 529 529 } 530 CNode* newElement = new CNode(c, last);530 CNode* newElement = new CNode(c, NULL); 531 531 temp->next = newElement; 532 532 return this; … … 535 535 if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element 536 536 CNode* temp = this; 537 while( NULL != temp->next ->data) {537 while( NULL != temp->next ) { 538 538 if( c->getDeg() < temp->next->data->getDeg() ) { 539 539 CNode* newElement = new CNode(c, temp->next); … … 549 549 else { 550 550 temp = temp->next; 551 while( NULL != temp->next ->data) {551 while( NULL != temp->next ) { 552 552 if( temp->next->data->getDeg() == c->getDeg() ) { 553 553 if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(), … … 567 567 } 568 568 } 569 CNode* newElement = new CNode(c, last);569 CNode* newElement = new CNode(c, NULL); 570 570 temp->next = newElement; 571 571 return this; … … 576 576 } 577 577 } 578 CNode* newElement = new CNode(c, last);578 CNode* newElement = new CNode(c, NULL); 579 579 temp->next = newElement; 580 580 return this; … … 586 586 CNode* CNode::getMinDeg() { 587 587 CNode* temp = this; 588 while( NULL != temp->data) {589 while(NULL != temp->next ->data&& temp->next->data->getDeg() == this->data->getDeg()) {588 while(NULL != temp) { 589 while(NULL != temp->next && temp->next->data->getDeg() == this->data->getDeg()) { 590 590 temp = temp->next; 591 591 } … … 593 593 // every CList should end with a (NULL,NULL) element for a similar behaviour 594 594 // using termination conditions throughout the algorithm 595 temp->next = new CNode();595 temp->next = NULL; 596 596 return returnCNode; 597 597 } … … 663 663 CNode* temp = this; 664 664 Print("___________________List of critical pairs______________________:\n"); 665 while(NULL != temp ->data) {665 while(NULL != temp) { 666 666 Print("LP1 Index: %d\n",temp->getLp1Index()); 667 667 Print("T1: "); … … 690 690 // for initialization of CLists, last element alwas has data=NULL and next=NULL 691 691 CList::CList() { 692 first = new CNode(); 693 last = first; 692 first = NULL; 694 693 } 695 694 696 695 CList::CList(CPair* c) { 697 696 first = new CNode(c); 698 last = first;699 697 } 700 698 701 699 CList::~CList() { 702 700 CNode* temp; 703 while( first) {701 while(NULL != first) { 704 702 temp = first; 705 703 first = first->getNext(); … … 711 709 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels 712 710 void CList::insert(CPair* c) { 713 first = first->insert(c , last);711 first = first->insert(c); 714 712 } 715 713 -
kernel/f5lists.h
r47ca23 r7c81165 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: f5lists.h,v 1.1 4 2009-03-04 20:23:05ederc Exp $ */4 /* $Id: f5lists.h,v 1.15 2009-03-12 09:43:53 ederc Exp $ */ 5 5 /* 6 6 * ABSTRACT: list interface … … 201 201 CNode(CPair* c, CNode* n); 202 202 ~CNode(); 203 CNode* insert(CPair* c , CNode* last);203 CNode* insert(CPair* c); 204 204 CNode* getMinDeg(); 205 205 CPair* getData(); … … 230 230 private: 231 231 CNode* first; 232 // last alway has data=NULL and next=NULL, for initialization purposes used233 CNode* last;234 232 public: 235 233 // for initialization of CLists, last element alwas has data=NULL and next=NULL
Note: See TracChangeset
for help on using the changeset viewer.