21 #define EXT_POLY_NEW 0 51 #define ENTER_USE_MEMMOVE 90 #ifdef ENTER_USE_MYMEMMOVE 91 inline void _my_memmove_d_gt_s(
unsigned long* d,
unsigned long*
s,
long l)
93 REGISTER unsigned long* _dl = (
unsigned long*) d;
94 REGISTER unsigned long* _sl = (
unsigned long*) s;
105 inline void _my_memmove_d_lt_s(
unsigned long* d,
unsigned long*
s,
long l)
108 REGISTER unsigned long* _dl = (
unsigned long*) d;
109 REGISTER unsigned long* _sl = (
unsigned long*)
s;
120 inline void _my_memmove(
void* d,
void*
s,
long l)
122 unsigned long _d = (
unsigned long) d;
123 unsigned long _s = (
unsigned long)
s;
124 unsigned long _l = ((
l) + SIZEOF_LONG - 1) >> LOG_SIZEOF_LONG;
126 if (_d > _s) _my_memmove_d_gt_s(_d, _s, _l);
127 else _my_memmove_d_lt_s(_d, _s, _l);
131 #define memmove(d,s,l) _my_memmove(d, s, l) 138 #define pDivComp_EQUAL 2 139 #define pDivComp_LESS 1 140 #define pDivComp_GREATER -1 141 #define pDivComp_INCOMP 0 154 unsigned long la, lb;
155 unsigned long divmask =
currRing->divmask;
156 for (i=0; i<
currRing->VarL_Size; i++)
165 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
172 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
203 unsigned long la, lb;
204 unsigned long divmask =
currRing->divmask;
205 for (i=0; i<
currRing->VarL_Size; i++)
214 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
221 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
228 if (b) {
return -1; }
249 poly
p = L->GetLmTailRing();
252 if (L->bucket !=
NULL)
290 L->ecart = L->pLDeg() - L->GetpFDeg();
299 L->ecart = L->pLDeg(strat->
LDegLast) - L->GetpFDeg();
339 ring r = L->tailRing;
340 poly
p = L->GetLmTailRing();
369 number eins=
nCopy(lc);
419 number eins=
nInit(1);
507 inline static unsigned long*
initsevS (
const int maxnr)
509 return (
unsigned long*)
omAlloc0(maxnr*
sizeof(
unsigned long));
513 return (
int*)
omAlloc0(maxnr*
sizeof(
int));
517 int &
length,
const int incr)
522 assume((length+incr) > 0);
526 (length+incr)*
sizeof(
TObject));
528 sevT = (
unsigned long*)
omReallocSize(sevT, length*
sizeof(
long*),
529 (length+incr)*
sizeof(
long*));
532 (length+incr)*
sizeof(
TObject*));
533 for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
547 for (j=0; j<=strat->
tl; j++)
551 if (strat->
T[j].max_exp !=
NULL)
561 if (strat->
T[j].t_p !=
NULL)
572 if (p == strat->
S[i])
574 if (strat->
T[j].t_p !=
NULL)
576 if (p_shallow_copy_delete!=
NULL)
600 for (j=0; j<=strat->
tl; j++)
604 if (strat->
T[j].max_exp !=
NULL)
614 if (strat->
T[j].t_p !=
NULL)
626 if (p == strat->
S[i])
628 if (strat->
T[j].t_p !=
NULL)
652 assume(((*length)+incr)>0);
655 ((*length)+incr)*
sizeof(
LObject));
675 if ((*k) < 0)
return FALSE;
676 if (((p1 == (*p).p1) && (p2 == (*p).p2))
677 || ((p1 == (*p).p2) && (p2 == (*p).p1)))
696 if ((*k) < 0)
return FALSE;
708 for (i=0; i<=tlength; i++)
710 if (T[i].p == p)
return i;
721 if (i >= 0)
return i;
724 while (strat !=
NULL);
737 #define kFalseReturn(x) do { if (!x) return FALSE;} while (0) 740 static const char* kTest_LmEqual(poly
p, poly
t_p, ring
tailRing)
743 for (i=1; i<=tailRing->N; i++)
746 return "Lm[i] different";
749 return "Lm[0] different";
751 return "Lm.next different";
753 return "Lm.coeff different";
762 r_assume(strat_tailRing == tailRing);
772 if (
T->t_p ==
NULL &&
i > 0)
778 const char* msg = kTest_LmEqual(
T->p,
T->t_p,
T->tailRing);
789 if (
T->t_p !=
NULL &&
i >= 0 && TN ==
'T')
793 if (
T->max_exp !=
NULL)
794 return dReportError(
"%c[%d].max_exp is not NULL as it should be", TN,
i);
798 if (
T->max_exp ==
NULL)
810 p_Setm(test_max, tailRing);
822 if (
T->p ==
NULL &&
i > 0)
827 if ((
i >= 0) && (
T->pLength != 0)
832 return dReportError(
"%c[%d] pLength error: has %d, specified to have %d",
837 if (
i >= 0 && (TN ==
'T' || TN ==
'L'))
840 if (
T->FDeg !=
T->pFDeg())
844 return dReportError(
"%c[%d] FDeg error: has %d, specified to have %d",
845 TN,
i ,
T->pFDeg(), d);
850 if (
i >= 0 && TN ==
'T')
865 if (L->bucket !=
NULL)
867 kFalseReturn(
kbTest(L->bucket));
868 r_assume(L->bucket->bucket_ring == L->tailRing);
875 if (testp!=2) kFalseReturn(
kTest_T(L, strat_tailRing, lpos,
'L'));
884 return dReportError(
"L[%d] wrong sev: has %o, specified to have %o",
893 else if (tlength > 0 &&
T !=
NULL && (lpos >=0) && (testp!=2))
915 -1, strat->
T, strat->
tl));
918 if (strat->
T !=
NULL)
920 for (i=0; i<=strat->
tl; i++)
929 if (strat->
L !=
NULL)
934 for (i=0; i<=strat->
Ll; i++)
938 strat->
T, strat->
tl));
943 for (i=0; i<=strat->
Ll; i++)
946 strat->
L[i].Next() != strat->
tail,
i,
947 strat->
T, strat->
tl));
958 if (strat->
S !=
NULL)
968 for (i=0; i<=strat->
sl; i++)
970 if (strat->
S[i] !=
NULL &&
973 return dReportError(
"S[%d] wrong sev: has %o, specified to have %o",
986 kFalseReturn(
kTest(strat));
989 for (i=0; i<=strat->
tl; i++)
991 if (strat->
T[i].i_r < 0 || strat->
T[i].i_r > strat->
tl)
992 return dReportError(
"strat->T[%d].i_r == %d out of bounds", i,
994 if (strat->
R[strat->
T[i].i_r] != &(strat->
T[i]))
998 if (strat->
S !=
NULL)
1000 for (i=0; i<=strat->
sl; i++)
1005 if (strat->
S_2_R[i] != strat->
T[j].i_r)
1007 i, strat->
S_2_R[i], j, strat->
T[j].i_r);
1011 #ifdef HAVE_SHIFTBBA 1014 for (i=0; i<=strat->
Ll; i++)
1016 if (strat->
L[i].p1 !=
NULL && strat->
L[i].p2)
1018 if (strat->
L[i].i_r1 < 0 ||
1019 strat->
L[i].i_r1 > strat->
tl ||
1020 strat->
L[i].T_1(strat)->p != strat->
L[
i].p1)
1022 if (strat->
L[i].i_r2 < 0 ||
1023 strat->
L[i].i_r2 > strat->
tl ||
1024 strat->
L[i].T_2(strat)->p != strat->
L[
i].p2)
1029 if (strat->
L[i].i_r1 != -1)
1031 if (strat->
L[i].i_r2 != -1)
1034 if (strat->
L[i].i_r != -1)
1047 #ifdef ENTER_USE_MEMMOVE 1048 memmove(&(strat->
S[i]), &(strat->
S[i+1]), (strat->
sl - i)*
sizeof(poly));
1049 memmove(&(strat->
ecartS[i]),&(strat->
ecartS[i+1]),(strat->
sl - i)*
sizeof(
int));
1050 memmove(&(strat->
sevS[i]),&(strat->
sevS[i+1]),(strat->
sl - i)*
sizeof(
unsigned long));
1051 memmove(&(strat->
S_2_R[i]),&(strat->
S_2_R[i+1]),(strat->
sl - i)*
sizeof(
int));
1054 for (j=i; j<strat->
sl; j++)
1056 strat->
S[
j] = strat->
S[j+1];
1064 #ifdef ENTER_USE_MEMMOVE 1065 memmove(&(strat->
lenS[i]),&(strat->
lenS[i+1]),(strat->
sl - i)*
sizeof(
int));
1067 for (j=i; j<strat->
sl; j++) strat->
lenS[j] = strat->
lenS[j+1];
1072 #ifdef ENTER_USE_MEMMOVE 1075 for (j=i; j<strat->
sl; j++) strat->
lenSw[j] = strat->
lenSw[j+1];
1080 #ifdef ENTER_USE_MEMMOVE 1081 memmove(&(strat->
fromQ[i]),&(strat->
fromQ[i+1]),(strat->
sl - i)*
sizeof(
int));
1083 for (j=i; j<strat->
sl; j++)
1099 #ifdef ENTER_USE_MEMMOVE 1100 memmove(&(strat->
S[i]), &(strat->
S[i+1]), (strat->
sl - i)*
sizeof(poly));
1101 memmove(&(strat->
sig[i]), &(strat->
sig[i+1]), (strat->
sl - i)*
sizeof(poly));
1102 memmove(&(strat->
ecartS[i]),&(strat->
ecartS[i+1]),(strat->
sl - i)*
sizeof(
int));
1103 memmove(&(strat->
sevS[i]),&(strat->
sevS[i+1]),(strat->
sl - i)*
sizeof(
unsigned long));
1104 memmove(&(strat->
sevSig[i]),&(strat->
sevSig[i+1]),(strat->
sl - i)*
sizeof(
unsigned long));
1105 memmove(&(strat->
S_2_R[i]),&(strat->
S_2_R[i+1]),(strat->
sl - i)*
sizeof(
int));
1108 for (j=i; j<strat->
sl; j++)
1110 strat->
S[
j] = strat->
S[j+1];
1111 strat->
sig[
j] = strat->
sig[j+1];
1120 #ifdef ENTER_USE_MEMMOVE 1121 memmove(&(strat->
lenS[i]),&(strat->
lenS[i+1]),(strat->
sl - i)*
sizeof(
int));
1123 for (j=i; j<strat->
sl; j++) strat->
lenS[j] = strat->
lenS[j+1];
1128 #ifdef ENTER_USE_MEMMOVE 1131 for (j=i; j<strat->
sl; j++) strat->
lenSw[j] = strat->
lenSw[j+1];
1136 #ifdef ENTER_USE_MEMMOVE 1137 memmove(&(strat->
fromQ[i]),&(strat->
fromQ[i+1]),(strat->
sl - i)*
sizeof(
int));
1139 for (j=i; j<strat->
sl; j++)
1196 if (*length > 0 && j < *length)
1198 #ifdef ENTER_USE_MEMMOVE 1199 memmove(&(
set[j]), &(
set[j+1]), (*length - j)*
sizeof(
LObject));
1202 for (i=j; i < (*length); i++)
1207 memset(&(
set[*length]),0,
sizeof(
LObject));
1218 assume(p.FDeg == p.pFDeg());
1223 if (at <= (*length))
1225 memmove(&((*
set)[at+1]), &((*set)[at]), ((*length)-at+1)*
sizeof(
LObject));
1227 for (
i=(*length)+1;
i>=at+1;
i--) (*
set)[
i] = (*set)[
i-1];
1241 h->FDeg = h->pFDeg();
1242 h->ecart = h->pLDeg() - h->FDeg;
1244 h->length=h->pLength=
pLength(h->p);
1249 h->FDeg = h->pFDeg();
1251 h->length=h->pLength=
pLength(h->p);
1256 Lp->FDeg = Lp->pFDeg();
1263 Lp->FDeg = Lp->pFDeg();
1264 (*Lp).ecart =
si_max(ecartF,ecartG);
1265 (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -
p_FDeg((*Lp).lcm,
currRing));
1274 return (ecart1 <= ecart2);
1305 int j,compare,compareCoeff;
1309 h.ecart=0; h.length=0;
1328 for(j = strat->
Bl;j>=0;j--)
1337 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1352 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1365 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1391 poly si =
pCopy(strat->
S[i]);
1451 h.i_r1 = -1;h.i_r2 = -1;
1461 h.i_r2 = strat->
S_2_R[
i];
1467 posx = strat->
posInL(strat->
B,strat->
Bl,&h,strat);
1484 poly m1, m2,
gcd,si;
1540 PrintS(
"\n--- create strong gcd poly: ");
1541 Print(
"\n p: %d", i);
1543 Print(
"\n strat->S[%d]: ", i);
1567 h.i_r1 = -1;h.i_r2 = -1;
1573 h.p1 =
p;h.p2 = strat->
S[
i];
1577 h.i_r2 = strat->
S_2_R[
i];
1588 posx = strat->
posInL(strat->
L,strat->
Ll,&h,strat);
1593 if(h.IsNull())
return FALSE;
1610 if(strat->
sl < 0)
return FALSE;
1612 for(i=0;i<strat->
sl;i++)
1638 if(pairsig!=
NULL &&
pLtCmp(pairsig,h->sig) == 0)
1648 h->i_r1 = -1;h->i_r2 = -1;
1670 poly m1, m2,
gcd,si;
1718 PrintS(
"\n--- create strong gcd poly: ");
1719 Print(
"\n p: %d", i);
1721 Print(
"\n strat->S[%d]: ", i);
1745 if(
pLmCmp(pSigMult,sSigMult) == 0)
1754 if(
pLtCmp(pSigMult,sSigMult)==1)
1774 h.i_r1 = -1;h.i_r2 = -1;
1782 int red_result =
redRing(&h,strat);
1792 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1794 strat->
enterS(h,0,strat,strat->
tl);
1801 h.sig =
pNeg(h.sig);
1809 int red_result =
redRing(&h,strat);
1819 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1822 strat->
enterS(h,0,strat, strat->
tl+1);
1832 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
1833 strat->
enterS(h,strat->
sl+1,strat,strat->
tl+1);
1836 h.p1 =
p;h.p2 = strat->
S[
i];
1840 h.i_r2 = strat->
S_2_R[
i];
1870 Lp.ecart=0; Lp.length=0;
1875 #ifndef HAVE_RATGRING 1876 pLcm(p,strat->
S[i],Lp.lcm);
1877 #elif defined(HAVE_RATGRING) 1881 pLcm(p,strat->
S[i],Lp.lcm);
1888 if((!((strat->
ecartS[i]>0)&&(ecart>0)))
1928 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
1933 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1988 for(j = strat->
Bl;j>=0;j--)
1990 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
1994 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
2020 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
2087 Lp.p1 = strat->
S[
i];
2101 Lp.i_r1 = strat->
S_2_R[
i];
2115 && (Lp.p->coef!=
NULL))
2119 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2157 Lp.ecart=0; Lp.length=0;
2164 if((!((strat->
ecartS[i]>0)&&(ecart>0)))
2204 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
2209 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
2260 for(j = strat->
Bl;j>=0;j--)
2262 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
2266 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
2288 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
2316 Lp.p1 = strat->
S[
i];
2323 Lp.i_r1 = strat->
S_2_R[
i];
2337 && (Lp.p->coef!=
NULL))
2341 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
2365 unsigned long pSigMultNegSev,sSigMultNegSev;
2369 Lp.ecart=0; Lp.length=0;
2374 #ifndef HAVE_RATGRING 2375 pLcm(p,strat->
S[i],Lp.lcm);
2376 #elif defined(HAVE_RATGRING) 2380 pLcm(p,strat->
S[i],Lp.lcm);
2406 PrintS(
"----------------\n");
2409 PrintS(
"----------------\n");
2415 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2436 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2437 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
2438 || strat->
rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2461 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
2515 Lp.sevSig = ~pSigMultNegSev;
2522 Lp.sevSig = ~sSigMultNegSev;
2533 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
2547 Lp.checked = strat->
sl+1;
2554 Lp.prod_crit =
TRUE;
2566 PrintS(
"SIGNATURE OF PAIR: ");
2570 Lp.p1 = strat->
S[
i];
2584 Lp.i_r1 = strat->
S_2_R[
i];
2598 && (Lp.p->coef!=
NULL))
2640 unsigned long pSigMultNegSev,sSigMultNegSev;
2644 Lp.ecart=0; Lp.length=0;
2649 #ifndef HAVE_RATGRING 2650 pLcm(p,strat->
S[i],Lp.lcm);
2651 #elif defined(HAVE_RATGRING) 2655 pLcm(p,strat->
S[i],Lp.lcm);
2687 if(pSigMult !=
NULL)
2690 if(sSigMult !=
NULL)
2694 Print(
"----------------\n");
2697 Print(
"----------------\n");
2701 if(pSigMult !=
NULL && sSigMult !=
NULL)
2710 if(pSigMult ==
NULL)
2712 if(sSigMult ==
NULL)
2722 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2744 int red_result =
redRing(&Lp,strat);
2754 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2756 strat->
enterS(Lp,0,strat,strat->
tl);
2770 Lp.sig =
pCopy(pSigMult);
2799 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
2800 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
2825 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
2882 Lp.sig =
pNeg(Lp.sig);
2893 Lp.sevSig = ~pSigMultNegSev;
2900 Lp.sevSig = ~sSigMultNegSev;
2912 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1))
2926 Lp.checked = strat->
sl+1;
2933 Lp.prod_crit =
TRUE;
2945 PrintS(
"SIGNATURE OF PAIR: ");
2949 Lp.p1 = strat->
S[
i];
2964 Lp.i_r1 = strat->
S_2_R[
i];
2978 && (Lp.p->coef!=
NULL))
2986 int red_result =
redRing(&Lp,strat);
2996 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
2999 strat->
enterS(Lp,0,strat, strat->
tl+1);
3051 Lp.p1 = strat->
S[
i];
3055 Lp.i_r1 = strat->
S_2_R[
i];
3070 && (Lp.p->coef!=
NULL))
3073 l = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
3084 int j=strat->
Ll+strat->
Bl+1;
3092 for (i=strat->
Bl; i>=0; i--)
3094 j = strat->
posInL(strat->
L,j,&(strat->
B[i]),strat);
3105 int j=strat->
Ll+strat->
Bl+1;
3113 for (i=strat->
Bl; i>=0; i--)
3115 j = strat->
posInLSba(strat->
L,j,&(strat->
B[i]),strat);
3136 for (j=0; j<=strat->
sl; j++)
3140 for (i=strat->
Bl; i>=0; i--)
3162 for (j=strat->
Ll; j>=0; j--)
3168 if (strat->
L[j].p == strat->
tail)
3188 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
3214 for (j=strat->
Ll; j>=0; j--)
3234 for(i=j-1; i>=0; i--)
3236 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
3253 for (j=strat->
Ll; j>=0; j--)
3284 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3287 if (strat->
L[j].p2 == p)
3293 if ((strat->
L[i].p2 == p) &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
3307 strat->
L[
i].p2 = strat->
tail;
3324 else if (strat->
L[j].p2 == strat->
tail)
3363 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3366 if (strat->
L[j].p2 == p)
3372 if ((strat->
L[i].p2 == p) &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
3386 strat->
L[
i].p2 = strat->
tail;
3403 else if (strat->
L[j].p2 == strat->
tail)
3411 #ifdef HAVE_RATGRING 3424 for (j=0; j<=strat->
sl; j++)
3428 for (i=strat->
Bl; i>=0; i--)
3436 Print(
"chain-crit-part: S[%d]=",j);
3438 Print(
" divide B[%d].lcm=",i);
3460 for (j=strat->
Ll; j>=0; j--)
3466 if (strat->
L[j].p == strat->
tail)
3470 PrintS(
"chain-crit-part: pCompareChainPart p=");
3472 Print(
" delete L[%d]",j);
3494 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
3501 Print(
"chain-crit-part: sugar B[%d].lcm=",j);
3503 Print(
" delete B[%d]",i);
3514 Print(
"chain-crit-part: sugar B[%d].lcm=",i);
3516 Print(
" delete B[%d]",j);
3536 for (j=strat->
Ll; j>=0; j--)
3544 PrintS(
"chain-crit-part: sugar:pCompareChainPart p=");
3546 Print(
" delete L[%d]",j);
3564 for(i=j-1; i>=0; i--)
3566 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
3570 Print(
"chain-crit-part: equal lcm B[%d].lcm=",j);
3572 Print(
" delete B[%d]\n",i);
3589 for (j=strat->
Ll; j>=0; j--)
3597 PrintS(
"chain-crit-part: pCompareChainPart p=");
3599 Print(
" delete L[%d]",j);
3628 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3631 if (strat->
L[j].p2 == p)
3637 if ((strat->
L[i].p2 == p) &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
3654 strat->
L[
i].p2 = strat->
tail;
3661 PrintS(
"chain-crit-part: divisible_by p=");
3663 Print(
" delete L[%d]",l);
3674 PrintS(
"chain-crit-part: divisible_by(2) p=");
3676 Print(
" delete L[%d]",i);
3687 else if (strat->
L[j].p2 == strat->
tail)
3715 for (j=0; j<=
k; j++)
3717 if (!strat->
fromQ[j])
3728 for (j=0; j<=
k; j++)
3737 for (j=0; j<=
k; j++)
3750 #ifdef HAVE_RATGRING 3780 for (j=0; j<=
k; j++)
3782 if (!strat->
fromQ[j])
3793 for (j=0; j<=
k; j++)
3802 for (j=0; j<=
k; j++)
3816 #ifdef HAVE_RATGRING 3839 for (j=0; j<=k && !strat->
sigdrop; j++)
3841 if (!strat->
fromQ[j])
3850 for (j=0; j<=k && !strat->
sigdrop; j++)
3859 for (j=0; j<=k && !strat->
sigdrop; j++)
3873 #ifdef HAVE_RATGRING 3901 for (j=0; j<=strat->
sl; j++)
3905 for (i=strat->
Bl; i>=0; i--)
3912 PrintS(
"--- chain criterion func chainCritRing type 1\n");
3915 PrintS(
" strat->B[i].lcm:");
3920 wrp(strat->
B[i].lcm);
3935 for (j=strat->
Ll; j>=0; j--)
3948 PrintS(
"--- chain criterion func chainCritRing type 2\n");
3949 PrintS(
"strat->L[j].p:");
3980 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
3983 if (strat->
L[j].p2 == p)
3991 &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
3998 PrintS(
"--- chain criterion func chainCritRing type 3\n");
3999 PrintS(
"strat->L[j].lcm:");
4000 wrp(strat->
L[j].lcm);
4001 PrintS(
" strat->L[i].lcm:");
4002 wrp(strat->
L[i].lcm);
4016 strat->
L[
i].p2 = strat->
tail;
4033 else if (strat->
L[j].p2 == strat->
tail)
4047 if (arg <= 0)
return 0;
4059 if (arg <= 0)
return 0;
4060 if (arg%2 == 1) { arg--; }
4070 #ifdef HAVE_VANIDEAL 4081 int l,
j,compare,compareCoeff;
4085 Lp.ecart=0; Lp.length=0;
4098 for(j = strat->
Bl;j>=0;j--)
4102 if (compareCoeff == 0 || compare == compareCoeff)
4120 if (compareCoeff == 1)
4127 if (compareCoeff == -1)
4138 if ((f==
NULL) || (p==
NULL))
return;
4170 tmp_h.SetShortExpVector();
4175 enterT(tmp_h, strat, strat->
tl + 1);
4180 Lp.i_r1 = strat->
tl;
4184 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
4198 if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
4207 if (N == 1)
return 0;
4209 while (exp[i] == cexp[i] && i <= N) i++;
4211 *cabsind -= cind[
i];
4214 *cabsind += cind[
i];
4217 if (i > N)
return 0;
4221 for (
int j = i + 1;
j <=
N;
j++)
4223 if (step[1] > step[
j]) step[1] = step[
j];
4225 add =
ind2(cexp[i] + 2);
4226 if (*cabsind - step[1] + add >= bound)
4229 *cabsind -= cind[
i];
4231 *cabsind += cind[
i];
4234 if (i > N)
return 0;
4237 }
while (step[1] != -1);
4242 if (add < step[i]) step[
i] =
add;
4243 for (i = 2; i <=
N; i++)
4245 if (step[1] > step[i]) step[1] = step[
i];
4263 poly zeroPoly =
NULL;
4271 for (
int i = 1; i <= leadRing->N; i++)
4277 if (cabsind < leadRing->ch)
4279 zeroPoly =
p_ISet(
twoPow(leadRing->ch - cabsind), tailRing);
4283 zeroPoly =
p_ISet(1, tailRing);
4285 for (
int i = 1; i <= leadRing->N; i++)
4287 for (
long j = 1;
j <= exp[
i];
j++)
4290 tmp2 =
p_ISet(1, tailRing);
4295 zeroPoly =
p_Mult_q(zeroPoly, tmp2, tailRing);
4300 zeroPoly =
p_Mult_q(zeroPoly,
p_Add_q(tmp3, tmp2, tailRing), tailRing);
4305 for (
int i = 1; i <= leadRing->N; i++)
4311 zeroPoly =
pNext(zeroPoly);
4313 pNext(tmp2) = zeroPoly;
4334 for (
int i = 1; i <=
currRing->N; i++)
4337 if (exp[i] & 1 != 0)
4339 exp[
i] = exp[
i] - 1;
4352 PrintS(
"-------------\npoly :");
4354 Print(
"\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4355 Print(
"cexp : (%d, %d)\n", cexp[1], cexp[2]);
4356 Print(
"cind : (%d, %d)\n", cind[1], cind[2]);
4358 Print(
"cind : %d\n", cabsind);
4375 Print(
"%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4400 for (
int i = 1; i <=
currRing->N; i++)
4411 PrintS(
"-------------\npoly :");
4413 Print(
"\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4414 Print(
"cexp : (%d, %d)\n", cexp[1], cexp[2]);
4415 Print(
"cind : (%d, %d)\n", cind[1], cind[2]);
4416 Print(
"bound : %d\n", bound);
4417 Print(
"cind : %d\n", cabsind);
4435 Print(
"%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4443 G0->m[
IDELEMS(G0) - 1] = zeroPoly;
4462 for (j=0; j<=
k; j++)
4469 && ((iCompH<=strat->syzComp)||(strat->
syzComp==0)))
4484 for (j=0; j<=k && !strat->
sigdrop; j++)
4491 && ((iCompH<=strat->syzComp)||(strat->
syzComp==0)))
4538 PrintS(
"--- create zero spoly: ");
4567 posx = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
4620 PrintS(
"--- create zero spoly: ");
4648 int red_result =
redRing(&Lp,strat);
4658 strat->
enterS(strat->
P,strat->
sl+1,strat, strat->
tl+1);
4660 strat->
enterS(Lp,0,strat,strat->
tl);
4708 if ( (!strat->
fromT)
4718 clearS(h,h_sev, &j,&k,strat);
4765 if ( (!strat->
fromT)
4773 clearS(h,h_sev, &j,&k,strat);
4790 if ( (!strat->
fromT)
4798 clearS(h,h_sev, &j,&k,strat);
4815 for (j=0; j<=
k; j++)
4817 const int iCompSj =
pGetComp(strat->
S[j]);
4818 if ((iCompH==iCompSj)
4829 for (j=0; j<=
k; j++)
4831 const int iCompSj =
pGetComp(strat->
S[j]);
4832 if ((iCompH==iCompSj)
4871 clearS(h,h_sev,&j,&k,strat);
4888 int new_suc=strat->
sl+1;
4892 for (; i<=strat->
sl; i++)
4897 if (new_suc > at) new_suc = at;
4900 sev = strat->
sevS[
i];
4903 for (j=i; j>=at+1; j--)
4905 strat->
S[
j] = strat->
S[j-1];
4912 strat->
sevS[at] = sev;
4913 strat->
S_2_R[at] = s2r;
4916 for (j=i; j>=at+1; j--)
4920 strat->
fromQ[at]=fq;
4924 if (new_suc <= strat->sl) *suc=new_suc;
4938 if(length==-1)
return 0;
4957 || ((o==oo) && (
pLmCmp(
set[length],p)!= cmp_int)))
4979 if (
pLmCmp(
set[length],p)== -cmp_int)
4987 if (cmp == cmp_int)
return an;
4988 if (cmp == -cmp_int)
return en;
4994 if (cmp == cmp_int) en =
i;
4995 else if (cmp == -cmp_int) an =
i;
5004 if (
pLmCmp(
set[length],p)== -cmp_int)
5011 if (
pLmCmp(
set[an],p) == cmp_int)
return an;
5012 if (
pLmCmp(
set[an],p) == -cmp_int)
return en;
5014 && ((strat->
ecartS[an])>ecart_p))
5019 if (
pLmCmp(
set[i],p) == cmp_int) en=i;
5020 else if (
pLmCmp(
set[i],p) == -cmp_int) an=i;
5024 &&((strat->
ecartS[
i])<ecart_p))
5038 if (length<0)
return 0;
5043 for(
int i = 0;i<=
length;i++)
5052 || ((op == o) && (
pLtCmp(
set[mon],p) == -1)))
5063 || ((op == o) && (
pLtCmp(
set[an],p) == -1)))
5070 || ((op == o) && (
pLtCmp(
set[i],p) == -1)))
5082 || ((op == o) && (
pLtCmp(
set[length],p) == -1)))
5096 || ((op == o) && (
pLtCmp(
set[an],p) == -1)))
5103 || ((op == o) && (
pLtCmp(
set[i],p) == -1)))
5115 if(end < 0 || end >=
IDELEMS(F))
5117 if (end<0)
return 0;
5124 for(i=start;i<end;i++)
5138 || ((op == o) && (
pLtCmp(
set[an],p) == -1)))
5145 || ((op == o) && (
pLtCmp(
set[i],p) == -1)))
5170 if (length==-1)
return 0;
5172 if (
pLmCmp(
set[length].p,p.p)!=
currRing->OrdSgn)
return length+1;
5201 if (
set[length].length<p.length)
5212 if (
set[an].length>p.length)
return an;
5216 if (
set[i].length>p.length) en=
i;
5228 if (length==-1)
return 0;
5230 int o = p.GetpFDeg();
5231 int op =
set[
length].GetpFDeg();
5234 || ((op == o) && (
pLmCmp(
set[length].p,p.p) !=
currRing->OrdSgn)))
5245 op=
set[an].GetpFDeg();
5252 op =
set[
i].GetpFDeg();
5264 if (length==-1)
return 0;
5266 int o = p.GetpFDeg();
5267 int op =
set[
length].GetpFDeg();
5281 op=
set[an].GetpFDeg();
5288 op =
set[
i].GetpFDeg();
5305 if (length==-1)
return 0;
5306 int o = p.GetpFDeg();
5307 int op =
set[
length].GetpFDeg();
5312 if ((op < o) || (
pLmCmp(
set[length].p,p.p)== -cmp_int))
5319 op =
set[an].GetpFDeg();
5320 if (op > o)
return an;
5321 if (op < 0)
return en;
5322 cmp =
pLmCmp(
set[an].p,p.p);
5323 if (cmp == cmp_int)
return an;
5324 if (cmp == -cmp_int)
return en;
5329 op =
set[
i].GetpFDeg();
5331 else if (op < o) an =
i;
5334 cmp =
pLmCmp(
set[i].p,p.p);
5335 if (cmp == cmp_int) en =
i;
5336 else if (cmp == -cmp_int) an =
i;
5382 if (length==-1)
return 0;
5384 int o = p.GetpFDeg();
5385 int op =
set[
length].GetpFDeg();
5388 || (( op == o) && (
set[length].length<p.length))
5389 || (( op == o) && (
set[length].length == p.length)
5400 op =
set[an].GetpFDeg();
5402 || (( op == o) && (
set[an].length > p.length))
5403 || (( op == o) && (
set[an].length == p.length)
5409 op =
set[
i].GetpFDeg();
5411 || (( op == o) && (
set[i].length > p.length))
5412 || (( op == o) && (
set[i].length == p.length)
5424 if (length==-1)
return 0;
5426 int o = p.GetpFDeg();
5427 int op =
set[
length].GetpFDeg();
5430 || (( op == o) && (
set[length].length<p.length))
5431 || (( op == o) && (
set[length].length == p.length)
5442 op =
set[an].GetpFDeg();
5444 || (( op == o) && (
set[an].length > p.length))
5445 || (( op == o) && (
set[an].length == p.length)
5451 op =
set[
i].GetpFDeg();
5453 || (( op == o) && (
set[i].length > p.length))
5454 || (( op == o) && (
set[i].length == p.length)
5470 if (length==-1)
return 0;
5472 int o = p.GetpFDeg();
5499 int ol = p.GetpLength();
5500 if (length==-1)
return 0;
5504 int oo=
set[
length].ecart;
5505 if ((oo < op) || ((oo==op) && (
set[length].length < ol)))
5515 int oo=
set[an].ecart;
5517 || ((oo==op) && (
set[an].
pLength > ol)))
5522 int oo=
set[
i].ecart;
5524 || ((oo == op) && (
set[i].
pLength > ol)))
5556 if (length==-1)
return 0;
5558 int o = p.GetpFDeg() + p.ecart;
5573 op =
set[an].GetpFDeg()+
set[an].ecart;
5580 op =
set[
i].GetpFDeg()+
set[
i].ecart;
5592 if (length==-1)
return 0;
5594 int o = p.GetpFDeg() + p.ecart;
5609 op =
set[an].GetpFDeg()+
set[an].ecart;
5616 op =
set[
i].GetpFDeg()+
set[
i].ecart;
5653 if (length==-1)
return 0;
5655 int o = p.GetpFDeg() + p.ecart;
5659 || (( op == o) && (
set[length].ecart > p.ecart))
5660 || (( op == o) && (
set[length].ecart==p.ecart)
5671 op =
set[an].GetpFDeg()+
set[an].ecart;
5673 || (( op == o) && (
set[an].ecart < p.ecart))
5674 || (( op == o) && (
set[an].ecart==p.ecart)
5680 op =
set[
i].GetpFDeg()+
set[
i].ecart;
5682 || (( op == o) && (
set[i].ecart < p.ecart))
5683 || (( op == o) && (
set[i].ecart == p.ecart)
5694 if (length==-1)
return 0;
5696 int o = p.GetpFDeg() + p.ecart;
5700 || (( op == o) && (
set[length].ecart > p.ecart))
5701 || (( op == o) && (
set[length].ecart==p.ecart)
5712 op =
set[an].GetpFDeg()+
set[an].ecart;
5714 || (( op == o) && (
set[an].ecart < p.ecart))
5715 || (( op == o) && (
set[an].ecart==p.ecart)
5721 op =
set[
i].GetpFDeg()+
set[
i].ecart;
5723 || (( op == o) && (
set[i].ecart < p.ecart))
5724 || (( op == o) && (
set[i].ecart == p.ecart)
5740 if (length==-1)
return 0;
5744 int o = p.GetpFDeg() + p.ecart;
5747 if (
pGetComp(
set[length].p)*cc < c)
5749 if (
pGetComp(
set[length].p)*cc == c)
5753 || ((op == o) && (
set[length].ecart > p.ecart))
5754 || ((op == o) && (
set[length].ecart==p.ecart)
5770 int op =
set[an].GetpFDeg()+
set[an].ecart;
5772 || ((op == o) && (
set[an].ecart < p.ecart))
5773 || ((op == o) && (
set[an].ecart==p.ecart)
5782 else if (
pGetComp(
set[i].p)*cc == c)
5784 int op =
set[
i].GetpFDeg()+
set[
i].ecart;
5786 || ((op == o) && (
set[i].ecart < p.ecart))
5787 || ((op == o) && (
set[i].ecart == p.ecart)
5801 if (length==-1)
return 0;
5805 int o = p.GetpFDeg() + p.ecart;
5808 if (
pGetComp(
set[length].p)*cc < c)
5810 if (
pGetComp(
set[length].p)*cc == c)
5814 || ((op == o) && (
set[length].ecart > p.ecart))
5815 || ((op == o) && (
set[length].ecart==p.ecart)
5831 int op =
set[an].GetpFDeg()+
set[an].ecart;
5833 || ((op == o) && (
set[an].ecart < p.ecart))
5834 || ((op == o) && (
set[an].ecart==p.ecart)
5843 else if (
pGetComp(
set[i].p)*cc == c)
5845 int op =
set[
i].GetpFDeg()+
set[
i].ecart;
5847 || ((op == o) && (
set[i].ecart < p.ecart))
5848 || ((op == o) && (
set[i].ecart == p.ecart)
5868 if (length==-1)
return 0;
5871 int op=p.GetpFDeg();
5873 if (
set[length].ecart < o)
5875 if (
set[length].ecart == o)
5877 int oo=
set[
length].GetpFDeg();
5878 if ((oo < op) || ((oo==op) && (
set[length].length < p.length)))
5889 if (
set[an].ecart > o)
5891 if (
set[an].ecart == o)
5893 int oo=
set[an].GetpFDeg();
5895 || ((oo==op) && (
set[an].length > p.length)))
5901 if (
set[i].ecart > o)
5903 else if (
set[i].ecart == o)
5905 int oo=
set[
i].GetpFDeg();
5907 || ((oo == op) && (
set[i].length > p.length)))
5925 if (length<0)
return 0;
5927 int d=p->GetpFDeg();
5928 int op=
set[
length].GetpFDeg();
5931 || ((op == d) && (p->p1!=
NULL)&&(
set[length].p1==
NULL))
5942 op=
set[an].GetpFDeg();
5944 || ((op == d) && (p->p1!=
NULL) && (
set[an].p1==
NULL))
5950 op=
set[
i].GetpFDeg();
5952 || ((op==d) && (p->p1!=
NULL) && (
set[i].p1==
NULL))
5968 if (length<0)
return 0;
5994 if (length<0)
return 0;
6026 if (length<0)
return 0;
6051 if (length<0)
return 0;
6065 cmp =
pLtCmp(
set[an].sig,p->sig);
6072 if (
set[an].
FDeg > p->FDeg)
6074 if (
set[an].FDeg < p->
FDeg)
6076 if (
set[an].FDeg == p->FDeg)
6078 cmp =
pLtCmp(
set[an].p,p->p);
6087 cmp =
pLtCmp(
set[i].sig,p->sig);
6094 if (
set[i].
FDeg > p->FDeg)
6096 if (
set[i].FDeg < p->
FDeg)
6098 if (
set[i].FDeg == p->FDeg)
6100 cmp =
pLtCmp(
set[i].p,p->p);
6113 if (length < 0)
return 0;
6114 if (
set[length].
FDeg > p->FDeg)
6116 if (
set[length].
FDeg == p->FDeg)
6117 if(
set[length].
GetpLength() > p->GetpLength())
6128 if (
set[an].
FDeg > p->FDeg)
6130 if(
set[an].
FDeg == p->FDeg)
6138 if(
nGreater(
set[an].p->coef, p->p->coef))
6153 if (
set[i].
FDeg > p->FDeg)
6157 if(
set[i].
FDeg == p->FDeg)
6165 if(
nGreater(
set[i].p->coef, p->p->coef))
6185 if (strat->
syzl==0)
return 0;
6190 int en= strat->
syzl-1;
6226 if (length<0)
return 0;
6228 int o = p->GetpFDeg();
6229 int op =
set[
length].GetpFDeg();
6232 || ((op == o) && (
pLmCmp(
set[length].p,p->p) != -
currRing->OrdSgn)))
6241 op =
set[an].GetpFDeg();
6248 op =
set[
i].GetpFDeg();
6268 if (length<0)
return 0;
6270 int o = p->GetpFDeg();
6271 int op =
set[
length].GetpFDeg();
6283 op =
set[an].GetpFDeg();
6290 op =
set[
i].GetpFDeg();
6302 if (length<0)
return 0;
6303 if(start == (length +1))
return (length+1);
6304 int o = p->GetpFDeg();
6305 int op =
set[
length].GetpFDeg();
6317 op =
set[an].GetpFDeg();
6324 op =
set[
i].GetpFDeg();
6338 if (length < 0)
return 0;
6348 if (
set[an].
FDeg > p->FDeg)
6350 if (
set[an].FDeg < p->
FDeg)
6352 if (
set[an].FDeg == p->FDeg)
6382 if (
set[i].
FDeg > p->FDeg)
6384 if (
set[i].FDeg < p->
FDeg)
6386 if (
set[i].FDeg == p->FDeg)
6426 if (coeff == 0)
return -1;
6429 while (tmp % 2 == 0)
6448 if (length < 0)
return 0;
6450 int o = p->GetpFDeg();
6451 int op =
set[
length].GetpFDeg();
6453 if ((op > o) || ((op == o) && (
pLmCmp(
set[length].p,p->p) != -
currRing->OrdSgn)))
6462 op =
set[an].GetpFDeg();
6463 if ((op > o) || ((op == o) && (
pLmCmp(
set[an].p,p->p) != -
currRing->OrdSgn)))
6468 op =
set[
i].GetpFDeg();
6469 if ((op > o) || ((op == o) && (
pLmCmp(
set[i].p,p->p) != -
currRing->OrdSgn)))
6524 if (length<0)
return 0;
6526 int o = p->GetpFDeg();
6527 int op =
set[
length].GetpFDeg();
6530 || ((op == o) && (
set[length].length >p->length))
6531 || ((op == o) && (
set[length].length <= p->length)
6541 op =
set[an].GetpFDeg();
6543 || ((op == o) && (
set[an].length >p->length))
6544 || ((op == o) && (
set[an].length <=p->length)
6550 op =
set[
i].GetpFDeg();
6552 || ((op == o) && (
set[i].length > p->length))
6553 || ((op == o) && (
set[i].length <= p->length)
6565 if (length<0)
return 0;
6567 int o = p->GetpFDeg();
6568 int op =
set[
length].GetpFDeg();
6571 || ((op == o) && (
set[length].length >p->length))
6572 || ((op == o) && (
set[length].length <= p->length)
6582 op =
set[an].GetpFDeg();
6584 || ((op == o) && (
set[an].length >p->length))
6585 || ((op == o) && (
set[an].length <=p->length)
6591 op =
set[
i].GetpFDeg();
6593 || ((op == o) && (
set[i].length > p->length))
6594 || ((op == o) && (
set[i].length <= p->length)
6612 if (length<0)
return 0;
6614 int o = p->GetpFDeg();
6647 if (length<0)
return 0;
6649 int o = p->GetpFDeg() + p->ecart;
6653 || ((op == o) && (
pLmCmp(
set[length].p,p->p) != -
currRing->OrdSgn)))
6662 op =
set[an].GetpFDeg() +
set[an].ecart;
6669 op =
set[
i].GetpFDeg() +
set[
i].ecart;
6682 if (length<0)
return 0;
6684 int o = p->GetpFDeg() + p->ecart;
6697 op =
set[an].GetpFDeg() +
set[an].ecart;
6704 op =
set[
i].GetpFDeg() +
set[
i].ecart;
6723 if (length<0)
return 0;
6725 int o = p->GetpFDeg() + p->ecart;
6727 if ((
set[length].
GetpFDeg() +
set[length].ecart > o)
6728 || ((
set[length].
GetpFDeg() +
set[length].ecart == o)
6729 && (
set[length].ecart > p->ecart))
6730 || ((
set[length].GetpFDeg() +
set[
length].ecart == o)
6731 && (
set[length].ecart == p->ecart)
6741 if ((
set[an].
GetpFDeg() +
set[an].ecart > o)
6742 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6743 && (
set[an].ecart > p->ecart))
6744 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6745 && (
set[an].ecart == p->ecart)
6751 if ((
set[i].
GetpFDeg() +
set[
i].ecart > o)
6752 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6753 && (
set[i].ecart > p->ecart))
6754 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6755 && (
set[i].ecart == p->ecart)
6767 if (length<0)
return 0;
6769 int o = p->GetpFDeg() + p->ecart;
6771 if ((
set[length].
GetpFDeg() +
set[length].ecart > o)
6772 || ((
set[length].
GetpFDeg() +
set[length].ecart == o)
6773 && (
set[length].ecart > p->ecart))
6774 || ((
set[length].GetpFDeg() +
set[
length].ecart == o)
6775 && (
set[length].ecart == p->ecart)
6785 if ((
set[an].
GetpFDeg() +
set[an].ecart > o)
6786 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6787 && (
set[an].ecart > p->ecart))
6788 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6789 && (
set[an].ecart == p->ecart)
6795 if ((
set[i].
GetpFDeg() +
set[
i].ecart > o)
6796 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6797 && (
set[i].ecart > p->ecart))
6798 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6799 && (
set[i].ecart == p->ecart)
6817 if (length<0)
return 0;
6821 unsigned long c =
pGetComp(p->p)*cc;
6822 int o = p->GetpFDeg() + p->ecart;
6824 if (
pGetComp(
set[length].p)*cc > c)
6826 if (
pGetComp(
set[length].p)*cc == c)
6828 if ((
set[length].
GetpFDeg() +
set[length].ecart > o)
6829 || ((
set[length].
GetpFDeg() +
set[length].ecart == o)
6830 && (
set[length].ecart > p->ecart))
6831 || ((
set[length].GetpFDeg() +
set[
length].ecart == o)
6832 && (
set[length].ecart == p->ecart)
6847 if ((
set[an].
GetpFDeg() +
set[an].ecart > o)
6848 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6849 && (
set[an].ecart > p->ecart))
6850 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6851 && (
set[an].ecart == p->ecart)
6860 else if (
pGetComp(
set[i].p)*cc == c)
6862 if ((
set[i].
GetpFDeg() +
set[
i].ecart > o)
6863 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6864 && (
set[i].ecart > p->ecart))
6865 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6866 && (
set[i].ecart == p->ecart)
6881 if (length<0)
return 0;
6885 unsigned long c =
pGetComp(p->p)*cc;
6886 int o = p->GetpFDeg() + p->ecart;
6888 if (
pGetComp(
set[length].p)*cc > c)
6890 if (
pGetComp(
set[length].p)*cc == c)
6892 if ((
set[length].
GetpFDeg() +
set[length].ecart > o)
6893 || ((
set[length].
GetpFDeg() +
set[length].ecart == o)
6894 && (
set[length].ecart > p->ecart))
6895 || ((
set[length].GetpFDeg() +
set[
length].ecart == o)
6896 && (
set[length].ecart == p->ecart)
6911 if ((
set[an].
GetpFDeg() +
set[an].ecart > o)
6912 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6913 && (
set[an].ecart > p->ecart))
6914 || ((
set[an].
GetpFDeg() +
set[an].ecart == o)
6915 && (
set[an].ecart == p->ecart)
6924 else if (
pGetComp(
set[i].p)*cc == c)
6926 if ((
set[i].
GetpFDeg() +
set[
i].ecart > o)
6927 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6928 && (
set[i].ecart > p->ecart))
6929 || ((
set[i].
GetpFDeg() +
set[
i].ecart == o)
6930 && (
set[i].ecart == p->ecart)
6949 PrintS(
"syzygy criterion checks: ");
6952 for (
int k=0;
k<strat->
syzl;
k++)
6957 Print(
"checking with: %d / %d -- \n",
k,strat->
syzl);
6986 PrintS(
"--- syzygy criterion checks: ");
6995 min = strat->
syzIdx[comp-2];
7005 max = strat->
syzIdx[comp-1];
7007 for (
int k=min;
k<
max;
k++)
7010 Print(
"COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->
currIdx,min,max,strat->
syzl);
7011 Print(
"checking with: %d -- ",
k);
7036 PrintS(
"rewritten criterion checks: ");
7039 for(
int k = strat->
sl;
k>=start;
k--)
7043 PrintS(
"checking with: ");
7059 PrintS(
"ALL ELEMENTS OF S\n----------------------------------------\n");
7060 for(
int kk = 0; kk<strat->
sl+1; kk++)
7064 PrintS(
"------------------------------\n");
7094 for (
int ii=strat->
sl; ii>start; ii--)
7100 if (!(
pLmCmp(p1,p2) == 1))
7119 for (
int i=strat->
Bl; i>-1; i--) {
7128 if (
pLmCmp(lm,strat->
B[found].GetLmCurrRing()) == -1)
7139 for (
int ii=strat->
sl; ii>-1; ii--)
7145 if (!(
pLmCmp(p1,p2) == 1))
7166 const unsigned long not_sev = ~L->sev;
7167 const unsigned long* sev = strat->
sevS;
7180 if (j > end_pos)
return NULL;
7181 #if defined(PDEBUG) || defined(PDIV_DEBUG) 7183 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
7188 if (!(sev[j] & not_sev) &&
7189 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]) &&
7203 if (j > end_pos)
return NULL;
7204 #if defined(PDEBUG) || defined(PDIV_DEBUG) 7211 if (!(sev[j] & not_sev) &&
7212 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]) &&
7223 if (strat->
tl < 0 || strat->
S_2_R[j] == -1)
7225 T->Set(strat->
S[j], r, strat->
tailRing);
7226 assume(T->GetpLength()==
pLength(T->p != __null ? T->p : T->t_p));
7234 return strat->
S_2_T(j);
7244 if (j > end_pos)
return NULL;
7246 #if defined(PDEBUG) || defined(PDIV_DEBUG) 7247 t = strat->
S_2_T(j);
7250 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
7256 if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
7258 t = strat->
S_2_T(j);
7259 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[j]);
7275 if (j > end_pos)
return NULL;
7277 #if defined(PDEBUG) || defined(PDIV_DEBUG) 7278 t = strat->
S_2_T(j);
7287 if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
7289 t = strat->
S_2_T(j);
7290 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[j]);
7341 if (With ==
NULL)
break;
7351 return redtail(L, end_pos, strat);
7357 if (hn ==
NULL)
goto all_done;
7378 return redtail(&L, end_pos, strat);
7383 #define REDTAIL_CANONICALIZE 100 7387 p = h = L->GetLmTailRing();
7389 return L->GetLmCurrRing();
7424 Ln.SetShortExpVector();
7430 With = &(strat->
T[
j]);
7431 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7436 if (With ==
NULL)
break;
7437 assume(With->GetpLength()==
pLength(With->p != __null ? With->p : With->t_p));
7464 pNext(h) = Ln.LmExtractAndIter();
7467 }
while (!Ln.IsNull());
7470 if (Ln.IsNull())
goto all_done;
7471 if (! withT) With_s.Init(
currRing);
7473 pNext(h) = Ln.LmExtractAndIter();
7492 return L->GetLmCurrRing();
7500 p = h = L->GetLmTailRing();
7502 return L->GetLmCurrRing();
7509 Ln.pLength = L->GetpLength() - 1;
7533 Ln.SetShortExpVector();
7539 With = &(strat->
T[
j]);
7544 if (With ==
NULL)
break;
7571 pNext(h) = Ln.LmExtractAndIter();
7574 }
while (!Ln.IsNull());
7580 Ln.p =
pJet(Ln.p,bound);
7586 if (! withT) With_s.Init(
currRing);
7588 pNext(h) = Ln.LmExtractAndIter();
7607 return L->GetLmCurrRing();
7617 p = h = L->GetLmTailRing();
7619 return L->GetLmCurrRing();
7626 Ln.pLength = L->GetpLength() - 1;
7639 Ln.SetShortExpVector();
7641 if (With ==
NULL)
break;
7651 poly p_Ln=Ln.GetLmCurrRing();
7652 poly p_With=With->GetLmCurrRing();
7664 if (Ln.bucket!=
NULL)
7695 pNext(h) = Ln.LmExtractAndIter();
7698 }
while (!Ln.IsNull());
7701 if (Ln.IsNull())
goto all_done;
7704 pNext(h) = Ln.LmExtractAndIter();
7722 return L->GetLmCurrRing();
7738 if (strat->
Ll != *reduc)
7740 if (strat->
Ll != *reduc-1)
7752 if (red_result == 0)
7754 else if (red_result < 0)
7756 if ((red_result > 0) || ((strat->
Ll % 100)==99))
7758 if (strat->
Ll != *reduc && strat->
Ll > 0)
7775 Print(
"product criterion:%d chain criterion:%d\n",strat->
cp,strat->
c3);
7776 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
7778 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
7789 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
7791 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
7806 for (i=0; i<=strat->
sl; i++)
7816 for (i=0; i<=strat->
tl; i++)
7820 if (strat->
T[i].length==0) strat->
T[
i].length=
pLength(strat->
T[i].p);
7821 Print(
" o:%ld e:%d l:%d",
7822 strat->
T[i].pFDeg(),strat->
T[
i].ecart,strat->
T[
i].length);
7827 for (i=strat->
Ll; i>=0; i--)
7836 Print(
" o:%ld e:%d l:%d",
7837 strat->
L[i].pFDeg(),strat->
L[
i].ecart,strat->
L[
i].length);
7859 strat->
S=strat->
Shdl->m;
7864 memset(strat->
fromQ,0,i*
sizeof(
int));
7870 h.p =
pCopy(Q->m[i]);
7890 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
7893 strat->
enterS(h,pos,strat,-1);
7894 strat->
fromQ[pos]=1;
7904 h.p =
pCopy(F->m[i]);
7925 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
7927 strat->
enterS(h,pos,strat,-1);
7953 strat->
S=strat->
Shdl->m;
7958 memset(strat->
fromQ,0,i*
sizeof(
int));
7964 h.p =
pCopy(Q->m[i]);
7984 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
7987 strat->
enterS(h,pos,strat,-1);
7988 strat->
fromQ[pos]=1;
7998 h.p =
pCopy(F->m[i]);
8020 pos = strat->
posInL(strat->
L,strat->
Ll,&h,strat);
8050 strat->
S = strat->
Shdl->m;
8063 memset(strat->
fromQ,0,i*
sizeof(
int));
8069 h.p =
pCopy(Q->m[i]);
8089 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8092 strat->
enterS(h,pos,strat,-1);
8093 strat->
fromQ[pos]=1;
8103 h.p =
pCopy(F->m[i]);
8203 for(i=1; i<=strat->
sl; i++)
8215 strat->
syz = (poly *)
omAlloc(ps*
sizeof(poly));
8219 #if defined(DEBUGF5) || defined(DEBUGF51) 8220 PrintS(
"------------- GENERATING SYZ RULES NEW ---------------\n");
8227 while (i <= strat->sl)
8239 diff = comp - comp_old - 1;
8257 for (k = 0; k<
i; k++)
8284 diff = comp - comp_old - 1;
8301 for (k = 0; k<strat->
sl+1; k++)
8322 PrintS(
"Principal syzygies:\n");
8325 Print(
"ps %d\n",ps);
8326 PrintS(
"--------------------------------\n");
8327 for(i=0;i<=strat->
syzl-1;i++)
8336 PrintS(
"--------------------------------\n");
8356 strat->
S=strat->
Shdl->m;
8362 memset(strat->
fromQ,0,i*
sizeof(
int));
8368 h.p =
pCopy(Q->m[i]);
8388 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8391 strat->
enterS(h,pos,strat, strat->
tl+1);
8393 strat->
fromQ[pos]=1;
8404 h.p =
pCopy(F->m[i]);
8419 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8421 strat->
enterS(h,pos,strat, strat->
tl+1);
8463 h.is_normalized = 0;
8468 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8470 strat->
enterS(h,pos,strat, strat->
tl+1);
8478 strat->
enterS(h,0,strat, strat->
tl+1);
8500 strat->
S=strat->
Shdl->m;
8506 memset(strat->
fromQ,0,i*
sizeof(
int));
8512 h.p =
pCopy(Q->m[i]);
8532 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8535 strat->
enterS(h,pos,strat, strat->
tl+1);
8537 strat->
fromQ[pos]=1;
8548 h.p =
pCopy(F->m[i]);
8563 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8565 strat->
enterS(h,pos,strat, strat->
tl+1);
8607 h.is_normalized = 0;
8612 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
8614 strat->
enterS(h,pos,strat, strat->
tl+1);
8622 strat->
enterS(h,0,strat, strat->
tl+1);
8638 while (j <= maxIndex)
8655 if (!
pIsVector((*p).p) && ((*p).ecart != 0))
8664 h1 = r =
pCopy((*p).p);
8717 while ((j <= strat->sl) && (
pGetComp(strat->
S[j])!=0)) j++;
8719 while (j<=strat->sl)
8743 while (j <= maxIndex)
8797 while (j <= maxIndex);
8827 while (i<=strat->sl)
8834 redSi =
pHead(strat->
S[i]);
8835 strat->
S[
i] =
redBba(strat->
S[i],i-1,strat);
8838 if (
pCmp(redSi,strat->
S[i])!=0)
8851 if (strat->
S[i]==
NULL)
8859 if (strat->
S[i]==
NULL)
8877 DENOMINATOR_LIST=denom;
8895 if (any_change)
reorderS(&suc,strat);
8900 for (i=0; i<=strat->
sl; i++)
8921 h.sev = strat->
sevS[
i];
8934 while (i<=strat->sl)
8939 redSi=
pHead((strat->
S)[i]);
8940 (strat->
S)[i] =
redMora((strat->
S)[
i],i-1,strat);
8946 else if (
pCmp((strat->
S)[i],redSi)!=0)
8963 DENOMINATOR_LIST=denom;
8977 strat->
sevS[
i] = h.sev;
8987 if (any_change)
reorderS(&suc,strat);
8988 else { suc=-1;
break; }
8999 for (i=0; i<=strat->
sl; i++)
9003 strat->
S[
i] = h.p =
redtail(strat->
S[i],strat->
sl,strat);
9007 strat->
sevS[
i] = h.sev;
9013 h.sev = strat->
sevS[
i];
9014 h.length = h.pLength =
pLength(h.p);
9023 if (suc!= -1)
updateS(toT,strat);
9043 *
sizeof(
unsigned long));
9070 strat->
Shdl->m=strat->
S;
9072 if (atS <= strat->sl)
9074 #ifdef ENTER_USE_MEMMOVE 9075 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9076 (strat->
sl - atS + 1)*
sizeof(poly));
9077 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9078 (strat->
sl - atS + 1)*
sizeof(
int));
9079 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9080 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9081 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9082 (strat->
sl - atS + 1)*
sizeof(
int));
9084 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9085 (strat->
sl - atS + 1)*
sizeof(
int));
9087 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9090 for (i=strat->
sl+1; i>=atS+1; i--)
9092 strat->
S[
i] = strat->
S[i-1];
9098 for (i=strat->
sl+1; i>=atS+1; i--)
9101 for (i=strat->
sl+1; i>=atS+1; i--)
9107 #ifdef ENTER_USE_MEMMOVE 9108 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9109 (strat->
sl - atS + 1)*
sizeof(
int));
9111 for (i=strat->
sl+1; i>=atS+1; i--)
9116 strat->
fromQ[atS]=0;
9127 strat->
sevS[atS] = p.sev;
9128 strat->
ecartS[atS] = p.ecart;
9129 strat->
S_2_R[atS] = atR;
9146 *
sizeof(
unsigned long));
9150 *
sizeof(
unsigned long));
9178 strat->
Shdl->m=strat->
S;
9185 if (atS <= strat->sl)
9187 #ifdef ENTER_USE_MEMMOVE 9188 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
9189 (strat->
sl - atS + 1)*
sizeof(poly));
9190 memmove(&(strat->
sig[atS+1]), &(strat->
sig[atS]),
9191 (strat->
sl - atS + 1)*
sizeof(poly));
9192 memmove(&(strat->
sevSig[atS+1]), &(strat->
sevSig[atS]),
9193 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9194 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
9195 (strat->
sl - atS + 1)*
sizeof(
int));
9196 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
9197 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
9198 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
9199 (strat->
sl - atS + 1)*
sizeof(
int));
9201 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
9202 (strat->
sl - atS + 1)*
sizeof(
int));
9204 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
9207 for (i=strat->
sl+1; i>=atS+1; i--)
9209 strat->
S[
i] = strat->
S[i-1];
9213 strat->
sig[
i] = strat->
sig[i-1];
9217 for (i=strat->
sl+1; i>=atS+1; i--)
9220 for (i=strat->
sl+1; i>=atS+1; i--)
9226 #ifdef ENTER_USE_MEMMOVE 9227 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
9228 (strat->
sl - atS + 1)*
sizeof(
int));
9230 for (i=strat->
sl+1; i>=atS+1; i--)
9235 strat->
fromQ[atS]=0;
9239 strat->
S[atS] = p.p;
9240 strat->
sig[atS] = p.sig;
9246 strat->
sevS[atS] = p.sev;
9256 strat->
sevSig[atS] = p.sevSig;
9258 strat->
ecartS[atS] = p.ecart;
9259 strat->
S_2_R[atS] = atR;
9263 Print(
"--- LIST S: %d ---\n",strat->
sl);
9264 for(k=0;k<=strat->
sl;k++)
9268 PrintS(
"--- LIST S END ---\n");
9284 assume(p.FDeg == p.pFDeg());
9289 for(i=strat->
tl;i>=0;i--)
9291 if (p.p==strat->
T[i].p)
9293 printf(
"already in T at pos %d of %d, atT=%d\n",i,strat->
tl,atT);
9299 #ifdef HAVE_TAIL_RING 9302 p.t_p=p.GetLmTailRing();
9307 atT = strat->
posInT(strat->
T, strat->
tl, p);
9308 if (strat->
tl == strat->
tmax-1)
9310 if (atT <= strat->tl)
9312 #ifdef ENTER_USE_MEMMOVE 9313 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9315 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9316 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9318 for (i=strat->
tl+1; i>=atT+1; i--)
9320 #ifndef ENTER_USE_MEMMOVE 9321 strat->
T[
i] = strat->
T[i-1];
9324 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9342 strat->
T[atT].max_exp =
NULL;
9345 strat->
R[strat->
tl] = &(strat->
T[atT]);
9346 strat->
T[atT].i_r = strat->
tl;
9366 assume(p.FDeg == p.pFDeg());
9371 for(i=strat->
tl;i>=0;i--)
9373 if (p.p==strat->
T[i].p)
9375 printf(
"already in T at pos %d of %d, atT=%d\n",i,strat->
tl,atT);
9381 #ifdef HAVE_TAIL_RING 9384 p.t_p=p.GetLmTailRing();
9389 atT = strat->
posInT(strat->
T, strat->
tl, p);
9390 if (strat->
tl == strat->
tmax-1)
9392 if (atT <= strat->tl)
9394 #ifdef ENTER_USE_MEMMOVE 9395 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
9397 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
9398 (strat->
tl-atT+1)*
sizeof(
unsigned long));
9400 for (i=strat->
tl+1; i>=atT+1; i--)
9402 #ifndef ENTER_USE_MEMMOVE 9403 strat->
T[
i] = strat->
T[i-1];
9406 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
9424 strat->
T[atT].max_exp =
NULL;
9427 strat->
R[strat->
tl] = &(strat->
T[atT]);
9428 strat->
T[atT].i_r = strat->
tl;
9435 for(i=strat->
tl;i>=0;i--)
9466 (strat->
syzmax)*
sizeof(
unsigned long),
9468 *
sizeof(
unsigned long));
9471 if (atT < strat->syzl)
9473 #ifdef ENTER_USE_MEMMOVE 9474 memmove(&(strat->
syz[atT+1]), &(strat->
syz[atT]),
9475 (strat->
syzl-atT+1)*
sizeof(poly));
9476 memmove(&(strat->
sevSyz[atT+1]), &(strat->
sevSyz[atT]),
9477 (strat->
syzl-atT+1)*
sizeof(
unsigned long));
9479 for (i=strat->
syzl; i>=atT+1; i--)
9481 #ifndef ENTER_USE_MEMMOVE 9482 strat->
syz[
i] = strat->
syz[i-1];
9494 strat->
syz[atT] = p.sig;
9495 strat->
sevSyz[atT] = p.sevSig;
9498 Print(
"element in strat->syz: %d--%d ",atT+1,strat->
syzmax);
9508 strat->
L[cc].sig, ~strat->
L[cc].sevSig,
currRing)
9522 PrintS(
"--- Syzygies ---\n");
9525 PrintS(
"--------------------------------\n");
9526 for(i=0;i<=strat->
syzl-1;i++)
9531 PrintS(
"--------------------------------\n");
9567 #ifdef HAVE_RATGRING 9612 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
9613 else PrintS(
"ideal/module is not homogeneous\n");
9644 #ifdef HAVE_RATGRING 9683 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
9684 else PrintS(
"ideal/module is not homogeneous\n");
10192 for (l=
IDELEMS(r)-1;l>=0;l--)
10203 for (l=
IDELEMS(r)-1;l>=0;l--)
10205 if ((r->m[l]!=
NULL)
10210 for(q=
IDELEMS(Q)-1; q>=0;q--)
10212 if ((Q->m[q]!=
NULL)
10234 for (l=
IDELEMS(r)-1;l>=0;l--)
10236 if ((r->m[l]!=
NULL)
10241 for(q=
IDELEMS(Q)-1; q>=0;q--)
10243 if ((Q->m[q]!=
NULL)
10274 for (l=
IDELEMS(r)-1;l>=0;l--)
10278 for(q=
IDELEMS(Q)-1; q>=0;q--)
10287 reduction_found=
TRUE;
10303 for (l=
IDELEMS(r)-1;l>=0;l--)
10307 for(q=
IDELEMS(Q)-1; q>=0;q--)
10318 reduction_found=
TRUE;
10332 if ( reduction_found)
10337 for (l=
IDELEMS(r)-1;l>=0;l--)
10368 for (l=
IDELEMS(r)-1;l>=0;l--)
10422 for (i=strat->
sl; i>=low; i--)
10424 int end_pos=strat->
sl;
10426 if (strat->
ak==0) end_pos=i-1;
10428 if ((T_j !=
NULL)&&(T_j->p==strat->
S[i]))
10434 Print(
"test S[%d]:",i);
10446 Print(
"to (tailR) S[%d]:",i);
10458 T_j->max_exp =
NULL;
10461 T_j->pCleardenom();
10469 Print(
"test S[%d]:",i);
10475 strat->
S[
i] =
redtailBba(strat->
S[i], end_pos, strat, withT);
10489 DENOMINATOR_LIST=denom;
10501 Print(
"to (-tailR) S[%d]:",i);
10512 sloppy_max =
FALSE;
10549 if (j < strat->
HCord)
10590 assume(L->i_r1 >= -1 && L->i_r1 <= strat->
tl);
10591 assume(L->i_r2 >= -1 && L->i_r2 <= strat->
tl);
10597 if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10601 poly p1_max = (strat->
R[L->i_r1])->
max_exp;
10602 poly p2_max = (strat->
R[L->i_r2])->
max_exp;
10628 poly p1_max = (strat->
R[atR])->
max_exp;
10651 ideal F =
idCopy(Forig);
10655 ideal monred =
idInit(1,1);
10656 for(
int i=0; i<
idElem(F); i++)
10662 if((posconst != -1) && (!
nIsZero(F->m[posconst]->coef)))
10672 for(
int i=0; i<idelemQ; i++)
10680 if((posconst != -1) && (!
nIsZero(monred->m[posconst]->coef)))
10682 pmon =
pCopy(monred->m[posconst]);
10696 for(
int i = 0, j = 0; i<
IDELEMS(F); i++)
10697 II->m[j++] =
prMapR(F->m[i], nMap, origR, QQ_ring);
10698 for(
int i = 0, j =
IDELEMS(F); i<idelemQ; i++)
10699 II->m[j++] =
prMapR(Q->m[i], nMap, origR, QQ_ring);
10705 for(
int i =
IDELEMS(II)-1; i>=0; i--)
10706 if(II->m[i] !=
NULL)
10707 II->m[i+1] = II->m[
i];
10710 poly integer =
NULL;
10711 for(
int i =
IDELEMS(syz)-1;i>=0; i--)
10718 integer =
pHead(syz->m[i]);
10725 pmon =
prMapR(integer, nMap2, QQ_ring, origR);
10739 poly mindegmon =
NULL;
10740 for(
int i = 0; i<
IDELEMS(one); i++)
10744 if(mindegmon ==
NULL)
10745 mindegmon =
pCopy(one->m[i]);
10748 if(
p_Deg(one->m[i], QQ_ring) <
p_Deg(mindegmon, QQ_ring))
10749 mindegmon =
pCopy(one->m[i]);
10753 if(mindegmon !=
NULL)
10755 for(
int i =
IDELEMS(II)-1; i>=0; i--)
10756 if(II->m[i] !=
NULL)
10757 II->m[i+1] = II->m[
i];
10758 II->m[0] =
pCopy(mindegmon);
10761 for(
int i =
IDELEMS(syz)-1;i>=0; i--)
10775 if (found ==
FALSE)
10787 pmon =
prMapR(mindegmon, nMap2, QQ_ring, origR);
10818 poly pH = h->GetP();
10822 for(
int i = 0; i<=strat->
sl; i++)
10877 h->SetLmCurrRing();
10878 if((deleted)&&(h->p!=
NULL))
10886 poly hSig = h->sig;
10887 poly pH = h->GetP();
10891 for(
int i = 0; i<=strat->
sl; i++)
10902 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
10929 if(sigMult!=
NULL &&
pLtCmp(hSig,sigMult) == 1)
10960 h->SetLmCurrRing();
10976 for(
int j = 0; j<=strat->
sl; j++)
10980 for(
int i = 0; i<=strat->
sl; i++)
10982 if((i != j) && (strat->
S[i] !=
NULL))
11042 if (expbound == 0) expbound = strat->
tailRing->bitmask << 1;
11059 new_tailRing->pFDeg =
currRing->pFDeg;
11060 new_tailRing->pLDeg =
currRing->pLDeg;
11064 Print(
"[%lu:%d", (
unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11073 for (i=0; i<=strat->
tl; i++)
11075 strat->
T[
i].ShallowCopyDelete(new_tailRing, new_tailBin,
11076 p_shallow_copy_delete);
11078 for (i=0; i<=strat->
Ll; i++)
11082 strat->
L[
i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11084 if ((strat->
P.t_p !=
NULL) ||
11086 strat->
P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11088 if ((L !=
NULL) && (L->tailRing != new_tailRing))
11091 L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11097 L->tailRing = new_tailRing;
11100 L->max_exp = t_l->max_exp;
11104 if ((T !=
NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11105 T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11112 strat->
tailBin = new_tailBin;
11138 unsigned long l = 0;
11144 for (i=0; i<= strat->
Ll; i++)
11148 for (i=0; i<=strat->
tl; i++)
11175 res->block0 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11176 res->block1 = (
int *)
omAlloc0((n+1)*
sizeof(int));
11177 int **wvhdl = (
int **)
omAlloc0((n+1)*
sizeof(
int*));
11178 res->wvhdl = wvhdl;
11179 for (
int i=1; i<n; i++)
11181 res->order[
i] = r->order[i-1];
11182 res->block0[
i] = r->block0[i-1];
11183 res->block1[
i] = r->block1[i-1];
11184 res->wvhdl[
i] = r->wvhdl[i-1];
11190 for (
int i=
rBlocks(res); i>0; --
i)
11203 #ifndef SING_NDEBUG 11204 WarnS(
"error in nc_rComplete");
11223 res->block0 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11224 res->block1 = (
int *)
omAlloc0((n+2)*
sizeof(int));
11225 int **wvhdl = (
int **)
omAlloc0((n+2)*
sizeof(
int*));
11226 res->wvhdl = wvhdl;
11227 for (
int i=2; i<n+2; i++)
11229 res->order[
i] = r->order[i-2];
11230 res->block0[
i] = r->block0[i-2];
11231 res->block1[
i] = r->block1[i-2];
11232 res->wvhdl[
i] = r->wvhdl[i-2];
11237 res->block0[0] = 1;
11238 res->wvhdl[0] = (
int *)
omAlloc(res->N*
sizeof(
int));
11239 for (
int i=0; i<res->N; ++
i)
11240 res->wvhdl[0][i] = 1;
11244 res->wvhdl[1] =
NULL;
11246 for (
int i=
rBlocks(res); i>1; --
i)
11259 #ifndef SING_NDEBUG 11260 WarnS(
"error in nc_rComplete");
11397 #ifdef HAVE_TAIL_BIN 11409 if (tailBin !=
NULL)
11413 if (t_kHEdge !=
NULL)
11415 if (t_kNoether !=
NULL)
11424 Timings
for the different possibilities of posInT:
11425 T15 EDL DL EL L 1-2-3
11426 Gonnet 43.26 42.30 38.34 41.98 38.40 100.04
11427 Hairer_2_1 1.11 1.15 1.04 1.22 1.08 4.7
11428 Twomat3 1.62 1.69 1.70 1.65 1.54 11.32
11429 ahml 4.48 4.03 4.03 4.38 4.96 26.50
11430 c7 15.02 13.98 15.16 13.24 17.31 47.89
11431 c8 505.09 407.46 852.76 413.21 499.19 n/a
11432 f855 12.65 9.27 14.97 8.78 14.23 33.12
11433 gametwo6 11.47 11.35 14.57 11.20 12.02 35.07
11434 gerhard_3 2.73 2.83 2.93 2.64 3.12 6.24
11435 ilias13 22.89 22.46 24.62 20.60 23.34 53.86
11436 noon8 40.68 37.02 37.99 36.82 35.59 877.16
11437 rcyclic_19 48.22 42.29 43.99 45.35 51.51 204.29
11438 rkat9 82.37 79.46 77.20 77.63 82.54 267.92
11439 schwarz_11 16.46 16.81 16.76 16.81 16.72 35.56
11440 test016 16.39 14.17 14.40 13.50 14.26 34.07
11441 test017 34.70 36.01 33.16 35.48 32.75 71.45
11442 test042 10.76 10.99 10.27 11.57 10.45 23.04
11443 test058 6.78 6.75 6.51 6.95 6.22 9.47
11444 test066 10.71 10.94 10.76 10.61 10.56 19.06
11445 test073 10.75 11.11 10.17 10.79 8.63 58.10
11446 test086 12.23 11.81 12.88 12.24 13.37 66.68
11447 test103 5.05 4.80 5.47 4.64 4.89 11.90
11448 test154 12.96 11.64 13.51 12.46 14.61 36.35
11449 test162 65.27 64.01 67.35 59.79 67.54 196.46
11450 test164 7.50 6.50 7.68 6.70 7.96 17.13
11451 virasoro 3.39 3.50 3.35 3.47 3.70 7.66
11461 if (length==-1)
return 0;
11464 int op=p.GetpFDeg();
11465 int ol = p.GetpLength();
11467 if (
set[length].ecart < o)
11469 if (
set[length].ecart == o)
11471 int oo=
set[
length].GetpFDeg();
11472 if ((oo < op) || ((oo==op) && (
set[length].length < ol)))
11483 if (
set[an].ecart > o)
11485 if (
set[an].ecart == o)
11487 int oo=
set[an].GetpFDeg();
11489 || ((oo==op) && (
set[an].
pLength > ol)))
11495 if (
set[i].ecart > o)
11497 else if (
set[i].ecart == o)
11499 int oo=
set[
i].GetpFDeg();
11501 || ((oo == op) && (
set[i].
pLength > ol)))
11515 if (length==-1)
return 0;
11517 int op=p.GetpFDeg();
11518 int ol = p.GetpLength();
11520 int oo=
set[
length].GetpFDeg();
11521 if ((oo < op) || ((oo==op) && (
set[length].length < ol)))
11531 int oo=
set[an].GetpFDeg();
11533 || ((oo==op) && (
set[an].
pLength > ol)))
11538 int oo=
set[
i].GetpFDeg();
11540 || ((oo == op) && (
set[i].
pLength > ol)))
11551 int ol = p.GetpLength();
11554 if (
set[length].length<p.length)
11565 if (
set[an].
pLength>ol)
return an;
11586 if (strat->
red==redFirst)
PrintS(
"redFirst\n");
11588 else if (strat->
red==redEcart)
PrintS(
"redEcart\n");
11590 else Print(
"%p\n",(
void*)strat->
red);
11609 #ifdef HAVE_MORE_POS_IN_T 11640 else if (strat->
enterS==enterSMora)
PrintS(
"enterSMora\n");
11641 else if (strat->
enterS==enterSMoraNF)
PrintS(
"enterSMoraNF\n");
11647 PrintS(
"initEcartPair: ");
11651 Print(
"homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11653 Print(
"honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11659 Print(
"posInLDependsOnLength=%d\n",
11691 PrintS(
"currRing->pFDeg: ");
11706 PrintS(
"ecartWeights: ");
11713 #ifndef SING_NDEBUG 11718 #ifdef HAVE_SHIFTBBA 11732 #ifdef HAVE_SHIFTBBA 11749 #ifdef HAVE_SHIFTBBA 11841 #ifdef HAVE_SHIFTBBA 11851 for (i=0; i<=strat->
sl; i++)
11853 memset(&h,0,
sizeof(h));
11856 h.sev = strat->
sevS[
i];
11870 #ifdef HAVE_SHIFTBBA 11946 #ifdef HAVE_SHIFTBBA 11960 poly qq = strat->
S[
i];
11986 qfromQ = strat->
fromQ[
i];
11998 enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12000 for (j=1; j<= toInsert; j++)
12016 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12021 #ifdef HAVE_SHIFTBBA 12063 for (; j<= toInsert; j++)
12080 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12085 #ifdef HAVE_SHIFTBBA 12089 void enterOnePairShift (poly q, poly p,
int ecart,
int isFromQ,
kStrategy strat,
int atR,
int ecartq,
int qisFromQ,
int shiftcount,
int ifromS,
int ,
int lV)
12113 int qfromQ = qisFromQ;
12122 Lp.ecart=0; Lp.length=0;
12128 if (!
isInV(Lp.lcm, lV))
12133 PrintS(
"V crit applied to q = ");
12148 if((!((ecartq>0)&&(ecart>0)))
12170 Lp.ecart =
si_max(ecart,ecartq);
12171 if (strat->
fromT && (ecartq>ecart))
12188 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
12193 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12236 if (strat->
fromT && (ecartq>ecart))
12248 for(j = strat->
Bl;j>=0;j--)
12250 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
12254 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
12278 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (qfromQ!=0))
12345 if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12362 && (Lp.p->coef!=
NULL))
12366 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
12372 #ifdef HAVE_SHIFTBBA 12393 for (j=0; j<=
k; j++)
12395 if (!strat->
fromQ[j])
12408 for (j=0; j<=
k; j++)
12421 for (j=0; j<=
k; j++)
12446 #ifdef HAVE_SHIFTBBA 12459 if ( (!strat->
fromT)
12468 clearS(h,h_sev, &j,&k,strat);
12477 #ifdef HAVE_SHIFTBBA 12497 atT = strat->
posInT(strat->
T, strat->
tl, p);
12504 for (i=1; i<=toInsert; i++)
12519 atT = strat->
posInT(strat->
T, strat->
tl, qq);
12528 #ifdef HAVE_SHIFTBBA 12535 p = h = L->GetLmTailRing();
12537 return L->GetLmCurrRing();
12544 Ln.pLength = L->GetpLength() - 1;
12552 while(!Ln.IsNull())
12556 Ln.SetShortExpVector();
12562 With = &(strat->
T[
j]);
12567 if (With ==
NULL)
break;
12583 pNext(h) = Ln.LmExtractAndIter();
12586 }
while (!Ln.IsNull());
12589 if (Ln.IsNull())
goto all_done;
12590 if (! withT) With_s.Init(
currRing);
12592 pNext(h) = Ln.LmExtractAndIter();
12607 return L->GetLmCurrRing();
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
#define TEST_OPT_INFREDTAIL
#define __p_GetComp(p, r)
#define pSetmComp(p)
TODO:
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
static void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
int getIndexRng(long coeff)
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
denominator_list_s * denominator_list
int posInT_pLength(const TSet set, const int length, LObject &p)
#define omRealloc0Size(addr, o_size, size)
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
static 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,b,r) >=0
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...
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
KINLINE TObject ** initR()
const CanonicalForm int s
int posInTrg0(const TSet set, const int length, LObject &p)
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
void initSbaPos(kStrategy strat)
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int, int lV)
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
int itoInsert(poly p, int uptodeg, int lV, const ring r)
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
int redRing(LObject *h, kStrategy strat)
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
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.
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
void kBucketInit(kBucket_pt bucket, poly lm, int length)
static CanonicalForm bound(const CFMatrix &M)
int posInT2(const TSet set, const int length, LObject &p)
long pLDeg1(poly p, int *l, const ring r)
static int p_Cmp(poly p1, poly p2, ring r)
KINLINE unsigned long * initsevT()
#define TEST_OPT_DEGBOUND
void pLcmRat(poly a, poly b, poly m, int rat_shift)
void initBuchMoraPos(kStrategy strat)
void clearSbatch(poly h, int k, int pos, kStrategy strat)
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
pLDegProc pOrigLDeg_TailRing
#define idDelete(H)
delete an ideal
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
static int * initS_2_R(const int maxnr)
gmp_float exp(const gmp_float &a)
#define pLtCmpOrdSgnDiffM(p, q)
void messageStat(int hilbcount, kStrategy strat)
void postReduceByMonSig(LObject *h, kStrategy strat)
static int min(int a, int b)
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
static int si_min(const int a, const int b)
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
long pLDeg1c(poly p, int *l, const ring r)
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Compatiblity layer for legacy polynomial operations (over currRing)
int posInT1(const TSet set, const int length, LObject &p)
long totaldegreeWecart(poly p, ring r)
void chainCritNormal(poly p, int ecart, kStrategy strat)
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
void initBuchMora(ideal F, ideal Q, kStrategy strat)
static poly p_Mult_mm(poly p, poly m, const ring r)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
static void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static BOOLEAN rIsSyzIndexRing(const ring r)
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
poly prMoveR(poly &p, ring src_r, ring dest_r)
void reorderS(int *suc, kStrategy strat)
static int rGetCurrSyzLimit(const ring r)
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
static BOOLEAN rIsRatGRing(const ring r)
#define TEST_OPT_CONTENTSB
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
#define omFreeSize(addr, size)
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
void cleanTSbaRing(kStrategy strat)
static short rVar(const ring r)
#define rVar(r) (r->N)
static int pDivComp(poly p, poly q)
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int ksCheckCoeff(number *a, number *b)
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
void initSyzRules(kStrategy strat)
int posInT15Ring(const TSet set, const int length, LObject &p)
long pLDeg0c(poly p, int *l, const ring r)
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void initSL(ideal F, ideal Q, kStrategy strat)
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
void p_Lcm(const poly a, const poly b, poly m, const ring r)
static poly pp_Mult_mm(poly p, poly m, const ring r)
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case: ignore component
denominator_list DENOMINATOR_LIST
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
poly redtailBba_Z(LObject *L, int end_pos, kStrategy strat)
poly pMove2CurrTail(poly p, kStrategy strat)
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
#define pHasNotCF(p1, p2)
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
static long p_Totaldegree(poly p, const ring r)
void deleteInS(int i, kStrategy strat)
static BOOLEAN rField_is_Domain(const ring r)
pShallowCopyDeleteProc p_shallow_copy_delete
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
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 initSLSba(ideal F, ideal Q, kStrategy strat)
void cancelunit(LObject *L, BOOLEAN inNF)
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
static BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
static void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
long pLDeg1_Deg(poly p, int *l, const ring r)
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
static unsigned long * initsevS(const int maxnr)
ring rAssure_c_dp(const ring r)
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
int posInT15(const TSet set, const int length, LObject &p)
int(* red)(LObject *L, kStrategy strat)
void initBuchMoraPosRing(kStrategy strat)
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
int redHomog(LObject *h, kStrategy strat)
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
static poly redBba1(poly h, int maxIndex, kStrategy strat)
int(* posInT)(const TSet T, const int tl, LObject &h)
static number p_SetCoeff(poly p, number n, ring r)
void HEckeTest(poly pp, kStrategy strat)
#define omCheckBinAddrSize(addr, size)
poly p_Sub(poly p1, poly p2, const ring r)
void chainCritSig(poly p, int, kStrategy strat)
static void p_LmFree(poly p, ring)
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
#define pGetComp(p)
Component.
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
#define pLtCmpOrdSgnDiffP(p, q)
int posInT0(const TSet, const int length, LObject &)
int redFirstShift(LObject *h, kStrategy strat)
static poly p_Copy(poly p, const ring r)
returns a copy of p
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void enterExtendedSpoly(poly h, kStrategy strat)
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 ...
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
char completeReduce_retry
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
void kStratInitChangeTailRing(kStrategy strat)
static poly redBba(poly h, int maxIndex, kStrategy strat)
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
long pLDeg1c_Deg(poly p, int *l, const ring r)
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
void enterT(LObject &p, kStrategy strat, int atT)
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
int redHoney(LObject *h, kStrategy strat)
void p_Cleardenom_n(poly ph, const ring r, number &c)
poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
void deleteInL(LSet set, int *length, int j, kStrategy strat)
void updateSShift(kStrategy strat, int uptodeg, int lV)
#define pFalseReturn(cond)
BOOLEAN p_CheckPolyRing(poly p, ring r)
#define omReallocSize(addr, o_size, size)
void(* initEcart)(TObject *L)
#define pGetExp(p, i)
Exponent.
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
void initS(ideal F, ideal Q, kStrategy strat)
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
int posInT11(const TSet set, const int length, LObject &p)
static int rBlocks(ring r)
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
int posInT17_c(const TSet set, const int length, LObject &p)
long p_Deg(poly a, const ring r)
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
void chainCritRing(poly p, int, kStrategy strat)
int posInT11Ring(const TSet set, const int length, LObject &p)
KINLINE TObject * S_2_T(int i)
void kBucketDestroy(kBucket_pt *bucket_pt)
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
#define TEST_OPT_INTSTRATEGY
static void p_SetCompP(poly p, int i, ring r)
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define TEST_OPT_NOT_SUGAR
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 void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
const CanonicalForm CFMap CFMap & N
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...
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
static int max(int a, int b)
poly redtail(LObject *L, int end_pos, kStrategy strat)
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
long p_WFirstTotalDegree(poly p, const ring r)
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
void initEcartBBA(TObject *h)
int posInT17Ring(const TSet set, const int length, LObject &p)
void messageStatSBA(int hilbcount, kStrategy strat)
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
void enterOneZeroPairRing(poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
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:...
long pLDeg0(poly p, int *l, const ring r)
#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 pp_Test(p, lmRing, tailRing)
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
long kHomModDeg(poly p, ring r)
poly pMoveCurrTail2poly(poly p, kStrategy strat)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
static long p_FDeg(const poly p, const ring r)
static int p_LmCmp(poly p, poly q, const ring r)
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
#define pIsConstant(p)
like above, except that Comp might be != 0
void initBuchMoraCrit(kStrategy strat)
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
static int si_max(const int a, const int b)
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
#define __pp_Mult_nn(p, n, r)
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
void exitSba(kStrategy strat)
void rDebugPrint(const ring r)
void PrintS(const char *s)
poly redtailBbaBound(LObject *L, int end_pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize)
void kDebugPrint(kStrategy strat)
Output some debug info about a given strategy.
int isInV(poly p, int lV)
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
int posInT17(const TSet set, const int length, LObject &p)
static poly p_LmFreeAndNext(poly p, ring)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
void deleteInSSba(int i, kStrategy strat)
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
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...
omBin omGetStickyBinOfBin(omBin bin)
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
BOOLEAN rHasMixedOrdering(const ring r)
void enterT_strong(LObject &p, kStrategy strat, int atT)
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
static void enlargeL(LSet *L, int *length, const int incr)
static BOOLEAN _p_LmDivisibleByPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
static int index(p_Length length, p_Ord ord)
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
void rChangeCurrRing(ring r)
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
#define rRing_has_Comp(r)
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
static void p_Delete(poly *p, const ring r)
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...
unsigned long p_GetShortExpVector(const poly p, const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
void kMergeBintoLSba(kStrategy strat)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
void initenterzeropairsRing(poly p, int ecart, kStrategy strat, int atR)
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...
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
#define TEST_OPT_SUGARCRIT
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
void(* chainCrit)(poly p, int ecart, kStrategy strat)
void initPairtest(kStrategy strat)
long pLDegb(poly p, int *l, const ring r)
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
BOOLEAN p_CheckIsFromRing(poly p, ring r)
static BOOLEAN rField_is_Ring(const ring r)
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
void cleanT(kStrategy strat)
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
void pEnlargeSet(poly **p, int l, int increment)
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
int redEcart(LObject *h, kStrategy strat)
#define pLtCmpOrdSgnEqP(p, q)
BOOLEAN rHasGlobalOrdering(const ring r)
void rDelete(ring r)
unconditionally deletes fields in r
long ind_fact_2(long arg)
int posInSyz(const kStrategy strat, poly sig)
int posInT110(const TSet set, const int length, LObject &p)
#define pInit()
allocates a new monomial and initializes everything to 0
static BOOLEAN length(leftv result, leftv arg)
#define TEST_OPT_CANCELUNIT
void initSbaCrit(kStrategy strat)
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
#define omSizeWOfBin(bin_ptr)
void updateS(BOOLEAN toT, kStrategy strat)
int posInT110Ring(const TSet set, const int length, LObject &p)
static bool rIsSCA(const ring r)
void completeReduce(kStrategy strat, BOOLEAN withT)
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
#define REDTAIL_CANONICALIZE
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
BOOLEAN kCheckStrongCreation(int atR, poly m1, int atS, poly m2, kStrategy strat)
void chainCritOpt_1(poly, int, kStrategy strat)
void rKillModifiedRing(ring r)
long maxdegreeWecart(poly p, int *l, ring r)
static void p_Setm(poly p, const ring r)
void updateResult(ideal r, ideal Q, kStrategy strat)
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
KINLINE TObject * s_2_t(int i)
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
int redFirst(LObject *h, kStrategy strat)
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
static nc_type & ncRingType(nc_struct *p)
static intset initec(const int maxnr)
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
static int pDivCompRing(poly p, poly q)
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
poly pCopyL2p(LObject H, kStrategy strat)
int idElem(const ideal F)
count non-zero elements
int dReportError(const char *fmt,...)
char posInLDependsOnLength
#define ALLOW_PROD_CRIT(A)
static poly p_Neg(poly p, const ring r)
static void p_LmDelete(poly p, const ring r)
BOOLEAN isInPairsetB(poly q, int *k, kStrategy strat)
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
long p_WTotaldegree(poly p, const ring r)
static poly redMora(poly h, int maxIndex, kStrategy strat)
void kMergeBintoL(kStrategy strat)
void p_wrp(poly p, ring lmRing, ring tailRing)
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
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
BOOLEAN newHEdge(kStrategy strat)
int posInT19(const TSet set, const int length, LObject &p)
poly redtailBbaShift(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
void initEcartNormal(TObject *h)
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
static LSet initL(int nr=setmaxL)
static poly p_Add_q(poly p, poly q, const ring r)
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
KINLINE poly kNoetherTail()
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
poly p_Cleardenom(poly p, const ring r)
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
void chainCritPart(poly p, int ecart, kStrategy strat)
void nKillChar(coeffs r)
undo all initialisations
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
static poly p_Mult_q(poly p, poly q, const ring r)
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
void exitBuchMora(kStrategy strat)
pFDegProc pOrigFDeg_TailRing
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
#define ENTER_USE_MEMMOVE
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
int posInT17_cRing(const TSet set, const int length, LObject &p)
int posInT13(const TSet set, const int length, LObject &p)
void enterSyz(LObject &p, kStrategy strat, int atT)
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
#define pCopy(p)
return a copy of the poly
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
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...
int posInLSigRing(const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)
KINLINE long GetpFDeg() const