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