47#define ENTER_USE_MEMMOVE
87#ifdef ENTER_USE_MYMEMMOVE
88inline 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;
102inline 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;
117inline 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);
539inline 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))
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++)
1271 && (strat->
P.p1!=
NULL))
1277 for (
int i=lv;
i>0;
i--)
1301 if (set[
j].sig!=
NULL)
1333 #ifdef HAVE_SHIFTBBA
1343#ifdef ENTER_USE_MEMMOVE
1347 for (
i=
j;
i < (*length);
i++)
1369#ifdef ENTER_USE_MEMMOVE
1370 memmove(&((*set)[at+1]), &((*set)[at]), ((*
length)-at+1)*
sizeof(
LObject));
1372 for (
i=(*
length)+1;
i>=at+1;
i--) (*set)[
i] = (*set)[
i-1];
1386 h->FDeg =
h->pFDeg();
1387 h->ecart =
h->pLDeg() -
h->FDeg;
1394 h->FDeg =
h->pFDeg();
1401 Lp->FDeg = Lp->pFDeg();
1408 Lp->FDeg = Lp->pFDeg();
1409 (*Lp).ecart =
si_max(ecartF,ecartG);
1410 (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -
p_FDeg((*Lp).lcm,
currRing));
1419 return (ecart1 <= ecart2);
1451 int j,compare,compareCoeff;
1455 h.ecart=0;
h.length=0;
1479 for(
j = strat->
Bl;
j>=0;
j--)
1600 h.i_r1 = -1;
h.i_r2 = -1;
1616 posx = strat->
posInL(strat->
B,strat->
Bl,&
h,strat);
1621 else strat->
P.sev=0L;
1635 poly m1, m2,
gcd,si;
1664 for (
int j = 0;
j < strat->
sl;
j++)
1670 && !(strat->
sevS[
j] & ~sev)
1713 PrintS(
"\n--- create strong gcd poly: ");
1716 Print(
"\n strat->S[%d]: ",
i);
1739 h.i_r1 = -1;
h.i_r2 = -1;
1745 h.p1 =
p;
h.p2 = strat->
S[
i];
1760 posx = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
1765 if(
h.IsNull())
return FALSE;
1782 if(strat->
sl < 0)
return FALSE;
1784 for(
i=0;
i<strat->
sl;
i++)
1820 h->i_r1 = -1;
h->i_r2 = -1;
1842 poly m1, m2,
gcd,si;
1890 PrintS(
"\n--- create strong gcd poly: ");
1893 Print(
"\n strat->S[%d]: ",
i);
1917 if(
pLmCmp(pSigMult,sSigMult) == 0)
1926 if(
pLtCmp(pSigMult,sSigMult)==1)
1945 h.i_r1 = -1;
h.i_r2 = -1;
1953 int red_result =
redRing(&
h,strat);
1963 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1980 int red_result =
redRing(&
h,strat);
1990 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2003 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2007 h.p1 =
p;
h.p2 = strat->
S[
i];
2041 Lp.ecart=0; Lp.length=0;
2046#ifndef HAVE_RATGRING
2048#elif defined(HAVE_RATGRING)
2065 if((!((strat->
ecartS[
i]>0)&&(ecart>0)))
2158 for(
j = strat->
Bl;
j>=0;
j--)
2257 Lp.p1 = strat->
S[
i];
2271 Lp.i_r1 = strat->
S_2_R[
i];
2285 && (Lp.p->coef!=
NULL))
2289 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2329 Lp.ecart=0; Lp.length=0;
2336 if((!((strat->
ecartS[
i]>0)&&(ecart>0)))
2432 for(
j = strat->
Bl;
j>=0;
j--)
2488 Lp.p1 = strat->
S[
i];
2495 Lp.i_r1 = strat->
S_2_R[
i];
2509 && (Lp.p->coef!=
NULL))
2513 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2537 unsigned long pSigMultNegSev,sSigMultNegSev;
2541 Lp.ecart=0; Lp.length=0;
2546#ifndef HAVE_RATGRING
2548#elif defined(HAVE_RATGRING)
2572 pSigMultNegSev = ~p_GetShortExpVector(pSigMult,
currRing);
2574 sSigMultNegSev = ~p_GetShortExpVector(sSigMult,
currRing);
2578 PrintS(
"----------------\n");
2581 PrintS(
"----------------\n");
2587 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2608 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2609 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
2610 || strat->
rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,
i+1)
2687 Lp.sevSig = ~pSigMultNegSev;
2694 Lp.sevSig = ~sSigMultNegSev;
2705 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
2719 Lp.checked = strat->
sl+1;
2726 Lp.prod_crit =
TRUE;
2738 PrintS(
"SIGNATURE OF PAIR: ");
2742 Lp.p1 = strat->
S[
i];
2756 Lp.i_r1 = strat->
S_2_R[
i];
2770 && (Lp.p->coef!=
NULL))
2812 unsigned long pSigMultNegSev,sSigMultNegSev;
2816 Lp.ecart=0; Lp.length=0;
2821#ifndef HAVE_RATGRING
2823#elif defined(HAVE_RATGRING)
2859 if(pSigMult !=
NULL)
2860 pSigMultNegSev = ~p_GetShortExpVector(pSigMult,
currRing);
2862 if(sSigMult !=
NULL)
2863 sSigMultNegSev = ~p_GetShortExpVector(sSigMult,
currRing);
2866 Print(
"----------------\n");
2869 Print(
"----------------\n");
2873 if(pSigMult !=
NULL && sSigMult !=
NULL)
2882 if(pSigMult ==
NULL)
2884 if(sSigMult ==
NULL)
2894 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2916 int red_result =
redRing(&Lp,strat);
2926 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2928 strat->
enterS(Lp,0,strat,strat->
tl);
2942 Lp.sig =
pCopy(pSigMult);
2971 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2972 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
3054 Lp.sig =
pNeg(Lp.sig);
3065 Lp.sevSig = ~pSigMultNegSev;
3072 Lp.sevSig = ~sSigMultNegSev;
3084 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
3098 Lp.checked = strat->
sl+1;
3105 Lp.prod_crit =
TRUE;
3117 PrintS(
"SIGNATURE OF PAIR: ");
3121 Lp.p1 = strat->
S[
i];
3136 Lp.i_r1 = strat->
S_2_R[
i];
3150 && (Lp.p->coef!=
NULL))
3158 int red_result =
redRing(&Lp,strat);
3168 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
3171 strat->
enterS(Lp,0,strat, strat->
tl+1);
3223 Lp.p1 = strat->
S[
i];
3227 Lp.i_r1 = strat->
S_2_R[
i];
3242 && (Lp.p->coef!=
NULL))
3245 l = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
3256 int j=strat->
Ll+strat->
Bl+1;
3264 for (
i=strat->
Bl;
i>=0;
i--)
3266 j = strat->
posInL(strat->
L,
j,&(strat->
B[
i]),strat);
3277 int j=strat->
Ll+strat->
Bl+1;
3285 for (
i=strat->
Bl;
i>=0;
i--)
3312 for (
j=0;
j<=strat->
sl;
j++)
3316 for (
i=strat->
Bl;
i>=0;
i--)
3331 for (
j=0;
j<=strat->
sl;
j++)
3335 for (
i=strat->
Bl;
i>=0;
i--)
3358 for (
j=strat->
Ll;
j>=0;
j--)
3364 if (strat->
L[
j].p == strat->
tail)
3410 for (
j=strat->
Ll;
j>=0;
j--)
3430 for(
i=
j-1;
i>=0;
i--)
3449 for (
j=strat->
Ll;
j>=0;
j--)
3451 #ifdef HAVE_SHIFTBBA
3452 if ((strat->
L[
j].p1!=
NULL) &&
3485 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3488 if (strat->
L[
j].p2 ==
p)
3494 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3508 strat->
L[
i].p2 = strat->
tail;
3525 else if (strat->
L[
j].p2 == strat->
tail)
3564 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3567 if (strat->
L[
j].p2 ==
p)
3573 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3587 strat->
L[
i].p2 = strat->
tail;
3604 else if (strat->
L[
j].p2 == strat->
tail)
3625 for (
j=0;
j<=strat->
sl;
j++)
3629 for (
i=strat->
Bl;
i>=0;
i--)
3637 Print(
"chain-crit-part: S[%d]=",
j);
3639 Print(
" divide B[%d].lcm=",
i);
3661 for (
j=strat->
Ll;
j>=0;
j--)
3667 if (strat->
L[
j].p == strat->
tail)
3671 PrintS(
"chain-crit-part: pCompareChainPart p=");
3673 Print(
" delete L[%d]",
j);
3702 Print(
"chain-crit-part: sugar B[%d].lcm=",
j);
3704 Print(
" delete B[%d]",
i);
3715 Print(
"chain-crit-part: sugar B[%d].lcm=",
i);
3717 Print(
" delete B[%d]",
j);
3737 for (
j=strat->
Ll;
j>=0;
j--)
3745 PrintS(
"chain-crit-part: sugar:pCompareChainPart p=");
3747 Print(
" delete L[%d]",
j);
3765 for(
i=
j-1;
i>=0;
i--)
3771 Print(
"chain-crit-part: equal lcm B[%d].lcm=",
j);
3773 Print(
" delete B[%d]\n",
i);
3790 for (
j=strat->
Ll;
j>=0;
j--)
3798 PrintS(
"chain-crit-part: pCompareChainPart p=");
3800 Print(
" delete L[%d]",
j);
3829 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3832 if (strat->
L[
j].p2 ==
p)
3838 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3855 strat->
L[
i].p2 = strat->
tail;
3862 PrintS(
"chain-crit-part: divisible_by p=");
3864 Print(
" delete L[%d]",
l);
3875 PrintS(
"chain-crit-part: divisible_by(2) p=");
3877 Print(
" delete L[%d]",
i);
3888 else if (strat->
L[
j].p2 == strat->
tail)
3916 for (
j=0;
j<=
k;
j++)
3929 for (
j=0;
j<=
k;
j++)
3938 for (
j=0;
j<=
k;
j++)
3951 #ifdef HAVE_RATGRING
3981 for (
j=0;
j<=
k;
j++)
3994 for (
j=0;
j<=
k;
j++)
4003 for (
j=0;
j<=
k;
j++)
4101 for (
j=0;
j<=strat->
sl;
j++)
4105 for (
i=strat->
Bl;
i>=0;
i--)
4112 PrintS(
"--- chain criterion func chainCritRing type 1\n");
4115 PrintS(
" strat->B[i].lcm:");
4120 wrp(strat->
B[
i].lcm);
4135 for (
j=strat->
Ll;
j>=0;
j--)
4148 PrintS(
"--- chain criterion func chainCritRing type 2\n");
4149 PrintS(
"strat->L[j].p:");
4180 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
4183 if (strat->
L[
j].p2 ==
p)
4198 PrintS(
"--- chain criterion func chainCritRing type 3\n");
4199 PrintS(
"strat->L[j].lcm:");
4200 wrp(strat->
L[
j].lcm);
4201 PrintS(
" strat->L[i].lcm:");
4202 wrp(strat->
L[
i].lcm);
4216 strat->
L[
i].p2 = strat->
tail;
4233 else if (strat->
L[
j].p2 == strat->
tail)
4259 for (
j=0;
j<=
k;
j++)
4271 for (
j=0;
j<=
k;
j++)
4279 for (
j=0;
j<=
k;
j++)
4291 #ifdef HAVE_RATGRING
4316 && ((iCompH<=strat->syzComp)||(strat->
syzComp==0)))
4363 PrintS(
"--- create zero spoly: ");
4392 posx = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
4445 PrintS(
"--- create zero spoly: ");
4473 int red_result =
redRing(&Lp,strat);
4483 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
4485 strat->
enterS(Lp,0,strat,strat->
tl);
4533 if ( (!strat->
fromT)
4593 if ( (!strat->
fromT)
4618 if ( (!strat->
fromT)
4643 for (
j=0;
j<=
k;
j++)
4646 if ((iCompH==iCompSj)
4657 for (
j=0;
j<=
k;
j++)
4660 if ((iCompH==iCompSj)
4712 int i,
j,at,ecart, s2r;
4716 int new_suc=strat->
sl+1;
4720 for (;
i<=strat->
sl;
i++)
4725 if (new_suc > at) new_suc = at;
4728 sev = strat->
sevS[
i];
4731 for (
j=
i;
j>=at+1;
j--)
4733 strat->
S[
j] = strat->
S[
j-1];
4739 strat->
ecartS[at] = ecart;
4740 strat->
sevS[at] = sev;
4741 strat->
S_2_R[at] = s2r;
4744 for (
j=
i;
j>=at+1;
j--)
4748 strat->
fromQ[at]=fq;
4752 if (new_suc <= strat->sl) *suc=new_suc;
4815 if (cmp == cmp_int)
return an;
4816 if (cmp == -cmp_int)
return en;
4822 if (cmp == cmp_int) en =
i;
4823 else if (cmp == -cmp_int) an =
i;
4839 if (
pLmCmp(set[an],
p) == cmp_int)
return an;
4840 if (
pLmCmp(set[an],
p) == -cmp_int)
return en;
4842 && ((strat->
ecartS[an])>ecart_p))
4848 else if (
pLmCmp(set[
i],
p) == -cmp_int) an=
i;
4852 &&((strat->
ecartS[
i])<ecart_p))
4880 || ((op == o) && (
pLtCmp(set[mon],
p) == -1)))
4891 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
4898 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
4924 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
4931 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
4943 if(end < 0 || end >=
IDELEMS(F))
4945 if (end<0)
return 0;
4952 for(
i=start;
i<end;
i++)
4966 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
4973 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
4998 if (
length==-1)
return 0;
5011 if (
pLmCmp(set[an].
p,
p.p) == cmp_int)
return an;
5027 if (
length==-1)
return 0;
5039 if (set[an].
length>
p.length)
return an;
5055 if (
length==-1)
return 0;
5057 int o =
p.GetpFDeg();
5058 int op = set[
length].GetpFDeg();
5073 op= set[an].GetpFDeg();
5075 || (( op == o) && (
pLmCmp(set[an].
p,
p.p) == cmp_int)))
5080 op = set[
i].GetpFDeg();
5082 || (( op == o) && (
pLmCmp(set[
i].
p,
p.p) == cmp_int)))
5092 if (
length==-1)
return 0;
5094 int o =
p.GetpFDeg();
5095 int op = set[
length].GetpFDeg();
5109 op= set[an].GetpFDeg();
5116 op = set[
i].GetpFDeg();
5133 if (
length==-1)
return 0;
5134 int o =
p.GetpFDeg();
5135 int op = set[
length].GetpFDeg();
5147 op = set[an].GetpFDeg();
5148 if (op > o)
return an;
5149 if (op < 0)
return en;
5151 if (cmp == cmp_int)
return an;
5152 if (cmp == -cmp_int)
return en;
5157 op = set[
i].GetpFDeg();
5159 else if (op < o) an =
i;
5163 if (cmp == cmp_int) en =
i;
5164 else if (cmp == -cmp_int) an =
i;
5209 if (
length==-1)
return 0;
5212 int o =
p.GetpFDeg();
5213 int op = set[
length].GetpFDeg();
5218 || (( op == o) && (set[
length].length ==
p.length)
5229 op = set[an].GetpFDeg();
5231 || (( op == o) && (set[an].
length >
p.length))
5232 || (( op == o) && (set[an].length ==
p.length)
5233 && (
pLmCmp(set[an].
p,
p.p) == cmp_int)))
5238 op = set[
i].GetpFDeg();
5240 || (( op == o) && (set[
i].
length >
p.length))
5241 || (( op == o) && (set[
i].length ==
p.length)
5252 if (
length==-1)
return 0;
5255 int o =
p.GetpFDeg();
5256 int op = set[
length].GetpFDeg();
5260 || (( op == o) && (set[
length].length ==
p.length)
5271 op = set[an].GetpFDeg();
5273 || (( op == o) && (set[an].
length >
p.length))
5274 || (( op == o) && (set[an].length ==
p.length)
5280 op = set[
i].GetpFDeg();
5282 || (( op == o) && (set[
i].
length >
p.length))
5283 || (( op == o) && (set[
i].length ==
p.length)
5299 if (
length==-1)
return 0;
5301 int o =
p.GetpFDeg();
5303 if (set[
length].GetpFDeg() <= o)
5313 if (set[an].GetpFDeg() > o)
5318 if (set[
i].GetpFDeg() > o)
5328 if (
length==-1)
return 0;
5329 int ol =
p.GetpLength();
5331 int oo=set[
length].ecart;
5333 if ((oo < op) || ((oo==op) && (set[
length].
length <= ol)))
5343 int oo=set[an].ecart;
5345 || ((oo==op) && (set[an].
pLength > ol)))
5350 int oo=set[
i].ecart;
5352 || ((oo == op) && (set[
i].
pLength > ol)))
5384 if (
length==-1)
return 0;
5386 int o =
p.GetpFDeg() +
p.ecart;
5402 op = set[an].GetpFDeg()+set[an].ecart;
5404 || (( op == o) && (
pLmCmp(set[an].
p,
p.p) == cmp_int)))
5409 op = set[
i].GetpFDeg()+set[
i].ecart;
5411 || (( op == o) && (
pLmCmp(set[
i].
p,
p.p) == cmp_int)))
5421 if (
length==-1)
return 0;
5423 int o =
p.GetpFDeg() +
p.ecart;
5438 op = set[an].GetpFDeg()+set[an].ecart;
5445 op = set[
i].GetpFDeg()+set[
i].ecart;
5482 if (
length==-1)
return 0;
5484 int o =
p.GetpFDeg() +
p.ecart;
5489 || (( op == o) && (set[
length].ecart >
p.ecart))
5490 || (( op == o) && (set[
length].ecart==
p.ecart)
5501 op = set[an].GetpFDeg()+set[an].ecart;
5503 || (( op == o) && (set[an].ecart <
p.ecart))
5504 || (( op == o) && (set[an].ecart==
p.ecart)
5505 && (
pLmCmp(set[an].
p,
p.p) == cmp_int)))
5510 op = set[
i].GetpFDeg()+set[
i].ecart;
5512 || (( op == o) && (set[
i].ecart <
p.ecart))
5513 || (( op == o) && (set[
i].ecart ==
p.ecart)
5524 if (
length==-1)
return 0;
5526 int o =
p.GetpFDeg() +
p.ecart;
5530 || (( op == o) && (set[
length].ecart >
p.ecart))
5531 || (( op == o) && (set[
length].ecart==
p.ecart)
5542 op = set[an].GetpFDeg()+set[an].ecart;
5544 || (( op == o) && (set[an].ecart <
p.ecart))
5545 || (( op == o) && (set[an].ecart==
p.ecart)
5551 op = set[
i].GetpFDeg()+set[
i].ecart;
5553 || (( op == o) && (set[
i].ecart <
p.ecart))
5554 || (( op == o) && (set[
i].ecart ==
p.ecart)
5570 if (
length==-1)
return 0;
5574 int o =
p.GetpFDeg() +
p.ecart;
5584 || ((op == o) && (set[
length].ecart >
p.ecart))
5585 || ((op == o) && (set[
length].ecart==
p.ecart)
5601 int op = set[an].GetpFDeg()+set[an].ecart;
5603 || ((op == o) && (set[an].ecart <
p.ecart))
5604 || ((op == o) && (set[an].ecart==
p.ecart)
5605 && (
pLmCmp(set[an].
p,
p.p) == cmp_int)))
5615 int op = set[
i].GetpFDeg()+set[
i].ecart;
5617 || ((op == o) && (set[
i].ecart <
p.ecart))
5618 || ((op == o) && (set[
i].ecart ==
p.ecart)
5632 if (
length==-1)
return 0;
5636 int o =
p.GetpFDeg() +
p.ecart;
5645 || ((op == o) && (set[
length].ecart >
p.ecart))
5646 || ((op == o) && (set[
length].ecart==
p.ecart)
5662 int op = set[an].GetpFDeg()+set[an].ecart;
5664 || ((op == o) && (set[an].ecart <
p.ecart))
5665 || ((op == o) && (set[an].ecart==
p.ecart)
5676 int op = set[
i].GetpFDeg()+set[
i].ecart;
5678 || ((op == o) && (set[
i].ecart <
p.ecart))
5679 || ((op == o) && (set[
i].ecart ==
p.ecart)
5699 if (
length==-1)
return 0;
5702 int op=
p.GetpFDeg();
5704 if (set[
length].ecart < o)
5706 if (set[
length].ecart == o)
5708 int oo=set[
length].GetpFDeg();
5709 if ((oo < op) || ((oo==op) && (set[
length].
length <
p.length)))
5720 if (set[an].ecart > o)
5722 if (set[an].ecart == o)
5724 int oo=set[an].GetpFDeg();
5726 || ((oo==op) && (set[an].
length >
p.length)))
5732 if (set[
i].ecart > o)
5734 else if (set[
i].ecart == o)
5736 int oo=set[
i].GetpFDeg();
5738 || ((oo == op) && (set[
i].
length >
p.length)))
5758 int d=
p->GetpFDeg();
5759 int op=set[
length].GetpFDeg();
5774 op=set[an].GetpFDeg();
5776 || ((op == d) && (
p->p1!=
NULL) && (set[an].p1==
NULL))
5777 || (
pLmCmp(set[an].
p,
p->p)== cmp_int))
5782 op=set[
i].GetpFDeg();
5784 || ((op==d) && (
p->p1!=
NULL) && (set[
i].p1==
NULL))
5814 if (
pLmCmp(set[an].
p,
p->p) == cmp_int)
return en;
5872 if (
pLtCmp(set[an].sig,
p->sig) == cmp_int)
return en;
5876 if (
pLtCmp(set[
i].sig,
p->sig) == cmp_int) an=
i;
5900 cmp =
pLtCmp(set[an].sig,
p->sig);
5907 if (set[an].FDeg >
p->FDeg)
5909 if (set[an].FDeg < p->FDeg)
5911 if (set[an].FDeg ==
p->FDeg)
5929 if (set[
i].FDeg >
p->FDeg)
5931 if (set[
i].FDeg < p->FDeg)
5933 if (set[
i].FDeg ==
p->FDeg)
5948 if (
length < 0)
return 0;
5949 if (set[
length].FDeg >
p->FDeg)
5951 if (set[
length].FDeg ==
p->FDeg)
5952 if(set[
length].GetpLength() >
p->GetpLength())
5963 if (set[an].FDeg >
p->FDeg)
5965 if(set[an].FDeg ==
p->FDeg)
5967 if(set[an].GetpLength() >
p->GetpLength())
5971 if(set[an].GetpLength() ==
p->GetpLength())
5988 if (set[
i].FDeg >
p->FDeg)
5992 if(set[
i].FDeg ==
p->FDeg)
5994 if(set[
i].GetpLength() >
p->GetpLength())
5998 if(set[
i].GetpLength() ==
p->GetpLength())
6020 if (strat->
syzl==0)
return 0;
6026 int en= strat->
syzl-1;
6031 if (
pLtCmp(strat->
syz[an],sig) != cmp_int)
return en;
6064 int o =
p->GetpFDeg();
6065 int op = set[
length].GetpFDeg();
6078 op = set[an].GetpFDeg();
6080 || ((op == o) && (
pLmCmp(set[an].
p,
p->p) != cmp_int)))
6085 op = set[
i].GetpFDeg();
6087 || ((op == o) && (
pLmCmp(set[
i].
p,
p->p) != cmp_int)))
6107 int o =
p->GetpFDeg();
6108 int op = set[
length].GetpFDeg();
6120 op = set[an].GetpFDeg();
6127 op = set[
i].GetpFDeg();
6141 int o =
p->GetpFDeg();
6142 int op = set[
length].GetpFDeg();
6154 op = set[an].GetpFDeg();
6161 op = set[
i].GetpFDeg();
6175 if (
length < 0)
return 0;
6185 if (set[an].FDeg >
p->FDeg)
6187 if (set[an].FDeg < p->FDeg)
6189 if (set[an].FDeg ==
p->FDeg)
6197 if (set[an].t_p!=
NULL)
6219 if (set[
i].FDeg >
p->FDeg)
6221 if (set[
i].FDeg < p->FDeg)
6223 if (set[
i].FDeg ==
p->FDeg)
6231 if (set[
i].t_p!=
NULL)
6263 if (coeff == 0)
return -1;
6266 while (tmp % 2 == 0)
6285 if (
length < 0)
return 0;
6287 int o =
p->GetpFDeg();
6288 int op = set[
length].GetpFDeg();
6299 op = set[an].GetpFDeg();
6300 if ((op > o) || ((op == o) && (
pLmCmp(set[an].
p,
p->p) != -
currRing->OrdSgn)))
6305 op = set[
i].GetpFDeg();
6363 int o =
p->GetpFDeg();
6364 int op = set[
length].GetpFDeg();
6369 || ((op == o) && (set[
length].length <=
p->length)
6379 op = set[an].GetpFDeg();
6381 || ((op == o) && (set[an].
length >
p->length))
6382 || ((op == o) && (set[an].length <=
p->length)
6383 && (
pLmCmp(set[an].
p,
p->p) != cmp_int)))
6388 op = set[
i].GetpFDeg();
6390 || ((op == o) && (set[
i].
length >
p->length))
6391 || ((op == o) && (set[
i].length <=
p->length)
6405 int o =
p->GetpFDeg();
6406 int op = set[
length].GetpFDeg();
6410 || ((op == o) && (set[
length].length <=
p->length)
6420 op = set[an].GetpFDeg();
6422 || ((op == o) && (set[an].
length >
p->length))
6423 || ((op == o) && (set[an].length <=
p->length)
6429 op = set[
i].GetpFDeg();
6431 || ((op == o) && (set[
i].
length >
p->length))
6432 || ((op == o) && (set[
i].length <=
p->length)
6452 int o =
p->GetpFDeg();
6454 if (set[
length].GetpFDeg() > o)
6464 if (set[an].GetpFDeg() >= o)
6469 if (set[
i].GetpFDeg() >= o)
6487 int o =
p->GetpFDeg() +
p->ecart;
6501 op = set[an].GetpFDeg() + set[an].ecart;
6503 || ((op == o) && (
pLmCmp(set[an].
p,
p->p) != cmp_int)))
6508 op = set[
i].GetpFDeg() + set[
i].ecart;
6510 || ((op == o) && (
pLmCmp(set[
i].
p,
p->p) != cmp_int)))
6523 int o =
p->GetpFDeg() +
p->ecart;
6536 op = set[an].GetpFDeg() + set[an].ecart;
6543 op = set[
i].GetpFDeg() + set[
i].ecart;
6564 int o =
p->GetpFDeg() +
p->ecart;
6569 && (set[
length].ecart >
p->ecart))
6571 && (set[
length].ecart ==
p->ecart)
6581 if ((set[an].GetpFDeg() + set[an].ecart > o)
6582 || ((set[an].GetpFDeg() + set[an].ecart == o)
6583 && (set[an].ecart >
p->ecart))
6584 || ((set[an].GetpFDeg() + set[an].ecart == o)
6585 && (set[an].ecart ==
p->ecart)
6586 && (
pLmCmp(set[an].
p,
p->p) != cmp_int)))
6591 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6592 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6593 && (set[
i].ecart >
p->ecart))
6594 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6595 && (set[
i].ecart ==
p->ecart)
6609 int o =
p->GetpFDeg() +
p->ecart;
6613 && (set[
length].ecart >
p->ecart))
6615 && (set[
length].ecart ==
p->ecart)
6625 if ((set[an].GetpFDeg() + set[an].ecart > o)
6626 || ((set[an].GetpFDeg() + set[an].ecart == o)
6627 && (set[an].ecart >
p->ecart))
6628 || ((set[an].GetpFDeg() + set[an].ecart == o)
6629 && (set[an].ecart ==
p->ecart)
6635 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6636 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6637 && (set[
i].ecart >
p->ecart))
6638 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6639 && (set[
i].ecart ==
p->ecart)
6662 int o =
p->GetpFDeg() +
p->ecart;
6671 && (set[
length].ecart >
p->ecart))
6673 && (set[
length].ecart ==
p->ecart)
6688 if ((set[an].GetpFDeg() + set[an].ecart > o)
6689 || ((set[an].GetpFDeg() + set[an].ecart == o)
6690 && (set[an].ecart >
p->ecart))
6691 || ((set[an].GetpFDeg() + set[an].ecart == o)
6692 && (set[an].ecart ==
p->ecart)
6693 && (
pLmCmp(set[an].
p,
p->p) != cmp_int)))
6703 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6704 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6705 && (set[
i].ecart >
p->ecart))
6706 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6707 && (set[
i].ecart ==
p->ecart)
6727 int o =
p->GetpFDeg() +
p->ecart;
6735 && (set[
length].ecart >
p->ecart))
6737 && (set[
length].ecart ==
p->ecart)
6752 if ((set[an].GetpFDeg() + set[an].ecart > o)
6753 || ((set[an].GetpFDeg() + set[an].ecart == o)
6754 && (set[an].ecart >
p->ecart))
6755 || ((set[an].GetpFDeg() + set[an].ecart == o)
6756 && (set[an].ecart ==
p->ecart)
6767 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6768 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6769 && (set[
i].ecart >
p->ecart))
6770 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6771 && (set[
i].ecart ==
p->ecart)
6790 PrintS(
"syzygy criterion checks: ");
6793 for (
int k=0;
k<strat->
syzl;
k++)
6798 Print(
"checking with: %d / %d -- \n",
k,strat->
syzl);
6827 PrintS(
"--- syzygy criterion checks: ");
6852 Print(
"checking with: %d -- ",
k);
6877 PrintS(
"rewritten criterion checks: ");
6880 for(
int k = strat->
sl;
k>=start;
k--)
6884 PrintS(
"checking with: ");
6900 PrintS(
"ALL ELEMENTS OF S\n----------------------------------------\n");
6901 for(
int kk = 0; kk<strat->
sl+1; kk++)
6905 PrintS(
"------------------------------\n");
6935 for (
int ii=strat->
sl; ii>start; ii--)
6941 if (!(
pLmCmp(p1,p2) == 1))
6960 for (
int i=strat->
Bl;
i>-1;
i--)
6981 for (
int ii=strat->
sl; ii>-1; ii--)
6987 if (!(
pLmCmp(p1,p2) == 1))
7008 const unsigned long not_sev = ~L->sev;
7009 const unsigned long* sev = strat->
sevS;
7022 if (
j > end_pos)
return NULL;
7023 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7025 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7030 if (!(sev[
j] & not_sev) &&
7031 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]) &&
7045 if (
j > end_pos)
return NULL;
7046 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7053 if (!(sev[
j] & not_sev) &&
7054 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]) &&
7065 if (strat->
tl < 0 || strat->
S_2_R[
j] == -1)
7086 if (
j > end_pos)
return NULL;
7088 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7092 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7098 if (! (sev[
j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7101 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[
j]);
7117 if (
j > end_pos)
return NULL;
7119 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7129 if (! (sev[
j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7132 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[
j]);
7183 if (With ==
NULL)
break;
7193 return redtail(L, end_pos, strat);
7199 if (hn ==
NULL)
goto all_done;
7220 return redtail(&L, end_pos, strat);
7228 p =
h = L->GetLmTailRing();
7230 return L->GetLmCurrRing();
7265 Ln.SetShortExpVector();
7271 With = &(strat->
T[
j]);
7272 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7277 if (With ==
NULL)
break;
7278 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7305 pNext(
h) = Ln.LmExtractAndIter();
7308 }
while (!Ln.IsNull());
7311 if (Ln.IsNull())
goto all_done;
7312 if (! withT) With_s.Init(
currRing);
7314 pNext(
h) = Ln.LmExtractAndIter();
7333 return L->GetLmCurrRing();
7341 p =
h = L->GetLmTailRing();
7343 return L->GetLmCurrRing();
7350 Ln.pLength = L->GetpLength() - 1;
7374 Ln.SetShortExpVector();
7380 With = &(strat->
T[
j]);
7385 if (With ==
NULL)
break;
7412 pNext(
h) = Ln.LmExtractAndIter();
7415 }
while (!Ln.IsNull());
7427 if (! withT) With_s.Init(
currRing);
7429 pNext(
h) = Ln.LmExtractAndIter();
7448 return L->GetLmCurrRing();
7458 p =
h = L->GetLmTailRing();
7493 Ln.SetShortExpVector();
7506 With = &(strat->
T[
j]);
7507 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7524 pNext(
h) = Ln.LmExtractAndIter();
7527 }
while (!Ln.IsNull());
7535 With = &(strat->
T[
j]);
7536 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7553 pNext(
h) = Ln.LmExtractAndIter();
7556 }
while (!Ln.IsNull());
7560 if (Ln.IsNull())
goto all_done;
7562 pNext(
h) = Ln.LmExtractAndIter();
7587 p =
h = L->GetLmTailRing();
7589 return L->GetLmCurrRing();
7596 Ln.pLength = L->GetpLength() - 1;
7609 Ln.SetShortExpVector();
7611 if (With ==
NULL)
break;
7621 poly p_Ln=Ln.GetLmCurrRing();
7622 poly p_With=With->GetLmCurrRing();
7634 if (Ln.bucket!=
NULL)
7665 pNext(
h) = Ln.LmExtractAndIter();
7668 }
while (!Ln.IsNull());
7671 if (Ln.IsNull())
goto all_done;
7674 pNext(
h) = Ln.LmExtractAndIter();
7692 return L->GetLmCurrRing();
7701 p =
h = L->GetLmTailRing();
7703 return L->GetLmCurrRing();
7710 Ln.pLength = L->GetpLength() - 1;
7723 Ln.SetShortExpVector();
7726 if (With ==
NULL)
break;
7735 poly p_Ln=Ln.GetLmCurrRing();
7736 poly p_With=With->GetLmCurrRing();
7749 pNext(
h) = Ln.LmExtractAndIter();
7752 }
while (!Ln.IsNull());
7757 if (Ln.IsNull())
goto all_done;
7759 pNext(
h) = Ln.LmExtractAndIter();
7777 return L->GetLmCurrRing();
7793 if (strat->
Ll != *reduc)
7795 if (strat->
Ll != *reduc-1)
7807 if (red_result == 0)
7809 else if (red_result < 0)
7811 if ((red_result > 0) || ((strat->
Ll % 100)==99))
7813 if (strat->
Ll != *reduc && strat->
Ll > 0)
7830 Print(
"product criterion:%d chain criterion:%d\n",strat->
cp,strat->
c3);
7831 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
7832 #ifdef HAVE_SHIFTBBA
7834 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
7845 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
7846 #ifdef HAVE_SHIFTBBA
7848 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
7863 for (
i=0;
i<=strat->
sl;
i++)
7875 for (
i=0;
i<=strat->
tl;
i++)
7879 if (strat->
T[
i].length==0) strat->
T[
i].length=
pLength(strat->
T[
i].p);
7880 Print(
" o:%ld e:%d l:%d",
7881 strat->
T[
i].pFDeg(),strat->
T[
i].ecart,strat->
T[
i].length);
7886 for (
i=strat->
Ll;
i>=0;
i--)
7895 Print(
" o:%ld e:%d l:%d",
7896 strat->
L[
i].pFDeg(),strat->
L[
i].ecart,strat->
L[
i].length);
7918 strat->
S=strat->
Shdl->m;
7923 memset(strat->
fromQ,0,
i*
sizeof(
int));
7952 strat->
enterS(
h,pos,strat,-1);
7953 strat->
fromQ[pos]=1;
7986 strat->
enterS(
h,pos,strat,-1);
8012 strat->
S=strat->
Shdl->m;
8017 memset(strat->
fromQ,0,
i*
sizeof(
int));
8046 strat->
enterS(
h,pos,strat,-1);
8047 strat->
fromQ[pos]=1;
8079 pos = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
8109 strat->
S = strat->
Shdl->m;
8122 memset(strat->
fromQ,0,
i*
sizeof(
int));
8151 strat->
enterS(
h,pos,strat,-1);
8152 strat->
fromQ[pos]=1;
8262 for(
i=1;
i<=strat->
sl;
i++)
8274 strat->
syz = (poly *)
omAlloc(ps*
sizeof(poly));
8278#if defined(DEBUGF5) || defined(DEBUGF51)
8279 PrintS(
"------------- GENERATING SYZ RULES NEW ---------------\n");
8286 while (i <= strat->sl)
8316 for (
k = 0;
k<
i;
k++)
8360 for (
k = 0;
k<strat->
sl+1;
k++)
8381 PrintS(
"Principal syzygies:\n");
8384 Print(
"ps %d\n",ps);
8385 PrintS(
"--------------------------------\n");
8395 PrintS(
"--------------------------------\n");
8415 strat->
S=strat->
Shdl->m;
8421 memset(strat->
fromQ,0,
i*
sizeof(
int));
8450 strat->
enterS(
h,pos,strat, strat->
tl+1);
8452 strat->
fromQ[pos]=1;
8480 strat->
enterS(
h,pos,strat, strat->
tl+1);
8522 h.is_normalized = 0;
8529 strat->
enterS(
h,pos,strat, strat->
tl+1);
8559 strat->
S=strat->
Shdl->m;
8565 memset(strat->
fromQ,0,
i*
sizeof(
int));
8594 strat->
enterS(
h,pos,strat, strat->
tl+1);
8596 strat->
fromQ[pos]=1;
8624 strat->
enterS(
h,pos,strat, strat->
tl+1);
8666 h.is_normalized = 0;
8673 strat->
enterS(
h,pos,strat, strat->
tl+1);
8695 unsigned long not_sev = ~ pGetShortExpVector(
h);
8697 while (
j <= maxIndex)
8714 if (!
pIsVector((*p).p) && ((*p).ecart != 0))
8723 h1 = r =
pCopy((*p).p);
8775 unsigned long not_sev = ~ pGetShortExpVector(
h);
8776 while ((j <= strat->sl) && (
pGetComp(strat->
S[
j])!=0))
j++;
8778 while (j<=strat->sl)
8785 not_sev = ~ pGetShortExpVector(
h);
8800 unsigned long not_sev = ~ pGetShortExpVector(
h);
8802 while (
j <= maxIndex)
8809 not_sev = ~ pGetShortExpVector(
h);
8825 unsigned long not_sev = ~ pGetShortExpVector(
h);
8852 not_sev = ~ pGetShortExpVector(
h);
8856 while (
j <= maxIndex);
8886 while (i<=strat->sl)
8897 if (
pCmp(redSi,strat->
S[
i])!=0)
8954 if (any_change)
reorderS(&suc,strat);
8959 for (
i=0;
i<=strat->
sl;
i++)
8997 while (i<=strat->sl)
9009 else if (
pCmp((strat->
S)[
i],redSi)!=0)
9050 if (any_change)
reorderS(&suc,strat);
9051 else { suc=-1;
break; }
9062 for (
i=0;
i<=strat->
sl;
i++)
9090 if (suc!= -1)
updateS(toT,strat);
9110 *
sizeof(
unsigned long));
9137 strat->
Shdl->m=strat->
S;
9139 if (atS <= strat->sl)
9141#ifdef ENTER_USE_MEMMOVE
9142 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9143 (strat->
sl - atS + 1)*
sizeof(poly));
9144 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9145 (strat->
sl - atS + 1)*
sizeof(
int));
9146 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9147 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9148 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9149 (strat->
sl - atS + 1)*
sizeof(
int));
9151 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9152 (strat->
sl - atS + 1)*
sizeof(
int));
9154 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9157 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9159 strat->
S[
i] = strat->
S[
i-1];
9165 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9168 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9174#ifdef ENTER_USE_MEMMOVE
9175 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9176 (strat->
sl - atS + 1)*
sizeof(
int));
9178 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9183 strat->
fromQ[atS]=0;
9194 strat->
sevS[atS] =
p.sev;
9196 strat->
S_2_R[atS] = atR;
9206 for (
int i = maxPossibleShift;
i > 0;
i--)
9214 int atS =
posInS(strat, strat->
sl, qq.p, qq.ecart);
9233 *
sizeof(
unsigned long));
9237 *
sizeof(
unsigned long));
9265 strat->
Shdl->m=strat->
S;
9272 if (atS <= strat->sl)
9274#ifdef ENTER_USE_MEMMOVE
9275 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9276 (strat->
sl - atS + 1)*
sizeof(poly));
9277 memmove(&(strat->
sig[atS+1]), &(strat->
sig[atS]),
9278 (strat->
sl - atS + 1)*
sizeof(poly));
9279 memmove(&(strat->
sevSig[atS+1]), &(strat->
sevSig[atS]),
9280 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9281 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9282 (strat->
sl - atS + 1)*
sizeof(
int));
9283 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9284 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9285 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9286 (strat->
sl - atS + 1)*
sizeof(
int));
9288 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9289 (strat->
sl - atS + 1)*
sizeof(
int));
9291 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9294 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9296 strat->
S[
i] = strat->
S[
i-1];
9304 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9307 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9313#ifdef ENTER_USE_MEMMOVE
9314 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9315 (strat->
sl - atS + 1)*
sizeof(
int));
9317 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9322 strat->
fromQ[atS]=0;
9326 strat->
S[atS] =
p.p;
9327 strat->
sig[atS] =
p.sig;
9333 strat->
sevS[atS] =
p.sev;
9343 strat->
sevSig[atS] =
p.sevSig;
9346 strat->
S_2_R[atS] = atR;
9350 Print(
"--- LIST S: %d ---\n",strat->
sl);
9351 for(
k=0;
k<=strat->
sl;
k++)
9355 PrintS(
"--- LIST S END ---\n");
9381 else strat->
P.sev=0;
9389 poly tp = strat->
T[tj].p;
9394 for (
j = 0;
j <= strat->
sl; ++
j)
9408 pos =
posInS(strat, strat->
sl,
p.p,
p.ecart);
9414 for (
i = 0;
i <= strat->
Ll; ++
i)
9438 strat->
enterS(
p, pos, strat, strat->
tl);
9477 for(
i=strat->
tl;
i>=0;
i--)
9479 if (
p.p==strat->
T[
i].p)
9481 printf(
"already in T at pos %d of %d, atT=%d\n",
i,strat->
tl,atT);
9487#ifdef HAVE_TAIL_RING
9490 p.t_p=
p.GetLmTailRing();
9496 if (strat->
tl == strat->
tmax-1)
9498 if (atT <= strat->tl)
9500#ifdef ENTER_USE_MEMMOVE
9501 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9503 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9504 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9506 for (
i=strat->
tl+1;
i>=atT+1;
i--)
9508#ifndef ENTER_USE_MEMMOVE
9509 strat->
T[
i] = strat->
T[
i-1];
9512 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9520 if (!(
currRing->isLPring &&
p.shift > 0))
9536 strat->
T[atT].max_exp =
NULL;
9539 strat->
R[strat->
tl] = &(strat->
T[atT]);
9540 strat->
T[atT].i_r = strat->
tl;
9565 for(
i=strat->
tl;
i>=0;
i--)
9567 if (
p.p==strat->
T[
i].p)
9569 printf(
"already in T at pos %d of %d, atT=%d\n",
i,strat->
tl,atT);
9575#ifdef HAVE_TAIL_RING
9578 p.t_p=
p.GetLmTailRing();
9584 if (strat->
tl == strat->
tmax-1)
9586 if (atT <= strat->tl)
9588#ifdef ENTER_USE_MEMMOVE
9589 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9591 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9592 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9594 for (
i=strat->
tl+1;
i>=atT+1;
i--)
9596#ifndef ENTER_USE_MEMMOVE
9597 strat->
T[
i] = strat->
T[
i-1];
9600 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9618 strat->
T[atT].max_exp =
NULL;
9621 strat->
R[strat->
tl] = &(strat->
T[atT]);
9622 strat->
T[atT].i_r = strat->
tl;
9629 for(
i=strat->
tl;
i>=0;
i--)
9660 (strat->
syzmax)*
sizeof(
unsigned long),
9662 *
sizeof(
unsigned long));
9665 if (atT < strat->syzl)
9667#ifdef ENTER_USE_MEMMOVE
9668 memmove(&(strat->
syz[atT+1]), &(strat->
syz[atT]),
9669 (strat->
syzl-atT+1)*
sizeof(poly));
9670 memmove(&(strat->
sevSyz[atT+1]), &(strat->
sevSyz[atT]),
9671 (strat->
syzl-atT+1)*
sizeof(
unsigned long));
9673 for (
i=strat->
syzl;
i>=atT+1;
i--)
9675#ifndef ENTER_USE_MEMMOVE
9688 strat->
syz[atT] =
p.sig;
9689 strat->
sevSyz[atT] =
p.sevSig;
9692 Print(
"element in strat->syz: %d--%d ",atT+1,strat->
syzmax);
9702 strat->
L[cc].sig, ~strat->
L[cc].sevSig,
currRing)
9716 PrintS(
"--- Syzygies ---\n");
9719 PrintS(
"--------------------------------\n");
9725 PrintS(
"--------------------------------\n");
9807 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
9808 else PrintS(
"ideal/module is not homogeneous\n");
9878 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
9879 else PrintS(
"ideal/module is not homogeneous\n");
10079#ifdef HAVE_SHIFTBBA
10148#ifdef HAVE_SHIFTBBA
10175#ifdef HAVE_SHIFTBBA
10419 if ((r->m[
l]!=
NULL)
10426 if ((
Q->m[q]!=
NULL)
10450 if ((r->m[
l]!=
NULL)
10457 if ((
Q->m[q]!=
NULL)
10501 reduction_found=
TRUE;
10532 reduction_found=
TRUE;
10546 if ( reduction_found)
10636 for (
i=strat->
sl;
i>=low;
i--)
10638 int end_pos=strat->
sl;
10640 if (strat->
ak==0) end_pos=
i-1;
10642 if ((T_j !=
NULL)&&(T_j->p==strat->
S[
i]))
10660 Print(
"to (tailR) S[%d]:",
i);
10672 T_j->max_exp =
NULL;
10675 T_j->pCleardenom();
10715 Print(
"to (-tailR) S[%d]:",
i);
10812 assume(L->i_r1 >= -1 && L->i_r1 <= strat->
tl);
10813 assume(L->i_r2 >= -1 && L->i_r2 <= strat->
tl);
10818 if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10823 if ((L->i_r1>=0)&&(strat->
R[L->i_r1]!=
NULL)) p1_max = (strat->
R[L->i_r1])->max_exp;
10825 if ((L->i_r2>=0)&&(strat->
R[L->i_r2]!=
NULL)) p2_max = (strat->
R[L->i_r2])->max_exp;
10851 poly p1_max = (strat->
R[atR])->max_exp;
10852 poly p2_max = (strat->
R[strat->
S_2_R[atS]])->max_exp;
10873 ideal F =
idCopy(Forig);
10877 ideal monred =
idInit(1,1);
10884 if((posconst != -1) && (!
nIsZero(F->m[posconst]->coef)))
10894 for(
int i=0;
i<idelemQ;
i++)
10902 if((posconst != -1) && (!
nIsZero(monred->m[posconst]->coef)))
10904 pmon =
pCopy(monred->m[posconst]);
10919 II->m[
j++] =
prMapR(F->m[
i], nMap, origR, QQ_ring);
10921 II->m[
j++] =
prMapR(
Q->m[
i], nMap, origR, QQ_ring);
10928 if(II->m[
i] !=
NULL)
10929 II->m[
i+1] = II->m[
i];
10932 poly integer =
NULL;
10940 integer =
pHead(syz->m[
i]);
10947 pmon =
prMapR(integer, nMap2, QQ_ring, origR);
10961 poly mindegmon =
NULL;
10966 if(mindegmon ==
NULL)
10967 mindegmon =
pCopy(one->m[
i]);
10970 if(
p_Deg(one->m[
i], QQ_ring) <
p_Deg(mindegmon, QQ_ring))
10971 mindegmon =
pCopy(one->m[
i]);
10975 if(mindegmon !=
NULL)
10978 if(II->m[
i] !=
NULL)
10979 II->m[
i+1] = II->m[
i];
10980 II->m[0] =
pCopy(mindegmon);
11009 pmon =
prMapR(mindegmon, nMap2, QQ_ring, origR);
11040 poly pH =
h->GetP();
11044 for(
int i = 0;
i<=strat->
sl;
i++)
11054#ifdef HAVE_SHIFTBBA
11079#ifdef HAVE_SHIFTBBA
11107 h->SetLmCurrRing();
11108 if((deleted)&&(
h->p!=
NULL))
11116 poly hSig =
h->sig;
11117 poly pH =
h->GetP();
11121 for(
int i = 0;
i<=strat->
sl;
i++)
11132 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
11159 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
11190 h->SetLmCurrRing();
11300 if (expbound == 0) expbound = strat->
tailRing->bitmask << 1;
11317 new_tailRing->pFDeg =
currRing->pFDeg;
11318 new_tailRing->pLDeg =
currRing->pLDeg;
11322 Print(
"[%lu:%d", (
unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11331 for (
i=0;
i<=strat->
tl;
i++)
11333 strat->
T[
i].ShallowCopyDelete(new_tailRing, new_tailBin,
11334 p_shallow_copy_delete);
11336 for (
i=0;
i<=strat->
Ll;
i++)
11340 strat->
L[
i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11342 if ((strat->
P.t_p !=
NULL) ||
11344 strat->
P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11346 if ((L !=
NULL) && (L->tailRing != new_tailRing))
11349 L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11355 L->tailRing = new_tailRing;
11358 L->max_exp = t_l->max_exp;
11362 if ((
T !=
NULL) && (
T->tailRing != new_tailRing &&
T->i_r < 0))
11363 T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11370 strat->
tailBin = new_tailBin;
11389 unsigned long l = 0;
11395 for (
i=0;
i<= strat->
Ll;
i++)
11399 for (
i=0;
i<=strat->
tl;
i++)
11427 res->block0 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11428 res->block1 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11429 int **wvhdl = (
int **)
omAlloc0((n+1)*
sizeof(
int*));
11430 res->wvhdl = wvhdl;
11431 for (
int i=1;
i<n;
i++)
11433 res->order[
i] = r->order[
i-1];
11434 res->block0[
i] = r->block0[
i-1];
11435 res->block1[
i] = r->block1[
i-1];
11436 res->wvhdl[
i] = r->wvhdl[
i-1];
11456 WarnS(
"error in nc_rComplete");
11475 res->block0 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11476 res->block1 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11477 int **wvhdl = (
int **)
omAlloc0((n+2)*
sizeof(
int*));
11478 res->wvhdl = wvhdl;
11479 for (
int i=2;
i<n+2;
i++)
11481 res->order[
i] = r->order[
i-2];
11482 res->block0[
i] = r->block0[
i-2];
11483 res->block1[
i] = r->block1[
i-2];
11484 res->wvhdl[
i] = r->wvhdl[
i-2];
11489 res->block0[0] = 1;
11491 for (
int i=0;
i<
res->N; ++
i)
11492 res->wvhdl[0][
i] = 1;
11512 WarnS(
"error in nc_rComplete");
11649#ifdef HAVE_TAIL_BIN
11674Timings
for the different possibilities of posInT:
11675 T15 EDL DL EL L 1-2-3
11676Gonnet 43.26 42.30 38.34 41.98 38.40 100.04
11677Hairer_2_1 1.11 1.15 1.04 1.22 1.08 4.7
11678Twomat3 1.62 1.69 1.70 1.65 1.54 11.32
11679ahml 4.48 4.03 4.03 4.38 4.96 26.50
11680c7 15.02 13.98 15.16 13.24 17.31 47.89
11681c8 505.09 407.46 852.76 413.21 499.19 n/a
11682f855 12.65 9.27 14.97 8.78 14.23 33.12
11683gametwo6 11.47 11.35 14.57 11.20 12.02 35.07
11684gerhard_3 2.73 2.83 2.93 2.64 3.12 6.24
11685ilias13 22.89 22.46 24.62 20.60 23.34 53.86
11686noon8 40.68 37.02 37.99 36.82 35.59 877.16
11687rcyclic_19 48.22 42.29 43.99 45.35 51.51 204.29
11688rkat9 82.37 79.46 77.20 77.63 82.54 267.92
11689schwarz_11 16.46 16.81 16.76 16.81 16.72 35.56
11690test016 16.39 14.17 14.40 13.50 14.26 34.07
11691test017 34.70 36.01 33.16 35.48 32.75 71.45
11692test042 10.76 10.99 10.27 11.57 10.45 23.04
11693test058 6.78 6.75 6.51 6.95 6.22 9.47
11694test066 10.71 10.94 10.76 10.61 10.56 19.06
11695test073 10.75 11.11 10.17 10.79 8.63 58.10
11696test086 12.23 11.81 12.88 12.24 13.37 66.68
11697test103 5.05 4.80 5.47 4.64 4.89 11.90
11698test154 12.96 11.64 13.51 12.46 14.61 36.35
11699test162 65.27 64.01 67.35 59.79 67.54 196.46
11700test164 7.50 6.50 7.68 6.70 7.96 17.13
11701virasoro 3.39 3.50 3.35 3.47 3.70 7.66
11711 if (
length==-1)
return 0;
11714 int op=
p.GetpFDeg();
11715 int ol =
p.GetpLength();
11717 if (set[
length].ecart < o)
11719 if (set[
length].ecart == o)
11721 int oo=set[
length].GetpFDeg();
11722 if ((oo < op) || ((oo==op) && (set[
length].
length < ol)))
11733 if (set[an].ecart > o)
11735 if (set[an].ecart == o)
11737 int oo=set[an].GetpFDeg();
11739 || ((oo==op) && (set[an].
pLength > ol)))
11745 if (set[
i].ecart > o)
11747 else if (set[
i].ecart == o)
11749 int oo=set[
i].GetpFDeg();
11751 || ((oo == op) && (set[
i].
pLength > ol)))
11765 if (
length==-1)
return 0;
11767 int op=
p.GetpFDeg();
11768 int ol =
p.GetpLength();
11770 int oo=set[
length].GetpFDeg();
11771 if ((oo < op) || ((oo==op) && (set[
length].
length < ol)))
11781 int oo=set[an].GetpFDeg();
11783 || ((oo==op) && (set[an].
pLength > ol)))
11788 int oo=set[
i].GetpFDeg();
11790 || ((oo == op) && (set[
i].
pLength > ol)))
11801 int ol =
p.GetpLength();
11815 if (set[an].
pLength>ol)
return an;
11842 else Print(
"%p\n",(
void*)strat->
red);
11861#ifdef HAVE_MORE_POS_IN_T
11899 PrintS(
"initEcartPair: ");
11903 Print(
"homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11905 Print(
"honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11911 Print(
"posInLDependsOnLength=%d\n",
11943 PrintS(
"currRing->pFDeg: ");
11958 PrintS(
"ecartWeights: ");
11970#ifdef HAVE_SHIFTBBA
11984#ifdef HAVE_SHIFTBBA
12001#ifdef HAVE_SHIFTBBA
12096#ifdef HAVE_SHIFTBBA
12101 assume(ifromS <= strat->sl);
12200 PrintS(
"\n--- create strong gcd poly: ");
12203 Print(
"\n q (strat->S[%d]): ", ifromS);
12209 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);
12231 h.i_r1 = -1;
h.i_r2 = -1;
12238 if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
12251 posx = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
12265#ifdef HAVE_SHIFTBBA
12292 int j,compare,compareCoeff;
12296 h.ecart=0;
h.length=0;
12328 for(
j = strat->
Bl;
j>=0;
j--)
12337 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12352 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12365 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12469 h.i_r1 = -1;
h.i_r2 = -1;
12478 if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
12493 posx = strat->
posInL(strat->
B,strat->
Bl,&
h,strat);
12508#ifdef HAVE_SHIFTBBA
12518#ifdef HAVE_SHIFTBBA
12523 assume(q_inS < 0 || strat->S[q_inS] == q);
12533 if (strat->
fromQ !=
NULL && q_inS >= 0)
12534 q_isFromQ = strat->
fromQ[q_inS];
12536 BOOLEAN (*enterPair)(poly, poly, int, int,
kStrategy, int, int, int, int, int);
12545 int neededShift = p_lastVblock - ((
pGetComp(
p) > 0 ||
pGetComp(q) > 0) ? 0 : 1);
12546 int maxPossibleShift =
degbound - q_lastVblock;
12547 int maxShift =
si_min(neededShift, maxPossibleShift);
12548 int firstShift = (q ==
p ? 1 : 0);
12550 for (
int j = firstShift;
j <= maxShift;
j++)
12553 if (enterPair(qq,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ,
j, q_inS))
12566 for (
int j = p_lastVblock;
j <= maxPossibleShift;
j++)
12572 enterPair(qq,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, p_lastVblock, q_inS);
12578 return delete_pair;
12582#ifdef HAVE_SHIFTBBA
12588 assume(p_inS < 0 || strat->S[p_inS] ==
p);
12597 if (strat->
fromQ !=
NULL && p_inS >= 0)
12598 p_isFromQ = strat->
fromQ[p_inS];
12603 assume(q_shift <= p_lastVblock);
12610 return enterOnePairShift(q,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, q_shift, -1);
12624#ifdef HAVE_SHIFTBBA
12627#ifdef CRITERION_DEBUG
12632 poly lmq =
pHead(q);
12653 int qfromQ = qisFromQ;
12662 Lp.ecart=0; Lp.length=0;
12672#ifdef CRITERION_DEBUG
12680 if((!((ecartq>0)&&(ecart>0)))
12699#ifdef CRITERION_DEBUG
12705 Lp.ecart =
si_max(ecart,ecartq);
12706 if (strat->
fromT && (ecartq>ecart))
12709#ifdef CRITERION_DEBUG
12731 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12734#ifdef CRITERION_DEBUG
12737 Print(
"--- chain crit using B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12748#ifdef CRITERION_DEBUG
12751 Print(
"--- chain crit using pair to remove B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12784#ifdef CRITERION_DEBUG
12789 if (strat->
fromT && (ecartq>ecart))
12792#ifdef CRITERION_DEBUG
12804 for(
j = strat->
Bl;
j>=0;
j--)
12810 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12813#ifdef CRITERION_DEBUG
12816 Print(
"--- chain crit using B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12826#ifdef CRITERION_DEBUG
12829 Print(
"--- chain crit using pair to remove B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12846#ifdef CRITERION_DEBUG
12851 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (qfromQ!=0))
12854#ifdef CRITERION_DEBUG
12914#ifdef CRITERION_DEBUG
12931 if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12948 && (Lp.p->coef!=
NULL))
12952 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
12954#ifdef CRITERION_DEBUG
12967#ifdef HAVE_SHIFTBBA
12973 if (h_lastVblock == 0)
return;
12984 int maxShift =
degbound - h_lastVblock;
12993 for (
i=0;
i<=maxShift;
i++)
12997 for (
j=0;
j<=
k;
j++)
13002 poly
s = strat->
S[
j];
13013 for (
j=0;
j<=
k;
j++)
13015 poly
s = strat->
S[
j];
13030 else if ((isFromQ)&&(strat->
fromQ!=
NULL))
13033 for (
j=0;
j<=
k;
j++)
13038 poly
s = strat->
S[
j];
13045 for (
i=1;
i<=maxShift;
i++)
13049 for (
j=0;
j<=
k;
j++)
13053 poly
s = strat->
S[
j];
13055 if (
i < s_lastVblock || (
pGetComp(
s) > 0 &&
i == s_lastVblock))
13083 for (
j=0;
j<=
k;
j++)
13085 poly
s = strat->
S[
j];
13089 for (
i=1;
i<=maxShift;
i++)
13093 for (
j=0;
j<=
k;
j++)
13095 poly
s = strat->
S[
j];
13097 if (
i < s_lastVblock || (
pGetComp(
s) > 0 &&
i == s_lastVblock))
13114 if (
i < h_lastVblock)
13140 for (
j=0;
j<=
k;
j++)
13145 poly
s = strat->
S[
j];
13162 for (
j=0;
j<=
k;
j++)
13167 poly
s = strat->
S[
j];
13172 for (
i=1;
i<=maxShift;
i++)
13175 for (
j=0;
j<=
k;
j++)
13180 poly
s = strat->
S[
j];
13182 if (
i <= s_lastVblock)
13199 if (
i <= h_lastVblock)
13235#ifdef HAVE_SHIFTBBA
13241 if (h_lastVblock == 0)
return;
13252 int maxShift =
degbound - h_lastVblock;
13261 for (
i=0;
i<=maxShift;
i++)
13264 for (
j=0;
j<=
k;
j++)
13269 poly
s = strat->
S[
j];
13278 for (
j=0;
j<=
k;
j++)
13280 poly
s = strat->
S[
j];
13295 else if ((isFromQ)&&(strat->
fromQ!=
NULL))
13298 for (
j=0;
j<=
k;
j++)
13303 poly
s = strat->
S[
j];
13310 for (
i=1;
i<=maxShift;
i++)
13313 for (
j=0;
j<=
k;
j++)
13317 poly
s = strat->
S[
j];
13328 for (
j=0;
j<=
k;
j++)
13330 poly
s = strat->
S[
j];
13335 for (
i=1;
i<=maxShift;
i++)
13339 for (
j=0;
j<=
k;
j++)
13341 poly
s = strat->
S[
j];
13356 for (
j=0;
j<=
k;
j++)
13362 poly
s = strat->
S[
j];
13379 for (
j=0;
j<=
k;
j++)
13384 poly
s = strat->
S[
j];
13389 for (
i=1;
i<=maxShift;
i++)
13392 for (
j=0;
j<=
k;
j++)
13397 poly
s = strat->
S[
j];
13419#ifdef HAVE_SHIFTBBA
13428 if ( (!strat->
fromT)
13449#ifdef HAVE_SHIFTBBA
13460 for (
int i = 1;
i <= maxPossibleShift;
i++)
13472#ifdef HAVE_SHIFTBBA
13479 p =
h = L->GetLmTailRing();
13481 return L->GetLmCurrRing();
13488 Ln.pLength = L->GetpLength() - 1;
13496 while(!Ln.IsNull())
13500 Ln.SetShortExpVector();
13506 With = &(strat->
T[
j]);
13511 if (With ==
NULL)
break;
13527 pNext(
h) = Ln.LmExtractAndIter();
13530 }
while (!Ln.IsNull());
13533 if (Ln.IsNull())
goto all_done;
13534 if (! withT) With_s.Init(
currRing);
13536 pNext(
h) = Ln.LmExtractAndIter();
13551 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)
if(!FE_OPT_NO_SHELL_FLAG)(void) system(sys)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge)
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 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 TObject ** initR()
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 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)
KINLINE unsigned long * initsevT()
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)
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
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)
static const char * kTest_LmEqual(poly p, poly t_p, ring tailRing)
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)
static BOOLEAN enterOneStrongPolyAndEnterOnePairRingShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
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)
static BOOLEAN enterOnePairWithShifts(int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int, int p_lastVblock, int q_lastVblock)
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)
static BOOLEAN enterOnePairWithoutShifts(int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int, int p_lastVblock, int q_shift)
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 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)
static BOOLEAN is_shifted_p1(const poly p, const 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)
static int * initS_2_R(const int maxnr)
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)
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)
void exitSba(kStrategy strat)
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)
BOOLEAN enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
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)
void initBuchMoraPosRing(kStrategy strat)
int kFindInTShift(poly p, TSet T, int tlength)
void postReduceByMonSig(LObject *h, kStrategy strat)
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...
static unsigned long * initsevS(const int maxnr)
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)
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)
void cancelunit(LObject *L, BOOLEAN inNF)
denominator_list_s * denominator_list
static int kFindInL1(const poly p, const kStrategy strat)
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)
static nc_type & ncRingType(nc_struct *p)
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys 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 BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static int rBlocks(const ring r)
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)