21 #define EXT_POLY_NEW 0
47 #define ENTER_USE_MEMMOVE
87 #ifdef ENTER_USE_MYMEMMOVE
88 inline void _my_memmove_d_gt_s(
unsigned long* d,
unsigned long*
s,
long l)
90 REGISTER unsigned long* _dl = (
unsigned long*) d;
91 REGISTER unsigned long* _sl = (
unsigned long*)
s;
102 inline void _my_memmove_d_lt_s(
unsigned long* d,
unsigned long*
s,
long l)
105 REGISTER unsigned long* _dl = (
unsigned long*) d;
106 REGISTER unsigned long* _sl = (
unsigned long*)
s;
117 inline void _my_memmove(
void* d,
void*
s,
long l)
119 unsigned long _d = (
unsigned long) d;
120 unsigned long _s = (
unsigned long)
s;
121 unsigned long _l = ((
l) + SIZEOF_LONG - 1) >> LOG_SIZEOF_LONG;
123 if (_d > _s) _my_memmove_d_gt_s(_d, _s, _l);
124 else _my_memmove_d_lt_s(_d, _s, _l);
128 #define memmove(d,s,l) _my_memmove(d, s, l)
135 #define pDivComp_EQUAL 2
136 #define pDivComp_LESS 1
137 #define pDivComp_GREATER -1
138 #define pDivComp_INCOMP 0
151 unsigned long la, lb;
152 unsigned long divmask =
currRing->divmask;
162 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
169 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
200 unsigned long la, lb;
201 unsigned long divmask =
currRing->divmask;
211 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
218 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
225 if (
b) {
return -1; }
253 && (L->bucket !=
NULL))
256 for (
int i=1;
i<= (int) L->bucket->buckets_used;
i++)
258 poly
p=L->bucket->buckets[
i];
263 L->bucket->buckets[
i]=
NULL;
264 L->bucket->buckets_length[
i]=0;
273 L->bucket->buckets_length[
i]=
pLength(L->bucket->buckets[
i]);
281 int i=L->bucket->buckets_used;
282 while ((
i>0)&&(L->bucket->buckets[
i]==
NULL))
285 L->bucket->buckets_used=
i;
300 poly
p = L->GetLmTailRing();
311 if (L->bucket !=
NULL)
343 L->ecart = L->pLDeg() - L->GetpFDeg();
350 if ((!fromNext) && cut)
353 L->ecart = L->pLDeg(strat->
LDegLast) - L->GetpFDeg();
378 ring r = L->tailRing;
379 poly
p = L->GetLmTailRing();
457 number eins=
nInit(1);
539 inline static unsigned long*
initsevS (
const int maxnr)
541 return (
unsigned long*)
omAlloc0(maxnr*
sizeof(
unsigned long));
545 return (
int*)
omAlloc0(maxnr*
sizeof(
int));
549 int &
length,
const int incr)
561 (
length+incr)*
sizeof(
long*));
579 for (
j=0;
j<=strat->
tl;
j++)
583 if (strat->
T[
j].max_exp !=
NULL)
593 if (strat->
T[
j].t_p !=
NULL)
601 if (
currRing->isLPring && strat->
T[
j].shift > 0)
610 if (
p == strat->
S[
i])
612 if (strat->
T[
j].t_p !=
NULL)
614 if (p_shallow_copy_delete!=
NULL)
638 for (
j=0;
j<=strat->
tl;
j++)
642 if (strat->
T[
j].max_exp !=
NULL)
652 if (strat->
T[
j].t_p !=
NULL)
664 if (
p == strat->
S[
i])
666 if (strat->
T[
j].t_p !=
NULL)
713 if ((*
k) < 0)
return FALSE;
714 if (((p1 == (*p).p1) && (p2 == (*p).p2))
715 || ((p1 == (*p).p2) && (p2 == (*p).p1)))
734 if ((*
k) < 0)
return FALSE;
746 for (
i=0;
i<=tlength;
i++)
748 if (
T[
i].
p ==
p)
return i;
759 if (
i >= 0)
return i;
762 while (strat !=
NULL);
771 for (
i=0;
i<=tlength;
i++)
787 if (
i >= 0)
return i;
790 while (strat !=
NULL);
804 #define kFalseReturn(x) do { if (!x) return FALSE;} while (0)
810 for (
i=1;
i<=tailRing->N;
i++)
813 return "Lm[i] different";
816 return "Lm[0] different";
818 return "Lm.next different";
820 return "Lm.coeff different";
827 ring tailRing =
T->tailRing;
828 ring strat_tailRing = strat->
tailRing;
829 if (strat_tailRing ==
NULL) strat_tailRing = tailRing;
830 r_assume(strat_tailRing == tailRing);
852 if (
T->t_p ==
NULL &&
i > 0)
869 if (
T->t_p !=
NULL &&
i >= 0 && TN ==
'T')
873 if (
T->max_exp !=
NULL)
874 return dReportError(
"%c[%d].max_exp is not NULL as it should be", TN,
i);
878 if (
T->max_exp ==
NULL)
890 p_Setm(test_max, tailRing);
902 if (
T->p ==
NULL &&
i > 0)
918 if ((
i >= 0) && (
T->pLength != 0)
923 return dReportError(
"%c[%d] pLength error: has %d, specified to have %d",
928 if (
i >= 0 && (TN ==
'T' || TN ==
'L'))
931 if (strat->
homog && (
T->FDeg !=
T->pFDeg()))
935 return dReportError(
"%c[%d] FDeg error: has %d, specified to have %d",
936 TN,
i ,
T->pFDeg(), d);
941 if (
i >= 0 && TN ==
'T')
953 ring strat_tailRing=strat->
tailRing;
978 if (L->bucket !=
NULL)
981 r_assume(L->bucket->bucket_ring == L->tailRing);
999 return dReportError(
"L[%d] wrong sev: has %lo, specified to have %lo",
1009 else if (tlength > 0 &&
T !=
NULL && (lpos >=0))
1013 #ifdef HAVE_SHIFTBBA
1021 #ifdef HAVE_SHIFTBBA
1042 -1, strat->
T, strat->
tl));
1045 if (strat->
T !=
NULL)
1047 for (
i=0;
i<=strat->
tl;
i++)
1056 if (strat->
L !=
NULL)
1058 for (
i=0;
i<=strat->
Ll;
i++)
1061 strat->
L[
i].Next() != strat->
tail,
i,
1062 strat->
T, strat->
tl));
1073 if (strat->
S !=
NULL)
1083 for (
i=0;
i<=strat->
sl;
i++)
1085 if (strat->
S[
i] !=
NULL &&
1088 return dReportError(
"S[%d] wrong sev: has %o, specified to have %o",
1104 for (
i=0;
i<=strat->
tl;
i++)
1106 if (strat->
T[
i].i_r < 0 || strat->
T[
i].i_r > strat->
tl)
1107 return dReportError(
"strat->T[%d].i_r == %d out of bounds",
i,
1109 if (strat->
R[strat->
T[
i].i_r] != &(strat->
T[
i]))
1113 if ((strat->
S !=
NULL)&&(strat->
tl>=0))
1115 for (
i=0;
i<=strat->
sl;
i++)
1120 if (strat->
S_2_R[
i] != strat->
T[
j].i_r)
1126 #ifdef HAVE_SHIFTBBA
1131 for (
i=0;
i<=strat->
Ll;
i++)
1133 if (strat->
L[
i].p1 !=
NULL && strat->
L[
i].p2)
1135 if (strat->
L[
i].i_r1 < 0 ||
1136 strat->
L[
i].i_r1 > strat->
tl ||
1137 strat->
L[
i].T_1(strat)->p != strat->
L[
i].p1)
1139 if (strat->
L[
i].i_r2 < 0 ||
1140 strat->
L[
i].i_r2 > strat->
tl ||
1141 strat->
L[
i].T_2(strat)->p != strat->
L[
i].p2)
1146 if (strat->
L[
i].i_r1 != -1)
1148 if (strat->
L[
i].i_r2 != -1)
1151 if (strat->
L[
i].i_r != -1)
1165 #ifdef ENTER_USE_MEMMOVE
1166 memmove(&(strat->
S[
i]), &(strat->
S[
i+1]), (strat->
sl -
i)*
sizeof(poly));
1168 memmove(&(strat->
sevS[
i]),&(strat->
sevS[
i+1]),(strat->
sl -
i)*
sizeof(
unsigned long));
1169 memmove(&(strat->
S_2_R[
i]),&(strat->
S_2_R[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1172 for (
j=
i;
j<strat->
sl;
j++)
1174 strat->
S[
j] = strat->
S[
j+1];
1182 #ifdef ENTER_USE_MEMMOVE
1183 memmove(&(strat->
lenS[
i]),&(strat->
lenS[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1190 #ifdef ENTER_USE_MEMMOVE
1198 #ifdef ENTER_USE_MEMMOVE
1199 memmove(&(strat->
fromQ[
i]),&(strat->
fromQ[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1201 for (
j=
i;
j<strat->
sl;
j++)
1217 #ifdef ENTER_USE_MEMMOVE
1218 memmove(&(strat->
S[
i]), &(strat->
S[
i+1]), (strat->
sl -
i)*
sizeof(poly));
1219 memmove(&(strat->
sig[
i]), &(strat->
sig[
i+1]), (strat->
sl -
i)*
sizeof(poly));
1221 memmove(&(strat->
sevS[
i]),&(strat->
sevS[
i+1]),(strat->
sl -
i)*
sizeof(
unsigned long));
1222 memmove(&(strat->
sevSig[
i]),&(strat->
sevSig[
i+1]),(strat->
sl -
i)*
sizeof(
unsigned long));
1223 memmove(&(strat->
S_2_R[
i]),&(strat->
S_2_R[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1226 for (
j=
i;
j<strat->
sl;
j++)
1228 strat->
S[
j] = strat->
S[
j+1];
1238 #ifdef ENTER_USE_MEMMOVE
1239 memmove(&(strat->
lenS[
i]),&(strat->
lenS[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1246 #ifdef ENTER_USE_MEMMOVE
1254 #ifdef ENTER_USE_MEMMOVE
1255 memmove(&(strat->
fromQ[
i]),&(strat->
fromQ[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1257 for (
j=
i;
j<strat->
sl;
j++)
1276 if (set[
j].sig!=
NULL)
1310 #ifdef ENTER_USE_MEMMOVE
1314 for (
i=
j;
i < (*length);
i++)
1336 #ifdef ENTER_USE_MEMMOVE
1337 memmove(&((*set)[at+1]), &((*set)[at]), ((*
length)-at+1)*
sizeof(
LObject));
1339 for (
i=(*
length)+1;
i>=at+1;
i--) (*set)[
i] = (*set)[
i-1];
1353 h->FDeg =
h->pFDeg();
1354 h->ecart =
h->pLDeg() -
h->FDeg;
1361 h->FDeg =
h->pFDeg();
1368 Lp->FDeg = Lp->pFDeg();
1375 Lp->FDeg = Lp->pFDeg();
1376 (*Lp).ecart =
si_max(ecartF,ecartG);
1377 (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -
p_FDeg((*Lp).lcm,
currRing));
1386 return (ecart1 <= ecart2);
1418 int j,compare,compareCoeff;
1422 h.ecart=0;
h.length=0;
1446 for(
j = strat->
Bl;
j>=0;
j--)
1567 h.i_r1 = -1;
h.i_r2 = -1;
1583 posx = strat->
posInL(strat->
B,strat->
Bl,&
h,strat);
1588 else strat->
P.sev=0L;
1602 poly m1, m2,
gcd,si;
1631 for (
int j = 0;
j < strat->
sl;
j++)
1637 && !(strat->
sevS[
j] & ~sev)
1680 PrintS(
"\n--- create strong gcd poly: ");
1683 Print(
"\n strat->S[%d]: ",
i);
1706 h.i_r1 = -1;
h.i_r2 = -1;
1712 h.p1 =
p;
h.p2 = strat->
S[
i];
1727 posx = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
1732 if(
h.IsNull())
return FALSE;
1749 if(strat->
sl < 0)
return FALSE;
1751 for(
i=0;
i<strat->
sl;
i++)
1787 h->i_r1 = -1;
h->i_r2 = -1;
1809 poly m1, m2,
gcd,si;
1857 PrintS(
"\n--- create strong gcd poly: ");
1860 Print(
"\n strat->S[%d]: ",
i);
1884 if(
pLmCmp(pSigMult,sSigMult) == 0)
1893 if(
pLtCmp(pSigMult,sSigMult)==1)
1912 h.i_r1 = -1;
h.i_r2 = -1;
1920 int red_result =
redRing(&
h,strat);
1930 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1947 int red_result =
redRing(&
h,strat);
1957 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1970 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1974 h.p1 =
p;
h.p2 = strat->
S[
i];
2008 Lp.ecart=0; Lp.length=0;
2013 #ifndef HAVE_RATGRING
2015 #elif defined(HAVE_RATGRING)
2032 if((!((strat->
ecartS[
i]>0)&&(ecart>0)))
2125 for(
j = strat->
Bl;
j>=0;
j--)
2224 Lp.p1 = strat->
S[
i];
2238 Lp.i_r1 = strat->
S_2_R[
i];
2252 && (Lp.p->coef!=
NULL))
2256 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2296 Lp.ecart=0; Lp.length=0;
2303 if((!((strat->
ecartS[
i]>0)&&(ecart>0)))
2399 for(
j = strat->
Bl;
j>=0;
j--)
2455 Lp.p1 = strat->
S[
i];
2462 Lp.i_r1 = strat->
S_2_R[
i];
2476 && (Lp.p->coef!=
NULL))
2480 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2504 unsigned long pSigMultNegSev,sSigMultNegSev;
2508 Lp.ecart=0; Lp.length=0;
2513 #ifndef HAVE_RATGRING
2515 #elif defined(HAVE_RATGRING)
2545 PrintS(
"----------------\n");
2548 PrintS(
"----------------\n");
2554 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2575 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2576 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
2577 || strat->
rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,
i+1)
2654 Lp.sevSig = ~pSigMultNegSev;
2661 Lp.sevSig = ~sSigMultNegSev;
2672 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
2686 Lp.checked = strat->
sl+1;
2693 Lp.prod_crit =
TRUE;
2705 PrintS(
"SIGNATURE OF PAIR: ");
2709 Lp.p1 = strat->
S[
i];
2723 Lp.i_r1 = strat->
S_2_R[
i];
2737 && (Lp.p->coef!=
NULL))
2779 unsigned long pSigMultNegSev,sSigMultNegSev;
2783 Lp.ecart=0; Lp.length=0;
2788 #ifndef HAVE_RATGRING
2790 #elif defined(HAVE_RATGRING)
2826 if(pSigMult !=
NULL)
2829 if(sSigMult !=
NULL)
2833 Print(
"----------------\n");
2836 Print(
"----------------\n");
2840 if(pSigMult !=
NULL && sSigMult !=
NULL)
2849 if(pSigMult ==
NULL)
2851 if(sSigMult ==
NULL)
2861 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2883 int red_result =
redRing(&Lp,strat);
2893 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2895 strat->
enterS(Lp,0,strat,strat->
tl);
2909 Lp.sig =
pCopy(pSigMult);
2938 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2939 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
3021 Lp.sig =
pNeg(Lp.sig);
3032 Lp.sevSig = ~pSigMultNegSev;
3039 Lp.sevSig = ~sSigMultNegSev;
3051 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
3065 Lp.checked = strat->
sl+1;
3072 Lp.prod_crit =
TRUE;
3084 PrintS(
"SIGNATURE OF PAIR: ");
3088 Lp.p1 = strat->
S[
i];
3103 Lp.i_r1 = strat->
S_2_R[
i];
3117 && (Lp.p->coef!=
NULL))
3125 int red_result =
redRing(&Lp,strat);
3135 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
3138 strat->
enterS(Lp,0,strat, strat->
tl+1);
3190 Lp.p1 = strat->
S[
i];
3194 Lp.i_r1 = strat->
S_2_R[
i];
3209 && (Lp.p->coef!=
NULL))
3212 l = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
3223 int j=strat->
Ll+strat->
Bl+1;
3231 for (
i=strat->
Bl;
i>=0;
i--)
3233 j = strat->
posInL(strat->
L,
j,&(strat->
B[
i]),strat);
3244 int j=strat->
Ll+strat->
Bl+1;
3252 for (
i=strat->
Bl;
i>=0;
i--)
3275 #ifdef HAVE_SHIFTBBA
3279 for (
j=0;
j<=strat->
sl;
j++)
3283 for (
i=strat->
Bl;
i>=0;
i--)
3298 for (
j=0;
j<=strat->
sl;
j++)
3302 for (
i=strat->
Bl;
i>=0;
i--)
3325 for (
j=strat->
Ll;
j>=0;
j--)
3331 if (strat->
L[
j].p == strat->
tail)
3377 for (
j=strat->
Ll;
j>=0;
j--)
3397 for(
i=
j-1;
i>=0;
i--)
3416 for (
j=strat->
Ll;
j>=0;
j--)
3447 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3450 if (strat->
L[
j].p2 ==
p)
3456 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3470 strat->
L[
i].p2 = strat->
tail;
3487 else if (strat->
L[
j].p2 == strat->
tail)
3526 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3529 if (strat->
L[
j].p2 ==
p)
3535 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3549 strat->
L[
i].p2 = strat->
tail;
3566 else if (strat->
L[
j].p2 == strat->
tail)
3574 #ifdef HAVE_RATGRING
3587 for (
j=0;
j<=strat->
sl;
j++)
3591 for (
i=strat->
Bl;
i>=0;
i--)
3599 Print(
"chain-crit-part: S[%d]=",
j);
3601 Print(
" divide B[%d].lcm=",
i);
3623 for (
j=strat->
Ll;
j>=0;
j--)
3629 if (strat->
L[
j].p == strat->
tail)
3633 PrintS(
"chain-crit-part: pCompareChainPart p=");
3635 Print(
" delete L[%d]",
j);
3664 Print(
"chain-crit-part: sugar B[%d].lcm=",
j);
3666 Print(
" delete B[%d]",
i);
3677 Print(
"chain-crit-part: sugar B[%d].lcm=",
i);
3679 Print(
" delete B[%d]",
j);
3699 for (
j=strat->
Ll;
j>=0;
j--)
3707 PrintS(
"chain-crit-part: sugar:pCompareChainPart p=");
3709 Print(
" delete L[%d]",
j);
3727 for(
i=
j-1;
i>=0;
i--)
3733 Print(
"chain-crit-part: equal lcm B[%d].lcm=",
j);
3735 Print(
" delete B[%d]\n",
i);
3752 for (
j=strat->
Ll;
j>=0;
j--)
3760 PrintS(
"chain-crit-part: pCompareChainPart p=");
3762 Print(
" delete L[%d]",
j);
3791 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3794 if (strat->
L[
j].p2 ==
p)
3800 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3817 strat->
L[
i].p2 = strat->
tail;
3824 PrintS(
"chain-crit-part: divisible_by p=");
3826 Print(
" delete L[%d]",
l);
3837 PrintS(
"chain-crit-part: divisible_by(2) p=");
3839 Print(
" delete L[%d]",
i);
3850 else if (strat->
L[
j].p2 == strat->
tail)
3878 for (
j=0;
j<=
k;
j++)
3891 for (
j=0;
j<=
k;
j++)
3900 for (
j=0;
j<=
k;
j++)
3913 #ifdef HAVE_RATGRING
3943 for (
j=0;
j<=
k;
j++)
3956 for (
j=0;
j<=
k;
j++)
3965 for (
j=0;
j<=
k;
j++)
3979 #ifdef HAVE_RATGRING
4036 #ifdef HAVE_RATGRING
4063 for (
j=0;
j<=strat->
sl;
j++)
4067 for (
i=strat->
Bl;
i>=0;
i--)
4074 PrintS(
"--- chain criterion func chainCritRing type 1\n");
4077 PrintS(
" strat->B[i].lcm:");
4082 wrp(strat->
B[
i].lcm);
4097 for (
j=strat->
Ll;
j>=0;
j--)
4110 PrintS(
"--- chain criterion func chainCritRing type 2\n");
4111 PrintS(
"strat->L[j].p:");
4142 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
4145 if (strat->
L[
j].p2 ==
p)
4160 PrintS(
"--- chain criterion func chainCritRing type 3\n");
4161 PrintS(
"strat->L[j].lcm:");
4162 wrp(strat->
L[
j].lcm);
4163 PrintS(
" strat->L[i].lcm:");
4164 wrp(strat->
L[
i].lcm);
4178 strat->
L[
i].p2 = strat->
tail;
4195 else if (strat->
L[
j].p2 == strat->
tail)
4221 for (
j=0;
j<=
k;
j++)
4233 for (
j=0;
j<=
k;
j++)
4241 for (
j=0;
j<=
k;
j++)
4253 #ifdef HAVE_RATGRING
4278 && ((iCompH<=strat->syzComp)||(strat->
syzComp==0)))
4325 PrintS(
"--- create zero spoly: ");
4354 posx = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
4407 PrintS(
"--- create zero spoly: ");
4435 int red_result =
redRing(&Lp,strat);
4445 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
4447 strat->
enterS(Lp,0,strat,strat->
tl);
4495 if ( (!strat->
fromT)
4555 if ( (!strat->
fromT)
4580 if ( (!strat->
fromT)
4605 for (
j=0;
j<=
k;
j++)
4608 if ((iCompH==iCompSj)
4619 for (
j=0;
j<=
k;
j++)
4622 if ((iCompH==iCompSj)
4674 int i,
j,at,ecart, s2r;
4678 int new_suc=strat->
sl+1;
4682 for (;
i<=strat->
sl;
i++)
4687 if (new_suc > at) new_suc = at;
4690 sev = strat->
sevS[
i];
4693 for (
j=
i;
j>=at+1;
j--)
4695 strat->
S[
j] = strat->
S[
j-1];
4701 strat->
ecartS[at] = ecart;
4702 strat->
sevS[at] = sev;
4703 strat->
S_2_R[at] = s2r;
4706 for (
j=
i;
j>=at+1;
j--)
4710 strat->
fromQ[at]=fq;
4714 if (new_suc <= strat->sl) *suc=new_suc;
4777 if (cmp == cmp_int)
return an;
4778 if (cmp == -cmp_int)
return en;
4784 if (cmp == cmp_int) en =
i;
4785 else if (cmp == -cmp_int) an =
i;
4801 if (
pLmCmp(set[an],
p) == cmp_int)
return an;
4802 if (
pLmCmp(set[an],
p) == -cmp_int)
return en;
4804 && ((strat->
ecartS[an])>ecart_p))
4810 else if (
pLmCmp(set[
i],
p) == -cmp_int) an=
i;
4814 &&((strat->
ecartS[
i])<ecart_p))
4842 || ((op == o) && (
pLtCmp(set[mon],
p) == -1)))
4853 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
4860 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
4886 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
4893 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
4905 if(end < 0 || end >=
IDELEMS(F))
4907 if (end<0)
return 0;
4914 for(
i=start;
i<end;
i++)
4928 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
4935 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
4960 if (
length==-1)
return 0;
4988 if (
length==-1)
return 0;
5000 if (set[an].
length>
p.length)
return an;
5016 if (
length==-1)
return 0;
5018 int o =
p.GetpFDeg();
5019 int op = set[
length].GetpFDeg();
5033 op= set[an].GetpFDeg();
5040 op = set[
i].GetpFDeg();
5052 if (
length==-1)
return 0;
5054 int o =
p.GetpFDeg();
5055 int op = set[
length].GetpFDeg();
5069 op= set[an].GetpFDeg();
5076 op = set[
i].GetpFDeg();
5093 if (
length==-1)
return 0;
5094 int o =
p.GetpFDeg();
5095 int op = set[
length].GetpFDeg();
5107 op = set[an].GetpFDeg();
5108 if (op > o)
return an;
5109 if (op < 0)
return en;
5111 if (cmp == cmp_int)
return an;
5112 if (cmp == -cmp_int)
return en;
5117 op = set[
i].GetpFDeg();
5119 else if (op < o) an =
i;
5123 if (cmp == cmp_int) en =
i;
5124 else if (cmp == -cmp_int) an =
i;
5169 if (
length==-1)
return 0;
5172 int o =
p.GetpFDeg();
5173 int op = set[
length].GetpFDeg();
5177 || (( op == o) && (set[
length].length ==
p.length)
5188 op = set[an].GetpFDeg();
5190 || (( op == o) && (set[an].
length >
p.length))
5191 || (( op == o) && (set[an].length ==
p.length)
5197 op = set[
i].GetpFDeg();
5199 || (( op == o) && (set[
i].
length >
p.length))
5200 || (( op == o) && (set[
i].length ==
p.length)
5211 if (
length==-1)
return 0;
5214 int o =
p.GetpFDeg();
5215 int op = set[
length].GetpFDeg();
5219 || (( op == o) && (set[
length].length ==
p.length)
5230 op = set[an].GetpFDeg();
5232 || (( op == o) && (set[an].
length >
p.length))
5233 || (( op == o) && (set[an].length ==
p.length)
5239 op = set[
i].GetpFDeg();
5241 || (( op == o) && (set[
i].
length >
p.length))
5242 || (( op == o) && (set[
i].length ==
p.length)
5258 if (
length==-1)
return 0;
5260 int o =
p.GetpFDeg();
5262 if (set[
length].GetpFDeg() <= o)
5272 if (set[an].GetpFDeg() > o)
5277 if (set[
i].GetpFDeg() > o)
5287 if (
length==-1)
return 0;
5288 int ol =
p.GetpLength();
5290 int oo=set[
length].ecart;
5292 if ((oo < op) || ((oo==op) && (set[
length].
length <= ol)))
5302 int oo=set[an].ecart;
5304 || ((oo==op) && (set[an].
pLength > ol)))
5309 int oo=set[
i].ecart;
5311 || ((oo == op) && (set[
i].
pLength > ol)))
5343 if (
length==-1)
return 0;
5345 int o =
p.GetpFDeg() +
p.ecart;
5360 op = set[an].GetpFDeg()+set[an].ecart;
5367 op = set[
i].GetpFDeg()+set[
i].ecart;
5379 if (
length==-1)
return 0;
5381 int o =
p.GetpFDeg() +
p.ecart;
5396 op = set[an].GetpFDeg()+set[an].ecart;
5403 op = set[
i].GetpFDeg()+set[
i].ecart;
5440 if (
length==-1)
return 0;
5442 int o =
p.GetpFDeg() +
p.ecart;
5446 || (( op == o) && (set[
length].ecart >
p.ecart))
5447 || (( op == o) && (set[
length].ecart==
p.ecart)
5458 op = set[an].GetpFDeg()+set[an].ecart;
5460 || (( op == o) && (set[an].ecart <
p.ecart))
5461 || (( op == o) && (set[an].ecart==
p.ecart)
5467 op = set[
i].GetpFDeg()+set[
i].ecart;
5469 || (( op == o) && (set[
i].ecart <
p.ecart))
5470 || (( op == o) && (set[
i].ecart ==
p.ecart)
5481 if (
length==-1)
return 0;
5483 int o =
p.GetpFDeg() +
p.ecart;
5487 || (( op == o) && (set[
length].ecart >
p.ecart))
5488 || (( op == o) && (set[
length].ecart==
p.ecart)
5499 op = set[an].GetpFDeg()+set[an].ecart;
5501 || (( op == o) && (set[an].ecart <
p.ecart))
5502 || (( op == o) && (set[an].ecart==
p.ecart)
5508 op = set[
i].GetpFDeg()+set[
i].ecart;
5510 || (( op == o) && (set[
i].ecart <
p.ecart))
5511 || (( op == o) && (set[
i].ecart ==
p.ecart)
5527 if (
length==-1)
return 0;
5531 int o =
p.GetpFDeg() +
p.ecart;
5540 || ((op == o) && (set[
length].ecart >
p.ecart))
5541 || ((op == o) && (set[
length].ecart==
p.ecart)
5557 int op = set[an].GetpFDeg()+set[an].ecart;
5559 || ((op == o) && (set[an].ecart <
p.ecart))
5560 || ((op == o) && (set[an].ecart==
p.ecart)
5571 int op = set[
i].GetpFDeg()+set[
i].ecart;
5573 || ((op == o) && (set[
i].ecart <
p.ecart))
5574 || ((op == o) && (set[
i].ecart ==
p.ecart)
5588 if (
length==-1)
return 0;
5592 int o =
p.GetpFDeg() +
p.ecart;
5601 || ((op == o) && (set[
length].ecart >
p.ecart))
5602 || ((op == o) && (set[
length].ecart==
p.ecart)
5618 int op = set[an].GetpFDeg()+set[an].ecart;
5620 || ((op == o) && (set[an].ecart <
p.ecart))
5621 || ((op == o) && (set[an].ecart==
p.ecart)
5632 int op = set[
i].GetpFDeg()+set[
i].ecart;
5634 || ((op == o) && (set[
i].ecart <
p.ecart))
5635 || ((op == o) && (set[
i].ecart ==
p.ecart)
5655 if (
length==-1)
return 0;
5658 int op=
p.GetpFDeg();
5660 if (set[
length].ecart < o)
5662 if (set[
length].ecart == o)
5664 int oo=set[
length].GetpFDeg();
5665 if ((oo < op) || ((oo==op) && (set[
length].
length <
p.length)))
5676 if (set[an].ecart > o)
5678 if (set[an].ecart == o)
5680 int oo=set[an].GetpFDeg();
5682 || ((oo==op) && (set[an].
length >
p.length)))
5688 if (set[
i].ecart > o)
5690 else if (set[
i].ecart == o)
5692 int oo=set[
i].GetpFDeg();
5694 || ((oo == op) && (set[
i].
length >
p.length)))
5714 int d=
p->GetpFDeg();
5715 int op=set[
length].GetpFDeg();
5729 op=set[an].GetpFDeg();
5731 || ((op == d) && (
p->p1!=
NULL) && (set[an].p1==
NULL))
5737 op=set[
i].GetpFDeg();
5739 || ((op==d) && (
p->p1!=
NULL) && (set[
i].p1==
NULL))
5852 cmp =
pLtCmp(set[an].sig,
p->sig);
5859 if (set[an].FDeg >
p->FDeg)
5861 if (set[an].FDeg < p->FDeg)
5863 if (set[an].FDeg ==
p->FDeg)
5881 if (set[
i].FDeg >
p->FDeg)
5883 if (set[
i].FDeg < p->FDeg)
5885 if (set[
i].FDeg ==
p->FDeg)
5900 if (
length < 0)
return 0;
5901 if (set[
length].FDeg >
p->FDeg)
5903 if (set[
length].FDeg ==
p->FDeg)
5904 if(set[
length].GetpLength() >
p->GetpLength())
5915 if (set[an].FDeg >
p->FDeg)
5917 if(set[an].FDeg ==
p->FDeg)
5919 if(set[an].GetpLength() >
p->GetpLength())
5923 if(set[an].GetpLength() ==
p->GetpLength())
5940 if (set[
i].FDeg >
p->FDeg)
5944 if(set[
i].FDeg ==
p->FDeg)
5946 if(set[
i].GetpLength() >
p->GetpLength())
5950 if(set[
i].GetpLength() ==
p->GetpLength())
5972 if (strat->
syzl==0)
return 0;
5977 int en= strat->
syzl-1;
6015 int o =
p->GetpFDeg();
6016 int op = set[
length].GetpFDeg();
6028 op = set[an].GetpFDeg();
6035 op = set[
i].GetpFDeg();
6057 int o =
p->GetpFDeg();
6058 int op = set[
length].GetpFDeg();
6070 op = set[an].GetpFDeg();
6077 op = set[
i].GetpFDeg();
6091 int o =
p->GetpFDeg();
6092 int op = set[
length].GetpFDeg();
6104 op = set[an].GetpFDeg();
6111 op = set[
i].GetpFDeg();
6125 if (
length < 0)
return 0;
6135 if (set[an].FDeg >
p->FDeg)
6137 if (set[an].FDeg < p->FDeg)
6139 if (set[an].FDeg ==
p->FDeg)
6147 if (set[an].t_p!=
NULL)
6169 if (set[
i].FDeg >
p->FDeg)
6171 if (set[
i].FDeg < p->FDeg)
6173 if (set[
i].FDeg ==
p->FDeg)
6181 if (set[
i].t_p!=
NULL)
6213 if (coeff == 0)
return -1;
6216 while (tmp % 2 == 0)
6235 if (
length < 0)
return 0;
6237 int o =
p->GetpFDeg();
6238 int op = set[
length].GetpFDeg();
6249 op = set[an].GetpFDeg();
6250 if ((op > o) || ((op == o) && (
pLmCmp(set[an].
p,
p->p) != -
currRing->OrdSgn)))
6255 op = set[
i].GetpFDeg();
6313 int o =
p->GetpFDeg();
6314 int op = set[
length].GetpFDeg();
6318 || ((op == o) && (set[
length].length <=
p->length)
6328 op = set[an].GetpFDeg();
6330 || ((op == o) && (set[an].
length >
p->length))
6331 || ((op == o) && (set[an].length <=
p->length)
6337 op = set[
i].GetpFDeg();
6339 || ((op == o) && (set[
i].
length >
p->length))
6340 || ((op == o) && (set[
i].length <=
p->length)
6354 int o =
p->GetpFDeg();
6355 int op = set[
length].GetpFDeg();
6359 || ((op == o) && (set[
length].length <=
p->length)
6369 op = set[an].GetpFDeg();
6371 || ((op == o) && (set[an].
length >
p->length))
6372 || ((op == o) && (set[an].length <=
p->length)
6378 op = set[
i].GetpFDeg();
6380 || ((op == o) && (set[
i].
length >
p->length))
6381 || ((op == o) && (set[
i].length <=
p->length)
6401 int o =
p->GetpFDeg();
6403 if (set[
length].GetpFDeg() > o)
6413 if (set[an].GetpFDeg() >= o)
6418 if (set[
i].GetpFDeg() >= o)
6436 int o =
p->GetpFDeg() +
p->ecart;
6449 op = set[an].GetpFDeg() + set[an].ecart;
6456 op = set[
i].GetpFDeg() + set[
i].ecart;
6471 int o =
p->GetpFDeg() +
p->ecart;
6484 op = set[an].GetpFDeg() + set[an].ecart;
6491 op = set[
i].GetpFDeg() + set[
i].ecart;
6512 int o =
p->GetpFDeg() +
p->ecart;
6516 && (set[
length].ecart >
p->ecart))
6518 && (set[
length].ecart ==
p->ecart)
6528 if ((set[an].GetpFDeg() + set[an].ecart > o)
6529 || ((set[an].GetpFDeg() + set[an].ecart == o)
6530 && (set[an].ecart >
p->ecart))
6531 || ((set[an].GetpFDeg() + set[an].ecart == o)
6532 && (set[an].ecart ==
p->ecart)
6538 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6539 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6540 && (set[
i].ecart >
p->ecart))
6541 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6542 && (set[
i].ecart ==
p->ecart)
6556 int o =
p->GetpFDeg() +
p->ecart;
6560 && (set[
length].ecart >
p->ecart))
6562 && (set[
length].ecart ==
p->ecart)
6572 if ((set[an].GetpFDeg() + set[an].ecart > o)
6573 || ((set[an].GetpFDeg() + set[an].ecart == o)
6574 && (set[an].ecart >
p->ecart))
6575 || ((set[an].GetpFDeg() + set[an].ecart == o)
6576 && (set[an].ecart ==
p->ecart)
6582 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6583 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6584 && (set[
i].ecart >
p->ecart))
6585 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6586 && (set[
i].ecart ==
p->ecart)
6609 int o =
p->GetpFDeg() +
p->ecart;
6617 && (set[
length].ecart >
p->ecart))
6619 && (set[
length].ecart ==
p->ecart)
6634 if ((set[an].GetpFDeg() + set[an].ecart > o)
6635 || ((set[an].GetpFDeg() + set[an].ecart == o)
6636 && (set[an].ecart >
p->ecart))
6637 || ((set[an].GetpFDeg() + set[an].ecart == o)
6638 && (set[an].ecart ==
p->ecart)
6649 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6650 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6651 && (set[
i].ecart >
p->ecart))
6652 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6653 && (set[
i].ecart ==
p->ecart)
6673 int o =
p->GetpFDeg() +
p->ecart;
6681 && (set[
length].ecart >
p->ecart))
6683 && (set[
length].ecart ==
p->ecart)
6698 if ((set[an].GetpFDeg() + set[an].ecart > o)
6699 || ((set[an].GetpFDeg() + set[an].ecart == o)
6700 && (set[an].ecart >
p->ecart))
6701 || ((set[an].GetpFDeg() + set[an].ecart == o)
6702 && (set[an].ecart ==
p->ecart)
6713 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6714 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6715 && (set[
i].ecart >
p->ecart))
6716 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6717 && (set[
i].ecart ==
p->ecart)
6736 PrintS(
"syzygy criterion checks: ");
6739 for (
int k=0;
k<strat->
syzl;
k++)
6744 Print(
"checking with: %d / %d -- \n",
k,strat->
syzl);
6773 PrintS(
"--- syzygy criterion checks: ");
6798 Print(
"checking with: %d -- ",
k);
6823 PrintS(
"rewritten criterion checks: ");
6826 for(
int k = strat->
sl;
k>=start;
k--)
6830 PrintS(
"checking with: ");
6846 PrintS(
"ALL ELEMENTS OF S\n----------------------------------------\n");
6847 for(
int kk = 0; kk<strat->
sl+1; kk++)
6851 PrintS(
"------------------------------\n");
6881 for (
int ii=strat->
sl; ii>start; ii--)
6887 if (!(
pLmCmp(p1,p2) == 1))
6906 for (
int i=strat->
Bl;
i>-1;
i--)
6927 for (
int ii=strat->
sl; ii>-1; ii--)
6933 if (!(
pLmCmp(p1,p2) == 1))
6954 const unsigned long not_sev = ~L->sev;
6955 const unsigned long* sev = strat->
sevS;
6968 if (
j > end_pos)
return NULL;
6969 #if defined(PDEBUG) || defined(PDIV_DEBUG)
6971 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
6976 if (!(sev[
j] & not_sev) &&
6977 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]) &&
6991 if (
j > end_pos)
return NULL;
6992 #if defined(PDEBUG) || defined(PDIV_DEBUG)
6999 if (!(sev[
j] & not_sev) &&
7000 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]) &&
7011 if (strat->
tl < 0 || strat->
S_2_R[
j] == -1)
7032 if (
j > end_pos)
return NULL;
7034 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7038 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7044 if (! (sev[
j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7047 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[
j]);
7063 if (
j > end_pos)
return NULL;
7065 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7075 if (! (sev[
j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7078 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[
j]);
7129 if (With ==
NULL)
break;
7139 return redtail(L, end_pos, strat);
7145 if (hn ==
NULL)
goto all_done;
7166 return redtail(&L, end_pos, strat);
7174 p =
h = L->GetLmTailRing();
7176 return L->GetLmCurrRing();
7211 Ln.SetShortExpVector();
7217 With = &(strat->
T[
j]);
7218 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7223 if (With ==
NULL)
break;
7224 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7251 pNext(
h) = Ln.LmExtractAndIter();
7254 }
while (!Ln.IsNull());
7257 if (Ln.IsNull())
goto all_done;
7258 if (! withT) With_s.Init(
currRing);
7260 pNext(
h) = Ln.LmExtractAndIter();
7279 return L->GetLmCurrRing();
7287 p =
h = L->GetLmTailRing();
7289 return L->GetLmCurrRing();
7296 Ln.pLength = L->GetpLength() - 1;
7320 Ln.SetShortExpVector();
7326 With = &(strat->
T[
j]);
7331 if (With ==
NULL)
break;
7358 pNext(
h) = Ln.LmExtractAndIter();
7361 }
while (!Ln.IsNull());
7373 if (! withT) With_s.Init(
currRing);
7375 pNext(
h) = Ln.LmExtractAndIter();
7394 return L->GetLmCurrRing();
7404 p =
h = L->GetLmTailRing();
7439 Ln.SetShortExpVector();
7452 With = &(strat->
T[
j]);
7453 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7470 pNext(
h) = Ln.LmExtractAndIter();
7473 }
while (!Ln.IsNull());
7481 With = &(strat->
T[
j]);
7482 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7499 pNext(
h) = Ln.LmExtractAndIter();
7502 }
while (!Ln.IsNull());
7506 if (Ln.IsNull())
goto all_done;
7508 pNext(
h) = Ln.LmExtractAndIter();
7533 p =
h = L->GetLmTailRing();
7535 return L->GetLmCurrRing();
7542 Ln.pLength = L->GetpLength() - 1;
7555 Ln.SetShortExpVector();
7557 if (With ==
NULL)
break;
7567 poly p_Ln=Ln.GetLmCurrRing();
7568 poly p_With=With->GetLmCurrRing();
7580 if (Ln.bucket!=
NULL)
7611 pNext(
h) = Ln.LmExtractAndIter();
7614 }
while (!Ln.IsNull());
7617 if (Ln.IsNull())
goto all_done;
7620 pNext(
h) = Ln.LmExtractAndIter();
7638 return L->GetLmCurrRing();
7647 p =
h = L->GetLmTailRing();
7649 return L->GetLmCurrRing();
7656 Ln.pLength = L->GetpLength() - 1;
7669 Ln.SetShortExpVector();
7672 if (With ==
NULL)
break;
7681 poly p_Ln=Ln.GetLmCurrRing();
7682 poly p_With=With->GetLmCurrRing();
7695 pNext(
h) = Ln.LmExtractAndIter();
7698 }
while (!Ln.IsNull());
7703 if (Ln.IsNull())
goto all_done;
7705 pNext(
h) = Ln.LmExtractAndIter();
7723 return L->GetLmCurrRing();
7739 if (strat->
Ll != *reduc)
7741 if (strat->
Ll != *reduc-1)
7753 if (red_result == 0)
7755 else if (red_result < 0)
7757 if ((red_result > 0) || ((strat->
Ll % 100)==99))
7759 if (strat->
Ll != *reduc && strat->
Ll > 0)
7776 Print(
"product criterion:%d chain criterion:%d\n",strat->
cp,strat->
c3);
7777 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
7778 #ifdef HAVE_SHIFTBBA
7780 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
7791 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
7792 #ifdef HAVE_SHIFTBBA
7794 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
7809 for (
i=0;
i<=strat->
sl;
i++)
7821 for (
i=0;
i<=strat->
tl;
i++)
7825 if (strat->
T[
i].length==0) strat->
T[
i].length=
pLength(strat->
T[
i].p);
7826 Print(
" o:%ld e:%d l:%d",
7827 strat->
T[
i].pFDeg(),strat->
T[
i].ecart,strat->
T[
i].length);
7832 for (
i=strat->
Ll;
i>=0;
i--)
7841 Print(
" o:%ld e:%d l:%d",
7842 strat->
L[
i].pFDeg(),strat->
L[
i].ecart,strat->
L[
i].length);
7864 strat->
S=strat->
Shdl->m;
7869 memset(strat->
fromQ,0,
i*
sizeof(
int));
7898 strat->
enterS(
h,pos,strat,-1);
7899 strat->
fromQ[pos]=1;
7932 strat->
enterS(
h,pos,strat,-1);
7958 strat->
S=strat->
Shdl->m;
7963 memset(strat->
fromQ,0,
i*
sizeof(
int));
7992 strat->
enterS(
h,pos,strat,-1);
7993 strat->
fromQ[pos]=1;
8025 pos = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
8055 strat->
S = strat->
Shdl->m;
8068 memset(strat->
fromQ,0,
i*
sizeof(
int));
8097 strat->
enterS(
h,pos,strat,-1);
8098 strat->
fromQ[pos]=1;
8208 for(
i=1;
i<=strat->
sl;
i++)
8220 strat->
syz = (poly *)
omAlloc(ps*
sizeof(poly));
8224 #if defined(DEBUGF5) || defined(DEBUGF51)
8225 PrintS(
"------------- GENERATING SYZ RULES NEW ---------------\n");
8232 while (i <= strat->sl)
8262 for (
k = 0;
k<
i;
k++)
8306 for (
k = 0;
k<strat->
sl+1;
k++)
8327 PrintS(
"Principal syzygies:\n");
8330 Print(
"ps %d\n",ps);
8331 PrintS(
"--------------------------------\n");
8341 PrintS(
"--------------------------------\n");
8361 strat->
S=strat->
Shdl->m;
8367 memset(strat->
fromQ,0,
i*
sizeof(
int));
8396 strat->
enterS(
h,pos,strat, strat->
tl+1);
8398 strat->
fromQ[pos]=1;
8426 strat->
enterS(
h,pos,strat, strat->
tl+1);
8468 h.is_normalized = 0;
8475 strat->
enterS(
h,pos,strat, strat->
tl+1);
8505 strat->
S=strat->
Shdl->m;
8511 memset(strat->
fromQ,0,
i*
sizeof(
int));
8540 strat->
enterS(
h,pos,strat, strat->
tl+1);
8542 strat->
fromQ[pos]=1;
8570 strat->
enterS(
h,pos,strat, strat->
tl+1);
8612 h.is_normalized = 0;
8619 strat->
enterS(
h,pos,strat, strat->
tl+1);
8643 while (
j <= maxIndex)
8660 if (!
pIsVector((*p).p) && ((*p).ecart != 0))
8669 h1 = r =
pCopy((*p).p);
8722 while ((j <= strat->sl) && (
pGetComp(strat->
S[
j])!=0))
j++;
8724 while (j<=strat->sl)
8748 while (
j <= maxIndex)
8802 while (
j <= maxIndex);
8832 while (i<=strat->sl)
8843 if (
pCmp(redSi,strat->
S[
i])!=0)
8900 if (any_change)
reorderS(&suc,strat);
8905 for (
i=0;
i<=strat->
sl;
i++)
8931 #ifdef HAVE_SHIFTBBA
8943 while (i<=strat->sl)
8955 else if (
pCmp((strat->
S)[
i],redSi)!=0)
8996 if (any_change)
reorderS(&suc,strat);
8997 else { suc=-1;
break; }
9008 for (
i=0;
i<=strat->
sl;
i++)
9031 #ifdef HAVE_SHIFTBBA
9036 if (suc!= -1)
updateS(toT,strat);
9056 *
sizeof(
unsigned long));
9083 strat->
Shdl->m=strat->
S;
9085 if (atS <= strat->sl)
9087 #ifdef ENTER_USE_MEMMOVE
9088 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9089 (strat->
sl - atS + 1)*
sizeof(poly));
9090 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9091 (strat->
sl - atS + 1)*
sizeof(
int));
9092 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9093 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9094 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9095 (strat->
sl - atS + 1)*
sizeof(
int));
9097 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9098 (strat->
sl - atS + 1)*
sizeof(
int));
9100 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9103 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9105 strat->
S[
i] = strat->
S[
i-1];
9111 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9114 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9120 #ifdef ENTER_USE_MEMMOVE
9121 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9122 (strat->
sl - atS + 1)*
sizeof(
int));
9124 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9129 strat->
fromQ[atS]=0;
9140 strat->
sevS[atS] =
p.sev;
9142 strat->
S_2_R[atS] = atR;
9146 #ifdef HAVE_SHIFTBBA
9152 for (
int i = maxPossibleShift;
i > 0;
i--)
9160 int atS =
posInS(strat, strat->
sl, qq.p, qq.ecart);
9179 *
sizeof(
unsigned long));
9183 *
sizeof(
unsigned long));
9211 strat->
Shdl->m=strat->
S;
9218 if (atS <= strat->sl)
9220 #ifdef ENTER_USE_MEMMOVE
9221 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9222 (strat->
sl - atS + 1)*
sizeof(poly));
9223 memmove(&(strat->
sig[atS+1]), &(strat->
sig[atS]),
9224 (strat->
sl - atS + 1)*
sizeof(poly));
9225 memmove(&(strat->
sevSig[atS+1]), &(strat->
sevSig[atS]),
9226 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9227 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9228 (strat->
sl - atS + 1)*
sizeof(
int));
9229 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9230 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9231 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9232 (strat->
sl - atS + 1)*
sizeof(
int));
9234 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9235 (strat->
sl - atS + 1)*
sizeof(
int));
9237 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9240 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9242 strat->
S[
i] = strat->
S[
i-1];
9250 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9253 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9259 #ifdef ENTER_USE_MEMMOVE
9260 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9261 (strat->
sl - atS + 1)*
sizeof(
int));
9263 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9268 strat->
fromQ[atS]=0;
9272 strat->
S[atS] =
p.p;
9273 strat->
sig[atS] =
p.sig;
9279 strat->
sevS[atS] =
p.sev;
9289 strat->
sevSig[atS] =
p.sevSig;
9292 strat->
S_2_R[atS] = atR;
9296 Print(
"--- LIST S: %d ---\n",strat->
sl);
9297 for(
k=0;
k<=strat->
sl;
k++)
9301 PrintS(
"--- LIST S END ---\n");
9315 #ifdef HAVE_SHIFTBBA
9327 else strat->
P.sev=0;
9335 poly tp = strat->
T[tj].p;
9340 for (
j = 0;
j <= strat->
sl; ++
j)
9354 pos =
posInS(strat, strat->
sl,
p.p,
p.ecart);
9360 for (
i = 0;
i <= strat->
Ll; ++
i)
9374 #ifdef HAVE_SHIFTBBA
9384 strat->
enterS(
p, pos, strat, strat->
tl);
9386 #ifdef HAVE_SHIFTBBA
9401 #ifdef HAVE_SHIFTBBA
9423 for(
i=strat->
tl;
i>=0;
i--)
9425 if (
p.p==strat->
T[
i].p)
9427 printf(
"already in T at pos %d of %d, atT=%d\n",
i,strat->
tl,atT);
9433 #ifdef HAVE_TAIL_RING
9436 p.t_p=
p.GetLmTailRing();
9442 if (strat->
tl == strat->
tmax-1)
9444 if (atT <= strat->tl)
9446 #ifdef ENTER_USE_MEMMOVE
9447 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9449 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9450 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9452 for (
i=strat->
tl+1;
i>=atT+1;
i--)
9454 #ifndef ENTER_USE_MEMMOVE
9455 strat->
T[
i] = strat->
T[
i-1];
9458 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9464 #ifdef HAVE_SHIFTBBA
9466 if (!(
currRing->isLPring &&
p.shift > 0))
9482 strat->
T[atT].max_exp =
NULL;
9485 strat->
R[strat->
tl] = &(strat->
T[atT]);
9486 strat->
T[atT].i_r = strat->
tl;
9511 for(
i=strat->
tl;
i>=0;
i--)
9513 if (
p.p==strat->
T[
i].p)
9515 printf(
"already in T at pos %d of %d, atT=%d\n",
i,strat->
tl,atT);
9521 #ifdef HAVE_TAIL_RING
9524 p.t_p=
p.GetLmTailRing();
9530 if (strat->
tl == strat->
tmax-1)
9532 if (atT <= strat->tl)
9534 #ifdef ENTER_USE_MEMMOVE
9535 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9537 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9538 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9540 for (
i=strat->
tl+1;
i>=atT+1;
i--)
9542 #ifndef ENTER_USE_MEMMOVE
9543 strat->
T[
i] = strat->
T[
i-1];
9546 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9564 strat->
T[atT].max_exp =
NULL;
9567 strat->
R[strat->
tl] = &(strat->
T[atT]);
9568 strat->
T[atT].i_r = strat->
tl;
9575 for(
i=strat->
tl;
i>=0;
i--)
9606 (strat->
syzmax)*
sizeof(
unsigned long),
9608 *
sizeof(
unsigned long));
9611 if (atT < strat->syzl)
9613 #ifdef ENTER_USE_MEMMOVE
9614 memmove(&(strat->
syz[atT+1]), &(strat->
syz[atT]),
9615 (strat->
syzl-atT+1)*
sizeof(poly));
9616 memmove(&(strat->
sevSyz[atT+1]), &(strat->
sevSyz[atT]),
9617 (strat->
syzl-atT+1)*
sizeof(
unsigned long));
9619 for (
i=strat->
syzl;
i>=atT+1;
i--)
9621 #ifndef ENTER_USE_MEMMOVE
9634 strat->
syz[atT] =
p.sig;
9635 strat->
sevSyz[atT] =
p.sevSig;
9638 Print(
"element in strat->syz: %d--%d ",atT+1,strat->
syzmax);
9648 strat->
L[cc].sig, ~strat->
L[cc].sevSig,
currRing)
9662 PrintS(
"--- Syzygies ---\n");
9665 PrintS(
"--------------------------------\n");
9671 PrintS(
"--------------------------------\n");
9707 #ifdef HAVE_RATGRING
9753 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
9754 else PrintS(
"ideal/module is not homogeneous\n");
9785 #ifdef HAVE_RATGRING
9824 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
9825 else PrintS(
"ideal/module is not homogeneous\n");
10025 #ifdef HAVE_SHIFTBBA
10094 #ifdef HAVE_SHIFTBBA
10121 #ifdef HAVE_SHIFTBBA
10365 if ((r->m[
l]!=
NULL)
10372 if ((
Q->m[q]!=
NULL)
10396 if ((r->m[
l]!=
NULL)
10403 if ((
Q->m[q]!=
NULL)
10447 reduction_found=
TRUE;
10478 reduction_found=
TRUE;
10492 if ( reduction_found)
10582 for (
i=strat->
sl;
i>=low;
i--)
10584 int end_pos=strat->
sl;
10586 if (strat->
ak==0) end_pos=
i-1;
10588 if ((T_j !=
NULL)&&(T_j->p==strat->
S[
i]))
10606 Print(
"to (tailR) S[%d]:",
i);
10618 T_j->max_exp =
NULL;
10621 T_j->pCleardenom();
10661 Print(
"to (-tailR) S[%d]:",
i);
10758 assume(L->i_r1 >= -1 && L->i_r1 <= strat->
tl);
10759 assume(L->i_r2 >= -1 && L->i_r2 <= strat->
tl);
10764 if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10769 if ((L->i_r1>=0)&&(strat->
R[L->i_r1]!=
NULL)) p1_max = (strat->
R[L->i_r1])->max_exp;
10771 if ((L->i_r2>=0)&&(strat->
R[L->i_r2]!=
NULL)) p2_max = (strat->
R[L->i_r2])->max_exp;
10797 poly p1_max = (strat->
R[atR])->max_exp;
10798 poly p2_max = (strat->
R[strat->
S_2_R[atS]])->max_exp;
10819 ideal F =
idCopy(Forig);
10823 ideal monred =
idInit(1,1);
10830 if((posconst != -1) && (!
nIsZero(F->m[posconst]->coef)))
10840 for(
int i=0;
i<idelemQ;
i++)
10848 if((posconst != -1) && (!
nIsZero(monred->m[posconst]->coef)))
10850 pmon =
pCopy(monred->m[posconst]);
10865 II->m[
j++] =
prMapR(F->m[
i], nMap, origR, QQ_ring);
10867 II->m[
j++] =
prMapR(
Q->m[
i], nMap, origR, QQ_ring);
10874 if(II->m[
i] !=
NULL)
10875 II->m[
i+1] = II->m[
i];
10878 poly integer =
NULL;
10886 integer =
pHead(syz->m[
i]);
10893 pmon =
prMapR(integer, nMap2, QQ_ring, origR);
10907 poly mindegmon =
NULL;
10912 if(mindegmon ==
NULL)
10913 mindegmon =
pCopy(one->m[
i]);
10916 if(
p_Deg(one->m[
i], QQ_ring) <
p_Deg(mindegmon, QQ_ring))
10917 mindegmon =
pCopy(one->m[
i]);
10921 if(mindegmon !=
NULL)
10924 if(II->m[
i] !=
NULL)
10925 II->m[
i+1] = II->m[
i];
10926 II->m[0] =
pCopy(mindegmon);
10955 pmon =
prMapR(mindegmon, nMap2, QQ_ring, origR);
10986 poly pH =
h->GetP();
10990 for(
int i = 0;
i<=strat->
sl;
i++)
11000 #ifdef HAVE_SHIFTBBA
11025 #ifdef HAVE_SHIFTBBA
11053 h->SetLmCurrRing();
11054 if((deleted)&&(
h->p!=
NULL))
11062 poly hSig =
h->sig;
11063 poly pH =
h->GetP();
11067 for(
int i = 0;
i<=strat->
sl;
i++)
11078 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
11105 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
11136 h->SetLmCurrRing();
11246 if (expbound == 0) expbound = strat->
tailRing->bitmask << 1;
11263 new_tailRing->pFDeg =
currRing->pFDeg;
11264 new_tailRing->pLDeg =
currRing->pLDeg;
11268 Print(
"[%lu:%d", (
unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11277 for (
i=0;
i<=strat->
tl;
i++)
11279 strat->
T[
i].ShallowCopyDelete(new_tailRing, new_tailBin,
11280 p_shallow_copy_delete);
11282 for (
i=0;
i<=strat->
Ll;
i++)
11286 strat->
L[
i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11288 if ((strat->
P.t_p !=
NULL) ||
11290 strat->
P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11292 if ((L !=
NULL) && (L->tailRing != new_tailRing))
11295 L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11301 L->tailRing = new_tailRing;
11304 L->max_exp = t_l->max_exp;
11308 if ((
T !=
NULL) && (
T->tailRing != new_tailRing &&
T->i_r < 0))
11309 T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11316 strat->
tailBin = new_tailBin;
11335 unsigned long l = 0;
11341 for (
i=0;
i<= strat->
Ll;
i++)
11345 for (
i=0;
i<=strat->
tl;
i++)
11373 res->block0 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11374 res->block1 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11375 int **wvhdl = (
int **)
omAlloc0((n+1)*
sizeof(
int*));
11376 res->wvhdl = wvhdl;
11377 for (
int i=1;
i<n;
i++)
11379 res->order[
i] = r->order[
i-1];
11380 res->block0[
i] = r->block0[
i-1];
11381 res->block1[
i] = r->block1[
i-1];
11382 res->wvhdl[
i] = r->wvhdl[
i-1];
11401 #ifndef SING_NDEBUG
11402 WarnS(
"error in nc_rComplete");
11421 res->block0 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11422 res->block1 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11423 int **wvhdl = (
int **)
omAlloc0((n+2)*
sizeof(
int*));
11424 res->wvhdl = wvhdl;
11425 for (
int i=2;
i<n+2;
i++)
11427 res->order[
i] = r->order[
i-2];
11428 res->block0[
i] = r->block0[
i-2];
11429 res->block1[
i] = r->block1[
i-2];
11430 res->wvhdl[
i] = r->wvhdl[
i-2];
11435 res->block0[0] = 1;
11437 for (
int i=0;
i<
res->N; ++
i)
11438 res->wvhdl[0][
i] = 1;
11457 #ifndef SING_NDEBUG
11458 WarnS(
"error in nc_rComplete");
11595 #ifdef HAVE_TAIL_BIN
11620 Timings
for the different possibilities of posInT:
11621 T15 EDL DL EL L 1-2-3
11622 Gonnet 43.26 42.30 38.34 41.98 38.40 100.04
11623 Hairer_2_1 1.11 1.15 1.04 1.22 1.08 4.7
11624 Twomat3 1.62 1.69 1.70 1.65 1.54 11.32
11625 ahml 4.48 4.03 4.03 4.38 4.96 26.50
11626 c7 15.02 13.98 15.16 13.24 17.31 47.89
11627 c8 505.09 407.46 852.76 413.21 499.19 n/a
11628 f855 12.65 9.27 14.97 8.78 14.23 33.12
11629 gametwo6 11.47 11.35 14.57 11.20 12.02 35.07
11630 gerhard_3 2.73 2.83 2.93 2.64 3.12 6.24
11631 ilias13 22.89 22.46 24.62 20.60 23.34 53.86
11632 noon8 40.68 37.02 37.99 36.82 35.59 877.16
11633 rcyclic_19 48.22 42.29 43.99 45.35 51.51 204.29
11634 rkat9 82.37 79.46 77.20 77.63 82.54 267.92
11635 schwarz_11 16.46 16.81 16.76 16.81 16.72 35.56
11636 test016 16.39 14.17 14.40 13.50 14.26 34.07
11637 test017 34.70 36.01 33.16 35.48 32.75 71.45
11638 test042 10.76 10.99 10.27 11.57 10.45 23.04
11639 test058 6.78 6.75 6.51 6.95 6.22 9.47
11640 test066 10.71 10.94 10.76 10.61 10.56 19.06
11641 test073 10.75 11.11 10.17 10.79 8.63 58.10
11642 test086 12.23 11.81 12.88 12.24 13.37 66.68
11643 test103 5.05 4.80 5.47 4.64 4.89 11.90
11644 test154 12.96 11.64 13.51 12.46 14.61 36.35
11645 test162 65.27 64.01 67.35 59.79 67.54 196.46
11646 test164 7.50 6.50 7.68 6.70 7.96 17.13
11647 virasoro 3.39 3.50 3.35 3.47 3.70 7.66
11657 if (
length==-1)
return 0;
11660 int op=
p.GetpFDeg();
11661 int ol =
p.GetpLength();
11663 if (set[
length].ecart < o)
11665 if (set[
length].ecart == o)
11667 int oo=set[
length].GetpFDeg();
11668 if ((oo < op) || ((oo==op) && (set[
length].
length < ol)))
11679 if (set[an].ecart > o)
11681 if (set[an].ecart == o)
11683 int oo=set[an].GetpFDeg();
11685 || ((oo==op) && (set[an].
pLength > ol)))
11691 if (set[
i].ecart > o)
11693 else if (set[
i].ecart == o)
11695 int oo=set[
i].GetpFDeg();
11697 || ((oo == op) && (set[
i].
pLength > ol)))
11711 if (
length==-1)
return 0;
11713 int op=
p.GetpFDeg();
11714 int ol =
p.GetpLength();
11716 int oo=set[
length].GetpFDeg();
11717 if ((oo < op) || ((oo==op) && (set[
length].
length < ol)))
11727 int oo=set[an].GetpFDeg();
11729 || ((oo==op) && (set[an].
pLength > ol)))
11734 int oo=set[
i].GetpFDeg();
11736 || ((oo == op) && (set[
i].
pLength > ol)))
11747 int ol =
p.GetpLength();
11761 if (set[an].
pLength>ol)
return an;
11788 else Print(
"%p\n",(
void*)strat->
red);
11807 #ifdef HAVE_MORE_POS_IN_T
11845 PrintS(
"initEcartPair: ");
11849 Print(
"homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11851 Print(
"honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11857 Print(
"posInLDependsOnLength=%d\n",
11889 PrintS(
"currRing->pFDeg: ");
11904 PrintS(
"ecartWeights: ");
11911 #ifndef SING_NDEBUG
11916 #ifdef HAVE_SHIFTBBA
11930 #ifdef HAVE_SHIFTBBA
11947 #ifdef HAVE_SHIFTBBA
12042 #ifdef HAVE_SHIFTBBA
12047 assume(ifromS <= strat->sl);
12146 PrintS(
"\n--- create strong gcd poly: ");
12149 Print(
"\n q (strat->S[%d]): ", ifromS);
12155 pNext(
gcd) =
p_Add_q(
pp_Mult_mm(
pp_mm_Mult(
pNext(
p), m1, strat->
tailRing), m12, strat->
tailRing),
pp_Mult_mm(
pp_mm_Mult(
pNext(q), m2, strat->
tailRing), m22, strat->
tailRing), strat->
tailRing);
12177 h.i_r1 = -1;
h.i_r2 = -1;
12184 if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
12197 posx = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
12211 #ifdef HAVE_SHIFTBBA
12238 int j,compare,compareCoeff;
12242 h.ecart=0;
h.length=0;
12274 for(
j = strat->
Bl;
j>=0;
j--)
12283 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12298 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12311 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12415 h.i_r1 = -1;
h.i_r2 = -1;
12424 if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
12439 posx = strat->
posInL(strat->
B,strat->
Bl,&
h,strat);
12454 #ifdef HAVE_SHIFTBBA
12463 #ifdef HAVE_SHIFTBBA
12468 assume(q_inS < 0 || strat->S[q_inS] == q);
12478 if (strat->
fromQ !=
NULL && q_inS >= 0)
12479 q_isFromQ = strat->
fromQ[q_inS];
12481 void (*enterPair)(poly, poly, int, int,
kStrategy, int, int, int, int, int);
12490 int neededShift = p_lastVblock - ((
pGetComp(
p) > 0 ||
pGetComp(q) > 0) ? 0 : 1);
12491 int maxPossibleShift =
degbound - q_lastVblock;
12492 int maxShift =
si_min(neededShift, maxPossibleShift);
12493 int firstShift = (q ==
p ? 1 : 0);
12494 for (
int j = firstShift;
j <= maxShift;
j++)
12497 enterPair(qq,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ,
j, q_inS);
12505 for (
int j = p_lastVblock;
j <= maxPossibleShift;
j++)
12511 enterPair(qq,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, p_lastVblock, q_inS);
12520 #ifdef HAVE_SHIFTBBA
12525 assume(p_inS < 0 || strat->S[p_inS] ==
p);
12534 if (strat->
fromQ !=
NULL && p_inS >= 0)
12535 p_isFromQ = strat->
fromQ[p_inS];
12540 assume(q_shift <= p_lastVblock);
12547 enterOnePairShift(q,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, q_shift, -1);
12560 #ifdef HAVE_SHIFTBBA
12563 #ifdef CRITERION_DEBUG
12568 poly lmq =
pHead(q);
12589 int qfromQ = qisFromQ;
12598 Lp.ecart=0; Lp.length=0;
12608 #ifdef CRITERION_DEBUG
12616 if((!((ecartq>0)&&(ecart>0)))
12635 #ifdef CRITERION_DEBUG
12641 Lp.ecart =
si_max(ecart,ecartq);
12642 if (strat->
fromT && (ecartq>ecart))
12645 #ifdef CRITERION_DEBUG
12667 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12670 #ifdef CRITERION_DEBUG
12673 Print(
"--- chain crit using B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12684 #ifdef CRITERION_DEBUG
12687 Print(
"--- chain crit using pair to remove B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12720 #ifdef CRITERION_DEBUG
12725 if (strat->
fromT && (ecartq>ecart))
12728 #ifdef CRITERION_DEBUG
12740 for(
j = strat->
Bl;
j>=0;
j--)
12746 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12749 #ifdef CRITERION_DEBUG
12752 Print(
"--- chain crit using B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12762 #ifdef CRITERION_DEBUG
12765 Print(
"--- chain crit using pair to remove B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12782 #ifdef CRITERION_DEBUG
12787 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (qfromQ!=0))
12790 #ifdef CRITERION_DEBUG
12850 #ifdef CRITERION_DEBUG
12866 if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12883 && (Lp.p->coef!=
NULL))
12887 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
12889 #ifdef CRITERION_DEBUG
12901 #ifdef HAVE_SHIFTBBA
12907 if (h_lastVblock == 0)
return;
12918 int maxShift =
degbound - h_lastVblock;
12927 for (
i=0;
i<=maxShift;
i++)
12930 for (
j=0;
j<=
k;
j++)
12935 poly
s = strat->
S[
j];
12944 for (
j=0;
j<=
k;
j++)
12946 poly
s = strat->
S[
j];
12961 else if ((isFromQ)&&(strat->
fromQ!=
NULL))
12964 for (
j=0;
j<=
k;
j++)
12969 poly
s = strat->
S[
j];
12976 for (
i=1;
i<=maxShift;
i++)
12979 for (
j=0;
j<=
k;
j++)
12983 poly
s = strat->
S[
j];
12985 if (
i < s_lastVblock || (
pGetComp(
s) > 0 &&
i == s_lastVblock))
13009 for (
j=0;
j<=
k;
j++)
13011 poly
s = strat->
S[
j];
13015 for (
i=1;
i<=maxShift;
i++)
13018 for (
j=0;
j<=
k;
j++)
13020 poly
s = strat->
S[
j];
13022 if (
i < s_lastVblock || (
pGetComp(
s) > 0 &&
i == s_lastVblock))
13038 if (
i < h_lastVblock)
13062 for (
j=0;
j<=
k;
j++)
13067 poly
s = strat->
S[
j];
13084 for (
j=0;
j<=
k;
j++)
13089 poly
s = strat->
S[
j];
13094 for (
i=1;
i<=maxShift;
i++)
13097 for (
j=0;
j<=
k;
j++)
13102 poly
s = strat->
S[
j];
13104 if (
i <= s_lastVblock)
13121 if (
i <= h_lastVblock)
13154 #ifdef HAVE_SHIFTBBA
13160 if (h_lastVblock == 0)
return;
13171 int maxShift =
degbound - h_lastVblock;
13180 for (
i=0;
i<=maxShift;
i++)
13183 for (
j=0;
j<=
k;
j++)
13188 poly
s = strat->
S[
j];
13197 for (
j=0;
j<=
k;
j++)
13199 poly
s = strat->
S[
j];
13214 else if ((isFromQ)&&(strat->
fromQ!=
NULL))
13217 for (
j=0;
j<=
k;
j++)
13222 poly
s = strat->
S[
j];
13229 for (
i=1;
i<=maxShift;
i++)
13232 for (
j=0;
j<=
k;
j++)
13236 poly
s = strat->
S[
j];
13247 for (
j=0;
j<=
k;
j++)
13249 poly
s = strat->
S[
j];
13254 for (
i=1;
i<=maxShift;
i++)
13257 for (
j=0;
j<=
k;
j++)
13259 poly
s = strat->
S[
j];
13271 for (
j=0;
j<=
k;
j++)
13277 poly
s = strat->
S[
j];
13294 for (
j=0;
j<=
k;
j++)
13299 poly
s = strat->
S[
j];
13304 for (
i=1;
i<=maxShift;
i++)
13307 for (
j=0;
j<=
k;
j++)
13312 poly
s = strat->
S[
j];
13334 #ifdef HAVE_SHIFTBBA
13343 if ( (!strat->
fromT)
13364 #ifdef HAVE_SHIFTBBA
13375 for (
int i = 1;
i <= maxPossibleShift;
i++)
13387 #ifdef HAVE_SHIFTBBA
13394 p =
h = L->GetLmTailRing();
13396 return L->GetLmCurrRing();
13403 Ln.pLength = L->GetpLength() - 1;
13411 while(!Ln.IsNull())
13415 Ln.SetShortExpVector();
13421 With = &(strat->
T[
j]);
13426 if (With ==
NULL)
break;
13442 pNext(
h) = Ln.LmExtractAndIter();
13445 }
while (!Ln.IsNull());
13448 if (Ln.IsNull())
goto all_done;
13449 if (! withT) With_s.Init(
currRing);
13451 pNext(
h) = Ln.LmExtractAndIter();
13466 return L->GetLmCurrRing();
static int si_max(const int a, const int b)
static int si_min(const int a, const int b)
static CanonicalForm bound(const CFMatrix &M)
KINLINE poly kNoetherTail()
void(* chainCrit)(poly p, int ecart, kStrategy strat)
pFDegProc pOrigFDeg_TailRing
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
KINLINE TObject * s_2_t(int i)
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
pShallowCopyDeleteProc p_shallow_copy_delete
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
char completeReduce_retry
void(* initEcart)(TObject *L)
KINLINE TObject * S_2_T(int i)
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
int(* posInT)(const TSet T, const int tl, LObject &h)
int(* red)(LObject *L, kStrategy strat)
char posInLDependsOnLength
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
pLDegProc pOrigLDeg_TailRing
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
@ n_Q
rational (GMP) numbers
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
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.
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
void nKillChar(coeffs r)
undo all initialisations
const CanonicalForm int s
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
static int min(int a, int b)
static int max(int a, int b)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
#define idDelete(H)
delete an ideal
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
static BOOLEAN length(leftv result, leftv arg)
KINLINE unsigned long * initsevT()
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
KINLINE int ksReducePolyTailLC_Z(LObject *PR, TObject *PW, LObject *Red)
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
KINLINE TObject ** initR()
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
KINLINE int ksReducePolyTail_Z(LObject *PR, TObject *PW, LObject *Red)
int redLiftstd(LObject *h, kStrategy strat)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
void kBucketDestroy(kBucket_pt *bucket_pt)
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
int ksCheckCoeff(number *a, number *b)
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
long kHomModDeg(poly p, ring r)
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
int redHoney(LObject *h, kStrategy strat)
int redHomog(LObject *h, kStrategy strat)
int redLazy(LObject *h, kStrategy strat)
int redRing(LObject *h, kStrategy strat)
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
void initSbaPos(kStrategy strat)
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
poly redtail(LObject *L, int end_pos, kStrategy strat)
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
int getIndexRng(long coeff)
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
int posInT17(const TSet set, const int length, LObject &p)
void initBuchMora(ideal F, ideal Q, kStrategy strat)
poly pMove2CurrTail(poly p, kStrategy strat)
int posInTrg0(const TSet set, const int length, LObject &p)
int redFirst(LObject *h, kStrategy strat)
void kMergeBintoL(kStrategy strat)
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
void enterSyz(LObject &p, kStrategy strat, int atT)
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
int redEcart(LObject *h, kStrategy strat)
int posInT11(const TSet set, const int length, LObject &p)
void enterT(LObject &p, kStrategy strat, int atT)
int posInT1(const TSet set, const int length, LObject &p)
void enterTShift(LObject p, kStrategy strat, int atT)
int posInT110Ring(const TSet set, const int length, LObject &p)
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
BOOLEAN kTest(kStrategy strat)
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
poly redtailBbaBound(LObject *L, int end_pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize)
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
int posInT0(const TSet, const int length, LObject &)
poly pMoveCurrTail2poly(poly p, kStrategy strat)
BOOLEAN kTest_TS(kStrategy strat)
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
BOOLEAN kCheckStrongCreation(int atR, poly m1, int atS, poly m2, kStrategy strat)
void initenterstrongPairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
static void enterOnePairRingShift(poly q, poly p, int, int isFromQ, kStrategy strat, int atR, int, int qisFromQ, int shiftcount, int ifromS)
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
void clearSbatch(poly h, int k, int pos, kStrategy strat)
static int pLPDivComp(poly p, poly q)
int posInT2(const TSet set, const int length, LObject &p)
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
int posInT_pLength(const TSet set, const int length, LObject &p)
static intset initec(const int maxnr)
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
int posInT13(const TSet set, const int length, LObject &p)
void redtailBbaAlsoLC_Z(LObject *L, int end_pos, kStrategy strat)
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
static void deleteHCBucket(LObject *L, kStrategy strat)
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
void chainCritSig(poly p, int, kStrategy strat)
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
static poly redMora(poly h, int maxIndex, kStrategy strat)
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
static int pDivCompRing(poly p, poly q)
BOOLEAN isInPairsetB(poly q, int *k, kStrategy strat)
void initBuchMoraPos(kStrategy strat)
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
void initS(ideal F, ideal Q, kStrategy strat)
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
poly redtailBba_Z(LObject *L, int end_pos, kStrategy strat)
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
void initPairtest(kStrategy strat)
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case and syzComp==1: ignore component
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
void chainCritOpt_1(poly, int, kStrategy strat)
int posInT11Ring(const TSet set, const int length, LObject &p)
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
static poly redBba(poly h, int maxIndex, kStrategy strat)
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
poly pCopyL2p(LObject H, kStrategy strat)
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
static void enlargeL(LSet *L, int *length, const int incr)
int posInT17_c(const TSet set, const int length, LObject &p)
poly redtailBbaShift(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
int posInT15(const TSet set, const int length, LObject &p)
void enterT_strong(LObject &p, kStrategy strat, int atT)
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
void HEckeTest(poly pp, kStrategy strat)
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
STATIC_VAR BOOLEAN sloppy_max
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
static void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
BOOLEAN kTest_L(LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
void exitBuchMora(kStrategy strat)
void messageStatSBA(int hilbcount, kStrategy strat)
void initEcartNormal(TObject *h)
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
void updateS(BOOLEAN toT, kStrategy strat)
void initSLSba(ideal F, ideal Q, kStrategy strat)
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
void initSyzRules(kStrategy strat)
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
void cleanT(kStrategy strat)
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
int posInT110(const TSet set, const int length, LObject &p)
BOOLEAN kTest_S(kStrategy strat)
int posInSyz(const kStrategy strat, poly sig)
void replaceInLAndSAndT(LObject &p, int tj, kStrategy strat)
static const char * kTest_LmEqual(poly p, poly t_p, ring tailRing)
void reorderS(int *suc, kStrategy strat)
void enterExtendedSpoly(poly h, kStrategy strat)
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN kTest_T(TObject *T, kStrategy strat, int i, char TN)
void kMergeBintoLSba(kStrategy strat)
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
void updateResult(ideal r, ideal Q, kStrategy strat)
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
int posInT19(const TSet set, const int length, LObject &p)
static void enterOneStrongPolyAndEnterOnePairRingShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
void exitSba(kStrategy strat)
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
int posInT15Ring(const TSet set, const int length, LObject &p)
int posInT17Ring(const TSet set, const int length, LObject &p)
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
void kDebugPrint(kStrategy strat)
Output some debug info about a given strategy.
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
void deleteInL(LSet set, int *length, int j, kStrategy strat)
void kStratInitChangeTailRing(kStrategy strat)
void chainCritPart(poly p, int ecart, kStrategy strat)
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
void initBuchMoraCrit(kStrategy strat)
void cleanTSbaRing(kStrategy strat)
int posInT17_cRing(const TSet set, const int length, LObject &p)
void deleteInSSba(int i, kStrategy strat)
static int pDivComp(poly p, poly q)
void completeReduce(kStrategy strat, BOOLEAN withT)
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
static void enterOnePairWithoutShifts(int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int, int p_lastVblock, int q_shift)
void initBuchMoraPosRing(kStrategy strat)
int kFindInTShift(poly p, TSet T, int tlength)
void postReduceByMonSig(LObject *h, kStrategy strat)
static void enterOnePairWithShifts(int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int, int p_lastVblock, int q_lastVblock)
static BOOLEAN enterOneStrongPolyShift(poly q, poly p, int, int, kStrategy strat, int atR, int, int, int shiftcount, int ifromS)
void messageSets(kStrategy strat)
void deleteInS(int i, kStrategy strat)
static poly redBba1(poly h, int maxIndex, kStrategy strat)
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
int posInLSigRing(const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
poly preIntegerCheck(const ideal Forig, const ideal Q)
used for GB over ZZ: look for constant and monomial elements in the ideal background: any known const...
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
void chainCritNormal(poly p, int ecart, kStrategy strat)
void initEcartBBA(TObject *h)
VAR denominator_list DENOMINATOR_LIST
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
static void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void enterSBbaShift(LObject &p, int atS, kStrategy strat, int atR)
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
poly redtailBba_Ring(LObject *L, int end_pos, kStrategy strat)
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
static unsigned long * initsevS(const int maxnr)
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
void messageStat(int hilbcount, kStrategy strat)
static BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
void chainCritRing(poly p, int, kStrategy strat)
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
void initSL(ideal F, ideal Q, kStrategy strat)
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
void initSbaCrit(kStrategy strat)
BOOLEAN newHEdge(kStrategy strat)
static int * initS_2_R(const int maxnr)
void cancelunit(LObject *L, BOOLEAN inNF)
denominator_list_s * denominator_list
static LSet initL(int nr=setmaxL)
static void kDeleteLcm(LObject *P)
#define ALLOW_PROD_CRIT(A)
#define REDTAIL_CANONICALIZE
static bool rIsSCA(const ring r)
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
static nc_type & ncRingType(nc_struct *p)
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
int dReportError(const char *fmt,...)
#define pFalseReturn(cond)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
#define __p_GetComp(p, r)
#define rRing_has_Comp(r)
STATIC_VAR gmp_float * diff
#define omFreeSize(addr, size)
#define omCheckBinAddrSize(addr, size)
#define omReallocSize(addr, o_size, size)
#define omRealloc0Size(addr, o_size, size)
#define omSizeWOfBin(bin_ptr)
#define TEST_OPT_INTSTRATEGY
#define TEST_OPT_INFREDTAIL
#define TEST_OPT_SUGARCRIT
#define TEST_OPT_DEGBOUND
#define TEST_OPT_NOT_SUGAR
#define TEST_OPT_CANCELUNIT
#define TEST_OPT_CONTENTSB
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
static int index(p_Length length, p_Ord ord)
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,...
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)
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)
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
long pLDeg1c_Deg(poly p, int *l, const ring r)
long pLDeg1(poly p, int *l, const ring r)
unsigned long p_GetShortExpVector(const poly p, const ring r)
long pLDeg1_Deg(poly p, int *l, const ring r)
long p_WTotaldegree(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)
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
long pLDeg0c(poly p, int *l, 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
long pLDeg0(poly p, int *l, const ring r)
poly p_Sub(poly p1, poly p2, const ring r)
void pEnlargeSet(poly **p, int l, int increment)
long p_Deg(poly a, const ring r)
void p_Lcm(const poly a, const poly b, poly m, const ring r)
static poly p_Neg(poly p, const ring r)
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
static poly p_Add_q(poly p, poly q, const ring r)
static void p_LmDelete(poly p, const ring r)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
BOOLEAN p_CheckIsFromRing(poly p, 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_FDeg(const poly p, const ring r)
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
static void p_LmDelete0(poly p, const ring r)
static int p_Cmp(poly p1, poly p2, ring r)
#define __pp_Mult_nn(p, n, r)
static poly pp_mm_Mult(poly p, poly m, const ring r)
static poly pp_Mult_mm(poly p, poly m, const ring r)
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
static void p_SetCompP(poly p, int i, ring r)
#define pp_Test(p, lmRing, tailRing)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static void p_Setm(poly p, const ring r)
static number p_SetCoeff(poly p, number n, ring r)
static int p_LmCmp(poly p, poly q, const ring r)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
static void p_Delete(poly *p, const ring r)
static unsigned pLength(poly a)
BOOLEAN p_CheckPolyRing(poly p, ring r)
static poly p_LmFreeAndNext(poly p, ring)
static poly p_Mult_mm(poly p, poly m, const ring r)
static void p_LmFree(poly p, ring)
static poly p_Copy(poly p, const ring r)
returns a copy of p
static long p_Totaldegree(poly p, const ring r)
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
void p_wrp(poly p, ring lmRing, ring tailRing)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatiblity layer for legacy polynomial operations (over currRing)
#define pLtCmpOrdSgnDiffM(p, q)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
#define pIsConstant(p)
like above, except that Comp must be 0
#define pHasNotCF(p1, p2)
#define pLtCmpOrdSgnDiffP(p, q)
#define pGetComp(p)
Component.
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
#define pGetExp(p, i)
Exponent.
#define pSetmComp(p)
TODO:
#define pHasNotCFRing(p1, p2)
#define pInit()
allocates a new monomial and initializes everything to 0
#define pEqualPolys(p1, p2)
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
#define pLtCmpOrdSgnEqP(p, q)
#define pCopy(p)
return a copy of the poly
poly prMoveR(poly &p, ring src_r, ring dest_r)
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
void pLcmRat(poly a, poly b, poly m, int rat_shift)
void PrintS(const char *s)
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
void rKillModifiedRing(ring r)
ring rAssure_c_dp(const ring r)
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
void rDebugPrint(const ring r)
void rDelete(ring r)
unconditionally deletes fields in r
static int rBlocks(ring r)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static int rGetCurrSyzLimit(const ring r)
static BOOLEAN rField_is_Domain(const ring r)
static BOOLEAN rIsRatGRing(const ring r)
static BOOLEAN rIsLPRing(const ring r)
BOOLEAN rHasMixedOrdering(const ring r)
static BOOLEAN rIsSyzIndexRing(const ring r)
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
static short rVar(const ring r)
#define rVar(r) (r->N)
BOOLEAN rHasGlobalOrdering(const ring r)
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
#define rField_is_Ring(R)
int p_mLPmaxPossibleShift(poly p, const ring r)
#define pLPCopyAndShiftLM(p, sh)
BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r)
int p_mFirstVblock(poly p, const ring ri)
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
void p_mLPshift(poly m, int sh, const ring ri)
#define pLPDivisibleBy(a, b)
#define pLPLmDivisibleBy(a, b)
ideal idInit(int idsize, int rank)
initialise an ideal / module
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int idElem(const ideal F)
count non-zero elements
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
ideal id_MaxIdeal(const ring r)
initialise the maximal ideal (at 0)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
long totaldegreeWecart(poly p, ring r)
long maxdegreeWecart(poly p, int *l, ring r)
EXTERN_VAR short * ecartWeights
#define omGetStickyBinOfBin(B)
#define omMergeStickyBinIntoBin(A, B)