1 | //! \file f5data.cc |
---|
2 | /**************************************** |
---|
3 | * Computer Algebra System SINGULAR * |
---|
4 | ****************************************/ |
---|
5 | /* $Id$ */ |
---|
6 | /* |
---|
7 | * ABSTRACT: labeled polynomial interface |
---|
8 | */ |
---|
9 | #ifndef F5DATA_HEADER |
---|
10 | #define F5DATA_HEADER |
---|
11 | #ifdef HAVE_F5 |
---|
12 | /*! |
---|
13 | ========================================================= |
---|
14 | ========================================================= |
---|
15 | classes for labeled polynomials/pairs/S-polynomials in F5 |
---|
16 | ========================================================= |
---|
17 | ========================================================= |
---|
18 | */ |
---|
19 | class LPolyOld; |
---|
20 | class CPairOld; |
---|
21 | class RuleOld; |
---|
22 | |
---|
23 | |
---|
24 | /*! |
---|
25 | ============================ |
---|
26 | class of labeled polynomials |
---|
27 | ============================ |
---|
28 | */ |
---|
29 | class LPolyOld { |
---|
30 | private: |
---|
31 | poly term; //term of signature |
---|
32 | int index; //index of signature |
---|
33 | poly polynomial; //standard polynomial data |
---|
34 | RuleOld* _ruleOld; |
---|
35 | bool del; |
---|
36 | public: |
---|
37 | inline LPolyOld(poly t, int i, poly p, RuleOld* r=NULL); |
---|
38 | // inline LPolyOld(poly t, int i, poly p, RuleOld* r=NULL, bool b=0); |
---|
39 | inline void setPoly(poly p); |
---|
40 | inline poly getPoly(); |
---|
41 | inline void setTerm(poly t); |
---|
42 | inline poly getTerm(); |
---|
43 | inline void setIndex(int i); |
---|
44 | inline int getIndex(); |
---|
45 | inline void setRuleOld(RuleOld* r); |
---|
46 | inline RuleOld* getRuleOld(); |
---|
47 | inline void setDel(bool d); |
---|
48 | inline bool getDel(); |
---|
49 | inline void set(poly t, int i, poly p, RuleOld* r); |
---|
50 | inline LPolyOld* get(); |
---|
51 | }; |
---|
52 | |
---|
53 | LPolyOld::LPolyOld(poly t,int i,poly p, RuleOld* r) { |
---|
54 | set(t,i,p,r); |
---|
55 | del = 0; |
---|
56 | } |
---|
57 | |
---|
58 | /*LPolyOld::LPolyOld(poly t,int i,poly p, RuleOld* r, bool b) { |
---|
59 | set(t,i,p,r); |
---|
60 | del = b; |
---|
61 | } |
---|
62 | */ |
---|
63 | void LPolyOld::setPoly(poly p) { |
---|
64 | //poly _p = pInit(); |
---|
65 | //_p = pCopy(p); |
---|
66 | polynomial = p; |
---|
67 | } |
---|
68 | |
---|
69 | void LPolyOld::setTerm(poly t) { |
---|
70 | //poly _t = pInit(); |
---|
71 | //_t = pCopy(t); |
---|
72 | term = t; |
---|
73 | } |
---|
74 | |
---|
75 | void LPolyOld::setIndex(int i) { |
---|
76 | index = i; |
---|
77 | } |
---|
78 | |
---|
79 | void LPolyOld::setRuleOld(RuleOld* r) { |
---|
80 | _ruleOld = r; |
---|
81 | } |
---|
82 | |
---|
83 | void LPolyOld::setDel(bool d) { |
---|
84 | del = d; |
---|
85 | } |
---|
86 | |
---|
87 | poly LPolyOld::getPoly() { |
---|
88 | return polynomial; |
---|
89 | } |
---|
90 | |
---|
91 | poly LPolyOld::getTerm() { |
---|
92 | return term; |
---|
93 | } |
---|
94 | |
---|
95 | int LPolyOld::getIndex() { |
---|
96 | return index; |
---|
97 | } |
---|
98 | |
---|
99 | RuleOld* LPolyOld::getRuleOld() { |
---|
100 | return _ruleOld; |
---|
101 | } |
---|
102 | |
---|
103 | bool LPolyOld::getDel() { |
---|
104 | return del; |
---|
105 | } |
---|
106 | |
---|
107 | void LPolyOld::set(poly t, int i, poly p, RuleOld* r) { |
---|
108 | this->setTerm(t); |
---|
109 | this->setIndex(i); |
---|
110 | this->setPoly(p); |
---|
111 | this->setRuleOld(r); |
---|
112 | } |
---|
113 | |
---|
114 | LPolyOld* LPolyOld::get() { |
---|
115 | return this; |
---|
116 | } |
---|
117 | |
---|
118 | |
---|
119 | /*! |
---|
120 | =================================== |
---|
121 | structure of labeled critical pairs |
---|
122 | =================================== |
---|
123 | */ |
---|
124 | class CPairOld { |
---|
125 | private: |
---|
126 | long deg; // total degree of the critical pair |
---|
127 | poly t1; // first term for label |
---|
128 | LPolyOld* lp1; // first labeled poly |
---|
129 | poly t2; // second term for label |
---|
130 | LPolyOld* lp2; // second labeled poly |
---|
131 | RuleOld* testedRuleOld; // already tested by RuleOlds up to lastRuleOldTested |
---|
132 | bool del; |
---|
133 | public: |
---|
134 | inline CPairOld(long degree, poly term1, LPolyOld* LPolyOld1, poly term2, LPolyOld* LPolyOld2, bool useless, RuleOld* r = NULL); |
---|
135 | inline long getDeg(); |
---|
136 | inline poly getT1(); |
---|
137 | inline poly* getAdT1(); |
---|
138 | inline LPolyOld* getAdLp1(); |
---|
139 | inline poly getLp1Poly(); |
---|
140 | inline poly getLp1Term(); |
---|
141 | inline int getLp1Index(); |
---|
142 | inline poly getT2(); |
---|
143 | inline poly* getAdT2(); |
---|
144 | inline LPolyOld* getAdLp2(); |
---|
145 | inline poly getLp2Poly(); |
---|
146 | inline poly getLp2Term(); |
---|
147 | inline int getLp2Index(); |
---|
148 | inline bool getDel(); |
---|
149 | inline RuleOld* getTestedRuleOld(); |
---|
150 | inline void setTestedRuleOld(RuleOld* r); |
---|
151 | }; |
---|
152 | |
---|
153 | CPairOld::CPairOld(long degree, poly term1, LPolyOld* LPolyOld1, poly term2, LPolyOld* LPolyOld2, bool useless, RuleOld* r) { |
---|
154 | deg = degree; |
---|
155 | t1 = term1; |
---|
156 | lp1 = LPolyOld1; |
---|
157 | t2 = term2; |
---|
158 | lp2 = LPolyOld2; |
---|
159 | testedRuleOld = r; |
---|
160 | del = useless; |
---|
161 | } |
---|
162 | |
---|
163 | long CPairOld::getDeg() { |
---|
164 | return deg; |
---|
165 | } |
---|
166 | |
---|
167 | poly CPairOld::getT1() { |
---|
168 | return t1; |
---|
169 | } |
---|
170 | |
---|
171 | poly* CPairOld::getAdT1() { |
---|
172 | return &t1; |
---|
173 | } |
---|
174 | |
---|
175 | poly* CPairOld::getAdT2() { |
---|
176 | return &t2; |
---|
177 | } |
---|
178 | |
---|
179 | poly CPairOld::getT2() { |
---|
180 | return t2; |
---|
181 | } |
---|
182 | |
---|
183 | LPolyOld* CPairOld::getAdLp1() { |
---|
184 | return lp1; |
---|
185 | } |
---|
186 | |
---|
187 | LPolyOld* CPairOld::getAdLp2() { |
---|
188 | return lp2; |
---|
189 | } |
---|
190 | |
---|
191 | poly CPairOld::getLp1Poly() { |
---|
192 | return lp1->getPoly(); |
---|
193 | } |
---|
194 | |
---|
195 | poly CPairOld::getLp2Poly() { |
---|
196 | return lp2->getPoly(); |
---|
197 | } |
---|
198 | |
---|
199 | poly CPairOld::getLp1Term() { |
---|
200 | return lp1->getTerm(); |
---|
201 | } |
---|
202 | |
---|
203 | poly CPairOld::getLp2Term() { |
---|
204 | return lp2->getTerm(); |
---|
205 | } |
---|
206 | |
---|
207 | int CPairOld::getLp1Index() { |
---|
208 | return lp1->getIndex(); |
---|
209 | } |
---|
210 | |
---|
211 | int CPairOld::getLp2Index() { |
---|
212 | return lp2->getIndex(); |
---|
213 | } |
---|
214 | |
---|
215 | bool CPairOld::getDel() { |
---|
216 | return del; |
---|
217 | } |
---|
218 | |
---|
219 | RuleOld* CPairOld::getTestedRuleOld() { |
---|
220 | return testedRuleOld; |
---|
221 | } |
---|
222 | |
---|
223 | void CPairOld::setTestedRuleOld(RuleOld* r) { |
---|
224 | testedRuleOld = r; |
---|
225 | } |
---|
226 | |
---|
227 | |
---|
228 | /*! |
---|
229 | ======================================================== |
---|
230 | structure of RuleOlds(i.e. already computed / known labels) |
---|
231 | ======================================================== |
---|
232 | */ |
---|
233 | class RuleOld { |
---|
234 | private: |
---|
235 | int index; // index of the labeled polynomial the RuleOld comes from |
---|
236 | poly term; // term of the labeled polynomial the RuleOld comes from |
---|
237 | public: |
---|
238 | inline RuleOld(int i, poly term); |
---|
239 | inline ~RuleOld(); |
---|
240 | inline int getIndex(); |
---|
241 | inline poly getTerm(); |
---|
242 | }; |
---|
243 | |
---|
244 | RuleOld::RuleOld(int i, poly t) { |
---|
245 | index = i; |
---|
246 | term = t; |
---|
247 | } |
---|
248 | |
---|
249 | RuleOld::~RuleOld() { |
---|
250 | //pDelete(&term); |
---|
251 | } |
---|
252 | |
---|
253 | int RuleOld::getIndex() { |
---|
254 | return index; |
---|
255 | } |
---|
256 | |
---|
257 | poly RuleOld::getTerm() { |
---|
258 | return term; |
---|
259 | } |
---|
260 | #endif |
---|
261 | #endif |
---|