[35aab3] | 1 | #ifndef POLYS_H |
---|
| 2 | #define POLYS_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
| 6 | /* |
---|
[702175] | 7 | * ABSTRACT - compatiblity layer for all operations with polys |
---|
[35aab3] | 8 | */ |
---|
| 9 | |
---|
[737a68] | 10 | #include <polys/monomials/ring.h> |
---|
[6bec87] | 11 | #include <polys/monomials/p_polys.h> |
---|
[35aab3] | 12 | |
---|
[702175] | 13 | extern ring currRing; |
---|
[85fd90] | 14 | void rChangeCurrRing(ring r); |
---|
| 15 | |
---|
[f0a8c59] | 16 | #include <coeffs/numbers.h> |
---|
| 17 | inline number nGcd(number a, number b, const ring r = currRing) { return n_Gcd(a, b, r->cf); } |
---|
| 18 | |
---|
[35aab3] | 19 | /*************************************************************** |
---|
| 20 | * |
---|
| 21 | * Primitives for accessing and setting fields of a poly |
---|
| 22 | * poly must be != NULL |
---|
| 23 | * |
---|
| 24 | ***************************************************************/ |
---|
[6ed8c4] | 25 | |
---|
[35aab3] | 26 | // deletes old coeff before setting the new one |
---|
| 27 | #define pSetCoeff(p,n) p_SetCoeff(p,n,currRing) |
---|
| 28 | |
---|
| 29 | // Order |
---|
| 30 | #define pGetOrder(p) p_GetOrder(p, currRing) |
---|
| 31 | |
---|
| 32 | // Component |
---|
[1f637e] | 33 | #define pGetComp(p) __p_GetComp(p, currRing) |
---|
[35aab3] | 34 | #define pSetComp(p,v) p_SetComp(p,v, currRing) |
---|
| 35 | |
---|
| 36 | // Exponent |
---|
| 37 | #define pGetExp(p,i) p_GetExp(p, i, currRing) |
---|
| 38 | #define pSetExp(p,i,v) p_SetExp(p, i, v, currRing) |
---|
| 39 | #define pIncrExp(p,i) p_IncrExp(p,i, currRing) |
---|
| 40 | #define pDecrExp(p,i) p_DecrExp(p,i, currRing) |
---|
| 41 | #define pAddExp(p,i,v) p_AddExp(p,i,v, currRing) |
---|
| 42 | #define pSubExp(p,i,v) p_SubExp(p,i,v, currRing) |
---|
| 43 | #define pMultExp(p,i,v) p_MultExp(p,i,v, currRing) |
---|
| 44 | #define pGetExpSum(p1, p2, i) p_GetExpSum(p1, p2, i, currRing) |
---|
| 45 | #define pGetExpDiff(p1, p2, i) p_GetExpDiff(p1, p2, i, currRing) |
---|
[6ed8c4] | 46 | |
---|
[35aab3] | 47 | |
---|
| 48 | /*************************************************************** |
---|
| 49 | * |
---|
| 50 | * Allocation/Initalization/Deletion |
---|
[fb82895] | 51 | * except for pHead, all polys must be != NULL |
---|
[35aab3] | 52 | * |
---|
| 53 | ***************************************************************/ |
---|
| 54 | // allocates the space for a new monomial -- no initialization !!! |
---|
| 55 | #define pNew() p_New(currRing) |
---|
| 56 | // allocates a new monomial and initializes everything to 0 |
---|
| 57 | #define pInit() p_Init(currRing) |
---|
| 58 | // like pInit, except that expvector is initialized to that of p, |
---|
| 59 | // p must be != NULL |
---|
| 60 | #define pLmInit(p) p_LmInit(p, currRing) |
---|
| 61 | // returns newly allocated copy of Lm(p), coef is copied, next=NULL, |
---|
| 62 | // p might be NULL |
---|
| 63 | #define pHead(p) p_Head(p, currRing) |
---|
| 64 | // frees the space of the monomial m, assumes m != NULL |
---|
| 65 | // coef is not freed, m is not advanced |
---|
| 66 | static inline void pLmFree(poly p) {p_LmFree(p, currRing);} |
---|
| 67 | // like pLmFree, but advances p |
---|
| 68 | static inline void pLmFree(poly *p) {p_LmFree(p, currRing);} |
---|
| 69 | // assumes p != NULL, deletes p, returns pNext(p) |
---|
| 70 | #define pLmFreeAndNext(p) p_LmFreeAndNext(p, currRing) |
---|
| 71 | // assume p != NULL, deletes Lm(p)->coef and Lm(p) |
---|
| 72 | #define pLmDelete(p) p_LmDelete(p, currRing) |
---|
| 73 | // like pLmDelete, returns pNext(p) |
---|
| 74 | #define pLmDeleteAndNext(p) p_LmDeleteAndNext(p, currRing) |
---|
| 75 | |
---|
| 76 | /*************************************************************** |
---|
| 77 | * |
---|
| 78 | * Operation on ExpVectors: assumes polys != NULL |
---|
| 79 | * |
---|
| 80 | ***************************************************************/ |
---|
| 81 | |
---|
| 82 | #define pExpVectorCopy(d_p, s_p) p_ExpVectorCopy(d_p, s_p, currRing) |
---|
| 83 | #define pExpVectorAdd(p1, p2) p_ExpVectorAdd(p1, p2, currRing) |
---|
| 84 | #define pExpVectorSub(p1, p2) p_ExpVectorSub(p1, p2, currRing) |
---|
| 85 | #define pExpVectorAddSub(p1, p2, p3)p_ExpVectorAddSub(p1, p2, p3, currRing) |
---|
| 86 | #define pExpVectorSum(pr, p1, p2) p_ExpVectorSum(pr, p1, p2, currRing) |
---|
| 87 | #define pExpVectorDiff(pr, p1, p2) p_ExpVectorDiff(pr, p1, p2, currRing) |
---|
| 88 | |
---|
| 89 | // Gets a copy of (resp. set) the exponent vector, where e is assumed |
---|
[0b5e3d] | 90 | // to point to (r->N +1)*sizeof(long) memory. Exponents are |
---|
[35aab3] | 91 | // filled in as follows: comp, e_1, .., e_n |
---|
| 92 | #define pGetExpV(p, e) p_GetExpV(p, e, currRing) |
---|
| 93 | #define pSetExpV(p, e) p_SetExpV(p, e, currRing) |
---|
| 94 | |
---|
| 95 | /*************************************************************** |
---|
| 96 | * |
---|
| 97 | * Comparisons: they are all done without regarding coeffs |
---|
| 98 | * |
---|
| 99 | ***************************************************************/ |
---|
| 100 | // returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering |
---|
| 101 | #define pLmCmp(p,q) p_LmCmp(p,q,currRing) |
---|
| 102 | // executes axtionE|actionG|actionS if p=q|p>q|p<q w.r.t monomial ordering |
---|
| 103 | // action should be a "goto ..." |
---|
| 104 | #define pLmCmpAction(p,q, actionE, actionG, actionS) \ |
---|
| 105 | _p_LmCmpAction(p,q,currRing, actionE, actionG,actionS) |
---|
| 106 | |
---|
[5c39a9] | 107 | #define pLmEqual(p1, p2) p_ExpVectorEqual(p1, p2, currRing) |
---|
[35aab3] | 108 | |
---|
| 109 | // pCmp: args may be NULL |
---|
| 110 | // returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) |
---|
| 111 | #define pCmp(p1, p2) p_Cmp(p1, p2, currRing) |
---|
| 112 | |
---|
| 113 | |
---|
| 114 | /*************************************************************** |
---|
| 115 | * |
---|
| 116 | * Divisiblity tests, args must be != NULL, except for |
---|
| 117 | * pDivisbleBy |
---|
| 118 | * |
---|
| 119 | ***************************************************************/ |
---|
| 120 | // returns TRUE, if leading monom of a divides leading monom of b |
---|
| 121 | // i.e., if there exists a expvector c > 0, s.t. b = a + c; |
---|
| 122 | #define pDivisibleBy(a, b) p_DivisibleBy(a,b,currRing) |
---|
| 123 | // like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL |
---|
| 124 | #define pLmDivisibleBy(a,b) p_LmDivisibleBy(a,b,currRing) |
---|
| 125 | // like pLmDivisibleBy, does not check components |
---|
| 126 | #define pLmDivisibleByNoComp(a, b) p_LmDivisibleByNoComp(a,b,currRing) |
---|
| 127 | // Divisibility tests based on Short Exponent vectors |
---|
| 128 | // sev_a == pGetShortExpVector(a) |
---|
| 129 | // not_sev_b == ~ pGetShortExpVector(b) |
---|
| 130 | #define pLmShortDivisibleBy(a, sev_a, b, not_sev_b) \ |
---|
| 131 | p_LmShortDivisibleBy(a, sev_a, b, not_sev_b, currRing) |
---|
[cea6f3] | 132 | #define pLmRingShortDivisibleBy(a, sev_a, b, not_sev_b) \ |
---|
| 133 | p_LmRingShortDivisibleBy(a, sev_a, b, not_sev_b, currRing) |
---|
[35aab3] | 134 | // returns the "Short Exponent Vector" -- used to speed up divisibility |
---|
| 135 | // tests (see polys-impl.cc ) |
---|
| 136 | #define pGetShortExpVector(a) p_GetShortExpVector(a, currRing) |
---|
[a8b44d] | 137 | #ifdef HAVE_RINGS |
---|
| 138 | /* divisibility check over ground ring (which may contain zero divisors); |
---|
| 139 | TRUE iff LT(f) divides LT(g), i.e., LT(f)*c*m = LT(g), for some |
---|
| 140 | coefficient c and some monomial m; |
---|
| 141 | does not take components into account */ |
---|
[3d0808] | 142 | #define pDivisibleByRingCase(f,g) p_DivisibleByRingCase(f,g,currRing) |
---|
[a8b44d] | 143 | #endif |
---|
[35aab3] | 144 | |
---|
| 145 | /*************************************************************** |
---|
| 146 | * |
---|
| 147 | * Copying/Deleteion of polys: args may be NULL |
---|
| 148 | * |
---|
| 149 | ***************************************************************/ |
---|
| 150 | // return a copy of the poly |
---|
| 151 | #define pCopy(p) p_Copy(p, currRing) |
---|
| 152 | #define pDelete(p_ptr) p_Delete(p_ptr, currRing) |
---|
| 153 | |
---|
| 154 | /*************************************************************** |
---|
| 155 | * |
---|
[95450e] | 156 | * Copying/Deletion of polys: args may be NULL |
---|
[35aab3] | 157 | * - p/q as arg mean a poly |
---|
| 158 | * - m a monomial |
---|
| 159 | * - n a number |
---|
| 160 | * - pp (resp. qq, mm, nn) means arg is constant |
---|
| 161 | * - p (resp, q, m, n) means arg is destroyed |
---|
| 162 | * |
---|
| 163 | ***************************************************************/ |
---|
| 164 | #define pNeg(p) p_Neg(p, currRing) |
---|
| 165 | #define ppMult_nn(p, n) pp_Mult_nn(p, n, currRing) |
---|
| 166 | #define pMult_nn(p, n) p_Mult_nn(p, n, currRing) |
---|
| 167 | #define ppMult_mm(p, m) pp_Mult_mm(p, m, currRing) |
---|
| 168 | #define pMult_mm(p, m) p_Mult_mm(p, m, currRing) |
---|
| 169 | #define pAdd(p, q) p_Add_q(p, q, currRing) |
---|
[690e21e] | 170 | #define pPower(p, q) p_Power(p, q, currRing) |
---|
[35aab3] | 171 | #define pMinus_mm_Mult_qq(p, m, q) p_Minus_mm_Mult_qq(p, m, q, currRing) |
---|
| 172 | #define pPlus_mm_Mult_qq(p, m, q) p_Plus_mm_Mult_qq(p, m, q, currRing) |
---|
| 173 | #define pMult(p, q) p_Mult_q(p, q, currRing) |
---|
| 174 | #define ppMult_qq(p, q) pp_Mult_qq(p, q, currRing) |
---|
| 175 | // p*Coeff(m) for such monomials pm of p, for which m is divisble by pm |
---|
| 176 | #define ppMult_Coeff_mm_DivSelect(p, m) pp_Mult_Coeff_mm_DivSelect(p, m, currRing) |
---|
| 177 | /************************************************************************* |
---|
| 178 | * |
---|
| 179 | * Sort routines |
---|
| 180 | * |
---|
| 181 | *************************************************************************/ |
---|
| 182 | // sorts p, assumes all monomials in p are different |
---|
[f34215] | 183 | #define pSortMerger(p) p_SortMerge(p, currRing) |
---|
[35aab3] | 184 | #define pSort(p) p_SortMerge(p, currRing) |
---|
| 185 | |
---|
| 186 | // sorts p, p may have equal monomials |
---|
| 187 | #define pSortAdd(p) p_SortAdd(p, currRing) |
---|
| 188 | |
---|
| 189 | |
---|
| 190 | // Assume: If considerd only as poly in any component of p |
---|
| 191 | // (say, monomials of other components of p are set to 0), |
---|
| 192 | // then p is already sorted correctly |
---|
| 193 | #define pSortCompCorrect(p) pSort(p) |
---|
| 194 | |
---|
| 195 | /*************************************************************** |
---|
| 196 | * |
---|
| 197 | * Predicates on polys/Lm's |
---|
| 198 | * |
---|
| 199 | ***************************************************************/ |
---|
| 200 | // return true if all p is eihter NULL, or if all exponents |
---|
| 201 | // of p are 0 and Comp of p is zero |
---|
| 202 | #define pIsConstantComp(p) p_IsConstantComp(p, currRing) |
---|
| 203 | // like above, except that Comp might be != 0 |
---|
| 204 | #define pIsConstant(p) p_IsConstant(p,currRing) |
---|
| 205 | // return true if the Lm is a constant <>0 |
---|
| 206 | #define pIsUnit(p) p_IsUnit(p,currRing) |
---|
| 207 | // like above, except that p must be != NULL |
---|
| 208 | #define pLmIsConstantComp(p) p_LmIsConstantComp(p, currRing) |
---|
| 209 | #define pLmIsConstant(p) p_LmIsConstant(p,currRing) |
---|
| 210 | |
---|
| 211 | // return TRUE if all monomials of p are constant |
---|
| 212 | #define pIsConstantPoly(p) p_IsConstantPoly(p, currRing) |
---|
| 213 | |
---|
| 214 | #define pIsPurePower(p) p_IsPurePower(p, currRing) |
---|
[2f0d83f] | 215 | #define pIsUnivariate(p) p_IsUnivariate(p, currRing) |
---|
[35aab3] | 216 | #define pIsVector(p) (pGetComp(p)>0) |
---|
[95450e] | 217 | #define pGetVariables(p,e) p_GetVariables(p, e, currRing) |
---|
[35aab3] | 218 | |
---|
| 219 | /*************************************************************** |
---|
| 220 | * |
---|
| 221 | * Old stuff |
---|
| 222 | * |
---|
| 223 | ***************************************************************/ |
---|
| 224 | |
---|
| 225 | typedef poly* polyset; |
---|
[993ae2] | 226 | // // // extern poly ppNoether; // use currRing -> ppNoether!!! |
---|
[35aab3] | 227 | extern BOOLEAN pVectorOut; |
---|
| 228 | |
---|
| 229 | /*-------------predicate on polys ----------------------*/ |
---|
[f34215] | 230 | #define pHasNotCF(p1,p2) p_HasNotCF(p1,p2,currRing) |
---|
| 231 | /*has no common factor ?*/ |
---|
| 232 | #define pSplit(p,r) p_Split(p,r) |
---|
| 233 | /*p => IN(p), r => REST(p) */ |
---|
[35aab3] | 234 | |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | /*-----------the ordering of monomials:-------------*/ |
---|
| 238 | #define pSetm(p) p_Setm(p, currRing) |
---|
| 239 | // TODO: |
---|
[f34215] | 240 | #define pSetmComp(p) p_Setm(p, currRing) |
---|
[35aab3] | 241 | |
---|
| 242 | /*************************************************************** |
---|
| 243 | * |
---|
| 244 | * Degree stuff -- see p_polys.cc for explainations |
---|
| 245 | * |
---|
| 246 | ***************************************************************/ |
---|
[c6e80e] | 247 | inline int pWeight(int i, const ring R = currRing){ return p_Weight(i, R); } |
---|
[a9c298] | 248 | |
---|
[1f637e] | 249 | |
---|
[99bdcf] | 250 | static inline long pTotaldegree(poly p) { return p_Totaldegree(p,currRing); } |
---|
[bf183f] | 251 | #define pWTotaldegree(p) p_WTotaldegree(p,currRing) |
---|
[6bec87] | 252 | #define pWDegree(p) p_WDegree(p,currRing) |
---|
[35aab3] | 253 | |
---|
| 254 | /*-------------operations on polynomials:------------*/ |
---|
[bf183f] | 255 | #define pSub(a,b) p_Sub(a,b,currRing) |
---|
| 256 | |
---|
[f34215] | 257 | #define pmInit(a,b) p_mInit(a,b,currRing) |
---|
[35aab3] | 258 | |
---|
| 259 | // ----------------- define to enable new p_procs -----*/ |
---|
| 260 | |
---|
[fb4075b] | 261 | #define pDivide(a,b) p_Divide(a,b,currRing) |
---|
[2a38d90] | 262 | #define pDivideM(a,b) p_DivideM(a,b,currRing) |
---|
[a7ee69] | 263 | #define pLcm(a,b,m) p_Lcm(a,b,m,currRing) |
---|
[ac0bd6] | 264 | #define pDiff(a,b) p_Diff(a,b,currRing) |
---|
[5162db] | 265 | #define pDiffOp(a,b,m) p_DiffOp(a,b,m,currRing) |
---|
[35aab3] | 266 | |
---|
| 267 | #define pMaxComp(p) p_MaxComp(p, currRing) |
---|
| 268 | #define pMinComp(p) p_MinComp(p, currRing) |
---|
| 269 | |
---|
| 270 | #define pOneComp(p) p_OneComp(p, currRing) |
---|
| 271 | #define pSetCompP(a,i) p_SetCompP(a, i, currRing) |
---|
| 272 | |
---|
| 273 | // let's inline those, so that we can call them from the debugger |
---|
| 274 | inline char* pString(poly p) {return p_String(p, currRing, currRing);} |
---|
[538512] | 275 | inline void pString0(poly p) {p_String0(p, currRing, currRing);} |
---|
[35aab3] | 276 | inline void pWrite(poly p) {p_Write(p, currRing, currRing);} |
---|
| 277 | inline void pWrite0(poly p) {p_Write0(p, currRing, currRing);} |
---|
| 278 | inline void wrp(poly p) {p_wrp(p, currRing, currRing);} |
---|
| 279 | |
---|
| 280 | #define pISet(i) p_ISet(i,currRing) |
---|
| 281 | #define pNSet(n) p_NSet(n,currRing) |
---|
[1c33e0d] | 282 | |
---|
[a88544] | 283 | #define pOne() p_One(currRing) |
---|
[35aab3] | 284 | |
---|
| 285 | #define pNormalize(p) p_Normalize(p,currRing) |
---|
[fbf8a6] | 286 | #define pSize(p) p_Size(p,currRing) |
---|
[7ba059] | 287 | |
---|
[35aab3] | 288 | |
---|
| 289 | // homogenizes p by multiplying certain powers of the varnum-th variable |
---|
[4e8ef90] | 290 | #define pHomogen(p,varnum) p_Homogen(p,varnum,currRing) |
---|
[35aab3] | 291 | |
---|
| 292 | BOOLEAN pIsHomogeneous (poly p); |
---|
[4e8ef90] | 293 | // // replaces the maximal powers of the leading monomial of p2 in p1 by |
---|
| 294 | // // the same powers of n, utility for dehomogenization |
---|
| 295 | // #define pDehomogen(p1,p2,n) p_Dehomgen(p1,p2,n,currRing) |
---|
| 296 | // #define pIsHomogen(p) p_IsHomggen(p,currRing) |
---|
[a30a39a] | 297 | #define pIsHomogen(p) p_IsHomogen(p,currRing) |
---|
[35aab3] | 298 | |
---|
| 299 | /*BOOLEAN pVectorHasUnitM(poly p, int * k);*/ |
---|
[cd246b] | 300 | #define pVectorHasUnitB(p,k) p_VectorHasUnitB(p,k,currRing) |
---|
| 301 | #define pVectorHasUnit(p,k,l) p_VectorHasUnit(p,k,l,currRing) |
---|
| 302 | #define pTakeOutComp1(p,k) p_TakeOutComp1(p,k,currRing) |
---|
| 303 | |
---|
[35aab3] | 304 | // Splits *p into two polys: *q which consists of all monoms with |
---|
| 305 | // component == comp and *p of all other monoms *lq == pLength(*q) |
---|
| 306 | // On return all components pf *q == 0 |
---|
[1a20e5] | 307 | inline void pTakeOutComp(poly *p, long comp, poly *q, int *lq, const ring R = currRing) |
---|
[a9c298] | 308 | { |
---|
[1a20e5] | 309 | return p_TakeOutComp(p, comp, q, lq, R); |
---|
| 310 | } |
---|
| 311 | |
---|
[ffe4fd] | 312 | |
---|
[35aab3] | 313 | // This is something weird -- Don't use it, unless you know what you are doing |
---|
[1a20e5] | 314 | inline poly pTakeOutComp(poly * p, int k, const ring R = currRing) |
---|
| 315 | { |
---|
| 316 | return p_TakeOutComp(p, k, R); |
---|
| 317 | } |
---|
| 318 | |
---|
[74021a] | 319 | /* old spielwiese |
---|
| 320 | #define pTakeOutComp(p,k,q,lq) p_TakeOutComp(p,k,q,lq,currRing) |
---|
| 321 | |
---|
| 322 | // Similar to pTakeOutComp, except that only those components are |
---|
| 323 | // taken out whose Order == order |
---|
| 324 | // ASSUME: monomial ordering is Order compatible, i.e., if m1, m2 Monoms then |
---|
| 325 | // m1 >= m2 ==> pGetOrder(m1) >= pGetOrder(m2) |
---|
| 326 | #define pDecrOrdTakeOutComp(p,c,o,q,lq) p_DecrOrdTakeOutComp(p,c,o,q,lq,currRing) |
---|
| 327 | */ |
---|
[35aab3] | 328 | void pSetPolyComp(poly p, int comp); |
---|
[74021a] | 329 | #define pDeleteComp(p,k) p_DeleteComp(p,k,currRing) |
---|
[f0a8c59] | 330 | |
---|
| 331 | inline void pNorm(poly p, const ring R = currRing){ p_Norm(p, R); } |
---|
| 332 | |
---|
| 333 | |
---|
[3b1d9a] | 334 | #define pSubst(p,n,e) p_Subst(p,n,e,currRing) |
---|
[ba0fc3] | 335 | #define ppJet(p,m) pp_Jet(p,m,currRing) |
---|
| 336 | #define pJet(p,m) p_Jet(p,m,currRing) |
---|
| 337 | #define ppJetW(p,m,iv) pp_JetW(p,m,iv,currRing) |
---|
| 338 | #define pJetW(p,m,iv) p_JetW(p,m,iv,currRing) |
---|
| 339 | #define pMinDeg(p,w) p_MinDeg(p,w,currRing) |
---|
[b7cfaf] | 340 | #define pSeries(n,p,u,w) p_Series(n,p,u,w,currRing) |
---|
[a4081e5] | 341 | #define pInvers(n,p,w) p_Invers(n,p,w,currRing) |
---|
[35aab3] | 342 | // maximum weigthed degree of all monomials of p, w is indexed from |
---|
| 343 | // 1..pVariables |
---|
[7415540] | 344 | |
---|
| 345 | /// Deprecated: only for compatibility with older code! |
---|
[ba0fc3] | 346 | #define pDegW(p,w) p_DegW(p,w,currRing) |
---|
[35aab3] | 347 | |
---|
| 348 | /*-----------type conversions ----------------------------*/ |
---|
[d02fff] | 349 | // void pVec2Polys(poly v, polyset *p, int *len); |
---|
[891692] | 350 | #define pVar(m) p_Var(m,currRing) |
---|
[35aab3] | 351 | |
---|
| 352 | /*-----------specials for spoly-computations--------------*/ |
---|
[e044528] | 353 | |
---|
| 354 | /// Returns TRUE if |
---|
| 355 | /// * LM(p) | LM(lcm) |
---|
| 356 | /// * LC(p) | LC(lcm) only if ring |
---|
| 357 | /// * Exists i, j: |
---|
| 358 | /// * LE(p, i) != LE(lcm, i) |
---|
| 359 | /// * LE(p1, i) != LE(lcm, i) ==> LCM(p1, p) != lcm |
---|
| 360 | /// * LE(p, j) != LE(lcm, j) |
---|
| 361 | /// * LE(p2, j) != LE(lcm, j) ==> LCM(p2, p) != lcm |
---|
| 362 | BOOLEAN pCompareChain (poly p, poly p1, poly p2, poly lcm, const ring R = currRing); |
---|
| 363 | |
---|
[14d732] | 364 | #define pEqualPolys(p1,p2) p_EqualPolys(p1,p2,currRing) |
---|
[35aab3] | 365 | |
---|
| 366 | |
---|
[e044528] | 367 | |
---|
[1fdb6e] | 368 | // returns the length of a polynomial (numbers of monomials) |
---|
| 369 | // respect syzComp |
---|
| 370 | static inline poly pLast(poly a, int &length) { return p_Last (a, length, currRing); } |
---|
| 371 | static inline poly pLast(poly a) { int l; return pLast(a, l); } |
---|
[35aab3] | 372 | |
---|
| 373 | /*************************************************************** |
---|
| 374 | * |
---|
| 375 | * PDEBUG stuff |
---|
| 376 | * |
---|
| 377 | ***************************************************************/ |
---|
| 378 | #ifdef PDEBUG |
---|
| 379 | #define pTest(p) _p_Test(p, currRing, PDEBUG) |
---|
| 380 | #define pLmTest(p) _p_LmTest(p, currRing, PDEBUG) |
---|
| 381 | |
---|
| 382 | #else // ! PDEBUG |
---|
| 383 | |
---|
[d101b1] | 384 | #define pTest(p) do {} while (0) |
---|
| 385 | #define pLmTest(p) do {} while (0) |
---|
[35aab3] | 386 | #endif |
---|
| 387 | |
---|
| 388 | #endif // POLYS_H |
---|