[0e1846] | 1 | #ifndef POLYS_H |
---|
| 2 | #define POLYS_H |
---|
| 3 | /**************************************** |
---|
| 4 | * Computer Algebra System SINGULAR * |
---|
| 5 | ****************************************/ |
---|
[2d19a1b] | 6 | /* $Id: polys.h,v 1.55 2001-02-27 18:06:35 mschulze Exp $ */ |
---|
[0e1846] | 7 | /* |
---|
[512a2b] | 8 | * ABSTRACT - all basic methods to manipulate polynomials of the |
---|
| 9 | currRing |
---|
[0e1846] | 10 | */ |
---|
[55b8ae] | 11 | |
---|
[512a2b] | 12 | #include "p_polys.h" |
---|
| 13 | /* |
---|
[a6a239] | 14 | Some general remarks: |
---|
| 15 | We divide poly operations into roughly 4 categories: |
---|
[cb66fa] | 16 | Level 2: operations on monomials/polynomials with constant time, |
---|
| 17 | or operations which are just dispatchers to other |
---|
| 18 | poly routines |
---|
[a6a239] | 19 | - implemented in: pInline2.h |
---|
| 20 | - debugging only if PDEBUG >= 2 |
---|
| 21 | - normally inlined, unless PDEBUG >= 2 || NO_INLINE2 |
---|
[e10683] | 22 | Level 1: operations on monomials with time proportional to length |
---|
[cb66fa] | 23 | - implemented in: pInline1.h |
---|
| 24 | - debugging only if PDEBUG >= 1 |
---|
[e10683] | 25 | - normally inlined, unless PDEBUG >= 1 || NO_INLINE1 |
---|
[a6a239] | 26 | Level 0: short operations on polynomials with time proportional to |
---|
| 27 | length of poly |
---|
| 28 | - implemented in pInline0.cc |
---|
| 29 | - debugging if PDEBUG |
---|
| 30 | - normally _not_ inlined: can be forced with |
---|
| 31 | #define DO_PINLINE0 |
---|
| 32 | #include "pInline0.h" |
---|
[e10683] | 33 | Misc : operations on polynomials which do not fit in any of the |
---|
[a6a239] | 34 | above categories |
---|
| 35 | - implemented in: polys*.cc |
---|
| 36 | - never inlined |
---|
| 37 | - debugging if PDEBUG >= 0 |
---|
| 38 | |
---|
[512a2b] | 39 | You can set PDEBUG on a per-file basis, before including "mod2.h" like |
---|
| 40 | #define PDEBUG 2 |
---|
| 41 | #include "mod2.h" |
---|
[cb66fa] | 42 | However, PDEBUG will only be in effect, if !NDEBUG. |
---|
[a6a239] | 43 | |
---|
[e10683] | 44 | All p_* operations take as last argument a ring |
---|
| 45 | and are ring independent. Their corresponding p* operations are usually |
---|
[a6a239] | 46 | just macros to the respective p_*(..,currRing). |
---|
| 47 | |
---|
[512a2b] | 48 | */ |
---|
[a6a239] | 49 | |
---|
| 50 | /*************************************************************** |
---|
| 51 | * |
---|
| 52 | * Primitives for accessing and setting fields of a poly |
---|
| 53 | * poly must be != NULL |
---|
| 54 | * |
---|
| 55 | ***************************************************************/ |
---|
| 56 | // deletes old coeff before setting the new one |
---|
| 57 | #define pSetCoeff(p,n) p_SetCoeff(p,n,currRing) |
---|
| 58 | |
---|
| 59 | // Order |
---|
| 60 | #define pGetOrder(p) p_GetOrder(p, currRing) |
---|
| 61 | // don't use this |
---|
| 62 | #define pSetOrder(p, o) p_SetOrder(p, o, currRing) |
---|
| 63 | |
---|
[e10683] | 64 | // Component |
---|
[a6a239] | 65 | #define pGetComp(p) _p_GetComp(p, currRing) |
---|
| 66 | #define pSetComp(p,v) p_SetComp(p,v, currRing) |
---|
| 67 | #define pIncrComp(p) p_IncrComp(p,currRing) |
---|
| 68 | #define pDecrComp(p) p_DecrComp(p,currRing) |
---|
| 69 | #define pAddComp(p,v) p_AddComp(p,v,currRing) |
---|
| 70 | #define pSubComp(p,v) p_SubComp(p,v,currRing) |
---|
| 71 | |
---|
| 72 | // Exponent |
---|
| 73 | #define pGetExp(p,i) p_GetExp(p, i, currRing) |
---|
| 74 | #define pSetExp(p,i,v) p_SetExp(p, i, v, currRing) |
---|
| 75 | #define pIncrExp(p,i) p_IncrExp(p,i, currRing) |
---|
| 76 | #define pDecrExp(p,i) p_DecrExp(p,i, currRing) |
---|
| 77 | #define pAddExp(p,i,v) p_AddExp(p,i,v, currRing) |
---|
| 78 | #define pSubExp(p,i,v) p_SubExp(p,i,v, currRing) |
---|
| 79 | #define pMultExp(p,i,v) p_MultExp(p,i,v, currRing) |
---|
[512a2b] | 80 | #define pGetExpSum(p1, p2, i) p_GetExpSum(p1, p2, i, currRing) |
---|
| 81 | #define pGetExpDiff(p1, p2, i) p_GetExpDiff(p1, p2, i, currRing) |
---|
[a6a239] | 82 | |
---|
| 83 | /*************************************************************** |
---|
| 84 | * |
---|
[e10683] | 85 | * Allocation/Initalization/Deletion |
---|
[512a2b] | 86 | * except for pDeleteLm and pHead, all polys must be != NULL |
---|
| 87 | * |
---|
[a6a239] | 88 | ***************************************************************/ |
---|
| 89 | // allocates the space for a new monomial -- no initialization !!! |
---|
| 90 | #define pNew() p_New(currRing) |
---|
| 91 | // allocates a new monomial and initializes everything to 0 |
---|
[512a2b] | 92 | #define pInit() p_Init(currRing) |
---|
[e10683] | 93 | // like pInit, except that expvector is initialized to that of p, |
---|
[512a2b] | 94 | // p must be != NULL |
---|
| 95 | #define pLmInit(p) p_LmInit(p, currRing) |
---|
[e10683] | 96 | // returns newly allocated copy of Lm(p), coef is copied, next=NULL, |
---|
[512a2b] | 97 | // p might be NULL |
---|
[a6a239] | 98 | #define pHead(p) p_Head(p, currRing) |
---|
[e10683] | 99 | // if *p_ptr != NULL, delete p_ptr->coef, *p_ptr, and set *p_ptr to |
---|
[512a2b] | 100 | // pNext(*p_ptr) |
---|
| 101 | static inline void pDeleteLm(poly *p) {p_DeleteLm(p, currRing);} |
---|
| 102 | // if (p!=NULL) delete p-coef and p |
---|
| 103 | static inline void pDeleteLm(poly p) {p_DeleteLm(p, currRing);} |
---|
[a6a239] | 104 | // frees the space of the monomial m, assumes m != NULL |
---|
| 105 | // coef is not freed, m is not advanced |
---|
[512a2b] | 106 | static inline void pLmFree(poly p) {p_LmFree(p, currRing);} |
---|
| 107 | // like pLmFree, but advances p |
---|
| 108 | static inline void pLmFree(poly *p) {p_LmFree(p, currRing);} |
---|
[a6a239] | 109 | // assumes p != NULL, deletes p, returns pNext(p) |
---|
[512a2b] | 110 | #define pLmFreeAndNext(p) p_LmFreeAndNext(p, currRing) |
---|
[a6a239] | 111 | // assume p != NULL, deletes Lm(p)->coef and Lm(p) |
---|
| 112 | #define pLmDelete(p) p_LmDelete(p, currRing) |
---|
| 113 | // like pLmDelete, returns pNext(p) |
---|
| 114 | #define pLmDeleteAndNext(p) p_LmDeleteAndNext(p, currRing) |
---|
| 115 | // used by iparith.cc |
---|
| 116 | extern poly pHeadProc(poly p); |
---|
| 117 | |
---|
| 118 | /*************************************************************** |
---|
| 119 | * |
---|
| 120 | * Operation on ExpVectors: assumes polys != NULL |
---|
| 121 | * |
---|
| 122 | ***************************************************************/ |
---|
| 123 | |
---|
| 124 | #define pExpVectorCopy(d_p, s_p) p_ExpVectorCopy(d_p, s_p, currRing) |
---|
| 125 | #define pExpVectorAdd(p1, p2) p_ExpVectorAdd(p1, p2, currRing) |
---|
| 126 | #define pExpVectorSub(p1, p2) p_ExpVectorSub(p1, p2, currRing) |
---|
[1aa55bf] | 127 | #define pExpVectorAddSub(p1, p2, p3)p_ExpVectorAddSub(p1, p2, p3, currRing) |
---|
[a6a239] | 128 | #define pExpVectorSum(pr, p1, p2) p_ExpVectorSum(pr, p1, p2, currRing) |
---|
| 129 | #define pExpVectorDiff(pr, p1, p2) p_ExpVectorDiff(pr, p1, p2, currRing) |
---|
| 130 | #define pExpVectorEqual(p1, p2) p_ExpVectorEqual(p1, p2, currRing) |
---|
| 131 | #define pExpVectorQuerSum(p) p_ExpVectorQuerSum(p, currRing) |
---|
| 132 | |
---|
[512a2b] | 133 | // Gets a copy of (resp. set) the exponent vector, where e is assumed |
---|
| 134 | // to point to (r->N +1)*sizeof(Exponent_t) memory. Exponents are |
---|
[a6a239] | 135 | // filled in as follows: comp, e_1, .., e_n |
---|
| 136 | #define pGetExpV(p, e) p_GetExpV(p, e, currRing) |
---|
| 137 | #define pSetExpV(p, e) p_SetExpV(p, e, currRing) |
---|
| 138 | |
---|
| 139 | /*************************************************************** |
---|
| 140 | * |
---|
[512a2b] | 141 | * Comparisons: they are all done without regarding coeffs |
---|
[a6a239] | 142 | * |
---|
| 143 | ***************************************************************/ |
---|
| 144 | // returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering |
---|
| 145 | #define pLmCmp(p,q) p_LmCmp(p,q,currRing) |
---|
| 146 | // executes axtionE|actionG|actionS if p=q|p>q|p<q w.r.t monomial ordering |
---|
| 147 | // action should be a "goto ..." |
---|
| 148 | #define pLmCmpAction(p,q, actionE, actionG, actionS) \ |
---|
| 149 | _p_LmCmpAction(p,q,currRing, actionE, actionG,actionS) |
---|
| 150 | |
---|
[512a2b] | 151 | #define pLmEqual(p1, p2) pExpVectorEqual(p1, p2) |
---|
[a6a239] | 152 | |
---|
| 153 | // pCmp: args may be NULL |
---|
| 154 | // returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) |
---|
| 155 | #define pCmp(p1, p2) p_Cmp(p1, p2, currRing) |
---|
| 156 | |
---|
[e10683] | 157 | |
---|
[a6a239] | 158 | /*************************************************************** |
---|
| 159 | * |
---|
[e10683] | 160 | * Divisiblity tests, args must be != NULL, except for |
---|
[a6a239] | 161 | * pDivisbleBy |
---|
| 162 | * |
---|
| 163 | ***************************************************************/ |
---|
| 164 | // returns TRUE, if leading monom of a divides leading monom of b |
---|
[e10683] | 165 | // i.e., if there exists a expvector c > 0, s.t. b = a + c; |
---|
[a6a239] | 166 | #define pDivisibleBy(a, b) p_DivisibleBy(a,b,currRing) |
---|
[512a2b] | 167 | // like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL |
---|
| 168 | #define pLmDivisibleBy(a,b) p_LmDivisibleBy(a,b,currRing) |
---|
| 169 | // like pLmDivisibleBy, does not check components |
---|
| 170 | #define pLmDivisibleByNoComp(a, b) p_LmDivisibleByNoComp(a,b,currRing) |
---|
[a6a239] | 171 | // Divisibility tests based on Short Exponent vectors |
---|
| 172 | // sev_a == pGetShortExpVector(a) |
---|
| 173 | // not_sev_b == ~ pGetShortExpVector(b) |
---|
[512a2b] | 174 | #define pLmShortDivisibleBy(a, sev_a, b, not_sev_b) \ |
---|
| 175 | p_LmShortDivisibleBy(a, sev_a, b, not_sev_b, currRing) |
---|
[a6a239] | 176 | // returns the "Short Exponent Vector" -- used to speed up divisibility |
---|
| 177 | // tests (see polys-impl.cc ) |
---|
| 178 | #define pGetShortExpVector(a) p_GetShortExpVector(a, currRing) |
---|
| 179 | |
---|
| 180 | /*************************************************************** |
---|
| 181 | * |
---|
| 182 | * Copying/Deleteion of polys: args may be NULL |
---|
| 183 | * |
---|
| 184 | ***************************************************************/ |
---|
| 185 | // return a copy of the poly |
---|
| 186 | #define pCopy(p) p_Copy(p, currRing) |
---|
| 187 | #define pDelete(p_ptr) p_Delete(p_ptr, currRing) |
---|
| 188 | |
---|
| 189 | /*************************************************************** |
---|
| 190 | * |
---|
| 191 | * Copying/Deleteion of polys: args may be NULL |
---|
| 192 | * - p/q as arg mean a poly |
---|
| 193 | * - m a monomial |
---|
| 194 | * - n a number |
---|
| 195 | * - pp (resp. qq, mm, nn) means arg is constant |
---|
| 196 | * - p (resp, q, m, n) means arg is destroyed |
---|
| 197 | * |
---|
| 198 | ***************************************************************/ |
---|
| 199 | #define pNeg(p) p_Neg(p, currRing) |
---|
| 200 | #define ppMult_nn(p, n) pp_Mult_nn(p, n, currRing) |
---|
| 201 | #define pMult_nn(p, n) p_Mult_nn(p, n, currRing) |
---|
| 202 | #define ppMult_mm(p, m) pp_Mult_mm(p, m, currRing) |
---|
| 203 | #define pMult_mm(p, m) p_Mult_mm(p, m, currRing) |
---|
| 204 | #define pAdd(p, q) p_Add_q(p, q, currRing) |
---|
| 205 | #define pMinus_mm_Mult_qq(p, m, q) p_Minus_mm_Mult_qq(p, m, q, currRing) |
---|
| 206 | #define pPlus_mm_Mult_qq(p, m, q) p_Plus_mm_Mult_qq(p, m, q, currRing) |
---|
| 207 | #define pMult(p, q) p_Mult_q(p, q, currRing) |
---|
| 208 | #define ppMult_qq(p, q) pp_Mult_qq(p, q, currRing) |
---|
[1aa55bf] | 209 | // p*Coeff(m) for such monomials pm of p, for which m is divisble by pm |
---|
| 210 | #define ppMult_Coeff_mm_DivSelect(p, m) pp_Mult_Coeff_mm_DivSelect(p, m, currRing) |
---|
[2f436b] | 211 | /************************************************************************* |
---|
| 212 | * |
---|
| 213 | * Sort routines |
---|
| 214 | * |
---|
| 215 | *************************************************************************/ |
---|
| 216 | // sorts p, assumes all monomials in p are different |
---|
| 217 | #define pSortMerger(p) pSort(p) |
---|
| 218 | #define pSort(p) p_SortMerge(p, currRing) |
---|
| 219 | |
---|
| 220 | // sorts p, p may have equal monomials |
---|
| 221 | #define pSortAdd(p) p_SortAdd(p, currRing) |
---|
| 222 | |
---|
| 223 | |
---|
[de90196] | 224 | // Assume: If considerd only as poly in any component of p |
---|
| 225 | // (say, monomials of other components of p are set to 0), |
---|
| 226 | // then p is already sorted correctly |
---|
[2f436b] | 227 | #define pSortCompCorrect(p) pSort(p) |
---|
| 228 | |
---|
[c5f4b9] | 229 | /*************************************************************** |
---|
| 230 | * |
---|
| 231 | * Predicates on polys/Lm's |
---|
| 232 | * |
---|
| 233 | ***************************************************************/ |
---|
[2f436b] | 234 | // return true if all p is eihter NULL, or if all exponents |
---|
| 235 | // of p are 0 and Comp of p is zero |
---|
| 236 | #define pIsConstantComp(p) p_IsConstantComp(p, currRing) |
---|
| 237 | // like above, except that Comp might be != 0 |
---|
| 238 | #define pIsConstant(p) p_IsConstant(p,currRing) |
---|
[d609e1] | 239 | // return true if the Lm is a constant <>0 |
---|
| 240 | #define pIsUnit(p) p_IsUnit(p,currRing) |
---|
[2f436b] | 241 | // like above, except that p must be != NULL |
---|
| 242 | #define pLmIsConstantComp(p) p_LmIsConstantComp(p, currRing) |
---|
| 243 | #define pLmIsConstant(p) p_LmIsConstant(p,currRing) |
---|
| 244 | |
---|
| 245 | // return TRUE if all monomials of p are constant |
---|
| 246 | #define pIsConstantPoly(p) p_IsConstantPoly(p, currRing) |
---|
| 247 | |
---|
| 248 | #define pIsPurePower(p) p_IsPurePower(p, currRing) |
---|
| 249 | #define pIsVector(p) (pGetComp(p)>0) |
---|
[c5f4b9] | 250 | |
---|
[a6a239] | 251 | |
---|
| 252 | /*************************************************************** |
---|
| 253 | * |
---|
| 254 | * Old stuff |
---|
| 255 | * |
---|
| 256 | ***************************************************************/ |
---|
| 257 | |
---|
[416465] | 258 | #define pFetchCopy(r,p) _pFetchCopy(r,p) |
---|
| 259 | // Similar to pFetchCopy, except that poly p is deleted |
---|
| 260 | #define pFetchCopyDelete(r, p) _pFetchCopyDelete(r, p) |
---|
[0e1846] | 261 | |
---|
[51c163] | 262 | typedef poly* polyset; |
---|
[0e1846] | 263 | extern int pVariables; |
---|
| 264 | extern int pOrdSgn; |
---|
| 265 | extern BOOLEAN pLexOrder; |
---|
| 266 | extern poly ppNoether; |
---|
[6a6dccc] | 267 | extern BOOLEAN pVectorOut; |
---|
[0e1846] | 268 | |
---|
[51c163] | 269 | /*-------------predicate on polys ----------------------*/ |
---|
[0e1846] | 270 | BOOLEAN pHasNotCF(poly p1, poly p2); /*has no common factor ?*/ |
---|
| 271 | void pSplit(poly p, poly * r); /*p => IN(p), r => REST(p) */ |
---|
[a6a239] | 272 | |
---|
[51c163] | 273 | |
---|
[0e1846] | 274 | |
---|
| 275 | /*-------------ring management:----------------------*/ |
---|
[a9a7be] | 276 | //extern void pChangeRing(ring newRing); |
---|
[47faf56] | 277 | extern void pSetGlobals(ring r, BOOLEAN complete = TRUE); |
---|
[24d587] | 278 | // resets the pFDeg and pLDeg: if pLDeg is not given, it is |
---|
| 279 | // set to currRing->pLDegOrig, i.e. to the respective LDegProc which |
---|
| 280 | // only uses pFDeg (and not pDeg, or pTotalDegree, etc). |
---|
| 281 | // If you use this, make sure your procs does not make any assumptions |
---|
| 282 | // on oredering and/or OrdIndex -- otherwise they might return wrong results |
---|
| 283 | // on strat->tailRing |
---|
| 284 | extern void pSetDegProcs(pFDegProc new_FDeg, pLDegProc new_lDeg = NULL); |
---|
[de90196] | 285 | // restores pFDeg and pLDeg: |
---|
[24d587] | 286 | extern void pRestoreDegProcs(pFDegProc old_FDeg, pLDegProc old_lDeg); |
---|
[0e1846] | 287 | |
---|
| 288 | /*-----------the ordering of monomials:-------------*/ |
---|
[a6a239] | 289 | #define pSetm(p) p_Setm(p, currRing) |
---|
[cb66fa] | 290 | // TODO: |
---|
| 291 | #define pSetmComp pSetm |
---|
| 292 | |
---|
[47bc1c] | 293 | /*************************************************************** |
---|
| 294 | * |
---|
| 295 | * Degree stuff -- see p_polys.cc for explainations |
---|
| 296 | * |
---|
| 297 | ***************************************************************/ |
---|
[0e1846] | 298 | extern pLDegProc pLDeg; |
---|
| 299 | extern pFDegProc pFDeg; |
---|
[4e6cf2] | 300 | int pWeight(int c, ring r = currRing); |
---|
| 301 | long pDeg(poly p, ring r = currRing); |
---|
| 302 | long pTotaldegree(poly p, ring r = currRing); |
---|
| 303 | long pWTotaldegree(poly p, ring r = currRing); |
---|
| 304 | long pWDegree(poly p, ring r = currRing); |
---|
| 305 | long pLDeg0(poly p,int *l, ring r = currRing); |
---|
| 306 | long pLDeg0c(poly p,int *l, ring r = currRing); |
---|
| 307 | long pLDegb(poly p,int *l, ring r = currRing); |
---|
| 308 | long pLDeg1(poly p,int *l, ring r = currRing); |
---|
| 309 | long pLDeg1c(poly p,int *l, ring r = currRing); |
---|
[5038cd] | 310 | long pLDeg1_Deg(poly p,int *l, ring r = currRing); |
---|
| 311 | long pLDeg1c_Deg(poly p,int *l, ring r = currRing); |
---|
| 312 | long pLDeg1_Totaldegree(poly p,int *l, ring r = currRing); |
---|
| 313 | long pLDeg1c_Totaldegree(poly p,int *l, ring r = currRing); |
---|
[24d587] | 314 | long pLDeg1_WFirstTotalDegree(poly p,int *l, ring r=currRing); |
---|
| 315 | long pLDeg1c_WFirstTotalDegree(poly p,int *l, ring r=currRing); |
---|
[0e1846] | 316 | |
---|
| 317 | /*-------------pComp for syzygies:-------------------*/ |
---|
| 318 | |
---|
| 319 | void pSetModDeg(intvec *w); |
---|
| 320 | |
---|
[a6a239] | 321 | |
---|
| 322 | |
---|
[0e1846] | 323 | |
---|
[e10683] | 324 | poly pmInit(char *s, BOOLEAN &ok); /* monom -> poly, interpreter */ |
---|
| 325 | char * p_Read(char *s, poly &p, ring r); /* monom -> poly */ |
---|
[0e1846] | 326 | void ppDelete(poly * a, ring r); |
---|
| 327 | |
---|
| 328 | /*-------------operations on polynomials:------------*/ |
---|
| 329 | poly pSub(poly a, poly b); |
---|
[55b8ae] | 330 | poly pPower(poly p, int i); |
---|
[9d72fe] | 331 | |
---|
| 332 | // ----------------- define to enable new p_procs -----*/ |
---|
[0e1846] | 333 | |
---|
| 334 | poly pDivide(poly a, poly b); |
---|
| 335 | poly pDivideM(poly a, poly b); |
---|
| 336 | void pLcm(poly a, poly b, poly m); |
---|
| 337 | poly pDiff(poly a, int k); |
---|
| 338 | poly pDiffOp(poly a, poly b,BOOLEAN multiply); |
---|
| 339 | |
---|
[9adbf8] | 340 | #define pMaxComp(p) p_MaxComp(p, currRing) |
---|
| 341 | #define pMinComp(p) p_MinComp(p, currRing) |
---|
| 342 | int pMaxCompProc(poly p); |
---|
| 343 | |
---|
[e10683] | 344 | #define pOneComp(p) p_OneComp(p, currRing) |
---|
[a6a239] | 345 | #define pSetCompP(a,i) p_SetCompP(a, i, currRing) |
---|
[0e1846] | 346 | |
---|
[beb237] | 347 | // let's inline those, so that we can call them from the debugger |
---|
| 348 | inline char* pString(poly p) {return p_String(p, currRing, currRing);} |
---|
| 349 | inline char* pString0(poly p) {return p_String0(p, currRing, currRing);} |
---|
[4e6cf2] | 350 | inline void pWrite(poly p) {p_Write(p, currRing, currRing);} |
---|
| 351 | inline void pWrite0(poly p) {p_Write0(p, currRing, currRing);} |
---|
| 352 | inline void wrp(poly p) {p_wrp(p, currRing, currRing);} |
---|
[0e1846] | 353 | |
---|
| 354 | void pEnlargeSet(polyset *p, int length, int increment); |
---|
[a1ecc18] | 355 | #define pISet(i) p_ISet(i,currRing) |
---|
[de90196] | 356 | #define pNSet(n) p_NSet(n,currRing) |
---|
[954622] | 357 | #define pOne() pISet(1) |
---|
[0e1846] | 358 | |
---|
| 359 | void pContent(poly p); |
---|
| 360 | void pCleardenom(poly p); |
---|
[fdd95ca] | 361 | void pNormalize(poly p); |
---|
[0e1846] | 362 | |
---|
[e9ad8a6] | 363 | // homogenizes p by multiplying certain powers of the varnum-th variable |
---|
[0e1846] | 364 | poly pHomogen (poly p, int varnum); |
---|
[e9ad8a6] | 365 | |
---|
[e78cce] | 366 | // replaces the maximal powers of the leading monomial of p2 in p1 by |
---|
| 367 | // the same powers of n, utility for dehomogenization |
---|
[0e1846] | 368 | poly pDehomogen (poly p1,poly p2,number n); |
---|
| 369 | BOOLEAN pIsHomogeneous (poly p); |
---|
[e78cce] | 370 | |
---|
| 371 | // returns the leading monomial of p1 divided by the maximal power of |
---|
| 372 | // that of p2 |
---|
[0e1846] | 373 | poly pDivByMonom (poly p1,poly p2); |
---|
[e78cce] | 374 | |
---|
| 375 | // Returns as i-th entry of P the coefficient of the (i-1) power of |
---|
| 376 | // the leading monomial of p2 in p1 |
---|
[0e1846] | 377 | void pCancelPolyByMonom (poly p1,poly p2,polyset * P,int * SizeOfSet); |
---|
[e78cce] | 378 | |
---|
[4508ce5] | 379 | poly pPermPoly (poly p, int * perm, ring OldRing, nMapFunc nMap, |
---|
[e78cce] | 380 | int *par_perm=NULL, int OldPar=0); |
---|
[0e1846] | 381 | |
---|
| 382 | /*BOOLEAN pVectorHasUnitM(poly p, int * k);*/ |
---|
| 383 | BOOLEAN pVectorHasUnitB(poly p, int * k); |
---|
| 384 | void pVectorHasUnit(poly p, int * k, int * len); |
---|
| 385 | poly pTakeOutComp1(poly * p, int k); |
---|
[a9a7be] | 386 | // Splits *p into two polys: *q which consists of all monoms with |
---|
[8c8bea] | 387 | // component == comp and *p of all other monoms *lq == pLength(*q) |
---|
[4e6cf2] | 388 | // On return all components pf *q == 0 |
---|
[8c8bea] | 389 | void pTakeOutComp(poly *p, Exponent_t comp, poly *q, int *lq); |
---|
| 390 | // Similar to pTakeOutComp, except that only those components are |
---|
| 391 | // taken out whose Order == order |
---|
| 392 | // ASSUME: monomial ordering is Order compatible, i.e., if m1, m2 Monoms then |
---|
| 393 | // m1 >= m2 ==> pGetOrder(m1) >= pGetOrder(m2) |
---|
| 394 | void pDecrOrdTakeOutComp(poly *p, Exponent_t comp, Order_t order, |
---|
| 395 | poly *q, int *lq); |
---|
[a9a7be] | 396 | // This is something weird -- Don't use it, unless you know what you are doing |
---|
[8c8bea] | 397 | poly pTakeOutComp(poly * p, int k); |
---|
[d14712] | 398 | void pSetPolyComp(poly p, int comp); |
---|
[0e1846] | 399 | void pDeleteComp(poly * p,int k); |
---|
| 400 | void pNorm(poly p); |
---|
| 401 | poly pSubst(poly p, int n, poly e); |
---|
[d609e1] | 402 | poly ppJet(poly p, int m); |
---|
[0e1846] | 403 | poly pJet(poly p, int m); |
---|
[d609e1] | 404 | poly ppJetW(poly p, int m, short * iv); |
---|
[2d19a1b] | 405 | int pMinDegW(poly p,intvec *w); |
---|
[d609e1] | 406 | poly pSeries(int n,poly p,poly u=NULL); |
---|
| 407 | poly pInvers(int n, poly p); |
---|
[e1af45] | 408 | // maximum weigthed degree of all monomials of p, w is indexed from |
---|
| 409 | // 1..pVariables |
---|
[0e1846] | 410 | int pDegW(poly p, short *w); |
---|
| 411 | |
---|
| 412 | /*-----------type conversions ----------------------------*/ |
---|
| 413 | poly pPolys2Vec(polyset p, int len); |
---|
| 414 | void pVec2Polys(poly v, polyset *p, int *len); |
---|
| 415 | int pVar(poly m); |
---|
| 416 | |
---|
[51c163] | 417 | /*-----------specials for spoly-computations--------------*/ |
---|
[0e1846] | 418 | BOOLEAN pCompareChain (poly p,poly p1,poly p2,poly lcm); |
---|
| 419 | BOOLEAN pEqualPolys(poly p1,poly p2); |
---|
| 420 | BOOLEAN pComparePolys(poly p1,poly p2); |
---|
| 421 | |
---|
| 422 | |
---|
[d14712] | 423 | |
---|
[cb66fa] | 424 | /*************************************************************** |
---|
| 425 | * |
---|
| 426 | * PDEBUG stuff |
---|
| 427 | * |
---|
| 428 | ***************************************************************/ |
---|
[0e1846] | 429 | #ifdef PDEBUG |
---|
[cb66fa] | 430 | #define pTest(p) _p_Test(p, currRing, PDEBUG) |
---|
| 431 | #define pLmTest(p) _p_LmTest(p, currRing, PDEBUG) |
---|
| 432 | |
---|
| 433 | #else // ! PDEBUG |
---|
| 434 | |
---|
| 435 | #define pTest(p) ((void)0) |
---|
| 436 | #define pLmTest(p) ((void)0) |
---|
[0e1846] | 437 | #endif |
---|
[55b8ae] | 438 | |
---|
[cb66fa] | 439 | #endif // POLYS_H |
---|