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
395 {
396  LNode* temp = this;
397  PrintS("___________________List of S-polynomials______________________:\n");
398  while(NULL != temp && NULL != temp->data) {
399  Print("Index: %d\n",temp->getIndex());
400  PrintS("Term: ");
401  pWrite(temp->getTerm());
402  PrintS("Poly: ");
403  pWrite(temp->getPoly());
404  temp = temp->next;
405  }
406  PrintS("_______________________________________________________________\n");
407 }
408 
410  int nonDel = 0;
411  LNode* temp = l;
412  while(NULL != temp) {
413  if(!temp->getDel()) {
414  nonDel++;
415  temp = temp->next;
416  }
417  else {
418  temp = temp->next;
419  }
420  }
421  return nonDel;
422 }
423 
424 /*
425 ====================================
426 functions working on the class LList
427 ====================================
428 */
429 
431  first = last = NULL;;
432  length = 0;
433 }
434 
436  first = new LNode(lp);
437  last = first;
438  length = 1;
439 }
440 
442  first = new LNode(t,i,p,r);
443  last = first;
444  length = 1;
445 }
446 
448  LNode* temp;
449  while(first) {
450  temp = first;
451  first = first->getNext();
452  delete temp;
453  //Print("%p\n",first);
454  }
455 }
456 
457 // insertion at the end of the list, needed for gPrev
459  last = last->insert(lp);
460  if(NULL == first) {
461  first = last;
462  }
463  //Print("NEW LAST GPREV: ");
464  //pWrite(last->getPoly());
465  //Print("%p\n",first);
466  //pWrite(first->getPoly());
467  length++;
468  //Print("LENGTH %d\n",length);
469 }
470 
471 void LList::insert(poly t,int i, poly p, RuleOld* r) {
472  last = last->insert(t,i,p,r);
473  if(NULL == first) {
474  first = last;
475  }
476  length++;
477  //Print("LENGTH %d\n",length);
478 }
479 
480 // insertion in front of the list, needed for sPolyList
482  first = first->insertSP(lp);
483  length++;
484  //Print("LENGTH %d\n",length);
485 }
486 
487 void LList::insertSP(poly t,int i, poly p, RuleOld* r) {
488  first = first->insertSP(t,i,p,r);
489  length++;
490  //Print("LENGTH %d\n",length);
491 }
492 
493 
495  first = first->insertByLabel(t,i,p,r);
496  length++;
497  //Print("LENGTH %d\n",length);
498 }
499 
501  first = first->insertFirst(l);
502  length++;
503  //Print("LENGTH %d\n",length);
504 }
505 
508  length++;
509  //Print("LENGTH %d\n",length);
510 }
511 
513  first = first->deleteByDeg();
514 }
515 
517  return first->polyTest(p);
518 }
519 
521  return first;
522 }
523 
525  return last;
526 }
527 
529  return length;
530 }
531 
533  LNode* temp = first;
534  temp->setNext(NULL);
535  first = l;
536  length--;
537 }
538 
539 void LList::print() {
540  first->print();
541 }
542 
544  return first->count(l);
545 }
546 /*
547 =======================================
548 functions working on the class LTagNode
549 =======================================
550 */
552  data = NULL;
553  next = NULL;
554 }
555 
557  data = l;
558  next = NULL;
559 }
560 
562  data = l;
563  next = n;
564 }
565 
567  delete data;
568 }
569 
570 // declaration with first as parameter due to sorting of LTagList
572  LTagNode* newElement = new LTagNode(l, this);
573  return newElement;
574 }
575 
577  return this->data;
578 }
579 
581  return next;
582 }
583 
584 // NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
585 // Thus given actual index i and idx being the index of the LPolyOld under investigation
586 // the element on position length-idx is the right one
587 LNode* LTagNode::get(int idx, int length) {
588  if(idx == 1) {
589  return NULL;
590  }
591  else {
592  int j;
593  LTagNode* temp = this; // last
594  for(j=1;j<=length-idx+1;j++) {
595  temp = temp->next;
596  }
597  return temp->data;
598  }
599 }
600 
601 
602 /*
603 =======================================
604 functions working on the class LTagList
605 =======================================
606 */
608  LTagNode* first = new LTagNode();
609 
610  length = 0;
611 }
612 
614  LTagNode* first = new LTagNode(l);
615  length = 1;
616 }
617 
619  LTagNode* temp;
620  while(first) {
621  temp = first;
622  first = first->getNext();
623  delete temp;
624  //Print("%p\n",first);
625  }
626 }
627 
628 // declaration with first as parameter in LTagNode due to sorting of LTagList
630  first = first->insert(l);
631  length++;
632 }
633 
635  firstCurrentIdx = l;
636 }
637 
638 LNode* LTagList::get(int idx) {
639  return first->get(idx, length);
640 }
641 
643  return first->getLNode();
644 }
645 
647  return firstCurrentIdx;
648 }
649 
650 /*
651 =====================================
652 functions working on the class TopRed
653 =====================================
654 */
655 
657  _completed = NULL;
658  _toDo = NULL;
659 }
660 
662  _completed = c;
663  _toDo = t;
664 }
665 
667  return _completed;
668 }
669 
671  return _toDo;
672 }
673 
674 /*
675 ====================================
676 functions working on the class CNode
677 ====================================
678 */
679 
681  data = NULL;
682  next = NULL;
683 }
684 
686  data = c;
687  next = NULL;
688 }
689 
691  data = c;
692  next = n;
693 }
694 
696  delete data;
697 }
698 
699 // insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
700 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
701 // working only with linked, but not doubly linked lists due to memory usage we have to check the
702 // insertion around the first element separately from the insertion around all other elements in the list
704  if(NULL == this) {
705  CNode* newElement = new CNode(c, this);
706  return newElement;
707  }
708  else {
709  poly u1 = ppMult_qq(c->getT1(),c->getLp1Term());
710  if( c->getDeg() < this->data->getDeg() ) { // lower degree than the first list element
711  CNode* newElement = new CNode(c, this);
712  return newElement;
713  }
714  if( c->getDeg() == this->data->getDeg() ) { // same degree than the first list element
715  if(1 != pLmCmp(u1,ppMult_qq(this->data->getT1(), this->data->getLp1Term()))) {
716  //pWrite(u1);
717  //Print("Multi-Term in CritPairs Sortierung altes Element: ");
718  //pWrite(ppMult_qq(this->data->getT1(),this->data->getLp1Term()));
719  CNode* newElement = new CNode(c, this);
720  return newElement;
721  }
722  else {
723  //Print("Insert Deg\n");
724  CNode* temp = this;
725  while( NULL != temp->next) {
726  if(temp->next->data->getDeg() == c->getDeg() ) {
727  if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) {
728  temp = temp->next;
729  }
730  else {
731  CNode* newElement = new CNode(c, temp->next);
732  temp->next = newElement;
733  return this;
734  }
735  }
736  else {
737  CNode* newElement = new CNode(c, temp->next);
738  temp->next = newElement;
739  return this;
740  }
741  }
742  CNode* newElement = new CNode(c, NULL);
743  temp->next = newElement;
744  return this;
745  }
746  } // outer if-clause
747  if( c->getDeg() > this->data->getDeg() ) { // greater degree than the first list element
748  CNode* temp = this;
749  while( NULL != temp->next ) {
750  if( c->getDeg() < temp->next->data->getDeg() ) {
751  CNode* newElement = new CNode(c, temp->next);
752  temp->next = newElement;
753  return this;
754  }
755  if( c->getDeg() == temp->next->data->getDeg() ) {
756  if(1 != pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),temp->next->data->getLp1Term()))) {
757  CNode* newElement = new CNode(c, temp->next);
758  temp->next = newElement;
759  return this;
760  }
761  else {
762  temp = temp->next;
763  while( NULL != temp->next ) {
764  if( temp->next->data->getDeg() == c->getDeg() ) {
765  if(1 == pLmCmp(u1,ppMult_qq(temp->next->data->getT1(),
766  temp->next->data->getLp1Term()))) {
767  temp = temp->next;
768  }
769  else {
770  CNode* newElement = new CNode(c, temp->next);
771  temp->next = newElement;
772  return this;
773  }
774  }
775  else {
776  CNode* newElement = new CNode(c, temp->next);
777  temp->next = newElement;
778  return this;
779  }
780  }
781  CNode* newElement = new CNode(c, NULL);
782  temp->next = newElement;
783  return this;
784  }
785  }
786  if( c->getDeg() > temp->next->data->getDeg() ) {
787  temp = temp->next;
788  }
789  }
790  CNode* newElement = new CNode(c, NULL);
791  temp->next = newElement;
792  return this;
793  }
794  }
795 }
796 
797 
799  CNode* newElement = new CNode(cp);
800  newElement->next = this;
801  return newElement;
802 }
803 
804 
805 // get the first elements from CListOld which by the above sorting have minimal degree
807  CNode* temp = this;
808  while(NULL != temp) {
809  while(NULL != temp->next && temp->next->data->getDeg() == this->data->getDeg()) {
810  temp = temp->next;
811  }
812  CNode* returnCNode = temp->next;
813  // every CListOld should end with a (NULL,NULL) element for a similar behaviour
814  // using termination conditions throughout the algorithm
815  temp->next = NULL;
816  return returnCNode;
817  }
818  return NULL;
819 }
820 
822  return data;
823 }
824 
826  return next;
827 }
828 
830  return this->data->getAdLp1();
831 }
832 
834  return this->data->getAdLp2();
835 }
836 
838  return this->data->getLp1Poly();
839 }
840 
842  return this->data->getLp2Poly();
843 }
844 
846  return this->data->getLp1Term();
847 }
848 
850  return this->data->getLp2Term();
851 }
852 
854  return this->data->getLp1Index();
855 }
856 
858  return this->data->getLp2Index();
859 }
860 
862  return this->data->getT1();
863 }
864 
866  return this->data->getAdT1();
867 }
868 
870  return this->data->getT2();
871 }
872 
874  return this->data->getAdT2();
875 }
876 
878  return data->getDel();
879 }
880 
882  return this->data->getTestedRuleOld();
883 }
884 
885 // for debugging
887 {
888  CNode* temp = this;
889  PrintS("___________________List of critical pairs______________________:\n");
890  while(NULL != temp)
891  {
892  pWrite(ppMult_qq(temp->getT1(),temp->getLp1Term()));
893  Print("LP1 Index: %d\n",temp->getLp1Index());
894  PrintS("T1: ");
895  pWrite(temp->getT1());
896  Print("%p\n",temp->getT1());
897  PrintS("LP1 Term: ");
898  pWrite(temp->getLp1Term());
899  PrintS("LP1 Poly: ");
900  pWrite(temp->getLp1Poly());
901  Print("LP2 Index: %d\n",temp->getLp2Index());
902  PrintS("T2: ");
903  pWrite(temp->getT2());
904  Print("%p\n",temp->getT2());
905  PrintS("LP2 Term: ");
906  pWrite(temp->getLp2Term());
907  PrintS("LP2 Poly: ");
908  pWrite(temp->getLp2Poly());
909  PrintLn();
910  temp = temp->next;
911  }
912 }
913 
914 /*
915 ====================================
916 functions working on the class CListOld
917 ====================================
918 */
919 // for initialization of CListOlds, last element alwas has data=NULL and next=NULL
921  first = NULL;
922 }
923 
925  first = new CNode(c);
926 }
927 
929  CNode* temp;
930  while(NULL != first) {
931  temp = first;
932  first = first->getNext();
933  delete temp;
934  }
935 }
936 
937 // insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
938 // note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
940  first = first->insert(c);
941 }
942 
945 }
946 
948  return first;
949 }
950 
951 // get the first elements from CListOld which by the above sorting have minimal degree
952 // returns the pointer on the first element of those
954  CNode* temp = first;
955  first = first->getMinDeg();
956  return temp;
957 }
958 
960  first->print();
961 }
962 
963 /*
964 ====================================
965 functions working on the class RNode
966 ====================================
967 */
969  //Print("HIER RNODE CONSTRUCTOR\n");
970  data = NULL;
971  next = NULL;
972 }
973 
975  data = r;
976  next = NULL;
977 }
978 
980  //Print("DELETE RuleOld\n");
981  delete data;
982 }
983 
985  RNode* newElement = new RNode(r);
986  newElement->next = this;
987  return newElement;
988 }
989 
991  //Print("IN INSERT: ");
992  //pWrite(t);
993  RuleOld* r = new RuleOld(i,t);
994  //Print("ADDRESS OF RuleOld: %p\n",r);
995  RNode* newElement = new RNode(r);
996  //Print("ADDRESS OF RNODE: %p\n",newElement);
997  //Print("ADDRESS OF RNODE DATA: %p\n",newElement->getRuleOld());
998  newElement->next = this;
999  return newElement;
1000 }
1001 
1002 
1004  RNode* newElement = new RNode(r);
1005  RNode* temp = this;
1006  if(NULL == temp) {
1007  newElement->next = temp;
1008  return newElement;
1009  }
1010  if(1 == pLmCmp(newElement->getRuleOldTerm(),temp->getRuleOldTerm())) {
1011  newElement->next = temp;
1012  return newElement;
1013  }
1014  else {
1015  while(NULL != temp && 1 == pLmCmp(temp->getRuleOldTerm(),newElement->getRuleOldTerm())) {
1016  temp = temp->getNext();
1017  }
1018  newElement->next = temp;
1019  return this;
1020  }
1021 }
1022 
1023 
1025  return next;
1026 }
1027 
1029  return data;
1030 }
1031 
1033  return data->getIndex();
1034 }
1035 
1037  return data->getTerm();
1038 }
1039 
1041  RNode* temp = this;
1042  while(NULL != temp) {
1043  pWrite(temp->getRuleOldTerm());
1044  Print("%d\n\n",temp->getRuleOldIndex());
1045  temp = temp->getNext();
1046  }
1047 }
1048 
1049 /*
1050 ====================================
1051 functions working on the class RList
1052 ====================================
1053 */
1055  first = NULL;
1056 }
1057 
1059  first = new RNode(r);
1060 }
1061 
1063  RNode* temp;
1064  //Print("%p\n",first);
1065  while(first) {
1066  temp = first;
1067  first = first->getNext();
1068  //Print("1 %p\n",first);
1069  //if(first) {
1070  //Print("1' %p\n",first->getRuleOld());
1071  //Print("2 %p\n",first->getNext());
1072  //Print("3 %p\n",first->getNext()->getRuleOld());
1073  //Print("3 %p\n",first->getNext()->getRuleOldTerm());
1074  //}
1075  delete temp;
1076  }
1077  //Print("FERTIG\n");
1078 }
1079 
1080 void RList::insert(int i, poly t) {
1081  first = first->insert(i,t);
1082 }
1083 
1085  first = first->insert(r);
1086 }
1087 
1089  first = first->insertOrdered(r);
1090 }
1091 
1093  return first;
1094 }
1095 
1097  return this->getRuleOld();
1098 }
1099 
1101  first->print();
1102 }
1103 
1104 /*
1105 =======================================
1106 functions working on the class RTagNode
1107 =======================================
1108 */
1109 
1111  data = NULL;
1112  next = NULL;
1113 }
1114 
1116  data = r;
1117  next = NULL;
1118 }
1119 
1121 
1122  data = r;
1123  next = n;
1124 }
1125 
1127  delete data;
1128 }
1129 
1130 // declaration with first as parameter due to sorting of RTagList
1132  //Print("Hier1\n");
1133  RTagNode* newElement = new RTagNode(r, this);
1134  //Print("Hier2\n");
1135  return newElement;
1136 }
1137 
1139  //Print("%p\n", this);
1140  //Print("%p\n",this->data);
1141  return this->data;
1142 }
1143 
1145  return next;
1146 }
1147 
1148 // NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
1149 // Thus given actual index i and idx being the index of the LPolyOld under investigation
1150 // the element on position length-idx+1 is the right one
1151 RNode* RTagNode::get(int idx, int length) {
1152  if(idx==1 || idx==0) {
1153  // NOTE: We set this NULL as putting it the last element in the list, i.e. the element having
1154  // RNode* = NULL would cost lots of iterations at each step of F5inc, with increasing
1155  // length of the list this should be prevented
1156  return NULL;
1157  }
1158  else {
1159  int j;
1160  RTagNode* temp = this;
1161  //Print("\n\nHIER IN GET IDX\n");
1162  //Print("FOR LOOP: %d\n",length-idx+1);
1163  for(j=1; j<=length-idx+1; j++) {
1164  temp = temp->next;
1165  }
1166  return temp->data;
1167  }
1168 }
1169 
1171  this->data = r;
1172 }
1173 
1174 
1176  RTagNode* temp = this;
1177  if(NULL != temp && NULL != temp->getRNode()) {
1178  Print("1. element: %d, ",getRNode()->getRuleOld()->getIndex());
1179  pWrite(getRNode()->getRuleOld()->getTerm());
1180  temp = temp->next;
1181  int i = 2;
1182  while(NULL != temp->getRNode() && NULL != temp) {
1183  Print("%d. element: %d, ",i,getRNode()->getRuleOld()->getIndex());
1184  pWrite(getRNode()->getRuleOld()->getTerm());
1185  temp = temp->next;
1186  i++;
1187  }
1188  }
1189 }
1190 
1191 /*
1192 =======================================
1193 functions working on the class LTagList
1194 =======================================
1195 */
1196 
1198  RTagNode* first = new RTagNode();
1199  length = 0;
1200 }
1201 
1203  RTagNode* first = new RTagNode(r);
1204  length = 1;
1205 }
1206 
1208  RTagNode* temp;
1209  while(first) {
1210  temp = first;
1211  first = first->getNext();
1212  delete temp;
1213  }
1214 }
1215 
1216 // declaration with first as parameter in LTagNode due to sorting of LTagList
1218  first = first->insert(r);
1219  //Print("LENGTH:%d\n",length);
1220  length = length +1;
1221  //Print("LENGTH:%d\n",length);
1222 }
1223 
1225  return first->getRNode();
1226 }
1227 
1229  return first->get(idx, length);
1230 }
1231 
1233  first->set(r);
1234 }
1235 
1237  first->print();
1238 }
1239 
1241  return length;
1242 }
1243 #endif
PNode(poly p, PNode *n)
functions working on the class PNode
Definition: f5lists.cc:26
#define ppMult_qq(p, q)
Definition: polys.h:191
RNode * getFirst()
Definition: f5lists.cc:1224
LNode * insertFirst(LNode *l)
Definition: f5lists.cc:266
RTagNode * insert(RNode *r)
Definition: f5lists.cc:1131
poly getTerm()
Definition: f5data.h:256
int getLp2Index()
Definition: f5data.h:210
bool check(poly p)
Definition: f5lists.cc:94
LNode * getNext()
Definition: f5lists.cc:322
LNode()
Definition: f5lists.cc:130
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
poly getT2()
Definition: f5lists.cc:869
LList()
Definition: f5lists.cc:430
class PNode of nodes of polynomials
Definition: f5lists.h:36
void insert(LNode *l)
Definition: f5lists.cc:629
CNode * insert(CPairOld *c)
Definition: f5lists.cc:703
long getDeg()
Definition: f5data.h:162
LList * getCompleted()
Definition: f5lists.cc:666
~RList()
Definition: f5lists.cc:1062
~CNode()
Definition: f5lists.cc:695
void insert(LPolyOld *lp)
Definition: f5lists.cc:458
CNode * first
Definition: f5lists.h:271
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:528
return P p
Definition: myNF.cc:203
CNode()
Definition: f5lists.cc:680
CPairOld * getData()
Definition: f5lists.cc:821
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 * getAdT1()
Definition: f5data.h:170
poly getTerm()
Definition: f5lists.cc:336
poly getT1()
Definition: f5data.h:166
LNode * last
Definition: f5lists.h:130
poly * getAdT2()
Definition: f5lists.cc:873
RuleOld * getRuleOld()
Definition: f5lists.cc:344
static poly getTerm(const ideal H, const mark ab)
poly getT1()
Definition: f5lists.cc:861
int getIndex()
Definition: f5data.h:94
LNode * next
Definition: f5lists.h:68
structure of RuleOlds(i.e.
Definition: f5data.h:232
void setFirstCurrentIdx(LNode *l)
Definition: f5lists.cc:634
int getIndex()
Definition: f5data.h:252
LList * _toDo
Definition: f5lists.h:218
void setIndex(int i)
Definition: f5lists.cc:365
RNode * get(int idx)
Definition: f5lists.cc:1228
void setFirst(RNode *r)
Definition: f5lists.cc:1232
LList * getToDo()
Definition: f5lists.cc:670
int count(LNode *l)
Definition: f5lists.cc:543
void pWrite(poly p)
Definition: polys.h:290
void setTerm(poly t)
Definition: f5data.h:68
LPolyOld * getAdLp2()
Definition: f5data.h:186
poly getLp1Term()
Definition: f5lists.cc:845
RTagList()
Definition: f5lists.cc:1197
int length
Definition: f5lists.h:364
~RTagList()
Definition: f5lists.cc:1207
poly getPoly()
Definition: f5lists.cc:332
void insert(RNode *r)
Definition: f5lists.cc:1217
void setIndex(int i)
Definition: f5data.h:74
RNode()
Definition: f5lists.cc:968
LTagNode * first
Definition: f5lists.h:190
int getLp1Index()
Definition: f5data.h:206
void print()
Definition: f5lists.cc:886
LNode * getFirst()
Definition: f5lists.cc:642
RTagNode * first
Definition: f5lists.h:363
poly getPoly()
Definition: f5data.h:86
void setTerm(poly t)
Definition: f5lists.cc:361
void print()
Definition: f5lists.cc:539
LNode * get(int idx)
Definition: f5lists.cc:638
void print()
Definition: f5lists.cc:959
void print()
Definition: f5lists.cc:1236
CNode * getMinDeg()
Definition: f5lists.cc:953
RNode * getNext()
Definition: f5lists.cc:1024
poly getLp1Poly()
Definition: f5lists.cc:837
~RNode()
Definition: f5lists.cc:979
poly getLp2Poly()
Definition: f5lists.cc:841
RuleOld * getTestedRuleOld()
Definition: f5lists.cc:881
RTagNode * next
Definition: f5lists.h:340
LTagNode * getNext()
Definition: f5lists.cc:580
LNode * first
Definition: f5lists.h:129
LPolyOld * getAdLp1()
Definition: f5data.h:182
RNode * get(int idx, int length)
Definition: f5lists.cc:1151
const ring r
Definition: syzextra.cc:208
poly * getAdT2()
Definition: f5data.h:174
RNode * first
Definition: f5lists.h:315
int getLp1Index()
Definition: f5lists.cc:853
Definition: f5lists.h:65
~LNode()
Definition: f5lists.cc:162
Definition: f5lists.h:232
RuleOld * getRuleOld()
Definition: f5lists.cc:1096
int length
Definition: f5lists.h:192
int j
Definition: myNF.cc:70
LNode * getFirstCurrentIdx()
Definition: f5lists.cc:646
RNode * insert(RuleOld *r)
Definition: f5lists.cc:984
poly getTerm()
Definition: f5data.h:90
poly getRuleOldTerm()
Definition: f5lists.cc:1036
RTagNode * getNext()
Definition: f5lists.cc:1144
RuleOld * getRuleOld()
Definition: f5lists.cc:1028
int count(LNode *l)
Definition: f5lists.cc:409
class of labeled polynomials
Definition: f5data.h:28
void setPoly(poly p)
Definition: f5data.h:62
bool polyTest(poly *p)
Definition: f5lists.cc:378
CListOld()
Definition: f5lists.cc:920
LPolyOld * getLPolyOld()
Definition: f5lists.cc:327
int getRuleOldIndex()
Definition: f5lists.cc:1032
~LList()
Definition: f5lists.cc:447
void insertFirst(LNode *l)
Definition: f5lists.cc:500
RList()
Definition: f5lists.cc:1054
LPolyOld * getAdLp2()
Definition: f5lists.cc:833
LTagNode * next
Definition: f5lists.h:169
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
PNode * getNext()
Definition: f5lists.cc:35
void deleteAll()
Definition: f5lists.cc:168
#define pOne()
Definition: polys.h:297
PNode * first
Definition: f5lists.h:52
RNode * insertOrdered(RuleOld *r)
Definition: f5lists.cc:1003
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:939
LList * _completed
Definition: f5lists.h:217
LTagNode * insert(LNode *l)
Definition: f5lists.cc:571
int length
Definition: f5lists.h:131
void setDel(bool d)
Definition: f5lists.cc:373
RTagNode()
Definition: f5lists.cc:1110
~RTagNode()
Definition: f5lists.cc:1126
bool polyTest(poly *p)
Definition: f5lists.cc:516
int getLength()
Definition: f5lists.cc:1240
void print()
Definition: f5lists.cc:1175
LNode * getLNode()
Definition: f5lists.cc:576
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
bool getDel()
Definition: f5data.h:102
Definition: f5lists.h:127
void setRuleOld(RuleOld *r)
Definition: f5data.h:78
PNode * insert(poly p)
Definition: f5lists.cc:38
~CListOld()
Definition: f5lists.cc:928
LNode * insert(LPolyOld *lp)
Definition: f5lists.cc:179
CNode * getNext()
Definition: f5lists.cc:825
CNode * insertWithoutSort(CPairOld *cp)
Definition: f5lists.cc:798
void insert(RuleOld *r)
Definition: f5lists.cc:1084
bool getDel()
Definition: f5lists.cc:877
void insertByLabel(poly t, int i, poly p, RuleOld *r=NULL)
Definition: f5lists.cc:494
void print()
Definition: f5lists.cc:1040
CNode * getMinDeg()
Definition: f5lists.cc:806
void print()
Definition: f5lists.cc:394
void deleteByDeg()
Definition: f5lists.cc:512
poly * getAdT1()
Definition: f5lists.cc:865
poly getLp2Term()
Definition: f5data.h:202
PList()
functions working on the class PList
Definition: f5lists.cc:76
LTagNode()
Definition: f5lists.cc:551
poly getLp1Term()
Definition: f5data.h:198
poly getT2()
Definition: f5data.h:178
bool getDel()
Definition: f5data.h:214
void insertWithoutSort(CPairOld *c)
Definition: f5lists.cc:943
RNode * next
Definition: f5lists.h:293
void setFirst(LNode *l)
Definition: f5lists.cc:532
int getLp2Index()
Definition: f5lists.cc:857
TopRed()
Definition: f5lists.cc:656
LPolyOld * getAdLp1()
Definition: f5lists.cc:829
poly getLp2Term()
Definition: f5lists.cc:849
polyrec * poly
Definition: hilb.h:10
LNode * get(int i, int length)
Definition: f5lists.cc:587
Definition: f5lists.h:290
int getIndex()
Definition: f5lists.cc:340
LNode * getFirst()
Definition: f5lists.cc:520
RuleOld * getRuleOld()
Definition: f5data.h:98
LNode * firstCurrentIdx
Definition: f5lists.h:191
poly getLp1Poly()
Definition: f5data.h:190
LNode * deleteByDeg()
Definition: f5lists.cc:317
void print()
Definition: f5lists.cc:115
void print()
Definition: f5lists.cc:1100
void setDel(bool d)
Definition: f5data.h:82
RuleOld * data
Definition: f5lists.h:292
poly getLp2Poly()
Definition: f5data.h:194
RNode * getFirst()
Definition: f5lists.cc:1092
void insertSP(LPolyOld *lp)
Definition: f5lists.cc:481
void setRuleOld(RuleOld *r)
Definition: f5lists.cc:348
~LTagList()
Definition: f5lists.cc:618
#define pLmEqual(p1, p2)
Definition: polys.h:111
void insertOrdered(RuleOld *r)
Definition: f5lists.cc:1088
RuleOld * getTestedRuleOld()
Definition: f5data.h:218
LTagList()
Definition: f5lists.cc:607
int l
Definition: cfEzgcd.cc:94
~LTagNode()
Definition: f5lists.cc:566
void set(RNode *)
Definition: f5lists.cc:1170
LNode * getLast()
Definition: f5lists.cc:524
CNode * getFirst()
Definition: f5lists.cc:947
RNode * getRNode()
Definition: f5lists.cc:1138
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
LNode * data
Definition: f5lists.h:168
structure of labeled critical pairs
Definition: f5data.h:123