23 #define ADIDEBUG_COUNT 0 26 # ifdef HAVE_TAIL_RING 27 # undef HAVE_TAIL_RING 28 # endif // ifdef HAVE_TAIL_RING 35 #define PLURAL_INTERNAL_DECLARATIONS 1 54 #define SBA_INTERRED_START 0 55 #define SBA_TAIL_RED 1 56 #define SBA_PRODUCT_CRITERION 0 57 #define SBA_PRINT_ZERO_REDUCTIONS 0 58 #define SBA_PRINT_REDUCTION_STEPS 0 59 #define SBA_PRINT_OPERATIONS 0 60 #define SBA_PRINT_SIZE_G 0 61 #define SBA_PRINT_SIZE_SYZ 0 62 #define SBA_PRINT_PRODUCT_CRITERION 0 65 #if SBA_PRINT_REDUCTION_STEPS 66 long sba_reduction_steps;
67 long sba_interreduction_steps;
69 #if SBA_PRINT_OPERATIONS 71 long sba_interreduction_operations;
106 unsigned long not_sev = ~L->sev;
110 const unsigned long* sevT=strat->
sevT;
120 if (j > strat->
tl)
return -1;
121 #if defined(PDEBUG) || defined(PDIV_DEBUG) 137 if (!(sevT[j] & not_sev) &&
162 if (j > strat->
tl)
return -1;
163 #if defined(PDEBUG) || defined(PDIV_DEBUG) 180 if (!(sevT[j] & not_sev) &&
204 unsigned long not_sev = ~L->sev;
205 poly p = L->GetLmCurrRing();
211 if ((strat->
ak>0) ||
currRing->pLexOrder) ende=strat->
sl;
212 else ende=
posInS(strat,*max_ind,p,0)+1;
213 if (ende>(*max_ind)) ende=(*max_ind);
220 if (j > ende)
return -1;
221 #if defined(PDEBUG) || defined(PDIV_DEBUG) 234 if ( !(strat->
sevS[j] & not_sev) &&
252 unsigned long not_sev = ~L->sev;
253 poly p = L->GetLmCurrRing();
264 if (j > ende)
return -1;
265 #if defined(PDEBUG) || defined(PDIV_DEBUG) 278 if ( !(strat->
sevS[j] & not_sev) &&
303 unsigned long a = (
unsigned long)
pGetCoeff(p);
306 int a_ind2 =
ind2(a);
310 for (
int i = 1;
i <= leadRing->N;
i++)
320 if (
n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
322 int too_much = k_ind2 + a_ind2 -
n_GetChar(leadRing->cf);
324 zeroPoly =
p_ISet(a, tailRing);
325 for (
int i = 1;
i <= leadRing->N;
i++)
332 while ( (0 <
ind2(s_exp)) && (
ind2(s_exp) <= too_much) )
334 too_much = too_much -
ind2(s_exp);
338 for (
int j = 1;
j <= s_exp;
j++)
341 tmp2 =
p_ISet(1, tailRing);
346 zeroPoly =
p_Mult_q(zeroPoly, tmp2, tailRing);
351 zeroPoly =
p_Mult_q(zeroPoly,
p_Add_q(tmp3, tmp2, tailRing), tailRing);
355 p_Setm(lead_mult, tailRing);
356 zeroPoly =
p_Mult_mm(zeroPoly, lead_mult, tailRing);
358 for (
int i = 1;
i <= leadRing->N;
i++)
364 pNext(tmp2) = zeroPoly;
411 if (h->IsNull())
return 0;
412 if (strat->
tl<0)
return 1;
422 assume(h->pFDeg() == h->FDeg);
423 long reddeg = h->GetpFDeg();
425 h->SetShortExpVector();
441 if (h->GetLmTailRing() ==
NULL)
452 printf(
"\nFound j = %i\n",j);
pWrite(strat->
T[j].p);
457 printf(
"\nand after reduce: \n");
pWrite(h->p);
460 if (h->GetLmTailRing() ==
NULL)
469 h->SetShortExpVector();
474 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
479 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
492 if (d >= (
long)strat->
tailRing->bitmask)
494 if (h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
499 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
521 if (strat->
tl<0)
return 1;
523 assume(h->FDeg == h->pFDeg());
527 unsigned long not_sev;
532 h->SetShortExpVector();
534 h_p = h->GetLmTailRing();
541 li = strat->
T[
j].pLength;
558 if ((strat->
T[i].pLength < li)
566 li = strat->
T[
i].pLength;
587 #if SBA_PRINT_REDUCTION_STEPS 588 sba_interreduction_steps++;
590 #if SBA_PRINT_OPERATIONS 591 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
603 h_p = h->GetLmTailRing();
612 h->SetShortExpVector();
624 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
633 Print(
" lazy: -> L%d\n",at);
647 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
648 Red->HeadNormalize();
680 if (strat->
tl<0)
return 1;
683 assume(h->FDeg == h->pFDeg());
686 Print(
"------- IN REDSIG -------\n");
693 Print(
"---------------------------\n");
699 unsigned long not_sev;
704 h->SetShortExpVector();
706 h_p = h->GetLmTailRing();
716 li = strat->
T[
j].pLength;
733 if ((strat->
T[i].pLength < li)
741 li = strat->
T[
i].pLength;
763 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
764 Print(
"--------------------------------\n");
767 pWrite(h->GetLmCurrRing());
771 Print(
"--------------------------------\n");
772 printf(
"INDEX OF REDUCER T: %d\n",ii);
775 #if SBA_PRINT_REDUCTION_STEPS 777 sba_reduction_steps++;
779 #if SBA_PRINT_OPERATIONS 781 sba_operations +=
pLength(strat->
T[ii].p);
788 Print(
"SigSAFE: %d\n",sigSafe);
803 h_p = h->GetLmTailRing();
812 h->SetShortExpVector();
824 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
835 Print(
" lazy: -> L%d\n",at);
848 #define REDTAIL_CANONICALIZE 100 852 p = h = L->GetLmTailRing();
854 return L->GetLmCurrRing();
862 Ln.sevSig = L->sevSig;
863 Ln.pLength = L->GetpLength() - 1;
876 Ln.SetShortExpVector();
882 With = &(strat->
T[
j]);
887 if (With ==
NULL)
break;
907 #if SBA_PRINT_REDUCTION_STEPS 909 sba_reduction_steps++;
911 #if SBA_PRINT_OPERATIONS 913 sba_operations +=
pLength(With->p);
923 pNext(h) = Ln.LmExtractAndIter();
926 }
while (!Ln.IsNull());
929 if (Ln.IsNull())
goto all_done;
932 pNext(h) = Ln.LmExtractAndIter();
950 return L->GetLmCurrRing();
959 if (strat->
tl<0)
return 1;
963 assume(h->pFDeg() == h->FDeg);
964 long reddeg = h->GetpFDeg();
966 unsigned long not_sev;
968 h->SetShortExpVector();
969 poly h_p = h->GetLmTailRing();
976 li = strat->
T[
j].pLength;
980 li=strat->
T[
j].pLength=
pLength(strat->
T[j].p);
1001 if (strat->
T[i].pLength==0)
1007 if ((strat->
T[i].pLength < li)
1016 li = strat->
T[
i].pLength;
1038 #if SBA_PRINT_REDUCTION_STEPS 1039 sba_interreduction_steps++;
1041 #if SBA_PRINT_OPERATIONS 1042 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1054 h_p=h->GetLmTailRing();
1064 h->SetShortExpVector();
1070 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
1073 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1074 if (at <= strat->Ll)
1077 int dummy=strat->
sl;
1089 else if (d != reddeg)
1091 if (d>=(
long)strat->
tailRing->bitmask)
1093 if (h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
1098 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1119 if (strat->
tl<0)
return 1;
1121 assume(h->FDeg == h->pFDeg());
1123 int i,
j,at,pass,ei, ii, h_d;
1124 unsigned long not_sev;
1128 d = reddeg = h->GetpFDeg() + h->ecart;
1129 h->SetShortExpVector();
1131 h_p = h->GetLmTailRing();
1138 if (j < 0)
return 1;
1140 ei = strat->
T[
j].ecart;
1141 li = strat->
T[
j].pLength;
1159 if ((((strat->
T[i].ecart < ei) && (ei> h->ecart))
1160 || ((strat->
T[i].ecart <= h->ecart) && (strat->
T[i].pLength < li)))
1168 ei = strat->
T[
i].ecart;
1169 li = strat->
T[
i].pLength;
1188 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1214 #if SBA_PRINT_REDUCTION_STEPS 1215 sba_interreduction_steps++;
1217 #if SBA_PRINT_OPERATIONS 1218 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1247 else if (h->t_p!=
NULL)
1256 h->SetShortExpVector();
1258 h_d = h->SetpFDeg();
1263 h->ecart = d-h_d+ei-h->ecart;
1277 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1278 if (at <= strat->Ll)
1280 int dummy=strat->
sl;
1286 Print(
" degree jumped: -> L%d\n",at);
1292 else if (d > reddeg)
1294 if (d>=(
long)strat->
tailRing->bitmask)
1296 if (h->pTotalDeg()+h->ecart >= (long)strat->
tailRing->bitmask)
1301 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
1332 P.SetShortExpVector();
1360 int sl=
pSize(strat->
S[j]);
1432 P.SetShortExpVector();
1471 int hilbeledeg=1,hilbcount=0,minimcnt=0;
1491 withT = ! strat->
homog;
1500 PrintS(
"bba start GB: currRing: ");
1508 #ifdef HAVE_TAIL_RING 1524 while (strat->
Ll >= 0)
1527 printf(
"\n ------------------------NEW LOOP\n");
1528 printf(
"\nShdl = \n");
1532 for(
int ii = 0; ii<=strat->
sl;ii++)
1535 printf(
"\n list L\n");
1538 for(iii = 0; iii<= strat->
Ll; iii++)
1540 printf(
"L[%i]:",iii);
1547 printf(
"L[%i]:",strat->
Ll);
1554 for(iii = 0; iii<= strat->
Bl; iii++)
1556 printf(
"B[%i]:",iii);
1577 while ((strat->
Ll >= 0)
1578 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
1583 if (strat->
Ll<0)
break;
1587 strat->
P = strat->
L[strat->
Ll];
1619 else if (strat->
P.p1 ==
NULL)
1621 if (strat->
minim > 0)
1627 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
1635 &olddeg,&reduc,
strat, red_result);
1639 printf(
"\nBefore \n");
pWrite(strat->P.p);
1641 red_result = strat->red(&strat->P,strat);
1643 printf(
"\nAfter \n");
pWrite(strat->P.p);
1654 if (red_result == 1)
1657 strat->
P.GetP(strat->
lmBin);
1666 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
1679 strat->
P.pCleardenom();
1682 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
1683 strat->
P.pCleardenom();
1690 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
1703 if (strat->
minim==1)
1710 strat->
M->m[minimcnt]=strat->
P.p2;
1714 pNext(strat->
M->m[minimcnt])
1733 printf(
"\nThis element is added to S\n");
1736 strat->
enterS(strat->
P, pos, strat, strat->
tl);
1753 if (strat->
s_poly(strat))
1758 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
1766 strat->
enterS(strat->
P, pos, strat, strat->
tl);
1770 for(
int iii = 0; iii<=strat->
tl;iii++)
1772 printf(
"\nT[%i] = ",iii);
pWrite(strat->
T[iii].p);
1776 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1778 if (strat->
P.lcm!=
NULL)
1785 else if (strat->
P.p1 ==
NULL && strat->
minim > 0)
1791 memset(&(strat->
P), 0,
sizeof(strat->
P));
1827 #ifdef HAVE_TAIL_RING 1835 for(i=strat->
sl;i>=0;i--) strat->
S_2_R[
i]=-1;
1846 for(
int i = 0;
i<=strat->
sl;
i++)
1877 return (strat->
Shdl);
1888 #if SBA_PRINT_ZERO_REDUCTIONS 1889 long zeroreductions = 0;
1891 #if SBA_PRINT_PRODUCT_CRITERION 1892 long product_criterion = 0;
1894 #if SBA_PRINT_SIZE_G 1896 int size_g_non_red = 0;
1898 #if SBA_PRINT_SIZE_SYZ 1902 #if SBA_PRINT_REDUCTION_STEPS 1903 sba_reduction_steps = 0;
1904 sba_interreduction_steps = 0;
1906 #if SBA_PRINT_OPERATIONS 1908 sba_interreduction_operations = 0;
1912 ring sRing, currRingOld;
1917 if (sRing!=currRingOld)
1927 F->m[
i] = F1->m[(*sort)[
i]-1];
1928 #if SBA_INTERRED_START 1932 printf(
"SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
1934 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
1937 int srmax,lrmax, red_result = 1;
1939 int hilbeledeg=1,hilbcount=0,minimcnt=0;
1954 reduc = olddeg = lrmax = 0;
1972 PrintS(
"bba start GB: currRing: ");
1980 #ifdef HAVE_TAIL_RING 1996 while (strat->
Ll >= 0)
1998 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2028 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2029 lrmax, reduc, Q, w, hilb );
2040 strat->
P = strat->
L[strat->
Ll];
2044 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(),
strat, strat->
P.checked+1)) {
2047 Print(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2048 Print(
"-------------------------------------------------\n");
2053 Print(
"-------------------------------------------------\n");
2090 else if (strat->
P.p1 ==
NULL)
2092 if (strat->
minim > 0)
2097 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2105 Print(
"Poly before red: ");
2109 #if SBA_PRODUCT_CRITERION 2110 if (strat->
P.prod_crit) {
2111 #if SBA_PRINT_PRODUCT_CRITERION 2112 product_criterion++;
2114 int pos =
posInSyz(strat, strat->
P.sig);
2116 if (strat->
P.lcm!=
NULL)
2120 red_result = strat->
red(&strat->
P,strat);
2123 red_result = strat->
red(&strat->
P,strat);
2137 if (red_result != 0) {
2138 Print(
"Poly after red: ");
2140 pWrite(strat->
P.GetLmCurrRing());
2142 printf(
"%d\n",red_result);
2152 if (red_result == 1)
2155 strat->
P.GetP(strat->
lmBin);
2159 (strat->
P).FDeg = (strat->
P).pFDeg();
2171 int pos = strat->
sl+1;
2186 strat->
P.pCleardenom();
2189 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2190 strat->
P.pCleardenom();
2197 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2206 for (
int jj = 0; jj<strat->
tl+1; jj++)
2210 strat->
T[jj].is_sigsafe =
FALSE;
2216 for (
int jj = 0; jj<strat->
tl+1; jj++)
2218 strat->
T[jj].is_sigsafe =
FALSE;
2232 if (strat->
minim==1)
2239 strat->
M->m[minimcnt]=strat->
P.p2;
2243 pNext(strat->
M->m[minimcnt])
2253 strat->
T[strat->
tl].is_sigsafe =
FALSE;
2266 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2270 for (
int tk=0; tk<strat->
sl+1; tk++)
2291 for(
int ps=0;ps<strat->
sl+1;ps++)
2299 (strat->
syzmax)*
sizeof(
unsigned long),
2301 *
sizeof(
unsigned long));
2304 Q.sig =
pCopy(strat->
P.sig);
2342 for (
int i=0;
i<strat->
sl; ++
i) {
2356 for (
int i=cmp+1;
i<=max_cmp; ++
i) {
2358 for (
int j=0;
j<strat->
sl; ++
j) {
2389 printf(
"---------------------------\n");
2390 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
2413 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2415 if (strat->
P.lcm!=
NULL)
2421 if (strat->
sl>srmax) srmax = strat->
sl;
2430 if (red_result!=2) {
2431 #if SBA_PRINT_ZERO_REDUCTIONS 2434 int pos =
posInSyz(strat, strat->
P.sig);
2438 Print(
"ADDING STUFF TO SYZ : ");
2450 memset(&(strat->
P), 0,
sizeof(strat->
P));
2487 #ifdef HAVE_TAIL_RING 2495 for(i=strat->
sl;i>=0;i--) strat->
S_2_R[
i]=-1;
2502 #if SBA_PRINT_SIZE_SYZ 2504 size_syz = strat->
syzl;
2524 #if SBA_PRINT_SIZE_G 2538 #if SBA_PRINT_SIZE_G 2542 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
2546 printf(
" %d. ",oo+1);
2551 #if SBA_PRINT_ZERO_REDUCTIONS 2552 printf(
"----------------------------------------------------------\n");
2553 printf(
"ZERO REDUCTIONS: %ld\n",zeroreductions);
2556 #if SBA_PRINT_REDUCTION_STEPS 2557 printf(
"----------------------------------------------------------\n");
2558 printf(
"S-REDUCTIONS: %ld\n",sba_reduction_steps);
2560 #if SBA_PRINT_OPERATIONS 2561 printf(
"OPERATIONS: %ld\n",sba_operations);
2563 #if SBA_PRINT_REDUCTION_STEPS 2564 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2565 printf(
"INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
2567 #if SBA_PRINT_OPERATIONS 2568 printf(
"INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
2570 #if SBA_PRINT_REDUCTION_STEPS 2571 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2572 printf(
"ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
2573 sba_interreduction_steps = 0;
2574 sba_reduction_steps = 0;
2576 #if SBA_PRINT_OPERATIONS 2577 printf(
"ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
2578 sba_interreduction_operations = 0;
2581 #if SBA_PRINT_SIZE_G 2582 printf(
"----------------------------------------------------------\n");
2583 printf(
"SIZE OF G: %d / %d\n",size_g,size_g_non_red);
2587 #if SBA_PRINT_SIZE_SYZ 2588 printf(
"SIZE OF SYZ: %ld\n",size_syz);
2589 printf(
"----------------------------------------------------------\n");
2592 #if SBA_PRINT_PRODUCT_CRITERION 2593 printf(
"PRODUCT CRITERIA: %ld\n",product_criterion);
2594 product_criterion = 0;
2596 return (strat->
Shdl);
2651 p =
redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2706 for (i=
IDELEMS(q)-1; i>=0; i--)
2723 p =
redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2756 int& hilbcount,
int& srmax,
int& lrmax,
int& reduc, ideal
Q,
2759 int Ll_old, red_result = 1;
2765 reduc = olddeg = lrmax = 0;
2770 while (strat->
tl >= 0)
2772 if(!strat->
T[strat->
tl].is_redundant)
2775 h.p = strat->
T[strat->
tl].p;
2776 h.tailRing = strat->
T[strat->
tl].tailRing;
2777 h.t_p = strat->
T[strat->
tl].t_p;
2814 while (strat->
Ll>Ll_old)
2816 strat->
P = strat->
L[strat->
Ll];
2820 Print(
"NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
2821 Print(
"-------------------------------------------------\n");
2825 printf(
"%d\n",strat->
tl);
2826 Print(
"-------------------------------------------------\n");
2861 else if (strat->
P.p1 ==
NULL)
2863 if (strat->
minim > 0)
2869 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2877 &olddeg,&reduc,
strat, red_result);
2880 Print(
"Poly before red: ");
2884 red_result = strat->red2(&strat->P,strat);
2894 if (red_result == 1)
2897 strat->
P.GetP(strat->
lmBin);
2906 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
2921 strat->
P.pCleardenom();
2924 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
2925 strat->
P.pCleardenom();
2932 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
2946 if (strat->
minim==1)
2953 strat->
M->m[minimcnt]=strat->
P.p2;
2957 pNext(strat->
M->m[minimcnt])
2970 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2973 Print(
"ELEMENT ADDED TO GCURR DURING INTERRED: ");
2977 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2980 if (strat->
P.lcm!=
NULL)
2986 if (strat->
sl>srmax) srmax = strat->
sl;
3002 memset(&(strat->
P), 0,
sizeof(strat->
P));
3006 while (cc<strat->tl+1)
3008 strat->
T[cc].sig =
pOne();
3011 strat->
sig[cc] = strat->
T[cc].sig;
3012 strat->
sevSig[cc] = strat->
T[cc].sevSig;
3013 strat->
T[cc].is_sigsafe =
TRUE;
3021 for (
int cd=strat->
Ll;
cd>=0;
cd--)
3030 Print(
"------------------- STRAT S ---------------------\n");
3032 while (cc<strat->tl+1)
3036 printf(
"- - - - - -\n");
3039 Print(
"-------------------------------------------------\n");
3040 Print(
"------------------- STRAT T ---------------------\n");
3042 while (cc<strat->tl+1)
3046 printf(
"- - - - - -\n");
3049 Print(
"-------------------------------------------------\n");
3050 Print(
"------------------- STRAT L ---------------------\n");
3052 while (cc<strat->Ll+1)
3058 printf(
"- - - - - -\n");
3061 Print(
"-------------------------------------------------\n");
3062 printf(
"F5C DONE\nSTRAT SL: %d -- %d\n",strat->
sl, strat->
currIdx);
3069 #ifdef HAVE_SHIFTBBA 3076 int hilbeledeg=1,hilbcount=0,minimcnt=0;
3103 #ifdef HAVE_TAIL_RING 3108 while (strat->
Ll >= 0)
3123 while ((strat->
Ll >= 0)
3124 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
3129 if (strat->
Ll<0)
break;
3133 strat->
P = strat->
L[strat->
Ll];
3156 else if (strat->
P.p1 ==
NULL)
3158 if (strat->
minim > 0)
3168 if ( ! strat->
homog)
3170 strat->
P.GetP(strat->
lmBin);
3181 strat->
P.GetP(strat->
lmBin);
3197 strat->
P.t_p =
NULL;
3203 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3211 &olddeg,&reduc,
strat, red_result);
3214 red_result = strat->red(&strat->P,strat);
3218 if (red_result == 1)
3224 strat->
P.GetP(strat->
lmBin);
3226 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3231 strat->
P.pCleardenom();
3234 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3235 strat->
P.pCleardenom();
3242 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3255 if (strat->
minim==1)
3262 strat->
M->m[minimcnt]=strat->
P.p2;
3266 pNext(strat->
M->m[minimcnt])
3275 if ( ! strat->
homog)
3277 strat->
P.GetP(strat->
lmBin);
3289 strat->
P.GetP(strat->
lmBin);
3302 strat->
P.t_p =
NULL;
3304 goto red_shrink2zero;
3321 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3323 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3336 memset(&(strat->
P), 0,
sizeof(strat->
P));
3359 Ln.SetShortExpVector();
3361 if (j<0) { k++; j=-1;}
3364 if (
pLmCmp(strat->
S[k],strat->
T[j].p) == 0)
3367 if (j<0) { k++; j=-1;}
3390 for(i=strat->
sl;i>=0;i--) strat->
S_2_R[
i]=-1;
3409 return (strat->
Shdl);
3413 ideal
freegb(ideal I,
int uptodeg,
int lVblock)
3425 WerrorS(
"The input ideal contains incorrectly encoded elements! ");
3449 if (h->IsNull())
return 0;
3457 d = h->GetpFDeg() + h->ecart;
3460 h->SetShortExpVector();
3466 h->SetDegStuffReturnLDeg(strat->
LDegLast);
3471 strat->
T[
j].pNorm();
3504 h->SetShortExpVector();
3517 h->SetDegStuffReturnLDeg(strat->
LDegLast);
3527 if (strat->
T[j].ecart <= h->ecart)
3528 h->ecart = d - h->GetpFDeg();
3530 h->ecart = d - h->GetpFDeg() + strat->
T[
j].ecart - h->ecart;
3532 d = h->GetpFDeg() + h->ecart;
3535 d = h->SetDegStuffReturnLDeg(strat->
LDegLast);
3544 && ((d >= reddeg) || (pass > strat->
LazyPass)))
3549 at = strat->
posInL(strat->
L,strat->
Ll,h,strat);
3550 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)
void p_DebugPrint(poly p, const ring r)
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))
#define idDelete(H)
delete an ideal
void messageStat(int hilbcount, kStrategy strat)
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)
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 ...
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red)
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)
static bool rIsPluralRing(const ring r)
we must always have this test!
int redHomog(LObject *h, kStrategy strat)
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
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)
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 : the integer VarOffset encodes:
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
void initEcartBBA(TObject *h)
#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)
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)
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
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...
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 Werror(const char *fmt,...)
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