My Project  UNKNOWN_GIT_VERSION
f5lists.h
Go to the documentation of this file.
1 #ifndef F5LISTS_HEADER
2 #define F5LISTS_HEADER
3 /****************************************
4 * Computer Algebra System SINGULAR *
5 ****************************************/
6 /*
7 * ABSTRACT: list interface
8 */
10 
11 #ifdef HAVE_F5
12 /*
13 ============================
14 ============================
15 classes for lists used in F5
16 ============================
17 ============================
18 */
19 class PNode;
20 class PList;
21 class LNode;
22 class LList;
23 class LTagNode;
24 class LTagList;
25 class CNode;
26 class CListOld;
27 class RList;
28 class RNode;
29 class RTagNode;
30 class RTagList;
31 
32 
33 /**
34  * class PNode of nodes of polynomials
35  */
36 class PNode {
37  private:
38  poly data;
40  public:
41  PNode(poly p, PNode* n);
42  poly getPoly();
43  PNode* getNext();
44  PNode* insert(poly p);
45 };
46 
47 /**
48  * class PList of lists of PNodes
49  */
50 class PList {
51  private:
53  public:
54  PList();
55  void insert(poly p);
56  bool check(poly p);
57  void print();
58 };
59 
60 /*
61 =======================================
62 class LNode (nodes for lists of LPolyOlds)
63 =======================================
64 */
65 class LNode {
66  private:
69  public:
70  // generating new list elements from the labeled / classical polynomial view
71  LNode();
72  LNode(LPolyOld* lp);
73  LNode(LPolyOld* lp, LNode* l);
74  LNode(poly t, int i, poly p, RuleOld* r=NULL);
75  LNode(poly t, int i, poly p, RuleOld* r, LNode* l);
76  LNode(LNode* ln);
77  ~LNode();
78  void deleteAll();
79  // insert new elements to the list at the end from the labeled / classical polynomial view
80  // needed for gPrev
81  LNode* insert(LPolyOld* lp);
82  LNode* insert(poly t, int i, poly p, RuleOld* r);
84  // insert new elements to the list in front from the labeled / classical polynomial view
85  // needed for sPolyList
86  LNode* insertSP(LPolyOld* lp);
87  LNode* insertSP(poly t, int i, poly p, RuleOld* r);
88  // insert new elements to the list with resp. to increasing labels
89  // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
90  LNode* insertByLabel(poly t, int i, poly p, RuleOld* r);
93  // deletes the first elements of the list with the same degree
94  // get next & prev from current LNode
95  LNode* getNext();
96  LNode* getPrev();
97  // only used for the S-polys, which are already sorted by increasing degree by CListOld
98  LNode* deleteByDeg();
99  // get the LPolyOld* out of LNode*
101  // get the data from the LPolyOld saved in LNode
102  poly getPoly();
103  poly getTerm();
104  int getIndex();
105  RuleOld* getRuleOld();
106  bool getDel();
107  // set the data from the LPolyOld saved in LNode
108  void setPoly(poly p);
109  void setTerm(poly t);
110  void setIndex(int i);
111  void setNext(LNode* l);
112  void setRuleOld(RuleOld* r);
113  void setDel(bool d);
114  // test if for any list element the polynomial part of the data is equal to *p
115  bool polyTest(poly* p);
116  LNode* getNext(LNode* l);
117  void print();
118  int count(LNode* l);
119 };
120 
121 
122 /*
123 ============================
124 class LList(lists of LPolyOlds)
125 ============================
126 */
127 class LList {
128  private:
131  int length;
132  public:
133  LList();
134  LList(LPolyOld* lp);
135  LList(poly t,int i,poly p, RuleOld* r = NULL);
136  ~LList();
137  // insertion at the end of the list
138  // needed for gPrev
139  void insert(LPolyOld* lp);
140  void insert(poly t,int i, poly p, RuleOld* r = NULL);
141  void insertByDeg(LPolyOld* lp);
142  // insertion in front of the list
143  // needed for sPolyList
144  void insertSP(LPolyOld* lp);
145  void insertSP(poly t,int i, poly p, RuleOld* r = NULL);
146  void insertByLabel(poly t, int i, poly p, RuleOld* r = NULL);
147  void insertByLabel(LNode* l);
148  void insertFirst(LNode* l);
149  void deleteByDeg();
150  bool polyTest(poly* p);
151  LNode* getFirst();
152  LNode* getLast();
153  int getLength();
154  void setFirst(LNode* l);
155  void print();
156  int count(LNode* l);
157 };
158 
159 
160 
161 /*
162 ==============================================
163 class LtagNode (nodes for lists of LPolyOld tags)
164 ==============================================
165 */
166 class LTagNode {
167  private:
170  public:
171  LTagNode();
172  LTagNode(LNode* l);
173  LTagNode(LNode* l, LTagNode* n);
174  ~LTagNode();
175  // declaration with first as parameter due to sorting of LTagList
176  LTagNode* insert(LNode* l);
177  LNode* getLNode();
178  LTagNode* getNext();
179  LNode* get(int i, int length);
180 };
181 
182 
183 /*
184 =========================================================================
185 class LTagList(lists of LPolyOld tags, i.e. first elements of a given index)
186 =========================================================================
187 */
188 class LTagList {
189  private:
192  int length;
193  public:
194  LTagList();
195  LTagList(LNode* l);
196  ~LTagList();
197  // declaration with first as parameter in LTagNode due to sorting of LTagList
198  void insert(LNode* l);
199  void setFirstCurrentIdx(LNode* l);
200  LNode* get(int idx);
201  LNode* getFirst();
203 };
204 
207 
208 
209 /*
210 ======================================================================================
211 class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements
212  of the lists LList* completed & LList* sPolyList
213 ======================================================================================
214 */
215 class TopRed {
216  private:
219  public:
220  TopRed();
221  TopRed(LList* c, LList* t);
222  LList* getCompleted();
223  LList* getToDo();
224 };
225 
226 
227 /*
228 =======================================
229 class CNode (nodes for lists of CPairOlds)
230 =======================================
231 */
232 class CNode {
233  private:
236  public:
237  CNode();
238  CNode(CPairOld* c);
239  CNode(CPairOld* c, CNode* n);
240  ~CNode();
241  CNode* insert(CPairOld* c);
243  CNode* getMinDeg();
244  CPairOld* getData();
245  CNode* getNext();
246  LPolyOld* getAdLp1();
247  LPolyOld* getAdLp2();
248  poly getLp1Poly();
249  poly getLp2Poly();
250  poly getLp1Term();
251  poly getLp2Term();
252  poly getT1();
253  poly* getAdT1();
254  poly getT2();
255  poly* getAdT2();
256  int getLp1Index();
257  int getLp2Index();
258  bool getDel();
260  void print();
261 };
262 
263 
264 /*
265 ============================
266 class CListOld(lists of CPairOlds)
267 ============================
268 */
269 class CListOld {
270  private:
272  public:
273  // for initialization of CListOlds, last element alwas has data=NULL and next=NULL
274  CListOld();
275  CListOld(CPairOld* c);
276  ~CListOld();
277  CNode* getFirst();
278  void insert(CPairOld* c);
279  void insertWithoutSort(CPairOld* c);
280  CNode* getMinDeg();
281  void print();
282 };
283 
284 
285 /*
286 ======================================
287 class RNode (nodes for lists of RuleOlds)
288 ======================================
289 */
290 class RNode {
291  private:
294  public:
295  RNode();
296  RNode(RuleOld* r);
297  ~RNode();
298  RNode* insert(RuleOld* r);
299  RNode* insert(int i, poly t);
301  RNode* getNext();
302  RuleOld* getRuleOld();
303  int getRuleOldIndex();
304  poly getRuleOldTerm();
305  void print();
306 };
307 
308 /*
309 ============================
310 class RList (lists of RuleOlds)
311 ============================
312 */
313 class RList {
314  private:
316  // last alway has data=NULL and next=NULL, for initialization purposes used
318  public:
319  RList();
320  RList(RuleOld* r);
321  ~RList();
322  void insert(RuleOld* r);
323  void insert(int i, poly t);
324  void insertOrdered(RuleOld* r);
325  RNode* getFirst();
326  RuleOld* getRuleOld();
327  void print();
328 };
329 
330 
331 
332 /*
333 =============================================
334 class RtagNode (nodes for lists of RuleOld tags)
335 =============================================
336 */
337 class RTagNode {
338  private:
341  public:
342  RTagNode();
343  RTagNode(RNode* r);
344  RTagNode(RNode* r, RTagNode* n);
345  ~RTagNode();
346  // declaration with first as parameter due to sorting of LTagList
347  RTagNode* insert(RNode* r);
348  RNode* getRNode();
349  RTagNode* getNext();
350  RNode* get(int idx, int length);
351  void set(RNode*);
352  void print();
353 };
354 
355 
356 /*
357 ========================================================================
358 class RTagList(lists of RuleOld tags, i.e. first elements of a given index)
359 ========================================================================
360 */
361 class RTagList {
362  private:
364  int length;
365  public:
366  RTagList();
367  RTagList(RNode* r);
368  ~RTagList();
369  // declaration with first as parameter in LTagNode due to sorting of LTagList
370  void insert(RNode* r);
371  RNode* getFirst();
372  RNode* get(int idx);
373  void setFirst(RNode* r);
374  void print();
375  int getLength();
376 };
377 #endif
378 #endif
LTagList::getFirst
LNode * getFirst()
Definition: f5lists.cc:642
RList::insertOrdered
void insertOrdered(RuleOld *r)
Definition: f5lists.cc:1088
CNode::getData
CPairOld * getData()
Definition: f5lists.cc:821
RTagNode::insert
RTagNode * insert(RNode *r)
Definition: f5lists.cc:1131
RTagNode::get
RNode * get(int idx, int length)
Definition: f5lists.cc:1151
RTagList::length
int length
Definition: f5lists.h:364
LTagList
Definition: f5lists.h:188
LTagList::firstCurrentIdx
LNode * firstCurrentIdx
Definition: f5lists.h:191
LNode::getRuleOld
RuleOld * getRuleOld()
Definition: f5lists.cc:344
LList
Definition: f5lists.h:127
CNode::getLp2Term
poly getLp2Term()
Definition: f5lists.cc:849
LNode::next
LNode * next
Definition: f5lists.h:68
LList::getFirst
LNode * getFirst()
Definition: f5lists.cc:520
PNode::PNode
PNode(poly p, PNode *n)
functions working on the class PNode
Definition: f5lists.cc:26
PList::print
void print()
Definition: f5lists.cc:115
RNode::data
RuleOld * data
Definition: f5lists.h:292
RuleOld
Definition: f5data.h:232
LList::insertSP
void insertSP(LPolyOld *lp)
Definition: f5lists.cc:481
LTagList::getFirstCurrentIdx
LNode * getFirstCurrentIdx()
Definition: f5lists.cc:646
LTagList::length
int length
Definition: f5lists.h:192
LList::setFirst
void setFirst(LNode *l)
Definition: f5lists.cc:532
RList::getFirst
RNode * getFirst()
Definition: f5lists.cc:1092
CListOld::print
void print()
Definition: f5lists.cc:959
PList::check
bool check(poly p)
Definition: f5lists.cc:94
LNode::setTerm
void setTerm(poly t)
Definition: f5lists.cc:361
LNode::getPoly
poly getPoly()
Definition: f5lists.cc:332
CNode::insert
CNode * insert(CPairOld *c)
Definition: f5lists.cc:703
LTagNode::insert
LTagNode * insert(LNode *l)
Definition: f5lists.cc:571
PList::insert
void insert(poly p)
Definition: f5lists.cc:81
CNode::CNode
CNode()
Definition: f5lists.cc:680
LList::getLast
LNode * getLast()
Definition: f5lists.cc:524
length
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
LTagList::LTagList
LTagList()
Definition: f5lists.cc:607
PNode::data
poly data
Definition: f5lists.h:38
RNode::~RNode
~RNode()
Definition: f5lists.cc:979
CNode::getAdT2
poly * getAdT2()
Definition: f5lists.cc:873
CNode::getT1
poly getT1()
Definition: f5lists.cc:861
LList::first
LNode * first
Definition: f5lists.h:129
RTagNode::~RTagNode
~RTagNode()
Definition: f5lists.cc:1126
LTagNode::~LTagNode
~LTagNode()
Definition: f5lists.cc:566
RList::~RList
~RList()
Definition: f5lists.cc:1062
RTagList::~RTagList
~RTagList()
Definition: f5lists.cc:1207
CNode::print
void print()
Definition: f5lists.cc:886
LNode::getLPolyOld
LPolyOld * getLPolyOld()
Definition: f5lists.cc:327
LNode::~LNode
~LNode()
Definition: f5lists.cc:162
RList::getRuleOld
RuleOld * getRuleOld()
Definition: f5lists.cc:1096
RTagList::getFirst
RNode * getFirst()
Definition: f5lists.cc:1224
LNode::getTerm
poly getTerm()
Definition: f5lists.cc:336
RNode::getNext
RNode * getNext()
Definition: f5lists.cc:1024
LNode::LNode
LNode()
Definition: f5lists.cc:130
CNode::getLp2Poly
poly getLp2Poly()
Definition: f5lists.cc:841
LList::LList
LList()
Definition: f5lists.cc:430
LList::last
LNode * last
Definition: f5lists.h:130
RTagList::print
void print()
Definition: f5lists.cc:1236
RNode::RNode
RNode()
Definition: f5lists.cc:968
RTagNode::data
RNode * data
Definition: f5lists.h:339
CListOld::first
CNode * first
Definition: f5lists.h:271
LTagList::~LTagList
~LTagList()
Definition: f5lists.cc:618
i
int i
Definition: cfEzgcd.cc:125
LTagNode::get
LNode * get(int i, int length)
Definition: f5lists.cc:587
CNode::getLp1Index
int getLp1Index()
Definition: f5lists.cc:853
LNode::setPoly
void setPoly(poly p)
Definition: f5lists.cc:357
RNode
Definition: f5lists.h:290
LList::insertFirst
void insertFirst(LNode *l)
Definition: f5lists.cc:500
RTagNode::getNext
RTagNode * getNext()
Definition: f5lists.cc:1144
RNode::getRuleOldIndex
int getRuleOldIndex()
Definition: f5lists.cc:1032
CNode::getAdLp2
LPolyOld * getAdLp2()
Definition: f5lists.cc:833
LList::getLength
int getLength()
Definition: f5lists.cc:528
CNode::getLp1Poly
poly getLp1Poly()
Definition: f5lists.cc:837
LNode::setDel
void setDel(bool d)
Definition: f5lists.cc:373
LList::polyTest
bool polyTest(poly *p)
Definition: f5lists.cc:516
LNode::deleteAll
void deleteAll()
Definition: f5lists.cc:168
CNode::getTestedRuleOld
RuleOld * getTestedRuleOld()
Definition: f5lists.cc:881
CNode::getLp1Term
poly getLp1Term()
Definition: f5lists.cc:845
TopRed
Definition: f5lists.h:215
LTagNode::LTagNode
LTagNode()
Definition: f5lists.cc:551
LList::insertByDeg
void insertByDeg(LPolyOld *lp)
getGPrevRedCheck
LNode * getGPrevRedCheck()
RNode::insertOrdered
RNode * insertOrdered(RuleOld *r)
Definition: f5lists.cc:1003
RTagList::setFirst
void setFirst(RNode *r)
Definition: f5lists.cc:1232
LTagList::setFirstCurrentIdx
void setFirstCurrentIdx(LNode *l)
Definition: f5lists.cc:634
RTagList::first
RTagNode * first
Definition: f5lists.h:363
PNode::next
PNode * next
Definition: f5lists.h:39
LList::insertByLabel
void insertByLabel(poly t, int i, poly p, RuleOld *r=NULL)
Definition: f5lists.cc:494
RTagNode::set
void set(RNode *)
Definition: f5lists.cc:1170
RTagNode::next
RTagNode * next
Definition: f5lists.h:340
CListOld::CListOld
CListOld()
Definition: f5lists.cc:920
LTagList::first
LTagNode * first
Definition: f5lists.h:190
CPairOld
Definition: f5data.h:123
LList::count
int count(LNode *l)
Definition: f5lists.cc:543
RList::last
RNode * last
Definition: f5lists.h:317
RNode::getRuleOld
RuleOld * getRuleOld()
Definition: f5lists.cc:1028
PNode
class PNode of nodes of polynomials
Definition: f5lists.h:36
RTagList::insert
void insert(RNode *r)
Definition: f5lists.cc:1217
LNode::insert
LNode * insert(LPolyOld *lp)
Definition: f5lists.cc:179
LTagNode::getNext
LTagNode * getNext()
Definition: f5lists.cc:580
RTagList::getLength
int getLength()
Definition: f5lists.cc:1240
RTagList::RTagList
RTagList()
Definition: f5lists.cc:1197
RList::first
RNode * first
Definition: f5lists.h:315
CNode::getNext
CNode * getNext()
Definition: f5lists.cc:825
LList::deleteByDeg
void deleteByDeg()
Definition: f5lists.cc:512
f5data.h
CNode::getDel
bool getDel()
Definition: f5lists.cc:877
LNode::insertByDeg
LNode * insertByDeg(LPolyOld *lp)
RList::RList
RList()
Definition: f5lists.cc:1054
CListOld::getMinDeg
CNode * getMinDeg()
Definition: f5lists.cc:953
RNode::print
void print()
Definition: f5lists.cc:1040
LTagNode::next
LTagNode * next
Definition: f5lists.h:169
LList::print
void print()
Definition: f5lists.cc:539
LNode::getIndex
int getIndex()
Definition: f5lists.cc:340
PNode::getNext
PNode * getNext()
Definition: f5lists.cc:35
TopRed::_completed
LList * _completed
Definition: f5lists.h:217
RNode::insert
RNode * insert(RuleOld *r)
Definition: f5lists.cc:984
CNode::data
CPairOld * data
Definition: f5lists.h:234
RNode::getRuleOldTerm
poly getRuleOldTerm()
Definition: f5lists.cc:1036
LNode::count
int count(LNode *l)
Definition: f5lists.cc:409
PList::first
PNode * first
Definition: f5lists.h:52
TopRed::getCompleted
LList * getCompleted()
Definition: f5lists.cc:666
LNode::setRuleOld
void setRuleOld(RuleOld *r)
Definition: f5lists.cc:348
RList
Definition: f5lists.h:313
LTagList::insert
void insert(LNode *l)
Definition: f5lists.cc:629
CNode::getLp2Index
int getLp2Index()
Definition: f5lists.cc:857
getcompletedRedCheck
LNode * getcompletedRedCheck()
LTagNode::data
LNode * data
Definition: f5lists.h:168
CNode::getAdLp1
LPolyOld * getAdLp1()
Definition: f5lists.cc:829
CNode::getMinDeg
CNode * getMinDeg()
Definition: f5lists.cc:806
LNode
Definition: f5lists.h:65
CNode::getAdT1
poly * getAdT1()
Definition: f5lists.cc:865
TopRed::TopRed
TopRed()
Definition: f5lists.cc:656
RTagNode
Definition: f5lists.h:337
LNode::deleteByDeg
LNode * deleteByDeg()
Definition: f5lists.cc:317
LNode::data
LPolyOld * data
Definition: f5lists.h:67
TopRed::getToDo
LList * getToDo()
Definition: f5lists.cc:670
NULL
#define NULL
Definition: omList.c:10
LNode::insertFirst
LNode * insertFirst(LNode *l)
Definition: f5lists.cc:266
l
int l
Definition: cfEzgcd.cc:93
LNode::polyTest
bool polyTest(poly *p)
Definition: f5lists.cc:378
LNode::getNext
LNode * getNext()
Definition: f5lists.cc:322
CNode::next
CNode * next
Definition: f5lists.h:235
RNode::next
RNode * next
Definition: f5lists.h:293
PNode::insert
PNode * insert(poly p)
Definition: f5lists.cc:38
LList::length
int length
Definition: f5lists.h:131
LList::~LList
~LList()
Definition: f5lists.cc:447
p
int p
Definition: cfModGcd.cc:4019
RTagList::get
RNode * get(int idx)
Definition: f5lists.cc:1228
CListOld
Definition: f5lists.h:269
CListOld::getFirst
CNode * getFirst()
Definition: f5lists.cc:947
RTagNode::getRNode
RNode * getRNode()
Definition: f5lists.cc:1138
LTagNode
Definition: f5lists.h:166
RList::print
void print()
Definition: f5lists.cc:1100
RTagNode::print
void print()
Definition: f5lists.cc:1175
TopRed::_toDo
LList * _toDo
Definition: f5lists.h:218
LTagList::get
LNode * get(int idx)
Definition: f5lists.cc:638
CListOld::~CListOld
~CListOld()
Definition: f5lists.cc:928
PList
class PList of lists of PNodes
Definition: f5lists.h:50
CListOld::insertWithoutSort
void insertWithoutSort(CPairOld *c)
Definition: f5lists.cc:943
LNode::getDel
bool getDel()
Definition: f5lists.cc:352
LNode::insertSP
LNode * insertSP(LPolyOld *lp)
Definition: f5lists.cc:207
LTagNode::getLNode
LNode * getLNode()
Definition: f5lists.cc:576
LNode::setNext
void setNext(LNode *l)
Definition: f5lists.cc:369
CListOld::insert
void insert(CPairOld *c)
Definition: f5lists.cc:939
CNode::getT2
poly getT2()
Definition: f5lists.cc:869
CNode::insertWithoutSort
CNode * insertWithoutSort(CPairOld *cp)
Definition: f5lists.cc:798
RList::insert
void insert(RuleOld *r)
Definition: f5lists.cc:1084
RTagNode::RTagNode
RTagNode()
Definition: f5lists.cc:1110
RTagList
Definition: f5lists.h:361
LList::insert
void insert(LPolyOld *lp)
Definition: f5lists.cc:458
LNode::print
void print()
Definition: f5lists.cc:394
CNode::~CNode
~CNode()
Definition: f5lists.cc:695
CNode
Definition: f5lists.h:232
PList::PList
PList()
functions working on the class PList
Definition: f5lists.cc:76
LNode::getPrev
LNode * getPrev()
LPolyOld
Definition: f5data.h:28
PNode::getPoly
poly getPoly()
Definition: f5lists.cc:31
LNode::insertByLabel
LNode * insertByLabel(poly t, int i, poly p, RuleOld *r)
Definition: f5lists.cc:222
LNode::setIndex
void setIndex(int i)
Definition: f5lists.cc:365