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