19 #define PLURAL_INTERNAL_DECLARATIONS 1 38 #define SBA_INTERRED_START 0 39 #define SBA_TAIL_RED 1 40 #define SBA_PRODUCT_CRITERION 0 41 #define SBA_PRINT_ZERO_REDUCTIONS 0 42 #define SBA_PRINT_REDUCTION_STEPS 0 43 #define SBA_PRINT_OPERATIONS 0 44 #define SBA_PRINT_SIZE_G 0 45 #define SBA_PRINT_SIZE_SYZ 0 46 #define SBA_PRINT_PRODUCT_CRITERION 0 49 #if SBA_PRINT_REDUCTION_STEPS 50 long sba_reduction_steps;
51 long sba_interreduction_steps;
53 #if SBA_PRINT_OPERATIONS 55 long sba_interreduction_operations;
90 unsigned long not_sev = ~L->sev;
94 const unsigned long* sevT=strat->
sevT;
106 if (j > strat->
tl)
return -1;
107 #if defined(PDEBUG) || defined(PDIV_DEBUG) 114 if (!(sevT[j] & not_sev) &&
128 if (j > strat->
tl)
return -1;
129 #if defined(PDEBUG) || defined(PDIV_DEBUG) 135 if (!(sevT[j] & not_sev) &&
153 if (j > strat->
tl)
return -1;
154 #if defined(PDEBUG) || defined(PDIV_DEBUG) 162 if (!(sevT[j] & not_sev) &&
176 if (j > strat->
tl)
return -1;
177 #if defined(PDEBUG) || defined(PDIV_DEBUG) 184 if (!(sevT[j] & not_sev) &&
199 unsigned long not_sev = ~L->sev;
200 poly p = L->GetLmCurrRing();
207 else ende=
posInS(strat,*max_ind,p,0)+1;
208 if (ende>(*max_ind)) ende=(*max_ind);
217 if (j > ende)
return -1;
218 #if defined(PDEBUG) || defined(PDIV_DEBUG) 226 if ( !(strat->
sevS[j] & not_sev) &&
240 if (j > ende)
return -1;
241 #if defined(PDEBUG) || defined(PDIV_DEBUG) 248 if ( !(strat->
sevS[j] & not_sev) &&
261 unsigned long not_sev = ~L->sev;
262 poly p = L->GetLmCurrRing();
275 if (j > ende)
return -1;
276 #if defined(PDEBUG) || defined(PDIV_DEBUG) 284 if ( !(strat->
sevS[j] & not_sev) &&
298 if (j > ende)
return -1;
299 #if defined(PDEBUG) || defined(PDIV_DEBUG) 306 if ( !(strat->
sevS[j] & not_sev) &&
326 unsigned long a = (
unsigned long)
pGetCoeff(p);
329 int a_ind2 =
ind2(a);
333 for (
int i = 1;
i <= leadRing->N;
i++)
343 if (
n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
345 int too_much = k_ind2 + a_ind2 -
n_GetChar(leadRing->cf);
347 zeroPoly =
p_ISet(a, tailRing);
348 for (
int i = 1;
i <= leadRing->N;
i++)
355 while ( (0 <
ind2(s_exp)) && (
ind2(s_exp) <= too_much) )
357 too_much = too_much -
ind2(s_exp);
361 for (
int j = 1;
j <= s_exp;
j++)
364 tmp2 =
p_ISet(1, tailRing);
369 zeroPoly =
p_Mult_q(zeroPoly, tmp2, tailRing);
374 zeroPoly =
p_Mult_q(zeroPoly,
p_Add_q(tmp3, tmp2, tailRing), tailRing);
378 p_Setm(lead_mult, tailRing);
379 zeroPoly =
p_Mult_mm(zeroPoly, lead_mult, tailRing);
381 for (
int i = 1;
i <= leadRing->N;
i++)
387 pNext(tmp2) = zeroPoly;
434 if (h->IsNull())
return 0;
435 if (strat->
tl<0)
return 1;
445 assume(h->pFDeg() == h->FDeg);
446 long reddeg = h->GetpFDeg();
448 h->SetShortExpVector();
464 if (h->GetLmTailRing() ==
NULL)
477 if (h->GetLmTailRing() ==
NULL)
486 h->SetShortExpVector();
491 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
496 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
509 if (d >= (
long)strat->
tailRing->bitmask)
511 if (h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
516 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
538 if (strat->
tl<0)
return 1;
540 assume(h->FDeg == h->pFDeg());
544 unsigned long not_sev;
549 h->SetShortExpVector();
551 h_p = h->GetLmTailRing();
558 li = strat->
T[
j].pLength;
575 if ((strat->
T[i].pLength < li)
583 li = strat->
T[
i].pLength;
604 #if SBA_PRINT_REDUCTION_STEPS 605 sba_interreduction_steps++;
607 #if SBA_PRINT_OPERATIONS 608 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
620 h_p = h->GetLmTailRing();
629 h->SetShortExpVector();
641 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
650 Print(
" lazy: -> L%d\n",at);
663 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
665 Red->HeadNormalize();
699 if (strat->
tl<0)
return 1;
702 assume(h->FDeg == h->pFDeg());
705 PrintS(
"------- IN REDSIG -------\n");
712 PrintS(
"---------------------------\n");
718 unsigned long not_sev;
723 h->SetShortExpVector();
725 h_p = h->GetLmTailRing();
735 li = strat->
T[
j].pLength;
752 if ((strat->
T[i].pLength < li)
760 li = strat->
T[
i].pLength;
782 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
783 PrintS(
"--------------------------------\n");
786 pWrite(h->GetLmCurrRing());
790 PrintS(
"--------------------------------\n");
791 printf(
"INDEX OF REDUCER T: %d\n",ii);
794 #if SBA_PRINT_REDUCTION_STEPS 796 sba_reduction_steps++;
798 #if SBA_PRINT_OPERATIONS 800 sba_operations +=
pLength(strat->
T[ii].p);
807 Print(
"SigSAFE: %d\n",sigSafe);
822 h_p = h->GetLmTailRing();
831 h->SetShortExpVector();
843 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
854 Print(
" lazy: -> L%d\n",at);
873 printf(
"\nBefore sbaCheckGcdPair ");
pWrite(h->p);
878 printf(
"\nIntermidiate sbaCheckGcdPair ");
pWrite(h->p);
883 printf(
"\nAfter sbaCheckGcdPair ");
pWrite(h->p);
887 beforeredsig =
pCopy(h->sig);
889 if (strat->
tl<0)
return 1;
892 assume(h->FDeg == h->pFDeg());
894 printf(
"\n--------------------------redSig-------------------------------------\n");
895 printf(
"\nBefore redSig:\n");
900 Print(
"------- IN REDSIG -------\n");
907 Print(
"---------------------------\n");
913 unsigned long not_sev;
918 h->SetShortExpVector();
920 h_p = h->GetLmTailRing();
929 printf(
"\nBefore sbaCheckGcdPair ");
pWrite(h->p);
934 printf(
"\nIntermidiate sbaCheckGcdPair ");
pWrite(h->p);
937 h->is_redundant =
FALSE;
941 printf(
"\nAfter sbaCheckGcdPair ");
pWrite(h->p);
954 if (h->GetLmTailRing() ==
NULL)
961 if(
pLtCmp(beforeredsig,h->sig) == 1)
964 printf(
"\nSigDrop after reduce\n");
pWrite(beforeredsig);
pWrite(h->sig);
968 int red_result =
redRing(h,strat);
973 printf(
"\nReduced to 0 via redRing. Cancel sigdrop\n");
982 printf(
"\nReduced to this via redRing.SIGDROP\n");
pWrite(h->p);
993 li = strat->
T[
j].pLength;
1009 if ((strat->
T[i].pLength < li)
1017 li = strat->
T[
i].pLength;
1039 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
1040 Print(
"--------------------------------\n");
1043 pWrite(h->GetLmCurrRing());
1047 Print(
"--------------------------------\n");
1048 printf(
"INDEX OF REDUCER T: %d\n",ii);
1055 printf(
"\nAfter small reduction:\n");
pWrite(h->p);
pWrite(h->sig);
1068 printf(
"\nReducer and Original have same LT. Force it with redRing!\n");
1070 int red_result =
redRing(h,strat);
1074 printf(
"\nRedRing reduced it to 0. Perfect\n");
1082 printf(
"\nRedRing reduced it to *.\nHave to sigdrop now\n");
pWrite(h->p);
1091 #if SBA_PRINT_REDUCTION_STEPS 1093 sba_reduction_steps++;
1095 #if SBA_PRINT_OPERATIONS 1097 sba_operations +=
pLength(strat->
T[ii].p);
1104 Print(
"SigSAFE: %d\n",sigSafe);
1119 h_p = h->GetLmTailRing();
1128 h->SetShortExpVector();
1140 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1141 if (at <= strat->Ll)
1143 int dummy=strat->
sl;
1151 Print(
" lazy: -> L%d\n",at);
1164 #define REDTAIL_CANONICALIZE 100 1168 p = h = L->GetLmTailRing();
1170 return L->GetLmCurrRing();
1178 Ln.sevSig = L->sevSig;
1179 Ln.pLength = L->GetpLength() - 1;
1194 Ln.SetShortExpVector();
1200 With = &(strat->
T[
j]);
1205 if (With ==
NULL)
break;
1236 #if SBA_PRINT_REDUCTION_STEPS 1238 sba_reduction_steps++;
1240 #if SBA_PRINT_OPERATIONS 1242 sba_operations +=
pLength(With->p);
1252 pNext(h) = Ln.LmExtractAndIter();
1255 }
while (!Ln.IsNull());
1258 if (Ln.IsNull())
goto all_done;
1259 if (! withT) With_s.Init(
currRing);
1266 pNext(h) = Ln.LmExtractAndIter();
1283 return L->GetLmCurrRing();
1292 if (strat->
tl<0)
return 1;
1296 assume(h->pFDeg() == h->FDeg);
1297 long reddeg = h->GetpFDeg();
1299 unsigned long not_sev;
1301 h->SetShortExpVector();
1302 poly h_p = h->GetLmTailRing();
1307 if (j < 0)
return 1;
1309 li = strat->
T[
j].pLength;
1313 li=strat->
T[
j].pLength=
pLength(strat->
T[j].p);
1334 if (strat->
T[i].pLength==0)
1340 if ((strat->
T[i].pLength < li)
1349 li = strat->
T[
i].pLength;
1371 #if SBA_PRINT_REDUCTION_STEPS 1372 sba_interreduction_steps++;
1374 #if SBA_PRINT_OPERATIONS 1375 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1387 h_p=h->GetLmTailRing();
1397 h->SetShortExpVector();
1403 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
1406 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1407 if (at <= strat->Ll)
1410 int dummy=strat->
sl;
1422 else if (d != reddeg)
1424 if (d>=(
long)strat->
tailRing->bitmask)
1426 if (h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
1431 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1452 if (strat->
tl<0)
return 1;
1454 assume(h->FDeg == h->pFDeg());
1456 int i,
j,at,pass,ei, ii, h_d;
1457 unsigned long not_sev;
1461 d = reddeg = h->GetpFDeg() + h->ecart;
1462 h->SetShortExpVector();
1464 h_p = h->GetLmTailRing();
1471 if (j < 0)
return 1;
1473 ei = strat->
T[
j].ecart;
1474 li = strat->
T[
j].pLength;
1492 if ((((strat->
T[i].ecart < ei) && (ei> h->ecart))
1493 || ((strat->
T[i].ecart <= h->ecart) && (strat->
T[i].pLength < li)))
1501 ei = strat->
T[
i].ecart;
1502 li = strat->
T[
i].pLength;
1521 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1547 #if SBA_PRINT_REDUCTION_STEPS 1548 sba_interreduction_steps++;
1550 #if SBA_PRINT_OPERATIONS 1551 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1580 else if (h->t_p!=
NULL)
1589 h->SetShortExpVector();
1591 h_d = h->SetpFDeg();
1596 h->ecart = d-h_d+ei-h->ecart;
1610 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1611 if (at <= strat->Ll)
1613 int dummy=strat->
sl;
1619 Print(
" degree jumped: -> L%d\n",at);
1625 else if (d > reddeg)
1627 if (d>=(
long)strat->
tailRing->bitmask)
1629 if (h->pTotalDeg()+h->ecart >= (long)strat->
tailRing->bitmask)
1634 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1665 P.SetShortExpVector();
1693 int sl=
pSize(strat->
S[j]);
1765 P.SetShortExpVector();
1804 int hilbeledeg=1,hilbcount=0,minimcnt=0;
1827 withT = ! strat->
homog;
1832 #ifdef HAVE_TAIL_RING 1848 while (strat->
Ll >= 0)
1851 printf(
"\n ------------------------NEW LOOP\n");
1852 printf(
"\nShdl = \n");
1856 for(
int ii = 0; ii<=strat->
sl;ii++)
1859 printf(
"\n list L\n");
1862 for(iii = 0; iii<= strat->
Ll; iii++)
1864 printf(
"L[%i]:",iii);
1871 printf(
"L[%i]:",strat->
Ll);
1878 for(iii = 0; iii<= strat->
Bl; iii++)
1880 printf(
"B[%i]:",iii);
1901 while ((strat->
Ll >= 0)
1902 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
1907 if (strat->
Ll<0)
break;
1911 strat->
P = strat->
L[strat->
Ll];
1941 else if (strat->
P.p1 ==
NULL)
1943 if (strat->
minim > 0)
1949 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
1957 &olddeg,&reduc,
strat, red_result);
1960 red_result = strat->red(&strat->P,strat);
1970 if (red_result == 1)
1973 strat->
P.GetP(strat->
lmBin);
1982 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
1989 strat->
P.pCleardenom();
1992 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
1993 strat->
P.pCleardenom();
2000 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
2010 if (strat->
minim==1)
2017 strat->
M->m[minimcnt]=strat->
P.p2;
2021 pNext(strat->
M->m[minimcnt])
2037 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2039 printf(
"\nThis element has been added to S:\n");
pWrite(strat->
P.p);
pWrite(strat->
P.p1);
pWrite(strat->
P.p2);
2055 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2057 if (strat->
P.lcm!=
NULL)
2068 if (strat->
s_poly(strat))
2073 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
2079 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2083 else if (strat->
P.p1 ==
NULL && strat->
minim > 0)
2089 memset(&(strat->
P), 0,
sizeof(strat->
P));
2120 #ifdef HAVE_TAIL_RING 2128 for(i=strat->
sl;i>=0;i--) strat->
S_2_R[
i]=-1;
2138 for(
int i = 0;
i<=strat->
sl;
i++)
2163 return (strat->
Shdl);
2175 #if SBA_PRINT_ZERO_REDUCTIONS 2176 long zeroreductions = 0;
2178 #if SBA_PRINT_PRODUCT_CRITERION 2179 long product_criterion = 0;
2181 #if SBA_PRINT_SIZE_G 2183 int size_g_non_red = 0;
2185 #if SBA_PRINT_SIZE_SYZ 2189 #if SBA_PRINT_REDUCTION_STEPS 2190 sba_reduction_steps = 0;
2191 sba_interreduction_steps = 0;
2193 #if SBA_PRINT_OPERATIONS 2195 sba_interreduction_operations = 0;
2199 ring sRing, currRingOld;
2204 if (sRing!=currRingOld)
2223 dummy =
pCopy(F->m[0]);
2225 F->m[
i] = F->m[
i+1];
2246 dummy =
pCopy(F->m[0]);
2248 F->m[
i] = F->m[
i+1];
2267 F->m[
i] = F1->m[(*sort)[
i]-1];
2281 F->m[
j] = F->m[
j-1];
2299 printf(
"SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2301 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
2304 int srmax,lrmax, red_result = 1;
2306 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2320 reduc = olddeg = lrmax = 0;
2333 #ifdef HAVE_TAIL_RING 2351 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
2361 while (strat->
Ll >= 0)
2364 printf(
"\n ------------------------NEW LOOP\n");
2365 printf(
"\nShdl = \n");
2369 for(
int ii = 0; ii<=strat->
sl;ii++)
2376 for(
int iii = 0; iii< strat->
syzl; iii++)
2378 printf(
"\nsyz[%i]:\n",iii);
2383 for(
int iii = 0; iii<= strat->
tl; iii++)
2385 printf(
"\nT[%i]:\n",iii);
2389 printf(
"\n list L\n");
2392 for(iii = 0; iii<= strat->
Ll; iii++)
2394 printf(
"\nL[%i]:\n",iii);
2402 printf(
"L[%i]:",strat->
Ll);
2411 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2441 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2442 lrmax, reduc, Q, w, hilb );
2452 strat->
P = strat->
L[strat->
Ll];
2459 printf(
"\n-------------------------\nThis is the current element P\n");
2466 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(),
strat, strat->
P.checked+1)) {
2469 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2470 PrintS(
"-------------------------------------------------\n");
2475 PrintS(
"-------------------------------------------------\n");
2510 else if (strat->
P.p1 ==
NULL)
2512 if (strat->
minim > 0)
2518 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2526 PrintS(
"Poly before red: ");
2530 #if SBA_PRODUCT_CRITERION 2531 if (strat->
P.prod_crit) {
2532 #if SBA_PRINT_PRODUCT_CRITERION 2533 product_criterion++;
2535 int pos =
posInSyz(strat, strat->
P.sig);
2537 if (strat->
P.lcm!=
NULL)
2541 red_result = strat->
red(&strat->
P,strat);
2544 red_result = strat->
red(&strat->
P,strat);
2558 strat->
P.p =
pNeg(strat->
P.p);
2559 strat->
P.sig =
pNeg(strat->
P.sig);
2562 if(strat->
P.sig !=
NULL)
2564 if(strat->
P.p !=
NULL)
2568 printf(
"\nAfter reduce (redresult=%i): \n",red_result);
pWrite(strat->
P.p);
pWrite(strat->
P.sig);
2575 printf(
"\nSigdrop in the reduce. Trying redring\n");
2577 red_result =
redRing(&strat->
P,strat);
2581 printf(
"\nSigdrop cancelled since redRing reduced to 0\n");
2585 strat->
P.sig =
NULL;
2590 printf(
"\nStill Sigdrop - redRing reduced to:\n");
pWrite(strat->
P.p);
2592 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2601 printf(
"\nToo many blocked reductions\n");
2611 if (red_result != 0) {
2612 PrintS(
"Poly after red: ");
2614 pWrite(strat->
P.GetLmCurrRing());
2616 printf(
"%d\n",red_result);
2621 if(strat->
P.p !=
NULL)
2623 &olddeg,&reduc,
strat, red_result);
2625 message((strat->honey ? strat->P.ecart : 0),
2626 &olddeg,&reduc,strat, red_result);
2634 if (red_result == 1)
2637 strat->
P.GetP(strat->
lmBin);
2641 (strat->
P).FDeg = (strat->
P).pFDeg();
2653 int pos = strat->
sl+1;
2661 beforetailred =
pCopy(strat->
P.sig);
2667 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2674 strat->
P.pCleardenom();
2677 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2678 strat->
P.pCleardenom();
2685 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2695 printf(
"\n Still sigdrop after redtailSba - it reduced to \n");
pWrite(strat->
P.p);
2697 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2703 if(strat->
P.sig ==
NULL ||
pLtCmp(beforetailred,strat->
P.sig) == 1)
2706 printf(
"\nSigDrop after TAILred\n");
pWrite(beforetailred);
pWrite(strat->
P.sig);
2710 red_result =
redRing(&strat->
P,strat);
2715 printf(
"\nReduced to 0 via redRing. Cancel sigdrop\n");
2723 printf(
"\nReduced to this via redRing.SIGDROP\n");
pWrite(strat->
P.p);
2725 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2731 if(strat->
P.p ==
NULL)
2732 goto case_when_red_result_changed;
2735 printf(
"\nNach redTailSba: \n");
2742 for (
int jj = 0; jj<strat->
tl+1; jj++)
2746 strat->
T[jj].is_sigsafe =
FALSE;
2752 for (
int jj = 0; jj<strat->
tl+1; jj++)
2754 strat->
T[jj].is_sigsafe =
FALSE;
2764 if (strat->
minim==1)
2771 strat->
M->m[minimcnt]=strat->
P.p2;
2775 pNext(strat->
M->m[minimcnt])
2785 strat->
T[strat->
tl].is_sigsafe =
FALSE;
2796 printf(
"\nThis element is added to S\n");
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));
2842 Q.sig =
pCopy(strat->
P.sig);
2880 for (
int i=0;
i<strat->
sl; ++
i) {
2894 for (
int i=cmp+1;
i<=max_cmp; ++
i) {
2896 for (
int j=0;
j<strat->
sl; ++
j) {
2927 printf(
"---------------------------\n");
2928 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
2951 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2953 if (strat->
P.lcm!=
NULL)
2959 if (strat->
sl>srmax) srmax = strat->
sl;
2963 case_when_red_result_changed:
2969 if (red_result!=2) {
2970 #if SBA_PRINT_ZERO_REDUCTIONS 2979 int pos =
posInSyz(strat, strat->
P.sig);
2983 Print(
"ADDING STUFF TO SYZ : ");
2996 memset(&(strat->
P), 0,
sizeof(strat->
P));
3002 printf(
"\nSigDrop!\n");
3004 printf(
"\nEnded with no SigDrop\n");
3010 if(strat->
P.sig !=
NULL)
3014 memset(&(strat->
P), 0,
sizeof(strat->
P));
3044 #ifdef HAVE_TAIL_RING 3052 for(i=strat->
sl;i>=0;i--) strat->
S_2_R[
i]=-1;
3059 #if SBA_PRINT_SIZE_SYZ 3061 size_syz = strat->
syzl;
3074 #if SBA_PRINT_SIZE_G 3089 for(;k>=0 && (strat->
L[
k].p1 !=
NULL || strat->
L[
k].p2 !=
NULL);k--)
3099 for(;k>=0 && strat->
L[
k].p1 ==
NULL && strat->
L[
k].p2 ==
NULL;k--)
3102 strat->
enterS(strat->
L[k], strat->
sl+1, strat, strat->
tl);
3110 for(k=strat->
sl;k>=0;k--)
3112 printf(
"\nsig[%i] = ",
i);
pWrite(strat->
sig[k]);
3143 #if SBA_PRINT_SIZE_G 3147 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
3151 printf(
" %d. ",oo+1);
3156 #if SBA_PRINT_ZERO_REDUCTIONS 3157 printf(
"----------------------------------------------------------\n");
3158 printf(
"ZERO REDUCTIONS: %ld\n",zeroreductions);
3161 #if SBA_PRINT_REDUCTION_STEPS 3162 printf(
"----------------------------------------------------------\n");
3163 printf(
"S-REDUCTIONS: %ld\n",sba_reduction_steps);
3165 #if SBA_PRINT_OPERATIONS 3166 printf(
"OPERATIONS: %ld\n",sba_operations);
3168 #if SBA_PRINT_REDUCTION_STEPS 3169 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3170 printf(
"INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3172 #if SBA_PRINT_OPERATIONS 3173 printf(
"INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3175 #if SBA_PRINT_REDUCTION_STEPS 3176 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3177 printf(
"ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3178 sba_interreduction_steps = 0;
3179 sba_reduction_steps = 0;
3181 #if SBA_PRINT_OPERATIONS 3182 printf(
"ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3183 sba_interreduction_operations = 0;
3186 #if SBA_PRINT_SIZE_G 3187 printf(
"----------------------------------------------------------\n");
3188 printf(
"SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3192 #if SBA_PRINT_SIZE_SYZ 3193 printf(
"SIZE OF SYZ: %ld\n",size_syz);
3194 printf(
"----------------------------------------------------------\n");
3197 #if SBA_PRINT_PRODUCT_CRITERION 3198 printf(
"PRODUCT CRITERIA: %ld\n",product_criterion);
3199 product_criterion = 0;
3201 return (strat->
Shdl);
3254 p =
redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3309 for (i=
IDELEMS(q)-1; i>=0; i--)
3324 p =
redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3357 int& hilbcount,
int& srmax,
int& lrmax,
int& reduc, ideal
Q,
3360 int Ll_old, red_result = 1;
3366 reduc = olddeg = lrmax = 0;
3371 while (strat->
tl >= 0)
3373 if(!strat->
T[strat->
tl].is_redundant)
3376 h.p = strat->
T[strat->
tl].p;
3377 h.tailRing = strat->
T[strat->
tl].tailRing;
3378 h.t_p = strat->
T[strat->
tl].t_p;
3418 while (strat->
Ll>Ll_old)
3420 strat->
P = strat->
L[strat->
Ll];
3424 PrintS(
"NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3425 PrintS(
"-------------------------------------------------\n");
3429 printf(
"%d\n",strat->
tl);
3430 PrintS(
"-------------------------------------------------\n");
3463 else if (strat->
P.p1 ==
NULL)
3465 if (strat->
minim > 0)
3472 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3480 &olddeg,&reduc,
strat, red_result);
3483 PrintS(
"Poly before red: ");
3487 red_result = strat->red2(&strat->P,strat);
3497 if (red_result == 1)
3500 strat->
P.GetP(strat->
lmBin);
3511 pos =
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3515 pos =
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3524 strat->
P.pCleardenom();
3527 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3528 strat->
P.pCleardenom();
3535 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3545 if (strat->
minim==1)
3552 strat->
M->m[minimcnt]=strat->
P.p2;
3556 pNext(strat->
M->m[minimcnt])
3569 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3572 PrintS(
"ELEMENT ADDED TO GCURR DURING INTERRED: ");
3576 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3579 if (strat->
P.lcm!=
NULL)
3585 if (strat->
sl>srmax) srmax = strat->
sl;
3601 memset(&(strat->
P), 0,
sizeof(strat->
P));
3605 while (cc<strat->tl+1)
3607 strat->
T[cc].sig =
pOne();
3610 strat->
sig[cc] = strat->
T[cc].sig;
3611 strat->
sevSig[cc] = strat->
T[cc].sevSig;
3612 strat->
T[cc].is_sigsafe =
TRUE;
3620 for (
int cd=strat->
Ll;
cd>=0;
cd--)
3628 printf(
"\nAfter f5c sorting\n");
3629 for(
int i=0;
i<=strat->
sl;
i++)
3635 PrintS(
"------------------- STRAT S ---------------------\n");
3637 while (cc<strat->tl+1)
3641 printf(
"- - - - - -\n");
3644 PrintS(
"-------------------------------------------------\n");
3645 PrintS(
"------------------- STRAT T ---------------------\n");
3647 while (cc<strat->tl+1)
3651 printf(
"- - - - - -\n");
3654 PrintS(
"-------------------------------------------------\n");
3655 PrintS(
"------------------- STRAT L ---------------------\n");
3657 while (cc<strat->Ll+1)
3663 printf(
"- - - - - -\n");
3666 PrintS(
"-------------------------------------------------\n");
3667 printf(
"F5C DONE\nSTRAT SL: %d -- %d\n",strat->
sl, strat->
currIdx);
3674 #ifdef HAVE_SHIFTBBA 3681 int hilbeledeg=1,hilbcount=0,minimcnt=0;
3711 #ifdef HAVE_TAIL_RING 3716 while (strat->
Ll >= 0)
3731 while ((strat->
Ll >= 0)
3732 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
3737 if (strat->
Ll<0)
break;
3741 strat->
P = strat->
L[strat->
Ll];
3764 else if (strat->
P.p1 ==
NULL)
3766 if (strat->
minim > 0)
3776 if ( ! strat->
homog)
3778 strat->
P.GetP(strat->
lmBin);
3789 strat->
P.GetP(strat->
lmBin);
3805 strat->
P.t_p =
NULL;
3811 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3819 &olddeg,&reduc,
strat, red_result);
3822 red_result = strat->red(&strat->P,strat);
3826 if (red_result == 1)
3832 strat->
P.GetP(strat->
lmBin);
3834 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3839 strat->
P.pCleardenom();
3842 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3843 strat->
P.pCleardenom();
3850 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3863 if (strat->
minim==1)
3870 strat->
M->m[minimcnt]=strat->
P.p2;
3874 pNext(strat->
M->m[minimcnt])
3883 if ( ! strat->
homog)
3885 strat->
P.GetP(strat->
lmBin);
3897 strat->
P.GetP(strat->
lmBin);
3910 strat->
P.t_p =
NULL;
3912 goto red_shrink2zero;
3929 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3931 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3944 memset(&(strat->
P), 0,
sizeof(strat->
P));
3967 Ln.SetShortExpVector();
3969 if (j<0) { k++; j=-1;}
3972 if (
pLmCmp(strat->
S[k],strat->
T[j].p) == 0)
3975 if (j<0) { k++; j=-1;}
3998 for(i=strat->
sl;i>=0;i--) strat->
S_2_R[
i]=-1;
4017 return (strat->
Shdl);
4021 ideal
freegb(ideal I,
int uptodeg,
int lVblock)
4033 WerrorS(
"The input ideal contains incorrectly encoded elements! ");
4057 if (h->IsNull())
return 0;
4065 d = h->GetpFDeg() + h->ecart;
4068 h->SetShortExpVector();
4074 h->SetDegStuffReturnLDeg(strat->
LDegLast);
4079 strat->
T[
j].pNorm();
4112 h->SetShortExpVector();
4125 h->SetDegStuffReturnLDeg(strat->
LDegLast);
4135 if (strat->
T[j].ecart <= h->ecart)
4136 h->ecart = d - h->GetpFDeg();
4138 h->ecart = d - h->GetpFDeg() + strat->
T[
j].ecart - h->ecart;
4140 d = h->GetpFDeg() + h->ecart;
4143 d = h->SetDegStuffReturnLDeg(strat->
LDegLast);
4152 && ((d >= reddeg) || (pass > strat->
LazyPass)))
4157 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
4158 if (at <= strat->Ll)
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)
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)
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 void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
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
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)
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
BOOLEAN posInLDependsOnLength
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
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)
#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.
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)
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 int pLength(poly a)
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)
void(* initEcart)(TObject *L)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
int redLazy(LObject *h, kStrategy strat)
int posInSMonFirst(const kStrategy strat, const int length, const poly p, const int ecart_p)
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)
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy strat)
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 : 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.cc )
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)
#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 : 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)
void initSbaCrit(kStrategy strat)
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
void completeReduce(kStrategy strat, BOOLEAN withT)
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
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
void p_Write(poly p, ring lmRing, ring tailRing)
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)
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 kDebugPrint(kStrategy strat)
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
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)