2735{
2736
2737
2738
2739
2740
2741
2742
2743#if SBA_PRINT_ZERO_REDUCTIONS
2744 long zeroreductions = 0;
2745#endif
2746#if SBA_PRINT_PRODUCT_CRITERION
2747 long product_criterion = 0;
2748#endif
2749#if SBA_PRINT_SIZE_G
2750 int size_g = 0;
2751 int size_g_non_red = 0;
2752#endif
2753#if SBA_PRINT_SIZE_SYZ
2754 long size_syz = 0;
2755#endif
2756
2757#if SBA_PRINT_REDUCTION_STEPS
2758 sba_reduction_steps = 0;
2759 sba_interreduction_steps = 0;
2760#endif
2761#if SBA_PRINT_OPERATIONS
2762 sba_operations = 0;
2763 sba_interreduction_operations = 0;
2764#endif
2765
2766 ideal F1 = F0;
2767 ring sRing, currRingOld;
2770 {
2772 if (sRing!=currRingOld)
2773 {
2776 }
2777 }
2778 ideal F;
2779
2780
2781
2783 {
2784 #if 1
2789 {
2790 poly dummy;
2791 dummy =
pCopy(F->m[0]);
2793 F->m[
i] = F->m[
i+1];
2795 }
2796 #else
2798
2799 F->m[0] = F1->m[0];
2800 int pos;
2802 {
2804 {
2807 }
2809 {
2812 }
2813 poly dummy;
2814 dummy =
pCopy(F->m[0]);
2816 F->m[
i] = F->m[
i+1];
2818 }
2819 else
2820 {
2822 {
2825 }
2826 }
2827 #endif
2828
2829 }
2830 else
2831 {
2834 for (
int i=0;
i<
sort->length();++
i)
2835 F->m[
i] = F1->m[(*
sort)[
i]-1];
2837 {
2838
2839
2840 int nrmon = 0;
2842 {
2843
2845 {
2848 {
2849 F->m[
j] = F->m[
j-1];
2850 }
2852 nrmon++;
2853 }
2854
2855 }
2856 }
2857 }
2858
2863#if SBA_INTERRED_START
2865#endif
2866#if F5DEBUG
2867 printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2869 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
2870 printf("\n");
2871#endif
2872 int srmax,lrmax, red_result = 1;
2873 int olddeg,reduc;
2874 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2878
2883
2888 reduc = olddeg = lrmax = 0;
2889#ifndef NO_BUCKETS
2892#endif
2893
2894
2895
2896
2897
2898
2900
2901#ifdef HAVE_TAIL_RING
2904#endif
2906 {
2910 }
2911
2913 {
2915 {
2916
2917
2919 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
2920 }
2923 }
2925#ifdef KDEBUG
2926
2927#endif
2928
2929 while (strat->
Ll >= 0)
2930 {
2931 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2932 #ifdef KDEBUG
2934 #endif
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2956 {
2958#if F5C
2959
2960
2961 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2962 lrmax, reduc,
Q,
w, hilb );
2963#endif
2964
2966 }
2967
2968
2969
2970
2971
2972 strat->
P = strat->
L[strat->
Ll];
2974
2977
2978 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(), strat, strat->
P.checked+1))
2979 {
2980
2981#ifdef DEBUGF5
2982 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2983 PrintS(
"-------------------------------------------------\n");
2988 PrintS(
"-------------------------------------------------\n");
2989#endif
2991 {
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3004
3005
3008 {
3010
3011
3013 {
3015 break;
3016 }
3017 }
3018
3021
3022 }
3023 else if (strat->
P.p1 ==
NULL)
3024 {
3025 if (strat->
minim > 0)
3027
3030 }
3031 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3032 {
3033 red_result = 0;
3034 }
3035 else
3036 {
3037
3038#ifdef DEBUGF5
3039 PrintS(
"Poly before red: ");
3042#endif
3043#if SBA_PRODUCT_CRITERION
3044 if (strat->
P.prod_crit)
3045 {
3046#if SBA_PRINT_PRODUCT_CRITERION
3047 product_criterion++;
3048#endif
3049 int pos =
posInSyz(strat, strat->
P.sig);
3052 red_result = 2;
3053 }
3054 else
3055 {
3056 red_result = strat->
red(&strat->
P,strat);
3057 }
3058#else
3059 red_result = strat->
red(&strat->
P,strat);
3060#endif
3061 }
3062 }
3063 else
3064 {
3065
3066
3067
3068
3069 red_result = 2;
3070 }
3072 {
3074 {
3075 strat->
P.p =
pNeg(strat->
P.p);
3076 strat->
P.sig =
pNeg(strat->
P.sig);
3077 }
3079 if(strat->
P.sig !=
NULL)
3081 if(strat->
P.p !=
NULL)
3083 }
3084
3086 {
3087
3088 red_result =
redRing(&strat->
P,strat);
3089 if(red_result == 0)
3090 {
3093 strat->
P.sig =
NULL;
3094 }
3095 else
3096 {
3097 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3100 break;
3101 }
3102 }
3104 {
3106 break;
3107 }
3108
3110
3111
3112#ifdef DEBUGF5
3113 if (red_result != 0)
3114 {
3115 PrintS(
"Poly after red: ");
3117 pWrite(strat->
P.GetLmCurrRing());
3119 printf("%d\n",red_result);
3120 }
3121#endif
3123 {
3124 if(strat->
P.p !=
NULL)
3126 &olddeg,&reduc,strat, red_result);
3127 else
3129 &olddeg,&reduc,strat, red_result);
3130 }
3131
3133 {
3135 }
3136
3137 if (red_result == 1)
3138 {
3139
3140 strat->
P.GetP(strat->
lmBin);
3141
3142
3143
3144 (strat->
P).FDeg = (strat->
P).pFDeg();
3145
3146
3147
3149
3150
3152
3153
3154
3155
3156 int pos = strat->
sl+1;
3157
3158
3159
3160
3161 #ifdef HAVE_RINGS
3162 poly beforetailred;
3164 beforetailred =
pCopy(strat->
P.sig);
3165 #endif
3166#if SBA_TAIL_RED
3168 {
3170 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3171 }
3172 else
3173 {
3175 {
3177 {
3178 strat->
P.pCleardenom();
3180 {
3181 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3182 strat->
P.pCleardenom();
3183 }
3184 }
3185 else
3186 {
3189 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3190 }
3191 }
3192 }
3193
3194
3195
3197 {
3198 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3199 break;
3200 }
3201#endif
3203 {
3204 if(strat->
P.sig ==
NULL ||
pLtCmp(beforetailred,strat->
P.sig) == 1)
3205 {
3207
3208 red_result =
redRing(&strat->
P,strat);
3209 if(red_result == 0)
3210 {
3211
3214 }
3215 else
3216 {
3217 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3218 break;
3219 }
3220 }
3222
3223 if(strat->
P.p ==
NULL)
3224 goto case_when_red_result_changed;
3225 }
3226
3227
3229 {
3230 for (
int jj = 0; jj<strat->
tl+1; jj++)
3231 {
3233 {
3234 strat->
T[jj].is_sigsafe =
FALSE;
3235 }
3236 }
3237 }
3238 else
3239 {
3240 for (
int jj = 0; jj<strat->
tl+1; jj++)
3241 {
3242 strat->
T[jj].is_sigsafe =
FALSE;
3243 }
3244 }
3245#ifdef KDEBUG
3247#endif
3248
3249
3251 {
3252 if (strat->
minim==1)
3253 {
3256 }
3257 else
3258 {
3259 strat->
M->m[minimcnt]=strat->
P.p2;
3261 }
3263 pNext(strat->
M->m[minimcnt])
3267 minimcnt++;
3268 }
3269
3270
3271
3273 strat->
T[strat->
tl].is_sigsafe =
FALSE;
3274
3275
3276
3277
3278
3281 else
3284 break;
3287 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3289 {
3291 for (
int tk=0; tk<strat->
sl+1; tk++)
3292 {
3294 {
3295
3297 break;
3298 }
3299 }
3300
3301 if (overwrite)
3302 {
3308
3312 for(
int ps=0;ps<strat->
sl+1;ps++)
3313 {
3314
3317 {
3320 (strat->
syzmax)*
sizeof(
unsigned long),
3322 *sizeof(unsigned long));
3324 }
3326
3327
3330
3331
3332
3333
3334
3335
3336
3337
3341
3342
3346 }
3347 }
3348 }
3349
3350
3352 {
3354 unsigned max_cmp =
IDELEMS(F);
3358 int pos;
3360
3361
3363 {
3364 for (
int i=0;
i<strat->
sl; ++
i)
3365 {
3371
3374 }
3376 }
3377 else
3378 {
3379
3380
3381 for (
unsigned i=cmp+1;
i<=max_cmp; ++
i)
3382 {
3383 pos = -1;
3384 for (
int j=0;
j<strat->
sl; ++
j)
3385 {
3387 {
3389 break;
3390 }
3391 }
3392 if (pos != -1)
3393 {
3396
3403 {
3405 {
3408 }
3409 }
3410 else
3411 {
3414 }
3415 }
3416 }
3417
3418 }
3419 }
3420
3421#if DEBUGF50
3422 printf("---------------------------\n");
3423 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
3426#endif
3427
3428
3429
3430
3431
3432
3433#if 0
3435 if (pl==1)
3436 {
3437
3438
3439 }
3440 else if (pl==2)
3441 {
3442
3443
3444 }
3445#endif
3446 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
3447
3449 if (strat->
sl>srmax) srmax = strat->
sl;
3450 }
3451 else
3452 {
3453 case_when_red_result_changed:
3454
3455
3456
3457
3458
3459 if (red_result!=2)
3460 {
3461#if SBA_PRINT_ZERO_REDUCTIONS
3462 zeroreductions++;
3463#endif
3465 {
3466
3467 }
3468 else
3469 {
3470 int pos =
posInSyz(strat, strat->
P.sig);
3472
3473 #ifdef DEBUGF5
3474 Print(
"ADDING STUFF TO SYZ : ");
3475
3477 #endif
3478 }
3479 }
3481 {
3483 }
3484 }
3485
3486#ifdef KDEBUG
3487 memset(&(strat->
P), 0,
sizeof(strat->
P));
3488#endif
3490 }
3491 #if 0
3493 printf("\nSigDrop!\n");
3494 else
3495 printf("\nEnded with no SigDrop\n");
3496 #endif
3497
3499 {
3500
3501 if(strat->
P.sig !=
NULL)
3503
3504 #ifdef KDEBUG
3505 memset(&(strat->
P), 0,
sizeof(strat->
P));
3506 #endif
3507 }
3508#ifdef KDEBUG
3510#endif
3511
3513 {
3515 {
3518 while(k<=strat->sl)
3519 {
3522 {
3526 }
3528 }
3529 }
3530 }
3531
3533 {
3536 {
3537
3538
3539
3540#ifdef HAVE_TAIL_RING
3542 {
3548 }
3550#endif
3552 }
3553 }
3555
3556#if SBA_PRINT_SIZE_SYZ
3557
3558 size_syz = strat->
syzl;
3559#endif
3560
3561
3562
3563
3564
3565
3566
3567
3568
3571#if SBA_PRINT_SIZE_G
3573#endif
3576
3577 #ifdef HAVE_RINGS
3580 {
3581
3582
3584 #if 1
3585
3586 for(;
k>=0 && (strat->
L[
k].p1 !=
NULL || strat->
L[
k].p2 !=
NULL);
k--)
3587 {
3588
3590 }
3591 #endif
3592
3593
3594
3595
3596 for(;
k>=0 && strat->
L[
k].p1 ==
NULL && strat->
L[
k].p2 ==
NULL;
k--)
3597 {
3598
3599 strat->
enterS(strat->
L[
k], strat->
sl+1, strat, strat->
tl);
3600
3601 }
3602 }
3603
3604 #if 0
3606 {
3607 for(
k=strat->
sl;
k>=0;
k--)
3608 {
3612 }
3613 }
3614 #endif
3615 #endif
3616
3617
3618
3619
3621 {
3632 }
3639
3640#if SBA_PRINT_SIZE_G
3642#endif
3643#ifdef DEBUGF5
3644 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
3645 int oo = 0;
3647 {
3648 printf(" %d. ",oo+1);
3650 oo++;
3651 }
3652#endif
3653#if SBA_PRINT_ZERO_REDUCTIONS
3654 printf("----------------------------------------------------------\n");
3655 printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3656 zeroreductions = 0;
3657#endif
3658#if SBA_PRINT_REDUCTION_STEPS
3659 printf("----------------------------------------------------------\n");
3660 printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3661#endif
3662#if SBA_PRINT_OPERATIONS
3663 printf("OPERATIONS: %ld\n",sba_operations);
3664#endif
3665#if SBA_PRINT_REDUCTION_STEPS
3666 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3667 printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3668#endif
3669#if SBA_PRINT_OPERATIONS
3670 printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3671#endif
3672#if SBA_PRINT_REDUCTION_STEPS
3673 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3674 printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3675 sba_interreduction_steps = 0;
3676 sba_reduction_steps = 0;
3677#endif
3678#if SBA_PRINT_OPERATIONS
3679 printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3680 sba_interreduction_operations = 0;
3681 sba_operations = 0;
3682#endif
3683#if SBA_PRINT_SIZE_G
3684 printf("----------------------------------------------------------\n");
3685 printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3686 size_g = 0;
3687 size_g_non_red = 0;
3688#endif
3689#if SBA_PRINT_SIZE_SYZ
3690 printf("SIZE OF SYZ: %ld\n",size_syz);
3691 printf("----------------------------------------------------------\n");
3692 size_syz = 0;
3693#endif
3694#if SBA_PRINT_PRODUCT_CRITERION
3695 printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3696 product_criterion = 0;
3697#endif
3698 return (strat->
Shdl);
3699}
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, 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...