2545 #if SBA_PRINT_ZERO_REDUCTIONS 2546 long zeroreductions = 0;
2548 #if SBA_PRINT_PRODUCT_CRITERION 2549 long product_criterion = 0;
2551 #if SBA_PRINT_SIZE_G 2553 int size_g_non_red = 0;
2555 #if SBA_PRINT_SIZE_SYZ 2559 #if SBA_PRINT_REDUCTION_STEPS 2560 sba_reduction_steps = 0;
2561 sba_interreduction_steps = 0;
2563 #if SBA_PRINT_OPERATIONS 2565 sba_interreduction_operations = 0;
2569 ring sRing, currRingOld;
2574 if (sRing!=currRingOld)
2593 dummy =
pCopy(F->m[0]);
2595 F->m[
i] = F->m[
i+1];
2616 dummy =
pCopy(F->m[0]);
2618 F->m[
i] = F->m[
i+1];
2637 F->m[
i] = F1->m[(*sort)[
i]-1];
2651 F->m[
j] = F->m[
j-1];
2669 printf(
"SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2671 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
2674 int srmax,lrmax, red_result = 1;
2676 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2690 reduc = olddeg = lrmax = 0;
2703 #ifdef HAVE_TAIL_RING 2721 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
2731 while (strat->
Ll >= 0)
2733 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2763 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2764 lrmax, reduc,
Q, w, hilb );
2774 strat->
P = strat->
L[strat->
Ll];
2780 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(), strat, strat->
P.checked+1))
2784 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2785 PrintS(
"-------------------------------------------------\n");
2790 PrintS(
"-------------------------------------------------\n");
2825 else if (strat->
P.p1 ==
NULL)
2827 if (strat->
minim > 0)
2833 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
2841 PrintS(
"Poly before red: ");
2845 #if SBA_PRODUCT_CRITERION 2846 if (strat->
P.prod_crit)
2848 #if SBA_PRINT_PRODUCT_CRITERION 2849 product_criterion++;
2851 int pos =
posInSyz(strat, strat->
P.sig);
2858 red_result = strat->
red(&strat->
P,strat);
2861 red_result = strat->
red(&strat->
P,strat);
2877 strat->
P.p =
pNeg(strat->
P.p);
2878 strat->
P.sig =
pNeg(strat->
P.sig);
2881 if(strat->
P.sig !=
NULL)
2883 if(strat->
P.p !=
NULL)
2890 red_result =
redRing(&strat->
P,strat);
2895 strat->
P.sig =
NULL;
2899 strat->
enterS(strat->
P, 0, strat, strat->
tl);
2915 if (red_result != 0)
2917 PrintS(
"Poly after red: ");
2919 pWrite(strat->
P.GetLmCurrRing());
2921 printf(
"%d\n",red_result);
2926 if(strat->
P.p !=
NULL)
2928 &olddeg,&reduc,strat, red_result);
2930 message((strat->honey ? strat->P.ecart : 0),
2931 &olddeg,&reduc,strat, red_result);
2934 if (strat->overflow)
2939 if (red_result == 1)
2942 strat->P.GetP(strat->lmBin);
2946 (strat->P).FDeg = (strat->P).pFDeg();
2950 if (strat->homog) strat->initEcart(&(strat->P));
2958 int pos = strat->sl+1;
2966 beforetailred =
pCopy(strat->P.sig);
2972 strat->P.p =
redtailSba(&(strat->P),pos-1,strat, withT);
2976 if (strat->sbaOrder != 2)
2980 strat->P.pCleardenom();
2983 strat->P.p =
redtailSba(&(strat->P),pos-1,strat, withT);
2984 strat->P.pCleardenom();
2991 strat->P.p =
redtailSba(&(strat->P),pos-1,strat, withT);
3000 strat->enterS(strat->P, 0, strat, strat->tl);
3006 if(strat->P.sig ==
NULL ||
pLtCmp(beforetailred,strat->P.sig) == 1)
3008 strat->sigdrop =
TRUE;
3010 red_result =
redRing(&strat->P,strat);
3014 strat->sigdrop =
FALSE;
3019 strat->enterS(strat->P, 0, strat, strat->tl);
3025 if(strat->P.p ==
NULL)
3026 goto case_when_red_result_changed;
3030 if (strat->sbaOrder == 1)
3032 for (
int jj = 0; jj<strat->tl+1; jj++)
3034 if (
pGetComp(strat->T[jj].sig) == strat->currIdx)
3036 strat->T[jj].is_sigsafe =
FALSE;
3042 for (
int jj = 0; jj<strat->tl+1; jj++)
3044 strat->T[jj].is_sigsafe =
FALSE;
3052 if ((strat->P.p1==
NULL) && (strat->minim>0))
3054 if (strat->minim==1)
3056 strat->M->m[minimcnt]=
p_Copy(strat->P.p,
currRing,strat->tailRing);
3061 strat->M->m[minimcnt]=strat->P.p2;
3065 pNext(strat->M->m[minimcnt])
3066 = strat->p_shallow_copy_delete(
pNext(strat->M->m[minimcnt]),
3075 strat->T[strat->tl].is_sigsafe =
FALSE;
3082 superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
3084 enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
3089 strat->enterS(strat->P, pos, strat, strat->tl);
3090 if(strat->sbaOrder != 1)
3093 for (
int tk=0; tk<strat->sl+1; tk++)
3114 for(
int ps=0;ps<strat->sl+1;ps++)
3118 if (strat->syzl == strat->syzmax)
3122 (strat->syzmax)*
sizeof(
unsigned long),
3124 *
sizeof(
unsigned long));
3127 Q.sig =
pCopy(strat->P.sig);
3130 if (strat->sbaOrder == 0)
3153 if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
3156 unsigned max_cmp =
IDELEMS(F);
3164 if (strat->currIdx < idx)
3166 for (
int i=0; i<strat->sl; ++
i)
3177 strat->currIdx = idx;
3183 for (
unsigned i=cmp+1; i<=max_cmp; ++
i)
3186 for (
int j=0;
j<strat->sl; ++
j)
3204 if (strat->sbaOrder == 0)
3224 printf(
"---------------------------\n");
3225 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
3248 if (hilb!=
NULL)
khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3251 if (strat->sl>srmax) srmax = strat->sl;
3255 case_when_red_result_changed:
3263 #if SBA_PRINT_ZERO_REDUCTIONS 3272 int pos =
posInSyz(strat, strat->P.sig);
3276 Print(
"ADDING STUFF TO SYZ : ");
3282 if (strat->P.p1 ==
NULL && strat->minim > 0)
3289 memset(&(strat->P), 0,
sizeof(strat->P));
3295 printf(
"\nSigDrop!\n");
3297 printf(
"\nEnded with no SigDrop\n");
3303 if(strat->P.sig !=
NULL)
3304 strat->sbaEnterS =
pGetComp(strat->P.sig)-1;
3307 memset(&(strat->P), 0,
sizeof(strat->P));
3326 clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3337 if (strat->completeReduce_retry)
3342 #ifdef HAVE_TAIL_RING 3343 if(
currRing->bitmask>strat->tailRing->bitmask)
3345 strat->completeReduce_retry=
FALSE;
3348 for(i=strat->sl;i>=0;i--) strat->S_2_R[
i]=-1;
3351 if (strat->completeReduce_retry)
3358 #if SBA_PRINT_SIZE_SYZ 3360 size_syz = strat->syzl;
3373 #if SBA_PRINT_SIZE_G 3374 size_g_non_red =
IDELEMS(strat->Shdl);
3388 for(;k>=0 && (strat->L[
k].p1 !=
NULL || strat->L[
k].p2 !=
NULL);k--)
3398 for(;k>=0 && strat->L[
k].p1 ==
NULL && strat->L[
k].p2 ==
NULL;k--)
3401 strat->enterS(strat->L[k], strat->sl+1, strat, strat->tl);
3409 for(k=strat->sl;k>=0;k--)
3411 printf(
"\nsig[%i] = ",i);
pWrite(strat->sig[k]);
3412 if(strat->sig[k] ==
NULL)
3413 strat->sig[
k] =
pCopy(strat->sig[k-1]);
3422 if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
3431 if(strat->tailRing == sRing)
3442 #if SBA_PRINT_SIZE_G 3443 size_g =
IDELEMS(strat->Shdl);
3446 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->Shdl));
3448 while (oo<
IDELEMS(strat->Shdl))
3450 printf(
" %d. ",oo+1);
3455 #if SBA_PRINT_ZERO_REDUCTIONS 3456 printf(
"----------------------------------------------------------\n");
3457 printf(
"ZERO REDUCTIONS: %ld\n",zeroreductions);
3460 #if SBA_PRINT_REDUCTION_STEPS 3461 printf(
"----------------------------------------------------------\n");
3462 printf(
"S-REDUCTIONS: %ld\n",sba_reduction_steps);
3464 #if SBA_PRINT_OPERATIONS 3465 printf(
"OPERATIONS: %ld\n",sba_operations);
3467 #if SBA_PRINT_REDUCTION_STEPS 3468 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3469 printf(
"INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3471 #if SBA_PRINT_OPERATIONS 3472 printf(
"INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3474 #if SBA_PRINT_REDUCTION_STEPS 3475 printf(
"- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3476 printf(
"ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3477 sba_interreduction_steps = 0;
3478 sba_reduction_steps = 0;
3480 #if SBA_PRINT_OPERATIONS 3481 printf(
"ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3482 sba_interreduction_operations = 0;
3485 #if SBA_PRINT_SIZE_G 3486 printf(
"----------------------------------------------------------\n");
3487 printf(
"SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3491 #if SBA_PRINT_SIZE_SYZ 3492 printf(
"SIZE OF SYZ: %ld\n",size_syz);
3493 printf(
"----------------------------------------------------------\n");
3496 #if SBA_PRINT_PRODUCT_CRITERION 3497 printf(
"PRODUCT CRITERIA: %ld\n",product_criterion);
3498 product_criterion = 0;
3500 return (strat->Shdl);
#define __p_GetComp(p, r)
#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)
static void p_GetExpV(poly p, int *ev, const ring r)
VAR int(* test_PosInT)(const TSet T, const int tl, LObject &h)
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
void initSba(ideal F, kStrategy strat)
void initSyzRules(kStrategy strat)
static void kDeleteLcm(LObject *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 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)
VAR 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)
static unsigned pLength(poly a)
#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)
void completeReduce(kStrategy strat, BOOLEAN withT)
void updateResult(ideal r, ideal Q, kStrategy strat)
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
void sort(CFArray &A, int l=0)
quick sort A
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 Werror(const char *fmt,...)
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
VAR int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)