source: git/kernel/f5lists.h @ 9cb4078

fieker-DuValspielwiese
Last change on this file since 9cb4078 was 9cb4078, checked in by Christian Eder, 15 years ago
implemented interreduction, still with lots of bugs => commented out git-svn-id: file:///usr/local/Singular/svn/trunk@11514 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 9.3 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: f5lists.h,v 1.14 2009-03-04 20:23:05 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, CNode* last); 
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        // last alway has data=NULL and next=NULL, for initialization purposes used
233        CNode*  last;
234    public:
235                // for initialization of CLists, last element alwas has data=NULL and next=NULL
236                CList(); 
237                CList(CPair* c); 
238                ~CList(); 
239        CNode*  getFirst();
240        void    insert(CPair* c);
241        CNode*  getMinDeg();
242        void    print();
243};
244
245
246/*
247======================================
248class RNode (nodes for lists of Rules)
249======================================
250*/
251class RNode {
252    private:
253        Rule*   data;
254        RNode*  next;
255    public:
256                RNode();
257                RNode(Rule* r);
258                ~RNode();
259        RNode*  insert(Rule* r);
260        RNode*  insert(int i, poly t);
261        RNode*  getNext();
262        Rule*   getRule();
263        int     getRuleIndex();
264        poly    getRuleTerm();
265};
266
267/*
268============================
269class RList (lists of Rules)
270============================
271*/
272class RList {
273    private:
274        RNode*  first;
275        // last alway has data=NULL and next=NULL, for initialization purposes used
276        RNode*  last;
277    public:
278                RList();
279                RList(Rule* r);
280                ~RList();
281        void    insert(Rule* r);
282        void    insert(int i, poly t);
283        RNode*  getFirst();
284        Rule*   getRule();
285};
286
287
288
289/*
290=============================================
291class RtagNode (nodes for lists of Rule tags)
292=============================================
293*/
294class RTagNode {
295    private:
296        RNode*      data;
297        RTagNode*   next;
298    public:
299                    RTagNode();
300                    RTagNode(RNode* r);
301                    RTagNode(RNode* r, RTagNode* n);
302                    ~RTagNode();
303        // declaration with first as parameter due to sorting of LTagList
304        RTagNode*   insert(RNode* r);
305        RNode*      getRNode();
306        RTagNode*   getNext();
307        RNode*      get(int idx, int length);
308        void        set(RNode*);
309        void        print();
310};
311
312
313/*
314========================================================================
315class RTagList(lists of Rule tags, i.e. first elements of a given index)
316========================================================================
317*/
318class RTagList {
319    private:
320        RTagNode*   first;
321        int         length;
322    public:
323                RTagList();
324                RTagList(RNode* r);
325                ~RTagList();
326        // declaration with first as parameter in LTagNode due to sorting of LTagList
327        void    insert(RNode* r);
328        RNode*  getFirst();
329        RNode*  get(int idx);
330        void    setFirst(RNode* r);
331        void    print();
332        int     getLength();
333};
334#endif
335#endif
Note: See TracBrowser for help on using the repository browser.