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);
2629 if (strat->overflow)
2634 if (red_result == 1)
2637 strat->P.GetP(strat->lmBin);
2641 (strat->P).FDeg = (strat->P).pFDeg();
2645 if (strat->homog) strat->initEcart(&(strat->P));
2653 int pos = strat->sl+1;
2661 beforetailred =
pCopy(strat->P.sig);
2667 strat->P.p =
redtailSba(&(strat->P),pos-1,strat, withT);
2671 if (strat->sbaOrder != 2) {
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);
2708 strat->sigdrop =
TRUE;
2710 red_result =
redRing(&strat->P,strat);
2715 printf(
"\nReduced to 0 via redRing. Cancel sigdrop\n");
2717 strat->sigdrop =
FALSE;
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");
2740 if (strat->sbaOrder == 1)
2742 for (
int jj = 0; jj<strat->tl+1; jj++)
2744 if (
pGetComp(strat->T[jj].sig) == strat->currIdx)
2746 strat->T[jj].is_sigsafe =
FALSE;
2752 for (
int jj = 0; jj<strat->tl+1; jj++)
2754 strat->T[jj].is_sigsafe =
FALSE;
2762 if ((strat->P.p1==
NULL) && (strat->minim>0))
2764 if (strat->minim==1)
2766 strat->M->m[minimcnt]=
p_Copy(strat->P.p,
currRing,strat->tailRing);
2771 strat->M->m[minimcnt]=strat->P.p2;
2775 pNext(strat->M->m[minimcnt])
2776 = strat->p_shallow_copy_delete(
pNext(strat->M->m[minimcnt]),
2785 strat->T[strat->tl].is_sigsafe =
FALSE;
2792 superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2794 enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2796 printf(
"\nThis element is added to S\n");
2797 p_Write(strat->P.p, strat->tailRing);
p_Write(strat->P.p1, strat->tailRing);
p_Write(strat->P.p2, strat->tailRing);
pWrite(strat->P.sig);
2804 strat->enterS(strat->P, pos, strat, strat->tl);
2805 if(strat->sbaOrder != 1)
2808 for (
int tk=0; tk<strat->sl+1; tk++)
2829 for(
int ps=0;ps<strat->sl+1;ps++)
2833 if (strat->syzl == strat->syzmax)
2837 (strat->syzmax)*
sizeof(
unsigned long),
2839 *
sizeof(
unsigned long));
2842 Q.sig =
pCopy(strat->P.sig);
2845 if (strat->sbaOrder == 0)
2868 if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
2879 if (strat->currIdx < idx) {
2880 for (
int i=0; i<strat->sl; ++
i) {
2890 strat->currIdx = idx;
2894 for (
int i=cmp+1; i<=max_cmp; ++
i) {
2896 for (
int j=0;
j<strat->sl; ++
j) {
2911 if (strat->sbaOrder == 0) {
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 : ");
2989 if (strat->P.p1 ==
NULL && strat->minim > 0)
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)
3011 strat->sbaEnterS =
pGetComp(strat->P.sig)-1;
3014 memset(&(strat->P), 0,
sizeof(strat->P));
3033 clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3044 #ifdef HAVE_TAIL_RING 3045 if (strat->completeReduce_retry)
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 3075 size_g_non_red =
IDELEMS(strat->Shdl);
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]);
3113 if(strat->sig[k] ==
NULL)
3114 strat->sig[
k] =
pCopy(strat->sig[k-1]);
3123 if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
3132 if(strat->tailRing == sRing)
3143 #if SBA_PRINT_SIZE_G 3144 size_g =
IDELEMS(strat->Shdl);
3147 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->Shdl));
3149 while (oo<
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);
#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)
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
void initSba(ideal F, kStrategy strat)
void initSyzRules(kStrategy strat)
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
void WerrorS(const char *s)
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
int(* red)(LObject *L, kStrategy strat)
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)
static poly p_Copy(poly p, const ring r)
returns a copy of p
void kStratInitChangeTailRing(kStrategy strat)
#define TEST_OPT_NOT_BUCKETS
void enterT(LObject &p, kStrategy strat, int atT)
void deleteInL(LSet set, int *length, int j, kStrategy strat)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define TEST_OPT_INTSTRATEGY
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
void messageStatSBA(int hilbcount, kStrategy strat)
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
ideal kInterRed(ideal F, ideal Q)
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 exitSba(kStrategy strat)
void PrintS(const char *s)
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
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 ...
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
void rChangeCurrRing(ring r)
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
static void p_Delete(poly *p, const ring r)
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 BOOLEAN rField_is_Ring(const ring r)
void cleanT(kStrategy strat)
#define SBA_INTERRED_START
void pEnlargeSet(poly **p, int l, int increment)
void rDelete(ring r)
unconditionally deletes fields in r
int posInSyz(const kStrategy strat, poly sig)
void initSbaCrit(kStrategy strat)
#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)...
void completeReduce(kStrategy strat, BOOLEAN withT)
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
void p_Write(poly p, ring lmRing, ring tailRing)
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
static poly p_Add_q(poly p, poly q, const ring r)
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
void kDebugPrint(kStrategy strat)
void enterSyz(LObject &p, kStrategy strat, int atT)
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
#define pCopy(p)
return a copy of the poly