source: git/kernel/f5lists.h @ 66e7b5

spielwiese
Last change on this file since 66e7b5 was 66e7b5, checked in by Christian Eder, 15 years ago
subalgorithms criticalPairs, criterion1 and criterion2 added git-svn-id: file:///usr/local/Singular/svn/trunk@11343 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 6.8 KB
Line 
1/****************************************
2*  Computer Algebra System SINGULAR     *
3****************************************/
4/* $Id: f5lists.h,v 1.2 2009-01-29 17:59:30 ederc Exp $ */
5/*
6* ABSTRACT: list interface
7*/
8#include "lpolynomial.h"
9#ifndef LISTS_HEADER
10#define LISTS_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(LPoly* lp);
44                LNode(LPoly* lp, LNode* l);
45                LNode(poly* t, int* i, poly* p);
46                LNode(poly* t, int* i, poly* p, LNode* l);
47                LNode(LNode* ln);
48                ~LNode();
49        // insert new elements to the list in first place from the labeled / classical polynomial view
50        LNode*  insert(LPoly* lp);
51        LNode*  insert(poly* t, int* i, poly* p);
52        // insert new elements to the list with resp. to increasing labels
53        // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label)
54        LNode*  insertByLabel(LPoly* lp);
55        // deletes the first elements of the list with the same degree
56        // get next from current LNode
57        LNode*  getNext();
58        // only used for the S-polys, which are already sorted by increasing degree by CList
59        LNode*  deleteByDeg();
60        // get the LPoly* out of LNode*
61        LPoly*  getLPoly();
62        // get the data from the LPoly saved in LNode
63        poly    getPoly();
64        poly    getTerm();
65        int     getIndex();
66        // test if for any list element the polynomial part of the data is equal to *p
67        bool    polyTest(poly* p);
68        LNode*  getNext(LNode* l);
69};
70
71
72/*
73============================
74class LList(lists of LPolys)
75============================
76*/
77class LList {
78    private:
79        LNode*  first;
80    public:
81                LList(LPoly* lp);
82                LList(poly* t,int* i,poly* p);
83                ~LList();
84        void    insert(LPoly* lp);
85        // insertion in front of the list
86        void    insert(poly* t,int* i, poly* p);
87        void    insertByLabel(LPoly* lp);
88        void    deleteByDeg();
89        bool    polyTest(poly* p);
90        LNode*  getFirst(); 
91        LNode*  getNext(LNode* l);
92};
93
94
95/*
96==============================================
97class LtagNode (nodes for lists of LPoly tags)
98==============================================
99*/
100class LTagNode {
101    private:
102        LNode*      data;
103        LTagNode*   next;
104    public:
105        LTagNode(LNode* l);
106        LTagNode(LNode* l, LTagNode* n);
107        ~LTagNode();
108        // declaration with first as parameter due to sorting of LTagList
109        LTagNode*   insert(LNode* l);
110        LNode*      getLNode();
111        LNode*      get(int i, int length);
112};
113
114
115/*
116=========================================================================
117class LTagList(lists of LPoly tags, i.e. first elements of a given index)
118=========================================================================
119*/
120class LTagList {
121    private:
122        LTagNode*   first;
123        int         length;
124    public:
125                LTagList(LNode* l);
126                ~LTagList();
127        // declaration with first as parameter in LTagNode due to sorting of LTagList
128        void    insert(LNode* l);
129        LNode*  get(int idx);
130};
131
132
133/*
134=======================================
135class CNode (nodes for lists of CPairs)
136=======================================
137*/
138class CNode {
139    private:
140        CPair* data;
141        CNode* next;
142    public:
143                CNode();
144                CNode(CPair* c);
145                CNode(CPair* c, CNode* n);
146                ~CNode(); 
147        CNode*  insert(CPair* c, CNode* last); 
148        CNode*  getMinDeg();
149        poly    getLp1Poly();
150        poly    getLp2Poly();
151        poly    getLp1Term();
152        poly    getLp2Term();
153        poly    getT1();   
154        poly    getT2(); 
155        int     getLp1Index();
156        int     getLp2Index();
157        void    print();
158};
159
160
161/*
162============================
163class CList(lists of CPairs)
164============================
165*/
166class CList {
167    private:
168        CNode*  first;
169        // last alway has data=NULL and next=NULL, for initialization purposes used
170        CNode*  last;
171    public:
172                // for initialization of CLists, last element alwas has data=NULL and next=NULL
173                CList(); 
174                CList(CPair* c); 
175                ~CList(); 
176        void    insert(CPair* c);
177        CNode*  getMinDeg();
178        void    print();
179};
180
181
182/*
183======================================
184class RNode (nodes for lists of Rules)
185======================================
186*/
187class RNode {
188    private:
189        Rule*   data;
190        RNode*  next;
191    public:
192                RNode();
193                RNode(Rule* r);
194                ~RNode();
195        RNode*  insert(Rule* r);
196        RNode*  getNext();
197        Rule*   getRule();
198        int     getRuleIndex();
199        poly    getRuleTerm();
200};
201
202/*
203============================
204class RList (lists of Rules)
205============================
206*/
207class RList {
208    private:
209        RNode*  first;
210        // last alway has data=NULL and next=NULL, for initialization purposes used
211        RNode*  last;
212    public:
213                RList();
214                RList(Rule* r);
215                ~RList();
216        void    insert(Rule* r);
217        RNode*  getFirst();
218        Rule*   getRule();
219};
220
221
222
223/*
224=============================================
225class RtagNode (nodes for lists of Rule tags)
226=============================================
227*/
228class RTagNode {
229    private:
230        RNode*      data;
231        RTagNode*   next;
232    public:
233        RTagNode(RNode* r);
234        RTagNode(RNode* r, RTagNode* n);
235        ~RTagNode();
236        // declaration with first as parameter due to sorting of LTagList
237        RTagNode*   insert(RNode* r);
238        RNode*      getRNode();
239        RNode*      get(int idx, int length);
240};
241
242
243/*
244========================================================================
245class RTagList(lists of Rule tags, i.e. first elements of a given index)
246========================================================================
247*/
248class RTagList {
249    private:
250        RTagNode*   first;
251        int         length;
252    public:
253                RTagList(RNode* r);
254                ~RTagList();
255        // declaration with first as parameter in LTagNode due to sorting of LTagList
256        void    insert(RNode* r);
257        RNode*  get(int idx);
258};
259#endif
260#endif
Note: See TracBrowser for help on using the repository browser.