36 poly
p_Farey(poly
p, number
N,
const ring r);
71 poly
p_One(
const ring r);
75 long p_DegW(poly
p,
const short *
w,
const ring
R);
91 poly
p_ISet(
long i,
const ring r);
94 poly
p_NSet(number n,
const ring r);
124 poly
p_Sub(poly a, poly
b,
const ring r);
126 poly
p_Power(poly
p,
int i,
const ring r);
156 #define pIfThen(cond, check) do {if (cond) {check;}} while (0) 162 #define p_Test(p,r) _p_Test(p, r, PDEBUG) 163 #define p_LmTest(p,r) _p_LmTest(p, r, PDEBUG) 164 #define pp_Test(p, lmRing, tailRing) _pp_Test(p, lmRing, tailRing, PDEBUG) 168 #define pIsMonomOf(p, q) (TRUE) 169 #define pHaveCommonMonoms(p, q) (TRUE) 170 #define p_LmCheckIsFromRing(p,r) (TRUE) 171 #define p_LmCheckPolyRing(p,r) (TRUE) 172 #define p_CheckIsFromRing(p,r) (TRUE) 173 #define p_CheckPolyRing(p,r) (TRUE) 174 #define p_CheckRing(r) (TRUE) 175 #define P_CheckIf(cond, check) (TRUE) 177 #define p_Test(p,r) (TRUE) 178 #define p_LmTest(p,r) (TRUE) 179 #define pp_Test(p, lmRing, tailRing) (TRUE) 204 poly
p_Last(
const poly a,
int &
l,
const ring r);
208 void p_Norm(poly p1,
const ring r);
224 int p_Size( poly
p,
const ring r );
227 poly
p_Homogen (poly
p,
int varnum,
const ring r);
232 static inline void p_Setm(poly
p,
const ring r)
240 poly
p_Subst(poly
p,
int n, poly e,
const ring r);
243 #define p_SetmComp p_Setm 246 static inline unsigned long p_SetComp(poly
p,
unsigned long c, ring r)
280 static inline void p_SetCompP(poly
p,
int i, ring lmRing, ring tailRing)
291 static inline long p_MaxComp(poly
p, ring lmRing, ring tailRing)
295 if(p==
NULL)
return 0;
304 if (i>result) result =
i;
312 static inline long p_MinComp(poly
p, ring lmRing, ring tailRing)
316 if(p==
NULL)
return 0;
325 if (i<result) result =
i;
360 void p_String0(poly
p, ring lmRing, ring tailRing);
361 char*
p_String(poly
p, ring lmRing, ring tailRing);
362 void p_Write(poly
p, ring lmRing, ring tailRing);
363 void p_Write0(poly
p, ring lmRing, ring tailRing);
364 void p_wrp(poly
p, ring lmRing, ring tailRing);
379 static inline long p_FDeg(
const poly
p,
const ring r) {
return r->pFDeg(p,r); }
380 static inline long p_LDeg(
const poly
p,
int *
l,
const ring r) {
return r->pLDeg(p,l,r); }
402 long p_Deg(poly a,
const ring r);
423 if (r->typ==
NULL)
return ((p)->
exp[r->pOrdIndex]);
427 switch(r->typ[i].ord_typ)
440 return ((p)->
exp[r->pOrdIndex]);
446 static inline unsigned long p_AddComp(poly
p,
unsigned long v, ring r)
452 static inline unsigned long p_SubComp(poly
p,
unsigned long v, ring r)
460 #ifndef HAVE_EXPSIZES 468 static inline long p_GetExp(
const poly
p,
const unsigned long iBitmask,
const int VarOffset)
470 pAssume2((VarOffset >> (24 + 6)) == 0);
472 int pos=(VarOffset & 0xffffff);
473 int bitpos=(VarOffset >> 24);
474 unsigned long exp=(p->exp[pos] >> bitmask) & iBitmask;
478 ((p->exp[(VarOffset & 0xffffff)] >> (VarOffset >> 24))
487 static inline unsigned long p_SetExp(poly
p,
const unsigned long e,
const unsigned long iBitmask,
const int VarOffset)
491 pAssume2((VarOffset >> (24 + 6)) == 0);
494 REGISTER int shift = VarOffset >> 24;
495 unsigned long ee = e << shift ;
499 p->exp[
offset] &= ~( iBitmask << shift );
506 #else // #ifdef HAVE_EXPSIZES // EXPERIMENTAL!!! 508 static inline unsigned long BitMask(
unsigned long bitmask,
int twobits)
514 static const unsigned long _bitmasks[4] = {-1, 0x7fff, 0x7f, 0x3};
515 return bitmask & _bitmasks[twobits];
520 static inline long p_GetExp(
const poly
p,
const unsigned long iBitmask,
const int VarOffset)
522 int pos =(VarOffset & 0xffffff);
523 int hbyte= (VarOffset >> 24);
524 int bitpos = hbyte & 0x3f;
525 long bitmask = BitMask(iBitmask, hbyte >> 6);
527 long exp=(
p->exp[pos] >> bitpos) & bitmask;
532 static inline long p_SetExp(poly
p,
const long e,
const unsigned long iBitmask,
const int VarOffset)
535 pAssume2(e <= BitMask(iBitmask, VarOffset >> 30));
538 REGISTER int hbyte = VarOffset >> 24;
539 int bitmask = BitMask(iBitmask, hbyte >> 6);
541 long ee = e << shift;
545 p->exp[
offset] &= ~( bitmask << shift );
551 #endif // #ifndef HAVE_EXPSIZES 554 static inline long p_GetExp(
const poly
p,
const ring r,
const int VarOffset)
558 return p_GetExp(p, r->bitmask, VarOffset);
561 static inline long p_SetExp(poly
p,
const long e,
const ring r,
const int VarOffset)
565 return p_SetExp(p, e, r->bitmask, VarOffset);
571 static inline long p_GetExp(
const poly
p,
const int v,
const ring r)
576 return p_GetExp(p, r->bitmask, r->VarOffset[v]);
581 static inline long p_SetExp(poly
p,
const int v,
const long e,
const ring r)
586 return p_SetExp(p, e, r->bitmask, r->VarOffset[v]);
660 #if (OM_TRACK > 2) && defined(OM_TRACK_CUSTOM) 661 static inline poly
p_New(
const ring r,
omBin bin)
676 return p_New(r, r->PolyBin);
680 static inline void p_LmFree(poly
p, ring r)
689 static inline void p_LmFree(poly *p, ring r)
706 poly pnext =
pNext(p);
727 poly pnext =
pNext(p);
740 unsigned long p_GetMaxExpL(poly p,
const ring r,
unsigned long l_max = 0);
746 static inline unsigned long p_GetMaxExp(
const unsigned long l,
const ring r)
748 unsigned long bitmask = r->bitmask;
749 unsigned long max = (l & bitmask);
750 unsigned long j = r->ExpPerLong - 1;
754 unsigned long i = r->BitsPerExp;
758 e = ((l >>
i) & bitmask);
759 if ((
unsigned long) e >
max)
769 static inline unsigned long p_GetMaxExp(
const poly p,
const ring r)
774 static inline unsigned long 777 const unsigned long bitmask = r->bitmask;
778 unsigned long sum = (l & bitmask);
779 unsigned long j = number_of_exps - 1;
783 unsigned long i = r->BitsPerExp;
786 sum += ((l >>
i) & bitmask);
807 return r->p_Procs->p_Copy(p, r);
811 static inline poly
p_Copy(poly p,
const ring r)
824 static inline poly
p_Head(poly p,
const ring r)
831 memcpy(np->exp, p->exp, r->ExpL_Size*
sizeof(
long));
838 static inline poly
p_Copy(poly p,
const ring lmRing,
const ring tailRing)
843 if (tailRing == lmRing)
846 poly pres =
p_Head(p, lmRing);
860 if ((*p)!=
NULL) r->p_Procs->p_Delete(p, r);
863 static inline void p_Delete(poly *p,
const ring lmRing,
const ring tailRing)
869 if (tailRing == lmRing)
887 return r->p_Procs->p_ShallowCopyDelete(p, r, bin);
891 static inline poly
p_Add_q(poly p, poly q,
const ring r)
894 if (q==
NULL)
return p;
895 if (p==
NULL)
return q;
897 return r->p_Procs->p_Add_q(p, q, shorter, r);
901 static inline poly
p_Add_q(poly p, poly q,
int &lp,
int lq,
const ring r)
904 if (q==
NULL)
return p;
905 if (p==
NULL) { lp=lq;
return q; }
907 poly
res = r->p_Procs->p_Add_q(p, q, shorter, r);
913 static inline poly
p_Mult_nn(poly p, number n,
const ring r)
924 return r->p_Procs->p_Mult_nn(p, n, r);
926 #define __p_Mult_nn(p,n,r) r->p_Procs->p_Mult_nn(p, n, r) 928 static inline poly
p_Mult_nn(poly p, number n,
const ring lmRing,
933 if (lmRing == tailRing)
936 poly pnext =
pNext(p);
938 p = lmRing->p_Procs->p_Mult_nn(p, n, lmRing);
941 pNext(p) = tailRing->p_Procs->p_Mult_nn(pnext, n, tailRing);
947 static inline poly
pp_Mult_nn(poly p, number n,
const ring r)
955 return r->p_Procs->pp_Mult_nn(p, n, r);
957 #define __pp_Mult_nn(p,n,r) r->p_Procs->pp_Mult_nn(p, n, r) 964 int i = r->VarL_Size - 1;
968 if (p->exp[r->VarL_Offset[i]] != 0)
992 return r->p_Procs->pp_Mult_mm(p, m, r);
1002 return r->p_Procs->p_Mult_mm(p, m, r);
1006 const poly spNoether,
const ring r)
1009 const poly
res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, spNoether, r);
1020 return r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter,
NULL, r);
1028 return r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1036 poly
pp = r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
1042 static inline poly
p_Neg(poly p,
const ring r)
1044 return r->p_Procs->p_Neg(p, r);
1047 extern poly
_p_Mult_q(poly p, poly q,
const int copy,
const ring r);
1049 static inline poly
p_Mult_q(poly p, poly q,
const ring r)
1066 q = r->p_Procs->p_mm_Mult(q, p, r);
1073 p = r->p_Procs->p_Mult_mm(p, q, r);
1092 return r->p_Procs->pp_mm_Mult(q, p, r);
1097 return r->p_Procs->pp_Mult_mm(p, q, r);
1130 number n_neg =
n_Copy(n_old, r->cf);
1133 res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter,
NULL, r);
1134 lp = (lp + lq) - shorter;
1150 return r->p_Procs->p_Merge_q(p, q, r);
1177 return p_String(p, p_ring, p_ring);
1191 static inline void p_wrp(poly p, ring p_ring)
1193 p_wrp(p, p_ring, p_ring);
1199 #define _p_LmCmpAction(p, q, r, actionE, actionG, actionS) \ 1202 int _cmp = p_LmCmp(p,q,r); \ 1203 if (_cmp == 0) actionE; \ 1204 if (_cmp == 1) actionG; \ 1211 #define _p_LmCmpAction(p, q, r, actionE, actionG, actionS) \ 1212 p_MemCmp_LengthGeneral_OrdGeneral(p->exp, q->exp, r->CmpL_Size, r->ordsgn, \ 1213 actionE, actionG, actionS) 1217 #define pDivAssume(x) do {} while (0) 1229 if (r->NegWeightL_Offset !=
NULL)
1231 for (
int i=r->NegWeightL_Size-1;
i>=0;
i--)
1239 if (r->NegWeightL_Offset !=
NULL)
1241 for (
int i=r->NegWeightL_Size-1;
i>=0;
i--)
1252 memcpy(d_p->exp, s_p->exp, r->ExpL_Size*
sizeof(
long));
1267 return p_Init(r, r->PolyBin);
1276 memcpy(np->exp, p->exp, r->ExpL_Size*
sizeof(
long));
1281 static inline poly
p_LmInit(poly s_p,
const ring s_r,
const ring d_r,
omBin d_bin)
1286 poly d_p =
p_Init(d_r, d_bin);
1287 for (
unsigned i=d_r->N;
i!=0;
i--)
1298 static inline poly
p_LmInit(poly s_p,
const ring s_r,
const ring d_r)
1301 return p_LmInit(s_p, s_r, d_r, d_r->PolyBin);
1314 memcpy(np->exp, p->exp, r->ExpL_Size*
sizeof(
long));
1332 poly new_p =
p_New(r);
1333 memcpy(new_p->exp, p->exp, r->ExpL_Size*
sizeof(
long));
1351 for (
int i=1;
i<=r->N;
i++)
1366 for (
int i=1;
i<=r->N;
i++)
1380 for (
int i=1;
i<=r->N;
i++)
1397 for (
int i=1;
i<=r->N;
i++)
1415 for (
int i=1;
i<=r->N;
i++)
1429 unsigned i = r->ExpL_Size;
1430 unsigned long *ep = p1->exp;
1431 unsigned long *eq = p2->exp;
1436 if (ep[i] != eq[i])
return FALSE;
1448 for (
unsigned i=r->VarL_Size-1;
i!=0;
i--)
1458 for (
unsigned j = r->N;
j!=0;
j--)
1467 for (
unsigned j = r->N;
j!=0;
j--)
1473 for (
unsigned j = r->N;
j!=0;
j--)
1483 for (
unsigned j = r->N;
j!=0;
j--)
1496 static inline int p_LmCmp(poly p, poly q,
const ring r)
1501 const unsigned long* _s1 = ((
unsigned long*) p->exp);
1502 const unsigned long* _s2 = ((
unsigned long*) q->exp);
1505 const unsigned long _l = r->CmpL_Size;
1509 LengthGeneral_OrdGeneral_LoopTop:
1515 if (_i == _l)
return 0;
1516 goto LengthGeneral_OrdGeneral_LoopTop;
1518 const long* _ordsgn = (
long*) r->ordsgn;
1524 return -(_ordsgn[_i]);
1528 if (_ordsgn[_i] == 1)
return 1;
1531 if (_ordsgn[_i] == 1)
return -1;
1537 static inline int p_LtCmp(poly p, poly q,
const ring r)
1620 return(
p_LtCmp(p,q,r) == -r->OrdSgn);
1629 return(
p_LtCmp(p,q,r) == r->OrdSgn);
1643 #define p_LmCmpAction(p, q, r, actionE, actionG, actionS) \ 1644 _p_LmCmpAction(p, q, r, actionE, actionG, actionS) 1647 #define p_LmEqual(p1, p2, r) p_ExpVectorEqual(p1, p2, r) 1651 static inline int p_Cmp(poly p1, poly p2, ring r)
1655 if (p1==
NULL)
return 0;
1667 if (p1==
NULL)
return 0;
1691 int i=r->VarL_Size - 1;
1692 unsigned long divmask = r->divmask;
1693 unsigned long la, lb;
1695 if (r->VarL_LowIndex >= 0)
1697 i += r->VarL_LowIndex;
1703 (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1710 while (i>=r->VarL_LowIndex);
1716 la = a->exp[r->VarL_Offset[
i]];
1717 lb = b->exp[r->VarL_Offset[
i]];
1719 (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask)))
1758 #ifdef HAVE_RATGRING 1854 poly
b,
unsigned long not_sev_b,
const ring r)
1862 if (sev_a & not_sev_b)
1874 poly
b,
unsigned long not_sev_b,
const ring r)
1882 if (sev_a & not_sev_b)
1894 poly
b,
unsigned long not_sev_b,
const ring r_b)
1902 if (sev_a & not_sev_b)
1967 unsigned long l1, l2, divmask = r->divmask;
1970 for (i=0; i<r->VarL_Size; i++)
1972 l1 = p1->exp[r->VarL_Offset[
i]];
1973 l2 = p2->exp[r->VarL_Offset[
i]];
1975 if ( (l1 > ULONG_MAX - l2) ||
1976 (((l1 & divmask) ^ (l2 & divmask)) != ((l1 + l2) & divmask)))
1981 void p_Split(poly p, poly * r);
1985 const char *
p_Read(
const char *s, poly &p,
const ring r);
1986 poly
p_MDivide(poly a, poly
b,
const ring r);
1987 poly
p_DivideM(poly a, poly b,
const ring r);
1988 poly
p_Div_nn(poly p,
const number n,
const ring r);
1991 void p_Lcm(
const poly a,
const poly b, poly
m,
const ring r);
1993 poly
p_Lcm(
const poly a,
const poly b,
const ring r);
1995 #ifdef HAVE_RATGRING 1996 poly
p_LcmRat(
const poly a,
const poly b,
const long lCompM,
const ring r);
2003 poly
p_Diff(poly a,
int k,
const ring r);
2020 poly
p_PolyDiv(poly &p,
const poly divisor,
const BOOLEAN needResult,
const ring r);
2052 poly
pp_Jet(poly p,
int m,
const ring
R);
2053 poly
p_Jet(poly p,
int m,
const ring R);
2054 poly
pp_JetW(poly p,
int m,
short *w,
const ring R);
2055 poly
p_JetW(poly p,
int m,
short *w,
const ring R);
2057 poly
n_PermNumber(
const number z,
const int *par_perm,
const int OldPar,
const ring src,
const ring dst);
2059 poly
p_PermPoly (poly p,
const int * perm,
const ring OldRing,
const ring dst,
2067 int p_Var(poly mi,
const ring r);
2069 int p_LowVar (poly p,
const ring r);
2073 void p_Shift (poly * p,
int i,
const ring r);
2076 int p_Compare(
const poly a,
const poly b,
const ring R);
2082 poly
p_Div_mm(poly p,
const poly m,
const ring r);
void p_ProjectiveUnique(poly p, const ring r)
poly p_MDivide(poly a, poly b, const ring r)
#define p_LmCheckPolyRing2(p, r)
poly p_JetW(poly p, int m, short *w, const ring R)
static poly p_SortMerge(poly p, const ring r, BOOLEAN revert=FALSE)
#define __p_GetComp(p, r)
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
poly p_Cleardenom(poly p, const ring r)
#define p_MemSum_LengthGeneral(r, s1, s2, length)
static int p_CmpPolys(poly p1, poly p2, ring r)
static unsigned long p_AddComp(poly p, unsigned long v, ring r)
const CanonicalForm int s
static void p_SetExpVL(poly p, int64 *ev, const ring r)
poly p_Farey(poly p, number N, const ring r)
static int p_LtCmpOrdSgnEqP(poly p, poly q, const ring r)
CFArray copy(const CFList &list)
write elements of list into an array
long pLDeg1c(poly p, int *l, ring r)
poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r)
general NC-multiplication without destruction
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
#define POLY_NEGWEIGHT_OFFSET
static int p_Cmp(poly p1, poly p2, ring r)
static poly p_LmDeleteAndNext(poly p, const ring r)
int p_LowVar(poly p, const ring r)
the minimal index of used variables - 1
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
const char * p_Read(const char *s, poly &p, const ring r)
static int p_LtCmpOrdSgnEqM(poly p, poly q, const ring r)
gmp_float exp(const gmp_float &a)
BOOLEAN pDebugLmShortDivisibleByNoComp(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
long p_WDegree(poly p, const ring r)
char * p_String(poly p, ring lmRing, ring tailRing)
void p_String0Long(const poly p, ring lmRing, ring tailRing)
print p in a long way
unsigned long p_GetShortExpVector(const poly a, const ring r)
poly n_PermNumber(const number z, const int *par_perm, const int OldPar, const ring src, const ring dst)
poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
Returns: p * q, Destroys: if !copy then p, q Assumes: pLength(p) >= 2 pLength(q) >=2.
static BOOLEAN p_LmDivisibleByNoComp(poly a, poly b, const ring r)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
static poly p_Mult_mm(poly p, poly m, const ring r)
static long p_IncrExp(poly p, int v, ring r)
poly p_LcmRat(const poly a, const poly b, const long lCompM, const ring r)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
BOOLEAN p_DebugLmDivisibleByNoComp(poly a, poly b, ring r)
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
static poly pp_Mult_nn(poly p, number n, const ring r)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
int p_GetVariables(poly p, int *e, const ring r)
set entry e[i] to 1 if var(i) occurs in p, ignore var(j) if e[j]>0 return #(e[i]>0) ...
static void p_GetExpV(poly p, int *ev, const ring r)
#define _pPolyAssume2(cond, p, r)
BOOLEAN p_VectorHasUnitB(poly p, int *k, const ring r)
static BOOLEAN p_IsUnit(const poly p, const ring r)
static BOOLEAN _p_LmDivisibleBy(poly a, poly b, const ring r)
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
void p_Vec2Polys(poly v, poly **p, int *len, const ring r)
long p_DegW(poly p, const short *w, const ring R)
poly pp_JetW(poly p, int m, short *w, const ring R)
static poly p_LmShallowCopyDelete(poly p, const ring r)
static poly pp_Mult_mm(poly p, poly m, const ring r)
void p_Lcm(const poly a, const poly b, poly m, const ring r)
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
static long p_Totaldegree(poly p, const ring r)
BOOLEAN _pp_Test(poly p, ring lmRing, ring tailRing, int level)
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
static void p_MemSub_NegWeightAdjust(poly p, const ring r)
void p_ShallowDelete(poly *p, const ring r)
BOOLEAN p_IsHomogeneous(poly p, const ring r)
#define omTypeAllocBin(type, addr, bin)
static long p_MultExp(poly p, int v, long ee, ring r)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
BOOLEAN pHaveCommonMonoms(poly p, poly q)
long pLDeg1c_Deg(poly p, int *l, ring r)
static number p_SetCoeff(poly p, number n, ring r)
void p_Split(poly p, poly *r)
long(* pLDegProc)(poly p, int *length, ring r)
static void p_LmFree(poly p, ring)
BOOLEAN pIsMonomOf(poly p, poly m)
poly p_DiffOp(poly a, poly b, BOOLEAN multiply, const ring r)
BOOLEAN p_ComparePolys(poly p1, poly p2, const ring r)
returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL
long p_WTotaldegree(poly p, const ring r)
void pEnlargeSet(poly **p, int length, int increment)
static void p_SetExpV(poly p, int *ev, const ring r)
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
poly p_Sub(poly a, poly b, const ring r)
static unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps)
static int p_LtCmpOrdSgnDiffP(poly p, poly q, const ring r)
static poly p_Copy(poly p, const ring r)
returns a copy of p
static long p_GetExpSum(poly p1, poly p2, int i, ring r)
static long p_SubExp(poly p, int v, long ee, ring r)
poly sBucketSortMerge(poly p, const ring r)
Sorts p with bucketSort: assumes all monomials of p are different.
poly p_Vec2Poly(poly v, int k, const ring r)
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static poly p_Copy_noCheck(poly p, const ring r)
returns a copy of p (without any additional testing)
poly p_DivideM(poly a, poly b, const ring r)
static BOOLEAN p_LmIsConstant(const poly p, const ring r)
poly nc_p_Plus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, const int, const ring r)
#define p_MemAddSub_LengthGeneral(r, s, t, length)
static poly p_SortAdd(poly p, const ring r, BOOLEAN revert=FALSE)
static BOOLEAN _p_LmDivisibleByNoComp(poly a, poly b, const ring r)
return: FALSE, if there exists i, such that a->exp[i] > b->exp[i] TRUE, otherwise (1) Consider long v...
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
BOOLEAN p_CheckPolyRing(poly p, ring r)
BOOLEAN p_HasNotCF(poly p1, poly p2, const ring r)
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
void p_Normalize(poly p, const ring r)
static poly p_Head(poly p, const ring r)
void p_Norm(poly p1, const ring r)
int p_Compare(const poly a, const poly b, const ring R)
poly p_Div_nn(poly p, const number n, const ring r)
BOOLEAN _p_Test(poly p, ring r, int level)
Coefficient rings, fields and other domains suitable for Singular polynomials.
BOOLEAN _p_LmTest(poly p, ring r, int level)
static int p_Comp_k_n(poly a, poly b, int k, ring r)
static void p_SetCompP(poly p, int i, ring r)
poly p_Subst(poly p, int n, poly e, const ring r)
const CanonicalForm CFMap CFMap & N
poly sBucketSortAdd(poly p, const ring r)
Sorts p with bucketSort: p may have equal monomials.
#define p_MemAdd_LengthGeneral(r, s, length)
long pLDeg1_Totaldegree(poly p, int *l, ring r)
#define p_MemDiff_LengthGeneral(r, s1, s2, length)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
static int max(int a, int b)
#define omFreeBinAddr(addr)
#define p_SetRingOfLm(p, r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static BOOLEAN p_IsConstant(const poly p, const ring r)
poly _nc_p_Mult_q(poly p, poly q, const ring r)
general NC-multiplication with destruction
void p_Content(poly p, const ring r)
void p_Vec2Array(poly v, poly *p, int len, const ring r)
julia: vector to already allocated array (len=p_MaxComp(v,r))
long pLDegb(poly p, int *l, ring r)
long pLDeg0c(poly p, int *l, ring r)
static poly pp_Mult_qq(poly p, poly q, const ring r)
long pLDeg1(poly p, int *l, ring r)
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg=NULL)
BOOLEAN p_HasNotCFRing(poly p1, poly p2, const ring r)
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
int p_Size(poly p, const ring r)
poly p_mInit(const char *s, BOOLEAN &ok, const ring r)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
static void p_MemAdd_NegWeightAdjust(poly p, const ring r)
poly p_PolyDiv(poly &p, const poly divisor, const BOOLEAN needResult, const ring r)
assumes that p and divisor are univariate polynomials in r, mentioning the same variable; assumes div...
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
void p_DeleteComp(poly *p, int k, const ring r)
static long p_FDeg(const poly p, const ring r)
static int p_LtCmpOrdSgnDiffM(poly p, poly q, const ring r)
static int p_LmCmp(poly p, poly q, const ring r)
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
long p_WFirstTotalDegree(poly p, ring r)
long pLDeg0(poly p, int *l, ring r)
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
poly p_TakeOutComp1(poly *p, int k, const ring r)
#define __pp_Mult_nn(p, n, r)
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
static BOOLEAN p_IsOne(const poly p, const ring R)
either poly(1) or gen(k)?!
int p_Weight(int c, const ring r)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
static BOOLEAN p_LmDivisibleByPart(poly a, poly b, const ring r, const int start, const int end)
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
static poly p_Mult_nn(poly p, number n, const ring r)
void(* p_SetmProc)(poly p, const ring r)
static BOOLEAN p_LmShortDivisibleByNoComp(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
#define p_LmCheckPolyRing1(p, r)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, ring r)
static long p_MinComp(poly p, ring lmRing, ring tailRing)
static long p_LDeg(const poly p, int *l, const ring r)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
void p_Cleardenom_n(poly p, const ring r, number &c)
static poly p_LmFreeAndNext(poly p, ring)
static unsigned pLength(poly a)
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
static poly pReverse(poly p)
poly p_Jet(poly p, int m, const ring R)
poly p_Power(poly p, int i, const ring r)
p_SetmProc p_GetSetmProc(const ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
poly p_Last(const poly a, int &l, const ring r)
static unsigned long p_SubComp(poly p, unsigned long v, ring r)
static BOOLEAN _p_LmDivisibleByPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
static long p_GetOrder(poly p, ring r)
#define rRing_has_Comp(r)
void p_Write0(poly p, ring lmRing, ring tailRing)
static void p_Delete(poly *p, const ring r)
const Variable & v
< [in] a sqrfree bivariate poly
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
poly p_Div_mm(poly p, const poly m, const ring r)
divide polynomial by monomial
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
poly p_GcdMon(poly f, poly g, const ring r)
polynomial gcd for f=mon
static BOOLEAN p_IsConstantComp(const poly p, const ring r)
like the respective p_LmIs* routines, except that p might be empty
#define pIfThen1(cond, check)
#define __p_Mult_nn(p, n, r)
#define omTypeAlloc0Bin(type, addr, bin)
BOOLEAN p_CheckIsFromRing(poly p, ring r)
static BOOLEAN rField_is_Ring(const ring r)
void p_ContentForGB(poly p, const ring r)
static poly p_Merge_q(poly p, poly q, const ring r)
static BOOLEAN _p_LmDivisibleByNoCompPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
int p_Var(poly mi, const ring r)
long p_Deg(poly a, const ring r)
void p_ContentRat(poly &ph, const ring r)
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
number p_InitContent(poly ph, const ring r)
BOOLEAN p_DivisibleByRingCase(poly f, poly g, const ring r)
divisibility check over ground ring (which may contain zero divisors); TRUE iff LT(f) divides LT(g)...
#define p_MemSub_LengthGeneral(r, s, length)
long(* pFDegProc)(poly p, ring r)
long pLDeg1_WFirstTotalDegree(poly p, int *l, ring r)
static void p_GetExpVL(poly p, int64 *ev, const ring r)
int p_IsUnivariate(poly p, const ring r)
return i, if poly depends only on var(i)
void p_SetModDeg(intvec *w, ring r)
poly p_Diff(poly a, int k, const ring r)
static BOOLEAN length(leftv result, leftv arg)
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
#define omSizeWOfBin(bin_ptr)
static int p_LtCmp(poly p, poly q, const ring r)
static BOOLEAN p_IsConstantPoly(const poly p, const ring r)
void p_VectorHasUnit(poly p, int *k, int *len, const ring r)
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
static poly p_LmInit(poly p, const ring r)
static void p_Setm(poly p, const ring r)
static long p_AddExp(poly p, int v, long ee, ring r)
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max=0)
return the maximal exponent of p in form of the maximal long var
static poly p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, int lq, const poly spNoether, const ring r)
long pLDeg1c_Totaldegree(poly p, int *l, ring r)
static poly p_GetExp_k_n(poly p, int l, int k, const ring r)
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
static poly p_Neg(poly p, const ring r)
static void p_LmDelete(poly p, const ring r)
poly p_GetMaxExpP(poly p, ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
long pLDeg1_Deg(poly p, int *l, ring r)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
void p_wrp(poly p, ring lmRing, ring tailRing)
void p_String0(poly p, ring lmRing, ring tailRing)
print p according to ShortOut in lmRing & tailRing
void p_Write(poly p, ring lmRing, ring tailRing)
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2), where m is the long representing n in C: TRUE iff (Im(n) != 0 and Im(n) >= 0) or (Im(n) == 0 and Re(n) >= 0) in K(a)/<p(a)>: TRUE iff (n != 0 and (LC(n) > 0 or deg(n) > 0)) in K(t_1, ..., t_n): TRUE iff (LC(numerator(n) is a constant and > 0) or (LC(numerator(n) is not a constant) in Z/2^kZ: TRUE iff 0 < n <= 2^(k-1) in Z/mZ: TRUE iff the internal mpz is greater than zero in Z: TRUE iff n > 0
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
void p_SimpleContent(poly p, int s, const ring r)
int p_MinDeg(poly p, intvec *w, const ring R)
static long p_DecrExp(poly p, int v, ring r)
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
poly p_GetCoeffRat(poly p, int ishift, ring r)
static poly p_Add_q(poly p, poly q, const ring r)
static poly p_New(const ring, omBin bin)
BOOLEAN p_CheckRing(ring r)
static BOOLEAN rIsNCRing(const ring r)
static poly p_Init(const ring r, omBin bin)
BOOLEAN pDebugLmShortDivisibleBy(poly p1, unsigned long sev_1, ring r_1, poly p2, unsigned long not_sev_2, ring r_2)
poly pp_Jet(poly p, int m, const ring R)
static poly p_Mult_q(poly p, poly q, const ring r)
void p_String0Short(const poly p, ring lmRing, ring tailRing)
print p in a short way, if possible
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
poly p_ChineseRemainder(poly *xx, number *x, number *q, int rl, CFArray &inv_cache, const ring R)
static poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, const ring r)
poly p_PermPoly(poly p, const int *perm, const ring OldRing, const ring dst, nMapFunc nMap, const int *par_perm=NULL, int OldPar=0, BOOLEAN use_mult=FALSE)
static poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq, const ring r)
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
poly p_Homogen(poly p, int varnum, const ring r)