source: git/kernel/f5lists.h @ 1534d9

spielwiese
Last change on this file since 1534d9 was 7c81165, checked in by Christian Eder, 15 years ago
updated list of critical pairs, thrown away some useless data git-svn-id: file:///usr/local/Singular/svn/trunk@11555 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.2 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: f5lists.h,v 1.15 2009-03-12 09:43:53 ederc Exp $ */
5/*
6* ABSTRACT: list interface
7*/
8#include "f5data.h"
9#ifndef F5LISTS_HEADER
10#define F5LISTS_HEADER
11
12#ifdef HAVE_F5
13/*
14============================
15============================
16classes for lists used in F5
17============================
18============================
19*/
20class LNode;
21class LList;
22class LTagNode;
23class LTagList;
24class CNode;
25class CList;
26class RList;
27class RNode;
28class RTagNode;
29class RTagList;
30
31
32/*
33=======================================
34class LNode (nodes for lists of LPolys)
35=======================================
36*/
37class LNode {
38    private:
39        LPoly*  data;
40        LNode*  next;
41    public:
42        // generating new list elements from the labeled / classical polynomial view
43                LNode();
44                LNode(LPoly* lp);
45                LNode(LPoly* lp, LNode* l);
46                LNode(poly t, int i, poly p, Rule* r=NULL);
47                LNode(poly t, int i, poly p, Rule* r, LNode* l);
48                LNode(LNode* ln);
49                ~LNode();
50        void    deleteAll();
51        // insert new elements to the list at the end from the labeled / classical polynomial view
52        // needed for gPrev
53        LNode*  insert(LPoly* lp);
54        LNode*  insert(poly t, int i, poly p, Rule* r);
55        // insert new elements to the list in front from the labeled / classical polynomial view
56        // needed for sPolyList
57        LNode*  insertSP(LPoly* lp);
58        LNode*  insertSP(poly t, int i, poly p, Rule* r);
59        // insert new elements to the list with resp. to increasing labels
60        // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
61        LNode*  insertByLabel(poly t, int i, poly p, Rule* r);
62        // deletes the first elements of the list with the same degree
63        // get next & prev from current LNode
64        LNode*  getNext();
65        LNode*  getPrev();
66        // only used for the S-polys, which are already sorted by increasing degree by CList
67        LNode*  deleteByDeg();
68        // get the LPoly* out of LNode*
69        LPoly*  getLPoly();
70        // get the data from the LPoly saved in LNode
71        poly    getPoly();
72        poly    getTerm();
73        int     getIndex(); 
74        Rule*   getRule();
75        // set the data from the LPoly saved in LNode
76        void    setPoly(poly p);
77        void    setTerm(poly t);
78        void    setIndex(int i);
79        void    setNext(LNode* l);
80        // test if for any list element the polynomial part of the data is equal to *p
81        bool    polyTest(poly* p);
82        LNode*  getNext(LNode* l);
83        void    print();
84};
85
86
87/*
88============================
89class LList(lists of LPolys)
90============================
91*/
92class LList {
93    private:
94        LNode*  first;
95        LNode*  last;
96        int     length;
97    public:
98                LList();
99                LList(LPoly* lp);
100                LList(poly t,int i,poly p, Rule* r = NULL);
101                ~LList();
102        // insertion at the end of the list
103        // needed for gPrev
104        void    insert(LPoly* lp);
105        void    insert(poly t,int i, poly p, Rule* r = NULL);
106         // insertion in front of the list
107        // needed for sPolyList
108        void    insertSP(LPoly* lp);
109        void    insertSP(poly t,int i, poly p, Rule* r = NULL);
110        void    insertByLabel(poly t, int i, poly p, Rule* r = NULL);
111        void    insertByLabel(LNode* l);
112        void    deleteByDeg();
113        bool    polyTest(poly* p);
114        LNode*  getFirst();
115        LNode*  getLast();
116        int     getLength();
117        void    setFirst(LNode* l);
118        void    print();
119};
120
121
122
123/*
124==============================================
125class LtagNode (nodes for lists of LPoly tags)
126==============================================
127*/
128class LTagNode {
129    private:
130        LNode*      data;
131        LTagNode*   next;
132    public:
133        LTagNode();
134        LTagNode(LNode* l);
135        LTagNode(LNode* l, LTagNode* n);
136        ~LTagNode();
137        // declaration with first as parameter due to sorting of LTagList
138        LTagNode*   insert(LNode* l);
139        LNode*      getLNode();
140        LTagNode*   getNext();
141        LNode*      get(int i, int length);
142};
143
144
145/*
146=========================================================================
147class LTagList(lists of LPoly tags, i.e. first elements of a given index)
148=========================================================================
149*/
150class LTagList {
151    private:
152        LTagNode*   first;
153        LNode*      firstCurrentIdx;
154        int         length;
155    public:
156                LTagList();
157                LTagList(LNode* l);
158                ~LTagList();
159        // declaration with first as parameter in LTagNode due to sorting of LTagList
160        void    insert(LNode* l);
161        void    setFirstCurrentIdx(LNode* l);
162        LNode*  get(int idx);
163        LNode*  getFirst();
164        LNode*  getFirstCurrentIdx();
165};
166
167LNode*  getGPrevRedCheck();
168LNode*  getcompletedRedCheck();
169
170
171/*
172======================================================================================
173class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements
174             of the lists LList* completed & LList* sPolyList
175======================================================================================
176*/
177class TopRed {
178    private:
179        LList*  _completed;
180        LList*  _toDo;
181    public:
182                TopRed();
183                TopRed(LList* c, LList* t);
184        LList*  getCompleted();
185        LList*  getToDo();
186};
187
188
189/*
190=======================================
191class CNode (nodes for lists of CPairs)
192=======================================
193*/
194class CNode {
195    private:
196        CPair* data;
197        CNode* next;
198    public:
199                CNode();
200                CNode(CPair* c);
201                CNode(CPair* c, CNode* n);
202                ~CNode(); 
203        CNode*  insert(CPair* c); 
204        CNode*  getMinDeg();
205        CPair*  getData();
206        CNode*  getNext();
207        LPoly*  getAdLp1();
208        LPoly*  getAdLp2();
209        poly    getLp1Poly();
210        poly    getLp2Poly();
211        poly    getLp1Term();
212        poly    getLp2Term();
213        poly    getT1(); 
214        poly*   getAdT1(); 
215        poly    getT2(); 
216        poly*   getAdT2(); 
217        int     getLp1Index();
218        int     getLp2Index();
219        Rule*   getTestedRule();
220        void    print();
221};
222
223
224/*
225============================
226class CList(lists of CPairs)
227============================
228*/
229class CList {
230    private:
231        CNode*  first;
232    public:
233                // for initialization of CLists, last element alwas has data=NULL and next=NULL
234                CList(); 
235                CList(CPair* c); 
236                ~CList(); 
237        CNode*  getFirst();
238        void    insert(CPair* c);
239        CNode*  getMinDeg();
240        void    print();
241};
242
243
244/*
245======================================
246class RNode (nodes for lists of Rules)
247======================================
248*/
249class RNode {
250    private:
251        Rule*   data;
252        RNode*  next;
253    public:
254                RNode();
255                RNode(Rule* r);
256                ~RNode();
257        RNode*  insert(Rule* r);
258        RNode*  insert(int i, poly t);
259        RNode*  getNext();
260        Rule*   getRule();
261        int     getRuleIndex();
262        poly    getRuleTerm();
263};
264
265/*
266============================
267class RList (lists of Rules)
268============================
269*/
270class RList {
271    private:
272        RNode*  first;
273        // last alway has data=NULL and next=NULL, for initialization purposes used
274        RNode*  last;
275    public:
276                RList();
277                RList(Rule* r);
278                ~RList();
279        void    insert(Rule* r);
280        void    insert(int i, poly t);
281        RNode*  getFirst();
282        Rule*   getRule();
283};
284
285
286
287/*
288=============================================
289class RtagNode (nodes for lists of Rule tags)
290=============================================
291*/
292class RTagNode {
293    private:
294        RNode*      data;
295        RTagNode*   next;
296    public:
297                    RTagNode();
298                    RTagNode(RNode* r);
299                    RTagNode(RNode* r, RTagNode* n);
300                    ~RTagNode();
301        // declaration with first as parameter due to sorting of LTagList
302        RTagNode*   insert(RNode* r);
303        RNode*      getRNode();
304        RTagNode*   getNext();
305        RNode*      get(int idx, int length);
306        void        set(RNode*);
307        void        print();
308};
309
310
311/*
312========================================================================
313class RTagList(lists of Rule tags, i.e. first elements of a given index)
314========================================================================
315*/
316class RTagList {
317    private:
318        RTagNode*   first;
319        int         length;
320    public:
321                RTagList();
322                RTagList(RNode* r);
323                ~RTagList();
324        // declaration with first as parameter in LTagNode due to sorting of LTagList
325        void    insert(RNode* r);
326        RNode*  getFirst();
327        RNode*  get(int idx);
328        void    setFirst(RNode* r);
329        void    print();
330        int     getLength();
331};
332#endif
333#endif
Note: See TracBrowser for help on using the repository browser.