source: git/kernel/f5lists.h @ 61944d0

spielwiese
Last change on this file since 61944d0 was 61944d0, checked in by Christian Eder, 15 years ago
solved problems in reduction() in topReduction() considering both criteria and computation of new polynomials git-svn-id: file:///usr/local/Singular/svn/trunk@11473 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.4 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: f5lists.h,v 1.12 2009-02-26 09:01:52 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        LNode*  gPrevRedCheck;
42    public:
43        // generating new list elements from the labeled / classical polynomial view
44                LNode();
45                LNode(LPoly* lp);
46                LNode(LPoly* lp, LNode* l);
47                LNode(poly t, int i, poly p, Rule* r=NULL, LNode* gPCheck=NULL);
48                LNode(poly t, int i, poly p, Rule* r, LNode* gPCheck, LNode* l);
49                LNode(LNode* ln);
50                ~LNode();
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        LNode*  getGPrevRedCheck();
76        // set the data from the LPoly saved in LNode
77        void    setPoly(poly p);
78        void    setTerm(poly t);
79        void    setIndex(int i);
80        void    setGPrevRedCheck(LNode* l);
81        void    setNext(LNode* l);
82        // test if for any list element the polynomial part of the data is equal to *p
83        bool    polyTest(poly* p);
84        LNode*  getNext(LNode* l);
85        void    print();
86};
87
88
89/*
90============================
91class LList(lists of LPolys)
92============================
93*/
94class LList {
95    private:
96        LNode*  first;
97        LNode*  last;
98        int     length;
99    public:
100                LList();
101                LList(LPoly* lp);
102                LList(poly t,int i,poly p, Rule* r = NULL);
103                ~LList();
104        // insertion at the end of the list
105        // needed for gPrev
106        void    insert(LPoly* lp);
107        void    insert(poly t,int i, poly p, Rule* r = NULL);
108         // insertion in front of the list
109        // needed for sPolyList
110        void    insertSP(LPoly* lp);
111        void    insertSP(poly t,int i, poly p, Rule* r = NULL);
112        void    insertByLabel(poly t, int i, poly p, Rule* r = NULL);
113        void    insertByLabel(LNode* l);
114        void    deleteByDeg();
115        bool    polyTest(poly* p);
116        LNode*  getFirst();
117        LNode*  getLast();
118        int     getLength();
119        void    setFirst(LNode* l);
120        void    print();
121};
122
123
124
125/*
126==============================================
127class LtagNode (nodes for lists of LPoly tags)
128==============================================
129*/
130class LTagNode {
131    private:
132        LNode*      data;
133        LTagNode*   next;
134    public:
135        LTagNode();
136        LTagNode(LNode* l);
137        LTagNode(LNode* l, LTagNode* n);
138        ~LTagNode();
139        // declaration with first as parameter due to sorting of LTagList
140        LTagNode*   insert(LNode* l);
141        LNode*      getLNode();
142        LTagNode*   getNext();
143        LNode*      get(int i, int length);
144};
145
146
147/*
148=========================================================================
149class LTagList(lists of LPoly tags, i.e. first elements of a given index)
150=========================================================================
151*/
152class LTagList {
153    private:
154        LTagNode*   first;
155        LNode*      firstCurrentIdx;
156        int         length;
157    public:
158                LTagList();
159                LTagList(LNode* l);
160                ~LTagList();
161        // declaration with first as parameter in LTagNode due to sorting of LTagList
162        void    insert(LNode* l);
163        void    setFirstCurrentIdx(LNode* l);
164        LNode*  get(int idx);
165        LNode*  getFirst();
166        LNode*  getFirstCurrentIdx();
167};
168
169LNode*  getGPrevRedCheck();
170LNode*  getcompletedRedCheck();
171
172
173/*
174======================================================================================
175class TopRed(return values of subalgorithm TopRed in f5gb.cc), i.e. the first elements
176             of the lists LList* completed & LList* sPolyList
177======================================================================================
178*/
179class TopRed {
180    private:
181        LList*  _completed;
182        LList*  _toDo;
183    public:
184                TopRed();
185                TopRed(LList* c, LList* t);
186        LList*  getCompleted();
187        LList*  getToDo();
188};
189
190
191/*
192=======================================
193class CNode (nodes for lists of CPairs)
194=======================================
195*/
196class CNode {
197    private:
198        CPair* data;
199        CNode* next;
200    public:
201                CNode();
202                CNode(CPair* c);
203                CNode(CPair* c, CNode* n);
204                ~CNode(); 
205        CNode*  insert(CPair* c, CNode* last); 
206        CNode*  getMinDeg();
207        CPair*  getData();
208        CNode*  getNext();
209        LPoly*  getAdLp1();
210        LPoly*  getAdLp2();
211        poly    getLp1Poly();
212        poly    getLp2Poly();
213        poly    getLp1Term();
214        poly    getLp2Term();
215        poly    getT1(); 
216        poly*   getAdT1(); 
217        poly    getT2(); 
218        poly*   getAdT2(); 
219        int     getLp1Index();
220        int     getLp2Index();
221        Rule*   getTestedRule();
222        void    print();
223};
224
225
226/*
227============================
228class CList(lists of CPairs)
229============================
230*/
231class CList {
232    private:
233        CNode*  first;
234        // last alway has data=NULL and next=NULL, for initialization purposes used
235        CNode*  last;
236    public:
237                // for initialization of CLists, last element alwas has data=NULL and next=NULL
238                CList(); 
239                CList(CPair* c); 
240                ~CList(); 
241        CNode*  getFirst();
242        void    insert(CPair* c);
243        CNode*  getMinDeg();
244        void    print();
245};
246
247
248/*
249======================================
250class RNode (nodes for lists of Rules)
251======================================
252*/
253class RNode {
254    private:
255        Rule*   data;
256        RNode*  next;
257    public:
258                RNode();
259                RNode(Rule* r);
260                ~RNode();
261        RNode*  insert(Rule* r);
262        RNode*  insert(int i, poly t);
263        RNode*  getNext();
264        Rule*   getRule();
265        int     getRuleIndex();
266        poly    getRuleTerm();
267};
268
269/*
270============================
271class RList (lists of Rules)
272============================
273*/
274class RList {
275    private:
276        RNode*  first;
277        // last alway has data=NULL and next=NULL, for initialization purposes used
278        RNode*  last;
279    public:
280                RList();
281                RList(Rule* r);
282                ~RList();
283        void    insert(Rule* r);
284        void    insert(int i, poly t);
285        RNode*  getFirst();
286        Rule*   getRule();
287};
288
289
290
291/*
292=============================================
293class RtagNode (nodes for lists of Rule tags)
294=============================================
295*/
296class RTagNode {
297    private:
298        RNode*      data;
299        RTagNode*   next;
300    public:
301                    RTagNode();
302                    RTagNode(RNode* r);
303                    RTagNode(RNode* r, RTagNode* n);
304                    ~RTagNode();
305        // declaration with first as parameter due to sorting of LTagList
306        RTagNode*   insert(RNode* r);
307        RNode*      getRNode();
308        RNode*      get(int idx, int length);
309        void        set(RNode*);
310        void        print();
311};
312
313
314/*
315========================================================================
316class RTagList(lists of Rule tags, i.e. first elements of a given index)
317========================================================================
318*/
319class RTagList {
320    private:
321        RTagNode*   first;
322        int         length;
323    public:
324                RTagList();
325                RTagList(RNode* r);
326                ~RTagList();
327        // declaration with first as parameter in LTagNode due to sorting of LTagList
328        void    insert(RNode* r);
329        RNode*  getFirst();
330        RNode*  get(int idx);
331        void    setFirst(RNode* r);
332        void    print();
333        int     getLength();
334};
335#endif
336#endif
Note: See TracBrowser for help on using the repository browser.