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; }
260 poly
p = L->GetLmTailRing();
263 if (L->bucket !=
NULL)
301 L->ecart = L->pLDeg() - L->GetpFDeg();
310 L->ecart = L->pLDeg(strat->
LDegLast) - L->GetpFDeg();
348 ring r = L->tailRing;
349 poly
p = L->GetLmTailRing();
427 number eins=
nInit(1);
515 inline static unsigned long*
initsevS (
const int maxnr)
517 return (
unsigned long*)
omAlloc0(maxnr*
sizeof(
unsigned long));
521 return (
int*)
omAlloc0(maxnr*
sizeof(
int));
525 int &
length,
const int incr)
537 (
length+incr)*
sizeof(
long*));
555 for (
j=0;
j<=strat->
tl;
j++)
559 if (strat->
T[
j].max_exp !=
NULL)
569 if (strat->
T[
j].t_p !=
NULL)
577 if (
currRing->isLPring && strat->
T[
j].shift > 0)
586 if (
p == strat->
S[
i])
588 if (strat->
T[
j].t_p !=
NULL)
590 if (p_shallow_copy_delete!=
NULL)
614 for (
j=0;
j<=strat->
tl;
j++)
618 if (strat->
T[
j].max_exp !=
NULL)
628 if (strat->
T[
j].t_p !=
NULL)
640 if (
p == strat->
S[
i])
642 if (strat->
T[
j].t_p !=
NULL)
689 if ((*
k) < 0)
return FALSE;
690 if (((p1 == (*p).p1) && (p2 == (*p).p2))
691 || ((p1 == (*p).p2) && (p2 == (*p).p1)))
710 if ((*
k) < 0)
return FALSE;
722 for (
i=0;
i<=tlength;
i++)
724 if (
T[
i].
p ==
p)
return i;
735 if (
i >= 0)
return i;
738 while (strat !=
NULL);
747 for (
i=0;
i<=tlength;
i++)
763 if (
i >= 0)
return i;
766 while (strat !=
NULL);
780 #define kFalseReturn(x) do { if (!x) return FALSE;} while (0)
786 for (
i=1;
i<=tailRing->N;
i++)
789 return "Lm[i] different";
792 return "Lm[0] different";
794 return "Lm.next different";
796 return "Lm.coeff different";
803 ring tailRing =
T->tailRing;
804 if (strat_tailRing ==
NULL) strat_tailRing = tailRing;
805 r_assume(strat_tailRing == tailRing);
827 if (
T->t_p ==
NULL &&
i > 0)
844 if (
T->t_p !=
NULL &&
i >= 0 && TN ==
'T')
848 if (
T->max_exp !=
NULL)
849 return dReportError(
"%c[%d].max_exp is not NULL as it should be", TN,
i);
853 if (
T->max_exp ==
NULL)
865 p_Setm(test_max, tailRing);
877 if (
T->p ==
NULL &&
i > 0)
893 if ((
i >= 0) && (
T->pLength != 0)
898 return dReportError(
"%c[%d] pLength error: has %d, specified to have %d",
903 if (
i >= 0 && (TN ==
'T' || TN ==
'L'))
906 if (
T->FDeg !=
T->pFDeg())
910 return dReportError(
"%c[%d] FDeg error: has %d, specified to have %d",
911 TN,
i ,
T->pFDeg(), d);
916 if (
i >= 0 && TN ==
'T')
952 if (L->bucket !=
NULL)
955 r_assume(L->bucket->bucket_ring == L->tailRing);
973 return dReportError(
"L[%d] wrong sev: has %lo, specified to have %lo",
983 else if (tlength > 0 &&
T !=
NULL && (lpos >=0))
1016 -1, strat->
T, strat->
tl));
1019 if (strat->
T !=
NULL)
1021 for (
i=0;
i<=strat->
tl;
i++)
1030 if (strat->
L !=
NULL)
1032 for (
i=0;
i<=strat->
Ll;
i++)
1035 strat->
L[
i].Next() != strat->
tail,
i,
1036 strat->
T, strat->
tl));
1047 if (strat->
S !=
NULL)
1057 for (
i=0;
i<=strat->
sl;
i++)
1059 if (strat->
S[
i] !=
NULL &&
1062 return dReportError(
"S[%d] wrong sev: has %o, specified to have %o",
1078 for (
i=0;
i<=strat->
tl;
i++)
1080 if (strat->
T[
i].i_r < 0 || strat->
T[
i].i_r > strat->
tl)
1081 return dReportError(
"strat->T[%d].i_r == %d out of bounds",
i,
1083 if (strat->
R[strat->
T[
i].i_r] != &(strat->
T[
i]))
1087 if ((strat->
S !=
NULL)&&(strat->
tl>=0))
1089 for (
i=0;
i<=strat->
sl;
i++)
1094 if (strat->
S_2_R[
i] != strat->
T[
j].i_r)
1100 #ifdef HAVE_SHIFTBBA
1105 for (
i=0;
i<=strat->
Ll;
i++)
1107 if (strat->
L[
i].p1 !=
NULL && strat->
L[
i].p2)
1109 if (strat->
L[
i].i_r1 < 0 ||
1110 strat->
L[
i].i_r1 > strat->
tl ||
1111 strat->
L[
i].T_1(strat)->p != strat->
L[
i].p1)
1113 if (strat->
L[
i].i_r2 < 0 ||
1114 strat->
L[
i].i_r2 > strat->
tl ||
1115 strat->
L[
i].T_2(strat)->p != strat->
L[
i].p2)
1120 if (strat->
L[
i].i_r1 != -1)
1122 if (strat->
L[
i].i_r2 != -1)
1125 if (strat->
L[
i].i_r != -1)
1139 #ifdef ENTER_USE_MEMMOVE
1140 memmove(&(strat->
S[
i]), &(strat->
S[
i+1]), (strat->
sl -
i)*
sizeof(poly));
1142 memmove(&(strat->
sevS[
i]),&(strat->
sevS[
i+1]),(strat->
sl -
i)*
sizeof(
unsigned long));
1143 memmove(&(strat->
S_2_R[
i]),&(strat->
S_2_R[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1146 for (
j=
i;
j<strat->
sl;
j++)
1148 strat->
S[
j] = strat->
S[
j+1];
1156 #ifdef ENTER_USE_MEMMOVE
1157 memmove(&(strat->
lenS[
i]),&(strat->
lenS[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1164 #ifdef ENTER_USE_MEMMOVE
1172 #ifdef ENTER_USE_MEMMOVE
1173 memmove(&(strat->
fromQ[
i]),&(strat->
fromQ[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1175 for (
j=
i;
j<strat->
sl;
j++)
1191 #ifdef ENTER_USE_MEMMOVE
1192 memmove(&(strat->
S[
i]), &(strat->
S[
i+1]), (strat->
sl -
i)*
sizeof(poly));
1193 memmove(&(strat->
sig[
i]), &(strat->
sig[
i+1]), (strat->
sl -
i)*
sizeof(poly));
1195 memmove(&(strat->
sevS[
i]),&(strat->
sevS[
i+1]),(strat->
sl -
i)*
sizeof(
unsigned long));
1196 memmove(&(strat->
sevSig[
i]),&(strat->
sevSig[
i+1]),(strat->
sl -
i)*
sizeof(
unsigned long));
1197 memmove(&(strat->
S_2_R[
i]),&(strat->
S_2_R[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1200 for (
j=
i;
j<strat->
sl;
j++)
1202 strat->
S[
j] = strat->
S[
j+1];
1212 #ifdef ENTER_USE_MEMMOVE
1213 memmove(&(strat->
lenS[
i]),&(strat->
lenS[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1220 #ifdef ENTER_USE_MEMMOVE
1228 #ifdef ENTER_USE_MEMMOVE
1229 memmove(&(strat->
fromQ[
i]),&(strat->
fromQ[
i+1]),(strat->
sl -
i)*
sizeof(
int));
1231 for (
j=
i;
j<strat->
sl;
j++)
1250 if (set[
j].sig!=
NULL)
1284 #ifdef ENTER_USE_MEMMOVE
1288 for (
i=
j;
i < (*length);
i++)
1310 #ifdef ENTER_USE_MEMMOVE
1311 memmove(&((*set)[at+1]), &((*set)[at]), ((*
length)-at+1)*
sizeof(
LObject));
1313 for (
i=(*
length)+1;
i>=at+1;
i--) (*set)[
i] = (*set)[
i-1];
1327 h->FDeg =
h->pFDeg();
1328 h->ecart =
h->pLDeg() -
h->FDeg;
1335 h->FDeg =
h->pFDeg();
1342 Lp->FDeg = Lp->pFDeg();
1349 Lp->FDeg = Lp->pFDeg();
1350 (*Lp).ecart =
si_max(ecartF,ecartG);
1351 (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -
p_FDeg((*Lp).lcm,
currRing));
1360 return (ecart1 <= ecart2);
1392 int j,compare,compareCoeff;
1396 h.ecart=0;
h.length=0;
1420 for(
j = strat->
Bl;
j>=0;
j--)
1541 h.i_r1 = -1;
h.i_r2 = -1;
1557 posx = strat->
posInL(strat->
B,strat->
Bl,&
h,strat);
1562 else strat->
P.sev=0L;
1576 poly m1, m2,
gcd,si;
1605 for (
int j = 0;
j < strat->
sl;
j++)
1611 && !(strat->
sevS[
j] & ~sev)
1654 PrintS(
"\n--- create strong gcd poly: ");
1657 Print(
"\n strat->S[%d]: ",
i);
1681 h.i_r1 = -1;
h.i_r2 = -1;
1687 h.p1 =
p;
h.p2 = strat->
S[
i];
1702 posx = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
1707 if(
h.IsNull())
return FALSE;
1724 if(strat->
sl < 0)
return FALSE;
1726 for(
i=0;
i<strat->
sl;
i++)
1762 h->i_r1 = -1;
h->i_r2 = -1;
1784 poly m1, m2,
gcd,si;
1832 PrintS(
"\n--- create strong gcd poly: ");
1835 Print(
"\n strat->S[%d]: ",
i);
1859 if(
pLmCmp(pSigMult,sSigMult) == 0)
1868 if(
pLtCmp(pSigMult,sSigMult)==1)
1888 h.i_r1 = -1;
h.i_r2 = -1;
1896 int red_result =
redRing(&
h,strat);
1906 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1923 int red_result =
redRing(&
h,strat);
1933 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1946 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1950 h.p1 =
p;
h.p2 = strat->
S[
i];
1984 Lp.ecart=0; Lp.length=0;
1989 #ifndef HAVE_RATGRING
1991 #elif defined(HAVE_RATGRING)
2008 if((!((strat->
ecartS[
i]>0)&&(ecart>0)))
2101 for(
j = strat->
Bl;
j>=0;
j--)
2200 Lp.p1 = strat->
S[
i];
2214 Lp.i_r1 = strat->
S_2_R[
i];
2228 && (Lp.p->coef!=
NULL))
2232 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2272 Lp.ecart=0; Lp.length=0;
2279 if((!((strat->
ecartS[
i]>0)&&(ecart>0)))
2375 for(
j = strat->
Bl;
j>=0;
j--)
2431 Lp.p1 = strat->
S[
i];
2438 Lp.i_r1 = strat->
S_2_R[
i];
2452 && (Lp.p->coef!=
NULL))
2456 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2480 unsigned long pSigMultNegSev,sSigMultNegSev;
2484 Lp.ecart=0; Lp.length=0;
2489 #ifndef HAVE_RATGRING
2491 #elif defined(HAVE_RATGRING)
2521 PrintS(
"----------------\n");
2524 PrintS(
"----------------\n");
2530 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2551 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2552 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
2553 || strat->
rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,
i+1)
2630 Lp.sevSig = ~pSigMultNegSev;
2637 Lp.sevSig = ~sSigMultNegSev;
2648 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
2662 Lp.checked = strat->
sl+1;
2669 Lp.prod_crit =
TRUE;
2681 PrintS(
"SIGNATURE OF PAIR: ");
2685 Lp.p1 = strat->
S[
i];
2699 Lp.i_r1 = strat->
S_2_R[
i];
2713 && (Lp.p->coef!=
NULL))
2755 unsigned long pSigMultNegSev,sSigMultNegSev;
2759 Lp.ecart=0; Lp.length=0;
2764 #ifndef HAVE_RATGRING
2766 #elif defined(HAVE_RATGRING)
2802 if(pSigMult !=
NULL)
2805 if(sSigMult !=
NULL)
2809 Print(
"----------------\n");
2812 Print(
"----------------\n");
2816 if(pSigMult !=
NULL && sSigMult !=
NULL)
2825 if(pSigMult ==
NULL)
2827 if(sSigMult ==
NULL)
2837 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2859 int red_result =
redRing(&Lp,strat);
2869 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2871 strat->
enterS(Lp,0,strat,strat->
tl);
2885 Lp.sig =
pCopy(pSigMult);
2914 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2915 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
2997 Lp.sig =
pNeg(Lp.sig);
3008 Lp.sevSig = ~pSigMultNegSev;
3015 Lp.sevSig = ~sSigMultNegSev;
3027 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
3041 Lp.checked = strat->
sl+1;
3048 Lp.prod_crit =
TRUE;
3060 PrintS(
"SIGNATURE OF PAIR: ");
3064 Lp.p1 = strat->
S[
i];
3079 Lp.i_r1 = strat->
S_2_R[
i];
3093 && (Lp.p->coef!=
NULL))
3101 int red_result =
redRing(&Lp,strat);
3111 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
3114 strat->
enterS(Lp,0,strat, strat->
tl+1);
3166 Lp.p1 = strat->
S[
i];
3170 Lp.i_r1 = strat->
S_2_R[
i];
3185 && (Lp.p->coef!=
NULL))
3188 l = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
3199 int j=strat->
Ll+strat->
Bl+1;
3207 for (
i=strat->
Bl;
i>=0;
i--)
3209 j = strat->
posInL(strat->
L,
j,&(strat->
B[
i]),strat);
3220 int j=strat->
Ll+strat->
Bl+1;
3228 for (
i=strat->
Bl;
i>=0;
i--)
3251 #ifdef HAVE_SHIFTBBA
3255 for (
j=0;
j<=strat->
sl;
j++)
3259 for (
i=strat->
Bl;
i>=0;
i--)
3274 for (
j=0;
j<=strat->
sl;
j++)
3278 for (
i=strat->
Bl;
i>=0;
i--)
3301 for (
j=strat->
Ll;
j>=0;
j--)
3307 if (strat->
L[
j].p == strat->
tail)
3353 for (
j=strat->
Ll;
j>=0;
j--)
3373 for(
i=
j-1;
i>=0;
i--)
3392 for (
j=strat->
Ll;
j>=0;
j--)
3423 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3426 if (strat->
L[
j].p2 ==
p)
3432 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3446 strat->
L[
i].p2 = strat->
tail;
3463 else if (strat->
L[
j].p2 == strat->
tail)
3502 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3505 if (strat->
L[
j].p2 ==
p)
3511 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3525 strat->
L[
i].p2 = strat->
tail;
3542 else if (strat->
L[
j].p2 == strat->
tail)
3550 #ifdef HAVE_RATGRING
3563 for (
j=0;
j<=strat->
sl;
j++)
3567 for (
i=strat->
Bl;
i>=0;
i--)
3575 Print(
"chain-crit-part: S[%d]=",
j);
3577 Print(
" divide B[%d].lcm=",
i);
3599 for (
j=strat->
Ll;
j>=0;
j--)
3605 if (strat->
L[
j].p == strat->
tail)
3609 PrintS(
"chain-crit-part: pCompareChainPart p=");
3611 Print(
" delete L[%d]",
j);
3640 Print(
"chain-crit-part: sugar B[%d].lcm=",
j);
3642 Print(
" delete B[%d]",
i);
3653 Print(
"chain-crit-part: sugar B[%d].lcm=",
i);
3655 Print(
" delete B[%d]",
j);
3675 for (
j=strat->
Ll;
j>=0;
j--)
3683 PrintS(
"chain-crit-part: sugar:pCompareChainPart p=");
3685 Print(
" delete L[%d]",
j);
3703 for(
i=
j-1;
i>=0;
i--)
3709 Print(
"chain-crit-part: equal lcm B[%d].lcm=",
j);
3711 Print(
" delete B[%d]\n",
i);
3728 for (
j=strat->
Ll;
j>=0;
j--)
3736 PrintS(
"chain-crit-part: pCompareChainPart p=");
3738 Print(
" delete L[%d]",
j);
3767 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3770 if (strat->
L[
j].p2 ==
p)
3776 if ((strat->
L[
i].p2 ==
p) &&
pLmEqual(strat->
L[
j].lcm,strat->
L[
i].lcm))
3793 strat->
L[
i].p2 = strat->
tail;
3800 PrintS(
"chain-crit-part: divisible_by p=");
3802 Print(
" delete L[%d]",
l);
3813 PrintS(
"chain-crit-part: divisible_by(2) p=");
3815 Print(
" delete L[%d]",
i);
3826 else if (strat->
L[
j].p2 == strat->
tail)
3854 for (
j=0;
j<=
k;
j++)
3867 for (
j=0;
j<=
k;
j++)
3876 for (
j=0;
j<=
k;
j++)
3889 #ifdef HAVE_RATGRING
3919 for (
j=0;
j<=
k;
j++)
3932 for (
j=0;
j<=
k;
j++)
3941 for (
j=0;
j<=
k;
j++)
3955 #ifdef HAVE_RATGRING
4012 #ifdef HAVE_RATGRING
4039 for (
j=0;
j<=strat->
sl;
j++)
4043 for (
i=strat->
Bl;
i>=0;
i--)
4050 PrintS(
"--- chain criterion func chainCritRing type 1\n");
4053 PrintS(
" strat->B[i].lcm:");
4058 wrp(strat->
B[
i].lcm);
4073 for (
j=strat->
Ll;
j>=0;
j--)
4086 PrintS(
"--- chain criterion func chainCritRing type 2\n");
4087 PrintS(
"strat->L[j].p:");
4118 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
4121 if (strat->
L[
j].p2 ==
p)
4136 PrintS(
"--- chain criterion func chainCritRing type 3\n");
4137 PrintS(
"strat->L[j].lcm:");
4138 wrp(strat->
L[
j].lcm);
4139 PrintS(
" strat->L[i].lcm:");
4140 wrp(strat->
L[
i].lcm);
4154 strat->
L[
i].p2 = strat->
tail;
4171 else if (strat->
L[
j].p2 == strat->
tail)
4185 if (arg <= 0)
return 0;
4197 if (arg <= 0)
return 0;
4198 if (arg%2 == 1) { arg--; }
4208 #ifdef HAVE_VANIDEAL
4219 int l,
j,compare,compareCoeff;
4223 Lp.ecart=0; Lp.length=0;
4236 for(
j = strat->
Bl;
j>=0;
j--)
4240 if (compareCoeff == 0 || compare == compareCoeff)
4258 if (compareCoeff == 1)
4265 if (compareCoeff == -1)
4308 tmp_h.SetShortExpVector();
4313 enterT(tmp_h, strat, strat->
tl + 1);
4318 Lp.i_r1 = strat->
tl;
4322 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
4336 if ((*cabsind <
bound) && (*cabsind - step[1] +
add <
bound))
4345 if (
N == 1)
return 0;
4347 while (
exp[
i] == cexp[
i] &&
i <=
N)
i++;
4349 *cabsind -= cind[
i];
4352 *cabsind += cind[
i];
4355 if (
i >
N)
return 0;
4359 for (
int j =
i + 1;
j <=
N;
j++)
4361 if (step[1] > step[
j]) step[1] = step[
j];
4364 if (*cabsind - step[1] +
add >=
bound)
4367 *cabsind -= cind[
i];
4369 *cabsind += cind[
i];
4372 if (
i >
N)
return 0;
4375 }
while (step[1] != -1);
4381 for (
i = 2;
i <=
N;
i++)
4383 if (step[1] > step[
i]) step[1] = step[
i];
4401 poly zeroPoly =
NULL;
4409 for (
int i = 1;
i <= leadRing->N;
i++)
4415 if (cabsind < leadRing->ch)
4417 zeroPoly =
p_ISet(
twoPow(leadRing->ch - cabsind), tailRing);
4421 zeroPoly =
p_ISet(1, tailRing);
4423 for (
int i = 1;
i <= leadRing->N;
i++)
4425 for (
long j = 1;
j <=
exp[
i];
j++)
4443 for (
int i = 1;
i <= leadRing->N;
i++)
4449 zeroPoly =
pNext(zeroPoly);
4475 if (
exp[
i] & 1 != 0)
4490 PrintS(
"-------------\npoly :");
4493 Print(
"cexp : (%d, %d)\n", cexp[1], cexp[2]);
4494 Print(
"cind : (%d, %d)\n", cind[1], cind[2]);
4496 Print(
"cind : %d\n", cabsind);
4513 Print(
"%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4549 PrintS(
"-------------\npoly :");
4552 Print(
"cexp : (%d, %d)\n", cexp[1], cexp[2]);
4553 Print(
"cind : (%d, %d)\n", cind[1], cind[2]);
4555 Print(
"cind : %d\n", cabsind);
4573 Print(
"%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4581 G0->m[
IDELEMS(G0) - 1] = zeroPoly;
4605 for (
j=0;
j<=
k;
j++)
4617 for (
j=0;
j<=
k;
j++)
4625 for (
j=0;
j<=
k;
j++)
4637 #ifdef HAVE_RATGRING
4662 && ((iCompH<=strat->syzComp)||(strat->
syzComp==0)))
4709 PrintS(
"--- create zero spoly: ");
4738 posx = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
4791 PrintS(
"--- create zero spoly: ");
4819 int red_result =
redRing(&Lp,strat);
4829 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
4831 strat->
enterS(Lp,0,strat,strat->
tl);
4879 if ( (!strat->
fromT)
4939 if ( (!strat->
fromT)
4964 if ( (!strat->
fromT)
4989 for (
j=0;
j<=
k;
j++)
4992 if ((iCompH==iCompSj)
5003 for (
j=0;
j<=
k;
j++)
5006 if ((iCompH==iCompSj)
5058 int i,
j,at,ecart, s2r;
5062 int new_suc=strat->
sl+1;
5066 for (;
i<=strat->
sl;
i++)
5071 if (new_suc > at) new_suc = at;
5074 sev = strat->
sevS[
i];
5077 for (
j=
i;
j>=at+1;
j--)
5079 strat->
S[
j] = strat->
S[
j-1];
5085 strat->
ecartS[at] = ecart;
5086 strat->
sevS[at] = sev;
5087 strat->
S_2_R[at] = s2r;
5090 for (
j=
i;
j>=at+1;
j--)
5094 strat->
fromQ[at]=fq;
5098 if (new_suc <= strat->sl) *suc=new_suc;
5161 if (cmp == cmp_int)
return an;
5162 if (cmp == -cmp_int)
return en;
5168 if (cmp == cmp_int) en =
i;
5169 else if (cmp == -cmp_int) an =
i;
5185 if (
pLmCmp(set[an],
p) == cmp_int)
return an;
5186 if (
pLmCmp(set[an],
p) == -cmp_int)
return en;
5188 && ((strat->
ecartS[an])>ecart_p))
5194 else if (
pLmCmp(set[
i],
p) == -cmp_int) an=
i;
5198 &&((strat->
ecartS[
i])<ecart_p))
5226 || ((op == o) && (
pLtCmp(set[mon],
p) == -1)))
5237 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
5244 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
5270 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
5277 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
5289 if(end < 0 || end >=
IDELEMS(F))
5291 if (end<0)
return 0;
5298 for(
i=start;
i<end;
i++)
5312 || ((op == o) && (
pLtCmp(set[an],
p) == -1)))
5319 || ((op == o) && (
pLtCmp(set[
i],
p) == -1)))
5344 if (
length==-1)
return 0;
5386 if (set[an].
length>
p.length)
return an;
5402 if (
length==-1)
return 0;
5404 int o =
p.GetpFDeg();
5405 int op = set[
length].GetpFDeg();
5419 op= set[an].GetpFDeg();
5426 op = set[
i].GetpFDeg();
5438 if (
length==-1)
return 0;
5440 int o =
p.GetpFDeg();
5441 int op = set[
length].GetpFDeg();
5455 op= set[an].GetpFDeg();
5462 op = set[
i].GetpFDeg();
5479 if (
length==-1)
return 0;
5480 int o =
p.GetpFDeg();
5481 int op = set[
length].GetpFDeg();
5493 op = set[an].GetpFDeg();
5494 if (op > o)
return an;
5495 if (op < 0)
return en;
5497 if (cmp == cmp_int)
return an;
5498 if (cmp == -cmp_int)
return en;
5503 op = set[
i].GetpFDeg();
5505 else if (op < o) an =
i;
5509 if (cmp == cmp_int) en =
i;
5510 else if (cmp == -cmp_int) an =
i;
5556 if (
length==-1)
return 0;
5558 int o =
p.GetpFDeg();
5559 int op = set[
length].GetpFDeg();
5563 || (( op == o) && (set[
length].length ==
p.length)
5574 op = set[an].GetpFDeg();
5576 || (( op == o) && (set[an].
length >
p.length))
5577 || (( op == o) && (set[an].length ==
p.length)
5583 op = set[
i].GetpFDeg();
5585 || (( op == o) && (set[
i].
length >
p.length))
5586 || (( op == o) && (set[
i].length ==
p.length)
5598 if (
length==-1)
return 0;
5600 int o =
p.GetpFDeg();
5601 int op = set[
length].GetpFDeg();
5605 || (( op == o) && (set[
length].length ==
p.length)
5616 op = set[an].GetpFDeg();
5618 || (( op == o) && (set[an].
length >
p.length))
5619 || (( op == o) && (set[an].length ==
p.length)
5625 op = set[
i].GetpFDeg();
5627 || (( op == o) && (set[
i].
length >
p.length))
5628 || (( op == o) && (set[
i].length ==
p.length)
5644 if (
length==-1)
return 0;
5646 int o =
p.GetpFDeg();
5648 if (set[
length].GetpFDeg() <= o)
5658 if (set[an].GetpFDeg() > o)
5663 if (set[
i].GetpFDeg() > o)
5673 int ol =
p.GetpLength();
5674 if (
length==-1)
return 0;
5678 int oo=set[
length].ecart;
5679 if ((oo < op) || ((oo==op) && (set[
length].
length <= ol)))
5689 int oo=set[an].ecart;
5691 || ((oo==op) && (set[an].
pLength > ol)))
5696 int oo=set[
i].ecart;
5698 || ((oo == op) && (set[
i].
pLength > ol)))
5730 if (
length==-1)
return 0;
5732 int o =
p.GetpFDeg() +
p.ecart;
5747 op = set[an].GetpFDeg()+set[an].ecart;
5754 op = set[
i].GetpFDeg()+set[
i].ecart;
5766 if (
length==-1)
return 0;
5768 int o =
p.GetpFDeg() +
p.ecart;
5783 op = set[an].GetpFDeg()+set[an].ecart;
5790 op = set[
i].GetpFDeg()+set[
i].ecart;
5827 if (
length==-1)
return 0;
5829 int o =
p.GetpFDeg() +
p.ecart;
5833 || (( op == o) && (set[
length].ecart >
p.ecart))
5834 || (( op == o) && (set[
length].ecart==
p.ecart)
5845 op = set[an].GetpFDeg()+set[an].ecart;
5847 || (( op == o) && (set[an].ecart <
p.ecart))
5848 || (( op == o) && (set[an].ecart==
p.ecart)
5854 op = set[
i].GetpFDeg()+set[
i].ecart;
5856 || (( op == o) && (set[
i].ecart <
p.ecart))
5857 || (( op == o) && (set[
i].ecart ==
p.ecart)
5868 if (
length==-1)
return 0;
5870 int o =
p.GetpFDeg() +
p.ecart;
5874 || (( op == o) && (set[
length].ecart >
p.ecart))
5875 || (( op == o) && (set[
length].ecart==
p.ecart)
5886 op = set[an].GetpFDeg()+set[an].ecart;
5888 || (( op == o) && (set[an].ecart <
p.ecart))
5889 || (( op == o) && (set[an].ecart==
p.ecart)
5895 op = set[
i].GetpFDeg()+set[
i].ecart;
5897 || (( op == o) && (set[
i].ecart <
p.ecart))
5898 || (( op == o) && (set[
i].ecart ==
p.ecart)
5914 if (
length==-1)
return 0;
5918 int o =
p.GetpFDeg() +
p.ecart;
5927 || ((op == o) && (set[
length].ecart >
p.ecart))
5928 || ((op == o) && (set[
length].ecart==
p.ecart)
5944 int op = set[an].GetpFDeg()+set[an].ecart;
5946 || ((op == o) && (set[an].ecart <
p.ecart))
5947 || ((op == o) && (set[an].ecart==
p.ecart)
5958 int op = set[
i].GetpFDeg()+set[
i].ecart;
5960 || ((op == o) && (set[
i].ecart <
p.ecart))
5961 || ((op == o) && (set[
i].ecart ==
p.ecart)
5975 if (
length==-1)
return 0;
5979 int o =
p.GetpFDeg() +
p.ecart;
5988 || ((op == o) && (set[
length].ecart >
p.ecart))
5989 || ((op == o) && (set[
length].ecart==
p.ecart)
6005 int op = set[an].GetpFDeg()+set[an].ecart;
6007 || ((op == o) && (set[an].ecart <
p.ecart))
6008 || ((op == o) && (set[an].ecart==
p.ecart)
6019 int op = set[
i].GetpFDeg()+set[
i].ecart;
6021 || ((op == o) && (set[
i].ecart <
p.ecart))
6022 || ((op == o) && (set[
i].ecart ==
p.ecart)
6042 if (
length==-1)
return 0;
6045 int op=
p.GetpFDeg();
6047 if (set[
length].ecart < o)
6049 if (set[
length].ecart == o)
6051 int oo=set[
length].GetpFDeg();
6052 if ((oo < op) || ((oo==op) && (set[
length].
length <
p.length)))
6063 if (set[an].ecart > o)
6065 if (set[an].ecart == o)
6067 int oo=set[an].GetpFDeg();
6069 || ((oo==op) && (set[an].
length >
p.length)))
6075 if (set[
i].ecart > o)
6077 else if (set[
i].ecart == o)
6079 int oo=set[
i].GetpFDeg();
6081 || ((oo == op) && (set[
i].
length >
p.length)))
6101 int d=
p->GetpFDeg();
6102 int op=set[
length].GetpFDeg();
6116 op=set[an].GetpFDeg();
6118 || ((op == d) && (
p->p1!=
NULL) && (set[an].p1==
NULL))
6124 op=set[
i].GetpFDeg();
6126 || ((op==d) && (
p->p1!=
NULL) && (set[
i].p1==
NULL))
6239 cmp =
pLtCmp(set[an].sig,
p->sig);
6246 if (set[an].FDeg >
p->FDeg)
6248 if (set[an].FDeg < p->FDeg)
6250 if (set[an].FDeg ==
p->FDeg)
6268 if (set[
i].FDeg >
p->FDeg)
6270 if (set[
i].FDeg < p->FDeg)
6272 if (set[
i].FDeg ==
p->FDeg)
6287 if (
length < 0)
return 0;
6288 if (set[
length].FDeg >
p->FDeg)
6290 if (set[
length].FDeg ==
p->FDeg)
6291 if(set[
length].GetpLength() >
p->GetpLength())
6302 if (set[an].FDeg >
p->FDeg)
6304 if(set[an].FDeg ==
p->FDeg)
6306 if(set[an].GetpLength() >
p->GetpLength())
6310 if(set[an].GetpLength() ==
p->GetpLength())
6327 if (set[
i].FDeg >
p->FDeg)
6331 if(set[
i].FDeg ==
p->FDeg)
6333 if(set[
i].GetpLength() >
p->GetpLength())
6337 if(set[
i].GetpLength() ==
p->GetpLength())
6359 if (strat->
syzl==0)
return 0;
6364 int en= strat->
syzl-1;
6402 int o =
p->GetpFDeg();
6403 int op = set[
length].GetpFDeg();
6415 op = set[an].GetpFDeg();
6422 op = set[
i].GetpFDeg();
6444 int o =
p->GetpFDeg();
6445 int op = set[
length].GetpFDeg();
6457 op = set[an].GetpFDeg();
6464 op = set[
i].GetpFDeg();
6478 int o =
p->GetpFDeg();
6479 int op = set[
length].GetpFDeg();
6491 op = set[an].GetpFDeg();
6498 op = set[
i].GetpFDeg();
6512 if (
length < 0)
return 0;
6522 if (set[an].FDeg >
p->FDeg)
6524 if (set[an].FDeg < p->FDeg)
6526 if (set[an].FDeg ==
p->FDeg)
6534 if (set[an].t_p!=
NULL)
6556 if (set[
i].FDeg >
p->FDeg)
6558 if (set[
i].FDeg < p->FDeg)
6560 if (set[
i].FDeg ==
p->FDeg)
6568 if (set[
i].t_p!=
NULL)
6600 if (coeff == 0)
return -1;
6603 while (tmp % 2 == 0)
6622 if (
length < 0)
return 0;
6624 int o =
p->GetpFDeg();
6625 int op = set[
length].GetpFDeg();
6636 op = set[an].GetpFDeg();
6637 if ((op > o) || ((op == o) && (
pLmCmp(set[an].
p,
p->p) != -
currRing->OrdSgn)))
6642 op = set[
i].GetpFDeg();
6700 int o =
p->GetpFDeg();
6701 int op = set[
length].GetpFDeg();
6705 || ((op == o) && (set[
length].length <=
p->length)
6715 op = set[an].GetpFDeg();
6717 || ((op == o) && (set[an].
length >
p->length))
6718 || ((op == o) && (set[an].length <=
p->length)
6724 op = set[
i].GetpFDeg();
6726 || ((op == o) && (set[
i].
length >
p->length))
6727 || ((op == o) && (set[
i].length <=
p->length)
6741 int o =
p->GetpFDeg();
6742 int op = set[
length].GetpFDeg();
6746 || ((op == o) && (set[
length].length <=
p->length)
6756 op = set[an].GetpFDeg();
6758 || ((op == o) && (set[an].
length >
p->length))
6759 || ((op == o) && (set[an].length <=
p->length)
6765 op = set[
i].GetpFDeg();
6767 || ((op == o) && (set[
i].
length >
p->length))
6768 || ((op == o) && (set[
i].length <=
p->length)
6788 int o =
p->GetpFDeg();
6790 if (set[
length].GetpFDeg() > o)
6800 if (set[an].GetpFDeg() >= o)
6805 if (set[
i].GetpFDeg() >= o)
6823 int o =
p->GetpFDeg() +
p->ecart;
6836 op = set[an].GetpFDeg() + set[an].ecart;
6843 op = set[
i].GetpFDeg() + set[
i].ecart;
6858 int o =
p->GetpFDeg() +
p->ecart;
6871 op = set[an].GetpFDeg() + set[an].ecart;
6878 op = set[
i].GetpFDeg() + set[
i].ecart;
6899 int o =
p->GetpFDeg() +
p->ecart;
6903 && (set[
length].ecart >
p->ecart))
6905 && (set[
length].ecart ==
p->ecart)
6915 if ((set[an].GetpFDeg() + set[an].ecart > o)
6916 || ((set[an].GetpFDeg() + set[an].ecart == o)
6917 && (set[an].ecart >
p->ecart))
6918 || ((set[an].GetpFDeg() + set[an].ecart == o)
6919 && (set[an].ecart ==
p->ecart)
6925 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6926 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6927 && (set[
i].ecart >
p->ecart))
6928 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6929 && (set[
i].ecart ==
p->ecart)
6943 int o =
p->GetpFDeg() +
p->ecart;
6947 && (set[
length].ecart >
p->ecart))
6949 && (set[
length].ecart ==
p->ecart)
6959 if ((set[an].GetpFDeg() + set[an].ecart > o)
6960 || ((set[an].GetpFDeg() + set[an].ecart == o)
6961 && (set[an].ecart >
p->ecart))
6962 || ((set[an].GetpFDeg() + set[an].ecart == o)
6963 && (set[an].ecart ==
p->ecart)
6969 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
6970 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
6971 && (set[
i].ecart >
p->ecart))
6972 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
6973 && (set[
i].ecart ==
p->ecart)
6996 int o =
p->GetpFDeg() +
p->ecart;
7004 && (set[
length].ecart >
p->ecart))
7006 && (set[
length].ecart ==
p->ecart)
7021 if ((set[an].GetpFDeg() + set[an].ecart > o)
7022 || ((set[an].GetpFDeg() + set[an].ecart == o)
7023 && (set[an].ecart >
p->ecart))
7024 || ((set[an].GetpFDeg() + set[an].ecart == o)
7025 && (set[an].ecart ==
p->ecart)
7036 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
7037 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
7038 && (set[
i].ecart >
p->ecart))
7039 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
7040 && (set[
i].ecart ==
p->ecart)
7060 int o =
p->GetpFDeg() +
p->ecart;
7068 && (set[
length].ecart >
p->ecart))
7070 && (set[
length].ecart ==
p->ecart)
7085 if ((set[an].GetpFDeg() + set[an].ecart > o)
7086 || ((set[an].GetpFDeg() + set[an].ecart == o)
7087 && (set[an].ecart >
p->ecart))
7088 || ((set[an].GetpFDeg() + set[an].ecart == o)
7089 && (set[an].ecart ==
p->ecart)
7100 if ((set[
i].GetpFDeg() + set[
i].ecart > o)
7101 || ((set[
i].GetpFDeg() + set[
i].ecart == o)
7102 && (set[
i].ecart >
p->ecart))
7103 || ((set[
i].GetpFDeg() +set[
i].ecart == o)
7104 && (set[
i].ecart ==
p->ecart)
7123 PrintS(
"syzygy criterion checks: ");
7126 for (
int k=0;
k<strat->
syzl;
k++)
7131 Print(
"checking with: %d / %d -- \n",
k,strat->
syzl);
7160 PrintS(
"--- syzygy criterion checks: ");
7185 Print(
"checking with: %d -- ",
k);
7210 PrintS(
"rewritten criterion checks: ");
7213 for(
int k = strat->
sl;
k>=start;
k--)
7217 PrintS(
"checking with: ");
7233 PrintS(
"ALL ELEMENTS OF S\n----------------------------------------\n");
7234 for(
int kk = 0; kk<strat->
sl+1; kk++)
7238 PrintS(
"------------------------------\n");
7268 for (
int ii=strat->
sl; ii>start; ii--)
7274 if (!(
pLmCmp(p1,p2) == 1))
7293 for (
int i=strat->
Bl;
i>-1;
i--)
7314 for (
int ii=strat->
sl; ii>-1; ii--)
7320 if (!(
pLmCmp(p1,p2) == 1))
7341 const unsigned long not_sev = ~L->sev;
7342 const unsigned long* sev = strat->
sevS;
7355 if (
j > end_pos)
return NULL;
7356 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7358 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7363 if (!(sev[
j] & not_sev) &&
7364 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]) &&
7378 if (
j > end_pos)
return NULL;
7379 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7386 if (!(sev[
j] & not_sev) &&
7387 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]) &&
7398 if (strat->
tl < 0 || strat->
S_2_R[
j] == -1)
7419 if (
j > end_pos)
return NULL;
7421 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7425 (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7431 if (! (sev[
j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7434 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[
j]);
7450 if (
j > end_pos)
return NULL;
7452 #if defined(PDEBUG) || defined(PDIV_DEBUG)
7462 if (! (sev[
j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[
j]))
7465 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[
j]);
7516 if (With ==
NULL)
break;
7526 return redtail(L, end_pos, strat);
7532 if (hn ==
NULL)
goto all_done;
7553 return redtail(&L, end_pos, strat);
7558 #define REDTAIL_CANONICALIZE 100
7562 p =
h = L->GetLmTailRing();
7564 return L->GetLmCurrRing();
7599 Ln.SetShortExpVector();
7605 With = &(strat->
T[
j]);
7606 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7611 if (With ==
NULL)
break;
7612 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7639 pNext(
h) = Ln.LmExtractAndIter();
7642 }
while (!Ln.IsNull());
7645 if (Ln.IsNull())
goto all_done;
7646 if (! withT) With_s.Init(
currRing);
7648 pNext(
h) = Ln.LmExtractAndIter();
7667 return L->GetLmCurrRing();
7675 p =
h = L->GetLmTailRing();
7677 return L->GetLmCurrRing();
7684 Ln.pLength = L->GetpLength() - 1;
7708 Ln.SetShortExpVector();
7714 With = &(strat->
T[
j]);
7719 if (With ==
NULL)
break;
7746 pNext(
h) = Ln.LmExtractAndIter();
7749 }
while (!Ln.IsNull());
7761 if (! withT) With_s.Init(
currRing);
7763 pNext(
h) = Ln.LmExtractAndIter();
7782 return L->GetLmCurrRing();
7792 p =
h = L->GetLmTailRing();
7827 Ln.SetShortExpVector();
7840 With = &(strat->
T[
j]);
7841 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7858 pNext(
h) = Ln.LmExtractAndIter();
7861 }
while (!Ln.IsNull());
7869 With = &(strat->
T[
j]);
7870 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7887 pNext(
h) = Ln.LmExtractAndIter();
7890 }
while (!Ln.IsNull());
7894 if (Ln.IsNull())
goto all_done;
7896 pNext(
h) = Ln.LmExtractAndIter();
7921 p =
h = L->GetLmTailRing();
7923 return L->GetLmCurrRing();
7930 Ln.pLength = L->GetpLength() - 1;
7943 Ln.SetShortExpVector();
7945 if (With ==
NULL)
break;
7955 poly p_Ln=Ln.GetLmCurrRing();
7956 poly p_With=With->GetLmCurrRing();
7968 if (Ln.bucket!=
NULL)
7999 pNext(
h) = Ln.LmExtractAndIter();
8002 }
while (!Ln.IsNull());
8005 if (Ln.IsNull())
goto all_done;
8008 pNext(
h) = Ln.LmExtractAndIter();
8026 return L->GetLmCurrRing();
8042 if (strat->
Ll != *reduc)
8044 if (strat->
Ll != *reduc-1)
8056 if (red_result == 0)
8058 else if (red_result < 0)
8060 if ((red_result > 0) || ((strat->
Ll % 100)==99))
8062 if (strat->
Ll != *reduc && strat->
Ll > 0)
8079 Print(
"product criterion:%d chain criterion:%d\n",strat->
cp,strat->
c3);
8080 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
8081 #ifdef HAVE_SHIFTBBA
8083 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
8094 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
8095 #ifdef HAVE_SHIFTBBA
8097 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
8112 for (
i=0;
i<=strat->
sl;
i++)
8124 for (
i=0;
i<=strat->
tl;
i++)
8128 if (strat->
T[
i].length==0) strat->
T[
i].length=
pLength(strat->
T[
i].p);
8129 Print(
" o:%ld e:%d l:%d",
8130 strat->
T[
i].pFDeg(),strat->
T[
i].ecart,strat->
T[
i].length);
8135 for (
i=strat->
Ll;
i>=0;
i--)
8144 Print(
" o:%ld e:%d l:%d",
8145 strat->
L[
i].pFDeg(),strat->
L[
i].ecart,strat->
L[
i].length);
8167 strat->
S=strat->
Shdl->m;
8172 memset(strat->
fromQ,0,
i*
sizeof(
int));
8201 strat->
enterS(
h,pos,strat,-1);
8202 strat->
fromQ[pos]=1;
8235 strat->
enterS(
h,pos,strat,-1);
8261 strat->
S=strat->
Shdl->m;
8266 memset(strat->
fromQ,0,
i*
sizeof(
int));
8295 strat->
enterS(
h,pos,strat,-1);
8296 strat->
fromQ[pos]=1;
8328 pos = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
8358 strat->
S = strat->
Shdl->m;
8371 memset(strat->
fromQ,0,
i*
sizeof(
int));
8400 strat->
enterS(
h,pos,strat,-1);
8401 strat->
fromQ[pos]=1;
8511 for(
i=1;
i<=strat->
sl;
i++)
8523 strat->
syz = (poly *)
omAlloc(ps*
sizeof(poly));
8527 #if defined(DEBUGF5) || defined(DEBUGF51)
8528 PrintS(
"------------- GENERATING SYZ RULES NEW ---------------\n");
8535 while (i <= strat->sl)
8565 for (
k = 0;
k<
i;
k++)
8609 for (
k = 0;
k<strat->
sl+1;
k++)
8630 PrintS(
"Principal syzygies:\n");
8633 Print(
"ps %d\n",ps);
8634 PrintS(
"--------------------------------\n");
8644 PrintS(
"--------------------------------\n");
8664 strat->
S=strat->
Shdl->m;
8670 memset(strat->
fromQ,0,
i*
sizeof(
int));
8699 strat->
enterS(
h,pos,strat, strat->
tl+1);
8701 strat->
fromQ[pos]=1;
8729 strat->
enterS(
h,pos,strat, strat->
tl+1);
8771 h.is_normalized = 0;
8778 strat->
enterS(
h,pos,strat, strat->
tl+1);
8808 strat->
S=strat->
Shdl->m;
8814 memset(strat->
fromQ,0,
i*
sizeof(
int));
8843 strat->
enterS(
h,pos,strat, strat->
tl+1);
8845 strat->
fromQ[pos]=1;
8873 strat->
enterS(
h,pos,strat, strat->
tl+1);
8915 h.is_normalized = 0;
8922 strat->
enterS(
h,pos,strat, strat->
tl+1);
8946 while (
j <= maxIndex)
8963 if (!
pIsVector((*p).p) && ((*p).ecart != 0))
8972 h1 = r =
pCopy((*p).p);
9025 while ((j <= strat->sl) && (
pGetComp(strat->
S[
j])!=0))
j++;
9027 while (j<=strat->sl)
9051 while (
j <= maxIndex)
9105 while (
j <= maxIndex);
9135 while (i<=strat->sl)
9146 if (
pCmp(redSi,strat->
S[
i])!=0)
9203 if (any_change)
reorderS(&suc,strat);
9208 for (
i=0;
i<=strat->
sl;
i++)
9234 #ifdef HAVE_SHIFTBBA
9246 while (i<=strat->sl)
9258 else if (
pCmp((strat->
S)[
i],redSi)!=0)
9299 if (any_change)
reorderS(&suc,strat);
9300 else { suc=-1;
break; }
9311 for (
i=0;
i<=strat->
sl;
i++)
9334 #ifdef HAVE_SHIFTBBA
9339 if (suc!= -1)
updateS(toT,strat);
9359 *
sizeof(
unsigned long));
9386 strat->
Shdl->m=strat->
S;
9388 if (atS <= strat->sl)
9390 #ifdef ENTER_USE_MEMMOVE
9391 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9392 (strat->
sl - atS + 1)*
sizeof(poly));
9393 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9394 (strat->
sl - atS + 1)*
sizeof(
int));
9395 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9396 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9397 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9398 (strat->
sl - atS + 1)*
sizeof(
int));
9400 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9401 (strat->
sl - atS + 1)*
sizeof(
int));
9403 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9406 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9408 strat->
S[
i] = strat->
S[
i-1];
9414 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9417 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9423 #ifdef ENTER_USE_MEMMOVE
9424 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9425 (strat->
sl - atS + 1)*
sizeof(
int));
9427 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9432 strat->
fromQ[atS]=0;
9443 strat->
sevS[atS] =
p.sev;
9445 strat->
S_2_R[atS] = atR;
9449 #ifdef HAVE_SHIFTBBA
9455 for (
int i = maxPossibleShift;
i > 0;
i--)
9463 int atS =
posInS(strat, strat->
sl, qq.p, qq.ecart);
9482 *
sizeof(
unsigned long));
9486 *
sizeof(
unsigned long));
9514 strat->
Shdl->m=strat->
S;
9521 if (atS <= strat->sl)
9523 #ifdef ENTER_USE_MEMMOVE
9524 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9525 (strat->
sl - atS + 1)*
sizeof(poly));
9526 memmove(&(strat->
sig[atS+1]), &(strat->
sig[atS]),
9527 (strat->
sl - atS + 1)*
sizeof(poly));
9528 memmove(&(strat->
sevSig[atS+1]), &(strat->
sevSig[atS]),
9529 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9530 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9531 (strat->
sl - atS + 1)*
sizeof(
int));
9532 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9533 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9534 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9535 (strat->
sl - atS + 1)*
sizeof(
int));
9537 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9538 (strat->
sl - atS + 1)*
sizeof(
int));
9540 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9543 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9545 strat->
S[
i] = strat->
S[
i-1];
9553 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9556 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9562 #ifdef ENTER_USE_MEMMOVE
9563 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9564 (strat->
sl - atS + 1)*
sizeof(
int));
9566 for (
i=strat->
sl+1;
i>=atS+1;
i--)
9571 strat->
fromQ[atS]=0;
9575 strat->
S[atS] =
p.p;
9576 strat->
sig[atS] =
p.sig;
9582 strat->
sevS[atS] =
p.sev;
9592 strat->
sevSig[atS] =
p.sevSig;
9595 strat->
S_2_R[atS] = atR;
9599 Print(
"--- LIST S: %d ---\n",strat->
sl);
9600 for(
k=0;
k<=strat->
sl;
k++)
9604 PrintS(
"--- LIST S END ---\n");
9618 #ifdef HAVE_SHIFTBBA
9630 else strat->
P.sev=0;
9638 poly tp = strat->
T[tj].p;
9643 for (
j = 0;
j <= strat->
sl; ++
j)
9657 pos =
posInS(strat, strat->
sl,
p.p,
p.ecart);
9663 for (
i = 0;
i <= strat->
Ll; ++
i)
9677 #ifdef HAVE_SHIFTBBA
9687 strat->
enterS(
p, pos, strat, strat->
tl);
9689 #ifdef HAVE_SHIFTBBA
9704 #ifdef HAVE_SHIFTBBA
9726 for(
i=strat->
tl;
i>=0;
i--)
9728 if (
p.p==strat->
T[
i].p)
9730 printf(
"already in T at pos %d of %d, atT=%d\n",
i,strat->
tl,atT);
9736 #ifdef HAVE_TAIL_RING
9739 p.t_p=
p.GetLmTailRing();
9745 if (strat->
tl == strat->
tmax-1)
9747 if (atT <= strat->tl)
9749 #ifdef ENTER_USE_MEMMOVE
9750 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9752 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9753 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9755 for (
i=strat->
tl+1;
i>=atT+1;
i--)
9757 #ifndef ENTER_USE_MEMMOVE
9758 strat->
T[
i] = strat->
T[
i-1];
9761 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9767 #ifdef HAVE_SHIFTBBA
9769 if (!(
currRing->isLPring &&
p.shift > 0))
9785 strat->
T[atT].max_exp =
NULL;
9788 strat->
R[strat->
tl] = &(strat->
T[atT]);
9789 strat->
T[atT].i_r = strat->
tl;
9814 for(
i=strat->
tl;
i>=0;
i--)
9816 if (
p.p==strat->
T[
i].p)
9818 printf(
"already in T at pos %d of %d, atT=%d\n",
i,strat->
tl,atT);
9824 #ifdef HAVE_TAIL_RING
9827 p.t_p=
p.GetLmTailRing();
9833 if (strat->
tl == strat->
tmax-1)
9835 if (atT <= strat->tl)
9837 #ifdef ENTER_USE_MEMMOVE
9838 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9840 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9841 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9843 for (
i=strat->
tl+1;
i>=atT+1;
i--)
9845 #ifndef ENTER_USE_MEMMOVE
9846 strat->
T[
i] = strat->
T[
i-1];
9849 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9867 strat->
T[atT].max_exp =
NULL;
9870 strat->
R[strat->
tl] = &(strat->
T[atT]);
9871 strat->
T[atT].i_r = strat->
tl;
9878 for(
i=strat->
tl;
i>=0;
i--)
9909 (strat->
syzmax)*
sizeof(
unsigned long),
9911 *
sizeof(
unsigned long));
9914 if (atT < strat->syzl)
9916 #ifdef ENTER_USE_MEMMOVE
9917 memmove(&(strat->
syz[atT+1]), &(strat->
syz[atT]),
9918 (strat->
syzl-atT+1)*
sizeof(poly));
9919 memmove(&(strat->
sevSyz[atT+1]), &(strat->
sevSyz[atT]),
9920 (strat->
syzl-atT+1)*
sizeof(
unsigned long));
9922 for (
i=strat->
syzl;
i>=atT+1;
i--)
9924 #ifndef ENTER_USE_MEMMOVE
9937 strat->
syz[atT] =
p.sig;
9938 strat->
sevSyz[atT] =
p.sevSig;
9941 Print(
"element in strat->syz: %d--%d ",atT+1,strat->
syzmax);
9951 strat->
L[cc].sig, ~strat->
L[cc].sevSig,
currRing)
9965 PrintS(
"--- Syzygies ---\n");
9968 PrintS(
"--------------------------------\n");
9974 PrintS(
"--------------------------------\n");
10010 #ifdef HAVE_RATGRING
10056 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
10057 else PrintS(
"ideal/module is not homogeneous\n");
10088 #ifdef HAVE_RATGRING
10127 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
10128 else PrintS(
"ideal/module is not homogeneous\n");
10330 #ifdef HAVE_SHIFTBBA
10353 strat->
P.pLength=0;
10396 #ifdef HAVE_SHIFTBBA
10423 #ifdef HAVE_SHIFTBBA
10665 if ((r->m[
l]!=
NULL)
10672 if ((
Q->m[q]!=
NULL)
10696 if ((r->m[
l]!=
NULL)
10703 if ((
Q->m[q]!=
NULL)
10747 reduction_found=
TRUE;
10778 reduction_found=
TRUE;
10792 if ( reduction_found)
10882 for (
i=strat->
sl;
i>=low;
i--)
10884 int end_pos=strat->
sl;
10886 if (strat->
ak==0) end_pos=
i-1;
10888 if ((T_j !=
NULL)&&(T_j->p==strat->
S[
i]))
10906 Print(
"to (tailR) S[%d]:",
i);
10918 T_j->max_exp =
NULL;
10921 T_j->pCleardenom();
10961 Print(
"to (-tailR) S[%d]:",
i);
11009 if (j < strat->
HCord)
11050 assume(L->i_r1 >= -1 && L->i_r1 <= strat->
tl);
11051 assume(L->i_r2 >= -1 && L->i_r2 <= strat->
tl);
11056 if ((L->i_r1 == -1) || (L->i_r2 == -1) )
11061 if ((L->i_r1>=0)&&(strat->
R[L->i_r1]!=
NULL)) p1_max = (strat->
R[L->i_r1])->max_exp;
11063 if ((L->i_r2>=0)&&(strat->
R[L->i_r2]!=
NULL)) p2_max = (strat->
R[L->i_r2])->max_exp;
11089 poly p1_max = (strat->
R[atR])->max_exp;
11090 poly p2_max = (strat->
R[strat->
S_2_R[atS]])->max_exp;
11111 ideal F =
idCopy(Forig);
11115 ideal monred =
idInit(1,1);
11122 if((posconst != -1) && (!
nIsZero(F->m[posconst]->coef)))
11132 for(
int i=0;
i<idelemQ;
i++)
11140 if((posconst != -1) && (!
nIsZero(monred->m[posconst]->coef)))
11142 pmon =
pCopy(monred->m[posconst]);
11157 II->m[
j++] =
prMapR(F->m[
i], nMap, origR, QQ_ring);
11159 II->m[
j++] =
prMapR(
Q->m[
i], nMap, origR, QQ_ring);
11166 if(II->m[
i] !=
NULL)
11167 II->m[
i+1] = II->m[
i];
11170 poly integer =
NULL;
11178 integer =
pHead(syz->m[
i]);
11185 pmon =
prMapR(integer, nMap2, QQ_ring, origR);
11199 poly mindegmon =
NULL;
11204 if(mindegmon ==
NULL)
11205 mindegmon =
pCopy(one->m[
i]);
11208 if(
p_Deg(one->m[
i], QQ_ring) <
p_Deg(mindegmon, QQ_ring))
11209 mindegmon =
pCopy(one->m[
i]);
11213 if(mindegmon !=
NULL)
11216 if(II->m[
i] !=
NULL)
11217 II->m[
i+1] = II->m[
i];
11218 II->m[0] =
pCopy(mindegmon);
11247 pmon =
prMapR(mindegmon, nMap2, QQ_ring, origR);
11278 poly pH =
h->GetP();
11282 for(
int i = 0;
i<=strat->
sl;
i++)
11292 #ifdef HAVE_SHIFTBBA
11317 #ifdef HAVE_SHIFTBBA
11345 h->SetLmCurrRing();
11346 if((deleted)&&(
h->p!=
NULL))
11354 poly hSig =
h->sig;
11355 poly pH =
h->GetP();
11359 for(
int i = 0;
i<=strat->
sl;
i++)
11370 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
11397 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
11428 h->SetLmCurrRing();
11538 if (expbound == 0) expbound = strat->
tailRing->bitmask << 1;
11555 new_tailRing->pFDeg =
currRing->pFDeg;
11556 new_tailRing->pLDeg =
currRing->pLDeg;
11560 Print(
"[%lu:%d", (
unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11569 for (
i=0;
i<=strat->
tl;
i++)
11571 strat->
T[
i].ShallowCopyDelete(new_tailRing, new_tailBin,
11572 p_shallow_copy_delete);
11574 for (
i=0;
i<=strat->
Ll;
i++)
11578 strat->
L[
i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11580 if ((strat->
P.t_p !=
NULL) ||
11582 strat->
P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11584 if ((L !=
NULL) && (L->tailRing != new_tailRing))
11587 L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11593 L->tailRing = new_tailRing;
11596 L->max_exp = t_l->max_exp;
11600 if ((
T !=
NULL) && (
T->tailRing != new_tailRing &&
T->i_r < 0))
11601 T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11608 strat->
tailBin = new_tailBin;
11634 unsigned long l = 0;
11640 for (
i=0;
i<= strat->
Ll;
i++)
11644 for (
i=0;
i<=strat->
tl;
i++)
11672 res->block0 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11673 res->block1 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11674 int **wvhdl = (
int **)
omAlloc0((n+1)*
sizeof(
int*));
11675 res->wvhdl = wvhdl;
11676 for (
int i=1;
i<n;
i++)
11678 res->order[
i] = r->order[
i-1];
11679 res->block0[
i] = r->block0[
i-1];
11680 res->block1[
i] = r->block1[
i-1];
11681 res->wvhdl[
i] = r->wvhdl[
i-1];
11700 #ifndef SING_NDEBUG
11701 WarnS(
"error in nc_rComplete");
11720 res->block0 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11721 res->block1 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11722 int **wvhdl = (
int **)
omAlloc0((n+2)*
sizeof(
int*));
11723 res->wvhdl = wvhdl;
11724 for (
int i=2;
i<n+2;
i++)
11726 res->order[
i] = r->order[
i-2];
11727 res->block0[
i] = r->block0[
i-2];
11728 res->block1[
i] = r->block1[
i-2];
11729 res->wvhdl[
i] = r->wvhdl[
i-2];
11734 res->block0[0] = 1;
11736 for (
int i=0;
i<
res->N; ++
i)
11737 res->wvhdl[0][
i] = 1;
11756 #ifndef SING_NDEBUG
11757 WarnS(
"error in nc_rComplete");
11894 #ifdef HAVE_TAIL_BIN
11921 Timings
for the different possibilities of posInT:
11922 T15 EDL DL EL L 1-2-3
11923 Gonnet 43.26 42.30 38.34 41.98 38.40 100.04
11924 Hairer_2_1 1.11 1.15 1.04 1.22 1.08 4.7
11925 Twomat3 1.62 1.69 1.70 1.65 1.54 11.32
11926 ahml 4.48 4.03 4.03 4.38 4.96 26.50
11927 c7 15.02 13.98 15.16 13.24 17.31 47.89
11928 c8 505.09 407.46 852.76 413.21 499.19 n/a
11929 f855 12.65 9.27 14.97 8.78 14.23 33.12
11930 gametwo6 11.47 11.35 14.57 11.20 12.02 35.07
11931 gerhard_3 2.73 2.83 2.93 2.64 3.12 6.24
11932 ilias13 22.89 22.46 24.62 20.60 23.34 53.86
11933 noon8 40.68 37.02 37.99 36.82 35.59 877.16
11934 rcyclic_19 48.22 42.29 43.99 45.35 51.51 204.29
11935 rkat9 82.37 79.46 77.20 77.63 82.54 267.92
11936 schwarz_11 16.46 16.81 16.76 16.81 16.72 35.56
11937 test016 16.39 14.17 14.40 13.50 14.26 34.07
11938 test017 34.70 36.01 33.16 35.48 32.75 71.45
11939 test042 10.76 10.99 10.27 11.57 10.45 23.04
11940 test058 6.78 6.75 6.51 6.95 6.22 9.47
11941 test066 10.71 10.94 10.76 10.61 10.56 19.06
11942 test073 10.75 11.11 10.17 10.79 8.63 58.10
11943 test086 12.23 11.81 12.88 12.24 13.37 66.68
11944 test103 5.05 4.80 5.47 4.64 4.89 11.90
11945 test154 12.96 11.64 13.51 12.46 14.61 36.35
11946 test162 65.27 64.01 67.35 59.79 67.54 196.46
11947 test164 7.50 6.50 7.68 6.70 7.96 17.13
11948 virasoro 3.39 3.50 3.35 3.47 3.70 7.66
11958 if (
length==-1)
return 0;
11961 int op=
p.GetpFDeg();
11962 int ol =
p.GetpLength();
11964 if (set[
length].ecart < o)
11966 if (set[
length].ecart == o)
11968 int oo=set[
length].GetpFDeg();
11969 if ((oo < op) || ((oo==op) && (set[
length].
length < ol)))
11980 if (set[an].ecart > o)
11982 if (set[an].ecart == o)
11984 int oo=set[an].GetpFDeg();
11986 || ((oo==op) && (set[an].
pLength > ol)))
11992 if (set[
i].ecart > o)
11994 else if (set[
i].ecart == o)
11996 int oo=set[
i].GetpFDeg();
11998 || ((oo == op) && (set[
i].
pLength > ol)))
12012 if (
length==-1)
return 0;
12014 int op=
p.GetpFDeg();
12015 int ol =
p.GetpLength();
12017 int oo=set[
length].GetpFDeg();
12018 if ((oo < op) || ((oo==op) && (set[
length].
length < ol)))
12028 int oo=set[an].GetpFDeg();
12030 || ((oo==op) && (set[an].
pLength > ol)))
12035 int oo=set[
i].GetpFDeg();
12037 || ((oo == op) && (set[
i].
pLength > ol)))
12048 int ol =
p.GetpLength();
12062 if (set[an].
pLength>ol)
return an;
12089 else Print(
"%p\n",(
void*)strat->
red);
12108 #ifdef HAVE_MORE_POS_IN_T
12146 PrintS(
"initEcartPair: ");
12150 Print(
"homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
12152 Print(
"honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
12158 Print(
"posInLDependsOnLength=%d\n",
12190 PrintS(
"currRing->pFDeg: ");
12205 PrintS(
"ecartWeights: ");
12212 #ifndef SING_NDEBUG
12217 #ifdef HAVE_SHIFTBBA
12231 #ifdef HAVE_SHIFTBBA
12248 #ifdef HAVE_SHIFTBBA
12343 #ifdef HAVE_SHIFTBBA
12348 assume(ifromS <= strat->sl);
12447 PrintS(
"\n--- create strong gcd poly: ");
12450 Print(
"\n q (strat->S[%d]): ", ifromS);
12456 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);
12479 h.i_r1 = -1;
h.i_r2 = -1;
12486 if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
12499 posx = strat->
posInL(strat->
L,strat->
Ll,&
h,strat);
12513 #ifdef HAVE_SHIFTBBA
12540 int j,compare,compareCoeff;
12544 h.ecart=0;
h.length=0;
12576 for(
j = strat->
Bl;
j>=0;
j--)
12585 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12600 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12613 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qisFromQ==0))
12717 h.i_r1 = -1;
h.i_r2 = -1;
12726 if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
12741 posx = strat->
posInL(strat->
B,strat->
Bl,&
h,strat);
12756 #ifdef HAVE_SHIFTBBA
12765 #ifdef HAVE_SHIFTBBA
12770 assume(q_inS < 0 || strat->S[q_inS] == q);
12780 if (strat->
fromQ !=
NULL && q_inS >= 0)
12781 q_isFromQ = strat->
fromQ[q_inS];
12783 void (*enterPair)(poly, poly, int, int,
kStrategy, int, int, int, int, int);
12792 int neededShift = p_lastVblock - ((
pGetComp(
p) > 0 ||
pGetComp(q) > 0) ? 0 : 1);
12793 int maxPossibleShift =
degbound - q_lastVblock;
12794 int maxShift =
si_min(neededShift, maxPossibleShift);
12795 int firstShift = (q ==
p ? 1 : 0);
12796 for (
int j = firstShift;
j <= maxShift;
j++)
12799 enterPair(qq,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ,
j, q_inS);
12806 for (
int j = p_lastVblock;
j <= maxPossibleShift;
j++)
12812 enterPair(qq,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, p_lastVblock, q_inS);
12821 #ifdef HAVE_SHIFTBBA
12826 assume(p_inS < 0 || strat->S[p_inS] ==
p);
12835 if (strat->
fromQ !=
NULL && p_inS >= 0)
12836 p_isFromQ = strat->
fromQ[p_inS];
12841 assume(q_shift <= p_lastVblock);
12848 enterOnePairShift(q,
p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, q_shift, -1);
12861 #ifdef HAVE_SHIFTBBA
12864 #ifdef CRITERION_DEBUG
12869 poly lmq =
pHead(q);
12890 int qfromQ = qisFromQ;
12899 Lp.ecart=0; Lp.length=0;
12909 #ifdef CRITERION_DEBUG
12917 if((!((ecartq>0)&&(ecart>0)))
12936 #ifdef CRITERION_DEBUG
12942 Lp.ecart =
si_max(ecart,ecartq);
12943 if (strat->
fromT && (ecartq>ecart))
12946 #ifdef CRITERION_DEBUG
12968 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12971 #ifdef CRITERION_DEBUG
12974 Print(
"--- chain crit using B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
12985 #ifdef CRITERION_DEBUG
12988 Print(
"--- chain crit using pair to remove B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
13021 #ifdef CRITERION_DEBUG
13026 if (strat->
fromT && (ecartq>ecart))
13029 #ifdef CRITERION_DEBUG
13041 for(
j = strat->
Bl;
j>=0;
j--)
13047 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
13050 #ifdef CRITERION_DEBUG
13053 Print(
"--- chain crit using B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
13063 #ifdef CRITERION_DEBUG
13066 Print(
"--- chain crit using pair to remove B[%d].lcm=%s\n",
j,
pString(strat->
B[
j].lcm));
13083 #ifdef CRITERION_DEBUG
13088 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (qfromQ!=0))
13091 #ifdef CRITERION_DEBUG
13151 #ifdef CRITERION_DEBUG
13167 if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
13184 && (Lp.p->coef!=
NULL))
13188 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
13190 #ifdef CRITERION_DEBUG
13202 #ifdef HAVE_SHIFTBBA
13208 if (h_lastVblock == 0)
return;
13219 int maxShift =
degbound - h_lastVblock;
13228 for (
i=0;
i<=maxShift;
i++)
13231 for (
j=0;
j<=
k;
j++)
13236 poly
s = strat->
S[
j];
13245 for (
j=0;
j<=
k;
j++)
13247 poly
s = strat->
S[
j];
13262 else if ((isFromQ)&&(strat->
fromQ!=
NULL))
13265 for (
j=0;
j<=
k;
j++)
13270 poly
s = strat->
S[
j];
13277 for (
i=1;
i<=maxShift;
i++)
13280 for (
j=0;
j<=
k;
j++)
13284 poly
s = strat->
S[
j];
13286 if (
i < s_lastVblock || (
pGetComp(
s) > 0 &&
i == s_lastVblock))
13310 for (
j=0;
j<=
k;
j++)
13312 poly
s = strat->
S[
j];
13316 for (
i=1;
i<=maxShift;
i++)
13319 for (
j=0;
j<=
k;
j++)
13321 poly
s = strat->
S[
j];
13323 if (
i < s_lastVblock || (
pGetComp(
s) > 0 &&
i == s_lastVblock))
13339 if (
i < h_lastVblock)
13363 for (
j=0;
j<=
k;
j++)
13368 poly
s = strat->
S[
j];
13385 for (
j=0;
j<=
k;
j++)
13390 poly
s = strat->
S[
j];
13395 for (
i=1;
i<=maxShift;
i++)
13398 for (
j=0;
j<=
k;
j++)
13403 poly
s = strat->
S[
j];
13405 if (
i <= s_lastVblock)
13422 if (
i <= h_lastVblock)
13455 #ifdef HAVE_SHIFTBBA
13461 if (h_lastVblock == 0)
return;
13472 int maxShift =
degbound - h_lastVblock;
13481 for (
i=0;
i<=maxShift;
i++)
13484 for (
j=0;
j<=
k;
j++)
13489 poly
s = strat->
S[
j];
13498 for (
j=0;
j<=
k;
j++)
13500 poly
s = strat->
S[
j];
13515 else if ((isFromQ)&&(strat->
fromQ!=
NULL))
13518 for (
j=0;
j<=
k;
j++)
13523 poly
s = strat->
S[
j];
13530 for (
i=1;
i<=maxShift;
i++)
13533 for (
j=0;
j<=
k;
j++)
13537 poly
s = strat->
S[
j];
13548 for (
j=0;
j<=
k;
j++)
13550 poly
s = strat->
S[
j];
13555 for (
i=1;
i<=maxShift;
i++)
13558 for (
j=0;
j<=
k;
j++)
13560 poly
s = strat->
S[
j];
13572 for (
j=0;
j<=
k;
j++)
13578 poly
s = strat->
S[
j];
13595 for (
j=0;
j<=
k;
j++)
13600 poly
s = strat->
S[
j];
13605 for (
i=1;
i<=maxShift;
i++)
13608 for (
j=0;
j<=
k;
j++)
13613 poly
s = strat->
S[
j];
13635 #ifdef HAVE_SHIFTBBA
13644 if ( (!strat->
fromT)
13665 #ifdef HAVE_SHIFTBBA
13676 for (
int i = 1;
i <= maxPossibleShift;
i++)
13688 #ifdef HAVE_SHIFTBBA
13695 p =
h = L->GetLmTailRing();
13697 return L->GetLmCurrRing();
13704 Ln.pLength = L->GetpLength() - 1;
13712 while(!Ln.IsNull())
13716 Ln.SetShortExpVector();
13722 With = &(strat->
T[
j]);
13727 if (With ==
NULL)
break;
13743 pNext(
h) = Ln.LmExtractAndIter();
13746 }
while (!Ln.IsNull());
13749 if (Ln.IsNull())
goto all_done;
13750 if (! withT) With_s.Init(
currRing);
13752 pNext(
h) = Ln.LmExtractAndIter();
13767 return L->GetLmCurrRing();
static int si_max(const int a, const int b)
static int si_min(const int a, const int b)
const CanonicalForm CFMap CFMap & N
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 long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ....
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)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
void kBucketDestroy(kBucket_pt *bucket_pt)
void kBucketInit(kBucket_pt bucket, poly lm, int length)
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)
long ind_fact_2(long arg)
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)
BOOLEAN kTest_L(LObject *L, ring strat_tailRing, BOOLEAN testp, int lpos, TSet T, int tlength)
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)
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)
static void enterOnePairWithoutShifts(int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_shift)
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)
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
static BOOLEAN enterOneStrongPolyShift(poly q, poly p, int, int, kStrategy strat, int atR, int, int qisFromQ, int shiftcount, int ifromS)
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 void enterOnePairWithShifts(int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int atR, int p_lastVblock, int q_lastVblock)
STATIC_VAR BOOLEAN sloppy_max
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
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)
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)
void enterOneZeroPairRing(poly f, poly t_p, 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)
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)
void initBuchMoraPosRing(kStrategy strat)
int kFindInTShift(poly p, TSet T, int tlength)
void postReduceByMonSig(LObject *h, kStrategy strat)
BOOLEAN kTest_T(TObject *T, ring strat_tailRing, int i, char TN)
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)
void initenterzeropairsRing(poly p, int ecart, kStrategy strat, int atR)
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)
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)
#define REDTAIL_CANONICALIZE
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)
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)
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
STATIC_VAR unsigned add[]
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)
gmp_float exp(const gmp_float &a)
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)
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
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)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
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 poly p_Mult_q(poly p, poly q, 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 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)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
#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:
void pNorm(poly p, const ring R=currRing)
#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 rField_is_Ring(const ring 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)
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)