 |
My Project
debian-1:4.1.1-p2+ds-4build1
|
Go to the documentation of this file.
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)
498 h->SetShortExpVector();
503 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
508 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
521 if (d >= (
long)strat->
tailRing->bitmask)
523 if (
h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
528 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
550 if (strat->
tl<0)
return 1;
556 unsigned long not_sev;
561 h->SetShortExpVector();
563 h_p =
h->GetLmTailRing();
570 li = strat->
T[
j].pLength;
571 if (li<=0) li=strat->
T[
j].GetpLength();
588 if ((strat->
T[
i].pLength < li)
596 li = strat->
T[
i].pLength;
597 if (li<=0) li=strat->
T[
i].GetpLength();
618 #if SBA_PRINT_REDUCTION_STEPS
619 sba_interreduction_steps++;
621 #if SBA_PRINT_OPERATIONS
622 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
634 h_p =
h->GetLmTailRing();
643 h->SetShortExpVector();
655 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
664 Print(
" lazy: -> L%d\n",at);
677 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
679 Red->HeadNormalize();
713 if (strat->
tl<0)
return 1;
719 PrintS(
"------- IN REDSIG -------\n");
726 PrintS(
"---------------------------\n");
732 unsigned long not_sev;
737 h->SetShortExpVector();
739 h_p =
h->GetLmTailRing();
749 li = strat->
T[
j].pLength;
750 if (li<=0) li=strat->
T[
j].GetpLength();
767 if ((strat->
T[
i].pLength < li)
775 li = strat->
T[
i].pLength;
776 if (li<=0) li=strat->
T[
i].GetpLength();
798 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
799 PrintS(
"--------------------------------\n");
806 PrintS(
"--------------------------------\n");
807 printf(
"INDEX OF REDUCER T: %d\n",ii);
810 #if SBA_PRINT_REDUCTION_STEPS
812 sba_reduction_steps++;
814 #if SBA_PRINT_OPERATIONS
816 sba_operations +=
pLength(strat->
T[ii].p);
823 Print(
"SigSAFE: %d\n",sigSafe);
838 h_p =
h->GetLmTailRing();
847 h->SetShortExpVector();
859 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
870 Print(
" lazy: -> L%d\n",at);
894 beforeredsig =
pCopy(
h->sig);
896 if (strat->
tl<0)
return 1;
902 Print(
"------- IN REDSIG -------\n");
909 Print(
"---------------------------\n");
915 unsigned long not_sev;
920 h->SetShortExpVector();
922 h_p =
h->GetLmTailRing();
947 if (
h->GetLmTailRing() ==
NULL)
954 if(
pLtCmp(beforeredsig,
h->sig) == 1)
977 li = strat->
T[
j].pLength;
978 if (li<=0) li=strat->
T[
j].GetpLength();
994 if ((strat->
T[
i].pLength < li)
1002 li = strat->
T[
i].pLength;
1003 if (li<=0) li=strat->
T[
i].GetpLength();
1025 Print(
"BEFORE REDUCTION WITH %d:\n",ii);
1026 Print(
"--------------------------------\n");
1033 Print(
"--------------------------------\n");
1034 printf(
"INDEX OF REDUCER T: %d\n",ii);
1062 #if SBA_PRINT_REDUCTION_STEPS
1064 sba_reduction_steps++;
1066 #if SBA_PRINT_OPERATIONS
1068 sba_operations +=
pLength(strat->
T[ii].p);
1075 Print(
"SigSAFE: %d\n",sigSafe);
1090 h_p =
h->GetLmTailRing();
1099 h->SetShortExpVector();
1111 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1112 if (at <= strat->Ll)
1114 int dummy=strat->
sl;
1122 Print(
" lazy: -> L%d\n",at);
1135 #define REDTAIL_CANONICALIZE 100
1139 p =
h = L->GetLmTailRing();
1141 return L->GetLmCurrRing();
1149 Ln.sevSig = L->sevSig;
1150 Ln.pLength = L->GetpLength() - 1;
1165 Ln.SetShortExpVector();
1171 With = &(strat->
T[
j]);
1176 if (With ==
NULL)
break;
1200 #if SBA_PRINT_REDUCTION_STEPS
1202 sba_reduction_steps++;
1204 #if SBA_PRINT_OPERATIONS
1206 sba_operations +=
pLength(With->p);
1216 pNext(
h) = Ln.LmExtractAndIter();
1219 }
while (!Ln.IsNull());
1222 if (Ln.IsNull())
goto all_done;
1223 if (! withT) With_s.Init(
currRing);
1230 pNext(
h) = Ln.LmExtractAndIter();
1247 return L->GetLmCurrRing();
1256 if (strat->
tl<0)
return 1;
1261 long reddeg =
h->GetpFDeg();
1263 unsigned long not_sev;
1265 h->SetShortExpVector();
1266 poly h_p =
h->GetLmTailRing();
1271 if (
j < 0)
return 1;
1273 li = strat->
T[
j].pLength;
1274 if (li<=0) li=strat->
T[
j].GetpLength();
1292 if ((strat->
T[
i].pLength < li)
1300 li = strat->
T[
i].pLength;
1301 if (li<=0) li=strat->
T[
i].GetpLength();
1323 #if SBA_PRINT_REDUCTION_STEPS
1324 sba_interreduction_steps++;
1326 #if SBA_PRINT_OPERATIONS
1327 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1339 h_p=
h->GetLmTailRing();
1349 h->SetShortExpVector();
1355 (strat->
Ll >= 0) && ((d > reddeg) || (pass > strat->
LazyPass)))
1358 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1359 if (at <= strat->Ll)
1362 int dummy=strat->
sl;
1374 else if (d != reddeg)
1376 if (d>=(
long)strat->
tailRing->bitmask)
1378 if (
h->pTotalDeg() >= (long)strat->
tailRing->bitmask)
1383 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1404 if (strat->
tl<0)
return 1;
1408 int i,
j,at,pass,ei, ii, h_d;
1409 unsigned long not_sev;
1413 d = reddeg =
h->GetpFDeg() +
h->ecart;
1414 h->SetShortExpVector();
1416 h_p =
h->GetLmTailRing();
1423 if (
j < 0)
return 1;
1425 ei = strat->
T[
j].ecart;
1426 li = strat->
T[
j].pLength;
1427 if (li<=0) li=strat->
T[
j].GetpLength();
1445 if ((((strat->
T[
i].ecart < ei) && (ei>
h->ecart))
1446 || ((strat->
T[
i].ecart <=
h->ecart) && (strat->
T[
i].pLength < li)))
1454 ei = strat->
T[
i].ecart;
1455 li = strat->
T[
i].pLength;
1456 if (li<=0) li=strat->
T[
i].GetpLength();
1475 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1493 Print(
"\nwith T[%d]:",ii);
1500 #if SBA_PRINT_REDUCTION_STEPS
1501 sba_interreduction_steps++;
1503 #if SBA_PRINT_OPERATIONS
1504 sba_interreduction_operations +=
pLength(strat->
T[ii].p);
1533 else if (
h->t_p!=
NULL)
1542 h->SetShortExpVector();
1544 h_d =
h->SetpFDeg();
1549 h->ecart = d-h_d+ei-
h->ecart;
1563 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1564 if (at <= strat->Ll)
1566 int dummy=strat->
sl;
1572 Print(
" degree jumped: -> L%d\n",at);
1578 else if (d > reddeg)
1580 if (d>=(
long)strat->
tailRing->bitmask)
1582 if (
h->pTotalDeg()+
h->ecart >= (long)strat->
tailRing->bitmask)
1587 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
1609 #define REDNF_CANONICALIZE 60
1620 P.SetShortExpVector();
1726 P.SetShortExpVector();
1775 P.SetShortExpVector();
1856 P.SetShortExpVector();
1884 P.SetShortExpVector();
1923 int hilbeledeg=1,hilbcount=0,minimcnt=0;
1946 withT = ! strat->
homog;
1951 #ifdef HAVE_TAIL_RING
1967 while (strat->
Ll >= 0)
1974 while (strat->
Ll >= 0)
1987 while ((strat->
Ll >= 0)
1988 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
1993 if (strat->
Ll<0)
break;
1998 strat->
P = strat->
L[strat->
Ll];
2028 else if (strat->
P.p1 ==
NULL)
2030 if (strat->
minim > 0)
2036 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2044 &olddeg,&reduc,strat, red_result);
2047 red_result = strat->red(&strat->P,strat);
2057 if (red_result == 1)
2060 strat->
P.GetP(strat->
lmBin);
2069 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
2077 strat->
P.pCleardenom();
2081 strat->
P.pCleardenom();
2090 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
2102 if (strat->
minim==1)
2109 strat->
M->m[minimcnt]=strat->
P.p2;
2113 pNext(strat->
M->m[minimcnt])
2129 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2144 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
2146 if (strat->
P.lcm!=
NULL)
2157 if (strat->
s_poly(strat))
2162 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
2168 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2172 else if (strat->
P.p1 ==
NULL && strat->
minim > 0)
2178 memset(&(strat->
P), 0,
sizeof(strat->
P));
2214 #ifdef HAVE_TAIL_RING
2233 for(
int i = 0;
i<=strat->
sl;
i++)
2241 for(
int i = 0;
i<=strat->
sl;
i++)
2269 return (strat->
Shdl);
2281 #if SBA_PRINT_ZERO_REDUCTIONS
2282 long zeroreductions = 0;
2284 #if SBA_PRINT_PRODUCT_CRITERION
2285 long product_criterion = 0;
2287 #if SBA_PRINT_SIZE_G
2289 int size_g_non_red = 0;
2291 #if SBA_PRINT_SIZE_SYZ
2295 #if SBA_PRINT_REDUCTION_STEPS
2296 sba_reduction_steps = 0;
2297 sba_interreduction_steps = 0;
2299 #if SBA_PRINT_OPERATIONS
2301 sba_interreduction_operations = 0;
2305 ring sRing, currRingOld;
2310 if (sRing!=currRingOld)
2329 dummy =
pCopy(F->m[0]);
2331 F->m[
i] = F->m[
i+1];
2352 dummy =
pCopy(F->m[0]);
2354 F->m[
i] = F->m[
i+1];
2372 for (
int i=0;
i<
sort->length();++
i)
2373 F->m[
i] = F1->m[(*
sort)[
i]-1];
2387 F->m[
j] = F->m[
j-1];
2405 printf(
"SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2407 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
2410 int srmax,lrmax, red_result = 1;
2412 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2426 reduc = olddeg = lrmax = 0;
2439 #ifdef HAVE_TAIL_RING
2457 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
2467 while (strat->
Ll >= 0)
2469 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2499 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2500 lrmax, reduc,
Q,
w, hilb );
2510 strat->
P = strat->
L[strat->
Ll];
2516 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(), strat, strat->
P.checked+1))
2520 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2521 PrintS(
"-------------------------------------------------\n");
2526 PrintS(
"-------------------------------------------------\n");
2561 else if (strat->
P.p1 ==
NULL)
2563 if (strat->
minim > 0)
2569 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2577 PrintS(
"Poly before red: ");
2581 #if SBA_PRODUCT_CRITERION
2582 if (strat->
P.prod_crit)
2584 #if SBA_PRINT_PRODUCT_CRITERION
2585 product_criterion++;
2587 int pos =
posInSyz(strat, strat->
P.sig);
2589 if (strat->
P.lcm!=
NULL)
2595 red_result = strat->
red(&strat->
P,strat);
2598 red_result = strat->
red(&strat->
P,strat);
2614 strat->
P.p =
pNeg(strat->
P.p);
2615 strat->
P.sig =
pNeg(strat->
P.sig);
2618 if(strat->
P.sig !=
NULL)
2620 if(strat->
P.p !=
NULL)
2627 red_result =
redRing(&strat->
P,strat);
2632 strat->
P.sig =
NULL;
2636 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2652 if (red_result != 0)
2654 PrintS(
"Poly after red: ");
2656 pWrite(strat->
P.GetLmCurrRing());
2658 printf(
"%d\n",red_result);
2663 if(strat->
P.p !=
NULL)
2665 &olddeg,&reduc,strat, red_result);
2667 message((strat->honey ? strat->P.ecart : 0),
2668 &olddeg,&reduc,strat, red_result);
2676 if (red_result == 1)
2679 strat->
P.GetP(strat->
lmBin);
2683 (strat->
P).FDeg = (strat->
P).pFDeg();
2695 int pos = strat->
sl+1;
2703 beforetailred =
pCopy(strat->
P.sig);
2709 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2717 strat->
P.pCleardenom();
2720 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2721 strat->
P.pCleardenom();
2728 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
2737 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2743 if(strat->
P.sig ==
NULL ||
pLtCmp(beforetailred,strat->
P.sig) == 1)
2747 red_result =
redRing(&strat->
P,strat);
2756 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2762 if(strat->
P.p ==
NULL)
2763 goto case_when_red_result_changed;
2769 for (
int jj = 0; jj<strat->
tl+1; jj++)
2773 strat->
T[jj].is_sigsafe =
FALSE;
2779 for (
int jj = 0; jj<strat->
tl+1; jj++)
2781 strat->
T[jj].is_sigsafe =
FALSE;
2791 if (strat->
minim==1)
2798 strat->
M->m[minimcnt]=strat->
P.p2;
2802 pNext(strat->
M->m[minimcnt])
2812 strat->
T[strat->
tl].is_sigsafe =
FALSE;
2826 strat->
enterS(strat->
P, pos, strat, strat->
tl);
2830 for (
int tk=0; tk<strat->
sl+1; tk++)
2851 for(
int ps=0;ps<strat->
sl+1;ps++)
2859 (strat->
syzmax)*
sizeof(
unsigned long),
2861 *
sizeof(
unsigned long));
2903 for (
int i=0;
i<strat->
sl; ++
i)
2920 for (
int i=cmp+1;
i<=max_cmp; ++
i)
2923 for (
int j=0;
j<strat->
sl; ++
j)
2961 printf(
"---------------------------\n");
2962 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
2985 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
2987 if (strat->
P.lcm!=
NULL)
2993 if (strat->
sl>srmax) srmax = strat->
sl;
2997 case_when_red_result_changed:
3005 #if SBA_PRINT_ZERO_REDUCTIONS
3014 int pos =
posInSyz(strat, strat->
P.sig);
3018 Print(
"ADDING STUFF TO SYZ : ");
3031 memset(&(strat->
P), 0,
sizeof(strat->
P));
3037 printf(
"\nSigDrop!\n");
3039 printf(
"\nEnded with no SigDrop\n");
3045 if(strat->
P.sig !=
NULL)
3049 memset(&(strat->
P), 0,
sizeof(strat->
P));
3084 #ifdef HAVE_TAIL_RING
3100 #if SBA_PRINT_SIZE_SYZ
3102 size_syz = strat->
syzl;
3115 #if SBA_PRINT_SIZE_G
3130 for(;
k>=0 && (strat->
L[
k].p1 !=
NULL || strat->
L[
k].p2 !=
NULL);
k--)
3140 for(;
k>=0 && strat->
L[
k].p1 ==
NULL && strat->
L[
k].p2 ==
NULL;
k--)
3143 strat->
enterS(strat->
L[
k], strat->
sl+1, strat, strat->
tl);
3151 for(
k=strat->
sl;
k>=0;
k--)
3184 #if SBA_PRINT_SIZE_G
3188 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
3192 printf(
" %d. ",oo+1);
3197 #if SBA_PRINT_ZERO_REDUCTIONS
3198 printf(
"----------------------------------------------------------\n");
3199 printf(
"ZERO REDUCTIONS: %ld\n",zeroreductions);
3202 #if SBA_PRINT_REDUCTION_STEPS
3203 printf(
"----------------------------------------------------------\n");
3204 printf(
"S-REDUCTIONS: %ld\n",sba_reduction_steps);
3206 #if SBA_PRINT_OPERATIONS
3207 printf(
"OPERATIONS: %ld\n",sba_operations);
3209 #if SBA_PRINT_REDUCTION_STEPS
3210 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3211 printf(
"INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3213 #if SBA_PRINT_OPERATIONS
3214 printf(
"INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3216 #if SBA_PRINT_REDUCTION_STEPS
3217 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3218 printf(
"ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3219 sba_interreduction_steps = 0;
3220 sba_reduction_steps = 0;
3222 #if SBA_PRINT_OPERATIONS
3223 printf(
"ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3224 sba_interreduction_operations = 0;
3227 #if SBA_PRINT_SIZE_G
3228 printf(
"----------------------------------------------------------\n");
3229 printf(
"SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3233 #if SBA_PRINT_SIZE_SYZ
3234 printf(
"SIZE OF SYZ: %ld\n",size_syz);
3235 printf(
"----------------------------------------------------------\n");
3238 #if SBA_PRINT_PRODUCT_CRITERION
3239 printf(
"PRODUCT CRITERIA: %ld\n",product_criterion);
3240 product_criterion = 0;
3242 return (strat->
Shdl);
3245 poly
kNF2 (ideal F,ideal
Q,poly q,
kStrategy strat,
int lazyReduce)
3384 ideal
kNF2 (ideal F,ideal
Q,ideal q,
kStrategy strat,
int lazyReduce)
3542 void f5c (
kStrategy strat,
int& olddeg,
int& minimcnt,
int& hilbeledeg,
3543 int& hilbcount,
int& srmax,
int& lrmax,
int& reduc, ideal
Q,
3546 int Ll_old, red_result = 1;
3552 reduc = olddeg = lrmax = 0;
3557 while (strat->
tl >= 0)
3559 if(!strat->
T[strat->
tl].is_redundant)
3562 h.p = strat->
T[strat->
tl].p;
3563 h.tailRing = strat->
T[strat->
tl].tailRing;
3564 h.t_p = strat->
T[strat->
tl].t_p;
3603 while (strat->
Ll>Ll_old)
3605 strat->
P = strat->
L[strat->
Ll];
3609 PrintS(
"NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
3610 PrintS(
"-------------------------------------------------\n");
3614 printf(
"%d\n",strat->
tl);
3615 PrintS(
"-------------------------------------------------\n");
3648 else if (strat->
P.p1 ==
NULL)
3650 if (strat->
minim > 0)
3657 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3665 &olddeg,&reduc,strat, red_result);
3668 PrintS(
"Poly before red: ");
3672 red_result = strat->red2(&strat->P,strat);
3682 if (red_result == 1)
3685 strat->
P.GetP(strat->
lmBin);
3696 pos =
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3700 pos =
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
3709 strat->
P.pCleardenom();
3712 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3713 strat->
P.pCleardenom();
3720 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
3730 if (strat->
minim==1)
3737 strat->
M->m[minimcnt]=strat->
P.p2;
3741 pNext(strat->
M->m[minimcnt])
3754 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3757 PrintS(
"ELEMENT ADDED TO GCURR DURING INTERRED: ");
3761 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
3764 if (strat->
P.lcm!=
NULL)
3770 if (strat->
sl>srmax) srmax = strat->
sl;
3786 memset(&(strat->
P), 0,
sizeof(strat->
P));
3790 while (cc<strat->tl+1)
3792 strat->
T[cc].sig =
pOne();
3795 strat->
sig[cc] = strat->
T[cc].sig;
3796 strat->
sevSig[cc] = strat->
T[cc].sevSig;
3797 strat->
T[cc].is_sigsafe =
TRUE;
3805 for (
int cd=strat->
Ll;
cd>=0;
cd--)
3813 printf(
"\nAfter f5c sorting\n");
3814 for(
int i=0;
i<=strat->
sl;
i++)
3820 PrintS(
"------------------- STRAT S ---------------------\n");
3822 while (cc<strat->tl+1)
3826 printf(
"- - - - - -\n");
3829 PrintS(
"-------------------------------------------------\n");
3830 PrintS(
"------------------- STRAT T ---------------------\n");
3832 while (cc<strat->tl+1)
3836 printf(
"- - - - - -\n");
3839 PrintS(
"-------------------------------------------------\n");
3840 PrintS(
"------------------- STRAT L ---------------------\n");
3842 while (cc<strat->Ll+1)
3848 printf(
"- - - - - -\n");
3851 PrintS(
"-------------------------------------------------\n");
3852 printf(
"F5C DONE\nSTRAT SL: %d -- %d\n",strat->
sl, strat->
currIdx);
3859 #ifdef HAVE_SHIFTBBA
3866 int hilbeledeg=1,hilbcount=0,minimcnt=0;
3896 #ifdef HAVE_TAIL_RING
3902 while (strat->
Ll >= 0)
3917 while ((strat->
Ll >= 0)
3918 && (strat->
L[strat->
Ll].p1!=
NULL) && (strat->
L[strat->
Ll].p2!=
NULL)
3923 if (strat->
Ll<0)
break;
3927 strat->
P = strat->
L[strat->
Ll];
3950 else if (strat->
P.p1 ==
NULL)
3952 if (strat->
minim > 0)
3962 if ( ! strat->
homog)
3964 strat->
P.GetP(strat->
lmBin);
3971 strat->
P.t_p =
NULL;
3972 strat->
P.GetP(strat->
lmBin);
3987 strat->
P.t_p =
NULL;
3992 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
4000 &olddeg,&reduc,strat, red_result);
4003 red_result = strat->red(&strat->P,strat);
4007 if (red_result == 1)
4013 strat->
P.GetP(strat->
lmBin);
4015 int pos=
posInS(strat,strat->
sl,strat->
P.p,strat->
P.ecart);
4020 strat->
P.pCleardenom();
4023 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
4024 strat->
P.pCleardenom();
4031 strat->
P.p =
redtailBba(&(strat->
P),pos-1,strat, withT);
4044 if (strat->
minim==1)
4051 strat->
M->m[minimcnt]=strat->
P.p2;
4055 pNext(strat->
M->m[minimcnt])
4064 if ( ! strat->
homog)
4066 strat->
P.GetP(strat->
lmBin);
4068 if (strat->
P.p!=
NULL)
4075 strat->
P.t_p =
NULL;
4076 strat->
P.GetP(strat->
lmBin);
4088 strat->
P.t_p =
NULL;
4089 goto red_shrink2zero;
4099 strat->
P.t_p =
NULL;
4111 strat->
P.t_p =
NULL;
4112 goto red_shrink2zero;
4126 int atR=strat->
tl+1;
4132 strat->
enterS(strat->
P, pos, strat, atR);
4134 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
4147 memset(&(strat->
P), 0,
sizeof(strat->
P));
4170 Ln.SetShortExpVector();
4172 if (
j<0) {
k++;
j=-1;}
4178 if (
j<0) {
k++;
j=-1;}
4199 #ifdef HAVE_TAIL_RING
4228 return (strat->
Shdl);
4232 ideal
freegb(ideal I,
int uptodeg,
int lVblock)
4244 WerrorS(
"The input ideal contains incorrectly encoded elements! ");
4268 if (
h->IsNull())
return 0;
4276 d =
h->GetpFDeg() +
h->ecart;
4279 h->SetShortExpVector();
4285 h->SetDegStuffReturnLDeg(strat->
LDegLast);
4290 strat->
T[
j].pNorm();
4322 h->SetShortExpVector();
4335 h->SetDegStuffReturnLDeg(strat->
LDegLast);
4345 if (strat->
T[
j].ecart <=
h->ecart)
4346 h->ecart = d -
h->GetpFDeg();
4348 h->ecart = d -
h->GetpFDeg() + strat->
T[
j].ecart -
h->ecart;
4350 d =
h->GetpFDeg() +
h->ecart;
4353 d =
h->SetDegStuffReturnLDeg(strat->
LDegLast);
4362 && ((d >= reddeg) || (pass > strat->
LazyPass)))
4367 at = strat->
posInL(strat->
L,strat->
Ll,
h,strat);
4368 if (at <= strat->Ll)
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
void kStratInitChangeTailRing(kStrategy strat)
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
poly kFindZeroPoly(poly input_p, ring leadRing, ring tailRing)
int kBucketCanonicalize(kBucket_pt bucket)
static poly p_LmDeleteAndNext(poly p, const ring r)
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, int uptodeg, int lV)
void initBuchMoraCrit(kStrategy strat)
#define pGetComp(p)
Component.
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
void pNorm(poly p, const ring R=currRing)
void cleanT(kStrategy strat)
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
#define SBA_INTERRED_START
#define idDelete(H)
delete an ideal
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
void rChangeCurrRing(ring r)
#define TEST_OPT_DEGBOUND
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
#define REDTAIL_CANONICALIZE
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
void initBbaShift(kStrategy strat)
void pEnlargeSet(poly **p, int l, int increment)
static poly p_Mult_mm(poly p, poly m, const ring r)
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
ideal freegb(ideal I, int uptodeg, int lVblock)
void updateResult(ideal r, ideal Q, 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...
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
static BOOLEAN length(leftv result, leftv arg)
long ind_fact_2(long arg)
#define TEST_OPT_CONTENTSB
#define __p_GetComp(p, r)
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
void initSbaCrit(kStrategy strat)
const poly kBucketGetLm(kBucket_pt bucket)
void f5c(kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
int posInSyz(const kStrategy strat, poly sig)
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
static unsigned pLength(poly a)
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
static void p_SetExpV(poly p, int *ev, const ring r)
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
static poly p_Copy(poly p, const ring r)
returns a copy of p
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
static BOOLEAN rField_is_Ring_Z(const ring r)
#define TEST_OPT_INTSTRATEGY
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
void kBucketDestroy(kBucket_pt *bucket_pt)
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
int redRing(LObject *h, kStrategy strat)
char posInLDependsOnLength
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
CanonicalForm cd(bCommonDen(FF))
#define TEST_OPT_NOT_BUCKETS
void initEcartNormal(TObject *h)
void PrintS(const char *s)
void kBucketInit(kBucket_pt bucket, poly lm, int length)
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
void completeReduce(kStrategy strat, BOOLEAN withT)
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
KINLINE poly kNoetherTail()
void exitBuchMora(kStrategy strat)
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
void initBuchMora(ideal F, ideal Q, kStrategy strat)
void enterSyz(LObject &p, kStrategy strat, int atT)
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 posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
void initBuchMoraPos(kStrategy strat)
static void p_GetExpV(poly p, int *ev, const ring r)
static int p_LmCmp(poly p, poly q, const ring r)
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
void messageStat(int hilbcount, kStrategy strat)
void initSyzRules(kStrategy strat)
void sort(CFArray &A, int l=0)
quick sort A
void kDebugPrint(kStrategy strat)
int ideal_isInV(ideal I, int lV)
void rDelete(ring r)
unconditionally deletes fields in r
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
int redSig(LObject *h, kStrategy strat)
void initBba(kStrategy strat)
void initSbaPos(kStrategy strat)
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
static void p_Delete(poly *p, const ring r)
static poly p_Add_q(poly p, poly q, const ring r)
void postReduceByMonSig(LObject *h, kStrategy strat)
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
void initBuchMoraPosRing(kStrategy strat)
void rWrite(ring r, BOOLEAN details)
static int si_max(const int a, const int b)
static CanonicalForm bound(const CFMatrix &M)
poly p_Shrink(poly p, int lV, const ring r)
pShallowCopyDeleteProc p_shallow_copy_delete
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
void Werror(const char *fmt,...)
ideal idInit(int idsize, int rank)
initialise an ideal / module
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
void WerrorS(const char *s)
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:...
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
#define omRealloc0Size(addr, o_size, size)
char completeReduce_retry
static void p_Setm(poly p, const ring r)
void updateSShift(kStrategy strat, int uptodeg, int lV)
void cancelunit(LObject *L, BOOLEAN inNF)
#define TEST_OPT_REDTHROUGH
void initSba(ideal F, kStrategy strat)
#define REDNF_CANONICALIZE
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
void messageStatSBA(int hilbcount, kStrategy strat)
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
int redLazy(LObject *h, kStrategy strat)
void deleteInL(LSet set, int *length, int j, kStrategy strat)
void(* initEcart)(TObject *L)
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
int(* red)(LObject *L, kStrategy strat)
void initEcartBBA(TObject *h)
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
#define pCopy(p)
return a copy of the poly
#define SI_RESTORE_OPT1(A)
int(* posInT)(const TSet T, const int tl, LObject &h)
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 deleteInS(int i, kStrategy strat)
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
int redFirstShift(LObject *h, kStrategy strat)
ideal kInterRed(ideal F, ideal Q)
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
unsigned long p_GetShortExpVector(const poly p, const ring r)
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
void exitSba(kStrategy strat)
int redHoney(LObject *h, kStrategy strat)
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
void enterT(LObject &p, kStrategy strat, int atT)
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
int redSigRing(LObject *h, kStrategy strat)
int redHomog(LObject *h, kStrategy strat)
void initS(ideal F, ideal Q, kStrategy strat)