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