1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* $Id: f5lists.h,v 1.1 2009-01-27 10:38:08 Singular 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 | ============================ |
---|
16 | classes for lists used in F5 |
---|
17 | ============================ |
---|
18 | ============================ |
---|
19 | */ |
---|
20 | class LNode; |
---|
21 | class LList; |
---|
22 | class PrevNode; |
---|
23 | class PrevList; |
---|
24 | class CNode; |
---|
25 | class CList; |
---|
26 | class RList; |
---|
27 | class RNode; |
---|
28 | |
---|
29 | /* |
---|
30 | ======================================= |
---|
31 | LNode class (nodes for lists of LPolys) |
---|
32 | ======================================= |
---|
33 | */ |
---|
34 | class LNode { |
---|
35 | private: |
---|
36 | LPoly* data; |
---|
37 | LNode* next; |
---|
38 | public: |
---|
39 | // generating new list elements from the labeled / classical polynomial view |
---|
40 | LNode(LPoly* lp); |
---|
41 | LNode(poly* t, int* i, poly* p); |
---|
42 | LNode(LNode* ln); |
---|
43 | ~LNode(); |
---|
44 | // insert new elements to the list in first place from the labeled / classical polynomial view |
---|
45 | LNode* insert(LPoly* lp); |
---|
46 | LNode* insert(poly* t, int* i, poly* p); |
---|
47 | // insert new elements to the list with resp. to increasing labels |
---|
48 | // only used for the S-polys to be reduced (TopReduction building new S-polys with higher label) |
---|
49 | LNode* insertByLabel(LPoly* lp); |
---|
50 | // deletes the first elements of the list with the same degree |
---|
51 | // get next from current LNode |
---|
52 | LNode* getNext(); |
---|
53 | // only used for the S-polys, which are already sorted by increasing degree by CList |
---|
54 | LNode* deleteByDeg(); |
---|
55 | // get the LPoly* out of LNode* |
---|
56 | LPoly* getLPoly(); |
---|
57 | // get the data from the LPoly saved in LNode |
---|
58 | poly* getPoly(); |
---|
59 | poly* getTerm(); |
---|
60 | int* getIndex(); |
---|
61 | // test if for any list element the polynomial part of the data is equal to *p |
---|
62 | bool polyTest(poly* p); |
---|
63 | LNode* getNext(LNode* l); |
---|
64 | }; |
---|
65 | |
---|
66 | |
---|
67 | /* |
---|
68 | ============================ |
---|
69 | class LList(lists of LPolys) |
---|
70 | ============================ |
---|
71 | */ |
---|
72 | class LList { |
---|
73 | private: |
---|
74 | LNode* first; |
---|
75 | public: |
---|
76 | LList(LPoly* lp); |
---|
77 | LList(poly* t,int* i,poly* p); |
---|
78 | ~LList(); |
---|
79 | void insert(LPoly* lp); |
---|
80 | // insertion in front of the list |
---|
81 | void insert(poly* t,int* i, poly* p); |
---|
82 | void insertByLabel(LPoly* lp); |
---|
83 | void deleteByDeg(); |
---|
84 | bool polyTest(poly* p); |
---|
85 | LNode* getFirst(); |
---|
86 | LNode* getNext(LNode* l); |
---|
87 | }; |
---|
88 | |
---|
89 | |
---|
90 | /* |
---|
91 | ============================================= |
---|
92 | PrevNode class (nodes for lists of gPrevLast) |
---|
93 | ============================================= |
---|
94 | */ |
---|
95 | class PrevNode { |
---|
96 | private: |
---|
97 | LNode* data; |
---|
98 | PrevNode* next; |
---|
99 | public: |
---|
100 | PrevNode(LNode* l); |
---|
101 | ~PrevNode(); |
---|
102 | PrevNode* append(LNode* l); |
---|
103 | LNode* getLNode(); |
---|
104 | LNode* getPrevLast(int i); |
---|
105 | }; |
---|
106 | |
---|
107 | |
---|
108 | /* |
---|
109 | ==================================================== |
---|
110 | class PrevList(lists of last node elements in gPrev) |
---|
111 | ==================================================== |
---|
112 | */ |
---|
113 | class PrevList { |
---|
114 | private: |
---|
115 | PrevNode* first; |
---|
116 | PrevNode* last; |
---|
117 | public: |
---|
118 | PrevList(LNode* l); |
---|
119 | ~PrevList(); |
---|
120 | void append(LNode* l); |
---|
121 | LNode* getPrevLast(int i); |
---|
122 | }; |
---|
123 | |
---|
124 | |
---|
125 | /* |
---|
126 | ======================================= |
---|
127 | class CNode (nodes for lists of CPairs) |
---|
128 | ======================================= |
---|
129 | */ |
---|
130 | class CNode { |
---|
131 | private: |
---|
132 | CPair* data; |
---|
133 | CNode* next; |
---|
134 | public: |
---|
135 | CNode(CPair* c); |
---|
136 | ~CNode(); |
---|
137 | CNode* insert(CPair* c); |
---|
138 | CNode* getMinDeg(); |
---|
139 | //CNode* getLPoly() const; |
---|
140 | }; |
---|
141 | |
---|
142 | |
---|
143 | /* |
---|
144 | ============================ |
---|
145 | class CList(lists of CPairs) |
---|
146 | ============================ |
---|
147 | */ |
---|
148 | class CList { |
---|
149 | private: |
---|
150 | CNode* first; |
---|
151 | public: |
---|
152 | CList(CPair* c); |
---|
153 | ~CList(); |
---|
154 | void insert(CPair* c); |
---|
155 | CNode* getMinDeg(); |
---|
156 | |
---|
157 | }; |
---|
158 | |
---|
159 | |
---|
160 | /* |
---|
161 | ====================================== |
---|
162 | class RNode (nodes for lists of Rules) |
---|
163 | ====================================== |
---|
164 | */ |
---|
165 | class RNode { |
---|
166 | private: |
---|
167 | Rule* data; |
---|
168 | RNode* next; |
---|
169 | public: |
---|
170 | RNode(Rule* r); |
---|
171 | ~RNode(); |
---|
172 | RNode* insert(Rule* r); |
---|
173 | }; |
---|
174 | |
---|
175 | /* |
---|
176 | ============================ |
---|
177 | class RList (lists of Rules) |
---|
178 | ============================ |
---|
179 | */ |
---|
180 | class RList { |
---|
181 | private: |
---|
182 | RNode* first; |
---|
183 | public: |
---|
184 | RList(Rule* r); |
---|
185 | ~RList(); |
---|
186 | void insert(Rule* r); |
---|
187 | }; |
---|
188 | #endif |
---|
189 | #endif |
---|