42 #define ENTER_USE_MEMMOVE
84 #ifdef ENTER_USE_MYMEMMOVE
85 inline void _my_memmove_d_gt_s(
unsigned long* d,
unsigned long*
s,
long l)
87 register unsigned long* _dl = (
unsigned long*) d;
88 register unsigned long* _sl = (
unsigned long*) s;
89 register long _i = l - 1;
99 inline void _my_memmove_d_lt_s(
unsigned long* d,
unsigned long*
s,
long l)
101 register long _ll =
l;
102 register unsigned long* _dl = (
unsigned long*) d;
103 register unsigned long* _sl = (
unsigned long*) s;
104 register long _i = 0;
114 inline void _my_memmove(
void* d,
void* s,
long l)
116 unsigned long _d = (
unsigned long) d;
117 unsigned long _s = (
unsigned long) s;
118 unsigned long _l = ((
l) + SIZEOF_LONG - 1) >> LOG_SIZEOF_LONG;
120 if (_d > _s) _my_memmove_d_gt_s(_d, _s, _l);
121 else _my_memmove_d_lt_s(_d, _s, _l);
125 #define memmove(d,s,l) _my_memmove(d, s, l)
132 #define pDivComp_EQUAL 2
133 #define pDivComp_LESS 1
134 #define pDivComp_GREATER -1
135 #define pDivComp_INCOMP 0
147 unsigned long la, lb;
148 unsigned long divmask =
currRing->divmask;
149 for (i=0; i<
currRing->VarL_Size; i++)
158 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
165 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
195 unsigned long la, lb;
196 unsigned long divmask =
currRing->divmask;
197 for (i=0; i<
currRing->VarL_Size; i++)
206 if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
213 if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
220 if (b) {
return -1; }
241 poly p = L->GetLmTailRing();
244 if (L->bucket !=
NULL)
282 L->ecart = L->pLDeg() - L->GetpFDeg();
291 L->ecart = L->pLDeg(strat->
LDegLast) - L->GetpFDeg();
333 ring
r = L->tailRing;
334 poly p = L->GetLmTailRing();
406 if (i == r->N)
break;
461 inline static unsigned long*
initsevS (
const int maxnr)
463 return (
unsigned long*)
omAlloc0(maxnr*
sizeof(
unsigned long));
467 return (
int*)
omAlloc0(maxnr*
sizeof(
int));
471 int &length,
const int incr)
476 assume((length+incr) > 0);
480 (length+incr)*
sizeof(
TObject));
482 sevT = (
unsigned long*)
omReallocSize(sevT, length*
sizeof(
long*),
483 (length+incr)*
sizeof(
long*));
486 (length+incr)*
sizeof(
TObject*));
487 for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
502 for (j=0; j<=strat->
tl; j++)
506 if (strat->
T[j].max !=
NULL)
516 if (strat->
T[j].t_p !=
NULL)
525 if (p == strat->
S[i])
527 if (strat->
T[j].t_p !=
NULL)
551 assume(((*length)+incr)>0);
554 ((*length)+incr)*
sizeof(
LObject));
574 if ((*k) < 0)
return FALSE;
575 if (((p1 == (*p).p1) && (p2 == (*p).p2))
576 || ((p1 == (*p).p2) && (p2 == (*p).p1)))
595 if ((*k) < 0)
return FALSE;
607 for (i=0; i<=tlength; i++)
609 if (T[i].p == p)
return i;
620 if (i >= 0)
return i;
623 while (strat !=
NULL);
636 #define kFalseReturn(x) do { if (!x) return FALSE;} while (0)
642 for (i=1; i<=tailRing->N; i++)
645 return "Lm[i] different";
648 return "Lm[0] different";
650 return "Lm.next different";
652 return "Lm.coeff different";
659 ring tailRing = T->tailRing;
661 r_assume(strat_tailRing == tailRing);
666 if (T->p ==
NULL && T->t_p ==
NULL && i >= 0)
671 if (T->t_p ==
NULL && i > 0)
677 const char* msg = kTest_LmEqual(T->p, T->t_p, T->tailRing);
688 if (T->t_p !=
NULL && i >= 0 && TN ==
'T')
693 return dReportError(
"%c[%d].max is not NULL as it should be", TN, i);
700 return dReportError(
"pNext(%c[%d].max) != NULL", TN, i);
709 p_Setm(test_max, tailRing);
722 return dReportError(
"%c[%d].max != NULL but tailRing == currRing",TN,i);
724 return dReportError(
"%c[%d].t_p != NULL but tailRing == currRing",TN,i);
725 if (T->p ==
NULL && i > 0)
730 if ((i >= 0) && (T->pLength != 0)
735 return dReportError(
"%c[%d] pLength error: has %d, specified to have %d",
740 if (i >= 0 && (TN ==
'T' || TN ==
'L'))
743 if (T->FDeg != T->pFDeg())
747 return dReportError(
"%c[%d] FDeg error: has %d, specified to have %d",
748 TN, i , T->pFDeg(), d);
753 if (i >= 0 && TN ==
'T')
768 if (L->bucket !=
NULL)
770 kFalseReturn(
kbTest(L->bucket));
771 r_assume(L->bucket->bucket_ring == L->tailRing);
778 kFalseReturn(
kTest_T(L, strat_tailRing, lpos,
'L'));
787 return dReportError(
"L[%d] wrong sev: has %o, specified to have %o",
796 else if (tlength > 0 && T !=
NULL && (lpos >=0))
817 -1, strat->
T, strat->
tl));
820 if (strat->
T !=
NULL)
822 for (i=0; i<=strat->
tl; i++)
831 if (strat->
L !=
NULL)
833 for (i=0; i<=strat->
Ll; i++)
836 strat->
L[i].Next() != strat->
tail,
i,
837 strat->
T, strat->
tl));
848 if (strat->
S !=
NULL)
858 for (i=0; i<=strat->
sl; i++)
860 if (strat->
S[i] !=
NULL &&
863 return dReportError(
"S[%d] wrong sev: has %o, specified to have %o",
876 kFalseReturn(
kTest(strat));
879 for (i=0; i<=strat->
tl; i++)
881 if (strat->
T[i].i_r < 0 || strat->
T[i].i_r > strat->
tl)
882 return dReportError(
"strat->T[%d].i_r == %d out of bounds", i,
884 if (strat->
R[strat->
T[i].i_r] != &(strat->
T[i]))
888 if (strat->
S !=
NULL)
890 for (i=0; i<=strat->
sl; i++)
895 if (strat->
S_2_R[i] != strat->
T[j].i_r)
897 i, strat->
S_2_R[i], j, strat->
T[j].i_r);
901 for (i=0; i<=strat->
Ll; i++)
903 if (strat->
L[i].p1 !=
NULL && strat->
L[i].p2)
905 if (strat->
L[i].i_r1 < 0 ||
906 strat->
L[i].i_r1 > strat->
tl ||
907 strat->
L[i].T_1(strat)->p != strat->
L[
i].p1)
909 if (strat->
L[i].i_r2 < 0 ||
910 strat->
L[i].i_r2 > strat->
tl ||
911 strat->
L[i].T_2(strat)->p != strat->
L[
i].p2)
916 if (strat->
L[i].i_r1 != -1)
918 if (strat->
L[i].i_r2 != -1)
921 if (strat->
L[i].i_r != -1)
934 #ifdef ENTER_USE_MEMMOVE
935 memmove(&(strat->
S[i]), &(strat->
S[i+1]), (strat->
sl - i)*
sizeof(
poly));
936 memmove(&(strat->
ecartS[i]),&(strat->
ecartS[i+1]),(strat->
sl - i)*
sizeof(
int));
937 memmove(&(strat->
sevS[i]),&(strat->
sevS[i+1]),(strat->
sl - i)*
sizeof(
unsigned long));
938 memmove(&(strat->
S_2_R[i]),&(strat->
S_2_R[i+1]),(strat->
sl - i)*
sizeof(
int));
941 for (j=i; j<strat->
sl; j++)
943 strat->
S[
j] = strat->
S[j+1];
951 #ifdef ENTER_USE_MEMMOVE
952 memmove(&(strat->
lenS[i]),&(strat->
lenS[i+1]),(strat->
sl - i)*
sizeof(
int));
954 for (j=i; j<strat->
sl; j++) strat->
lenS[j] = strat->
lenS[j+1];
959 #ifdef ENTER_USE_MEMMOVE
962 for (j=i; j<strat->
sl; j++) strat->
lenSw[j] = strat->
lenSw[j+1];
967 #ifdef ENTER_USE_MEMMOVE
968 memmove(&(strat->
fromQ[i]),&(strat->
fromQ[i+1]),(strat->
sl - i)*
sizeof(
int));
970 for (j=i; j<strat->
sl; j++)
986 #ifdef ENTER_USE_MEMMOVE
987 memmove(&(strat->
S[i]), &(strat->
S[i+1]), (strat->
sl - i)*
sizeof(
poly));
988 memmove(&(strat->
sig[i]), &(strat->
sig[i+1]), (strat->
sl - i)*
sizeof(
poly));
989 memmove(&(strat->
ecartS[i]),&(strat->
ecartS[i+1]),(strat->
sl - i)*
sizeof(
int));
990 memmove(&(strat->
sevS[i]),&(strat->
sevS[i+1]),(strat->
sl - i)*
sizeof(
unsigned long));
991 memmove(&(strat->
sevSig[i]),&(strat->
sevSig[i+1]),(strat->
sl - i)*
sizeof(
unsigned long));
992 memmove(&(strat->
S_2_R[i]),&(strat->
S_2_R[i+1]),(strat->
sl - i)*
sizeof(
int));
995 for (j=i; j<strat->
sl; j++)
997 strat->
S[
j] = strat->
S[j+1];
998 strat->
sig[
j] = strat->
sig[j+1];
1007 #ifdef ENTER_USE_MEMMOVE
1008 memmove(&(strat->
lenS[i]),&(strat->
lenS[i+1]),(strat->
sl - i)*
sizeof(
int));
1010 for (j=i; j<strat->
sl; j++) strat->
lenS[j] = strat->
lenS[j+1];
1015 #ifdef ENTER_USE_MEMMOVE
1018 for (j=i; j<strat->
sl; j++) strat->
lenSw[j] = strat->
lenSw[j+1];
1023 #ifdef ENTER_USE_MEMMOVE
1024 memmove(&(strat->
fromQ[i]),&(strat->
fromQ[i+1]),(strat->
sl - i)*
sizeof(
int));
1026 for (j=i; j<strat->
sl; j++)
1050 if (set[j].sig!=
NULL)
1082 if (*length > 0 && j < *length)
1084 #ifdef ENTER_USE_MEMMOVE
1085 memmove(&(set[j]), &(set[j+1]), (*length - j)*
sizeof(
LObject));
1088 for (i=j; i < (*length); i++)
1093 memset(&(set[*length]),0,
sizeof(
LObject));
1104 assume(p.FDeg == p.pFDeg());
1109 if (at <= (*length))
1111 memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*
sizeof(
LObject));
1113 for (i=(*length)+1; i>=at+1; i--) (*set)[
i] = (*set)[i-1];
1127 h->FDeg = h->pFDeg();
1128 h->ecart = h->pLDeg() - h->FDeg;
1130 h->length=h->pLength=
pLength(h->p);
1135 h->FDeg = h->pFDeg();
1137 h->length=h->pLength=
pLength(h->p);
1142 Lp->FDeg = Lp->pFDeg();
1149 Lp->FDeg = Lp->pFDeg();
1150 (*Lp).ecart =
si_max(ecartF,ecartG);
1151 (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -
p_FDeg((*Lp).lcm,
currRing));
1160 return (ecart1 <= ecart2);
1170 int l,
j,compare,compareCoeff;
1175 Lp.ecart=0; Lp.length=0;
1191 PrintS(
"--- Lp.lcm == 0\n");
1194 Print(
" strat->S[%d]:", i);
1204 pLcm(p,strat->
S[i],Lp.lcm);
1218 PrintS(
"--- product criterion func enterOnePairRing type 1\n");
1221 Print(
" strat->S[%d]:", i);
1237 for(j = strat->
Bl;j>=0;j--)
1241 if ((compareCoeff ==
pDivComp_EQUAL) || (compare == compareCoeff))
1249 PrintS(
"--- chain criterion type 1\n");
1251 wrp(strat->
B[j].lcm);
1257 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1264 else if (compare == -1)
1269 PrintS(
"--- chain criterion type 2\n");
1270 Print(
"strat->B[%d].lcm:",j);
1271 wrp(strat->
B[j].lcm);
1288 PrintS(
"--- chain criterion type 3\n");
1289 Print(
"strat->B[%d].lcm:", j);
1290 wrp(strat->
B[j].lcm);
1297 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1311 PrintS(
"--- chain criterion type 4\n");
1312 Print(
"strat->B[%d].lcm:", j);
1313 wrp(strat->
B[j].lcm);
1333 PrintS(
"--- spoly = NULL\n");
1339 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
1343 WarnS(
"Could we come here? 8738947389");
1355 PrintS(
"--- spoly = NULL\n");
1377 Lp.p1 = strat->
S[
i];
1385 Lp.i_r1 = strat->
S_2_R[
i];
1388 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
1420 memset(&(strat->
P), 0,
sizeof(strat->
P));
1422 strat->
P = *(strat->
R[atR]);
1444 PrintS(
"\n--- create strong gcd poly: ");
1445 Print(
"\n p: %d", i);
1447 Print(
"\n strat->S[%d]: ", i);
1474 posx = strat->
posInL(strat->
L,strat->
Ll,&h,strat);
1500 Lp.ecart=0; Lp.length=0;
1505 #ifndef HAVE_RATGRING
1506 pLcm(p,strat->
S[i],Lp.lcm);
1507 #elif defined(HAVE_RATGRING)
1516 if((!((strat->
ecartS[i]>0)&&(ecart>0)))
1558 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
1563 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1620 for(j = strat->
Bl;j>=0;j--)
1622 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
1626 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (strat->
fromQ[i]==0))
1652 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
1697 PrintS(
"enterOnePairNormal::\n strat->S[i]: ");
pWrite(strat->
S[i]);
1712 PrintS(
"enterOnePairNormal::\n strat->S[i]: ");
pWrite(strat->
S[i]);
1741 Lp.p1 = strat->
S[
i];
1755 Lp.i_r1 = strat->
S_2_R[
i];
1771 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
1796 unsigned long pSigMultNegSev,sSigMultNegSev;
1800 Lp.ecart=0; Lp.length=0;
1805 #ifndef HAVE_RATGRING
1806 pLcm(p,strat->
S[i],Lp.lcm);
1807 #elif defined(HAVE_RATGRING)
1835 Print(
"----------------\n");
1838 Print(
"----------------\n");
1844 Print(
"IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
1863 if ( strat->
syzCrit(pSigMult,pSigMultNegSev,strat) ||
1864 strat->
syzCrit(sSigMult,sSigMultNegSev,strat)
1865 || strat->
rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
1886 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (strat->
fromQ[i]!=0))
1931 PrintS(
"enterOnePairNormal::\n strat->S[i]: ");
pWrite(strat->
S[i]);
1946 PrintS(
"enterOnePairNormal::\n strat->S[i]: ");
pWrite(strat->
S[i]);
1961 Lp.sevSig = ~pSigMultNegSev;
1968 Lp.sevSig = ~sSigMultNegSev;
1979 if (strat->
rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->
sl+1)) {
1993 Lp.checked = strat->
sl+1;
1999 Lp.prod_crit =
TRUE;
2012 PrintS(
"SIGNATURE OF PAIR: ");
2016 Lp.p1 = strat->
S[
i];
2030 Lp.i_r1 = strat->
S_2_R[
i];
2074 pLcm(p,strat->
S[i],Lp.lcm);
2076 for(j = strat->
Ll;j>=0;j--)
2078 compare=
pDivComp(strat->
L[j].lcm,Lp.lcm);
2079 if ((compare==1) || (
pLmEqual(strat->
L[j].lcm,Lp.lcm)))
2086 else if (compare ==-1)
2112 Lp.p1 = strat->
S[
i];
2116 Lp.i_r1 = strat->
S_2_R[
i];
2131 l = strat->
posInL(strat->
L,strat->
Ll,&Lp,strat);
2142 int j=strat->
Ll+strat->
Bl+1;
2152 for (i=strat->
Bl; i>=0; i--)
2154 j = strat->
posInL(strat->
L,j,&(strat->
B[i]),strat);
2165 int j=strat->
Ll+strat->
Bl+1;
2175 for (i=strat->
Bl; i>=0; i--)
2177 j = strat->
posInLSba(strat->
L,j,&(strat->
B[i]),strat);
2199 for (j=0; j<=strat->
sl; j++)
2203 for (i=strat->
Bl; i>=0; i--)
2226 for (j=strat->
Ll; j>=0; j--)
2232 if (strat->
L[j].p == strat->
tail)
2252 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
2278 for (j=strat->
Ll; j>=0; j--)
2298 for(i=j-1; i>=0; i--)
2300 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
2317 for (j=strat->
Ll; j>=0; j--)
2348 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
2351 if (strat->
L[j].p2 == p)
2357 if ((strat->
L[i].p2 == p) &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
2371 strat->
L[
i].p2 = strat->
tail;
2388 else if (strat->
L[j].p2 == strat->
tail)
2411 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
2414 if (strat->
L[j].p2 == p)
2420 if ((strat->
L[i].p2 == p) &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
2434 strat->
L[
i].p2 = strat->
tail;
2451 else if (strat->
L[j].p2 == strat->
tail)
2459 #ifdef HAVE_RATGRING
2473 for (j=0; j<=strat->
sl; j++)
2477 for (i=strat->
Bl; i>=0; i--)
2485 Print(
"chain-crit-part: S[%d]=",j);
2487 Print(
" divide B[%d].lcm=",i);
2510 for (j=strat->
Ll; j>=0; j--)
2516 if (strat->
L[j].p == strat->
tail)
2520 PrintS(
"chain-crit-part: pCompareChainPart p=");
2522 Print(
" delete L[%d]",j);
2544 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
2551 Print(
"chain-crit-part: sugar B[%d].lcm=",j);
2553 Print(
" delete B[%d]",i);
2564 Print(
"chain-crit-part: sugar B[%d].lcm=",i);
2566 Print(
" delete B[%d]",j);
2586 for (j=strat->
Ll; j>=0; j--)
2594 PrintS(
"chain-crit-part: sugar:pCompareChainPart p=");
2596 Print(
" delete L[%d]",j);
2614 for(i=j-1; i>=0; i--)
2616 if (
pLmEqual(strat->
B[j].lcm,strat->
B[i].lcm))
2620 Print(
"chain-crit-part: equal lcm B[%d].lcm=",j);
2622 Print(
" delete B[%d]\n",i);
2639 for (j=strat->
Ll; j>=0; j--)
2647 PrintS(
"chain-crit-part: pCompareChainPart p=");
2649 Print(
" delete L[%d]",j);
2678 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
2681 if (strat->
L[j].p2 == p)
2687 if ((strat->
L[i].p2 == p) &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
2704 strat->
L[
i].p2 = strat->
tail;
2711 PrintS(
"chain-crit-part: divisible_by p=");
2713 Print(
" delete L[%d]",l);
2724 PrintS(
"chain-crit-part: divisible_by(2) p=");
2726 Print(
" delete L[%d]",i);
2737 else if (strat->
L[j].p2 == strat->
tail)
2765 for (j=0; j<=
k; j++)
2767 if (!strat->
fromQ[j])
2778 for (j=0; j<=
k; j++)
2781 PrintS(
"\n initenterpairs: \n");
2792 for (j=0; j<=
k; j++)
2806 #ifdef HAVE_RATGRING
2834 for (j=0; j<=
k; j++)
2836 if (!strat->
fromQ[j])
2847 for (j=0; j<=
k; j++)
2856 for (j=0; j<=
k; j++)
2870 #ifdef HAVE_RATGRING
2897 for (j=0; j<=strat->
sl; j++)
2901 for (i=strat->
Bl; i>=0; i--)
2908 PrintS(
"--- chain criterion func chainCritRing type 1\n");
2911 PrintS(
" strat->B[i].lcm:");
2912 wrp(strat->
B[i].lcm);
2927 for (j=strat->
Ll; j>=0; j--)
2940 PrintS(
"--- chain criterion func chainCritRing type 2\n");
2941 PrintS(
"strat->L[j].p:");
2972 if (strat->
L[0].p2 == strat->
tail) strat->
L[0].p2 =
p;
2975 if (strat->
L[j].p2 == p)
2983 &&
pLmEqual(strat->
L[j].lcm,strat->
L[i].lcm))
2990 PrintS(
"--- chain criterion func chainCritRing type 3\n");
2991 PrintS(
"strat->L[j].lcm:");
2992 wrp(strat->
L[j].lcm);
2993 PrintS(
" strat->L[i].lcm:");
2994 wrp(strat->
L[i].lcm);
3008 strat->
L[
i].p2 = strat->
tail;
3025 else if (strat->
L[j].p2 == strat->
tail)
3039 if (arg <= 0)
return 0;
3051 if (arg <= 0)
return 0;
3052 if (arg%2 == 1) { arg--; }
3062 #ifdef HAVE_VANIDEAL
3073 int l,
j,compare,compareCoeff;
3078 Lp.ecart=0; Lp.length=0;
3094 for(j = strat->
Bl;j>=0;j--)
3098 if (compareCoeff == 0 || compare == compareCoeff)
3116 if (compareCoeff == 1)
3123 if (compareCoeff == -1)
3134 if ((f==
NULL) || (p==
NULL))
return;
3166 tmp_h.SetShortExpVector();
3171 enterT(tmp_h, strat, strat->
tl + 1);
3176 Lp.i_r1 = strat->
tl;
3180 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
3194 if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
3203 if (N == 1)
return 0;
3205 while (exp[i] == cexp[i] && i <= N) i++;
3207 *cabsind -= cind[
i];
3210 *cabsind += cind[
i];
3213 if (i > N)
return 0;
3217 for (
int j = i + 1; j <=
N; j++)
3219 if (step[1] > step[j]) step[1] = step[
j];
3221 add =
ind2(cexp[i] + 2);
3222 if (*cabsind - step[1] + add >= bound)
3225 *cabsind -= cind[
i];
3227 *cabsind += cind[
i];
3230 if (i > N)
return 0;
3233 }
while (step[1] != -1);
3238 if (add < step[i]) step[
i] =
add;
3239 for (i = 2; i <=
N; i++)
3241 if (step[1] > step[i]) step[1] = step[
i];
3267 for (
int i = 1; i <= leadRing->N; i++)
3273 if (cabsind < leadRing->ch)
3275 zeroPoly =
p_ISet(
twoPow(leadRing->ch - cabsind), tailRing);
3279 zeroPoly =
p_ISet(1, tailRing);
3281 for (
int i = 1; i <= leadRing->N; i++)
3283 for (
long j = 1; j <= exp[
i]; j++)
3286 tmp2 =
p_ISet(1, tailRing);
3291 zeroPoly =
p_Mult_q(zeroPoly, tmp2, tailRing);
3296 zeroPoly =
p_Mult_q(zeroPoly,
p_Add_q(tmp3, tmp2, tailRing), tailRing);
3301 for (
int i = 1; i <= leadRing->N; i++)
3307 zeroPoly =
pNext(zeroPoly);
3309 pNext(tmp2) = zeroPoly;
3330 for (
int i = 1; i <=
currRing->N; i++)
3333 if (exp[i] & 1 != 0)
3335 exp[
i] = exp[
i] - 1;
3348 PrintS(
"-------------\npoly :");
3350 Print(
"\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3351 Print(
"cexp : (%d, %d)\n", cexp[1], cexp[2]);
3352 Print(
"cind : (%d, %d)\n", cind[1], cind[2]);
3354 Print(
"cind : %d\n", cabsind);
3371 Print(
"%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3396 for (
int i = 1; i <=
currRing->N; i++)
3407 PrintS(
"-------------\npoly :");
3409 Print(
"\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3410 Print(
"cexp : (%d, %d)\n", cexp[1], cexp[2]);
3411 Print(
"cind : (%d, %d)\n", cind[1], cind[2]);
3412 Print(
"bound : %d\n", bound);
3413 Print(
"cind : %d\n", cabsind);
3431 Print(
"%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3439 G0->m[
IDELEMS(G0) - 1] = zeroPoly;
3453 const unsigned long iCompH =
pGetComp(h);
3458 for (j=0; j<=
k; j++)
3515 PrintS(
"--- create zero spoly: ");
3553 posx = strat->
posInL(strat->
L,strat->
Ll,&h,strat);
3576 if ( (!strat->
fromT)
3586 clearS(h,h_sev, &j,&k,strat);
3600 PrintS(
"\nEnter superenterpairs\n");
3601 int iii = strat->
Ll;
3609 PrintS(
"\n enterExtendedSpoly has not changed the list L.\n");
3614 PrintS(
"\n enterExtendedSpoly changed the list L:\n");
3615 for(iii=0;iii<=strat->
Ll;iii++)
3617 Print(
"\n L[%d]:\n",iii);
3629 PrintS(
"\n initenterpairs has not changed the list L.\n");
3633 PrintS(
"\n initenterpairs changed the list L:\n");
3634 for(iii=0;iii<=strat->
Ll;iii++)
3636 Print(
"\n L[%d]:\n",iii);
3648 PrintS(
"\n initenterstrongPairs has not changed the list L.\n");
3652 PrintS(
"\n initenterstrongPairs changed the list L:\n");
3653 for(iii=0;iii<=strat->
Ll;iii++)
3655 Print(
"\n L[%d]:\n",iii);
3661 PrintS(
"\nEnd of superenterpairs\n");
3680 if ( (!strat->
fromT)
3689 clearS(h,h_sev, &j,&k,strat);
3712 if ( (!strat->
fromT)
3721 clearS(h,h_sev, &j,&k,strat);
3741 for (j=0; j<=
k; j++)
3743 const int iCompSj =
pGetComp(strat->
S[j]);
3744 if ((iCompH==iCompSj)
3755 for (j=0; j<=
k; j++)
3757 const int iCompSj =
pGetComp(strat->
S[j]);
3758 if ((iCompH==iCompSj)
3796 clearS(h,h_sev,&j,&k,strat);
3809 int i,
j,at,ecart, s2r;
3813 int new_suc=strat->
sl+1;
3817 for (; i<=strat->
sl; i++)
3822 if (new_suc > at) new_suc = at;
3825 sev = strat->
sevS[
i];
3828 for (j=i; j>=at+1; j--)
3830 strat->
S[
j] = strat->
S[j-1];
3836 strat->
ecartS[at] = ecart;
3837 strat->
sevS[at] = sev;
3838 strat->
S_2_R[at] = s2r;
3841 for (j=i; j>=at+1; j--)
3845 strat->
fromQ[at]=fq;
3849 if (new_suc <= strat->sl) *suc=new_suc;
3863 if(length==-1)
return 0;
3882 || ((o==oo) && (
pLmCmp(set[length],p)!= cmp_int)))
3905 if (
pLmCmp(set[length],p)== -cmp_int)
3913 if (cmp == cmp_int)
return an;
3914 if (cmp == -cmp_int)
return en;
3920 if (cmp == cmp_int) en =
i;
3921 else if (cmp == -cmp_int) an =
i;
3931 if (
pLmCmp(set[length],p)== -cmp_int)
3938 if (
pLmCmp(set[an],p) == cmp_int)
return an;
3939 if (
pLmCmp(set[an],p) == -cmp_int)
return en;
3941 && ((strat->
ecartS[an])>ecart_p))
3946 if (
pLmCmp(set[i],p) == cmp_int) en=i;
3947 else if (
pLmCmp(set[i],p) == -cmp_int) an=i;
3951 &&((strat->
ecartS[
i])<ecart_p))
3978 if (length==-1)
return 0;
3980 if (
pLmCmp(set[length].p,p.p)!=
currRing->OrdSgn)
return length+1;
4009 if (set[length].length<p.length)
4020 if (set[an].length>p.length)
return an;
4024 if (set[i].length>p.length) en=
i;
4053 if (length==-1)
return 0;
4055 int o = p.GetpFDeg();
4056 int op = set[length].GetpFDeg();
4059 || ((op == o) && (
pLmCmp(set[length].p,p.p) !=
currRing->OrdSgn)))
4070 op= set[an].GetpFDeg();
4077 op = set[
i].GetpFDeg();
4093 if (length==-1)
return 0;
4094 int o = p.GetpFDeg();
4095 int op = set[length].GetpFDeg();
4100 if ((op < o) || (
pLmCmp(set[length].p,p.p)== -cmp_int))
4107 op = set[an].GetpFDeg();
4108 if (op > o)
return an;
4109 if (op < 0)
return en;
4110 cmp =
pLmCmp(set[an].p,p.p);
4111 if (cmp == cmp_int)
return an;
4112 if (cmp == -cmp_int)
return en;
4117 op = set[
i].GetpFDeg();
4119 else if (op < o) an =
i;
4122 cmp =
pLmCmp(set[i].p,p.p);
4123 if (cmp == cmp_int) en =
i;
4124 else if (cmp == -cmp_int) an =
i;
4170 if (length==-1)
return 0;
4172 int o = p.GetpFDeg();
4173 int op = set[length].GetpFDeg();
4176 || (( op == o) && (set[length].length<p.length))
4177 || (( op == o) && (set[length].length == p.length)
4188 op = set[an].GetpFDeg();
4190 || (( op == o) && (set[an].length > p.length))
4191 || (( op == o) && (set[an].length == p.length)
4197 op = set[
i].GetpFDeg();
4199 || (( op == o) && (set[i].length > p.length))
4200 || (( op == o) && (set[i].length == p.length)
4215 if (length==-1)
return 0;
4217 int o = p.GetpFDeg();
4219 if (set[length].GetpFDeg() <= o)
4229 if (set[an].GetpFDeg() > o)
4234 if (set[i].GetpFDeg() > o)
4244 int ol = p.GetpLength();
4245 if (length==-1)
return 0;
4249 int oo=set[length].ecart;
4250 if ((oo < op) || ((oo==op) && (set[length].length < ol)))
4260 int oo=set[an].ecart;
4262 || ((oo==op) && (set[an].
pLength > ol)))
4267 int oo=set[
i].ecart;
4269 || ((oo == op) && (set[i].
pLength > ol)))
4301 if (length==-1)
return 0;
4303 int o = p.GetpFDeg() + p.ecart;
4304 int op = set[length].GetpFDeg()+set[length].ecart;
4318 op = set[an].GetpFDeg()+set[an].ecart;
4325 op = set[
i].GetpFDeg()+set[
i].ecart;
4361 if (length==-1)
return 0;
4363 int o = p.GetpFDeg() + p.ecart;
4364 int op = set[length].GetpFDeg()+set[length].ecart;
4367 || (( op == o) && (set[length].ecart > p.ecart))
4368 || (( op == o) && (set[length].ecart==p.ecart)
4379 op = set[an].GetpFDeg()+set[an].ecart;
4381 || (( op == o) && (set[an].ecart < p.ecart))
4382 || (( op == o) && (set[an].ecart==p.ecart)
4388 op = set[
i].GetpFDeg()+set[
i].ecart;
4390 || (( op == o) && (set[i].ecart < p.ecart))
4391 || (( op == o) && (set[i].ecart == p.ecart)
4405 if (length==-1)
return 0;
4409 int o = p.GetpFDeg() + p.ecart;
4410 unsigned long c =
pGetComp(p.p)*cc;
4412 if (
pGetComp(set[length].p)*cc < c)
4414 if (
pGetComp(set[length].p)*cc == c)
4416 int op = set[length].GetpFDeg()+set[length].ecart;
4418 || ((op == o) && (set[length].ecart > p.ecart))
4419 || ((op == o) && (set[length].ecart==p.ecart)
4435 int op = set[an].GetpFDeg()+set[an].ecart;
4437 || ((op == o) && (set[an].ecart < p.ecart))
4438 || ((op == o) && (set[an].ecart==p.ecart)
4447 else if (
pGetComp(set[i].p)*cc == c)
4449 int op = set[
i].GetpFDeg()+set[
i].ecart;
4451 || ((op == o) && (set[i].ecart < p.ecart))
4452 || ((op == o) && (set[i].ecart == p.ecart)
4471 if (length==-1)
return 0;
4474 int op=p.GetpFDeg();
4476 if (set[length].ecart < o)
4478 if (set[length].ecart == o)
4480 int oo=set[length].GetpFDeg();
4481 if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
4492 if (set[an].ecart > o)
4494 if (set[an].ecart == o)
4496 int oo=set[an].GetpFDeg();
4498 || ((oo==op) && (set[an].length > p.length)))
4504 if (set[i].ecart > o)
4506 else if (set[i].ecart == o)
4508 int oo=set[
i].GetpFDeg();
4510 || ((oo == op) && (set[i].length > p.length)))
4528 if (length<0)
return 0;
4530 int d=p->GetpFDeg();
4531 int op=set[length].GetpFDeg();
4534 || ((op == d) && (p->p1!=
NULL)&&(set[length].p1==
NULL))
4545 op=set[an].GetpFDeg();
4547 || ((op == d) && (p->p1!=
NULL) && (set[an].p1==
NULL))
4553 op=set[
i].GetpFDeg();
4555 || ((op==d) && (p->p1!=
NULL) && (set[i].p1==
NULL))
4571 if (length<0)
return 0;
4602 if (length<0)
return 0;
4626 if (strat->
syzl==0)
return 0;
4631 int en= strat->
syzl-1;
4684 if (length<0)
return 0;
4686 int o = p->GetpFDeg();
4687 int op = set[length].GetpFDeg();
4690 || ((op == o) && (
pLmCmp(set[length].p,p->p) != -
currRing->OrdSgn)))
4699 op = set[an].GetpFDeg();
4706 op = set[
i].GetpFDeg();
4723 if (coeff == 0)
return -1;
4726 while (tmp % 2 == 0)
4745 if (length < 0)
return 0;
4747 int o = p->GetpFDeg();
4748 int op = set[length].GetpFDeg();
4750 if ((op > o) || ((op == o) && (
pLmCmp(set[length].p,p->p) != -
currRing->OrdSgn)))
4759 op = set[an].GetpFDeg();
4760 if ((op > o) || ((op == o) && (
pLmCmp(set[an].p,p->p) != -
currRing->OrdSgn)))
4765 op = set[
i].GetpFDeg();
4766 if ((op > o) || ((op == o) && (
pLmCmp(set[i].p,p->p) != -
currRing->OrdSgn)))
4821 if (length<0)
return 0;
4823 int o = p->GetpFDeg();
4824 int op = set[length].GetpFDeg();
4827 || ((op == o) && (set[length].length >p->length))
4828 || ((op == o) && (set[length].length <= p->length)
4838 op = set[an].GetpFDeg();
4840 || ((op == o) && (set[an].length >p->length))
4841 || ((op == o) && (set[an].length <=p->length)
4847 op = set[
i].GetpFDeg();
4849 || ((op == o) && (set[i].length > p->length))
4850 || ((op == o) && (set[i].length <= p->length)
4867 if (length<0)
return 0;
4869 int o = p->GetpFDeg();
4871 if (set[length].GetpFDeg() > o)
4881 if (set[an].GetpFDeg() >= o)
4886 if (set[i].GetpFDeg() >= o)
4920 if (length<0)
return 0;
4922 int o = p->GetpFDeg() + p->ecart;
4923 int op = set[length].GetpFDeg() + set[length].ecart;
4926 || ((op == o) && (
pLmCmp(set[length].p,p->p) != -
currRing->OrdSgn)))
4935 op = set[an].GetpFDeg() + set[an].ecart;
4942 op = set[
i].GetpFDeg() + set[
i].ecart;
4960 if (length<0)
return 0;
4962 int o = p->GetpFDeg() + p->ecart;
4964 if ((set[length].GetpFDeg() + set[length].ecart > o)
4965 || ((set[length].GetpFDeg() + set[length].ecart == o)
4966 && (set[length].ecart > p->ecart))
4967 || ((set[length].GetpFDeg() + set[length].ecart == o)
4968 && (set[length].ecart == p->ecart)
4978 if ((set[an].GetpFDeg() + set[an].ecart > o)
4979 || ((set[an].GetpFDeg() + set[an].ecart == o)
4980 && (set[an].ecart > p->ecart))
4981 || ((set[an].GetpFDeg() + set[an].ecart == o)
4982 && (set[an].ecart == p->ecart)
4988 if ((set[i].GetpFDeg() + set[
i].ecart > o)
4989 || ((set[i].GetpFDeg() + set[
i].ecart == o)
4990 && (set[i].ecart > p->ecart))
4991 || ((set[i].GetpFDeg() +set[
i].ecart == o)
4992 && (set[i].ecart == p->ecart)
5008 if (length<0)
return 0;
5012 unsigned long c =
pGetComp(p->p)*cc;
5013 int o = p->GetpFDeg() + p->ecart;
5015 if (
pGetComp(set[length].p)*cc > c)
5017 if (
pGetComp(set[length].p)*cc == c)
5019 if ((set[length].GetpFDeg() + set[length].ecart > o)
5020 || ((set[length].GetpFDeg() + set[length].ecart == o)
5021 && (set[length].ecart > p->ecart))
5022 || ((set[length].GetpFDeg() + set[length].ecart == o)
5023 && (set[length].ecart == p->ecart)
5038 if ((set[an].GetpFDeg() + set[an].ecart > o)
5039 || ((set[an].GetpFDeg() + set[an].ecart == o)
5040 && (set[an].ecart > p->ecart))
5041 || ((set[an].GetpFDeg() + set[an].ecart == o)
5042 && (set[an].ecart == p->ecart)
5051 else if (
pGetComp(set[i].p)*cc == c)
5053 if ((set[i].GetpFDeg() + set[
i].ecart > o)
5054 || ((set[i].GetpFDeg() + set[
i].ecart == o)
5055 && (set[i].ecart > p->ecart))
5056 || ((set[i].GetpFDeg() +set[
i].ecart == o)
5057 && (set[i].ecart == p->ecart)
5075 Print(
"syzygy criterion checks: ");
5078 for (
int k=0;
k<strat->
syzl;
k++)
5083 Print(
"checking with: %d / %d -- \n",
k,strat->
syzl);
5107 Print(
"--- syzygy criterion checks: ");
5116 min = strat->
syzIdx[comp-2];
5126 max = strat->
syzIdx[comp-1];
5128 for (
int k=min;
k<
max;
k++)
5131 Print(
"COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->
currIdx,min,max,strat->
syzl);
5132 Print(
"checking with: %d -- ",
k);
5150 PrintS(
"rewritten criterion checks: ");
5153 for(
int k = strat->
sl;
k>=start;
k--)
5157 Print(
"checking with: ");
5172 Print(
"ALL ELEMENTS OF S\n----------------------------------------\n");
5173 for(
int kk = 0; kk<strat->
sl+1; kk++)
5177 Print(
"------------------------------\n");
5205 for (
int ii=strat->
sl; ii>start; ii--)
5211 if (!(
pLmCmp(p1,p2) == 1))
5227 for (
int i=strat->
Bl; i>-1; i--) {
5234 if (
pLmCmp(lm,strat->
B[found].GetLmCurrRing()) == -1) {
5242 for (
int ii=strat->
sl; ii>-1; ii--)
5248 if (!(
pLmCmp(p1,p2) == 1))
5271 const unsigned long not_sev = ~L->sev;
5272 const unsigned long* sev = strat->
sevS;
5283 if (j > pos)
return NULL;
5284 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5286 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
5289 if (!(sev[j] & not_sev) &&
5290 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]) &&
5298 if (strat->
tl < 0 || strat->
S_2_R[j] == -1)
5300 T->Set(strat->
S[j], r, strat->
tailRing);
5308 return strat->
S_2_T(j);
5316 if (j > pos)
return NULL;
5318 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5319 t = strat->
S_2_T(j);
5322 (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
5325 if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->
ecartS[j]))
5327 t = strat->
S_2_T(j);
5328 assume(t !=
NULL && t->t_p !=
NULL && t->tailRing == r && t->p == strat->
S[j]);
5362 if ((Kstd1_deg>0)&&(op>Kstd1_deg))
goto all_done;
5372 if (With ==
NULL)
break;
5382 return redtail(L, pos, strat);
5388 if (hn ==
NULL)
goto all_done;
5390 if ((Kstd1_deg>0)&&(op>Kstd1_deg))
goto all_done;
5409 return redtail(&L, pos, strat);
5414 #define REDTAIL_CANONICALIZE 100
5418 p = h = L->GetLmTailRing();
5420 return L->GetLmCurrRing();
5427 Ln.pLength = L->GetpLength() - 1;
5440 Ln.SetShortExpVector();
5446 With = &(strat->
T[
j]);
5451 if (With ==
NULL)
break;
5478 pNext(h) = Ln.LmExtractAndIter();
5481 }
while (!Ln.IsNull());
5484 if (Ln.IsNull())
goto all_done;
5485 if (! withT) With_s.Init(
currRing);
5487 pNext(h) = Ln.LmExtractAndIter();
5506 return L->GetLmCurrRing();
5516 p = h = L->GetLmTailRing();
5518 return L->GetLmCurrRing();
5525 Ln.pLength = L->GetpLength() - 1;
5538 Ln.SetShortExpVector();
5540 if (With ==
NULL)
break;
5550 poly p_Ln=Ln.GetLmCurrRing();
5551 poly p_With=With->GetLmCurrRing();
5563 if (Ln.bucket!=
NULL)
5594 pNext(h) = Ln.LmExtractAndIter();
5597 }
while (!Ln.IsNull());
5600 if (Ln.IsNull())
goto all_done;
5603 pNext(h) = Ln.LmExtractAndIter();
5621 return L->GetLmCurrRing();
5637 if (strat->
Ll != *reduc)
5639 if (strat->
Ll != *reduc-1)
5651 if (red_result == 0)
5653 else if (red_result < 0)
5655 if ((red_result > 0) || ((strat->
Ll % 100)==99))
5657 if (strat->
Ll != *reduc && strat->
Ll > 0)
5674 Print(
"product criterion:%d chain criterion:%d\n",strat->
cp,strat->
c3);
5675 if (hilbcount!=0)
Print(
"hilbert series criterion:%d\n",hilbcount);
5677 if (strat->
cv!=0)
Print(
"shift V criterion:%d\n",strat->
cv);
5692 for (i=0; i<=strat->
sl; i++)
5702 for (i=0; i<=strat->
tl; i++)
5706 Print(
" o:%ld e:%d l:%d",
5707 strat->
T[i].pFDeg(),strat->
T[
i].ecart,strat->
T[
i].length);
5712 for (i=strat->
Ll; i>=0; i--)
5721 Print(
" o:%ld e:%d l:%d",
5722 strat->
L[i].pFDeg(),strat->
L[
i].ecart,strat->
L[
i].length);
5744 strat->
S=strat->
Shdl->m;
5749 memset(strat->
fromQ,0,i*
sizeof(
int));
5755 h.p =
pCopy(Q->m[i]);
5776 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
5779 strat->
enterS(h,pos,strat,-1);
5780 strat->
fromQ[pos]=1;
5790 h.p =
pCopy(F->m[i]);
5819 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
5821 strat->
enterS(h,pos,strat,-1);
5847 strat->
S=strat->
Shdl->m;
5852 memset(strat->
fromQ,0,i*
sizeof(
int));
5858 h.p =
pCopy(Q->m[i]);
5879 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
5882 strat->
enterS(h,pos,strat,-1);
5883 strat->
fromQ[pos]=1;
5893 h.p =
pCopy(F->m[i]);
5916 pos = strat->
posInL(strat->
L,strat->
Ll,&h,strat);
5946 strat->
S = strat->
Shdl->m;
5959 memset(strat->
fromQ,0,i*
sizeof(
int));
5965 h.p =
pCopy(Q->m[i]);
5986 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
5989 strat->
enterS(h,pos,strat,-1);
5990 strat->
fromQ[pos]=1;
6000 h.p =
pCopy(F->m[i]);
6101 for(i=1; i<=strat->
sl; i++)
6117 #if defined(DEBUGF5) || defined(DEBUGF51)
6118 PrintS(
"------------- GENERATING SYZ RULES NEW ---------------\n");
6125 while (i <= strat->sl)
6137 diff = comp - comp_old - 1;
6155 for (k = 0; k<
i; k++)
6178 diff = comp - comp_old - 1;
6195 for (k = 0; k<strat->
sl+1; k++)
6212 PrintS(
"Principal syzygies:\n");
6215 Print(
"ps %d\n",ps);
6216 PrintS(
"--------------------------------\n");
6217 for(i=0;i<=strat->
syzl-1;i++)
6226 PrintS(
"--------------------------------\n");
6248 strat->
S=strat->
Shdl->m;
6254 memset(strat->
fromQ,0,i*
sizeof(
int));
6260 h.p =
pCopy(Q->m[i]);
6281 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
6284 strat->
enterS(h,pos,strat, strat->
tl+1);
6286 strat->
fromQ[pos]=1;
6297 h.p =
pCopy(F->m[i]);
6312 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
6314 strat->
enterS(h,pos,strat, strat->
tl+1);
6356 h.is_normalized = 0;
6361 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
6363 strat->
enterS(h,pos,strat, strat->
tl+1);
6371 strat->
enterS(h,0,strat, strat->
tl+1);
6393 strat->
S=strat->
Shdl->m;
6399 memset(strat->
fromQ,0,i*
sizeof(
int));
6405 h.p =
pCopy(Q->m[i]);
6426 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
6429 strat->
enterS(h,pos,strat, strat->
tl+1);
6431 strat->
fromQ[pos]=1;
6442 h.p =
pCopy(F->m[i]);
6457 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
6459 strat->
enterS(h,pos,strat, strat->
tl+1);
6501 h.is_normalized = 0;
6506 pos =
posInS(strat,strat->
sl,h.p,h.ecart);
6508 strat->
enterS(h,pos,strat, strat->
tl+1);
6516 strat->
enterS(h,0,strat, strat->
tl+1);
6531 while (j <= maxIndex)
6548 if (!
pIsVector((*p).p) && ((*p).ecart != 0))
6557 h1 = r =
pCopy((*p).p);
6610 while ((j <= strat->sl) && (
pGetComp(strat->
S[j])!=0)) j++;
6612 while (j<=strat->sl)
6636 while (j <= maxIndex)
6685 while (j <= maxIndex);
6715 while (i<=strat->sl)
6724 redSi =
pHead(strat->
S[i]);
6725 strat->
S[
i] =
redBba(strat->
S[i],i-1,strat);
6728 if (
pCmp(redSi,strat->
S[i])!=0)
6741 if (strat->
S[i]==
NULL)
6749 if (strat->
S[i]==
NULL)
6767 DENOMINATOR_LIST=denom;
6786 if (any_change)
reorderS(&suc,strat);
6791 for (i=0; i<=strat->
sl; i++)
6812 h.sev = strat->
sevS[
i];
6825 while (i<=strat->sl)
6830 redSi=
pHead((strat->
S)[i]);
6837 else if (
pCmp((strat->
S)[i],redSi)!=0)
6854 DENOMINATOR_LIST=denom;
6869 strat->
sevS[
i] = h.sev;
6879 if (any_change)
reorderS(&suc,strat);
6880 else { suc=-1;
break; }
6891 for (i=0; i<=strat->
sl; i++)
6895 strat->
S[
i] = h.p =
redtail(strat->
S[i],strat->
sl,strat);
6899 strat->
sevS[
i] = h.sev;
6905 h.sev = strat->
sevS[
i];
6906 h.length = h.pLength =
pLength(h.p);
6915 if (suc!= -1)
updateS(toT,strat);
6936 *
sizeof(
unsigned long));
6963 strat->
Shdl->m=strat->
S;
6965 if (atS <= strat->sl)
6967 #ifdef ENTER_USE_MEMMOVE
6969 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
6970 (strat->
sl - atS + 1)*
sizeof(
poly));
6971 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
6972 (strat->
sl - atS + 1)*
sizeof(
int));
6973 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
6974 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
6975 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
6976 (strat->
sl - atS + 1)*
sizeof(
int));
6978 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
6979 (strat->
sl - atS + 1)*
sizeof(
int));
6981 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
6984 for (i=strat->
sl+1; i>=atS+1; i--)
6986 strat->
S[
i] = strat->
S[i-1];
6992 for (i=strat->
sl+1; i>=atS+1; i--)
6995 for (i=strat->
sl+1; i>=atS+1; i--)
7001 #ifdef ENTER_USE_MEMMOVE
7002 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
7003 (strat->
sl - atS + 1)*
sizeof(
int));
7005 for (i=strat->
sl+1; i>=atS+1; i--)
7010 strat->
fromQ[atS]=0;
7014 strat->
S[atS] = p.p;
7020 strat->
sevS[atS] = p.sev;
7021 strat->
ecartS[atS] = p.ecart;
7022 strat->
S_2_R[atS] = atR;
7039 *
sizeof(
unsigned long));
7043 *
sizeof(
unsigned long));
7071 strat->
Shdl->m=strat->
S;
7076 if (atS <= strat->sl)
7078 #ifdef ENTER_USE_MEMMOVE
7080 memmove(&(strat->
S[atS+1]), &(strat->
S[atS]),
7081 (strat->
sl - atS + 1)*
sizeof(
poly));
7082 memmove(&(strat->
ecartS[atS+1]), &(strat->
ecartS[atS]),
7083 (strat->
sl - atS + 1)*
sizeof(
int));
7084 memmove(&(strat->
sevS[atS+1]), &(strat->
sevS[atS]),
7085 (strat->
sl - atS + 1)*
sizeof(
unsigned long));
7086 memmove(&(strat->
S_2_R[atS+1]), &(strat->
S_2_R[atS]),
7087 (strat->
sl - atS + 1)*
sizeof(
int));
7089 memmove(&(strat->
lenS[atS+1]), &(strat->
lenS[atS]),
7090 (strat->
sl - atS + 1)*
sizeof(
int));
7092 memmove(&(strat->
lenSw[atS+1]), &(strat->
lenSw[atS]),
7095 for (i=strat->
sl+1; i>=atS+1; i--)
7097 strat->
S[
i] = strat->
S[i-1];
7103 for (i=strat->
sl+1; i>=atS+1; i--)
7106 for (i=strat->
sl+1; i>=atS+1; i--)
7112 #ifdef ENTER_USE_MEMMOVE
7113 memmove(&(strat->
fromQ[atS+1]), &(strat->
fromQ[atS]),
7114 (strat->
sl - atS + 1)*
sizeof(
int));
7116 for (i=strat->
sl+1; i>=atS+1; i--)
7121 strat->
fromQ[atS]=0;
7125 strat->
S[atS] = p.p;
7126 strat->
sig[atS] = p.sig;
7132 strat->
sevS[atS] = p.sev;
7142 strat->
sevSig[atS] = p.sevSig;
7144 strat->
ecartS[atS] = p.ecart;
7145 strat->
S_2_R[atS] = atR;
7149 Print(
"--- LIST S: %d ---\n",strat->
sl);
7150 for(k=0;k<=strat->
sl;k++)
7154 Print(
"--- LIST S END ---\n");
7170 assume(p.FDeg == p.pFDeg());
7175 for(i=strat->
tl;i>=0;i--)
7177 if (p.p==strat->
T[i].p)
7179 printf(
"already in T at pos %d of %d, atT=%d\n",i,strat->
tl,atT);
7184 #ifdef HAVE_TAIL_RING
7187 p.t_p=p.GetLmTailRing();
7192 atT = strat->
posInT(strat->
T, strat->
tl, p);
7193 if (strat->
tl == strat->
tmax-1)
7195 if (atT <= strat->tl)
7197 #ifdef ENTER_USE_MEMMOVE
7198 memmove(&(strat->
T[atT+1]), &(strat->
T[atT]),
7200 memmove(&(strat->
sevT[atT+1]), &(strat->
sevT[atT]),
7201 (strat->
tl-atT+1)*
sizeof(
unsigned long));
7203 for (i=strat->
tl+1; i>=atT+1; i--)
7205 #ifndef ENTER_USE_MEMMOVE
7206 strat->
T[
i] = strat->
T[i-1];
7209 strat->
R[strat->
T[
i].i_r] = &(strat->
T[
i]);
7226 strat->
T[atT].max =
NULL;
7229 strat->
R[strat->
tl] = &(strat->
T[atT]);
7230 strat->
T[atT].i_r = strat->
tl;
7248 (strat->
syzmax)*
sizeof(
unsigned long),
7250 *
sizeof(
unsigned long));
7253 if (atT < strat->syzl)
7255 #ifdef ENTER_USE_MEMMOVE
7256 memmove(&(strat->
syz[atT+1]), &(strat->
syz[atT]),
7258 memmove(&(strat->
sevSyz[atT+1]), &(strat->
sevSyz[atT]),
7259 (strat->
syzl-atT+1)*
sizeof(
unsigned long));
7261 for (i=strat->
syzl; i>=atT+1; i--)
7263 #ifndef ENTER_USE_MEMMOVE
7264 strat->
syz[
i] = strat->
syz[i-1];
7271 strat->
syz[atT] = p.sig;
7272 strat->
sevSyz[atT] = p.sevSig;
7275 Print(
"element in strat->syz: %d--%d ",atT+1,strat->
syzmax);
7283 strat->
L[cc].sig, ~strat->
L[cc].sevSig,
currRing))
7291 PrintS(
"--- Syzygies ---\n");
7294 PrintS(
"--------------------------------\n");
7295 for(i=0;i<=strat->
syzl-1;i++)
7300 PrintS(
"--------------------------------\n");
7336 #ifdef HAVE_RATGRING
7376 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
7377 else PrintS(
"ideal/module is not homogeneous\n");
7408 #ifdef HAVE_RATGRING
7449 if (strat->
homog)
PrintS(
"ideal/module is homogeneous\n");
7450 else PrintS(
"ideal/module is not homogeneous\n");
7456 (
const LSet set,
const int length,
7926 reduction_found=
TRUE;
7956 reduction_found=
TRUE;
7969 if ( reduction_found)
8013 for (i=strat->
sl; i>=low; i--)
8015 int end_pos=strat->
sl;
8017 if (strat->
ak==0) end_pos=i-1;
8019 if ((T_j !=
NULL)&&(T_j->p==strat->
S[i]))
8025 Print(
"test S[%d]:",i);
8037 Print(
"to (tailR) S[%d]:",i);
8060 Print(
"test S[%d]:",i);
8066 strat->
S[
i] =
redtailBba(strat->
S[i], end_pos, strat, withT);
8080 DENOMINATOR_LIST=denom;
8093 Print(
"to (-tailR) S[%d]:",i);
8140 if (j < strat->HCord)
8181 assume(L->i_r1 >= -1 && L->i_r1 <= strat->
tl);
8182 assume(L->i_r2 >= -1 && L->i_r2 <= strat->
tl);
8188 if ((L->i_r1 == -1) || (L->i_r2 == -1) )
8192 poly p1_max = (strat->
R[L->i_r1])->
max;
8193 poly p2_max = (strat->
R[L->i_r2])->
max;
8219 poly p1_max = (strat->
R[atR])->
max;
8236 if (expbound == 0) expbound = strat->
tailRing->bitmask << 1;
8257 new_tailRing->pFDeg =
currRing->pFDeg;
8258 new_tailRing->pLDeg =
currRing->pLDeg;
8262 Print(
"[%lu:%d", (
unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
8271 for (i=0; i<=strat->
tl; i++)
8273 strat->
T[
i].ShallowCopyDelete(new_tailRing, new_tailBin,
8274 p_shallow_copy_delete);
8276 for (i=0; i<=strat->
Ll; i++)
8280 strat->
L[
i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8282 if ((strat->
P.t_p !=
NULL) ||
8284 strat->
P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8286 if ((L !=
NULL) && (L->tailRing != new_tailRing))
8289 L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8295 L->tailRing = new_tailRing;
8302 if ((T !=
NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
8303 T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
8336 unsigned long l = 0;
8342 for (i=0; i<= strat->
Ll; i++)
8346 for (i=0; i<=strat->
tl; i++)
8375 int **wvhdl = (
int **)
omAlloc0((n+1)*
sizeof(
int*));
8377 for (
int i=1; i<
n; i++)
8379 res->order[
i] = r->order[i-1];
8380 res->block0[
i] = r->block0[i-1];
8381 res->block1[
i] = r->block1[i-1];
8382 res->wvhdl[
i] = r->wvhdl[i-1];
8388 for (
int i=
rBlocks(res); i>0; --
i) {
8400 WarnS(
"error in nc_rComplete");
8421 int **wvhdl = (
int **)
omAlloc0((n+2)*
sizeof(
int*));
8423 for (
int i=2; i<n+2; i++)
8425 res->order[
i] = r->order[i-2];
8426 res->block0[
i] = r->block0[i-2];
8427 res->block1[
i] = r->block1[i-2];
8428 res->wvhdl[
i] = r->wvhdl[i-2];
8434 res->wvhdl[0] = (
int *)
omAlloc(res->N*
sizeof(
int));
8435 for (
int i=0; i<res->N; ++
i)
8436 res->wvhdl[0][i] = 1;
8440 res->wvhdl[1] =
NULL;
8442 for (
int i=
rBlocks(res); i>1; --
i) {
8454 WarnS(
"error in nc_rComplete");
8594 #ifdef HAVE_TAIL_BIN
8608 (tailRing !=
NULL ? tailRing->PolyBin:
8621 Timings
for the different possibilities of posInT:
8622 T15 EDL DL EL L 1-2-3
8623 Gonnet 43.26 42.30 38.34 41.98 38.40 100.04
8624 Hairer_2_1 1.11 1.15 1.04 1.22 1.08 4.7
8625 Twomat3 1.62 1.69 1.70 1.65 1.54 11.32
8626 ahml 4.48 4.03 4.03 4.38 4.96 26.50
8627 c7 15.02 13.98 15.16 13.24 17.31 47.89
8628 c8 505.09 407.46 852.76 413.21 499.19
n/
a
8629 f855 12.65 9.27 14.97 8.78 14.23 33.12
8630 gametwo6 11.47 11.35 14.57 11.20 12.02 35.07
8631 gerhard_3 2.73 2.83 2.93 2.64 3.12 6.24
8632 ilias13 22.89 22.46 24.62 20.60 23.34 53.86
8633 noon8 40.68 37.02 37.99 36.82 35.59 877.16
8634 rcyclic_19 48.22 42.29 43.99 45.35 51.51 204.29
8635 rkat9 82.37 79.46 77.20 77.63 82.54 267.92
8636 schwarz_11 16.46 16.81 16.76 16.81 16.72 35.56
8637 test016 16.39 14.17 14.40 13.50 14.26 34.07
8638 test017 34.70 36.01 33.16 35.48 32.75 71.45
8639 test042 10.76 10.99 10.27 11.57 10.45 23.04
8640 test058 6.78 6.75 6.51 6.95 6.22 9.47
8641 test066 10.71 10.94 10.76 10.61 10.56 19.06
8642 test073 10.75 11.11 10.17 10.79 8.63 58.10
8643 test086 12.23 11.81 12.88 12.24 13.37 66.68
8644 test103 5.05 4.80 5.47 4.64 4.89 11.90
8645 test154 12.96 11.64 13.51 12.46 14.61 36.35
8646 test162 65.27 64.01 67.35 59.79 67.54 196.46
8647 test164 7.50 6.50 7.68 6.70 7.96 17.13
8648 virasoro 3.39 3.50 3.35 3.47 3.70 7.66
8658 if (length==-1)
return 0;
8661 int op=p.GetpFDeg();
8662 int ol = p.GetpLength();
8664 if (set[length].ecart < o)
8666 if (set[length].ecart == o)
8668 int oo=set[length].GetpFDeg();
8669 if ((oo < op) || ((oo==op) && (set[length].length < ol)))
8680 if (set[an].ecart > o)
8682 if (set[an].ecart == o)
8684 int oo=set[an].GetpFDeg();
8686 || ((oo==op) && (set[an].
pLength > ol)))
8692 if (set[i].ecart > o)
8694 else if (set[i].ecart == o)
8696 int oo=set[
i].GetpFDeg();
8698 || ((oo == op) && (set[i].
pLength > ol)))
8712 if (length==-1)
return 0;
8714 int op=p.GetpFDeg();
8715 int ol = p.GetpLength();
8717 int oo=set[length].GetpFDeg();
8718 if ((oo < op) || ((oo==op) && (set[length].length < ol)))
8728 int oo=set[an].GetpFDeg();
8730 || ((oo==op) && (set[an].
pLength > ol)))
8735 int oo=set[
i].GetpFDeg();
8737 || ((oo == op) && (set[i].
pLength > ol)))
8748 int ol = p.GetpLength();
8751 if (set[length].length<p.length)
8762 if (set[an].
pLength>ol)
return an;
8787 else Print(
"%p\n",(
void*)strat->
red);
8799 #ifdef HAVE_MORE_POS_IN_T
8828 PrintS(
"initEcartPair: ");
8832 Print(
"homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
8834 Print(
"honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
8836 Print(
"posInLDependsOnLength=%d\n",
8868 PrintS(
"currRing->pFDeg: ");
8879 Print(
" degBound: %d\n", Kstd1_deg);
8883 PrintS(
"ecartWeights: ");
8896 #ifdef HAVE_SHIFTBBA
8910 #ifdef HAVE_SHIFTBBA
8927 #ifdef HAVE_SHIFTBBA
9019 #ifdef HAVE_SHIFTBBA
9029 for (i=0; i<=strat->
sl; i++)
9031 memset(&h,0,
sizeof(h));
9034 h.sev = strat->
sevS[
i];
9048 #ifdef HAVE_SHIFTBBA
9130 #ifdef HAVE_SHIFTBBA
9171 qfromQ = strat->
fromQ[
i];
9183 enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
9185 for (j=1; j<= toInsert; j++)
9200 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
9205 #ifdef HAVE_SHIFTBBA
9249 for (; j<= toInsert; j++)
9266 enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
9271 #ifdef HAVE_SHIFTBBA
9275 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)
9299 int qfromQ = qisFromQ;
9310 Lp.ecart=0; Lp.length=0;
9319 if (!
isInV(Lp.lcm, lV))
9324 PrintS(
"V crit applied to q = ");
9340 if((!((ecartq>0)&&(ecart>0)))
9363 Lp.ecart =
si_max(ecart,ecartq);
9364 if (strat->
fromT && (ecartq>ecart))
9382 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
9387 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
9431 if (strat->
fromT && (ecartq>ecart))
9444 for(j = strat->
Bl;j>=0;j--)
9446 compare=
pDivComp(strat->
B[j].lcm,Lp.lcm);
9450 if ((strat->
fromQ==
NULL) || (isFromQ==0) || (qfromQ==0))
9474 if ((strat->
fromQ!=
NULL) && (isFromQ!=0) && (qfromQ!=0))
9541 if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
9560 l = strat->
posInL(strat->
B,strat->
Bl,&Lp,strat);
9566 #ifdef HAVE_SHIFTBBA
9581 if ( (!strat->
fromT)
9590 clearS(h,h_sev, &j,&k,strat);
9599 #ifdef HAVE_SHIFTBBA
9620 for (j=0; j<=
k; j++)
9622 if (!strat->
fromQ[j])
9635 for (j=0; j<=
k; j++)
9648 for (j=0; j<=
k; j++)
9673 #ifdef HAVE_SHIFTBBA
9693 atT = strat->
posInT(strat->
T, strat->
tl, p);
9700 for (i=1; i<=toInsert; i++)
9711 atT = strat->
posInT(strat->
T, strat->
tl, qq);
9720 #ifdef HAVE_SHIFTBBA
9727 p = h = L->GetLmTailRing();
9729 return L->GetLmCurrRing();
9736 Ln.pLength = L->GetpLength() - 1;
9748 Ln.SetShortExpVector();
9754 With = &(strat->
T[
j]);
9759 if (With ==
NULL)
break;
9775 pNext(h) = Ln.LmExtractAndIter();
9778 }
while (!Ln.IsNull());
9781 if (Ln.IsNull())
goto all_done;
9782 if (! withT) With_s.Init(
currRing);
9784 pNext(h) = Ln.LmExtractAndIter();
9799 return L->GetLmCurrRing();
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
#define TEST_OPT_INFREDTAIL
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
int getIndexRng(long coeff)
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
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) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
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...
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)
poly redtail(LObject *L, int pos, 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
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)
void enterSSba(LObject p, int atS, kStrategy strat, int atR)
int itoInsert(poly p, int uptodeg, int lV, const ring r)
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
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)
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
pLDegProc pOrigLDeg_TailRing
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
static int * initS_2_R(const int maxnr)
void messageStat(int hilbcount, kStrategy strat)
static int min(int a, int b)
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)
Compatiblity layer for legacy polynomial operations (over currRing)
int posInT1(const TSet set, const int length, LObject &p)
void enterSyz(LObject p, kStrategy strat, int atT)
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)
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)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
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 enterOnePairSig(int i, poly p, poly pSig, int, 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 enterSMora(LObject p, int atS, kStrategy strat, int atR=-1)
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)
static poly pp_Mult_nn(poly p, number n, const ring r)
void enterT(LObject p, kStrategy strat, int atT)
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
#define TEST_OPT_CONTENTSB
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
BOOLEAN posInLDependsOnLength
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)
const CanonicalForm CFMap CFMap int &both_non_zero int n
static short rVar(const ring r)
#define rVar(r) (r->N)
static int pDivComp(poly p, poly q)
void initSyzRules(kStrategy strat)
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)
#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))) ...
static poly pp_Mult_mm(poly p, poly m, const ring r)
denominator_list DENOMINATOR_LIST
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
poly pMove2CurrTail(poly p, kStrategy strat)
#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)
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)
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
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)
int posInT15(const TSet set, const int length, LObject &p)
int(* red)(LObject *L, kStrategy strat)
static bool rIsPluralRing(const ring r)
we must always have this test!
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 poly redBba1(poly h, int maxIndex, kStrategy strat)
int(* posInT)(const TSet T, const int tl, LObject &h)
void HEckeTest(poly pp, kStrategy strat)
#define omCheckBinAddrSize(addr, size)
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.
static int pLength(poly a)
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
int posInT0(const TSet, const int length, LObject &)
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))
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)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#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)
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)
#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)
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
unsigned long p_GetShortExpVector(poly p, const ring r)
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)
#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 )
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.
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)
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)
void idDelete(ideal *h, ring r=currRing)
delete an ideal
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
#define pIsConstant(p)
like above, except that Comp might be != 0
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR=-1)
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
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)
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
void exitSba(kStrategy strat)
void PrintS(const char *s)
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)
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)
void idSkipZeroes(ideal ide)
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)
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)
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
poly redtailBba_Z(LObject *L, int pos, kStrategy strat)
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)
#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...
ideal idInit(int idsize, int rank)
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)
BOOLEAN p_CheckIsFromRing(poly p, ring r)
static BOOLEAN rField_is_Ring(const ring r)
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)
BOOLEAN rHasGlobalOrdering(const ring r)
long ind_fact_2(long arg)
int posInSyz(const kStrategy strat, poly sig)
int posInT110(const TSet set, const int length, LObject &p)
void pNorm(poly p, const ring R=currRing)
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
#define pInit()
allocates a new monomial and initializes everything to 0
#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)
void enterSMoraNF(LObject p, int atS, kStrategy strat, int atR=-1)
static bool rIsSCA(const ring r)
void completeReduce(kStrategy strat, BOOLEAN withT)
#define REDTAIL_CANONICALIZE
BOOLEAN kCheckStrongCreation(int atR, poly m1, int atS, poly m2, 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 dReportError(const char *fmt,...)
#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)
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)
void p_Write(poly p, ring lmRing, ring tailRing)
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
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)
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
static LSet initL(int nr=setmaxL)
static poly p_Add_q(poly p, poly q, const ring r)
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
KINLINE poly kNoetherTail()
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
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)
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)
static bool rIsRatGRing(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
#define ENTER_USE_MEMMOVE
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
int posInT13(const TSet set, const int length, LObject &p)
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
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...
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)