2968{
2969
2970
2971
2972
2973
2974
2975
2976#if SBA_PRINT_ZERO_REDUCTIONS
2977 long zeroreductions = 0;
2978#endif
2979#if SBA_PRINT_PRODUCT_CRITERION
2980 long product_criterion = 0;
2981#endif
2982#if SBA_PRINT_SIZE_G
2983 int size_g = 0;
2984 int size_g_non_red = 0;
2985#endif
2986#if SBA_PRINT_SIZE_SYZ
2987 long size_syz = 0;
2988#endif
2989
2990#if SBA_PRINT_REDUCTION_STEPS
2991 sba_reduction_steps = 0;
2992 sba_interreduction_steps = 0;
2993#endif
2994#if SBA_PRINT_OPERATIONS
2995 sba_operations = 0;
2996 sba_interreduction_operations = 0;
2997#endif
2998
3000 ring sRing, currRingOld;
3003 {
3005 if (sRing!=currRingOld)
3006 {
3009 }
3010 }
3011 ideal F;
3012
3013
3014
3016 {
3017 #if 1
3022 {
3023 poly dummy;
3024 dummy =
pCopy(F->m[0]);
3026 F->m[
i] = F->m[
i+1];
3028 }
3029 #else
3031
3033 int pos;
3035 {
3037 {
3040 }
3042 {
3045 }
3046 poly dummy;
3047 dummy =
pCopy(F->m[0]);
3049 F->m[
i] = F->m[
i+1];
3051 }
3052 else
3053 {
3055 {
3058 }
3059 }
3060 #endif
3061
3062 }
3063 else
3064 {
3067 for (
int i=0;
i<
sort->length();++
i)
3070 {
3071
3072
3073 int nrmon = 0;
3075 {
3076
3078 {
3081 {
3082 F->m[
j] = F->m[
j-1];
3083 }
3085 nrmon++;
3086 }
3087
3088 }
3089 }
3090 }
3091
3096#if SBA_INTERRED_START
3098#endif
3099#if F5DEBUG
3100 printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
3102 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
3103 printf("\n");
3104#endif
3105 int srmax,lrmax, red_result = 1;
3106 int olddeg,reduc;
3107 int hilbeledeg=1,hilbcount=0,minimcnt=0;
3111
3116
3121 reduc = olddeg = lrmax = 0;
3122#ifndef NO_BUCKETS
3125#endif
3126
3127
3128
3129
3130
3131
3133
3134#ifdef HAVE_TAIL_RING
3137#endif
3139 {
3143 }
3144
3146 {
3148 {
3149
3150
3152 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
3153 }
3156 }
3158#ifdef KDEBUG
3159
3160#endif
3161
3162 while (strat->
Ll >= 0)
3163 {
3164 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
3165 #ifdef KDEBUG
3167 #endif
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3189 {
3191#if F5C
3192
3193
3194 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
3195 lrmax, reduc,
Q,
w, hilb );
3196#endif
3197
3199 }
3200
3201
3202
3203
3204
3205 strat->
P = strat->
L[strat->
Ll];
3207
3210
3211 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(), strat, strat->
P.checked+1))
3212 {
3213
3214#ifdef DEBUGF5
3215 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
3216 PrintS(
"-------------------------------------------------\n");
3221 PrintS(
"-------------------------------------------------\n");
3222#endif
3224 {
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3237
3238
3241 {
3243
3244
3246 {
3248 break;
3249 }
3250 }
3251
3254
3255 }
3256 else if (strat->
P.p1 ==
NULL)
3257 {
3258 if (strat->
minim > 0)
3260
3263 }
3264 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3265 {
3266 red_result = 0;
3267 }
3268 else
3269 {
3270
3271#ifdef DEBUGF5
3272 PrintS(
"Poly before red: ");
3275#endif
3276#if SBA_PRODUCT_CRITERION
3277 if (strat->
P.prod_crit)
3278 {
3279#if SBA_PRINT_PRODUCT_CRITERION
3280 product_criterion++;
3281#endif
3282 int pos =
posInSyz(strat, strat->
P.sig);
3285 red_result = 2;
3286 }
3287 else
3288 {
3289 red_result = strat->
red(&strat->
P,strat);
3290 }
3291#else
3292 red_result = strat->
red(&strat->
P,strat);
3293#endif
3294 }
3295 }
3296 else
3297 {
3298
3299
3300
3301
3302 red_result = 2;
3303 }
3305 {
3307 {
3308 strat->
P.p =
pNeg(strat->
P.p);
3309 strat->
P.sig =
pNeg(strat->
P.sig);
3310 }
3312 if(strat->
P.sig !=
NULL)
3314 if(strat->
P.p !=
NULL)
3316 }
3317
3319 {
3320
3321 red_result =
redRing(&strat->
P,strat);
3322 if(red_result == 0)
3323 {
3326 strat->
P.sig =
NULL;
3327 }
3328 else
3329 {
3330 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3333 break;
3334 }
3335 }
3337 {
3339 break;
3340 }
3341
3343
3344
3345#ifdef DEBUGF5
3346 if (red_result != 0)
3347 {
3348 PrintS(
"Poly after red: ");
3350 pWrite(strat->
P.GetLmCurrRing());
3352 printf("%d\n",red_result);
3353 }
3354#endif
3356 {
3357 if(strat->
P.p !=
NULL)
3358 message((strat->
honey ? strat->
P.ecart : 0) + strat->P.pFDeg(),
3359 &olddeg,&reduc,strat, red_result);
3360 else
3362 &olddeg,&reduc,strat, red_result);
3363 }
3364
3366 {
3368 }
3369
3370 if (red_result == 1)
3371 {
3372
3373 strat->
P.GetP(strat->
lmBin);
3374
3375
3376
3377 (strat->
P).FDeg = (strat->
P).pFDeg();
3378
3379
3380
3382
3383
3385
3386
3387
3388
3389 int pos = strat->
sl+1;
3390
3391
3392
3393 poly beforetailred;
3395 beforetailred =
pCopy(strat->
P.sig);
3396#if SBA_TAIL_RED
3398 {
3400 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3401 }
3402 else
3403 {
3405 {
3407 {
3408 strat->
P.pCleardenom();
3410 {
3411 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3412 strat->
P.pCleardenom();
3413 }
3414 }
3415 else
3416 {
3419 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3420 }
3421 }
3422 }
3423
3424
3425
3427 {
3428 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3429 break;
3430 }
3431#endif
3433 {
3434 if(strat->
P.sig ==
NULL ||
pLtCmp(beforetailred,strat->
P.sig) == 1)
3435 {
3437
3438 red_result =
redRing(&strat->
P,strat);
3439 if(red_result == 0)
3440 {
3441
3444 }
3445 else
3446 {
3447 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3448 break;
3449 }
3450 }
3452
3453 if(strat->
P.p ==
NULL)
3454 goto case_when_red_result_changed;
3455 }
3456
3457
3459 {
3460 for (
int jj = 0; jj<strat->
tl+1; jj++)
3461 {
3463 {
3464 strat->
T[jj].is_sigsafe =
FALSE;
3465 }
3466 }
3467 }
3468 else
3469 {
3470 for (
int jj = 0; jj<strat->
tl+1; jj++)
3471 {
3472 strat->
T[jj].is_sigsafe =
FALSE;
3473 }
3474 }
3475#ifdef KDEBUG
3477#endif
3478
3479
3481 {
3482 if (strat->
minim==1)
3483 {
3486 }
3487 else
3488 {
3489 strat->
M->m[minimcnt]=strat->
P.p2;
3491 }
3493 pNext(strat->
M->m[minimcnt])
3497 minimcnt++;
3498 }
3499
3500
3501
3503 strat->
T[strat->
tl].is_sigsafe =
FALSE;
3504
3505
3506
3507
3508
3511 else
3514 break;
3517 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3519 {
3521 for (
int tk=0; tk<strat->
sl+1; tk++)
3522 {
3524 {
3525
3527 break;
3528 }
3529 }
3530
3531 if (overwrite)
3532 {
3538
3542 for(
int ps=0;ps<strat->
sl+1;ps++)
3543 {
3544
3547 {
3550 (strat->
syzmax)*
sizeof(
unsigned long),
3552 *sizeof(unsigned long));
3554 }
3556
3557
3560
3561
3562
3563
3564
3565
3566
3567
3571
3572
3576 }
3577 }
3578 }
3579
3580
3582 {
3584 unsigned max_cmp =
IDELEMS(F);
3588 int pos;
3590
3591
3593 {
3594 for (
int i=0;
i<strat->
sl; ++
i)
3595 {
3601
3604 }
3606 }
3607 else
3608 {
3609
3610
3611 for (
unsigned i=cmp+1;
i<=max_cmp; ++
i)
3612 {
3613 pos = -1;
3614 for (
int j=0;
j<strat->
sl; ++
j)
3615 {
3617 {
3619 break;
3620 }
3621 }
3622 if (pos != -1)
3623 {
3626
3633 {
3635 {
3638 }
3639 }
3640 else
3641 {
3644 }
3645 }
3646 }
3647
3648 }
3649 }
3650
3651#if DEBUGF50
3652 printf("---------------------------\n");
3653 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
3656#endif
3657
3658
3659
3660
3661
3662
3663#if 0
3665 if (pl==1)
3666 {
3667
3668
3669 }
3670 else if (pl==2)
3671 {
3672
3673
3674 }
3675#endif
3676 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
3677
3679 if (strat->
sl>srmax) srmax = strat->
sl;
3680 }
3681 else
3682 {
3683 case_when_red_result_changed:
3684
3685
3686
3687
3688
3689 if (red_result!=2)
3690 {
3691#if SBA_PRINT_ZERO_REDUCTIONS
3692 zeroreductions++;
3693#endif
3695 {
3696
3697 }
3698 else
3699 {
3700 int pos =
posInSyz(strat, strat->
P.sig);
3702
3703 #ifdef DEBUGF5
3704 Print(
"ADDING STUFF TO SYZ : ");
3705
3707 #endif
3708 }
3709 }
3711 {
3713 }
3714 }
3715
3716#ifdef KDEBUG
3718#endif
3720 }
3721 #if 0
3723 printf("\nSigDrop!\n");
3724 else
3725 printf("\nEnded with no SigDrop\n");
3726 #endif
3727
3729 {
3730
3731 if(strat->
P.sig !=
NULL)
3733
3734 #ifdef KDEBUG
3736 #endif
3737 }
3738#ifdef KDEBUG
3740#endif
3741
3743 {
3745 {
3749 {
3752 {
3756 }
3758 }
3759 }
3760 }
3761
3763 {
3766 {
3767
3768
3769
3770#ifdef HAVE_TAIL_RING
3772 {
3778 }
3780#endif
3782 }
3783 }
3785
3786#if SBA_PRINT_SIZE_SYZ
3787
3788 size_syz = strat->
syzl;
3789#endif
3790
3791
3792
3793
3794
3795
3796
3797
3798
3801#if SBA_PRINT_SIZE_G
3803#endif
3806
3809 {
3810
3811
3813 #if 1
3814
3815 for(;
k>=0 && (strat->
L[
k].p1 !=
NULL || strat->
L[
k].p2 !=
NULL);
k--)
3816 {
3817
3819 }
3820 #endif
3821
3822
3823
3824
3825 for(;
k>=0 && strat->
L[
k].p1 ==
NULL && strat->
L[
k].p2 ==
NULL;
k--)
3826 {
3827
3828 strat->
enterS(strat->
L[
k], strat->
sl+1, strat, strat->
tl);
3829
3830 }
3831 }
3832
3833 #if 0
3835 {
3836 for(
k=strat->
sl;
k>=0;
k--)
3837 {
3841 }
3842 }
3843 #endif
3844
3845
3846
3847
3849 {
3860 }
3867
3868#if SBA_PRINT_SIZE_G
3870#endif
3871#ifdef DEBUGF5
3872 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
3873 int oo = 0;
3875 {
3876 printf(" %d. ",oo+1);
3878 oo++;
3879 }
3880#endif
3881#if SBA_PRINT_ZERO_REDUCTIONS
3882 printf("----------------------------------------------------------\n");
3883 printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3884 zeroreductions = 0;
3885#endif
3886#if SBA_PRINT_REDUCTION_STEPS
3887 printf("----------------------------------------------------------\n");
3888 printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3889#endif
3890#if SBA_PRINT_OPERATIONS
3891 printf("OPERATIONS: %ld\n",sba_operations);
3892#endif
3893#if SBA_PRINT_REDUCTION_STEPS
3894 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3895 printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3896#endif
3897#if SBA_PRINT_OPERATIONS
3898 printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3899#endif
3900#if SBA_PRINT_REDUCTION_STEPS
3901 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3902 printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3903 sba_interreduction_steps = 0;
3904 sba_reduction_steps = 0;
3905#endif
3906#if SBA_PRINT_OPERATIONS
3907 printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3908 sba_interreduction_operations = 0;
3909 sba_operations = 0;
3910#endif
3911#if SBA_PRINT_SIZE_G
3912 printf("----------------------------------------------------------\n");
3913 printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3914 size_g = 0;
3915 size_g_non_red = 0;
3916#endif
3917#if SBA_PRINT_SIZE_SYZ
3918 printf("SIZE OF SYZ: %ld\n",size_syz);
3919 printf("----------------------------------------------------------\n");
3920 size_syz = 0;
3921#endif
3922#if SBA_PRINT_PRODUCT_CRITERION
3923 printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3924 product_criterion = 0;
3925#endif
3926 return (strat->
Shdl);
3927}
static void sort(int **points, int sizePoints)
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
ideal kInterRed(ideal F, const ideal Q)
void initSba(ideal F, kStrategy strat)
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
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 initSbaPos(kStrategy strat)
void enterSyz(LObject &p, kStrategy strat, int atT)
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
void messageStatSBA(int hilbcount, kStrategy strat)
void initSyzRules(kStrategy strat)
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
int posInSyz(const kStrategy strat, poly sig)
void exitSba(kStrategy strat)
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
void initSbaCrit(kStrategy strat)
#define __p_GetComp(p, r)
#define omRealloc0Size(addr, o_size, size)
void pEnlargeSet(poly **p, int l, int increment)
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
static void p_SetExpV(poly p, int *ev, const ring r)
static int p_LmCmp(poly p, poly q, const ring r)
static void p_GetExpV(poly p, int *ev, const ring r)
void rChangeCurrRing(ring r)
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
void rWrite(ring r, BOOLEAN details)
void rDelete(ring r)
unconditionally deletes fields in r
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...
int F1(int a1, int &r1)
F1.