My Project
Loading...
Searching...
No Matches
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 "kernel/polys.h"
11#include "kernel/ideals.h"
14#include "polys/kbuckets.h"
15#include "polys/weight.h"
16#include "misc/intvec.h"
17#include "kernel/polys.h"
21
22/**
23 * functions working on the class PNode
24 */
25PNode::PNode(poly p, PNode* n) {
26 data = p;
27 next = n;
28}
29
31 return this->data;
32}
33
35 return this->next;
36}
38 poly q = pOne();
39 q = pCopy(p);
40 PNode* temp = this;
41 if(NULL == temp) {
42 PNode* pn = new PNode(q,temp);
43 return pn;
44 }
45 if(1 == pLmCmp(q,temp->getPoly())) {
46 PNode* pn = new PNode(q,temp);
47 return pn;
48 }
49 if(0 == pLmCmp(q,temp->getPoly())) {
50 return this;
51 }
52 if(-1 == pLmCmp(q,temp->getPoly())) {
53 while(NULL != temp->getNext() && -1 == pLmCmp(q,temp->getNext()->getPoly())) {
54 temp = temp->getNext();
55 }
56 if(NULL == temp->getNext() || 1 == pLmCmp(q,temp->getNext()->getPoly())) {
57 PNode* pn = new PNode(q,temp->getNext());
58 temp->next = pn;
59 return this;
60 }
61 if(0 == pLmCmp(q,temp->getNext()->getPoly())) {
62 return this;
63 }
64 }
65}
66/*
67PNode* PNode::insert(poly p) {
68 PNode* pn = new PNode(p,this);
69 return pn;
70}
71*/
72/**
73 * functions working on the class PList
74 */
76 first = NULL;
77}
78
79
80void PList::insert(poly p) {
81 first = first->insert(p);
82}
83
84
85/*
86PNode* PList::insert(poly p) {
87 PNode* temp = first;
88 PNode* pn = new PNode(p,temp);
89 first = pn;
90 return first;
91}
92*/
93bool PList::check(poly p) {
94 PNode* temp = first;
95 //Print("\nCHECK: \n");
96 //pWrite(p);
97 //Print("-----\n");
98 while(NULL != temp) {
99 //pWrite(temp->getPoly());
100 //pWrite(p);
101 //Print("COMPARE: %d\n",pLmEqual(p,temp->getPoly()));
102 if(1 == pLmEqual(p,temp->getPoly())) {
103 //Print("YES!\n");
104 //pWrite(pHead(temp->getPoly()));
105 //Print("YES!\n");
106 return 1;
107 }
108 temp = temp->getNext();
109 }
110 //Print("NOTHING!\n");
111 return 0;
112}
113
115 Print("-----LIST-----\n");
116 PNode* temp = first;
117 while(NULL != temp) {
118 pWrite(temp->getPoly());
119 temp = temp->getNext();
120 }
121}
122/*
123====================================
124functions working on the class LNode
125====================================
126*/
127
128// generating new list elements (labeled / classical polynomial / LNode view)
130 data = NULL;
131 next = NULL;
132}
134 data = lp;
135 next = NULL;
136}
137
139//Print("HIER LNODE\n");
140 data = lp;
141 next = l;
142}
143
144LNode::LNode(poly t, int i, poly p, RuleOld* r) {
145LPolyOld* lp = new LPolyOld(t,i,p,r);
146data = lp;
147next = NULL;
148}
149
150LNode::LNode(poly t, int i, poly p, RuleOld* r, LNode* l) {
151 LPolyOld* lp = new LPolyOld(t,i,p,r);
152 data = lp;
153 next = l;
154}
155
157 data = ln->getLPolyOld();
158 next = ln->getNext();
159}
160
162 //delete next;
163 //Print("DELETE LNODE\n");
164 delete data;
165}
166
168 while(NULL != next) {
169 //Print("%p\n",next);
170 //pWrite(next->data->getPoly());
171 next->deleteAll();
172 }
173 delete data;
174}
175
176// insert new elements to the list always at the end (labeled / classical polynomial view)
177// needed for list gPrev
179 //Print("LAST GPREV: ");
180 //pWrite(this->getPoly());
181 if(NULL == this) {
182 LNode* newElement = new LNode(lp,this);
183 return newElement;
184 }
185 else {
186 LNode* newElement = new LNode(lp, NULL);
187 this->next = newElement;
188 return newElement;
189 }
190}
191
192inline LNode* LNode::insert(poly t, int i, poly p, RuleOld* r) {
193 if(NULL == this) {
194 LNode* newElement = new LNode(t,i,p,r,this);
195 return newElement;
196 }
197 else {
198 LNode* newElement = new LNode(t, i, p, r, NULL);
199 this->next = newElement;
200 return newElement;
201 }
202}
203
204// insert new elements to the list always in front (labeled / classical polynomial view)
205// needed for sPolyList
207 LNode* newElement = new LNode(lp, this);
208 //Print("INSERTED IN SPOLYLIST: ");
209 //pWrite(lp->getTerm());
210 return newElement;
211}
212
213inline LNode* LNode::insertSP(poly t, int i, poly p, RuleOld* r) {
214 LNode* newElement = new LNode(t, i, p, r, this);
215 //Print("INSERTED IN SPOLYLIST: ");
216 //pWrite(t);
217return newElement;
218}
219// insert new elements to the list w.r.t. increasing labels
220// only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
221inline LNode* LNode::insertByLabel(poly t, int i, poly p, RuleOld* r) {
222 //Print("ADDING SOLYS TO THE LIST\n");
223 //Print("new element: ");
224 //pWrite(t);
225 if(NULL == this) { // || NULL == data) {
226 LNode* newElement = new LNode(t, i, p, r, this);
227 return newElement;
228 }
229 else {
230 //Print("tested element1: ");
231 //pWrite(this->getTerm());
232 if(-1 == pLmCmp(t,this->getTerm())) {
233 //Print("HIERDRIN\n");
234 LNode* newElement = new LNode(t, i, p, r, this);
235 //Print("%p\n",this);
236 //Print("%p\n",newElement->next);
237 return newElement;
238 }
239 else {
240 LNode* temp = this;
241 while(NULL != temp->next && NULL != temp->next->data) {
242 //Print("tested element: ");
243 //pWrite(temp->getTerm());
244 if(-1 == pLmCmp(t,temp->next->getTerm())) {
245 LNode* newElement = new LNode(t, i, p, r, temp->next);
246 temp->next = newElement;
247 return this;
248 }
249 else {
250 temp = temp->next;
251 //Print("%p\n",temp);
252 //Print("%p\n",temp->data);
253
254 //Print("%p\n",temp->next);
255 }
256 }
257 //Print("HIER\n");
258 LNode* newElement = new LNode(t, i, p, r, temp->next);
259 temp->next = newElement;
260 return this;
261 }
262 }
263}
264
266 l->next = this;
267 return l;
268}
269
271 //Print("ADDING SOLYS TO THE LIST\n");
272 //Print("new element: ");
273 //pWrite(t);
274 if(NULL == this) { // || NULL == data) {
275 l->next = this;
276 return l;
277 }
278 else {
279 //Print("tested element1: ");
280 //pWrite(this->getTerm());
281 if(-1 == pLmCmp(l->getTerm(),this->getTerm())) {
282 //Print("HIERDRIN\n");
283 l->next = this;
284 //Print("%p\n",this);
285 //Print("%p\n",newElement->next);
286 return l;
287 }
288 else {
289 LNode* temp = this;
290 while(NULL != temp->next && NULL != temp->next->data) {
291 //Print("tested element: ");
292 //pWrite(temp->getTerm());
293 if(-1 == pLmCmp(l->getTerm(),temp->next->getTerm())) {
294 l->next = temp->next;
295 temp->next = l;
296 return this;
297 }
298 else {
299 temp = temp->next;
300 //Print("%p\n",temp);
301 //Print("%p\n",temp->data);
302
303 //Print("%p\n",temp->next);
304 }
305 }
306 //Print("HIER\n");
307 l->next = temp->next;
308 temp->next = l;
309 return this;
310 }
311 }
312}
313
314// deletes the first elements of the list with the same degree
315// only used for the S-polys, which are already sorted by increasing degree by CListOld
317 return this;
318}
319
320// get next from current LNode
322 return next;
323}
324
325// get the LPolyOld* out of LNode*
327 return data;
328}
329
330// get the data from the LPolyOld saved in LNode
332 return data->getPoly();
333}
334
336 return data->getTerm();
337}
338
340 return data->getIndex();
341}
342
344 return data->getRuleOld();
345}
346
348 return data->setRuleOld(r);
349}
350
352 return data->getDel();
353}
354
355// set the data from the LPolyOld saved in LNode
356void LNode::setPoly(poly p) {
357 data->setPoly(p);
358}
359
360void LNode::setTerm(poly t) {
361 data->setTerm(t);
362}
363
365 data->setIndex(i);
366}
367
369 next = l;
370}
371
372void LNode::setDel(bool d) {
373 data->setDel(d);
374}
375
376// test if for any list element the polynomial part of the data is equal to *p
377bool LNode::polyTest(poly* p) {
378 LNode* temp = new LNode(this);
379 while(NULL != temp) {
380 if(pComparePolys(temp->getPoly(),*p)) {
381 return 1;
382 }
383 temp = temp->next;
384 }
385 return 0;
386}
387
389 return l->next;
390}
391
392// for debugging
394{
395 LNode* temp = this;
396 PrintS("___________________List of S-polynomials______________________:\n");
397 while(NULL != temp && NULL != temp->data) {
398 Print("Index: %d\n",temp->getIndex());
399 PrintS("Term: ");
400 pWrite(temp->getTerm());
401 PrintS("Poly: ");
402 pWrite(temp->getPoly());
403 temp = temp->next;
404 }
405 PrintS("_______________________________________________________________\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====================================
425functions 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
440LList::LList(poly t,int i,poly p,RuleOld* r) {
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
470void 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
486void 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
493void LList::insertByLabel(poly t, int i, poly p, RuleOld* r) {
494 first = first->insertByLabel(t,i,p,r);
495 length++;
496 //Print("LENGTH %d\n",length);
497}
498
501 length++;
502 //Print("LENGTH %d\n",length);
503}
504
507 length++;
508 //Print("LENGTH %d\n",length);
509}
510
513}
514
515bool LList::polyTest(poly* p) {
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
539 first->print();
540}
541
543 return first->count(l);
544}
545/*
546=======================================
547functions 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
586LNode* 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=======================================
603functions 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
635}
636
638 return first->get(idx, length);
639}
640
642 return first->getLNode();
643}
644
646 return firstCurrentIdx;
647}
648
649/*
650=====================================
651functions working on the class TopRed
652=====================================
653*/
654
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====================================
675functions 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
886{
887 CNode* temp = this;
888 PrintS("___________________List of critical pairs______________________:\n");
889 while(NULL != temp)
890 {
891 pWrite(ppMult_qq(temp->getT1(),temp->getLp1Term()));
892 Print("LP1 Index: %d\n",temp->getLp1Index());
893 PrintS("T1: ");
894 pWrite(temp->getT1());
895 Print("%p\n",temp->getT1());
896 PrintS("LP1 Term: ");
897 pWrite(temp->getLp1Term());
898 PrintS("LP1 Poly: ");
899 pWrite(temp->getLp1Poly());
900 Print("LP2 Index: %d\n",temp->getLp2Index());
901 PrintS("T2: ");
902 pWrite(temp->getT2());
903 Print("%p\n",temp->getT2());
904 PrintS("LP2 Term: ");
905 pWrite(temp->getLp2Term());
906 PrintS("LP2 Poly: ");
907 pWrite(temp->getLp2Poly());
908 PrintLn();
909 temp = temp->next;
910 }
911}
912
913/*
914====================================
915functions working on the class CListOld
916====================================
917*/
918// for initialization of CListOlds, last element always has data=NULL and next=NULL
920 first = NULL;
921}
922
924 first = new CNode(c);
925}
926
928 CNode* temp;
929 while(NULL != first) {
930 temp = first;
931 first = first->getNext();
932 delete temp;
933 }
934}
935
936// insert sorts the critical pairs firstly by increasing total degree, secondly by increasing label
937// note: as all critical pairs have the same index here, the second sort is done on the terms of the labels
939 first = first->insert(c);
940}
941
944}
945
947 return first;
948}
949
950// get the first elements from CListOld which by the above sorting have minimal degree
951// returns the pointer on the first element of those
953 CNode* temp = first;
954 first = first->getMinDeg();
955 return temp;
956}
957
959 first->print();
960}
961
962/*
963====================================
964functions working on the class RNode
965====================================
966*/
968 //Print("HIER RNODE CONSTRUCTOR\n");
969 data = NULL;
970 next = NULL;
971}
972
974 data = r;
975 next = NULL;
976}
977
979 //Print("DELETE RuleOld\n");
980 delete data;
981}
982
984 RNode* newElement = new RNode(r);
985 newElement->next = this;
986 return newElement;
987}
988
989RNode* RNode::insert(int i, poly t) {
990 //Print("IN INSERT: ");
991 //pWrite(t);
992 RuleOld* r = new RuleOld(i,t);
993 //Print("ADDRESS OF RuleOld: %p\n",r);
994 RNode* newElement = new RNode(r);
995 //Print("ADDRESS OF RNODE: %p\n",newElement);
996 //Print("ADDRESS OF RNODE DATA: %p\n",newElement->getRuleOld());
997 newElement->next = this;
998 return newElement;
999}
1000
1001
1003 RNode* newElement = new RNode(r);
1004 RNode* temp = this;
1005 if(NULL == temp) {
1006 newElement->next = temp;
1007 return newElement;
1008 }
1009 if(1 == pLmCmp(newElement->getRuleOldTerm(),temp->getRuleOldTerm())) {
1010 newElement->next = temp;
1011 return newElement;
1012 }
1013 else {
1014 while(NULL != temp && 1 == pLmCmp(temp->getRuleOldTerm(),newElement->getRuleOldTerm())) {
1015 temp = temp->getNext();
1016 }
1017 newElement->next = temp;
1018 return this;
1019 }
1020}
1021
1022
1024 return next;
1025}
1026
1028 return data;
1029}
1030
1032 return data->getIndex();
1033}
1034
1036 return data->getTerm();
1037}
1038
1040 RNode* temp = this;
1041 while(NULL != temp) {
1042 pWrite(temp->getRuleOldTerm());
1043 Print("%d\n\n",temp->getRuleOldIndex());
1044 temp = temp->getNext();
1045 }
1046}
1047
1048/*
1049====================================
1050functions working on the class RList
1051====================================
1052*/
1054 first = NULL;
1055}
1056
1058 first = new RNode(r);
1059}
1060
1062 RNode* temp;
1063 //Print("%p\n",first);
1064 while(first) {
1065 temp = first;
1066 first = first->getNext();
1067 //Print("1 %p\n",first);
1068 //if(first) {
1069 //Print("1' %p\n",first->getRuleOld());
1070 //Print("2 %p\n",first->getNext());
1071 //Print("3 %p\n",first->getNext()->getRuleOld());
1072 //Print("3 %p\n",first->getNext()->getRuleOldTerm());
1073 //}
1074 delete temp;
1075 }
1076 //Print("FERTIG\n");
1077}
1078
1079void RList::insert(int i, poly t) {
1080 first = first->insert(i,t);
1081}
1082
1084 first = first->insert(r);
1085}
1086
1089}
1090
1092 return first;
1093}
1094
1096 return this->getRuleOld();
1097}
1098
1100 first->print();
1101}
1102
1103/*
1104=======================================
1105functions working on the class RTagNode
1106=======================================
1107*/
1108
1110 data = NULL;
1111 next = NULL;
1112}
1113
1115 data = r;
1116 next = NULL;
1117}
1118
1120
1121 data = r;
1122 next = n;
1123}
1124
1126 delete data;
1127}
1128
1129// declaration with first as parameter due to sorting of RTagList
1131 //Print("Hier1\n");
1132 RTagNode* newElement = new RTagNode(r, this);
1133 //Print("Hier2\n");
1134 return newElement;
1135}
1136
1138 //Print("%p\n", this);
1139 //Print("%p\n",this->data);
1140 return this->data;
1141}
1142
1144 return next;
1145}
1146
1147// NOTE: We insert at the beginning of the list and length = i-1, where i is the actual index.
1148// Thus given actual index i and idx being the index of the LPolyOld under investigation
1149// the element on position length-idx+1 is the right one
1151 if(idx==1 || idx==0) {
1152 // NOTE: We set this NULL as putting it the last element in the list, i.e. the element having
1153 // RNode* = NULL would cost lots of iterations at each step of F5inc, with increasing
1154 // length of the list this should be prevented
1155 return NULL;
1156 }
1157 else {
1158 int j;
1159 RTagNode* temp = this;
1160 //Print("\n\nHIER IN GET IDX\n");
1161 //Print("FOR LOOP: %d\n",length-idx+1);
1162 for(j=1; j<=length-idx+1; j++) {
1163 temp = temp->next;
1164 }
1165 return temp->data;
1166 }
1167}
1168
1170 this->data = r;
1171}
1172
1173
1175 RTagNode* temp = this;
1176 if(NULL != temp && NULL != temp->getRNode()) {
1177 Print("1. element: %d, ",getRNode()->getRuleOld()->getIndex());
1178 pWrite(getRNode()->getRuleOld()->getTerm());
1179 temp = temp->next;
1180 int i = 2;
1181 while(NULL != temp->getRNode() && NULL != temp) {
1182 Print("%d. element: %d, ",i,getRNode()->getRuleOld()->getIndex());
1183 pWrite(getRNode()->getRuleOld()->getTerm());
1184 temp = temp->next;
1185 i++;
1186 }
1187 }
1188}
1189
1190/*
1191=======================================
1192functions working on the class LTagList
1193=======================================
1194*/
1195
1197 RTagNode* first = new RTagNode();
1198 length = 0;
1199}
1200
1202 RTagNode* first = new RTagNode(r);
1203 length = 1;
1204}
1205
1207 RTagNode* temp;
1208 while(first) {
1209 temp = first;
1210 first = first->getNext();
1211 delete temp;
1212 }
1213}
1214
1215// declaration with first as parameter in LTagNode due to sorting of LTagList
1217 first = first->insert(r);
1218 //Print("LENGTH:%d\n",length);
1219 length = length +1;
1220 //Print("LENGTH:%d\n",length);
1221}
1222
1224 return first->getRNode();
1225}
1226
1228 return first->get(idx, length);
1229}
1230
1232 first->set(r);
1233}
1234
1236 first->print();
1237}
1238
1240 return length;
1241}
1242#endif
int l
Definition: cfEzgcd.cc:100
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
CNode * getMinDeg()
Definition: f5lists.cc:952
void insert(CPairOld *c)
Definition: f5lists.cc:938
~CListOld()
Definition: f5lists.cc:927
void insertWithoutSort(CPairOld *c)
Definition: f5lists.cc:942
CNode * getFirst()
Definition: f5lists.cc:946
void print()
Definition: f5lists.cc:958
CListOld()
Definition: f5lists.cc:919
CNode * first
Definition: f5lists.h:271
Definition: f5lists.h:232
CNode * getMinDeg()
Definition: f5lists.cc:805
LPolyOld * getAdLp2()
Definition: f5lists.cc:832
CPairOld * getData()
Definition: f5lists.cc:820
LPolyOld * getAdLp1()
Definition: f5lists.cc:828
poly getT1()
Definition: f5lists.cc:860
bool getDel()
Definition: f5lists.cc:876
poly getLp2Poly()
Definition: f5lists.cc:840
int getLp2Index()
Definition: f5lists.cc:856
RuleOld * getTestedRuleOld()
Definition: f5lists.cc:880
poly getLp1Term()
Definition: f5lists.cc:844
poly getT2()
Definition: f5lists.cc:868
void print()
Definition: f5lists.cc:885
CNode()
Definition: f5lists.cc:679
CNode * insert(CPairOld *c)
Definition: f5lists.cc:702
CNode * getNext()
Definition: f5lists.cc:824
CPairOld * data
Definition: f5lists.h:234
poly getLp2Term()
Definition: f5lists.cc:848
poly * getAdT2()
Definition: f5lists.cc:872
int getLp1Index()
Definition: f5lists.cc:852
CNode * insertWithoutSort(CPairOld *cp)
Definition: f5lists.cc:797
~CNode()
Definition: f5lists.cc:694
poly * getAdT1()
Definition: f5lists.cc:864
poly getLp1Poly()
Definition: f5lists.cc:836
CNode * next
Definition: f5lists.h:235
bool getDel()
Definition: f5data.h:214
poly getLp2Poly()
Definition: f5data.h:194
poly getLp1Poly()
Definition: f5data.h:190
LPolyOld * getAdLp1()
Definition: f5data.h:182
long getDeg()
Definition: f5data.h:162
LPolyOld * getAdLp2()
Definition: f5data.h:186
poly * getAdT2()
Definition: f5data.h:174
poly getLp2Term()
Definition: f5data.h:202
int getLp1Index()
Definition: f5data.h:206
int getLp2Index()
Definition: f5data.h:210
poly getLp1Term()
Definition: f5data.h:198
poly * getAdT1()
Definition: f5data.h:170
RuleOld * getTestedRuleOld()
Definition: f5data.h:218
poly getT1()
Definition: f5data.h:166
poly getT2()
Definition: f5data.h:178
Definition: f5lists.h:127
int count(LNode *l)
Definition: f5lists.cc:542
LNode * last
Definition: f5lists.h:130
LNode * getFirst()
Definition: f5lists.cc:519
void insert(LPolyOld *lp)
Definition: f5lists.cc:457
~LList()
Definition: f5lists.cc:446
int length
Definition: f5lists.h:131
void insertFirst(LNode *l)
Definition: f5lists.cc:499
LList()
Definition: f5lists.cc:429
int getLength()
Definition: f5lists.cc:527
bool polyTest(poly *p)
Definition: f5lists.cc:515
void setFirst(LNode *l)
Definition: f5lists.cc:531
void deleteByDeg()
Definition: f5lists.cc:511
void print()
Definition: f5lists.cc:538
void insertByLabel(poly t, int i, poly p, RuleOld *r=NULL)
Definition: f5lists.cc:493
void insertSP(LPolyOld *lp)
Definition: f5lists.cc:480
LNode * getLast()
Definition: f5lists.cc:523
LNode * first
Definition: f5lists.h:129
Definition: f5lists.h:65
void deleteAll()
Definition: f5lists.cc:167
LNode * insertFirst(LNode *l)
Definition: f5lists.cc:265
LNode * next
Definition: f5lists.h:68
void setTerm(poly t)
Definition: f5lists.cc:360
LNode()
Definition: f5lists.cc:129
void setIndex(int i)
Definition: f5lists.cc:364
LNode * deleteByDeg()
Definition: f5lists.cc:316
LNode * insert(LPolyOld *lp)
Definition: f5lists.cc:178
LPolyOld * data
Definition: f5lists.h:67
int count(LNode *l)
Definition: f5lists.cc:408
LNode * getNext()
Definition: f5lists.cc:321
int getIndex()
Definition: f5lists.cc:339
RuleOld * getRuleOld()
Definition: f5lists.cc:343
~LNode()
Definition: f5lists.cc:161
poly getPoly()
Definition: f5lists.cc:331
void setPoly(poly p)
Definition: f5lists.cc:356
LNode * insertSP(LPolyOld *lp)
Definition: f5lists.cc:206
void setDel(bool d)
Definition: f5lists.cc:372
void setNext(LNode *l)
Definition: f5lists.cc:368
LNode * insertByLabel(poly t, int i, poly p, RuleOld *r)
Definition: f5lists.cc:221
bool polyTest(poly *p)
Definition: f5lists.cc:377
bool getDel()
Definition: f5lists.cc:351
void setRuleOld(RuleOld *r)
Definition: f5lists.cc:347
LPolyOld * getLPolyOld()
Definition: f5lists.cc:326
void print()
Definition: f5lists.cc:393
poly getTerm()
Definition: f5lists.cc:335
poly getTerm()
Definition: f5data.h:90
void setIndex(int i)
Definition: f5data.h:74
RuleOld * getRuleOld()
Definition: f5data.h:98
poly getPoly()
Definition: f5data.h:86
void setRuleOld(RuleOld *r)
Definition: f5data.h:78
void setPoly(poly p)
Definition: f5data.h:62
bool getDel()
Definition: f5data.h:102
void setDel(bool d)
Definition: f5data.h:82
int getIndex()
Definition: f5data.h:94
void setTerm(poly t)
Definition: f5data.h:68
LTagNode * first
Definition: f5lists.h:190
~LTagList()
Definition: f5lists.cc:617
LTagList()
Definition: f5lists.cc:606
void setFirstCurrentIdx(LNode *l)
Definition: f5lists.cc:633
LNode * firstCurrentIdx
Definition: f5lists.h:191
LNode * getFirstCurrentIdx()
Definition: f5lists.cc:645
void insert(LNode *l)
Definition: f5lists.cc:628
LNode * getFirst()
Definition: f5lists.cc:641
int length
Definition: f5lists.h:192
LNode * get(int idx)
Definition: f5lists.cc:637
LNode * get(int i, int length)
Definition: f5lists.cc:586
LTagNode()
Definition: f5lists.cc:550
LNode * data
Definition: f5lists.h:168
~LTagNode()
Definition: f5lists.cc:565
LTagNode * next
Definition: f5lists.h:169
LTagNode * insert(LNode *l)
Definition: f5lists.cc:570
LTagNode * getNext()
Definition: f5lists.cc:579
LNode * getLNode()
Definition: f5lists.cc:575
bool check(poly p)
Definition: f5lists.cc:93
void print()
Definition: f5lists.cc:114
PList()
functions working on the class PList
Definition: f5lists.cc:75
PNode * first
Definition: f5lists.h:52
void insert(poly p)
Definition: f5lists.cc:80
class PNode of nodes of polynomials
Definition: f5lists.h:36
PNode * getNext()
Definition: f5lists.cc:34
PNode * insert(poly p)
Definition: f5lists.cc:37
poly data
Definition: f5lists.h:38
PNode(poly p, PNode *n)
functions working on the class PNode
Definition: f5lists.cc:25
poly getPoly()
Definition: f5lists.cc:30
PNode * next
Definition: f5lists.h:39
~RList()
Definition: f5lists.cc:1061
RuleOld * getRuleOld()
Definition: f5lists.cc:1095
void print()
Definition: f5lists.cc:1099
RNode * getFirst()
Definition: f5lists.cc:1091
RNode * first
Definition: f5lists.h:315
RList()
Definition: f5lists.cc:1053
void insert(RuleOld *r)
Definition: f5lists.cc:1083
void insertOrdered(RuleOld *r)
Definition: f5lists.cc:1087
Definition: f5lists.h:290
poly getRuleOldTerm()
Definition: f5lists.cc:1035
RNode * next
Definition: f5lists.h:293
void print()
Definition: f5lists.cc:1039
RNode * insertOrdered(RuleOld *r)
Definition: f5lists.cc:1002
RuleOld * data
Definition: f5lists.h:292
RNode()
Definition: f5lists.cc:967
RNode * insert(RuleOld *r)
Definition: f5lists.cc:983
RNode * getNext()
Definition: f5lists.cc:1023
~RNode()
Definition: f5lists.cc:978
int getRuleOldIndex()
Definition: f5lists.cc:1031
RuleOld * getRuleOld()
Definition: f5lists.cc:1027
int length
Definition: f5lists.h:364
RNode * getFirst()
Definition: f5lists.cc:1223
RTagNode * first
Definition: f5lists.h:363
int getLength()
Definition: f5lists.cc:1239
~RTagList()
Definition: f5lists.cc:1206
void setFirst(RNode *r)
Definition: f5lists.cc:1231
RTagList()
Definition: f5lists.cc:1196
void insert(RNode *r)
Definition: f5lists.cc:1216
void print()
Definition: f5lists.cc:1235
RNode * get(int idx)
Definition: f5lists.cc:1227
RTagNode * next
Definition: f5lists.h:340
RNode * getRNode()
Definition: f5lists.cc:1137
RNode * data
Definition: f5lists.h:339
~RTagNode()
Definition: f5lists.cc:1125
RTagNode()
Definition: f5lists.cc:1109
void set(RNode *)
Definition: f5lists.cc:1169
RTagNode * getNext()
Definition: f5lists.cc:1143
RTagNode * insert(RNode *r)
Definition: f5lists.cc:1130
void print()
Definition: f5lists.cc:1174
RNode * get(int idx, int length)
Definition: f5lists.cc:1150
poly getTerm()
Definition: f5data.h:256
int getIndex()
Definition: f5data.h:252
LList * getCompleted()
Definition: f5lists.cc:665
LList * _toDo
Definition: f5lists.h:218
LList * _completed
Definition: f5lists.h:217
TopRed()
Definition: f5lists.cc:655
LList * getToDo()
Definition: f5lists.cc:669
#define Print
Definition: emacs.cc:80
int j
Definition: facHensel.cc:110
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
#define NULL
Definition: omList.c:12
Compatibility layer for legacy polynomial operations (over currRing)
#define pLmEqual(p1, p2)
Definition: polys.h:111
#define ppMult_qq(p, q)
Definition: polys.h:208
void pWrite(poly p)
Definition: polys.h:308
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
#define pOne()
Definition: polys.h:315
static poly getTerm(const ideal H, const mark ab)
void PrintS(const char *s)
Definition: reporter.cc:284
void PrintLn()
Definition: reporter.cc:310