source: git/kernel/f5lists.h @ fcb8022

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