24#define TRANSEXT_PRIVATES
60 number c=pGetCoeff(
h);
65 while((hh!=
NULL)&&(n_IsZero(pGetCoeff(hh),r->cf)))
72 if(n_IsZero(pGetCoeff(
pNext(
h)),r->cf))
101 &&((r==
NULL)||(p_LmCmp(r,
h,
R)==-1)))
112 if ((hh!=
NULL) && (p_LmCmp(
h,hh,
R)==0))
115 hh=p_LmFreeAndNext(hh,
R);
119 x[
j]=n_Init(0,
R->cf);
126 if (n_IsZero(n,
R->cf)) p_Delete(&
h,
R);
135 res_p=pReverse(res_p);
175 for(
int i=a;
i<=e;
i++) ord+=p_GetExp(
p,
i,r);
176 p->exp[o->
data.dp.place]=ord;
186 int *
w=o->
data.wp.weights;
188 for(
int i=a;
i<=e;
i++) ord+=((
unsigned long)p_GetExp(
p,
i,r))*((
unsigned long)
w[
i-a]);
192 for(
int i=a;
i<=e;
i++)
202 p->exp[o->
data.wp.place]=ord;
208 const short a=o->
data.am.start;
209 const short e=o->
data.am.end;
210 const int *
w=o->
data.am.weights;
212 for(
short i=a;
i<=e;
i++,
w++)
213 ord += ((*
w) * p_GetExp(
p,
i,r));
217 for(
short i=a;
i<=e;
i++)
229 const short len_gen= o->
data.am.len_gen;
231 if ((c > 0) && (c <= len_gen))
238 p->exp[o->
data.am.place] = ord;
245 a=o->
data.wp64.start;
249 for(
int i=a;
i<=e;
i++)
256 if(ei!=0 && ai/ei!=wi)
260 Print(
"ai %lld, wi %lld\n",ai,wi);
262 Print(
"ai %ld, wi %ld\n",ai,wi);
270 Print(
"ai %lld, ord %lld\n",ai,ord);
272 Print(
"ai %ld, ord %ld\n",ai,ord);
278 long a_0=(long)(ord&mask);
279 long a_1=(long)(ord >>31 );
285 p->exp[o->
data.wp64.place]=a_1;
286 p->exp[o->
data.wp64.place+1]=a_0;
287 #elif SIZEOF_LONG == 8
288 p->exp[o->
data.wp64.place]=ord;
302 int pl=o->
data.cp.place;
303 for(
int i=a;
i<=e;
i++) {
p->exp[pl]=p_GetExp(
p,
i,r); pl++; }
311 o->
data.syzcomp.Components);
313 o->
data.syzcomp.ShiftedComponents);
314 if (ShiftedComponents !=
NULL)
317 assume(c == 0 || Components[c] != 0);
318 sc = ShiftedComponents[Components[c]];
319 assume(c == 0 || sc != 0);
321 p->exp[o->
data.syzcomp.place]=sc;
327 const short place = o->
data.syz.place;
328 const int limit = o->
data.syz.limit;
330 if (c > (
unsigned long)limit)
331 p->exp[place] = o->
data.syz.curr_index;
334 assume( (1 <= c) && (c <= (
unsigned long)limit) );
335 p->exp[place]= o->
data.syz.syz_index[c];
351 Print(
"p_Setm_General: ro_isTemp ord: pos: %d, p: ", pos);
p_wrp(
p, r);
360 const int*
const pVarOffset = o->
data.isTemp.pVarOffset;
365 for(
int i = 1;
i <= r->N;
i++ )
367 const int vo = pVarOffset[
i];
371 p_SetExp(
p, p_GetExp(
p,
i, r), r, vo);
373 assume( p_GetExp(
p, r, vo) == p_GetExp(
p,
i, r) );
377 for(
int i = 1;
i <= r->N;
i++ )
379 const int vo = pVarOffset[
i];
383 assume( p_GetExp(
p, r, vo) == p_GetExp(
p,
i, r) );
399 Print(
"p_Setm_General: ro_is ord: pos: %d, p: ", pos);
p_wrp(
p, r);
408 const ideal F = o->
data.is.F;
409 const int limit = o->
data.is.limit;
411 const int start = o->
data.is.start;
413 if( F !=
NULL && c > limit )
417 Print(
"p_Setm_General: ro_is : in rSetm: pos: %d, c: %d > limit: %d\n", c, pos, limit);
418 PrintS(
"preComputed Values: ");
437 const poly
pp = F->m[c];
446 Print(
"Respective F[c - %d: %d] pp: ", limit, c);
451 const int end = o->
data.is.end;
459 Print(
"p_Setm_General: is(-Temp-) :: c: %d, limit: %d, [st:%d] ===>>> %ld\n", c, limit, start,
p->exp[start]);
465 for(
int i = start;
i <= end;
i++)
466 p->exp[
i] +=
pp->exp[
i];
469 if (r->NegWeightL_Offset !=
NULL)
471 for (
int i=r->NegWeightL_Size-1;
i>=0;
i--)
473 const int _i = r->NegWeightL_Offset[
i];
474 if( start <= _i && _i <= end )
481 const int*
const pVarOffset = o->
data.is.pVarOffset;
485 for(
int i = 1;
i <= r->N;
i++ )
487 const int vo = pVarOffset[
i];
490 assume( p_GetExp(
p, r, vo) == (p_GetExp(
p,
i, r) + p_GetExp(
pp, r, vo)) );
501 const int*
const pVarOffset = o->
data.is.pVarOffset;
506 const int vo = pVarOffset[0];
512 Print(
"ELSE p_Setm_General: ro_is :: c: %d <= limit: %d, vo: %d, exp: %d\n", c, limit, vo,
p->exp[vo]);
525 if (pos == r->OrdSize)
return;
530void p_Setm_Syz(poly
p, ring r,
int* Components,
long* ShiftedComponents)
549 p->exp[r->pOrdIndex] = p_Totaldegree(
p, r);
566 if ((r->typ[0].ord_typ ==
ro_dp) &&
567 (r->typ[0].data.dp.start == 1) &&
568 (r->typ[0].data.dp.end == r->N) &&
569 (r->typ[0].data.dp.place == r->pOrdIndex))
571 if ((r->typ[0].ord_typ ==
ro_wp) &&
572 (r->typ[0].data.wp.start == 1) &&
573 (r->typ[0].data.wp.end == r->N) &&
574 (r->typ[0].data.wp.place == r->pOrdIndex) &&
575 (r->typ[0].data.wp.weights == r->firstwv))
590 return p_GetOrder(a, r);
600 for (
i=1;
i<= r->firstBlockEnds;
i++)
602 sum += p_GetExp(
p,
i, r)*r->firstwv[
i-1];
619 for (
i=0;r->order[
i]!=0;
i++)
626 for (
k=b0 ;
k<=b1 ;
k++)
628 j+= p_GetExp(
p,
k,r)*r->wvhdl[
i][
k - b0 ]*r->OrdSgn;
634 for (
k=b0 ;
k<=b1 ;
k++)
636 j+= p_GetExp(
p,
k,r)*r->wvhdl[
i][
k - b0 ];
643 for (
k=b0 ;
k<=b1 ;
k++)
645 j+= p_GetExp(
p,
k,r)*r->wvhdl[
i][
k - b0 ];
656 for (
k=b0 ;
k<=b1 ;
k++)
664 for (
k=0;
k<=(b1 - b0 );
k++)
667 j+= p_GetExp(
p,
k+1, r)*(long)
w[
k];
708 if ((r->firstwv==
NULL) || (
i>r->firstBlockEnds))
712 return r->firstwv[
i-1];
717 if (r->firstwv==
NULL)
return p_Totaldegree(
p, r);
722 for(
i=1;
i<=r->firstBlockEnds;
i++)
723 j+=p_GetExp(
p,
i, r)*r->firstwv[
i-1];
725 for (;
i<=rVar(r);
i++)
763 return r->pFDeg(
p, r);
779 if (! rIsSyzIndexRing(r))
790 long unsigned curr_limit = rGetCurrSyzLimit(r);
816 long o = r->pFDeg(
p, r);
885 if (rIsSyzIndexRing(r))
887 long unsigned limit = rGetCurrSyzLimit(r);
892 if ((t=r->pFDeg(
p, r))>
max)
max=t;
902 if ((t=r->pFDeg(
p, r))>
max)
max=t;
919 max=p_GetOrder(
p, r);
949 max=p_GetOrder(
p, r);
950 if (rIsSyzIndexRing(r))
952 long unsigned limit = rGetCurrSyzLimit(r);
957 if ((t=p_GetOrder(
p, r))>
max)
max=t;
967 if ((t=p_GetOrder(
p, r))>
max)
max=t;
983 max=p_Totaldegree(
p, r);
988 t=p_Totaldegree(
p, r);
997 t=p_Totaldegree(
p, r);
1012 max=p_Totaldegree(
p, r);
1013 if (rIsSyzIndexRing(r))
1015 long unsigned limit = rGetCurrSyzLimit(r);
1020 if ((t=p_Totaldegree(
p, r))>
max)
max=t;
1030 if ((t=p_Totaldegree(
p, r))>
max)
max=t;
1076 if (rIsSyzIndexRing(r))
1078 long unsigned limit = rGetCurrSyzLimit(r);
1083 if ((t=p_Totaldegree(
p, r))>
max)
max=t;
1093 if ((t=p_Totaldegree(
p, r))>
max)
max=t;
1107static inline unsigned long
1109 unsigned long number_of_exp)
1111 const unsigned long bitmask = r->bitmask;
1112 unsigned long ml1 = l1 & bitmask;
1113 unsigned long ml2 = l2 & bitmask;
1114 unsigned long max = (ml1 > ml2 ? ml1 : ml2);
1115 unsigned long j = number_of_exp - 1;
1119 unsigned long mask = bitmask << r->BitsPerExp;
1124 max |= ((ml1 > ml2 ? ml1 : ml2) & mask);
1127 mask = mask << r->BitsPerExp;
1133static inline unsigned long
1142 if (
p ==
NULL)
return p_Init(r);
1143 poly
max = p_LmInit(
p, r);
1147 unsigned long l_p, l_max;
1148 unsigned long divmask = r->divmask;
1152 offset = r->VarL_Offset[0];
1157 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1160 for (
i=1;
i<r->VarL_Size;
i++)
1167 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1178 unsigned long l_p, divmask = r->divmask;
1183 l_p =
p->exp[r->VarL_Offset[0]];
1185 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1187 for (
i=1;
i<r->VarL_Size;
i++)
1189 l_p =
p->exp[r->VarL_Offset[
i]];
1192 (((l_max & divmask) ^ (l_p & divmask)) != ((l_max-l_p) & divmask)))
1233 if (p_GetExp(
p,
i, r)!=0)
1256 if (p_GetExp(
p,
i, r)!=0)
1258 if((
k!=-1)&&(
k!=
i))
return 0;
1275 for(
i=r->N;
i>0;
i--)
1279 if (p_GetExp(
p,
i,r)>0)
1305 if (n_IsZero(pGetCoeff(rc),r->cf))
1316 poly rc = p_Init(r);
1338 if ((p_GetExp(p1,
i, r) > 0) && (p_GetExp(p2,
i, r) > 0))
1354 if ((p_GetExp(p1,
i, r) > 0) && (p_GetExp(p2,
i, r) > 0))
1358 if (n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf) ||
1359 n_DivBy(pGetCoeff(p2), pGetCoeff(p1), r->cf)) {
1371const char *
p_Read(
const char *st, poly &rc,
const ring r)
1383 p_IncrExp(rc,1+
j,r);
1384 while (*
s!=
'\0')
s++;
1396 const char *s_save=
s;
1398 if (((
unsigned long)
i) > r->bitmask/2)
1404 p_AddExp(rc,1+
j, (
long)
i, r);
1416 if (n_IsZero(pGetCoeff(rc),r->cf)) p_LmDelete(&rc,r);
1424 const unsigned int iFirstAltVar = scaFirstAltVar(r);
1425 const unsigned int iLastAltVar = scaLastAltVar(r);
1429 for(
unsigned int k = iFirstAltVar;
k <= iLastAltVar;
k++)
1430 if( p_GetExp(rc,
k, r) > 1 )
1446 char *sst=(
char*)st;
1448 if (sst[0]==
'-') { neg=
TRUE; sst=sst+1; }
1452 if ((
s!=sst)&&isdigit(sst[0]))
1459 if (pGetCoeff(
p)==
NULL) p_LmFree(
p,r);
1460 else p_LmDelete(
p,r);
1466 if (neg)
p=p_Neg(
p,r);
1476 if (n_IsZero(n,r->cf))
1478 n_Delete(&n, r->cf);
1483 poly rc = p_Init(r);
1499 for(
i=(
int)r->N;
i;
i--)
1500 p_SetExp(
result,
i, p_GetExp(a,
i,r)- p_GetExp(
b,
i,r),r);
1512 if (!n_IsOne(n,r->cf))
1516 number nc = n_Div(pGetCoeff(
p),n,r->cf);
1517 if (!n_IsZero(nc,r->cf))
1532 p_LmDelete(&
pNext(prev),r);
1548 number n=pGetCoeff(
m);
1551 number nc = n_Div(pGetCoeff(
p),n,r->cf);
1552 n_Normalize(nc,r->cf);
1553 if (!n_IsZero(nc,r->cf))
1557 p_ExpVectorSub(
p,
m,r);
1569 p_LmDelete(&
pNext(prev),r);
1584 if (a==
NULL) { p_Delete(&
b,r);
return NULL; }
1587 if(!p_IsConstant(
b,r))
1591 WerrorS(
"p_DivideM not implemented for non-commuative rings");
1597 if (p_DivisibleBy(
b,a,r))
1599 p_ExpVectorSub(a,
b,r);
1612 p_LmDelete(&
pNext(prev),r);
1620 number inv=pGetCoeff(
b);
1622 if (rField_is_Zp(r))
1624 inv = n_Invers(inv,r->cf);
1626 n_Delete(&inv, r->cf);
1649 for(
int i = (
int)rVar(r);
i>0;
i--)
1654 return n_DivBy(pGetCoeff(
g), pGetCoeff(
f), r->cf);
1659void p_Lcm(
const poly a,
const poly
b, poly
m,
const ring r)
1661 for (
int i=r->N;
i; --
i)
1662 p_SetExp(
m,
i, si_max( p_GetExp(a,
i,r), p_GetExp(
b,
i,r)),r);
1668poly
p_Lcm(
const poly a,
const poly
b,
const ring r)
1681poly
p_LcmRat(
const poly a,
const poly
b,
const long lCompM,
const ring r)
1689 for (
int i = r->real_var_end;
i>=r->real_var_start;
i--)
1691 const int lExpA = p_GetExp (a,
i, r);
1692 const int lExpB = p_GetExp (
b,
i, r);
1694 p_SetExp (
m,
i, si_max(lExpA, lExpB), r);
1697 p_SetComp (
m, lCompM, r);
1709 poly q = p_Head(*
p,r);
1711 while ( ( (*
p)!=
NULL ) && ( p_Comp_k_n(*
p, q, ishift+1, r) ) && (
p_GetComp(*
p, r) == cmp) )
1730 res = p_GetExp_k_n(
p, ishift+1, r->N, r);
1734 while ( (q!=
NULL) && (p_Comp_k_n(
p, q, ishift+1, r)) && (
p_GetComp(q, r) == cmp) )
1736 s = p_GetExp_k_n(q, ishift+1, r->N, r);
1742 p_SetCompP(
res,cmp,r);
1755 int len=pLength(ph);
1756 poly *C = (poly *)
omAlloc0((len+1)*
sizeof(poly));
1757 poly *LM = (poly *)
omAlloc0((len+1)*
sizeof(poly));
1758 int *
D = (
int *)
omAlloc0((len+1)*
sizeof(
int));
1759 int *L = (
int *)
omAlloc0((len+1)*
sizeof(
int));
1761 poly
p = p_Copy(ph, r);
1762 int mintdeg = p_Totaldegree(
p, r);
1765 int HasConstantCoef = 0;
1766 int is = r->real_var_start - 1;
1769 LM[
k] = p_GetExp_k_n(
p,1,is, r);
1771 D[
k] = p_Totaldegree(C[
k], r);
1772 mintdeg = si_min(mintdeg,
D[
k]);
1773 L[
k] = pLength(C[
k]);
1774 minlen = si_min(minlen,L[
k]);
1775 if (p_IsConstant(C[
k], r))
1778 HasConstantCoef = 1;
1788 int mindeglen = len;
1792 p_Delete(&LM[0], r);
1800 if (
D[
i] == mintdeg)
1802 if (L[
i] < mindeglen)
1809 d = p_Copy(C[pmindeglen], r);
1820 if (p_Totaldegree(d, r)==0)
1827 p_Delete(&LM[
k], r);
1844 p = p_Add_q(
p, p_Mult_q(C[
i],LM[
i], r), r);
1881 int divisorLE = p_GetExp(divisor, 1, r);
1886 number c = n_Div(
p_GetCoeff(
p, r), divisorLC, r->cf);
1887 n_Normalize(c,r->cf);
1888 p_SetCoeff(t, c, r);
1889 int e = p_GetExp(
p, 1, r) - divisorLE;
1890 p_SetExp(t, 1, e, r);
1892 if (needResult)
result = p_Add_q(
result, p_Copy(t, r), r);
1893 p = p_Add_q(
p, p_Neg(p_Mult_q(t, p_Copy(divisor, r), r), r), r);
1910 if (p_GetExp(a,
k,r)!=0)
1913 t = n_Init(p_GetExp(a,
k,r),r->cf);
1916 if (n_IsZero(pGetCoeff(
f),r->cf))
1943 n=n_Mult(pGetCoeff(a),pGetCoeff(
b),r->cf);
1944 for(
i=rVar(r);
i>0;
i--)
1947 if (
s<p_GetExp(a,
i,r))
1955 for(
j=p_GetExp(a,
i,r);
j>0;
j--)
1957 h = n_Init(
s,r->cf);
1958 hh=n_Mult(n,
h,r->cf);
1968 p_SetExp(
p,
i,
s-p_GetExp(a,
i,r),r);
1973 if (n_IsZero(n,r->cf))
p=p_LmDeleteAndNext(
p,r);
1994poly
p_Sub(poly p1, poly p2,
const ring r)
1996 return p_Add_q(p1, p_Neg(p2,r),r);
2008 if(!n_IsOne(pGetCoeff(
p),r->cf))
2012 n_Power(
y,
exp,&
x,r->cf);
2024 for (
i=rVar(r);
i!=0;
i--)
2026 p_MultExp(
p,
i,
exp,r);
2041 x = n_Mult(
y,pGetCoeff(q),r->cf);
2049 p_ExpVectorAdd(
p,q,r);
2059 poly r = p_Init(rr);
2061 x = n_Mult(pGetCoeff(
p),pGetCoeff(q),rr->cf);
2063 p_ExpVectorSum(r,
p, q, rr);
2075 x = n_Init(
exp,r->cf);
2076 if (n_IsZero(
x,r->cf))
2082 bin = (number *)
omAlloc0(
h*
sizeof(number));
2089 x = n_Init(
i,r->cf);
2091 y = n_Mult(
x,bin[e-1],r->cf);
2093 x = n_Init(e,r->cf);
2103 int e,
h = (
exp >> 1) + 1;
2108 n_Delete(&(bin[e]),r);
2123 poly tail,
b,
res,
h;
2136 al = (
exp + 1) *
sizeof(poly);
2139 for (e=1; e<
exp; e++)
2145 for (e=
exp-1; e>eh; e--)
2148 x = n_Mult(bin[
exp-e],pGetCoeff(
h),r->cf);
2154 for (e=eh; e!=0; e--)
2157 x = n_Mult(bin[e],pGetCoeff(
h),r->cf);
2163 p_LmDelete(&tail,r);
2186 #if __FLINT_RELEASE >= 20503
2187 if ((
i>16) && rField_is_Q(r))
2189 fmpq_mpoly_ctx_t ctx;
2190 if (!convSingRFlintR(ctx,r))
2192 fmpq_mpoly_t
pp,
res;
2193 fmpq_mpoly_init(
res,ctx);
2194 convSingPFlintMP(
pp,ctx,
p,pLength(
p),r);
2195 fmpq_mpoly_pow_ui(
res,
pp,
i,ctx);
2196 poly pres=convFlintMPSingP(
res,ctx,r);
2197 fmpq_mpoly_clear(
res,ctx);
2198 fmpq_mpoly_clear(
pp,ctx);
2199 fmpq_mpoly_ctx_clear(ctx);
2203 else if ((>17) && rField_is_Zp(r))
2205 nmod_mpoly_ctx_t ctx;
2206 if (!convSingRFlintR(ctx,r))
2208 nmod_mpoly_t
pp,
res;
2209 convSingPFlintMP(
pp,ctx,
p,pLength(
p),r);
2210 nmod_mpoly_init(
res,ctx);
2211 fq_nmod_mpoly_pow_ui(
res,
pp,
i,ctx);
2212 poly pres=convFlintMPSingP(
res,ctx,r);
2213 nmod_mpoly_clear(
res,ctx);
2214 nmod_mpoly_clear(
pp,ctx);
2215 nmod_mpoly_ctx_clear(ctx);
2221 poly rc = p_Copy(
p,r);
2225 rc = p_Mult_q(rc,p_Copy(
p,r),r);
2230 return p_Mult_q(rc,
p,r);
2257 if ( (
i > 0) && ((
unsigned long )
i > (r->bitmask))
2258 #ifdef HAVE_SHIFTBBA
2263 Werror(
"exponent %d is too large, max. is %ld",
i,r->bitmask);
2279 rc=p_Mult_q(p_Copy(
p,r),
p,r);
2296 rc = p_Mult_q(p_Copy(
p,r),rc,r);
2307 int char_p=rInternalChar(r);
2308 if ((char_p>0) && (
i>char_p)
2309 && ((rField_is_Zp(r,char_p)
2310 || (rField_is_Zp_a(r,char_p)))))
2314 while (rest>=char_p)
2329 if ((char_p==0) || (
i<=char_p))
2345 if (ph==
NULL)
return;
2349 p_SetCoeff(ph,n_Init(1,
cf),r);
2356 if ((rField_is_Q(r))
2357 || (rField_is_Q_a(r))
2358 || (rField_is_Zp_a)(r)
2366 h=n_Copy(pGetCoeff(ph),
cf);
2371 goto content_finish;
2377 n_Normalize(pGetCoeff(
p),
cf);
2378 number d=n_SubringGcd(
h,pGetCoeff(
p),
cf);
2383 goto content_finish;
2398 if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2401#define CLEARENUMERATORS 1
2420 assume(n_GreaterZero(pGetCoeff(ph), C));
2431 if (rField_has_Units(r))
2434 if (!n_IsOne(
k,r->cf))
2437 k = n_Invers(
k,r->cf);
2438 n_Delete(&tmpGMP,r->cf);
2440 p_SetCoeff(ph, n_Mult(pGetCoeff(ph),
k,r->cf),r);
2443 p_SetCoeff(
h, n_Mult(pGetCoeff(
h),
k,r->cf),r);
2459 p_SetCoeff(ph,n_Init(1,r->cf),r);
2472 assume(n_GreaterZero(pGetCoeff(ph), r->cf));
2479 n_Normalize(pGetCoeff(ph),r->cf);
2480 if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2481 if (rField_is_Q(r)||(getCoeffType(r->cf)==
n_transExt))
2488 h=n_Copy(pGetCoeff(ph),r->cf);
2493 n_Normalize(pGetCoeff(
p),r->cf);
2494 d=n_SubringGcd(
h,pGetCoeff(
p),r->cf);
2497 if(n_IsOne(
h,r->cf))
2504 if(!n_IsOne(
h,r->cf))
2524 if (rField_is_Q_a(r))
2529 h = n_Init(1, r->cf->extRing->cf);
2533 poly c_n_n=(poly)pGetCoeff(
p);
2538 n_Delete(&
h,r->cf->extRing->cf);
2546 if(!n_IsOne(
h,r->cf->extRing->cf))
2551 poly c_n=(poly)pGetCoeff(
p);
2554 d=n_Mult(
h,pGetCoeff(c_n),r->cf->extRing->cf);
2555 n_Normalize(d,r->cf->extRing->cf);
2556 n_Delete(&pGetCoeff(c_n),r->cf->extRing->cf);
2563 n_Delete(&
h,r->cf->extRing->cf);
2607 if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2615 if (ph==
NULL)
return;
2618 p_SetCoeff(ph,n_Init(1,r->cf),r);
2625 if (!(rField_is_Q(r))
2626 && (!rField_is_Q_a(r))
2627 && (!rField_is_Zp_a(r))
2628 && (!rField_is_Z(r))
2635 if (n_Size(d,r->cf)<=smax)
2643 if (smax==1) smax=2;
2647 d=n_SubringGcd(
h,pGetCoeff(
p),r->cf);
2651 n_InpGcd(
h,pGetCoeff(
p),r->cf);
2653 if(n_Size(
h,r->cf)<smax)
2662 if (!n_GreaterZero(pGetCoeff(
p),r->cf))
h=n_InpNeg(
h,r->cf);
2663 if(n_IsOne(
h,r->cf))
2675 STATISTIC(
n_ExactDiv); nlInpExactDiv(pGetCoeff(
p),
h,r->cf);
2693 return n_GetNumerator(pGetCoeff(
pNext(ph)),r->cf);
2696 number n1=n_GetNumerator(pGetCoeff(
p),r->cf);
2698 number n2=n_GetNumerator(pGetCoeff(
p),r->cf);
2705 t=n_GetNumerator(pGetCoeff(
p),r->cf);
2707 d=
nlAdd(n1,t,r->cf);
2709 d=
nlSub(n1,t,r->cf);
2716 t=n_GetNumerator(pGetCoeff(
p),r->cf);
2718 d=
nlAdd(n2,t,r->cf);
2720 d=
nlSub(n2,t,r->cf);
2727 d=
nlGcd(n1,n2,r->cf);
2735 number d=pGetCoeff(ph);
2736 int s=n_Size(d,r->cf);
2738 number d2=pGetCoeff(ph);
2739 int s2=n_Size(d2,r->cf);
2743 if (
s<s2)
return n_Copy(d,r->cf);
2744 else return n_Copy(d2,r->cf);
2748 number nd=pGetCoeff(ph);
2749 int ns=n_Size(nd,r->cf);
2768 return n_SubringGcd(d,d2,r->cf);
2842 p_SetCoeff(ph,n_Init(1,r->cf),r);
2846 n_Normalize(pGetCoeff(ph),r->cf);
2847 if(!n_GreaterZero(pGetCoeff(ph),r->cf)) ph = p_Neg(ph,r);
2848 h=n_Copy(pGetCoeff(ph),r->cf);
2852 n_Normalize(pGetCoeff(
p),r->cf);
2853 d=n_Gcd(
h,pGetCoeff(
p),r->cf);
2856 if(n_IsOne(
h,r->cf))
2864 if(!n_IsOne(
h,r->cf))
2878 p_SetCoeff(
p,d,r->cf);
2909 assume(n_GreaterZero(pGetCoeff(
p), C));
2919 if(!n_GreaterZero(pGetCoeff(
p),C))
p = p_Neg(
p,r);
2925 if(!n_GreaterZero(pGetCoeff(
p),C))
p = p_Neg(
p,r);
2934 p_SetCoeff(
p,n_Init(1,C),r);
2935 else if(!n_GreaterZero(pGetCoeff(
p),C))
2943#if 0 && CLEARENUMERATORS
2952 assume(n_GreaterZero(pGetCoeff(
p), C));
2964 n_Normalize(pGetCoeff(
p),C);
2977 d=n_Mult(
h,pGetCoeff(
p),C);
2997 if(!n_GreaterZero(pGetCoeff(
p),C))
p = p_Neg(
p,r);
3027 assume(n_GreaterZero(pGetCoeff(ph), C));
3044 c=n_Invers(pGetCoeff(
p), C);
3045 p_SetCoeff(
p, n_Init(1, C), r);
3052 if(!n_GreaterZero(pGetCoeff(ph),C))
3080 assume(n_GreaterZero(pGetCoeff(ph), C));
3100 n_Normalize(pGetCoeff(
p),C);
3124 d=n_Mult(
h,pGetCoeff(
p),C);
3129 if (rField_is_Q_a(r))
3159 d=n_Mult(
h,pGetCoeff(
p),C);
3164 number t=n_Mult(c,
h,C);
3178 if(!n_GreaterZero(pGetCoeff(ph),C))
3201 if (nCoeff_is_Ring(C))
3204 if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3205 assume( n_GreaterZero(pGetCoeff(ph),C) );
3211 p_SetCoeff(ph, n_Init(1, C), r);
3217 if(!n_GreaterZero(pGetCoeff(ph),C)) ph = p_Neg(ph,r);
3229 number hInv = n_Invers(
h, C);
3239 p_SetCoeff(
p, n_Init(1, C), r);
3252 fraction
f = (fraction)
h;
3254 if (rField_is_Q (C->extRing))
3256 if (!n_GreaterZero(n,C->extRing->cf))
3261 else if (rField_is_Zp(C->extRing)||rField_is_Zp_long(C->extRing))
3263 if (!n_IsOne (n, C->extRing->cf))
3265 n=n_Invers (n,C->extRing->cf);
3267 nMap= n_SetMap (C->extRing->cf, C);
3268 number ninv= nMap (n,C->extRing->cf, C);
3270 n_Delete (&ninv, C);
3271 n_Delete (&n, C->extRing->cf);
3281number p_GetAllDenom(poly ph,
const ring r)
3283 number d=n_Init(1,r->cf);
3288 number
h=n_GetDenom(pGetCoeff(
p),r->cf);
3289 if (!n_IsOne(
h,r->cf))
3291 number dd=n_Mult(d,
h,r->cf);
3305 if (r->cf->has_simple_Alloc)
3309 count+= n_Size( pGetCoeff(
p ), r->cf );
3333 if ((varnum < 1) || (varnum > rVar(r)))
3352 p_AddExp(q,varnum, (
long)ii,r);
3373 if ((varnum < 1) || (varnum > rVar(r)))
3377 o=p_Totaldegree(
p,r);
3381 ii=p_Totaldegree(q,r);
3389 ii = o-p_Totaldegree(q,r);
3392 p_AddExp(q,varnum, (
long)ii,r);
3422 if (d(qp,r) != o)
return FALSE;
3438 o = p_Totaldegree(
p,r);
3441 if (p_Totaldegree(qp,r) != o)
return FALSE;
3479 if (oo != o)
return FALSE;
3494 if (p_LmIsConstantComp(q,r))
3519 if (p_LmIsConstantComp(q,r))
3532 if ((*len == 0) || (
j<*len))
3546 unsigned long kk=(
unsigned long)
k;
3597 pNext(qq) = pNext_q;
3627 int lp = pLength(*r_p);
3662 assume(pLength(*r_p) + pLength(*r_q) == lp);
3674 if (*
p==
NULL)
return;
3685 p_LmDelete(&(
pNext(q)),r);
3730 if (
k>len) {
Werror(
"wrong rank:%d, should be %d",len,
k); }
3739 for(
int i=len-1;
i>=0;
i--)
3752 *len=p_MaxComp(
v,r);
3753 if (*len==0) *len=1;
3754 *
p=(poly*)
omAlloc((*len)*
sizeof(poly));
3765 r->pFDeg = new_FDeg;
3767 if (new_lDeg ==
NULL)
3768 new_lDeg = r->pLDegOrig;
3770 r->pLDeg = new_lDeg;
3777 r->pFDeg = old_FDeg;
3778 r->pLDeg = old_lDeg;
3793 if ((c>0) && ((r->pModW)->range(c-1))) d+= (*(r->pModW))[c-1];
3807 r->pLexOrder =
TRUE;
3825 if (increment==0)
return;
3828 h=(poly*)
omAlloc0(increment*
sizeof(poly));
3835 memset(&(
h[
l]),0,increment*
sizeof(poly));
3849 if(!n_GreaterZero(pGetCoeff(p1),r->cf)) p1 = p_Neg(p1,r);
3850 if (!n_IsUnit(pGetCoeff(p1), r->cf))
return;
3856 if (
LIKELY(!n_IsOne(pGetCoeff(p1),C)))
3860 p_SetCoeff(p1,n_Init(1,C),r);
3863 number
k = pGetCoeff(p1);
3866 if (
LIKELY(nCoeff_is_Zp(C)))
3870 number inv=n_Invers(
k,C);
3873 number c=n_Mult(pGetCoeff(
h),inv,C);
3884 number c=n_Div(pGetCoeff(
h),
k,C);
3893 number inv=n_Invers(
k,C);
3896 number c=n_Mult(pGetCoeff(
h),inv,C);
3901 n_Delete(&inv,r->cf);
3906 number inv=n_Invers(
k,C);
3909 number c=n_Mult(pGetCoeff(
h),inv,C);
3923 number c=n_Div(pGetCoeff(
h),
k,C);
3941 n_Normalize(pGetCoeff(
h),C);
3961 n_Normalize(pGetCoeff(
p),
cf);
3984 if (p_GetExp(
p, n,r) == 0)
4012 while (non_zero !=
NULL)
4014 assume(p_GetExp(non_zero, n,r) != 0);
4033 assume( ! n_IsZero(e,r->cf) );
4036 poly zero, non_zero;
4041 while (non_zero !=
NULL)
4043 assume(p_GetExp(non_zero, n, r) != 0);
4047 n_Power(e, p_GetExp(qq, n, r), &nn,r->cf);
4048 nm = n_Mult(nn, pGetCoeff(qq),r->cf);
4050 if (n_IsZero(nm,r->cf))
4053 n_Delete(&nm,r->cf);
4058 p_SetCoeff(qq, nm,r);
4059 p_SetExp(qq, n, 0,r);
4063 n_Delete(&nn,r->cf);
4080 if (p_GetExp(
pNext(
h),n,r)!=0)
4111 if (p_IsConstant(e,r))
4113 if (n_IsOne(pGetCoeff(e),r->cf))
return p_Subst1(
p,n,r);
4114 else return p_Subst2(
p, n, pGetCoeff(e),r);
4118 if (rIsPluralRing(r))
4129 me=(
int *)
omAlloc((rVar(r)+1)*
sizeof(
int));
4130 ee=(
int *)
omAlloc((rVar(r)+1)*
sizeof(
int));
4131 if (e!=
NULL) p_GetExpV(e,ee,r);
4136 if ((e!=
NULL) || (p_GetExp(
h,n,r)==0))
4142 for(
i=rVar(r);
i>0;
i--)
4147 n_Power(pGetCoeff(e),
exponent,&nu,r->cf);
4148 nu1=n_Mult(pGetCoeff(
m),nu,r->cf);
4149 n_Delete(&nu,r->cf);
4150 p_SetCoeff(
m,nu1,r);
4166poly
n_PermNumber(
const number z,
const int *par_perm,
const int ,
const ring src,
const ring dst)
4169 PrintS(
"\nSource Ring: \n");
4174 number zz = n_Copy(z, src->cf);
4175 PrintS(
"z: "); n_Write(zz, src);
4176 n_Delete(&zz, src->cf);
4179 PrintS(
"\nDestination Ring: \n");
4191 const coeffs srcCf = src->cf;
4199 const ring srcExtRing = srcCf->extRing;
4202 const coeffs dstCf = dst->cf;
4214 zz =
NUM((fraction)z);
4218 if( !DENIS1((fraction)z) )
4220 if (!p_IsConstant(DEN((fraction)z),srcExtRing))
4221 WarnS(
"Not defined: Cannot map a rational fraction and make a polynomial out of it! Ignoring the denominator.");
4227 WerrorS(
"Number permutation is not implemented for this data yet!");
4234 nMapFunc nMap = n_SetMap(srcExtRing->cf, dstCf);
4239 if ((par_perm ==
NULL) && (rPar(dst) != 0 && rVar (srcExtRing) > 0))
4242 perm=(
int *)
omAlloc0((rVar(srcExtRing)+1)*
sizeof(
int));
4243 for(
int i=si_min(rVar(srcExtRing),rPar(dst));
i>0;
i--)
4245 qq =
p_PermPoly(zz, perm, srcExtRing, dst, nMap,
NULL, rVar(srcExtRing)-1);
4249 qq =
p_PermPoly(zz, par_perm-1, srcExtRing, dst, nMap,
NULL, rVar (srcExtRing)-1);
4252 && (!DENIS1((fraction)z))
4253 && p_IsConstant(DEN((fraction)z),srcExtRing))
4255 number n=nMap(pGetCoeff(DEN((fraction)z)),srcExtRing->cf, dstCf);
4269poly
p_PermPoly (poly
p,
const int * perm,
const ring oldRing,
const ring dst,
4276 const int OldpVariables = rVar(oldRing);
4278 poly result_last =
NULL;
4284 poly tmp_mm=
p_One(dst);
4289 if ( ((OldPar == 0) || (par_perm ==
NULL) || rField_is_GF(oldRing) || (nMap==
ndCopyMap))
4294 number n = nMap(
p_GetCoeff(
p, oldRing), oldRing->cf, dst->cf);
4297 n_Normalize(n, dst->cf);
4310 p_SetCoeff(qq, n_Init(0, dst->cf),dst);
4315 if ( n_IsZero(pGetCoeff(qq), dst->cf) )
4317 p_LmDelete(&qq,dst);
4323 int mapped_to_par = 0;
4324 for(
int i = 1;
i <= OldpVariables;
i++)
4326 int e = p_GetExp(
p,
i, oldRing);
4330 p_SetExp(qq,
i, e, dst);
4336 p_SetExp(tmp_mm,perm[
i],e,dst);
4338 qq=p_Mult_mm(qq,tmp_mm,dst);
4339 p_SetExp(tmp_mm,perm[
i],0,dst);
4344 p_AddExp(qq,perm[
i], e, dst);
4349 if (rField_is_GF(dst))
4352 number ee = n_Param(1, dst);
4354 n_Power(ee, e, &eee, dst->cf);
4355 ee = n_Mult(c, eee, dst->cf);
4361 const int par = -perm[
i];
4365 const coeffs C = dst->cf;
4367 const ring
R = C->extRing;
4371 assume( !n_IsZero(c, C) );
4375 pcn =
NUM((fraction)c);
4377 p_AddExp(pcn, -perm[
i], e,
R);
4381 p_SetExp(mmc, -perm[
i], e,
R);
4389 p_GetCoeff(qq, dst) = n_Mult((number)c, nnc, C);
4390 n_Delete((number *)&c, C);
4391 n_Delete((number *)&nnc, C);
4400 p_LmDelete(&qq, dst);
4408 n_Normalize(n, dst->cf);
4433 qq=p_Mult_q(aq,qq,dst);
4436 if (result_last==
NULL)
4442 pNext(result_last)=qq;
4487 p_LmDelete(&tmp_mm,dst);
4504 if (p_Totaldegree(
p,
R)<=
m)
4532 if (p_LmIsConstantComp(
p,
R))
4555 while((
p!=
NULL) && (p_Totaldegree(
p,
R)>
m)) p_LmDelete(&
p,
R);
4623 for(
int j=0;
j<rVar(
R);
j++)
4625 d0+=p_GetExp(
p,
j+1,
R);
4627 d0+=(*w)[
j]*p_GetExp(
p,
j+1,
R);
4640 number u0=n_Invers(pGetCoeff(u),
R->cf);
4652 v=p_Add_q(
v,p_Copy(v1,
R),
R);
4655 v1=
p_JetW(p_Mult_q(v1,p_Copy(u1,
R),
R),n,ww,
R);
4656 v=p_Add_q(
v,p_Copy(v1,
R),
R);
4673 p=
p_JetW(p_Mult_q(
p,
p_Invers(n-
p_MinDeg(
p,
w,
R),u,
w,
R),
R),n,ww,
R);
4681 while ((p1 !=
NULL) && (p2 !=
NULL))
4700 int i = r1->ExpL_Size;
4702 assume( r1->ExpL_Size == r2->ExpL_Size );
4704 unsigned long *ep = p1->exp;
4705 unsigned long *eq = p2->exp;
4710 if (ep[
i] != eq[
i])
return FALSE;
4720 assume( r1->cf == r2->cf );
4722 while ((p1 !=
NULL) && (p2 !=
NULL))
4754 if (pLength(p1) != pLength(p2))
4759 if (!n_DivBy(pGetCoeff(p1), pGetCoeff(p2), r->cf))
return FALSE;
4762 n=n_Div(pGetCoeff(p1),pGetCoeff(p2),r->cf);
4763 while ((p1 !=
NULL) )
4767 n_Delete(&n, r->cf);
4770 if (!n_Equal(pGetCoeff(p1), nn = n_Mult(pGetCoeff(p2),n, r->cf), r->cf))
4772 n_Delete(&n, r->cf);
4773 n_Delete(&nn, r->cf);
4776 n_Delete(&nn, r->cf);
4780 n_Delete(&n, r->cf);
4797 if (! rIsSyzIndexRing(r))
4809 long unsigned curr_limit = rGetCurrSyzLimit(r);
4825 if (
m==
NULL)
return 0;
4828 for (
i=rVar(r);
i>0;
i--)
4830 int exp=p_GetExp(
m,
i,r);
4851 if (
p ==
NULL)
return -1;
4857 lex = p_GetExp(
p,
l,r);
4858 while ((
l < (rVar(r))) && (lex == 0))
4861 lex = p_GetExp(
p,
l,r);
4875 poly qp1 = *
p,qp2 = *
p;
4876 int j = p_MaxComp(*
p,r),
k = p_MinComp(*
p,r);
4900 qp2->next = qp1->next;
4901 if (qp1!=
NULL) p_LmDelete(&qp1,r);
4916 const unsigned int s,
const unsigned int n)
4919 unsigned long ev = 0L;
4950 unsigned long ev = 0;
4965 for (;
j<=r->N;
j++)
4967 if (p_GetExp(
p,
j,r) > 0)
i++;
5002 unsigned long ev = 0;
5006 if (p_GetExp(
p,
j,r)>0)
5018 unsigned long ev = 0;
5025 if ((e=p_GetExp(
p,
j,r))>0)
5037 if (p_GetExp(
p,
j,r)>0)
5053#define p_Delete__T p_ShallowDelete
5055#define n_Delete__T(n, r) do {} while (0)
5066 if ((r==0)&&(a!=
NULL))
5068 number
h=n_Sub(pGetCoeff(a),pGetCoeff(
b),
R->cf);
5070 r = -1+n_IsZero(
h,
R->cf)+2*n_GreaterZero(
h,
R->cf);
5080 else if(p_IsConstant(
b,
R))
5083 r = 1-2*n_GreaterZero(pGetCoeff(
b),
R->cf);
5088 if (p_IsConstant(a,
R))
5091 r = -1+2*n_GreaterZero(pGetCoeff(a),
R->cf);
5104 int *mf=(
int*)
omAlloc((r->N+1)*
sizeof(
int));
5106 int *mh=(
int*)
omAlloc((r->N+1)*
sizeof(
int));
5108 BOOLEAN one_coeff=n_IsOne(pGetCoeff(
G),r->cf);
5114 number n=n_SubringGcd(pGetCoeff(
G),pGetCoeff(
h),r->cf);
5115 one_coeff=n_IsOne(n,r->cf);
5120 for(
unsigned j=r->N;
j!=0;
j--)
5122 if (mh[
j]<mf[
j]) mf[
j]=mh[
j];
5123 if (mf[
j]>0) const_mon=
FALSE;
5125 if (one_coeff && const_mon)
break;
5141 memcpy(np->exp,
p->exp, r->ExpL_Size*
sizeof(
long));
5164 int mm=p_GetExp(
p,
i,r);
Concrete implementation of enumerators over polynomials.
const CanonicalForm CFMap CFMap & N
poly singclap_pdivide(poly f, poly g, const ring r)
This is a polynomial enumerator for simple iteration over coefficients of polynomials.
static FORCE_INLINE number n_NormalizeHelper(number a, number b, const coeffs r)
assume that r is a quotient field (otherwise, return 1) for arguments (a1/a2,b1/b2) return (lcm(a1,...
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
number ndCopyMap(number a, const coeffs src, const coeffs dst)
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r).
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
static FORCE_INLINE number n_ExactDiv(number a, number b, const coeffs r)
assume that there is a canonical subring in cf and we know that division is possible for these a and ...
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
static FORCE_INLINE number n_GetUnit(number n, const coeffs r)
in Z: 1 in Z/kZ (where k is not a prime): largest divisor of n (taken in Z) that is co-prime with k i...
static FORCE_INLINE void n_ClearDenominators(ICoeffsEnumerator &numberCollectionEnumerator, number &d, const coeffs r)
(inplace) Clears denominators on a collection of numbers number d is the LCM of all the coefficient d...
static FORCE_INLINE number n_ChineseRemainderSym(number *a, number *b, int rl, BOOLEAN sym, CFArray &inv_cache, const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
static FORCE_INLINE void n_ClearContent(ICoeffsEnumerator &numberCollectionEnumerator, number &c, const coeffs r)
Computes the content and (inplace) divides it out on a collection of numbers number c is the content ...
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
static FORCE_INLINE const char * n_Read(const char *s, number *a, const coeffs r)
!!! Recommendation: This method is too cryptic to be part of the user- !!! interface....
number(*) nMapFunc(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_long(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_transExt(const coeffs r)
TRUE iff r represents a transcendental extension field.
const CanonicalForm int s
const CanonicalForm int const CFList const Variable & y
CanonicalForm subst(const CanonicalForm &f, const CFList &a, const CFList &b, const CanonicalForm &Rstar, bool isFunctionField)
const Variable & v
< [in] a sqrfree bivariate poly
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
void WerrorS(const char *s)
const char * eati(const char *s, int *i)
poly p_ChineseRemainder(poly *xx, mpz_ptr *x, mpz_ptr *q, int rl, mpz_ptr *C, const ring R)
void p_TakeOutComp(poly *p, long comp, poly *q, int *lq, const ring r)
poly nc_pSubst(poly p, int n, poly e, const ring r)
substitute the n-th variable by e in p destroy p e is not a constant
LINLINE number nlAdd(number la, number li, const coeffs r)
LINLINE number nlSub(number la, number li, const coeffs r)
LINLINE void nlDelete(number *a, const coeffs r)
BOOLEAN nlGreaterZero(number za, const coeffs r)
number nlGcd(number a, number b, const coeffs r)
void nlNormalize(number &x, const coeffs r)
int dReportError(const char *fmt,...)
#define p_LmCheckPolyRing1(p, r)
#define p_LmCheckPolyRing2(p, r)
#define POLY_NEGWEIGHT_OFFSET
#define __p_GetComp(p, r)
#define p_SetRingOfLm(p, r)
#define rRing_has_Comp(r)
gmp_float max(const gmp_float &a, const gmp_float &b)
gmp_float exp(const gmp_float &a)
The main handler for Singular numbers which are suitable for Singular polynomials.
number ndGcd(number, number, const coeffs r)
void ndNormalize(number &, const coeffs)
#define omFreeSize(addr, size)
#define omReallocSize(addr, o_size, size)
#define omTypeAllocBin(type, addr, bin)
#define TEST_OPT_INTSTRATEGY
#define TEST_OPT_CONTENTSB
poly p_Diff(poly a, int k, const ring r)
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0,...
poly p_DivideM(poly a, poly b, const ring r)
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
poly pp_Jet(poly p, int m, const ring R)
STATIC_VAR pLDegProc pOldLDeg
void p_Cleardenom_n(poly ph, const ring r, number &c)
long pLDegb(poly p, int *l, const ring r)
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
long p_WFirstTotalDegree(poly p, const ring r)
poly p_HomogenDP(poly p, int varnum, const ring r)
poly p_Farey(poly p, number N, const ring r)
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
poly n_PermNumber(const number z, const int *par_perm, const int, const ring src, const ring dst)
static poly p_DiffOpM(poly a, poly b, BOOLEAN multiply, 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...
int p_Size(poly p, const ring r)
void p_Setm_Dummy(poly p, const ring r)
static poly p_Invers(int n, poly u, intvec *w, const ring R)
poly p_GcdMon(poly f, poly g, const ring r)
polynomial gcd for f=mon
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
int p_LowVar(poly p, const ring r)
the minimal index of used variables - 1
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),...
poly p_Homogen(poly p, int varnum, const ring r)
poly p_Subst(poly p, int n, poly e, const ring r)
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
BOOLEAN p_HasNotCF(poly p1, poly p2, const ring r)
void p_Content(poly ph, const ring r)
int p_Weight(int i, const ring r)
void p_Setm_TotalDegree(poly p, const ring r)
poly p_CopyPowerProduct(const poly p, const ring r)
like p_Head, but with coefficient 1
poly pp_DivideM(poly a, poly b, const ring r)
STATIC_VAR int _componentsExternal
void p_SimpleContent(poly ph, int smax, const ring r)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
STATIC_VAR long * _componentsShifted
void p_Vec2Polys(poly v, poly **p, int *len, const ring r)
static poly p_Subst0(poly p, int n, const ring r)
poly p_DiffOp(poly a, poly b, BOOLEAN multiply, const ring r)
static unsigned long p_GetMaxExpL2(unsigned long l1, unsigned long l2, const ring r, unsigned long number_of_exp)
poly p_Jet(poly p, int m, const ring R)
long pLDeg1c_Deg(poly p, int *l, const ring r)
long pLDeg1(poly p, int *l, const ring r)
static number * pnBin(int exp, const ring r)
void p_Shift(poly *p, int i, const ring r)
shifts components of the vector p by i
static void pnFreeBin(number *bin, int exp, const coeffs r)
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
poly p_Power(poly p, int i, const ring r)
poly p_Div_nn(poly p, const number n, const ring r)
void p_Normalize(poly p, const ring r)
unsigned long p_GetShortExpVector0(const poly p, const ring r)
void p_DeleteComp(poly *p, int k, const ring r)
poly p_mInit(const char *st, BOOLEAN &ok, const ring r)
poly p_MDivide(poly a, poly b, const ring r)
void p_ContentRat(poly &ph, const ring r)
void p_Norm(poly p1, const ring r)
poly p_Div_mm(poly p, const poly m, const ring r)
divide polynomial by monomial
poly pp_Jet0(poly p, const 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)
int p_MinDeg(poly p, intvec *w, const ring R)
int p_MaxExpPerVar(poly p, int i, const ring r)
max exponent of variable x_i in p
STATIC_VAR BOOLEAN pOldLexOrder
int p_Compare(const poly a, const poly b, const ring R)
STATIC_VAR pFDegProc pOldFDeg
void p_LmDeleteAndNextRat(poly *p, int ishift, ring r)
unsigned long p_GetShortExpVector(const poly p, const ring r)
BOOLEAN p_IsHomogeneousW(poly p, const intvec *w, const ring r)
long pLDeg1_Deg(poly p, int *l, const ring r)
poly p_Series(int n, poly p, poly u, intvec *w, const ring R)
void p_ProjectiveUnique(poly ph, const ring r)
long p_WTotaldegree(poly p, const ring r)
long p_DegW(poly p, const int *w, const ring R)
p_SetmProc p_GetSetmProc(const ring r)
void p_Setm_General(poly p, const ring r)
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
poly p_Cleardenom(poly p, const ring r)
long pLDeg1c(poly p, int *l, const ring r)
void p_Split(poly p, poly *h)
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
poly p_GetCoeffRat(poly p, int ishift, ring r)
BOOLEAN p_VectorHasUnitB(poly p, int *k, const ring r)
long pLDeg0c(poly p, int *l, const ring r)
poly p_Vec2Poly(poly v, int k, const ring r)
poly p_LcmRat(const poly a, const poly b, const long lCompM, const ring r)
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
static poly p_TwoMonPower(poly p, int exp, const ring r)
void p_SetModDeg(intvec *w, ring r)
BOOLEAN p_HasNotCFRing(poly p1, poly p2, const ring r)
long pLDeg0(poly p, int *l, const ring r)
int p_Var(poly m, const ring r)
poly p_Sub(poly p1, poly p2, const ring r)
void p_VectorHasUnit(poly p, int *k, int *len, const ring r)
static void p_SplitAndReversePoly(poly p, int n, poly *non_zero, poly *zero, const ring r)
int p_IsUnivariate(poly p, const ring r)
return i, if poly depends only on var(i)
STATIC_VAR int * _components
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
void pEnlargeSet(poly **p, int l, int increment)
long p_WDegree(poly p, const ring r)
static long pModDeg(poly p, ring r)
BOOLEAN p_IsHomogeneous(poly p, const ring r)
poly p_Head0(const poly p, const ring r)
like p_Head, but allow NULL coeff
static poly p_MonMultC(poly p, poly q, const ring rr)
unsigned long p_GetShortExpVector1(const poly p, const ring r)
static poly p_Pow_charp(poly p, int i, const ring r)
poly pp_JetW(poly p, int m, int *w, const ring R)
long p_Deg(poly a, const ring r)
static poly p_Subst1(poly p, int n, const ring r)
poly p_Last(const poly p, int &l, const ring r)
poly p_CopyPowerProduct0(const poly p, number n, const ring r)
like p_Head, but with coefficient n
static void p_MonMult(poly p, poly q, const ring r)
BOOLEAN p_IsHomogeneousDP(poly p, const ring r)
number p_InitContent(poly ph, const ring r)
void p_Vec2Array(poly v, poly *p, int len, const ring r)
vector to already allocated array (len>=p_MaxComp(v,r))
static poly p_MonPower(poly p, int exp, const ring r)
void p_ContentForGB(poly ph, const ring r)
static poly p_Subst2(poly p, int n, number e, const ring r)
void p_Lcm(const poly a, const poly b, poly m, const ring r)
static unsigned long GetBitFields(const long e, const unsigned int s, const unsigned int n)
const char * p_Read(const char *st, poly &rc, const ring r)
poly p_JetW(poly p, int m, int *w, const ring R)
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
static poly p_Pow(poly p, int i, const ring r)
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
#define p_LmEqual(p1, p2, r)
void p_Write(poly p, ring lmRing, ring tailRing)
BOOLEAN p_CheckPolyRing(poly p, ring r)
#define __p_Mult_nn(p, n, r)
void p_wrp(poly p, ring lmRing, ring tailRing)
poly singclap_gcd(poly f, poly g, const ring r)
polynomial gcd via singclap_gcd_r resp. idSyzygies destroys f and g
void PrintS(const char *s)
void Werror(const char *fmt,...)
BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
return TRUE if p_SetComp requires p_Setm
void rWrite(ring r, BOOLEAN details)
int r_IsRingVar(const char *n, char **names, int N)
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
long(*) pLDegProc(poly p, int *length, ring r)
@ ringorder_a64
for int64 weights
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
@ ringorder_IS
Induced (Schreyer) ordering.
long(*) pFDegProc(poly p, ring r)
union sro_ord::@006200034235045362245112336324125006204215012002 data
void(*) p_SetmProc(poly p, const ring r)
#define rField_is_Ring(R)
void sBucket_Add_m(sBucket_pt bucket, poly p)
sBucket_pt sBucketCreate(const ring r)
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
poly p_LPSubst(poly p, int n, poly e, const ring r)
int status int void size_t count
void p_Setm_Syz(poly p, ring r, int *Components, long *ShiftedComponents)
number ntInit(long i, const coeffs cf)
int * iv2array(intvec *iv, const ring R)
long totaldegreeWecart_IV(poly p, ring r, const int *w)