source: git/kernel/f5lists.h @ 6b0aa2

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