source: git/kernel/f5lists.h @ 3a0e1a

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