2750{
2751
2752
2753
2754
2755
2756
2757
2758#if SBA_PRINT_ZERO_REDUCTIONS
2759 long zeroreductions = 0;
2760#endif
2761#if SBA_PRINT_PRODUCT_CRITERION
2762 long product_criterion = 0;
2763#endif
2764#if SBA_PRINT_SIZE_G
2765 int size_g = 0;
2766 int size_g_non_red = 0;
2767#endif
2768#if SBA_PRINT_SIZE_SYZ
2769 long size_syz = 0;
2770#endif
2771
2772#if SBA_PRINT_REDUCTION_STEPS
2773 sba_reduction_steps = 0;
2774 sba_interreduction_steps = 0;
2775#endif
2776#if SBA_PRINT_OPERATIONS
2777 sba_operations = 0;
2778 sba_interreduction_operations = 0;
2779#endif
2780
2781 ideal F1 = F0;
2782 ring sRing, currRingOld;
2785 {
2787 if (sRing!=currRingOld)
2788 {
2791 }
2792 }
2793 ideal F;
2794
2795
2796
2798 {
2799 #if 1
2804 {
2805 poly dummy;
2806 dummy =
pCopy(F->m[0]);
2808 F->m[
i] = F->m[
i+1];
2810 }
2811 #else
2813
2814 F->m[0] = F1->m[0];
2815 int pos;
2817 {
2819 {
2822 }
2824 {
2827 }
2828 poly dummy;
2829 dummy =
pCopy(F->m[0]);
2831 F->m[
i] = F->m[
i+1];
2833 }
2834 else
2835 {
2837 {
2840 }
2841 }
2842 #endif
2843
2844 }
2845 else
2846 {
2849 for (
int i=0;
i<
sort->length();++
i)
2850 F->m[
i] = F1->m[(*
sort)[
i]-1];
2852 {
2853
2854
2855 int nrmon = 0;
2857 {
2858
2860 {
2863 {
2864 F->m[
j] = F->m[
j-1];
2865 }
2867 nrmon++;
2868 }
2869
2870 }
2871 }
2872 }
2873
2878#if SBA_INTERRED_START
2880#endif
2881#if F5DEBUG
2882 printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
2884 printf(
"ordSgn = %d\n",
currRing->OrdSgn);
2885 printf("\n");
2886#endif
2887 int srmax,lrmax, red_result = 1;
2888 int olddeg,reduc;
2889 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2893
2898
2903 reduc = olddeg = lrmax = 0;
2904#ifndef NO_BUCKETS
2907#endif
2908
2909
2910
2911
2912
2913
2915
2916#ifdef HAVE_TAIL_RING
2919#endif
2921 {
2925 }
2926
2928 {
2930 {
2931
2932
2934 strat->
enterS(strat->
L[strat->
Ll-(
i)], strat->
sl+1, strat, strat->
tl);
2935 }
2938 }
2940#ifdef KDEBUG
2941
2942#endif
2943
2944 while (strat->
Ll >= 0)
2945 {
2946 if (strat->
Ll > lrmax) lrmax =strat->
Ll;
2947 #ifdef KDEBUG
2949 #endif
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2971 {
2973#if F5C
2974
2975
2976 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
2977 lrmax, reduc,
Q,
w, hilb );
2978#endif
2979
2981 }
2982
2983
2984
2985
2986
2987 strat->
P = strat->
L[strat->
Ll];
2989
2992
2993 if (!strat->
rewCrit2(strat->
P.sig, ~strat->
P.sevSig, strat->
P.GetLmCurrRing(), strat, strat->
P.checked+1))
2994 {
2995
2996#ifdef DEBUGF5
2997 PrintS(
"SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
2998 PrintS(
"-------------------------------------------------\n");
3003 PrintS(
"-------------------------------------------------\n");
3004#endif
3006 {
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3019
3020
3023 {
3025
3026
3028 {
3030 break;
3031 }
3032 }
3033
3036
3037 }
3038 else if (strat->
P.p1 ==
NULL)
3039 {
3040 if (strat->
minim > 0)
3042
3045 }
3046 if (strat->
P.p ==
NULL && strat->
P.t_p ==
NULL)
3047 {
3048 red_result = 0;
3049 }
3050 else
3051 {
3052
3053#ifdef DEBUGF5
3054 PrintS(
"Poly before red: ");
3057#endif
3058#if SBA_PRODUCT_CRITERION
3059 if (strat->
P.prod_crit)
3060 {
3061#if SBA_PRINT_PRODUCT_CRITERION
3062 product_criterion++;
3063#endif
3064 int pos =
posInSyz(strat, strat->
P.sig);
3067 red_result = 2;
3068 }
3069 else
3070 {
3071 red_result = strat->
red(&strat->
P,strat);
3072 }
3073#else
3074 red_result = strat->
red(&strat->
P,strat);
3075#endif
3076 }
3077 }
3078 else
3079 {
3080
3081
3082
3083
3084 red_result = 2;
3085 }
3087 {
3089 {
3090 strat->
P.p =
pNeg(strat->
P.p);
3091 strat->
P.sig =
pNeg(strat->
P.sig);
3092 }
3094 if(strat->
P.sig !=
NULL)
3096 if(strat->
P.p !=
NULL)
3098 }
3099
3101 {
3102
3103 red_result =
redRing(&strat->
P,strat);
3104 if(red_result == 0)
3105 {
3108 strat->
P.sig =
NULL;
3109 }
3110 else
3111 {
3112 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3115 break;
3116 }
3117 }
3119 {
3121 break;
3122 }
3123
3125
3126
3127#ifdef DEBUGF5
3128 if (red_result != 0)
3129 {
3130 PrintS(
"Poly after red: ");
3132 pWrite(strat->
P.GetLmCurrRing());
3134 printf("%d\n",red_result);
3135 }
3136#endif
3138 {
3139 if(strat->
P.p !=
NULL)
3141 &olddeg,&reduc,strat, red_result);
3142 else
3144 &olddeg,&reduc,strat, red_result);
3145 }
3146
3148 {
3150 }
3151
3152 if (red_result == 1)
3153 {
3154
3155 strat->
P.GetP(strat->
lmBin);
3156
3157
3158
3159 (strat->
P).FDeg = (strat->
P).pFDeg();
3160
3161
3162
3164
3165
3167
3168
3169
3170
3171 int pos = strat->
sl+1;
3172
3173
3174
3175 #ifdef HAVE_RINGS
3176 poly beforetailred;
3178 beforetailred =
pCopy(strat->
P.sig);
3179 #endif
3180#if SBA_TAIL_RED
3182 {
3184 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3185 }
3186 else
3187 {
3189 {
3191 {
3192 strat->
P.pCleardenom();
3194 {
3195 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3196 strat->
P.pCleardenom();
3197 }
3198 }
3199 else
3200 {
3203 strat->
P.p =
redtailSba(&(strat->
P),pos-1,strat, withT);
3204 }
3205 }
3206 }
3207
3208
3209
3211 {
3212 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3213 break;
3214 }
3215#endif
3217 {
3218 if(strat->
P.sig ==
NULL ||
pLtCmp(beforetailred,strat->
P.sig) == 1)
3219 {
3221
3222 red_result =
redRing(&strat->
P,strat);
3223 if(red_result == 0)
3224 {
3225
3228 }
3229 else
3230 {
3231 strat->
enterS(strat->
P, 0, strat, strat->
tl);
3232 break;
3233 }
3234 }
3236
3237 if(strat->
P.p ==
NULL)
3238 goto case_when_red_result_changed;
3239 }
3240
3241
3243 {
3244 for (
int jj = 0; jj<strat->
tl+1; jj++)
3245 {
3247 {
3248 strat->
T[jj].is_sigsafe =
FALSE;
3249 }
3250 }
3251 }
3252 else
3253 {
3254 for (
int jj = 0; jj<strat->
tl+1; jj++)
3255 {
3256 strat->
T[jj].is_sigsafe =
FALSE;
3257 }
3258 }
3259#ifdef KDEBUG
3261#endif
3262
3263
3265 {
3266 if (strat->
minim==1)
3267 {
3270 }
3271 else
3272 {
3273 strat->
M->m[minimcnt]=strat->
P.p2;
3275 }
3277 pNext(strat->
M->m[minimcnt])
3281 minimcnt++;
3282 }
3283
3284
3285
3287 strat->
T[strat->
tl].is_sigsafe =
FALSE;
3288
3289
3290
3291
3292
3295 else
3298 break;
3301 strat->
enterS(strat->
P, pos, strat, strat->
tl);
3303 {
3305 for (
int tk=0; tk<strat->
sl+1; tk++)
3306 {
3308 {
3309
3311 break;
3312 }
3313 }
3314
3315 if (overwrite)
3316 {
3322
3326 for(
int ps=0;ps<strat->
sl+1;ps++)
3327 {
3328
3331 {
3334 (strat->
syzmax)*
sizeof(
unsigned long),
3336 *sizeof(unsigned long));
3338 }
3340
3341
3344
3345
3346
3347
3348
3349
3350
3351
3355
3356
3360 }
3361 }
3362 }
3363
3364
3366 {
3368 unsigned max_cmp =
IDELEMS(F);
3372 int pos;
3374
3375
3377 {
3378 for (
int i=0;
i<strat->
sl; ++
i)
3379 {
3385
3388 }
3390 }
3391 else
3392 {
3393
3394
3395 for (
unsigned i=cmp+1;
i<=max_cmp; ++
i)
3396 {
3397 pos = -1;
3398 for (
int j=0;
j<strat->
sl; ++
j)
3399 {
3401 {
3403 break;
3404 }
3405 }
3406 if (pos != -1)
3407 {
3410
3417 {
3419 {
3422 }
3423 }
3424 else
3425 {
3428 }
3429 }
3430 }
3431
3432 }
3433 }
3434
3435#if DEBUGF50
3436 printf("---------------------------\n");
3437 Print(
" %d. ELEMENT ADDED TO GCURR:\n",strat->
sl+1);
3440#endif
3441
3442
3443
3444
3445
3446
3447#if 0
3449 if (pl==1)
3450 {
3451
3452
3453 }
3454 else if (pl==2)
3455 {
3456
3457
3458 }
3459#endif
3460 if (hilb!=
NULL)
khCheck(
Q,
w,hilb,hilbeledeg,hilbcount,strat);
3461
3463 if (strat->
sl>srmax) srmax = strat->
sl;
3464 }
3465 else
3466 {
3467 case_when_red_result_changed:
3468
3469
3470
3471
3472
3473 if (red_result!=2)
3474 {
3475#if SBA_PRINT_ZERO_REDUCTIONS
3476 zeroreductions++;
3477#endif
3479 {
3480
3481 }
3482 else
3483 {
3484 int pos =
posInSyz(strat, strat->
P.sig);
3486
3487 #ifdef DEBUGF5
3488 Print(
"ADDING STUFF TO SYZ : ");
3489
3491 #endif
3492 }
3493 }
3495 {
3497 }
3498 }
3499
3500#ifdef KDEBUG
3501 memset(&(strat->
P), 0,
sizeof(strat->
P));
3502#endif
3504 }
3505 #if 0
3507 printf("\nSigDrop!\n");
3508 else
3509 printf("\nEnded with no SigDrop\n");
3510 #endif
3511
3513 {
3514
3515 if(strat->
P.sig !=
NULL)
3517
3518 #ifdef KDEBUG
3519 memset(&(strat->
P), 0,
sizeof(strat->
P));
3520 #endif
3521 }
3522#ifdef KDEBUG
3524#endif
3525
3527 {
3529 {
3532 while(k<=strat->sl)
3533 {
3536 {
3540 }
3542 }
3543 }
3544 }
3545
3547 {
3550 {
3551
3552
3553
3554#ifdef HAVE_TAIL_RING
3556 {
3562 }
3564#endif
3566 }
3567 }
3569
3570#if SBA_PRINT_SIZE_SYZ
3571
3572 size_syz = strat->
syzl;
3573#endif
3574
3575
3576
3577
3578
3579
3580
3581
3582
3585#if SBA_PRINT_SIZE_G
3587#endif
3590
3591 #ifdef HAVE_RINGS
3594 {
3595
3596
3598 #if 1
3599
3600 for(;
k>=0 && (strat->
L[
k].p1 !=
NULL || strat->
L[
k].p2 !=
NULL);
k--)
3601 {
3602
3604 }
3605 #endif
3606
3607
3608
3609
3610 for(;
k>=0 && strat->
L[
k].p1 ==
NULL && strat->
L[
k].p2 ==
NULL;
k--)
3611 {
3612
3613 strat->
enterS(strat->
L[
k], strat->
sl+1, strat, strat->
tl);
3614
3615 }
3616 }
3617
3618 #if 0
3620 {
3621 for(
k=strat->
sl;
k>=0;
k--)
3622 {
3626 }
3627 }
3628 #endif
3629 #endif
3630
3631
3632
3633
3635 {
3646 }
3653
3654#if SBA_PRINT_SIZE_G
3656#endif
3657#ifdef DEBUGF5
3658 printf(
"SIZE OF SHDL: %d\n",
IDELEMS(strat->
Shdl));
3659 int oo = 0;
3661 {
3662 printf(" %d. ",oo+1);
3664 oo++;
3665 }
3666#endif
3667#if SBA_PRINT_ZERO_REDUCTIONS
3668 printf("----------------------------------------------------------\n");
3669 printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3670 zeroreductions = 0;
3671#endif
3672#if SBA_PRINT_REDUCTION_STEPS
3673 printf("----------------------------------------------------------\n");
3674 printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3675#endif
3676#if SBA_PRINT_OPERATIONS
3677 printf("OPERATIONS: %ld\n",sba_operations);
3678#endif
3679#if SBA_PRINT_REDUCTION_STEPS
3680 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3681 printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3682#endif
3683#if SBA_PRINT_OPERATIONS
3684 printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3685#endif
3686#if SBA_PRINT_REDUCTION_STEPS
3687 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3688 printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3689 sba_interreduction_steps = 0;
3690 sba_reduction_steps = 0;
3691#endif
3692#if SBA_PRINT_OPERATIONS
3693 printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3694 sba_interreduction_operations = 0;
3695 sba_operations = 0;
3696#endif
3697#if SBA_PRINT_SIZE_G
3698 printf("----------------------------------------------------------\n");
3699 printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3700 size_g = 0;
3701 size_g_non_red = 0;
3702#endif
3703#if SBA_PRINT_SIZE_SYZ
3704 printf("SIZE OF SYZ: %ld\n",size_syz);
3705 printf("----------------------------------------------------------\n");
3706 size_syz = 0;
3707#endif
3708#if SBA_PRINT_PRODUCT_CRITERION
3709 printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3710 product_criterion = 0;
3711#endif
3712 return (strat->
Shdl);
3713}
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...