f5lists.cc
Go to the documentation of this file.
1 
2 
3 
4 #include <kernel/mod2.h>
5 
6 #ifdef HAVE_F5
8 #include <kernel/structs.h>
9 #include <omalloc/omalloc.h>
10 #include <kernel/polys.h>
12 #include <kernel/ideals.h>
13 #include <kernel/GBEngine/kstd1.h>
14 #include <kernel/GBEngine/khstd.h>
15 #include <polys/kbuckets.h>
16 #include <polys/weight.h>
17 #include <misc/intvec.h>
18 #include <kernel/polys.h>
19 #include <kernel/GBEngine/f5gb.h>
20 #include <kernel/GBEngine/f5data.h>
22 
23 /**
24  * functions working on the class PNode
25  */
27  data = p;
28  next = n;
29 }
30 
32  return this->data;
33 }
34 
36  return this->next;
37 }
39  poly q = pOne();
40  q = pCopy(p);
41  PNode* temp = this;
42  if(NULL == temp) {
43  PNode* pn = new PNode(q,temp);
44  return pn;
45  }
46  if(1 == pLmCmp(q,temp->getPoly())) {
47  PNode* pn = new PNode(q,temp);
48  return pn;
49  }
50  if(0 == pLmCmp(q,temp->getPoly())) {
51  return this;
52  }
53  if(-1 == pLmCmp(q,temp->getPoly())) {
54  while(NULL != temp->getNext() && -1 == pLmCmp(q,temp->getNext()->getPoly())) {
55  temp = temp->getNext();
56  }
57  if(NULL == temp->getNext() || 1 == pLmCmp(q,temp->getNext()->getPoly())) {
58  PNode* pn = new PNode(q,temp->getNext());
59  temp->next = pn;
60  return this;
61  }
62  if(0 == pLmCmp(q,temp->getNext()->getPoly())) {
63  return this;
64  }
65  }
66 }
67 /*
68 PNode* PNode::insert(poly p) {
69  PNode* pn = new PNode(p,this);
70  return pn;
71 }
72 */
73 /**
74  * functions working on the class PList
75  */
77  first = NULL;
78 }
79 
80 
82  first = first->insert(p);
83 }
84 
85 
86 /*
87 PNode* PList::insert(poly p) {
88  PNode* temp = first;
89  PNode* pn = new PNode(p,temp);
90  first = pn;
91  return first;
92 }
93 */
95  PNode* temp = first;
96  //Print("\nCHECK: \n");
97  //pWrite(p);
98  //Print("-----\n");
99  while(NULL != temp) {
100  //pWrite(temp->getPoly());
101  //pWrite(p);
102  //Print("COMAPRE: %d\n",pLmEqual(p,temp->getPoly()));
103  if(1 == pLmEqual(p,temp->getPoly())) {
104  //Print("YES!\n");
105  //pWrite(pHead(temp->getPoly()));
106  //Print("YES!\n");
107  return 1;
108  }
109  temp = temp->getNext();
110  }
111  //Print("NOTHING!\n");
112  return 0;
113 }
114 
115 void PList::print() {
116  Print("-----LIST-----\n");
117  PNode* temp = first;
118  while(NULL != temp) {
119  pWrite(temp->getPoly());
120  temp = temp->getNext();
121  }
122 }
123 /*
124 ====================================
125 functions working on the class LNode
126 ====================================
127 */
128 
129 // generating new list elements (labeled / classical polynomial / LNode view)
131  data = NULL;
132  next = NULL;
133 }
135  data = lp;
136  next = NULL;
137 }
138 
140 //Print("HIER LNODE\n");
141  data = lp;
142  next = l;
143 }
144 
146 LPolyOld* lp = new LPolyOld(t,i,p,r);
147 data = lp;
148 next = NULL;
149 }
150 
152  LPolyOld* lp = new LPolyOld(t,i,p,r);
153  data = lp;
154  next = l;
155 }
156 
158  data = ln->getLPolyOld();
159  next = ln->getNext();
160 }
161 
163  //delete next;
164  //Print("DELETE LNODE\n");
165  delete data;
166 }
167 
169  while(NULL != next) {
170  //Print("%p\n",next);
171  //pWrite(next->data->getPoly());
172  next->deleteAll();
173  }
174  delete data;
175 }
176 
177 // insert new elements to the list always at the end (labeled / classical polynomial view)
178 // needed for list gPrev
180  //Print("LAST GPREV: ");
181  //pWrite(this->getPoly());
182  if(NULL == this) {
183  LNode* newElement = new LNode(lp,this);
184  return newElement;
185  }
186  else {
187  LNode* newElement = new LNode(lp, NULL);
188  this->next = newElement;
189  return newElement;
190  }
191 }
192 
193 inline LNode* LNode::insert(poly t, int i, poly p, RuleOld* r) {
194  if(NULL == this) {
195  LNode* newElement = new LNode(t,i,p,r,this);
196  return newElement;
197  }
198  else {
199  LNode* newElement = new LNode(t, i, p, r, NULL);
200  this->next = newElement;
201  return newElement;
202  }
203 }
204 
205 // insert new elements to the list always in front (labeled / classical polynomial view)
206 // needed for sPolyList
208  LNode* newElement = new LNode(lp, this);
209  //Print("INSERTED IN SPOLYLIST: ");
210  //pWrite(lp->getTerm());
211  return newElement;
212 }
213 
214 inline LNode* LNode::insertSP(poly t, int i, poly p, RuleOld* r) {
215  LNode* newElement = new LNode(t, i, p, r, this);
216  //Print("INSERTED IN SPOLYLIST: ");
217  //pWrite(t);
218 return newElement;
219 }
220 // insert new elemets to the list w.r.t. increasing labels
221 // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
223  //Print("ADDING SOLYS TO THE LIST\n");
224  //Print("new element: ");
225  //pWrite(t);
226  if(NULL == this) { // || NULL == data) {
227  LNode* newElement = new LNode(t, i, p, r, this);
228  return newElement;
229  }
230  else {
231  //Print("tested element1: ");
232  //pWrite(this->getTerm());
233  if(-1 == pLmCmp(t,this->getTerm())) {
234  //Print("HIERDRIN\n");
235  LNode* newElement = new LNode(t, i, p, r, this);
236  //Print("%p\n",this);
237  //Print("%p\n",newElement->next);
238  return newElement;
239  }
240  else {
241  LNode* temp = this;
242  while(NULL != temp->next && NULL != temp->next->data) {
243  //Print("tested element: ");
244  //pWrite(temp->getTerm());
245  if(-1 == pLmCmp(t,temp->next->getTerm())) {
246  LNode* newElement = new LNode(t, i, p, r, temp->next);
247  temp->next = newElement;
248  return this;
249  }
250  else {
251  temp = temp->next;
252  //Print("%p\n",temp);
253  //Print("%p\n",temp->data);
254 
255  //Print("%p\n",temp->next);
256  }
257  }
258  //Print("HIER\n");
259  LNode* newElement = new LNode(t, i, p, r, temp->next);
260  temp->next = newElement;
261  return this;
262  }
263  }
264 }
265 
267  l->next = this;
268  return l;
269 }
270 
272  //Print("ADDING SOLYS TO THE LIST\n");
273  //Print("new element: ");
274  //pWrite(t);
275  if(NULL == this) { // || NULL == data) {
276  l->next = this;
277  return l;
278  }
279  else {
280  //Print("tested element1: ");
281  //pWrite(this->getTerm());
282  if(-1 == pLmCmp(l->getTerm(),this->getTerm())) {
283  //Print("HIERDRIN\n");
284  l->next = this;
285  //Print("%p\n",this);
286  //Print("%p\n",newElement->next);
287  return l;
288  }
289  else {
290  LNode* temp = this;
291  while(NULL != temp->next && NULL != temp->next->data) {
292  //Print("tested element: ");
293  //pWrite(temp->getTerm());
294  if(-1 == pLmCmp(l->getTerm(),temp->next->getTerm())) {
295  l->next = temp->next;
296  temp->next = l;
297  return this;
298  }
299  else {
300  temp = temp->next;
301  //Print("%p\n",temp);
302  //Print("%p\n",temp->data);
303 
304  //Print("%p\n",temp->next);
305  }
306  }
307  //Print("HIER\n");
308  l->next = temp->next;
309  temp->next = l;
310  return this;
311  }
312  }
313 }
314 
315 // deletes the first elements of the list with the same degree
316 // only used for the S-polys, which are already sorted by increasing degree by CListOld
318  return this;
319 }
320 
321 // get next from current LNode
323  return next;
324 }
325 
326 // get the LPolyOld* out of LNode*
328  return data;
329 }
330 
331 // get the data from the LPolyOld saved in LNode
333  return data->getPoly();
334 }
335 
337  return data->getTerm();
338 }
339 
341  return data->getIndex();
342 }
343 
345  return data->getRuleOld();
346 }
347 
349  return data->setRuleOld(r);
350 }
351 
353  return data->getDel();
354 }
355 
356 // set the data from the LPolyOld saved in LNode
358  data->setPoly(p);
359 }
360 
362  data->setTerm(t);
363 }
364 
365 void LNode::setIndex(int i) {
366  data->setIndex(i);
367 }
368 
370  next = l;
371 }
372 
373 void LNode::setDel(bool d) {
374  data->setDel(d);
375 }
376 
377 // test if for any list element the polynomial part of the data is equal to *p
379  LNode* temp = new LNode(this);
380  while(NULL != temp) {
381  if(pComparePolys(temp->getPoly(),*p)) {
382  return 1;
383  }
384  temp = temp->next;
385  }
386  return 0;
387 }
388 
390  return l->next;
391 }
392 
393 // for debugging
394 void LNode::print() {
395  LNode* temp = this;
396  Print("___________________List of S-polynomials______________________:\n");
397  while(NULL != temp && NULL != temp->data) {
398  Print("Index: %d\n",temp->getIndex());
399  Print("Term: ");
400  pWrite(temp->getTerm());
401  Print("Poly: ");
402  pWrite(temp->getPoly());
403  temp = temp->next;
404  }
405  Print("_______________________________________________________________\n");
406 }
407 
409  int nonDel = 0;
410  LNode* temp = l;
411  while(NULL != temp) {
412  if(!temp->getDel()) {
413  nonDel++;
414  temp = temp->next;
415  }
416  else {
417  temp = temp->next;
418  }
419  }
420  return nonDel;
421 }
422 
423 /*
424 ====================================
425 functions working on the class LList
426 ====================================
427 */
428 
430  first = last = NULL;;
431  length = 0;
432 }
433 
435  first = new LNode(lp);
436  last = first;
437  length = 1;
438 }
439 
441  first = new LNode(t,i,p,r);
442  last = first;
443  length = 1;
444 }
445 
447  LNode* temp;
448  while(first) {
449  temp = first;
450  first = first->getNext();
451  delete temp;
452  //Print("%p\n",first);
453  }
454 }
455 
456 // insertion at the end of the list, needed for gPrev
458  last = last->insert(lp);
459  if(NULL == first) {
460  first = last;
461  }
462  //Print("NEW LAST GPREV: ");
463  //pWrite(last->getPoly());
464  //Print("%p\n",first);
465  //pWrite(first->getPoly());
466  length++;
467  //Print("LENGTH %d\n",length);
468 }
469 
470 void LList::insert(poly t,int i, poly p, RuleOld* r) {
471  last = last->insert(t,i,p,r);
472  if(NULL == first) {
473  first = last;
474  }
475  length++;
476  //Print("LENGTH %d\n",length);
477 }
478 
479 // insertion in front of the list, needed for sPolyList
481  first = first->insertSP(lp);
482  length++;
483  //Print("LENGTH %d\n",length);
484 }
485 
486 void LList::insertSP(poly t,int i, poly p, RuleOld* r) {
487  first = first->insertSP(t,i,p,r);
488  length++;
489  //Print("LENGTH %d\n",length);
490 }
491 
492 
494  first = first->insertByLabel(t,i,p,r);
495  length++;
496  //Print("LENGTH %d\n",length);
497 }
498 
500  first = first->insertFirst(l);
501  length++;
502  //Print("LENGTH %d\n",length);
503 }
504 
506  first = first->insertByLabel(l);
507  length++;
508  //Print("LENGTH %d\n",length);
509 }
510 
512  first = first->deleteByDeg();
513 }
514 
516  return first->polyTest(p);
517 }
518 
520  return first;
521 }
522 
524  return last;
525 }
526 
528  return length;
529 }
530 
532  LNode* temp = first;
533  temp->setNext(NULL);
534  first = l;
535  length--;
536 }
537 
538 void LList::print() {
539  first->print();
540 }
541 
543  return first->count(l);
544 }
545 /*
546 =======================================
547 functions working on the class LTagNode
548 =======================================
549 */
551  data = NULL;
552  next = NULL;
553 }
554 
556  data = l;
557  next = NULL;
558 }
559 
561  data = l;
562  next = n;
563 }
564 
566  delete data;
567 }
568 
569 // declaration with first as parameter due to sorting of LTagList
571  LTagNode* newElement = new LTagNode(l, this);
572  return newElement;
573 }
574 
576  return this->data;
577 }
578 
580  return next;
581 }
582 
583 // NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
584 // Thus given actual index i and idx being the index of the LPolyOld under investigation
585 // the element on position length-idx is the right one
586 LNode* LTagNode::get(int idx, int length) {
587  if(idx == 1) {
588  return NULL;
589  }
590  else {
591  int j;
592  LTagNode* temp = this; // last
593  for(j=1;j<=length-idx+1;j++) {
594  temp = temp->next;
595  }
596  return temp->data;
597  }
598 }
599 
600 
601 /*
602 =======================================
603 functions working on the class LTagList
604 =======================================
605 */
607  LTagNode* first = new LTagNode();
608 
609  length = 0;
610 }
611 
613  LTagNode* first = new LTagNode(l);
614  length = 1;
615 }
616 
618  LTagNode* temp;
619  while(first) {
620  temp = first;
621  first = first->getNext();
622  delete temp;
623  //Print("%p\n",first);
624  }
625 }
626 
627 // declaration with first as parameter in LTagNode due to sorting of LTagList
629  first = first->insert(l);
630  length++;
631 }
632 
634  firstCurrentIdx = l;
635 }
636 
637 LNode* LTagList::get(int idx) {
638  return first->get(idx, length);
639 }
640 
642  return first->getLNode();
643 }
644 
646  return firstCurrentIdx;
647 }
648 
649 /*
650 =====================================
651 functions working on the class TopRed
652 =====================================
653 */
654 
656  _completed = NULL;
657  _toDo = NULL;
658 }
659 
661  _completed = c;
662  _toDo = t;
663 }
664 
666  return _completed;
667 }
668 
670  return _toDo;
671 }
672 
673 /*
674 ====================================
675 functions working on the class CNode
676 ====================================
677 */
678 
680  data = NULL;
681  next = NULL;
682 }
683 
685  data = c;
686  next = NULL;
687 }
688 
690  data = c;
691  next = n;
692 }
693 
695  delete data;
696 }
697 
698 // insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
699 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
700 // working only with linked, but not doubly linked lists due to memory usage we have to check the
701 // insertion around the first element separately from the insertion around all other elements in the list
703  if(NULL == this) {
704  CNode* newElement = new CNode(c, this);
705  return newElement;
706  }
707  else {
708  poly u1 = ppMult_qq(c->getT1(),c->getLp1Term());
709  if( c->getDeg() < this->data->getDeg() ) { // lower degree than the first list element
710  CNode* newElement = new CNode(c, this);
711  return newElement;
712  }
713  if( c->getDeg() == this->data->getDeg() ) { // same degree than the first list element
714  if(1 != pLmCmp(u1,ppMult_qq(this->data->getT1(), this->data->getLp1Term()))) {
715  //pWrite(u1);
716  //Print("Multi-Term in CritPairs Sortierung altes Element: ");
717  //pWrite(ppMult_qq(this->data->getT1(),this->data->getLp1Term()));
718  CNode* newElement = new CNode(c, this);
719  return newElement;
720  }
721  else {
722  //Print("Insert Deg\n");
723  CNode* temp = this;
724  while( NULL != temp->next) {
725  if(temp->next->data->getDeg() == c->getDeg() ) {
726  if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) {
727  temp = temp->next;
728  }
729  else {
730  CNode* newElement = new CNode(c, temp->next);
731  temp->next = newElement;
732  return this;
733  }
734  }
735  else {
736  CNode* newElement = new CNode(c, temp->next);
737  temp->next = newElement;
738  return this;
739  }
740  }
741  CNode* newElement = new CNode(c, NULL);
742  temp->next = newElement;
743  return this;
744  }
745  } // outer if-clause
746  if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element
747  CNode* temp = this;
748  while( NULL != temp->next ) {
749  if( c->getDeg() < temp->next->data->getDeg() ) {
750  CNode* newElement = new CNode(c, temp->next);
751  temp->next = newElement;
752  return this;
753  }
754  if( c->getDeg() == temp->next->data->getDeg() ) {
755  if(1 != pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) {
756  CNode* newElement = new CNode(c, temp->next);
757  temp->next = newElement;
758  return this;
759  }
760  else {
761  temp = temp->next;
762  while( NULL != temp->next ) {
763  if( temp->next->data->getDeg() == c->getDeg() ) {
764  if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),
765  temp->next->data->getLp1Term()))) {
766  temp = temp->next;
767  }
768  else {
769  CNode* newElement = new CNode(c, temp->next);
770  temp->next = newElement;
771  return this;
772  }
773  }
774  else {
775  CNode* newElement = new CNode(c, temp->next);
776  temp->next = newElement;
777  return this;
778  }
779  }
780  CNode* newElement = new CNode(c, NULL);
781  temp->next = newElement;
782  return this;
783  }
784  }
785  if( c->getDeg() > temp->next->data->getDeg() ) {
786  temp = temp->next;
787  }
788  }
789  CNode* newElement = new CNode(c, NULL);
790  temp->next = newElement;
791  return this;
792  }
793  }
794 }
795 
796 
798  CNode* newElement = new CNode(cp);
799  newElement->next = this;
800  return newElement;
801 }
802 
803 
804 // get the first elements from CListOld which by the above sorting have minimal degree
806  CNode* temp = this;
807  while(NULL != temp) {
808  while(NULL != temp->next && temp->next->data->getDeg() == this->data->getDeg()) {
809  temp = temp->next;
810  }
811  CNode* returnCNode = temp->next;
812  // every CListOld should end with a (NULL,NULL) element for a similar behaviour
813  // using termination conditions throughout the algorithm
814  temp->next = NULL;
815  return returnCNode;
816  }
817  return NULL;
818 }
819 
821  return data;
822 }
823 
825  return next;
826 }
827 
829  return this->data->getAdLp1();
830 }
831 
833  return this->data->getAdLp2();
834 }
835 
837  return this->data->getLp1Poly();
838 }
839 
841  return this->data->getLp2Poly();
842 }
843 
845  return this->data->getLp1Term();
846 }
847 
849  return this->data->getLp2Term();
850 }
851 
853  return this->data->getLp1Index();
854 }
855 
857  return this->data->getLp2Index();
858 }
859 
861  return this->data->getT1();
862 }
863 
865  return this->data->getAdT1();
866 }
867 
869  return this->data->getT2();
870 }
871 
873  return this->data->getAdT2();
874 }
875 
877  return data->getDel();
878 }
879 
881  return this->data->getTestedRuleOld();
882 }
883 
884 // for debugging
885 void CNode::print() {
886  CNode* temp = this;
887  Print("___________________List of critical pairs______________________:\n");
888  while(NULL != temp) {
889  pWrite(ppMult_qq(temp->getT1(),temp->getLp1Term()));
890  Print("LP1 Index: %d\n",temp->getLp1Index());
891  Print("T1: ");
892  pWrite(temp->getT1());
893  Print("%p\n",temp->getT1());
894  Print("LP1 Term: ");
895  pWrite(temp->getLp1Term());
896  Print("LP1 Poly: ");
897  pWrite(temp->getLp1Poly());
898  Print("LP2 Index: %d\n",temp->getLp2Index());
899  Print("T2: ");
900  pWrite(temp->getT2());
901  Print("%p\n",temp->getT2());
902  Print("LP2 Term: ");
903  pWrite(temp->getLp2Term());
904  Print("LP2 Poly: ");
905  pWrite(temp->getLp2Poly());
906  Print("\n");
907  temp = temp->next;
908  }
909 }
910 
911 /*
912 ====================================
913 functions working on the class CListOld
914 ====================================
915 */
916 // for initialization of CListOlds, last element alwas has data=NULL and next=NULL
918  first = NULL;
919 }
920 
922  first = new CNode(c);
923 }
924 
926  CNode* temp;
927  while(NULL != first) {
928  temp = first;
929  first = first->getNext();
930  delete temp;
931  }
932 }
933 
934 // insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
935 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
937  first = first->insert(c);
938 }
939 
941  first = first->insertWithoutSort(c);
942 }
943 
945  return first;
946 }
947 
948 // get the first elements from CListOld which by the above sorting have minimal degree
949 // returns the pointer on the first element of those
951  CNode* temp = first;
952  first = first->getMinDeg();
953  return temp;
954 }
955 
957  first->print();
958 }
959 
960 /*
961 ====================================
962 functions working on the class RNode
963 ====================================
964 */
966  //Print("HIER RNODE CONSTRUCTOR\n");
967  data = NULL;
968  next = NULL;
969 }
970 
972  data = r;
973  next = NULL;
974 }
975 
977  //Print("DELETE RuleOld\n");
978  delete data;
979 }
980 
982  RNode* newElement = new RNode(r);
983  newElement->next = this;
984  return newElement;
985 }
986 
988  //Print("IN INSERT: ");
989  //pWrite(t);
990  RuleOld* r = new RuleOld(i,t);
991  //Print("ADDRESS OF RuleOld: %p\n",r);
992  RNode* newElement = new RNode(r);
993  //Print("ADDRESS OF RNODE: %p\n",newElement);
994  //Print("ADDRESS OF RNODE DATA: %p\n",newElement->getRuleOld());
995  newElement->next = this;
996  return newElement;
997 }
998 
999 
1001  RNode* newElement = new RNode(r);
1002  RNode* temp = this;
1003  if(NULL == temp) {
1004  newElement->next = temp;
1005  return newElement;
1006  }
1007  if(1 == pLmCmp(newElement->getRuleOldTerm(),temp->getRuleOldTerm())) {
1008  newElement->next = temp;
1009  return newElement;
1010  }
1011  else {
1012  while(NULL != temp && 1 == pLmCmp(temp->getRuleOldTerm(),newElement->getRuleOldTerm())) {
1013  temp = temp->getNext();
1014  }
1015  newElement->next = temp;
1016  return this;
1017  }
1018 }
1019 
1020 
1022  return next;
1023 }
1024 
1026  return data;
1027 }
1028 
1030  return data->getIndex();
1031 }
1032 
1034  return data->getTerm();
1035 }
1036 
1038  RNode* temp = this;
1039  while(NULL != temp) {
1040  pWrite(temp->getRuleOldTerm());
1041  Print("%d\n\n",temp->getRuleOldIndex());
1042  temp = temp->getNext();
1043  }
1044 }
1045 
1046 /*
1047 ====================================
1048 functions working on the class RList
1049 ====================================
1050 */
1052  first = NULL;
1053 }
1054 
1056  first = new RNode(r);
1057 }
1058 
1060  RNode* temp;
1061  //Print("%p\n",first);
1062  while(first) {
1063  temp = first;
1064  first = first->getNext();
1065  //Print("1 %p\n",first);
1066  //if(first) {
1067  //Print("1' %p\n",first->getRuleOld());
1068  //Print("2 %p\n",first->getNext());
1069  //Print("3 %p\n",first->getNext()->getRuleOld());
1070  //Print("3 %p\n",first->getNext()->getRuleOldTerm());
1071  //}
1072  delete temp;
1073  }
1074  //Print("FERTIG\n");
1075 }
1076 
1077 void RList::insert(int i, poly t) {
1078  first = first->insert(i,t);
1079 }
1080 
1082  first = first->insert(r);
1083 }
1084 
1086  first = first->insertOrdered(r);
1087 }
1088 
1090  return first;
1091 }
1092 
1094  return this->getRuleOld();
1095 }
1096 
1098  first->print();
1099 }
1100 
1101 /*
1102 =======================================
1103 functions working on the class RTagNode
1104 =======================================
1105 */
1106 
1108  data = NULL;
1109  next = NULL;
1110 }
1111 
1113  data = r;
1114  next = NULL;
1115 }
1116 
1118 
1119  data = r;
1120  next = n;
1121 }
1122 
1124  delete data;
1125 }
1126 
1127 // declaration with first as parameter due to sorting of RTagList
1129  //Print("Hier1\n");
1130  RTagNode* newElement = new RTagNode(r, this);
1131  //Print("Hier2\n");
1132  return newElement;
1133 }
1134 
1136  //Print("%p\n", this);
1137  //Print("%p\n",this->data);
1138  return this->data;
1139 }
1140 
1142  return next;
1143 }
1144 
1145 // NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
1146 // Thus given actual index i and idx being the index of the LPolyOld under investigation
1147 // the element on position length-idx+1 is the right one
1148 RNode* RTagNode::get(int idx, int length) {
1149  if(idx==1 || idx==0) {
1150  // NOTE: We set this NULL as putting it the last element in the list, i.e. the element having
1151  // RNode* = NULL would cost lots of iterations at each step of F5inc, with increasing
1152  // length of the list this should be prevented
1153  return NULL;
1154  }
1155  else {
1156  int j;
1157  RTagNode* temp = this;
1158  //Print("\n\nHIER IN GET IDX\n");
1159  //Print("FOR LOOP: %d\n",length-idx+1);
1160  for(j=1; j<=length-idx+1; j++) {
1161  temp = temp->next;
1162  }
1163  return temp->data;
1164  }
1165 }
1166 
1168  this->data = r;
1169 }
1170 
1171 
1173  RTagNode* temp = this;
1174  if(NULL != temp && NULL != temp->getRNode()) {
1175  Print("1. element: %d, ",getRNode()->getRuleOld()->getIndex());
1176  pWrite(getRNode()->getRuleOld()->getTerm());
1177  temp = temp->next;
1178  int i = 2;
1179  while(NULL != temp->getRNode() && NULL != temp) {
1180  Print("%d. element: %d, ",i,getRNode()->getRuleOld()->getIndex());
1181  pWrite(getRNode()->getRuleOld()->getTerm());
1182  temp = temp->next;
1183  i++;
1184  }
1185  }
1186 }
1187 
1188 /*
1189 =======================================
1190 functions working on the class LTagList
1191 =======================================
1192 */
1193 
1195  RTagNode* first = new RTagNode();
1196  length = 0;
1197 }
1198 
1200  RTagNode* first = new RTagNode(r);
1201  length = 1;
1202 }
1203 
1205  RTagNode* temp;
1206  while(first) {
1207  temp = first;
1208  first = first->getNext();
1209  delete temp;
1210  }
1211 }
1212 
1213 // declaration with first as parameter in LTagNode due to sorting of LTagList
1215  first = first->insert(r);
1216  //Print("LENGTH:%d\n",length);
1217  length = length +1;
1218  //Print("LENGTH:%d\n",length);
1219 }
1220 
1222  return first->getRNode();
1223 }
1224 
1226  return first->get(idx, length);
1227 }
1228 
1230  first->set(r);
1231 }
1232 
1234  first->print();
1235 }
1236 
1238  return length;
1239 }
1240 #endif
PNode(poly p, PNode *n)
functions working on the class PNode
Definition: f5lists.cc:26
#define ppMult_qq(p, q)
Definition: polys.h:179
RNode * getFirst()
Definition: f5lists.cc:1221
LNode * insertFirst(LNode *l)
Definition: f5lists.cc:266
RTagNode * insert(RNode *r)
Definition: f5lists.cc:1128
bool check(poly p)
Definition: f5lists.cc:94
LNode * getNext()
Definition: f5lists.cc:322
LNode()
Definition: f5lists.cc:130
#define Print
Definition: emacs.cc:83
poly getT2()
Definition: f5lists.cc:868
LList()
Definition: f5lists.cc:429
class PNode of nodes of polynomials
Definition: f5lists.h:36
void insert(LNode *l)
Definition: f5lists.cc:628
CNode * insert(CPairOld *c)
Definition: f5lists.cc:702
long getDeg()
Definition: f5data.h:162
LList * getCompleted()
Definition: f5lists.cc:665
~RList()
Definition: f5lists.cc:1059
~CNode()
Definition: f5lists.cc:694
void insert(LPolyOld *lp)
Definition: f5lists.cc:457
poly getPoly()
Definition: f5lists.cc:31
LNode * insertSP(LPolyOld *lp)
Definition: f5lists.cc:207
void insert(poly p)
Definition: f5lists.cc:81
Compatiblity layer for legacy polynomial operations (over currRing)
int getLength()
Definition: f5lists.cc:527
return P p
Definition: myNF.cc:203
CNode()
Definition: f5lists.cc:679
CPairOld * getData()
Definition: f5lists.cc:820
LNode * insertByLabel(poly t, int i, poly p, RuleOld *r)
Definition: f5lists.cc:222
bool getDel()
Definition: f5lists.cc:352
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
poly data
Definition: f5lists.h:38
poly getTerm()
Definition: f5lists.cc:336
poly getT1()
Definition: f5data.h:166
poly * getAdT2()
Definition: f5lists.cc:872
RuleOld * getRuleOld()
Definition: f5lists.cc:344
static poly getTerm(const ideal H, const mark ab)
poly getT1()
Definition: f5lists.cc:860
static poly last
Definition: hdegree.cc:1075
LNode * next
Definition: f5lists.h:68
structure of RuleOlds(i.e.
Definition: f5data.h:232
void setFirstCurrentIdx(LNode *l)
Definition: f5lists.cc:633
void setIndex(int i)
Definition: f5lists.cc:365
RNode * get(int idx)
Definition: f5lists.cc:1225
void setFirst(RNode *r)
Definition: f5lists.cc:1229
LList * getToDo()
Definition: f5lists.cc:669
int count(LNode *l)
Definition: f5lists.cc:542
void pWrite(poly p)
Definition: polys.h:279
poly getLp1Term()
Definition: f5lists.cc:844
RTagList()
Definition: f5lists.cc:1194
~RTagList()
Definition: f5lists.cc:1204
poly getPoly()
Definition: f5lists.cc:332
void insert(RNode *r)
Definition: f5lists.cc:1214
RNode()
Definition: f5lists.cc:965
void print()
Definition: f5lists.cc:885
LNode * getFirst()
Definition: f5lists.cc:641
void setTerm(poly t)
Definition: f5lists.cc:361
void print()
Definition: f5lists.cc:538
LNode * get(int idx)
Definition: f5lists.cc:637
void print()
Definition: f5lists.cc:956
void print()
Definition: f5lists.cc:1233
CNode * getMinDeg()
Definition: f5lists.cc:950
RNode * getNext()
Definition: f5lists.cc:1021
poly getLp1Poly()
Definition: f5lists.cc:836
~RNode()
Definition: f5lists.cc:976
poly getLp2Poly()
Definition: f5lists.cc:840
RuleOld * getTestedRuleOld()
Definition: f5lists.cc:880
RTagNode * next
Definition: f5lists.h:340
LTagNode * getNext()
Definition: f5lists.cc:579
RNode * get(int idx, int length)
Definition: f5lists.cc:1148
const ring r
Definition: syzextra.cc:208
int getLp1Index()
Definition: f5lists.cc:852
Definition: f5lists.h:65
~LNode()
Definition: f5lists.cc:162
Definition: f5lists.h:232
RuleOld * getRuleOld()
Definition: f5lists.cc:1093
int j
Definition: myNF.cc:70
LNode * getFirstCurrentIdx()
Definition: f5lists.cc:645
RNode * insert(RuleOld *r)
Definition: f5lists.cc:981
poly getRuleOldTerm()
Definition: f5lists.cc:1033
RTagNode * getNext()
Definition: f5lists.cc:1141
RuleOld * getRuleOld()
Definition: f5lists.cc:1025
int count(LNode *l)
Definition: f5lists.cc:408
class of labeled polynomials
Definition: f5data.h:28
bool polyTest(poly *p)
Definition: f5lists.cc:378
CListOld()
Definition: f5lists.cc:917
LPolyOld * getLPolyOld()
Definition: f5lists.cc:327
int getRuleOldIndex()
Definition: f5lists.cc:1029
~LList()
Definition: f5lists.cc:446
void insertFirst(LNode *l)
Definition: f5lists.cc:499
RList()
Definition: f5lists.cc:1051
LPolyOld * getAdLp2()
Definition: f5lists.cc:832
LTagNode * next
Definition: f5lists.h:169
int i
Definition: cfEzgcd.cc:123
PNode * getNext()
Definition: f5lists.cc:35
void deleteAll()
Definition: f5lists.cc:168
#define pOne()
Definition: polys.h:286
RNode * insertOrdered(RuleOld *r)
Definition: f5lists.cc:1000
void setPoly(poly p)
Definition: f5lists.cc:357
LPolyOld * data
Definition: f5lists.h:67
CNode * next
Definition: f5lists.h:235
PNode * next
Definition: f5lists.h:39
void insert(CPairOld *c)
Definition: f5lists.cc:936
LTagNode * insert(LNode *l)
Definition: f5lists.cc:570
void setDel(bool d)
Definition: f5lists.cc:373
RTagNode()
Definition: f5lists.cc:1107
~RTagNode()
Definition: f5lists.cc:1123
bool polyTest(poly *p)
Definition: f5lists.cc:515
int getLength()
Definition: f5lists.cc:1237
void print()
Definition: f5lists.cc:1172
LNode * getLNode()
Definition: f5lists.cc:575
CPairOld * data
Definition: f5lists.h:234
#define NULL
Definition: omList.c:10
RNode * data
Definition: f5lists.h:339
void setNext(LNode *l)
Definition: f5lists.cc:369
Definition: f5lists.h:127
PNode * insert(poly p)
Definition: f5lists.cc:38
~CListOld()
Definition: f5lists.cc:925
LNode * insert(LPolyOld *lp)
Definition: f5lists.cc:179
CNode * getNext()
Definition: f5lists.cc:824
CNode * insertWithoutSort(CPairOld *cp)
Definition: f5lists.cc:797
void insert(RuleOld *r)
Definition: f5lists.cc:1081
bool getDel()
Definition: f5lists.cc:876
void insertByLabel(poly t, int i, poly p, RuleOld *r=NULL)
Definition: f5lists.cc:493
void print()
Definition: f5lists.cc:1037
CNode * getMinDeg()
Definition: f5lists.cc:805
void print()
Definition: f5lists.cc:394
void deleteByDeg()
Definition: f5lists.cc:511
poly * getAdT1()
Definition: f5lists.cc:864
PList()
functions working on the class PList
Definition: f5lists.cc:76
LTagNode()
Definition: f5lists.cc:550
poly getLp1Term()
Definition: f5data.h:198
void insertWithoutSort(CPairOld *c)
Definition: f5lists.cc:940
RNode * next
Definition: f5lists.h:293
void setFirst(LNode *l)
Definition: f5lists.cc:531
int getLp2Index()
Definition: f5lists.cc:856
TopRed()
Definition: f5lists.cc:655
LPolyOld * getAdLp1()
Definition: f5lists.cc:828
poly getLp2Term()
Definition: f5lists.cc:848
polyrec * poly
Definition: hilb.h:10
LNode * get(int i, int length)
Definition: f5lists.cc:586
Definition: f5lists.h:290
int getIndex()
Definition: f5lists.cc:340
LNode * getFirst()
Definition: f5lists.cc:519
LNode * deleteByDeg()
Definition: f5lists.cc:317
void print()
Definition: f5lists.cc:115
void print()
Definition: f5lists.cc:1097
RNode * getFirst()
Definition: f5lists.cc:1089
void insertSP(LPolyOld *lp)
Definition: f5lists.cc:480
void setRuleOld(RuleOld *r)
Definition: f5lists.cc:348
~LTagList()
Definition: f5lists.cc:617
#define pLmEqual(p1, p2)
Definition: polys.h:111
void insertOrdered(RuleOld *r)
Definition: f5lists.cc:1085
LTagList()
Definition: f5lists.cc:606
int l
Definition: cfEzgcd.cc:94
~LTagNode()
Definition: f5lists.cc:565
void set(RNode *)
Definition: f5lists.cc:1167
LNode * getLast()
Definition: f5lists.cc:523
CNode * getFirst()
Definition: f5lists.cc:944
RNode * getRNode()
Definition: f5lists.cc:1135
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
LNode * data
Definition: f5lists.h:168
structure of labeled critical pairs
Definition: f5data.h:123