18 #define PLURAL_INTERNAL_DECLARATIONS 1 37 #define SBA_INTERRED_START 0 38 #define SBA_TAIL_RED 1 39 #define SBA_PRODUCT_CRITERION 0 40 #define SBA_PRINT_ZERO_REDUCTIONS 0 41 #define SBA_PRINT_REDUCTION_STEPS 0 42 #define SBA_PRINT_OPERATIONS 0 43 #define SBA_PRINT_SIZE_G 0 44 #define SBA_PRINT_SIZE_SYZ 0 45 #define SBA_PRINT_PRODUCT_CRITERION 0 48 #if SBA_PRINT_REDUCTION_STEPS 49 long sba_reduction_steps;
50 long sba_interreduction_steps;
52 #if SBA_PRINT_OPERATIONS 54 long sba_interreduction_operations;
88 unsigned long not_sev = ~L->sev;
92 const unsigned long* sevT=strat->
sevT;
105 if (
j > strat->
tl)
return -1;
106 #if defined(PDEBUG) || defined(PDIV_DEBUG) 113 if (!(sevT[
j] & not_sev) &&
127 if (
j > strat->
tl)
return -1;
128 #if defined(PDEBUG) || defined(PDIV_DEBUG) 134 if (!(sevT[
j] & not_sev) &&
152 if (
j > strat->
tl)
return -1;
153 #if defined(PDEBUG) || defined(PDIV_DEBUG) 161 if (!(sevT[
j] & not_sev) &&
175 if (
j > strat->
tl)
return -1;
176 #if defined(PDEBUG) || defined(PDIV_DEBUG) 183 if (!(sevT[
j] & not_sev) &&
198 unsigned long not_sev = ~L->sev;
199 poly
p = L->GetLmCurrRing();
213 ende=
posInS(strat,*max_ind,
p,0)+1;
214 if (ende>(*max_ind)) ende=(*max_ind);
223 if (
j > ende)
return -1;
224 #if defined(PDEBUG) || defined(PDIV_DEBUG) 232 if ( !(strat->
sevS[
j] & not_sev) &&
246 if (
j > ende)
return -1;
247 #if defined(PDEBUG) || defined(PDIV_DEBUG) 254 if ( !(strat->
sevS[
j] & not_sev) &&
267 unsigned long not_sev = ~L->sev;
268 poly
p = L->GetLmCurrRing();
281 if (
j > ende)
return -1;
282 #if defined(PDEBUG) || defined(PDIV_DEBUG) 290 if ( !(strat->
sevS[
j] & not_sev) &&
304 if (
j > ende)
return -1;
305 #if defined(PDEBUG) || defined(PDIV_DEBUG) 312 if ( !(strat->
sevS[
j] & not_sev) &&
331 poly zeroPoly =
NULL;
332 unsigned long a = (
unsigned long)
pGetCoeff(
p);
335 int a_ind2 =
ind2(a);
339 for (
int i = 1;
i <= leadRing->N;
i++)
348 poly lead_mult =
p_ISet(1, tailRing);
349 if (
n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
351 int too_much = k_ind2 + a_ind2 -
n_GetChar(leadRing->cf);
353 zeroPoly =
p_ISet(a, tailRing);
354 for (
int i = 1;
i <= leadRing->N;
i++)
361 while ( (0 <
ind2(s_exp)) && (
ind2(s_exp) <= too_much) )
363 too_much = too_much -
ind2(s_exp);
367 for (
int j = 1;
j <= s_exp;
j++)
384 p_Setm(lead_mult, tailRing);
385 zeroPoly =
p_Mult_mm(zeroPoly, lead_mult, tailRing);
387 for (
int i = 1;
i <= leadRing->N;
i++)
440 if (
h->IsNull())
return 0;
441 if (strat->
tl<0)
return 1;
452 long reddeg =
h->GetpFDeg();
454 h->SetShortExpVector();
476 if (
h->GetLmTailRing() ==
NULL)
489 if (
h->GetLmTailRing() ==
NULL)
495 h->SetShortExpVector();
500 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
505 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
518 if (d >= (
long)strat->
tailRing->bitmask)
520 if (
h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
525 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
547 if (strat->
tl<0)
return 1;
553 unsigned long not_sev;
558 h->SetShortExpVector();
560 h_p =
h->GetLmTailRing();
567 li = strat->
T[
j].pLength;
568 if (li<=0) li=strat->
T[
j].GetpLength();
585 if ((strat->
T[
i].pLength < li)
593 li = strat->
T[
i].pLength;
594 if (li<=0) li=strat->
T[
i].GetpLength();
615 #if SBA_PRINT_REDUCTION_STEPS 616 sba_interreduction_steps++;
618 #if SBA_PRINT_OPERATIONS 619 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
631 h_p =
h->GetLmTailRing();
637 h->SetShortExpVector();
649 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
658 Print(
" lazy: -> L%d\n",at);
671 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
673 Red->HeadNormalize();
707 if (strat->
tl<0)
return 1;
713 PrintS(
"------- IN REDSIG -------\n");
720 PrintS(
"---------------------------\n");
726 unsigned long not_sev;
731 h->SetShortExpVector();
733 h_p =
h->GetLmTailRing();
743 li = strat->
T[
j].pLength;
744 if (li<=0) li=strat->
T[
j].GetpLength();
761 if ((strat->
T[
i].pLength < li)
769 li = strat->
T[
i].pLength;
770 if (li<=0) li=strat->
T[
i].GetpLength();
792 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
793 PrintS(
"--------------------------------\n");
800 PrintS(
"--------------------------------\n");
801 printf(
"INDEX OF REDUCER T: %d\n",ii);
804 #if SBA_PRINT_REDUCTION_STEPS 806 sba_reduction_steps++;
808 #if SBA_PRINT_OPERATIONS 810 sba_operations +=
pLength(strat->
T[ii].p);
817 Print(
"SigSAFE: %d\n",sigSafe);
832 h_p =
h->GetLmTailRing();
838 h->SetShortExpVector();
850 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
861 Print(
" lazy: -> L%d\n",at);
885 beforeredsig =
pCopy(
h->sig);
887 if (strat->
tl<0)
return 1;
893 Print(
"------- IN REDSIG -------\n");
900 Print(
"---------------------------\n");
906 unsigned long not_sev;
911 h->SetShortExpVector();
913 h_p =
h->GetLmTailRing();
938 if (
h->GetLmTailRing() ==
NULL)
945 if(
pLtCmp(beforeredsig,
h->sig) == 1)
968 li = strat->
T[
j].pLength;
969 if (li<=0) li=strat->
T[
j].GetpLength();
985 if ((strat->
T[
i].pLength < li)
993 li = strat->
T[
i].pLength;
994 if (li<=0) li=strat->
T[
i].GetpLength();
1016 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
1017 Print(
"--------------------------------\n");
1024 Print(
"--------------------------------\n");
1025 printf(
"INDEX OF REDUCER T: %d\n",ii);
1053 #if SBA_PRINT_REDUCTION_STEPS 1055 sba_reduction_steps++;
1057 #if SBA_PRINT_OPERATIONS 1059 sba_operations +=
pLength(strat->
T[ii].p);
1066 Print(
"SigSAFE: %d\n",sigSafe);
1081 h_p =
h->GetLmTailRing();
1087 h->SetShortExpVector();
1099 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1100 if (at <= strat->Ll)
1102 int dummy=strat->
sl;
1110 Print(
" lazy: -> L%d\n",at);
1123 #define REDTAIL_CANONICALIZE 100 1127 p =
h = L->GetLmTailRing();
1129 return L->GetLmCurrRing();
1137 Ln.sevSig = L->sevSig;
1138 Ln.pLength = L->GetpLength() - 1;
1153 Ln.SetShortExpVector();
1159 With = &(strat->
T[
j]);
1164 if (With ==
NULL)
break;
1188 #if SBA_PRINT_REDUCTION_STEPS 1190 sba_reduction_steps++;
1192 #if SBA_PRINT_OPERATIONS 1194 sba_operations +=
pLength(With->p);
1204 pNext(
h) = Ln.LmExtractAndIter();
1207 }
while (!Ln.IsNull());
1210 if (Ln.IsNull())
goto all_done;
1211 if (! withT) With_s.Init(
currRing);
1218 pNext(
h) = Ln.LmExtractAndIter();
1235 return L->GetLmCurrRing();
1244 if (strat->
tl<0)
return 1;
1249 long reddeg =
h->GetpFDeg();
1251 unsigned long not_sev;
1253 h->SetShortExpVector();
1254 poly h_p =
h->GetLmTailRing();
1259 if (
j < 0)
return 1;
1261 li = strat->
T[
j].pLength;
1262 if (li<=0) li=strat->
T[
j].GetpLength();
1280 if ((strat->
T[
i].pLength < li)
1288 li = strat->
T[
i].pLength;
1289 if (li<=0) li=strat->
T[
i].GetpLength();
1311 #if SBA_PRINT_REDUCTION_STEPS 1312 sba_interreduction_steps++;
1314 #if SBA_PRINT_OPERATIONS 1315 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1327 h_p=
h->GetLmTailRing();
1334 h->SetShortExpVector();
1340 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
1343 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1344 if (at <= strat->Ll)
1347 int dummy=strat->
sl;
1359 else if (d != reddeg)
1361 if (d>=(
long)strat->
tailRing->bitmask)
1363 if (
h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
1368 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1389 if (strat->
tl<0)
return 1;
1393 int i,
j,at,pass,ei, ii, h_d;
1394 unsigned long not_sev;
1398 d = reddeg =
h->GetpFDeg() +
h->ecart;
1399 h->SetShortExpVector();
1401 h_p =
h->GetLmTailRing();
1408 if (
j < 0)
return 1;
1410 ei = strat->
T[
j].ecart;
1411 li = strat->
T[
j].pLength;
1412 if (li<=0) li=strat->
T[
j].GetpLength();
1430 if ((((strat->
T[
i].ecart < ei) && (ei>
h->ecart))
1431 || ((strat->
T[
i].ecart <=
h->ecart) && (strat->
T[
i].pLength < li)))
1439 ei = strat->
T[
i].ecart;
1440 li = strat->
T[
i].pLength;
1441 if (li<=0) li=strat->
T[
i].GetpLength();
1460 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1478 Print(
"\nwith T[%d]:",ii);
1485 #if SBA_PRINT_REDUCTION_STEPS 1486 sba_interreduction_steps++;
1488 #if SBA_PRINT_OPERATIONS 1489 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1515 else if (
h->t_p!=
NULL)
1524 h->SetShortExpVector();
1526 h_d =
h->SetpFDeg();
1531 h->ecart = d-h_d+ei-
h->ecart;
1545 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1546 if (at <= strat->Ll)
1548 int dummy=strat->
sl;
1554 Print(
" degree jumped: -> L%d\n",at);
1560 else if (d > reddeg)
1562 if (d>=(
long)strat->
tailRing->bitmask)
1564 if (
h->pTotalDeg()+
h->ecart >= (long)strat->
tailRing->bitmask)
1569 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1591 #define REDNF_CANONICALIZE 60 1602 P.SetShortExpVector();
1708 P.SetShortExpVector();
1757 P.SetShortExpVector();
1838 P.SetShortExpVector();
1866 P.SetShortExpVector();
1905 int hilbeledeg=1,hilbcount=0,minimcnt=0;
1928 withT = ! strat->
homog;
1933 #ifdef HAVE_TAIL_RING 1949 while (strat->
Ll >= 0)
1956 while (strat->
Ll >= 0)
1969 while ((strat->
Ll >= 0)
1970 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
1975 if (strat->
Ll<0)
break;
1980 strat->
P = strat->
L[strat->
Ll];
2010 else if (strat->
P.p1 ==
NULL)
2012 if (strat->
minim > 0)
2018 if ((strat->
P.p ==
NULL) && (strat->
P.t_p ==
NULL))
2026 &olddeg,&reduc,strat, red_result);
2029 red_result = strat->red(&strat->P,strat);
2039 if (red_result == 1)
2042 strat->
P.GetP(strat->
lmBin);
2051 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
2059 strat->
P.pCleardenom();
2063 strat->
P.pCleardenom();
2072 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
2084 if (strat->
minim==1)
2091 strat->
M->m[minimcnt]=strat->
P.p2;
2095 pNext(strat->
M->m[minimcnt])
2111 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2126 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
2134 if (strat->
s_poly(strat))
2139 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
2145 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2149 else if (strat->
P.p1 ==
NULL && strat->
minim > 0)
2155 memset(&(strat->
P), 0,
sizeof(strat->
P));
2191 #ifdef HAVE_TAIL_RING 2213 for(
int i = 0;
i<=strat->
sl;
i++)
2248 return (strat->
Shdl);
2260 #if SBA_PRINT_ZERO_REDUCTIONS 2261 long zeroreductions = 0;
2263 #if SBA_PRINT_PRODUCT_CRITERION 2264 long product_criterion = 0;
2266 #if SBA_PRINT_SIZE_G 2268 int size_g_non_red = 0;
2270 #if SBA_PRINT_SIZE_SYZ 2274 #if SBA_PRINT_REDUCTION_STEPS 2275 sba_reduction_steps = 0;
2276 sba_interreduction_steps = 0;
2278 #if SBA_PRINT_OPERATIONS 2280 sba_interreduction_operations = 0;
2284 ring sRing, currRingOld;
2289 if (sRing!=currRingOld)
2308 dummy =
pCopy(F->m[0]);
2310 F->m[
i] = F->m[
i+1];
2331 dummy =
pCopy(F->m[0]);
2333 F->m[
i] = F->m[
i+1];
2351 for (
int i=0;
i<
sort->length();++
i)
2352 F->m[
i] = F1->m[(*
sort)[
i]-1];
2366 F->m[
j] = F->m[
j-1];
2384 printf(
"SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2386 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
2389 int srmax,lrmax, red_result = 1;
2391 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2405 reduc = olddeg = lrmax = 0;
2418 #ifdef HAVE_TAIL_RING 2436 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
2446 while (strat->
Ll >= 0)
2448 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2478 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2479 lrmax, reduc,
Q,
w, hilb );
2489 strat->
P = strat->
L[strat->
Ll];
2495 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(), strat, strat->
P.checked+1))
2499 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2500 PrintS(
"-------------------------------------------------\n");
2505 PrintS(
"-------------------------------------------------\n");
2540 else if (strat->
P.p1 ==
NULL)
2542 if (strat->
minim > 0)
2548 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2556 PrintS(
"Poly before red: ");
2560 #if SBA_PRODUCT_CRITERION 2561 if (strat->
P.prod_crit)
2563 #if SBA_PRINT_PRODUCT_CRITERION 2564 product_criterion++;
2566 int pos =
posInSyz(strat, strat->
P.sig);
2573 red_result = strat->
red(&strat->
P,strat);
2576 red_result = strat->
red(&strat->
P,strat);
2592 strat->
P.p =
pNeg(strat->
P.p);
2593 strat->
P.sig =
pNeg(strat->
P.sig);
2596 if(strat->
P.sig !=
NULL)
2598 if(strat->
P.p !=
NULL)
2605 red_result =
redRing(&strat->
P,strat);
2610 strat->
P.sig =
NULL;
2614 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2630 if (red_result != 0)
2632 PrintS(
"Poly after red: ");
2634 pWrite(strat->
P.GetLmCurrRing());
2636 printf(
"%d\n",red_result);
2641 if(strat->
P.p !=
NULL)
2643 &olddeg,&reduc,strat, red_result);
2645 message((strat->honey ? strat->P.ecart : 0),
2646 &olddeg,&reduc,strat, red_result);
2654 if (red_result == 1)
2657 strat->
P.GetP(strat->
lmBin);
2661 (strat->
P).FDeg = (strat->
P).pFDeg();
2673 int pos = strat->
sl+1;
2681 beforetailred =
pCopy(strat->
P.sig);
2687 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2695 strat->
P.pCleardenom();
2698 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2699 strat->
P.pCleardenom();
2706 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2715 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2721 if(strat->
P.sig ==
NULL ||
pLtCmp(beforetailred,strat->
P.sig) == 1)
2725 red_result =
redRing(&strat->
P,strat);
2734 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2740 if(strat->
P.p ==
NULL)
2741 goto case_when_red_result_changed;
2747 for (
int jj = 0; jj<strat->
tl+1; jj++)
2751 strat->
T[jj].is_sigsafe =
FALSE;
2757 for (
int jj = 0; jj<strat->
tl+1; jj++)
2759 strat->
T[jj].is_sigsafe =
FALSE;
2769 if (strat->
minim==1)
2776 strat->
M->m[minimcnt]=strat->
P.p2;
2780 pNext(strat->
M->m[minimcnt])
2790 strat->
T[strat->
tl].is_sigsafe =
FALSE;
2804 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2808 for (
int tk=0; tk<strat->
sl+1; tk++)
2829 for(
int ps=0;ps<strat->
sl+1;ps++)
2837 (strat->
syzmax)*
sizeof(
unsigned long),
2839 *
sizeof(
unsigned long));
2871 unsigned max_cmp =
IDELEMS(F);
2881 for (
int i=0;
i<strat->
sl; ++
i)
2898 for (
unsigned i=cmp+1;
i<=max_cmp; ++
i)
2901 for (
int j=0;
j<strat->
sl; ++
j)
2939 printf(
"---------------------------\n");
2940 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
2963 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
2966 if (strat->
sl>srmax) srmax = strat->
sl;
2970 case_when_red_result_changed:
2978 #if SBA_PRINT_ZERO_REDUCTIONS 2987 int pos =
posInSyz(strat, strat->
P.sig);
2991 Print(
"ADDING STUFF TO SYZ : ");
3004 memset(&(strat->
P), 0,
sizeof(strat->
P));
3010 printf(
"\nSigDrop!\n");
3012 printf(
"\nEnded with no SigDrop\n");
3018 if(strat->
P.sig !=
NULL)
3022 memset(&(strat->
P), 0,
sizeof(strat->
P));
3057 #ifdef HAVE_TAIL_RING 3073 #if SBA_PRINT_SIZE_SYZ 3075 size_syz = strat->
syzl;
3088 #if SBA_PRINT_SIZE_G 3103 for(;
k>=0 && (strat->
L[
k].p1 !=
NULL || strat->
L[
k].p2 !=
NULL);
k--)
3113 for(;
k>=0 && strat->
L[
k].p1 ==
NULL && strat->
L[
k].p2 ==
NULL;
k--)
3116 strat->
enterS(strat->
L[
k], strat->
sl+1, strat, strat->
tl);
3124 for(
k=strat->
sl;
k>=0;
k--)
3157 #if SBA_PRINT_SIZE_G 3161 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
3165 printf(
" %d. ",oo+1);
3170 #if SBA_PRINT_ZERO_REDUCTIONS 3171 printf(
"----------------------------------------------------------\n");
3172 printf(
"ZERO REDUCTIONS: %ld\n",zeroreductions);
3175 #if SBA_PRINT_REDUCTION_STEPS 3176 printf(
"----------------------------------------------------------\n");
3177 printf(
"S-REDUCTIONS: %ld\n",sba_reduction_steps);
3179 #if SBA_PRINT_OPERATIONS 3180 printf(
"OPERATIONS: %ld\n",sba_operations);
3182 #if SBA_PRINT_REDUCTION_STEPS 3183 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3184 printf(
"INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3186 #if SBA_PRINT_OPERATIONS 3187 printf(
"INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3189 #if SBA_PRINT_REDUCTION_STEPS 3190 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3191 printf(
"ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3192 sba_interreduction_steps = 0;
3193 sba_reduction_steps = 0;
3195 #if SBA_PRINT_OPERATIONS 3196 printf(
"ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3197 sba_interreduction_operations = 0;
3200 #if SBA_PRINT_SIZE_G 3201 printf(
"----------------------------------------------------------\n");
3202 printf(
"SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3206 #if SBA_PRINT_SIZE_SYZ 3207 printf(
"SIZE OF SYZ: %ld\n",size_syz);
3208 printf(
"----------------------------------------------------------\n");
3211 #if SBA_PRINT_PRODUCT_CRITERION 3212 printf(
"PRODUCT CRITERIA: %ld\n",product_criterion);
3213 product_criterion = 0;
3215 return (strat->
Shdl);
3516 int& hilbcount,
int& srmax,
int& lrmax,
int& reduc, ideal
Q,
3519 int Ll_old, red_result = 1;
3525 reduc = olddeg = lrmax = 0;
3530 while (strat->
tl >= 0)
3532 if(!strat->
T[strat->
tl].is_redundant)
3535 h.p = strat->
T[strat->
tl].p;
3536 h.tailRing = strat->
T[strat->
tl].tailRing;
3537 h.t_p = strat->
T[strat->
tl].t_p;
3576 while (strat->
Ll>Ll_old)
3578 strat->
P = strat->
L[strat->
Ll];
3582 PrintS(
"NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3583 PrintS(
"-------------------------------------------------\n");
3587 printf(
"%d\n",strat->
tl);
3588 PrintS(
"-------------------------------------------------\n");
3621 else if (strat->
P.p1 ==
NULL)
3623 if (strat->
minim > 0)
3630 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3638 &olddeg,&reduc,strat, red_result);
3641 PrintS(
"Poly before red: ");
3645 red_result = strat->red2(&strat->P,strat);
3655 if (red_result == 1)
3658 strat->
P.GetP(strat->
lmBin);
3669 pos =
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3673 pos =
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3682 strat->
P.pCleardenom();
3685 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3686 strat->
P.pCleardenom();
3693 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3703 if (strat->
minim==1)
3710 strat->
M->m[minimcnt]=strat->
P.p2;
3714 pNext(strat->
M->m[minimcnt])
3727 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3730 PrintS(
"ELEMENT ADDED TO GCURR DURING INTERRED: ");
3734 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
3738 if (strat->
sl>srmax) srmax = strat->
sl;
3754 memset(&(strat->
P), 0,
sizeof(strat->
P));
3758 while (cc<strat->tl+1)
3760 strat->
T[cc].sig =
pOne();
3763 strat->
sig[cc] = strat->
T[cc].sig;
3764 strat->
sevSig[cc] = strat->
T[cc].sevSig;
3765 strat->
T[cc].is_sigsafe =
TRUE;
3773 for (
int cd=strat->
Ll;
cd>=0;
cd--)
3781 printf(
"\nAfter f5c sorting\n");
3782 for(
int i=0;
i<=strat->
sl;
i++)
3788 PrintS(
"------------------- STRAT S ---------------------\n");
3790 while (cc<strat->tl+1)
3794 printf(
"- - - - - -\n");
3797 PrintS(
"-------------------------------------------------\n");
3798 PrintS(
"------------------- STRAT T ---------------------\n");
3800 while (cc<strat->tl+1)
3804 printf(
"- - - - - -\n");
3807 PrintS(
"-------------------------------------------------\n");
3808 PrintS(
"------------------- STRAT L ---------------------\n");
3810 while (cc<strat->Ll+1)
3816 printf(
"- - - - - -\n");
3819 PrintS(
"-------------------------------------------------\n");
3820 printf(
"F5C DONE\nSTRAT SL: %d -- %d\n",strat->
sl, strat->
currIdx);
3827 #ifdef HAVE_SHIFTBBA 3834 int hilbeledeg=1,hilbcount=0,minimcnt=0;
3864 #ifdef HAVE_TAIL_RING 3870 while (strat->
Ll >= 0)
3885 while ((strat->
Ll >= 0)
3886 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
3891 if (strat->
Ll<0)
break;
3895 strat->
P = strat->
L[strat->
Ll];
3918 else if (strat->
P.p1 ==
NULL)
3920 if (strat->
minim > 0)
3930 if ( ! strat->
homog)
3932 strat->
P.GetP(strat->
lmBin);
3939 strat->
P.t_p =
NULL;
3940 strat->
P.GetP(strat->
lmBin);
3955 strat->
P.t_p =
NULL;
3960 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3968 &olddeg,&reduc,strat, red_result);
3971 red_result = strat->red(&strat->P,strat);
3975 if (red_result == 1)
3981 strat->
P.GetP(strat->
lmBin);
3983 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3988 strat->
P.pCleardenom();
3991 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3992 strat->
P.pCleardenom();
3999 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
4012 if (strat->
minim==1)
4019 strat->
M->m[minimcnt]=strat->
P.p2;
4023 pNext(strat->
M->m[minimcnt])
4032 if ( ! strat->
homog)
4034 strat->
P.GetP(strat->
lmBin);
4036 if (strat->
P.p!=
NULL)
4043 strat->
P.t_p =
NULL;
4044 strat->
P.GetP(strat->
lmBin);
4056 strat->
P.t_p =
NULL;
4057 goto red_shrink2zero;
4067 strat->
P.t_p =
NULL;
4079 strat->
P.t_p =
NULL;
4080 goto red_shrink2zero;
4094 int atR=strat->
tl+1;
4100 strat->
enterS(strat->
P, pos, strat, atR);
4102 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
4115 memset(&(strat->
P), 0,
sizeof(strat->
P));
4138 Ln.SetShortExpVector();
4140 if (
j<0) {
k++;
j=-1;}
4146 if (
j<0) {
k++;
j=-1;}
4167 #ifdef HAVE_TAIL_RING 4196 return (strat->
Shdl);
4200 ideal
freegb(ideal I,
int uptodeg,
int lVblock)
4212 WerrorS(
"The input ideal contains incorrectly encoded elements! ");
4236 if (
h->IsNull())
return 0;
4244 d =
h->GetpFDeg() +
h->ecart;
4247 h->SetShortExpVector();
4253 h->SetDegStuffReturnLDeg(strat->
LDegLast);
4258 strat->
T[
j].pNorm();
4290 h->SetShortExpVector();
4303 h->SetDegStuffReturnLDeg(strat->
LDegLast);
4313 if (strat->
T[
j].ecart <=
h->ecart)
4314 h->ecart = d -
h->GetpFDeg();
4316 h->ecart = d -
h->GetpFDeg() + strat->
T[
j].ecart -
h->ecart;
4318 d =
h->GetpFDeg() +
h->ecart;
4321 d =
h->SetDegStuffReturnLDeg(strat->
LDegLast);
4330 && ((d >= reddeg) || (pass > strat->
LazyPass)))
4335 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
4336 if (at <= strat->Ll)
#define __p_GetComp(p, r)
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
#define omRealloc0Size(addr, o_size, size)
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
void initSbaPos(kStrategy strat)
static void nc_kBucketPolyRed_NF(kBucket_pt b, poly p, number *c)
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
int redRing(LObject *h, kStrategy strat)
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
void kBucketInit(kBucket_pt bucket, poly lm, int length)
static CanonicalForm bound(const CFMatrix &M)
static poly p_LmDeleteAndNext(poly p, const ring r)
#define TEST_OPT_DEGBOUND
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
void initBuchMoraPos(kStrategy strat)
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
CanonicalForm cd(bCommonDen(FF))
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
#define idDelete(H)
delete an ideal
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
void messageStat(int hilbcount, kStrategy strat)
void postReduceByMonSig(LObject *h, kStrategy strat)
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Compatiblity layer for legacy polynomial operations (over currRing)
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
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
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
int ideal_isInV(ideal I, int lV)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
#define TEST_OPT_CONTENTSB
static void p_GetExpV(poly p, int *ev, const ring r)
#define REDNF_CANONICALIZE
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
const poly kBucketGetLm(kBucket_pt bucket)
void initSba(ideal F, kStrategy strat)
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
void initSyzRules(kStrategy strat)
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static void kDeleteLcm(LObject *P)
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
void deleteInS(int i, kStrategy strat)
pShallowCopyDeleteProc p_shallow_copy_delete
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
void cancelunit(LObject *L, BOOLEAN inNF)
void WerrorS(const char *s)
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
void initBba(kStrategy strat)
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
static BOOLEAN rField_is_Z(const ring r)
int redSig(LObject *h, kStrategy strat)
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
int(* red)(LObject *L, kStrategy strat)
void initBuchMoraPosRing(kStrategy strat)
int redHomog(LObject *h, kStrategy strat)
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
int(* posInT)(const TSet T, const int tl, LObject &h)
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
#define pGetComp(p)
Component.
static void p_SetExpV(poly p, int *ev, const ring r)
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
int redFirstShift(LObject *h, kStrategy strat)
static poly p_Copy(poly p, const ring r)
returns a copy of p
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
char completeReduce_retry
void kStratInitChangeTailRing(kStrategy strat)
#define TEST_OPT_NOT_BUCKETS
void enterT(LObject &p, kStrategy strat, int atT)
int redHoney(LObject *h, kStrategy strat)
void deleteInL(LSet set, int *length, int j, kStrategy strat)
void updateSShift(kStrategy strat, int uptodeg, int lV)
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, int uptodeg, int lV)
poly p_Shrink(poly p, int lV, const ring r)
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
void(* initEcart)(TObject *L)
int redLazy(LObject *h, kStrategy strat)
void initS(ideal F, ideal Q, kStrategy strat)
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
void kBucketDestroy(kBucket_pt *bucket_pt)
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
#define TEST_OPT_INTSTRATEGY
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
void initEcartBBA(TObject *h)
void messageStatSBA(int hilbcount, kStrategy strat)
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
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:...
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
ideal kInterRed(ideal F, ideal Q)
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
static int p_LmCmp(poly p, poly q, const ring r)
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
void initBuchMoraCrit(kStrategy strat)
static int si_max(const int a, const int b)
void exitSba(kStrategy strat)
void PrintS(const char *s)
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)
int redSigRing(LObject *h, kStrategy strat)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
void f5c(kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
void rWrite(ring r, BOOLEAN details)
static unsigned pLength(poly a)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal freegb(ideal I, int uptodeg, int lVblock)
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
void rChangeCurrRing(ring r)
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
#define REDTAIL_CANONICALIZE
static void p_Delete(poly *p, const ring r)
void initBbaShift(kStrategy strat)
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
unsigned long p_GetShortExpVector(const poly p, const ring r)
ideal idInit(int idsize, int rank)
initialise an ideal / module
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
static BOOLEAN rField_is_Ring(const ring r)
void cleanT(kStrategy strat)
#define SBA_INTERRED_START
void pEnlargeSet(poly **p, int l, int increment)
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
void rDelete(ring r)
unconditionally deletes fields in r
long ind_fact_2(long arg)
int posInSyz(const kStrategy strat, poly sig)
void pNorm(poly p, const ring R=currRing)
static BOOLEAN length(leftv result, leftv arg)
void initSbaCrit(kStrategy strat)
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
void completeReduce(kStrategy strat, BOOLEAN withT)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
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)
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
void sort(CFArray &A, int l=0)
quick sort A
char posInLDependsOnLength
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
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
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
void initEcartNormal(TObject *h)
static poly p_Add_q(poly p, poly q, const ring r)
#define TEST_OPT_REDTHROUGH
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
int kBucketCanonicalize(kBucket_pt bucket)
Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in one bucket: Returns number of bu...
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
KINLINE poly kNoetherTail()
#define SI_RESTORE_OPT1(A)
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 exitBuchMora(kStrategy strat)
void Werror(const char *fmt,...)
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
void kDebugPrint(kStrategy strat)
void enterSyz(LObject &p, kStrategy strat, int atT)
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
#define pCopy(p)
return a copy of the poly
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)