My Project
Loading...
Searching...
No Matches
kstd2.cc File Reference
#include "kernel/mod2.h"
#include "kernel/GBEngine/kutil.h"
#include "misc/options.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/khstd.h"
#include "polys/kbuckets.h"
#include "polys/prCopy.h"
#include "polys/weight.h"
#include "misc/intvec.h"
#include "polys/nc/nc.h"
#include "polys/shiftop.h"

Go to the source code of this file.

Macros

#define GCD_SBA   1
#define PLURAL_INTERNAL_DECLARATIONS   1
#define STDZ_EXHANGE_DURING_REDUCTION   0
#define DEBUGF50   0
#define DEBUGF51   0
#define F5C   1
#define F5CTAILRED   1
#define SBA_INTERRED_START   0
#define SBA_TAIL_RED   1
#define SBA_PRODUCT_CRITERION   0
#define SBA_PRINT_ZERO_REDUCTIONS   0
#define SBA_PRINT_REDUCTION_STEPS   0
#define SBA_PRINT_OPERATIONS   0
#define SBA_PRINT_SIZE_G   0
#define SBA_PRINT_SIZE_SYZ   0
#define SBA_PRINT_PRODUCT_CRITERION   0

Functions

int kTestDivisibleByT0_Z (const kStrategy strat, const LObject *L)
 tests if T[0] divides the leading monomial of L, returns -1 if not
int kFindDivisibleByInT_Z (const kStrategy strat, const LObject *L, const int start)
static int kFindDivisibleByInS_Z (const kStrategy strat, LObject *L)
int kFindDivisibleByInT (const kStrategy strat, const LObject *L, const int start)
 return -1 if no divisor is found number of first divisor in T, otherwise
int kFindDivisibleByInT_ecart (const kStrategy strat, const LObject *L, const int ecart)
int kFindDivisibleByInS (const kStrategy strat, int *max_ind, LObject *L)
 return -1 if no divisor is found number of first divisor in S, otherwise
int kFindDivisibleByInS_noCF (const kStrategy strat, int *max_ind, LObject *L)
int kFindNextDivisibleByInS (const kStrategy strat, int start, int max_ind, LObject *L)
static long ind_fact_2 (long arg)
poly kFindZeroPoly (poly input_p, ring leadRing, ring tailRing)
int redRing_Z (LObject *h, kStrategy strat)
static int redRing_Z_S (LObject *h, kStrategy strat)
int redRing (LObject *h, kStrategy strat)
static int redRing_S (LObject *h, kStrategy strat)
int redHomog (LObject *h, kStrategy strat)
KINLINE int ksReducePolyTailSig (LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
int redSig (LObject *h, kStrategy strat)
int redSigRing (LObject *h, kStrategy strat)
poly redtailSba (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
int redLazy (LObject *h, kStrategy strat)
int redHoney (LObject *h, kStrategy strat)
poly redNF (poly h, int &max_ind, int nonorm, kStrategy strat)
poly redNFBound (poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
void kDebugPrint (kStrategy strat)
ideal bba (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
ideal sba (ideal F0, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
poly kNF2Bound (ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
ideal kNF2 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
ideal kNF2Bound (ideal F, ideal Q, ideal q, int bound, kStrategy strat, int lazyReduce)
void f5c (kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, bigintmat *hilb)
ideal bbaShift (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
ideal rightgb (ideal F, const ideal Q)
int redFirstShift (LObject *h, kStrategy strat)

Macro Definition Documentation

◆ DEBUGF50

#define DEBUGF50   0

Definition at line 26 of file kstd2.cc.

◆ DEBUGF51

#define DEBUGF51   0

Definition at line 27 of file kstd2.cc.

◆ F5C

#define F5C   1

Definition at line 34 of file kstd2.cc.

◆ F5CTAILRED

#define F5CTAILRED   1

Definition at line 36 of file kstd2.cc.

◆ GCD_SBA

#define GCD_SBA   1

Definition at line 12 of file kstd2.cc.

◆ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS   1

Definition at line 18 of file kstd2.cc.

◆ SBA_INTERRED_START

#define SBA_INTERRED_START   0

Definition at line 39 of file kstd2.cc.

◆ SBA_PRINT_OPERATIONS

#define SBA_PRINT_OPERATIONS   0

Definition at line 44 of file kstd2.cc.

◆ SBA_PRINT_PRODUCT_CRITERION

#define SBA_PRINT_PRODUCT_CRITERION   0

Definition at line 47 of file kstd2.cc.

◆ SBA_PRINT_REDUCTION_STEPS

#define SBA_PRINT_REDUCTION_STEPS   0

Definition at line 43 of file kstd2.cc.

◆ SBA_PRINT_SIZE_G

#define SBA_PRINT_SIZE_G   0

Definition at line 45 of file kstd2.cc.

◆ SBA_PRINT_SIZE_SYZ

#define SBA_PRINT_SIZE_SYZ   0

Definition at line 46 of file kstd2.cc.

◆ SBA_PRINT_ZERO_REDUCTIONS

#define SBA_PRINT_ZERO_REDUCTIONS   0

Definition at line 42 of file kstd2.cc.

◆ SBA_PRODUCT_CRITERION

#define SBA_PRODUCT_CRITERION   0

Definition at line 41 of file kstd2.cc.

◆ SBA_TAIL_RED

#define SBA_TAIL_RED   1

Definition at line 40 of file kstd2.cc.

◆ STDZ_EXHANGE_DURING_REDUCTION

#define STDZ_EXHANGE_DURING_REDUCTION   0

Definition at line 21 of file kstd2.cc.

Function Documentation

◆ bba()

ideal bba ( ideal F,
ideal Q,
intvec * w,
bigintmat * hilb,
kStrategy strat )

Definition at line 2614 of file kstd2.cc.

2615{
2616 int red_result = 1;
2617 int olddeg,reduc;
2618 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2619 BOOLEAN withT = FALSE;
2620 BITSET save;
2621 SI_SAVE_OPT1(save);
2622
2623 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
2625 initBuchMoraPosRing(strat);
2626 else
2627 initBuchMoraPos(strat);
2628 initHilbCrit(F,Q,&hilb,strat);
2629 initBba(strat);
2630 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2631 initBuchMora(F, Q,strat);
2632 if(errorreported) return NULL;
2633 if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2634 reduc = olddeg = 0;
2635
2636#ifndef NO_BUCKETS
2638 strat->use_buckets = 1;
2639#endif
2640 // redtailBBa against T for inhomogeneous input
2641 if (!TEST_OPT_OLDSTD)
2642 withT = ! strat->homog;
2643
2644 // strat->posInT = posInT_pLength;
2645 #ifdef KDEBUG
2646 kTest_TS(strat);
2647 #endif
2648
2649#ifdef HAVE_TAIL_RING
2650 if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2652#endif
2653
2654#ifdef KDEBUG
2655 //kDebugPrint(strat);
2656#endif
2657 /* compute------------------------------------------------------- */
2658 while (strat->Ll >= 0)
2659 {
2660 #ifdef KDEBUG
2661 if (TEST_OPT_DEBUG) messageSets(strat);
2662 #endif
2663 if (siCntrlc)
2664 {
2665 while (strat->Ll >= 0)
2666 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2667 strat->noClearS=TRUE;
2668 }
2670 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2671 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2672 {
2673 /*
2674 *stops computation if
2675 * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2676 *a predefined number Kstd1_deg
2677 */
2678 while ((strat->Ll >= 0)
2679 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2680 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2681 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2682 )
2683 {
2684 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2685 if(TEST_OPT_PROT) PrintS("D");
2686 }
2687 if (strat->Ll<0) break;
2688 else strat->noClearS=TRUE;
2689 }
2690 if (strat->Ll== 0) strat->interpt=TRUE;
2691 /* picks the last element from the lazyset L */
2692 strat->P = strat->L[strat->Ll];
2693 strat->Ll--;
2694
2695 if (pNext(strat->P.p) == strat->tail)
2696 {
2697 // deletes the short spoly
2699 pLmDelete(strat->P.p);
2700 else
2701 pLmFree(strat->P.p);
2702 strat->P.p = NULL;
2703 poly m1 = NULL, m2 = NULL;
2704
2705 // check that spoly creation is ok
2706 while (strat->tailRing != currRing &&
2707 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2708 {
2709 assume(m1 == NULL && m2 == NULL);
2710 // if not, change to a ring where exponents are at least
2711 // large enough
2712 if (!kStratChangeTailRing(strat))
2713 {
2714 WerrorS("OVERFLOW...");
2715 break;
2716 }
2717 }
2718 // create the real one
2719 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2720 strat->tailRing, m1, m2, strat->R);
2721 }
2722 else if (strat->P.p1 == NULL)
2723 {
2724 if (strat->minim > 0)
2725 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2726 // for input polys, prepare reduction
2727 strat->P.PrepareRed(strat->use_buckets);
2728 }
2729
2730 if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
2731 {
2732 red_result = 0;
2733 }
2734 else
2735 {
2736 if (TEST_OPT_PROT)
2737 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2738 &olddeg,&reduc,strat, red_result);
2739
2740 /* reduction of the element chosen from L */
2741 red_result = strat->red(&strat->P,strat);
2742 if (errorreported) break;
2743 }
2744
2745 if (strat->overflow)
2746 {
2747 if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2748 }
2749
2750 // reduction to non-zero new poly
2751 if (red_result == 1)
2752 {
2753 // get the polynomial (canonicalize bucket, make sure P.p is set)
2754 strat->P.GetP(strat->lmBin);
2755 // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2756 // but now, for entering S, T, we reset it
2757 // in the inhomogeneous case: FDeg == pFDeg
2758 if (strat->homog) strat->initEcart(&(strat->P));
2759
2760 /* statistic */
2761 if (TEST_OPT_PROT) PrintS("s");
2762
2763 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2764
2765 // reduce the tail and normalize poly
2766 // in the ring case we cannot expect LC(f) = 1,
2767 strat->redTailChange=FALSE;
2768
2769 /* if we are computing over Z we always want to try and cut down
2770 * the coefficients in the tail terms */
2772 {
2773 redtailBbaAlsoLC_Z(&(strat->P), strat->tl, strat);
2774 }
2775
2777 {
2778 strat->P.pCleardenom();
2780 {
2781 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
2782 strat->P.pCleardenom();
2783 if (strat->redTailChange) { strat->P.t_p=NULL; }
2784 }
2785 }
2786 else
2787 {
2788 strat->P.pNorm();
2790 {
2791 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2792 if (strat->redTailChange) { strat->P.t_p=NULL; }
2793 }
2794 }
2795
2796#ifdef KDEBUG
2797 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2798#endif /* KDEBUG */
2799
2800 // min_std stuff
2801 if ((strat->P.p1==NULL) && (strat->minim>0))
2802 {
2803 if (strat->minim==1)
2804 {
2805 strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2806 p_Delete(&strat->P.p2, currRing, strat->tailRing);
2807 }
2808 else
2809 {
2810 strat->M->m[minimcnt]=strat->P.p2;
2811 strat->P.p2=NULL;
2812 }
2813 if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2814 pNext(strat->M->m[minimcnt])
2815 = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2816 strat->tailRing, currRing,
2817 currRing->PolyBin);
2818 minimcnt++;
2819 }
2820
2821 // enter into S, L, and T
2822 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2823 {
2824 strat->P.SetShortExpVector();
2825 enterT(&strat->P, strat);
2827 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2828 else
2829 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2830 // posInS only depends on the leading term
2831 strat->enterS(&strat->P, pos, strat, strat->tl);
2832#if 0
2833 int pl=pLength(strat->P.p);
2834 if (pl==1)
2835 {
2836 //if (TEST_OPT_PROT)
2837 //PrintS("<1>");
2838 }
2839 else if (pl==2)
2840 {
2841 //if (TEST_OPT_PROT)
2842 //PrintS("<2>");
2843 }
2844#endif
2845 }
2846 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2847// Print("[%d]",hilbeledeg);
2848 kDeleteLcm(&strat->P);
2849 if (strat->s_poly!=NULL)
2850 {
2851 // the only valid entries are: strat->P.p,
2852 // strat->tailRing (read-only, keep it)
2853 // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2854 if (strat->s_poly(strat))
2855 {
2856 // we are called AFTER enterS, i.e. if we change P
2857 // we have to add it also to S/T
2858 // and add pairs
2859 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2860 enterT(&strat->P, strat);
2862 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2863 else
2864 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2865 strat->enterS(&strat->P, pos, strat, strat->tl);
2866 }
2867 }
2868 }
2869 else if (strat->P.p1 == NULL && strat->minim > 0)
2870 {
2871 p_Delete(&strat->P.p2, currRing, strat->tailRing);
2872 }
2873
2874#ifdef KDEBUG
2875 strat->P.Init();
2876 kTest_TS(strat);
2877#endif /* KDEBUG */
2878 }
2879#ifdef KDEBUG
2880 if (TEST_OPT_DEBUG) messageSets(strat);
2881#endif /* KDEBUG */
2882
2883 if (TEST_OPT_SB_1)
2884 {
2886 {
2887 int k=1;
2888 int j;
2889 while(k<=strat->sl)
2890 {
2891 j=0;
2892 loop
2893 {
2894 if (j>=k) break;
2895 clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2896 j++;
2897 }
2898 k++;
2899 }
2900 }
2901 }
2902 /* complete reduction of the standard basis--------- */
2903 if (TEST_OPT_REDSB)
2904 {
2905 completeReduce(strat);
2906 if (strat->completeReduce_retry)
2907 {
2908 // completeReduce needed larger exponents, retry
2909 // to reduce with S (instead of T)
2910 // and in currRing (instead of strat->tailRing)
2911#ifdef HAVE_TAIL_RING
2912 if(currRing->bitmask>strat->tailRing->bitmask)
2913 {
2915 cleanT(strat);strat->tailRing=currRing;
2916 int i;
2917 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2918 completeReduce(strat);
2919 }
2920 if (strat->completeReduce_retry)
2921#endif
2922 Werror("exponent bound is %ld",currRing->bitmask);
2923 }
2924 }
2925 else if (TEST_OPT_PROT) PrintLn();
2926 /* release temp data-------------------------------- */
2927 exitBuchMora(strat);
2928 /* postprocessing for GB over ZZ --------------------*/
2929 if (!errorreported)
2930 {
2932 {
2933 for(int i = 0;i<=strat->sl;i++)
2934 {
2935 if(!nGreaterZero(pGetCoeff(strat->S[i])))
2936 {
2937 strat->S[i] = pNeg(strat->S[i]);
2938 }
2939 }
2940 finalReduceByMon(strat);
2941 for(int i = 0;i<IDELEMS(strat->Shdl);i++)
2942 {
2943 if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
2944 {
2945 strat->S[i] = pNeg(strat->Shdl->m[i]);
2946 }
2947 }
2948 }
2949 //else if (rField_is_Ring(currRing))
2950 // finalReduceByMon(strat);
2951 }
2952// if (TEST_OPT_WEIGHTM)
2953// {
2954// pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2955// if (ecartWeights)
2956// {
2957// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2958// ecartWeights=NULL;
2959// }
2960// }
2961 if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
2962 SI_RESTORE_OPT1(save);
2963 /* postprocessing for GB over Q-rings ------------------*/
2964 if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
2965
2966 idTest(strat->Shdl);
2967
2968 return (strat->Shdl);
2969}
#define BITSET
Definition auxiliary.h:85
int BOOLEAN
Definition auxiliary.h:88
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int i
Definition cfEzgcd.cc:132
int k
Definition cfEzgcd.cc:99
int syzComp
Definition kutil.h:353
int * S_2_R
Definition kutil.h:341
ring tailRing
Definition kutil.h:342
int Ll
Definition kutil.h:350
omBin lmBin
Definition kutil.h:343
char honey
Definition kutil.h:374
polyset S
Definition kutil.h:305
int minim
Definition kutil.h:356
TObject ** R
Definition kutil.h:339
ideal M
Definition kutil.h:304
int tl
Definition kutil.h:349
poly tail
Definition kutil.h:333
ideal Shdl
Definition kutil.h:302
void(* enterS)(LObject *h, int pos, kStrategy strat, int atR)
Definition kutil.h:285
pShallowCopyDeleteProc p_shallow_copy_delete
Definition kutil.h:337
char use_buckets
Definition kutil.h:380
char interpt
Definition kutil.h:368
char redTailChange
Definition kutil.h:396
char completeReduce_retry
Definition kutil.h:400
void(* initEcart)(TObject *L)
Definition kutil.h:281
LObject P
Definition kutil.h:301
char noClearS
Definition kutil.h:399
char overflow
Definition kutil.h:401
LSet L
Definition kutil.h:326
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
int sl
Definition kutil.h:347
unsigned long * sevS
Definition kutil.h:321
char homog
Definition kutil.h:369
s_poly_proc_t s_poly
Definition kutil.h:299
const CanonicalForm & w
Definition facAbsFact.cc:51
int j
Definition facHensel.cc:110
VAR short errorreported
Definition feFopen.cc:23
void WerrorS(const char *s)
Definition feFopen.cc:24
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define idTest(id)
Definition ideals.h:47
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition kInline.h:1212
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition kInline.h:1235
void khCheck(ideal Q, intvec *w, bigintmat *hilb, int &eledeg, int &count, kStrategy strat)
Definition khstd.cc:28
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition kspoly.cc:1203
void initBba(kStrategy strat)
Definition kstd1.cc:1690
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9749
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1067
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4487
void redtailBbaAlsoLC_Z(LObject *L, int end_pos, kStrategy strat)
Definition kutil.cc:7140
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9580
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10939
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9837
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4663
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition kutil.cc:10459
void enterT(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9143
void cleanT(kStrategy strat)
Definition kutil.cc:557
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10051
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4457
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1208
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11036
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9435
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10257
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9664
void messageSets(kStrategy strat)
Definition kutil.cc:7536
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7504
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10847
void initHilbCrit(ideal, ideal, bigintmat **hilb, kStrategy strat)
Definition kutil.cc:9417
static void kDeleteLcm(LObject *P)
Definition kutil.h:876
#define assume(x)
Definition mod2.h:389
#define pNext(p)
Definition monomials.h:36
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
#define nGreaterZero(n)
Definition numbers.h:27
#define NULL
Definition omList.c:12
VAR BOOLEAN siCntrlc
Definition options.c:14
#define TEST_OPT_IDLIFT
Definition options.h:131
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
#define TEST_OPT_REDTAIL
Definition options.h:118
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
#define TEST_OPT_OLDSTD
Definition options.h:125
#define TEST_OPT_REDSB
Definition options.h:106
#define TEST_OPT_DEGBOUND
Definition options.h:115
#define TEST_OPT_SB_1
Definition options.h:121
#define TEST_OPT_PROT
Definition options.h:105
#define TEST_OPT_DEBUG
Definition options.h:110
#define TEST_OPT_CONTENTSB
Definition options.h:129
#define TEST_OPT_NOT_BUCKETS
Definition options.h:107
static int pLength(poly a)
Definition p_polys.h:190
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define pNeg(p)
Definition polys.h:199
#define pGetComp(p)
Component.
Definition polys.h:38
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition polys.h:71
void PrintS(const char *s)
Definition reporter.cc:288
void PrintLn()
Definition reporter.cc:314
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:520
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:774
#define rField_is_Ring(R)
Definition ring.h:491
ideal idInit(int idsize, int rank)
initialise an ideal / module
#define IDELEMS(i)
#define Q
Definition sirandom.c:26
#define loop
Definition structs.h:71

◆ bbaShift()

ideal bbaShift ( ideal F,
ideal Q,
intvec * w,
bigintmat * hilb,
kStrategy strat )

Definition at line 4577 of file kstd2.cc.

4578{
4579 int red_result = 1;
4580 int olddeg,reduc;
4581 int hilbeledeg=1,hilbcount=0,minimcnt=0;
4582 BOOLEAN withT = TRUE; // currently only T contains the shifts
4583 BITSET save;
4584 SI_SAVE_OPT1(save);
4585
4586 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
4588 initBuchMoraPosRing(strat);
4589 else
4590 initBuchMoraPos(strat);
4591 initHilbCrit(F,Q,&hilb,strat);
4592 initBba(strat);
4593 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
4594 /*Shdl=*/initBuchMora(F, Q,strat);
4595 if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
4596 reduc = olddeg = 0;
4597
4598#ifndef NO_BUCKETS
4600 strat->use_buckets = 1;
4601#endif
4602 // redtailBBa against T for inhomogeneous input
4603 // if (!TEST_OPT_OLDSTD)
4604 // withT = ! strat->homog;
4605
4606 // strat->posInT = posInT_pLength;
4607 kTest_TS(strat);
4608
4609#ifdef HAVE_TAIL_RING
4610 // if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
4611 // kStratInitChangeTailRing(strat);
4612 strat->tailRing=currRing;
4613#endif
4614
4615#ifdef KDEBUG
4616 //kDebugPrint(strat);
4617#endif
4618 /* compute------------------------------------------------------- */
4619 while (strat->Ll >= 0)
4620 {
4621 #ifdef KDEBUG
4622 if (TEST_OPT_DEBUG) messageSets(strat);
4623 #endif
4624 if (siCntrlc)
4625 {
4626 while (strat->Ll >= 0)
4627 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
4628 strat->noClearS=TRUE;
4629 }
4631 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4632 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
4633 {
4634 /*
4635 *stops computation if
4636 * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
4637 *a predefined number Kstd1_deg
4638 */
4639 while ((strat->Ll >= 0)
4640 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
4641 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
4642 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
4643 )
4644 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
4645 if (strat->Ll<0) break;
4646 else strat->noClearS=TRUE;
4647 }
4648 if (strat->Ll== 0) strat->interpt=TRUE;
4649 /* picks the last element from the lazyset L */
4650 strat->P = strat->L[strat->Ll];
4651 strat->Ll--;
4652
4653 if (pNext(strat->P.p) == strat->tail)
4654 {
4655 // deletes the short spoly
4657 pLmDelete(strat->P.p);
4658 else
4659 pLmFree(strat->P.p);
4660 strat->P.p = NULL;
4661 poly m1 = NULL, m2 = NULL;
4662
4663 // check that spoly creation is ok
4664 while (strat->tailRing != currRing &&
4665 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
4666 {
4667 assume(m1 == NULL && m2 == NULL);
4668 // if not, change to a ring where exponents are at least
4669 // large enough
4670 if (!kStratChangeTailRing(strat))
4671 {
4672 WerrorS("OVERFLOW...");
4673 break;
4674 }
4675 }
4676 // create the real one
4677 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
4678 strat->tailRing, m1, m2, strat->R);
4679 }
4680 else if (strat->P.p1 == NULL)
4681 {
4682 if (strat->minim > 0)
4683 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
4684 // for input polys, prepare reduction
4685 strat->P.PrepareRed(strat->use_buckets);
4686 }
4687
4688 if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
4689 {
4690 red_result = 0;
4691 }
4692 else
4693 {
4694 if (TEST_OPT_PROT)
4695 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
4696 &olddeg,&reduc,strat, red_result);
4697
4698 /* reduction of the element chosen from L */
4699 red_result = strat->red(&strat->P,strat);
4700 if (errorreported) break;
4701 }
4702
4703 if (strat->overflow)
4704 {
4705 if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
4706 }
4707
4708 // reduction to non-zero new poly
4709 if (red_result == 1)
4710 {
4711 // get the polynomial (canonicalize bucket, make sure P.p is set)
4712 strat->P.GetP(strat->lmBin);
4713 // in the homogeneous case FDeg >= pFDeg (sugar/honey)
4714 // but now, for entering S, T, we reset it
4715 // in the inhomogeneous case: FDeg == pFDeg
4716 if (strat->homog) strat->initEcart(&(strat->P));
4717
4718 /* statistic */
4719 if (TEST_OPT_PROT) PrintS("s");
4720
4721 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4722
4723 // reduce the tail and normalize poly
4724 // in the ring case we cannot expect LC(f) = 1,
4725 strat->redTailChange=FALSE;
4726
4727 /* if we are computing over Z we always want to try and cut down
4728 * the coefficients in the tail terms */
4730 {
4731 redtailBbaAlsoLC_Z(&(strat->P), strat->tl, strat);
4732 }
4733
4735 {
4736 strat->P.pCleardenom();
4738 {
4739 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
4740 strat->P.pCleardenom();
4741 if (strat->redTailChange)
4742 {
4743 strat->P.t_p=NULL;
4744 strat->initEcart(&(strat->P)); // somehow we need this here with letterplace
4745 }
4746 }
4747 }
4748 else
4749 {
4750 strat->P.pNorm();
4752 {
4753 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4754 if (strat->redTailChange)
4755 {
4756 strat->P.t_p=NULL;
4757 strat->initEcart(&(strat->P)); // somehow we need this here with letterplace
4758 }
4759 }
4760 }
4761
4762#ifdef KDEBUG
4763 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4764#endif /* KDEBUG */
4765
4766 // min_std stuff
4767 if ((strat->P.p1==NULL) && (strat->minim>0))
4768 {
4769 if (strat->minim==1)
4770 {
4771 strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4772 p_Delete(&strat->P.p2, currRing, strat->tailRing);
4773 }
4774 else
4775 {
4776 strat->M->m[minimcnt]=strat->P.p2;
4777 strat->P.p2=NULL;
4778 }
4779 if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4780 pNext(strat->M->m[minimcnt])
4781 = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4782 strat->tailRing, currRing,
4783 currRing->PolyBin);
4784 minimcnt++;
4785 }
4786
4787
4788 // enter into S, L, and T
4789 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4790 {
4791 enterT(&strat->P, strat);
4792 enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
4793 // posInS only depends on the leading term
4794 strat->enterS(&strat->P, pos, strat, strat->tl);
4795 if (!strat->rightGB)
4796 enterTShift(&strat->P, strat);
4797 }
4798
4799 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4800// Print("[%d]",hilbeledeg);
4801 kDeleteLcm(&strat->P);
4802 if (strat->s_poly!=NULL)
4803 {
4804 // the only valid entries are: strat->P.p,
4805 // strat->tailRing (read-only, keep it)
4806 // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
4807 if (strat->s_poly(strat))
4808 {
4809 // we are called AFTER enterS, i.e. if we change P
4810 // we have to add it also to S/T
4811 // and add pairs
4812 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4813 enterT(&strat->P, strat);
4814 enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
4815 strat->enterS(&strat->P, pos, strat, strat->tl);
4816 if (!strat->rightGB)
4817 enterTShift(&strat->P,strat);
4818 }
4819 }
4820 }
4821 else if (strat->P.p1 == NULL && strat->minim > 0)
4822 {
4823 p_Delete(&strat->P.p2, currRing, strat->tailRing);
4824 }
4825#ifdef KDEBUG
4826 strat->P.Init();
4827#endif /* KDEBUG */
4828 kTest_TS(strat);
4829 }
4830#ifdef KDEBUG
4831 if (TEST_OPT_DEBUG) messageSets(strat);
4832#endif /* KDEBUG */
4833 /* shift case: look for elt's in S such that they are divisible by elt in T */
4834 if ((TEST_OPT_SB_1 || TEST_OPT_REDSB) && !strat->noClearS) // when is OPT_SB_1 set?
4835 {
4837 {
4838 for (int k = 0; k <= strat->sl; ++k)
4839 {
4840 if ((strat->fromQ!=NULL) && (strat->fromQ[k])) continue; // do not reduce Q_k
4841 for (int j = 0; j<=strat->tl; ++j)
4842 {
4843 if (strat->T[j].p!=NULL)
4844 {
4845 // this is like clearS in bba, but we reduce with elements from T, because it contains the shifts too
4846 assume(strat->sevT[j] == pGetShortExpVector(strat->T[j].p));
4847 assume(strat->sevS[k] == pGetShortExpVector(strat->S[k]));
4848 if (pLmShortDivisibleBy(strat->T[j].p, strat->sevT[j], strat->S[k], ~strat->sevS[k]))
4849 {
4850 if (pLmCmp(strat->T[j].p, strat->S[k]) != 0)
4851 { // check whether LM is different
4852 deleteInS(k, strat);
4853 --k;
4854 break;
4855 }
4856 }
4857 }
4858 }
4859 }
4860 }
4861 }
4862 /* complete reduction of the standard basis--------- */
4863 if (TEST_OPT_REDSB)
4864 {
4865 completeReduce(strat, TRUE); //shift: withT = TRUE
4866 if (strat->completeReduce_retry)
4867 {
4868 // completeReduce needed larger exponents, retry
4869 // to reduce with S (instead of T)
4870 // and in currRing (instead of strat->tailRing)
4871#ifdef HAVE_TAIL_RING
4872 if(currRing->bitmask>strat->tailRing->bitmask)
4873 {
4875 cleanT(strat);strat->tailRing=currRing;
4876 int i;
4877 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
4878 WarnS("reduction with S is not yet supported by Letterplace"); // if this ever happens, we'll know
4879 completeReduce(strat);
4880 }
4881 if (strat->completeReduce_retry)
4882#endif
4883 Werror("exponent bound is %ld",currRing->bitmask);
4884 }
4885 }
4886 else if (TEST_OPT_PROT) PrintLn();
4887
4888 /* release temp data-------------------------------- */
4889 exitBuchMora(strat);
4890 /* postprocessing for GB over ZZ --------------------*/
4891 if (!errorreported)
4892 {
4894 {
4895 for(int i = 0;i<=strat->sl;i++)
4896 {
4897 if(!nGreaterZero(pGetCoeff(strat->S[i])))
4898 {
4899 strat->S[i] = pNeg(strat->S[i]);
4900 }
4901 }
4902 finalReduceByMon(strat);
4903 for(int i = 0;i<IDELEMS(strat->Shdl);i++)
4904 {
4905 if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
4906 {
4907 strat->S[i] = pNeg(strat->Shdl->m[i]);
4908 }
4909 }
4910 }
4911 //else if (rField_is_Ring(currRing))
4912 // finalReduceByMon(strat);
4913 }
4914// if (TEST_OPT_WEIGHTM)
4915// {
4916// pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
4917// if (ecartWeights)
4918// {
4919// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
4920// ecartWeights=NULL;
4921// }
4922// }
4923 if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
4924 SI_RESTORE_OPT1(save);
4925 /* postprocessing for GB over Q-rings ------------------*/
4926 if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
4927
4928 idTest(strat->Shdl);
4929
4930 return (strat->Shdl);
4931}
TSet T
Definition kutil.h:325
char rightGB
Definition kutil.h:366
unsigned long * sevT
Definition kutil.h:324
intset fromQ
Definition kutil.h:320
#define WarnS
Definition emacs.cc:78
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:12927
void enterTShift(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:12957
void deleteInS(int i, kStrategy strat)
Definition kutil.cc:1132
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition polys.h:147
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:153
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition polys.h:106

◆ f5c()

void f5c ( kStrategy strat,
int & olddeg,
int & minimcnt,
int & hilbeledeg,
int & hilbcount,
int & srmax,
int & lrmax,
int & reduc,
ideal Q,
intvec * w,
bigintmat * hilb )

Definition at line 4265 of file kstd2.cc.

4268{
4269 int Ll_old, red_result = 1;
4270 int pos = 0;
4271 hilbeledeg=1;
4272 hilbcount=0;
4273 minimcnt=0;
4274 srmax = 0; // strat->sl is 0 at this point
4275 reduc = olddeg = lrmax = 0;
4276 // we cannot use strat->T anymore
4277 //cleanT(strat);
4278 //strat->tl = -1;
4279 Ll_old = strat->Ll;
4280 while (strat->tl >= 0)
4281 {
4282 if(!strat->T[strat->tl].is_redundant)
4283 {
4284 LObject h;
4285 h.p = strat->T[strat->tl].p;
4286 h.tailRing = strat->T[strat->tl].tailRing;
4287 h.t_p = strat->T[strat->tl].t_p;
4288 if (h.p!=NULL)
4289 {
4290 if (currRing->OrdSgn==-1)
4291 {
4292 cancelunit(&h);
4293 deleteHC(&h, strat);
4294 }
4295 if (h.p!=NULL)
4296 {
4298 {
4299 h.pCleardenom(); // also does remove Content
4300 }
4301 else
4302 {
4303 h.pNorm();
4304 }
4305 strat->initEcart(&h);
4307 pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
4308 else
4309 pos = strat->Ll+1;
4310 h.sev = pGetShortExpVector(h.p);
4311 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
4312 }
4313 }
4314 }
4315 strat->tl--;
4316 }
4317 strat->sl = -1;
4318#if 0
4319//#ifdef HAVE_TAIL_RING
4320 if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
4322#endif
4323 //enterpairs(pOne(),0,0,-1,strat,strat->tl);
4324 //strat->sl = -1;
4325 /* picks the last element from the lazyset L */
4326 while (strat->Ll>Ll_old)
4327 {
4328 strat->P = strat->L[strat->Ll];
4329 strat->Ll--;
4330//#if 1
4331#ifdef DEBUGF5
4332 PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
4333 PrintS("-------------------------------------------------\n");
4334 pWrite(pHead(strat->P.p));
4335 pWrite(pHead(strat->P.p1));
4336 pWrite(pHead(strat->P.p2));
4337 printf("%d\n",strat->tl);
4338 PrintS("-------------------------------------------------\n");
4339#endif
4340 if (pNext(strat->P.p) == strat->tail)
4341 {
4342 // deletes the short spoly
4344 pLmDelete(strat->P.p);
4345 else
4346 pLmFree(strat->P.p);
4347
4348 // TODO: needs some masking
4349 // TODO: masking needs to vanish once the signature
4350 // stuff is completely implemented
4351 strat->P.p = NULL;
4352 poly m1 = NULL, m2 = NULL;
4353
4354 // check that spoly creation is ok
4355 while (strat->tailRing != currRing &&
4356 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
4357 {
4358 assume(m1 == NULL && m2 == NULL);
4359 // if not, change to a ring where exponents are at least
4360 // large enough
4361 if (!kStratChangeTailRing(strat))
4362 {
4363 WerrorS("OVERFLOW...");
4364 break;
4365 }
4366 }
4367 // create the real one
4368 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
4369 strat->tailRing, m1, m2, strat->R);
4370 }
4371 else if (strat->P.p1 == NULL)
4372 {
4373 if (strat->minim > 0)
4374 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
4375 // for input polys, prepare reduction
4377 strat->P.PrepareRed(strat->use_buckets);
4378 }
4379
4380 if (strat->P.p == NULL && strat->P.t_p == NULL)
4381 {
4382 red_result = 0;
4383 }
4384 else
4385 {
4386 if (TEST_OPT_PROT)
4387 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
4388 &olddeg,&reduc,strat, red_result);
4389
4390#ifdef DEBUGF5
4391 PrintS("Poly before red: ");
4392 pWrite(strat->P.p);
4393#endif
4394 /* complete reduction of the element chosen from L */
4395 red_result = strat->red2(&strat->P,strat);
4396 if (errorreported) break;
4397 }
4398
4399 if (strat->overflow)
4400 {
4401 if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
4402 }
4403
4404 // reduction to non-zero new poly
4405 if (red_result == 1)
4406 {
4407 // get the polynomial (canonicalize bucket, make sure P.p is set)
4408 strat->P.GetP(strat->lmBin);
4409 // in the homogeneous case FDeg >= pFDeg (sugar/honey)
4410 // but now, for entering S, T, we reset it
4411 // in the inhomogeneous case: FDeg == pFDeg
4412 if (strat->homog) strat->initEcart(&(strat->P));
4413
4414 /* statistic */
4415 if (TEST_OPT_PROT) PrintS("s");
4416 int pos;
4417 #if 1
4419 pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4420 else
4421 pos = posInSMonFirst(strat,strat->sl,strat->P.p);
4422 #else
4423 pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
4424 #endif
4425 // reduce the tail and normalize poly
4426 // in the ring case we cannot expect LC(f) = 1,
4427#if F5CTAILRED
4428 BOOLEAN withT = TRUE;
4430 {
4431 strat->P.pCleardenom();
4433 {
4434 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4435 strat->P.pCleardenom();
4436 }
4437 }
4438 else
4439 {
4440 strat->P.pNorm();
4442 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
4443 }
4444#endif
4445#ifdef KDEBUG
4446 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
4447#endif /* KDEBUG */
4448
4449 // min_std stuff
4450 if ((strat->P.p1==NULL) && (strat->minim>0))
4451 {
4452 if (strat->minim==1)
4453 {
4454 strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
4455 p_Delete(&strat->P.p2, currRing, strat->tailRing);
4456 }
4457 else
4458 {
4459 strat->M->m[minimcnt]=strat->P.p2;
4460 strat->P.p2=NULL;
4461 }
4462 if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
4463 pNext(strat->M->m[minimcnt])
4464 = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
4465 strat->tailRing, currRing,
4466 currRing->PolyBin);
4467 minimcnt++;
4468 }
4469
4470 // enter into S, L, and T
4471 // here we need to recompute new signatures, but those are trivial ones
4472 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
4473 {
4474 enterT(&strat->P, strat);
4475 // posInS only depends on the leading term
4476 strat->enterS(&strat->P, pos, strat, strat->tl);
4477//#if 1
4478#ifdef DEBUGF5
4479 PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
4480 pWrite(pHead(strat->S[strat->sl]));
4481 pWrite(strat->sig[strat->sl]);
4482#endif
4483 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
4484 }
4485 // Print("[%d]",hilbeledeg);
4486 kDeleteLcm(&strat->P);
4487 if (strat->sl>srmax) srmax = strat->sl;
4488 }
4489 else
4490 {
4491 // adds signature of the zero reduction to
4492 // strat->syz. This is the leading term of
4493 // syzygy and can be used in syzCriterion()
4494 // the signature is added if and only if the
4495 // pair was not detected by the rewritten criterion in strat->red = redSig
4496 if (strat->P.p1 == NULL && strat->minim > 0)
4497 {
4498 p_Delete(&strat->P.p2, currRing, strat->tailRing);
4499 }
4500 }
4501
4502#ifdef KDEBUG
4503 strat->P.Init();
4504#endif /* KDEBUG */
4505 }
4506 int cc = 0;
4507 while (cc<strat->tl+1)
4508 {
4509 strat->T[cc].sig = pOne();
4510 p_SetComp(strat->T[cc].sig,cc+1,currRing);
4511 strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
4512 strat->sig[cc] = strat->T[cc].sig;
4513 strat->sevSig[cc] = strat->T[cc].sevSig;
4514 strat->T[cc].is_sigsafe = TRUE;
4515 cc++;
4516 }
4517 strat->max_lower_index = strat->tl;
4518 // set current signature index of upcoming iteration step
4519 // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
4520 // the corresponding syzygy rules correctly
4521 strat->currIdx = cc+1;
4522 for (int cd=strat->Ll; cd>=0; cd--)
4523 {
4524 p_SetComp(strat->L[cd].sig,cc+1,currRing);
4525 cc++;
4526 }
4527 for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
4528 strat->Shdl->m[cc] = NULL;
4529 #if 0
4530 printf("\nAfter f5c sorting\n");
4531 for(int i=0;i<=strat->sl;i++)
4532 pWrite(pHead(strat->S[i]));
4533 getchar();
4534 #endif
4535//#if 1
4536#if DEBUGF5
4537 PrintS("------------------- STRAT S ---------------------\n");
4538 cc = 0;
4539 while (cc<strat->tl+1)
4540 {
4541 pWrite(pHead(strat->S[cc]));
4542 pWrite(strat->sig[cc]);
4543 printf("- - - - - -\n");
4544 cc++;
4545 }
4546 PrintS("-------------------------------------------------\n");
4547 PrintS("------------------- STRAT T ---------------------\n");
4548 cc = 0;
4549 while (cc<strat->tl+1)
4550 {
4551 pWrite(pHead(strat->T[cc].p));
4552 pWrite(strat->T[cc].sig);
4553 printf("- - - - - -\n");
4554 cc++;
4555 }
4556 PrintS("-------------------------------------------------\n");
4557 PrintS("------------------- STRAT L ---------------------\n");
4558 cc = 0;
4559 while (cc<strat->Ll+1)
4560 {
4561 pWrite(pHead(strat->L[cc].p));
4562 pWrite(pHead(strat->L[cc].p1));
4563 pWrite(pHead(strat->L[cc].p2));
4564 pWrite(strat->L[cc].sig);
4565 printf("- - - - - -\n");
4566 cc++;
4567 }
4568 PrintS("-------------------------------------------------\n");
4569 printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
4570#endif
4571
4572}
CanonicalForm cd(bCommonDen(FF))
Definition cfModGcd.cc:4097
int currIdx
Definition kutil.h:316
int(* red2)(LObject *L, kStrategy strat)
Definition kutil.h:280
unsigned long * sevSig
Definition kutil.h:323
int max_lower_index
Definition kutil.h:317
polyset sig
Definition kutil.h:307
int Lmax
Definition kutil.h:350
STATIC_VAR Poly * h
Definition janet.cc:971
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition kutil.cc:1269
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
Definition kutil.cc:4764
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition kutil.cc:286
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5878
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:365
class sLObject LObject
Definition kutil.h:59
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
void pWrite(poly p)
Definition polys.h:309
#define pOne()
Definition polys.h:316

◆ ind_fact_2()

long ind_fact_2 ( long arg)
static

Definition at line 596 of file kstd2.cc.

597{
598 if (arg <= 0) return 0;
599 long ind = 0;
600 if (arg%2 == 1) { arg--; }
601 while (arg > 0)
602 {
603 ind += SI_LOG2_LONG(arg);
604 arg = arg - 2;
605 }
606 return ind;
607}
static int SI_LOG2_LONG(long v)
Definition si_log2.h:22

◆ kDebugPrint()

void kDebugPrint ( kStrategy strat)

Definition at line 11478 of file kutil.cc.

11479{
11480 printf("red: ");
11481 if (strat->red==redFirst) printf("redFirst\n");
11482 else if (strat->red==redHoney) printf("redHoney\n");
11483 else if (strat->red==redEcart) printf("redEcart\n");
11484 else if (strat->red==redHomog) printf("redHomog\n");
11485 else if (strat->red==redLazy) printf("redLazy\n");
11486 else if (strat->red==redLiftstd) printf("redLiftstd\n");
11487 else printf("%p\n",(void*)strat->red);
11488 printf("posInT: ");
11489 if (strat->posInT==posInT0) printf("posInT0\n");
11490 else if (strat->posInT==posInT1) printf("posInT1\n");
11491 else if (strat->posInT==posInT11) printf("posInT11\n");
11492 else if (strat->posInT==posInT110) printf("posInT110\n");
11493 else if (strat->posInT==posInT13) printf("posInT13\n");
11494 else if (strat->posInT==posInT15) printf("posInT15\n");
11495 else if (strat->posInT==posInT17) printf("posInT17\n");
11496 else if (strat->posInT==posInT17_c) printf("posInT17_c\n");
11497 else if (strat->posInT==posInT19) printf("posInT19\n");
11498 else if (strat->posInT==posInT2) printf("posInT2\n");
11499 else if (strat->posInT==posInT11Ring) printf("posInT11Ring\n");
11500 else if (strat->posInT==posInT110Ring) printf("posInT110Ring\n");
11501 else if (strat->posInT==posInT15Ring) printf("posInT15Ring\n");
11502 else if (strat->posInT==posInT17Ring) printf("posInT17Ring\n");
11503 else if (strat->posInT==posInT17_cRing) printf("posInT17_cRing\n");
11504#ifdef HAVE_MORE_POS_IN_T
11505 else if (strat->posInT==posInT_EcartFDegpLength) printf("posInT_EcartFDegpLength\n");
11506 else if (strat->posInT==posInT_FDegpLength) printf("posInT_FDegpLength\n");
11507 else if (strat->posInT==posInT_pLength) printf("posInT_pLength\n");
11508#endif
11509 else if (strat->posInT==posInT_EcartpLength) printf("posInT_EcartpLength\n");
11510 else printf("%p\n",(void*)strat->posInT);
11511 printf("posInL: ");
11512 if (strat->posInL==posInL0) printf("posInL0\n");
11513 else if (strat->posInL==posInL10) printf("posInL10\n");
11514 else if (strat->posInL==posInL11) printf("posInL11\n");
11515 else if (strat->posInL==posInL110) printf("posInL110\n");
11516 else if (strat->posInL==posInL13) printf("posInL13\n");
11517 else if (strat->posInL==posInL15) printf("posInL15\n");
11518 else if (strat->posInL==posInL17) printf("posInL17\n");
11519 else if (strat->posInL==posInL17_c) printf("posInL17_c\n");
11520 else if (strat->posInL==posInL0) printf("posInL0Ring\n");
11521 else if (strat->posInL==posInL11Ring) printf("posInL11Ring\n");
11522 else if (strat->posInL==posInL11Ringls) printf("posInL11Ringls\n");
11523 else if (strat->posInL==posInL110Ring) printf("posInL110Ring\n");
11524 else if (strat->posInL==posInL15Ring) printf("posInL15Ring\n");
11525 else if (strat->posInL==posInL17Ring) printf("posInL17Ring\n");
11526 else if (strat->posInL==posInL17_cRing) printf("posInL17_cRing\n");
11527 else if (strat->posInL==posInLSpecial) printf("posInLSpecial\n");
11528 else printf("%p\n",(void*)strat->posInL);
11529 printf("enterS: ");
11530 if (strat->enterS==enterSBba) printf("enterSBba\n");
11531 else if (strat->enterS==enterSMora) printf("enterSMora\n");
11532 else if (strat->enterS==enterSMoraNF) printf("enterSMoraNF\n");
11533 else printf("%p\n",(void*)strat->enterS);
11534 printf("initEcart: ");
11535 if (strat->initEcart==initEcartBBA) printf("initEcartBBA\n");
11536 else if (strat->initEcart==initEcartNormal) printf("initEcartNormal\n");
11537 else printf("%p\n",(void*)strat->initEcart);
11538 printf("initEcartPair: ");
11539 if (strat->initEcartPair==initEcartPairBba) printf("initEcartPairBba\n");
11540 else if (strat->initEcartPair==initEcartPairMora) printf("initEcartPairMora\n");
11541 else printf("%p\n",(void*)strat->initEcartPair);
11542 printf("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11543 strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11544 printf("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11545 strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11546 printf("chainCrit: ");
11547 if (strat->chainCrit==chainCritNormal) printf("chainCritNormal\n");
11548 else if (strat->chainCrit==chainCritOpt_1) printf("chainCritOpt_1\n");
11549 else printf("%p\n",(void*)strat->chainCrit);
11550 printf("posInLDependsOnLength=%d\n",
11551 strat->posInLDependsOnLength);
11552 printf("%s\n",showOption());
11553 printf("LDeg: ");
11554 if (currRing->pLDeg==pLDeg0) printf("pLDeg0");
11555 else if (currRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11556 else if (currRing->pLDeg==pLDegb) printf("pLDegb");
11557 else if (currRing->pLDeg==pLDeg1) printf("pLDeg1");
11558 else if (currRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11559 else if (currRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11560 else if (currRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11561 else if (currRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11562 else if (currRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11563 else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11564 else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11565 else if (currRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11566 else printf("? (%lx)", (long)currRing->pLDeg);
11567 printf(" / ");
11568 if (strat->tailRing->pLDeg==pLDeg0) printf("pLDeg0");
11569 else if (strat->tailRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11570 else if (strat->tailRing->pLDeg==pLDegb) printf("pLDegb");
11571 else if (strat->tailRing->pLDeg==pLDeg1) printf("pLDeg1");
11572 else if (strat->tailRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11573 else if (strat->tailRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11574 else if (strat->tailRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11575 else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11576 else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11577 else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11578 else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11579 else if (strat->tailRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11580 else printf("? (%lx)", (long)strat->tailRing->pLDeg);
11581 printf("\n");
11582 printf("currRing->pFDeg: ");
11583 if (currRing->pFDeg==p_Totaldegree) printf("p_Totaldegree");
11584 else if (currRing->pFDeg==p_WFirstTotalDegree) printf("pWFirstTotalDegree");
11585 else if (currRing->pFDeg==p_Deg) printf("p_Deg");
11586 else if (currRing->pFDeg==kHomModDeg) printf("kHomModDeg");
11587 else if (currRing->pFDeg==kModDeg) printf("kModDeg");
11588 else if (currRing->pFDeg==totaldegreeWecart) printf("totaldegreeWecart");
11589 else if (currRing->pFDeg==p_WTotaldegree) printf("p_WTotaldegree");
11590 else printf("? (%lx)", (long)currRing->pFDeg);
11591 printf("\n");
11592 printf(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11594 printf(" degBound: %d\n", Kstd1_deg);
11595
11596 if( ecartWeights != NULL )
11597 {
11598 printf("ecartWeights: ");
11599 for (int i = rVar(currRing); i > 0; i--)
11600 printf("%hd ", ecartWeights[i]);
11601 printf("\n");
11603 }
11604
11605#ifndef SING_NDEBUG
11607#endif
11608}
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:290
char noTailReduction
Definition kutil.h:375
int ak
Definition kutil.h:352
char sugarCrit
Definition kutil.h:374
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:283
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:286
char Gebauer
Definition kutil.h:375
int LazyPass
Definition kutil.h:352
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:282
int LazyDegree
Definition kutil.h:352
char posInLDependsOnLength
Definition kutil.h:386
int redLiftstd(LObject *h, kStrategy strat)
Definition kLiftstd.cc:167
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2421
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:794
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2411
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:168
void enterSMora(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1629
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1360
void enterSMoraNF(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1682
int redHoney(LObject *h, kStrategy strat)
Definition kstd2.cc:2110
int redHomog(LObject *h, kStrategy strat)
Definition kstd2.cc:1150
int redLazy(LObject *h, kStrategy strat)
Definition kstd2.cc:1905
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6299
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6412
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6058
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5278
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5844
int posInT11(const TSet set, const int length, LObject &p)
Definition kutil.cc:4953
int posInT1(const TSet set, const int length, LObject &p)
Definition kutil.cc:4896
void enterSBba(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8792
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5071
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:5146
int posInT0(const TSet, const int length, LObject &)
Definition kutil.cc:4885
int posInT2(const TSet set, const int length, LObject &p)
Definition kutil.cc:4925
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6145
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6099
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11449
int posInT13(const TSet set, const int length, LObject &p)
Definition kutil.cc:5117
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1315
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5611
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3445
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:4989
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6180
int posInT17_c(const TSet set, const int length, LObject &p)
Definition kutil.cc:5384
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11358
int posInT15(const TSet set, const int length, LObject &p)
Definition kutil.cc:5184
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5567
void initEcartNormal(TObject *h)
Definition kutil.cc:1293
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5912
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6255
int posInT110(const TSet set, const int length, LObject &p)
Definition kutil.cc:5029
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6215
int posInT19(const TSet set, const int length, LObject &p)
Definition kutil.cc:5510
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5238
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5339
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition kutil.cc:5445
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6348
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11412
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3204
void initEcartBBA(TObject *h)
Definition kutil.cc:1301
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5802
char * showOption()
Definition misc_ip.cc:713
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition kutil.cc:1308
#define TEST_OPT_WEIGHTM
Definition options.h:123
long pLDegb(poly p, int *l, const ring r)
Definition p_polys.cc:812
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition p_polys.cc:976
long p_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:595
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition p_polys.cc:1039
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition p_polys.cc:1069
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition p_polys.cc:942
long pLDeg1(poly p, int *l, const ring r)
Definition p_polys.cc:842
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition p_polys.cc:911
long p_WTotaldegree(poly p, const ring r)
Definition p_polys.cc:612
long pLDeg1c(poly p, int *l, const ring r)
Definition p_polys.cc:878
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition p_polys.cc:1006
long pLDeg0c(poly p, int *l, const ring r)
Definition p_polys.cc:771
long pLDeg0(poly p, int *l, const ring r)
Definition p_polys.cc:740
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1528
void rDebugPrint(const ring r)
Definition ring.cc:4214
static int rGetCurrSyzLimit(const ring r)
Definition ring.h:734
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition ring.h:731
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:603
long totaldegreeWecart(poly p, ring r)
Definition weight.cc:217
long maxdegreeWecart(poly p, int *l, ring r)
Definition weight.cc:247
EXTERN_VAR short * ecartWeights
Definition weight.h:12

◆ kFindDivisibleByInS()

int kFindDivisibleByInS ( const kStrategy strat,
int * max_ind,
LObject * L )

return -1 if no divisor is found number of first divisor in S, otherwise

Definition at line 464 of file kstd2.cc.

465{
466 unsigned long not_sev = ~L->sev;
467 poly p = L->GetLmCurrRing();
468 int j = 0;
469
470 pAssume(~not_sev == p_GetShortExpVector(p, currRing));
471
473#if 1
474 int ende;
475 if (is_Ring
476 || (strat->ak>0)
477 || currRing->pLexOrder)
478 ende=strat->sl;
479 else
480 {
481 ende=posInS(strat,*max_ind,p,0)+1;
482 if (ende>(*max_ind)) ende=(*max_ind);
483 }
484#else
485 int ende=strat->sl;
486#endif
487 if(is_Ring)
488 {
489 loop
490 {
491 if (j > ende) return -1;
492#if defined(PDEBUG) || defined(PDIV_DEBUG)
493 if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
494 p, not_sev, currRing))
495#else
496 if ( !(strat->sevS[j] & not_sev) &&
497 p_LmDivisibleBy(strat->S[j], p, currRing))
498#endif
499 {
500 if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
501 return j;
502 }
503 j++;
504 }
505 }
506 else
507 {
508 loop
509 {
510 if (j > ende) return -1;
511#if defined(PDEBUG) || defined(PDIV_DEBUG)
512 if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
513 p, not_sev, currRing))
514#else
515 if ( !(strat->sevS[j] & not_sev) &&
516 p_LmDivisibleBy(strat->S[j], p, currRing))
517#endif
518 {
519 return j;
520 }
521 j++;
522 }
523 }
524}
int p
Definition cfModGcd.cc:4086
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition coeffs.h:747
#define pAssume(cond)
Definition monomials.h:90
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition p_polys.cc:4947
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition p_polys.h:1931
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1912

◆ kFindDivisibleByInS_noCF()

int kFindDivisibleByInS_noCF ( const kStrategy strat,
int * max_ind,
LObject * L )

Definition at line 527 of file kstd2.cc.

528{
529 unsigned long not_sev = ~L->sev;
530 poly p = L->GetLmCurrRing();
531 int j = 0;
532
533 pAssume(~not_sev == p_GetShortExpVector(p, currRing));
534
536#if 1
537 int ende;
538 if (is_Ring
539 || (strat->ak>0)
540 || currRing->pLexOrder)
541 ende=strat->sl;
542 else
543 {
544 ende=posInS(strat,*max_ind,p,0)+1;
545 if (ende>(*max_ind)) ende=(*max_ind);
546 }
547#else
548 int ende=strat->sl;
549#endif
550 loop
551 {
552 if (j > ende) return -1;
553#if defined(PDEBUG) || defined(PDIV_DEBUG)
554 if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
555 p, not_sev, currRing))
556#else
557 if ( !(strat->sevS[j] & not_sev) &&
558 p_LmDivisibleBy(strat->S[j], p, currRing))
559#endif
560 {
561 return j;
562 }
563 j++;
564 }
565}

◆ kFindDivisibleByInS_Z()

int kFindDivisibleByInS_Z ( const kStrategy strat,
LObject * L )
static

Definition at line 272 of file kstd2.cc.

273{
274 unsigned long not_sev = ~L->sev;
275 int j = 0;
276 int o = -1;
277
278 const polyset S=strat->S;
279 const unsigned long* sevS=strat->sevS;
280 number rest, orest, mult;
281 L->GetP();
282 if (L->p!=NULL)
283 {
284 const ring r=currRing;
285 const poly p=L->p;
286 orest = pGetCoeff(p);
287
288 pAssume(~not_sev == p_GetShortExpVector(p, r));
289
290 loop
291 {
292 if (j > strat->sl) return o;
293#if defined(PDEBUG) || defined(PDIV_DEBUG)
294 if (p_LmShortDivisibleBy(S[j], sevS[j],p, not_sev, r))
295#else
296 if (!(sevS[j] & not_sev) && p_LmDivisibleBy(S[j], p, r))
297#endif
298 {
299 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(S[j]), &rest, r->cf);
300 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
301 {
302 o = j;
303 orest = rest;
304 }
305 }
306 j++;
307 }
308 }
309 else
310 {
311 return -1;
312 }
313}
static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
Definition coeffs.h:678
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition coeffs.h:684
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition coeffs.h:517
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:647
poly * polyset
Definition polys.h:260

◆ kFindDivisibleByInT()

int kFindDivisibleByInT ( const kStrategy strat,
const LObject * L,
const int start )

return -1 if no divisor is found number of first divisor in T, otherwise

Definition at line 317 of file kstd2.cc.

318{
319 unsigned long not_sev = ~L->sev;
320 int j = start;
321
322 const TSet T=strat->T;
323 const unsigned long* sevT=strat->sevT;
324 const ring r=currRing;
325 const BOOLEAN is_Ring=rField_is_Ring(r);
326 if (L->p!=NULL)
327 {
328 const poly p=L->p;
329
330 pAssume(~not_sev == p_GetShortExpVector(p, r));
331
332 if(is_Ring)
333 {
334 loop
335 {
336 if (j > strat->tl) return -1;
337#if defined(PDEBUG) || defined(PDIV_DEBUG)
338 if ((T[j].p!=NULL)
339 && p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
340#else
341 if (!(sevT[j] & not_sev)
342 && (T[j].p!=NULL)
343 && p_LmDivisibleBy(T[j].p, p, r))
344#endif
345 {
346 if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
347 return j;
348 }
349 j++;
350 }
351 }
352 else
353 {
354 loop
355 {
356 if (j > strat->tl) return -1;
357#if defined(PDEBUG) || defined(PDIV_DEBUG)
358 if ((T[j].p!=NULL)
359 && p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
360#else
361 if (!(sevT[j] & not_sev)
362 && (T[j].p!=NULL)
363 && p_LmDivisibleBy(T[j].p, p, r))
364#endif
365 {
366 return j;
367 }
368 j++;
369 }
370 }
371 }
372 else
373 {
374 const poly p=L->t_p;
375 const ring r=strat->tailRing;
376 if(is_Ring)
377 {
378 loop
379 {
380 if (j > strat->tl) return -1;
381#if defined(PDEBUG) || defined(PDIV_DEBUG)
382 if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
383 p, not_sev, r))
384#else
385 if (!(sevT[j] & not_sev) &&
386 p_LmDivisibleBy(T[j].t_p, p, r))
387#endif
388 {
389 if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
390 return j;
391 }
392 j++;
393 }
394 }
395 else
396 {
397 loop
398 {
399 if (j > strat->tl) return -1;
400#if defined(PDEBUG) || defined(PDIV_DEBUG)
401 if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
402 p, not_sev, r))
403#else
404 if (!(sevT[j] & not_sev) &&
405 p_LmDivisibleBy(T[j].t_p, p, r))
406#endif
407 {
408 return j;
409 }
410 j++;
411 }
412 }
413 }
414}
STATIC_VAR jList * T
Definition janet.cc:30
TObject * TSet
Definition kutil.h:60

◆ kFindDivisibleByInT_ecart()

int kFindDivisibleByInT_ecart ( const kStrategy strat,
const LObject * L,
const int ecart )

Definition at line 416 of file kstd2.cc.

417{
418 if (TEST_OPT_LENGTH)
419 {
420 int r=-1; // found, but bad ecart
421 int j=-2; // found, good ecart
422 int jj=-1; // current search
423 loop
424 {
425 jj=kFindDivisibleByInT(strat,L,jj+1);
426 if (jj== -1)
427 {
428 if (j<0) return r; // nothing with good ecart
429 else return j; // end of search, return best found
430 }
431 else if (r<0) r=jj; // save bad ecart found
432 if (strat->T[jj].ecart<=ecart) // good enough
433 {
434 if (strat->T[jj].pLength<=0)
435 strat->T[jj].pLength=strat->T[jj].GetpLength();
436 if (j== -2) j=jj; // first found
437 else if (strat->T[j].pLength > strat->T[jj].pLength) // jj better then j
438 j=jj;
439 if (strat->T[j].pLength<=2) return j; // length already minimal
440 }
441 }
442 }
443 else
444 {
445 int r=-1;
446 int jj=-1;
447 loop
448 {
449 jj=kFindDivisibleByInT(strat,L,jj+1);
450 if (jj== -1)
451 {
452 return r; // nothing found
453 }
454 else if (r== -1) r=jj;
455 if (strat->T[jj].ecart<=ecart) // good enough
456 {
457 return jj;
458 }
459 }
460 }
461}
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition kstd2.cc:317
#define TEST_OPT_LENGTH
Definition options.h:132

◆ kFindDivisibleByInT_Z()

int kFindDivisibleByInT_Z ( const kStrategy strat,
const LObject * L,
const int start )

Definition at line 209 of file kstd2.cc.

210{
211 unsigned long not_sev = ~L->sev;
212 int j = start;
213 int o = -1;
214
215 const TSet T=strat->T;
216 const unsigned long* sevT=strat->sevT;
217 number rest, orest, mult;
218 if (L->p!=NULL)
219 {
220 const ring r=currRing;
221 const poly p=L->p;
222 orest = pGetCoeff(p);
223
224 pAssume(~not_sev == p_GetShortExpVector(p, r));
225
226 loop
227 {
228 if (j > strat->tl) return o;
229#if defined(PDEBUG) || defined(PDIV_DEBUG)
230 if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
231#else
232 if (!(sevT[j] & not_sev) && p_LmDivisibleBy(T[j].p, p, r))
233#endif
234 {
235 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].p), &rest, r->cf);
236 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
237 {
238 o = j;
239 orest = rest;
240 }
241 }
242 j++;
243 }
244 }
245 else
246 {
247 const ring r=strat->tailRing;
248 const poly p=L->t_p;
249 orest = pGetCoeff(p);
250 loop
251 {
252 if (j > strat->tl) return o;
253#if defined(PDEBUG) || defined(PDIV_DEBUG)
254 if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
255 p, not_sev, r))
256#else
257 if (!(sevT[j] & not_sev) && p_LmDivisibleBy(T[j].t_p, p, r))
258#endif
259 {
260 mult = n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].t_p), &rest, r->cf);
261 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
262 {
263 o = j;
264 orest = rest;
265 }
266 }
267 j++;
268 }
269 }
270}

◆ kFindNextDivisibleByInS()

int kFindNextDivisibleByInS ( const kStrategy strat,
int start,
int max_ind,
LObject * L )

Definition at line 567 of file kstd2.cc.

568{
569 unsigned long not_sev = ~L->sev;
570 poly p = L->GetLmCurrRing();
571 int j = start;
572
573 pAssume(~not_sev == p_GetShortExpVector(p, currRing));
574#if 1
575 int ende=max_ind;
576#else
577 int ende=strat->sl;
578#endif
579 loop
580 {
581 if (j > ende) return -1;
582#if defined(PDEBUG) || defined(PDIV_DEBUG)
583 if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
584 p, not_sev, currRing))
585#else
586 if ( !(strat->sevS[j] & not_sev) &&
587 p_LmDivisibleBy(strat->S[j], p, currRing))
588#endif
589 {
590 return j;
591 }
592 j++;
593 }
594}

◆ kFindZeroPoly()

poly kFindZeroPoly ( poly input_p,
ring leadRing,
ring tailRing )

Definition at line 609 of file kstd2.cc.

610{
611 // m = currRing->ch
612
613 if (input_p == NULL) return NULL;
614
615 poly p = input_p;
616 poly zeroPoly = NULL;
617 unsigned long a = (unsigned long) pGetCoeff(p);
618
619 int k_ind2 = 0;
620 int a_ind2 = SI_LOG2_LONG(a);
621
622 // unsigned long k = 1;
623 // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
624 for (int i = 1; i <= leadRing->N; i++)
625 {
626 k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
627 }
628
629 a = (unsigned long) pGetCoeff(p);
630
631 number tmp1;
632 poly tmp2, tmp3;
633 poly lead_mult = p_ISet(1, tailRing);
634 if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
635 {
636 int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
637 int s_exp;
638 zeroPoly = p_ISet(a, tailRing);
639 for (int i = 1; i <= leadRing->N; i++)
640 {
641 s_exp = p_GetExp(p, i,leadRing);
642 if (s_exp % 2 != 0)
643 {
644 s_exp = s_exp - 1;
645 }
646 while ( (0 < SI_LOG2_LONG(s_exp)) && (SI_LOG2_LONG(s_exp) <= too_much) )
647 {
648 too_much = too_much - SI_LOG2_LONG(s_exp);
649 s_exp = s_exp - 2;
650 }
651 p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
652 for (int j = 1; j <= s_exp; j++)
653 {
654 tmp1 = nInit(j);
655 tmp2 = p_ISet(1, tailRing);
656 p_SetExp(tmp2, i, 1, tailRing);
657 p_Setm(tmp2, tailRing);
658 if (nIsZero(tmp1))
659 { // should nowbe obsolet, test ! TODO OLIVER
660 zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
661 }
662 else
663 {
664 tmp3 = p_NSet(nCopy(tmp1), tailRing);
665 zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
666 }
667 }
668 }
669 p_Setm(lead_mult, tailRing);
670 zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
671 tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
672 for (int i = 1; i <= leadRing->N; i++)
673 {
674 pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
675 }
676 p_Setm(tmp2, leadRing);
677 zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
678 pNext(tmp2) = zeroPoly;
679 return tmp2;
680 }
681/* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
682 if (1 == 0 && alpha_k <= a)
683 { // Temporarily disabled, reducing coefficients not compatible with std TODO Oliver
684 zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
685 for (int i = 1; i <= leadRing->N; i++)
686 {
687 for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
688 {
689 tmp1 = nInit(j);
690 tmp2 = p_ISet(1, tailRing);
691 p_SetExp(tmp2, i, 1, tailRing);
692 p_Setm(tmp2, tailRing);
693 if (nIsZero(tmp1))
694 {
695 zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
696 }
697 else
698 {
699 tmp3 = p_ISet((unsigned long) tmp1, tailRing);
700 zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
701 }
702 }
703 }
704 tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
705 for (int i = 1; i <= leadRing->N; i++)
706 {
707 pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
708 }
709 p_Setm(tmp2, leadRing);
710 zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
711 pNext(tmp2) = zeroPoly;
712 return tmp2;
713 } */
714 return NULL;
715}
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:450
CFList tmp1
Definition facFqBivar.cc:75
CFList tmp2
Definition facFqBivar.cc:75
static long ind_fact_2(long arg)
Definition kstd2.cc:596
#define nIsZero(n)
Definition numbers.h:19
#define nCopy(n)
Definition numbers.h:15
#define nInit(i)
Definition numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition p_polys.cc:1474
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:471
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1053
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:757
#define pSetExp(p, i, v)
Definition polys.h:43

◆ kNF2() [1/2]

ideal kNF2 ( ideal F,
ideal Q,
ideal q,
kStrategy strat,
int lazyReduce )

Definition at line 4090 of file kstd2.cc.

4091{
4092 assume(!idIs0(q));
4093 assume(!(idIs0(F)&&(Q==NULL)));
4094// lazy_reduce flags: can be combined by |
4095//#define KSTD_NF_LAZY 1
4096 // do only a reduction of the leading term
4097//#define KSTD_NF_NONORM 4
4098 // only global: avoid normalization, return a multiply of NF
4099 poly p;
4100 int i;
4101 ideal res;
4102 int max_ind;
4103
4104 //if (idIs0(q))
4105 // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
4106 //if ((idIs0(F))&&(Q==NULL))
4107 // return idCopy(q); /*F=0*/
4108 //strat->ak = idRankFreeModule(F);
4109 /*- creating temp data structures------------------- -*/
4110 BITSET save1;
4111 SI_SAVE_OPT1(save1);
4113 initBuchMoraCrit(strat);
4114 strat->initEcart = initEcartBBA;
4115#ifdef HAVE_SHIFTBBA
4116 if (rIsLPRing(currRing))
4117 {
4118 strat->enterS = enterSBbaShift;
4119 }
4120 else
4121#endif
4122 {
4123 strat->enterS = enterSBba;
4124 }
4125 /*- set S -*/
4126 strat->sl = -1;
4127#ifndef NO_BUCKETS
4129#endif
4130 /*- init local data struct.---------------------------------------- -*/
4131 /*Shdl=*/initS(F,Q,strat);
4132 /*- compute------------------------------------------------------- -*/
4133 res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
4134 for (i=IDELEMS(q)-1; i>=0; i--)
4135 {
4136 if (q->m[i]!=NULL)
4137 {
4138 if (TEST_OPT_PROT) { PrintS("r");mflush(); }
4139 p = redNF(pCopy(q->m[i]),max_ind,
4140 (lazyReduce & KSTD_NF_NONORM)==KSTD_NF_NONORM,strat);
4141 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
4142 {
4143 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4145 {
4146 p = redtailBba_NF(p,strat);
4147 }
4148 else
4149 {
4151 p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
4152 }
4153 }
4154 res->m[i]=p;
4155 }
4156 //else
4157 // res->m[i]=NULL;
4158 }
4159 /*- release temp data------------------------------- -*/
4160 assume(strat->L==NULL); /* strat->L unused */
4161 assume(strat->B==NULL); /* strat->B unused */
4162 omFree(strat->sevS);
4163 omFree(strat->ecartS);
4164 assume(strat->T==NULL);//omfree(strat->T);
4165 assume(strat->sevT==NULL);//omfree(strat->sevT);
4166 assume(strat->R==NULL);//omfree(strat->R);
4167 omfree(strat->S_2_R);
4168 omfree(strat->fromQ);
4169 strat->fromQ=NULL;
4170 idDelete(&strat->Shdl);
4171 SI_RESTORE_OPT1(save1);
4172 if (TEST_OPT_PROT) PrintLn();
4173 return res;
4174}
static int si_max(const int a, const int b)
Definition auxiliary.h:125
intset ecartS
Definition kutil.h:308
LSet B
Definition kutil.h:327
CanonicalForm res
Definition facAbsFact.cc:60
#define idDelete(H)
delete an ideal
Definition ideals.h:29
#define KSTD_NF_LAZY
Definition kstd1.h:18
#define KSTD_NF_NONORM
Definition kstd1.h:22
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition kstd2.cc:2307
void enterSBbaShift(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8892
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7586
poly redtailBba_NF(poly p, kStrategy strat)
Definition kutil.cc:7350
#define omfree(addr)
#define omFree(addr)
VAR unsigned si_opt_1
Definition options.c:5
#define OPT_INTSTRATEGY
Definition options.h:93
#define OPT_REDTAIL
Definition options.h:92
#define Sy_bit(x)
Definition options.h:31
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
#define mflush()
Definition reporter.h:58
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417

◆ kNF2() [2/2]

poly kNF2 ( ideal F,
ideal Q,
poly q,
kStrategy strat,
int lazyReduce )

Definition at line 3927 of file kstd2.cc.

3928{
3929 assume(q!=NULL);
3930 assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3931
3932// lazy_reduce flags: can be combined by |
3933//#define KSTD_NF_LAZY 1
3934 // do only a reduction of the leading term
3935//#define KSTD_NF_NONORM 4
3936 // only global: avoid normalization, return a multiply of NF
3937//#define KSTD_NF_CANCELUNIT 8
3938 // apply cancelunit to f inf NF(f,I)
3939//#define KSTD_NF_NOLF 4096
3940 // avoid PrintLn with OPT_PROT
3941
3942 poly p;
3943
3944 //if ((idIs0(F))&&(Q==NULL))
3945 // return pCopy(q); /*F=0*/
3946 //strat->ak = idRankFreeModule(F);
3947 /*- creating temp data structures------------------- -*/
3948 BITSET save1;
3949 SI_SAVE_OPT1(save1);
3951 initBuchMoraCrit(strat);
3952 strat->initEcart = initEcartBBA;
3953#ifdef HAVE_SHIFTBBA
3954 if (rIsLPRing(currRing))
3955 {
3956 strat->enterS = enterSBbaShift;
3957 }
3958 else
3959#endif
3960 {
3961 strat->enterS = enterSBba;
3962 }
3963#ifndef NO_BUCKETS
3965#endif
3966 /*- set S -*/
3967 strat->sl = -1;
3968 /*- init local data struct.---------------------------------------- -*/
3969 /*Shdl=*/initS(F,Q,strat);
3970 /*- compute------------------------------------------------------- -*/
3971 //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3972 //{
3973 // for (i=strat->sl;i>=0;i--)
3974 // pNorm(strat->S[i]);
3975 //}
3976 kTest(strat);
3977 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3978 if (BVERBOSE(23)) kDebugPrint(strat);
3979 int max_ind;
3980 p = redNF(pCopy(q),max_ind,(lazyReduce & KSTD_NF_NONORM)==KSTD_NF_NONORM,strat);
3981 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3982 {
3983 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
3985 {
3986 p = redtailBba_NF(p,strat);
3987 }
3988 else if (rField_is_Ring(currRing))
3989 {
3990 p = redtailBba_Ring(p,max_ind,strat);
3991 }
3992 else
3993 {
3995 p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
3996 }
3997 }
3998 /*- release temp data------------------------------- -*/
3999 assume(strat->L==NULL); /* strat->L unused */
4000 assume(strat->B==NULL); /* strat->B unused */
4001 omFree(strat->sevS);
4002 omFree(strat->ecartS);
4003 assume(strat->T==NULL);//omfree(strat->T);
4004 assume(strat->sevT==NULL);//omfree(strat->sevT);
4005 assume(strat->R==NULL);//omfree(strat->R);
4006 omfree(strat->S_2_R);
4007 omfree(strat->fromQ);
4008 strat->fromQ=NULL;
4009 idDelete(&strat->Shdl);
4010 SI_RESTORE_OPT1(save1);
4011 if (TEST_OPT_PROT && ((lazyReduce &KSTD_NF_NOLF)==0)) PrintLn();
4012 return p;
4013}
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition kInline.h:1224
#define KSTD_NF_NOLF
Definition kstd1.h:26
void kDebugPrint(kStrategy strat)
Definition kutil.cc:11478
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1004
#define BVERBOSE(a)
Definition options.h:35
static BOOLEAN rField_is_Zn(const ring r)
Definition ring.h:523

◆ kNF2Bound() [1/2]

ideal kNF2Bound ( ideal F,
ideal Q,
ideal q,
int bound,
kStrategy strat,
int lazyReduce )

Definition at line 4176 of file kstd2.cc.

4177{
4178 assume(!idIs0(q));
4179 assume(!(idIs0(F)&&(Q==NULL)));
4180// lazy_reduce flags: can be combined by |
4181//#define KSTD_NF_LAZY 1
4182 // do only a reduction of the leading term
4183//#define KSTD_NF_NONORM 4
4184 // only global: avoid normalization, return a multiply of NF
4185 poly p;
4186 int i;
4187 ideal res;
4188 int max_ind;
4189
4190 //if (idIs0(q))
4191 // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
4192 //if ((idIs0(F))&&(Q==NULL))
4193 // return idCopy(q); /*F=0*/
4194 //strat->ak = idRankFreeModule(F);
4195 /*- creating temp data structures------------------- -*/
4196 BITSET save1;
4197 SI_SAVE_OPT1(save1);
4199 initBuchMoraCrit(strat);
4200 strat->initEcart = initEcartBBA;
4201 strat->enterS = enterSBba;
4202 /*- set S -*/
4203 strat->sl = -1;
4204#ifndef NO_BUCKETS
4206#endif
4207 /*- init local data struct.---------------------------------------- -*/
4208 /*Shdl=*/initS(F,Q,strat);
4209 /*- compute------------------------------------------------------- -*/
4210 res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
4211 for (i=IDELEMS(q)-1; i>=0; i--)
4212 {
4213 if (q->m[i]!=NULL)
4214 {
4215 if (TEST_OPT_PROT) { PrintS("r");mflush(); }
4216 p = redNFBound(pCopy(q->m[i]),max_ind,
4217 (lazyReduce & KSTD_NF_NONORM)==KSTD_NF_NONORM,strat,bound);
4218 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
4219 {
4220 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4222 {
4223 p = redtailBba_Z(p,max_ind,strat);
4224 }
4225 else if (rField_is_Ring(currRing))
4226 {
4227 p = redtailBba_Ring(p,max_ind,strat);
4228 }
4229 else
4230 {
4232 p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
4233 }
4234 }
4235 res->m[i]=p;
4236 }
4237 //else
4238 // res->m[i]=NULL;
4239 }
4240 /*- release temp data------------------------------- -*/
4241 assume(strat->L==NULL); /* strat->L unused */
4242 assume(strat->B==NULL); /* strat->B unused */
4243 omFree(strat->sevS);
4244 omFree(strat->ecartS);
4245 assume(strat->T==NULL);//omfree(strat->T);
4246 assume(strat->sevT==NULL);//omfree(strat->sevT);
4247 assume(strat->R==NULL);//omfree(strat->R);
4248 omfree(strat->S_2_R);
4249 omfree(strat->fromQ);
4250 strat->fromQ=NULL;
4251 idDelete(&strat->Shdl);
4252 SI_RESTORE_OPT1(save1);
4253 if (TEST_OPT_PROT) PrintLn();
4254 return res;
4255}
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition kInline.h:1218
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition kInline.h:1229
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition kstd2.cc:2503

◆ kNF2Bound() [2/2]

poly kNF2Bound ( ideal F,
ideal Q,
poly q,
int bound,
kStrategy strat,
int lazyReduce )

Definition at line 4015 of file kstd2.cc.

4016{
4017 assume(q!=NULL);
4018 assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
4019
4020// lazy_reduce flags: can be combined by |
4021//#define KSTD_NF_LAZY 1
4022 // do only a reduction of the leading term
4023//#define KSTD_NF_NONORM 4
4024 // only global: avoid normalization, return a multiply of NF
4025 poly p;
4026
4027 //if ((idIs0(F))&&(Q==NULL))
4028 // return pCopy(q); /*F=0*/
4029 //strat->ak = idRankFreeModule(F);
4030 /*- creating temp data structures------------------- -*/
4031 BITSET save1;
4032 SI_SAVE_OPT1(save1);
4034 initBuchMoraCrit(strat);
4035 strat->initEcart = initEcartBBA;
4036 strat->enterS = enterSBba;
4037#ifndef NO_BUCKETS
4039#endif
4040 /*- set S -*/
4041 strat->sl = -1;
4042 /*- init local data struct.---------------------------------------- -*/
4043 /*Shdl=*/initS(F,Q,strat);
4044 /*- compute------------------------------------------------------- -*/
4045 //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
4046 //{
4047 // for (i=strat->sl;i>=0;i--)
4048 // pNorm(strat->S[i]);
4049 //}
4050 kTest(strat);
4051 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
4052 if (BVERBOSE(23)) kDebugPrint(strat);
4053 int max_ind;
4054 p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
4055 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
4056 {
4057 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4059 {
4060 p = redtailBba_Z(p,max_ind,strat);
4061 }
4062 else if (rField_is_Ring(currRing))
4063 {
4064 p = redtailBba_Ring(p,max_ind,strat);
4065 }
4066 else
4067 {
4069 p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
4070 //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
4071 }
4072 }
4073 /*- release temp data------------------------------- -*/
4074 assume(strat->L==NULL); /* strat->L unused */
4075 assume(strat->B==NULL); /* strat->B unused */
4076 omFree(strat->sevS);
4077 omFree(strat->ecartS);
4078 assume(strat->T==NULL);//omfree(strat->T);
4079 assume(strat->sevT==NULL);//omfree(strat->sevT);
4080 assume(strat->R==NULL);//omfree(strat->R);
4081 omfree(strat->S_2_R);
4082 omfree(strat->fromQ);
4083 strat->fromQ=NULL;
4084 idDelete(&strat->Shdl);
4085 SI_RESTORE_OPT1(save1);
4086 if (TEST_OPT_PROT) PrintLn();
4087 return p;
4088}

◆ ksReducePolyTailSig()

KINLINE int ksReducePolyTailSig ( LObject * PR,
TObject * PW,
LObject * Red,
kStrategy strat )

Definition at line 1331 of file kstd2.cc.

1332{
1333 BOOLEAN ret;
1334 number coef;
1335 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1337 Red->HeadNormalize();
1338 /*
1339 printf("------------------------\n");
1340 pWrite(Red->GetLmCurrRing());
1341 */
1343 ret = ksReducePolySigRing(Red, PW, 1, NULL, &coef, strat);
1344 else
1345 ret = ksReducePolySig(Red, PW, 1, NULL, &coef, strat);
1346 if (!ret)
1347 {
1348 if (! n_IsOne(coef, currRing->cf) && !rField_is_Ring(currRing))
1349 {
1350 PR->Mult_nn(coef);
1351 // HANNES: mark for Normalize
1352 }
1353 n_Delete(&coef, currRing->cf);
1354 }
1355 return ret;
1356}
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition coeffs.h:474
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:737
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:943

◆ kTestDivisibleByT0_Z()

int kTestDivisibleByT0_Z ( const kStrategy strat,
const LObject * L )

tests if T[0] divides the leading monomial of L, returns -1 if not

Definition at line 142 of file kstd2.cc.

143{
144 if (strat->tl < 1)
145 return -1;
146
147 unsigned long not_sev = ~L->sev;
148 const unsigned long sevT0 = strat->sevT[0];
149 number orest,rest,mult;
150 if (L->p!=NULL)
151 {
152 const poly T0p = strat->T[0].p;
153 const ring r = currRing;
154 const poly p = L->p;
155 orest = pGetCoeff(p);
156
157 pAssume(~not_sev == p_GetShortExpVector(p, r));
158
159#if defined(PDEBUG) || defined(PDIV_DEBUG)
160 if (p_LmShortDivisibleBy(T0p, sevT0, p, not_sev, r))
161#else
162 if (!(sevT0 & not_sev) && p_LmDivisibleBy(T0p, p, r))
163#endif
164 {
165 if (n_QuotRem!=ndQuotRem) /*euclidean ring*/
166 {
167 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T0p), &rest, r->cf);
168 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
169 {
170 n_Delete(&mult,r->cf);
171 n_Delete(&rest,r->cf);
172 return 0;
173 }
174 n_Delete(&mult,r->cf);
175 n_Delete(&rest,r->cf);
176 }
177 }
178 }
179 else
180 {
181 const poly T0p = strat->T[0].t_p;
182 const ring r = strat->tailRing;
183 const poly p = L->t_p;
184 orest = pGetCoeff(p);
185#if defined(PDEBUG) || defined(PDIV_DEBUG)
186 if (p_LmShortDivisibleBy(T0p, sevT0,
187 p, not_sev, r))
188#else
189 if (!(sevT0 & not_sev) && p_LmDivisibleBy(T0p, p, r))
190#endif
191 {
192 if (n_QuotRem!=ndQuotRem) /*euclidean ring*/
193 {
194 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T0p), &rest, r->cf);
195 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
196 {
197 n_Delete(&mult,r->cf);
198 n_Delete(&rest,r->cf);
199 return 0;
200 }
201 n_Delete(&mult,r->cf);
202 n_Delete(&rest,r->cf);
203 }
204 }
205 }
206 return -1;
207}
number ndQuotRem(number a, number b, number *r, const coeffs R)
Definition numbers.cc:356

◆ redFirstShift()

int redFirstShift ( LObject * h,
kStrategy strat )

Definition at line 4951 of file kstd2.cc.

4952{
4953 if (h->IsNull()) return 0;
4954
4955 int at, reddeg,d;
4956 int pass = 0;
4957 int j = 0;
4958
4959 if (! strat->homog)
4960 {
4961 d = h->GetpFDeg() + h->ecart;
4962 reddeg = strat->LazyDegree+d;
4963 }
4964 h->SetShortExpVector();
4965 loop
4966 {
4967 j = kFindDivisibleByInT(strat, h);
4968 if (j < 0)
4969 {
4970 h->SetDegStuffReturnLDeg(strat->LDegLast);
4971 return 1;
4972 }
4973
4975 strat->T[j].pNorm();
4976#ifdef KDEBUG
4977 if (TEST_OPT_DEBUG)
4978 {
4979 PrintS("reduce ");
4980 h->wrp();
4981 PrintS(" with ");
4982 strat->T[j].wrp();
4983 }
4984#endif
4985 ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, NULL, strat);
4986
4987#ifdef KDEBUG
4988 if (TEST_OPT_DEBUG)
4989 {
4990 PrintS("\nto ");
4991 wrp(h->p);
4992 PrintLn();
4993 }
4994#endif
4995 if (h->IsNull())
4996 {
4997 kDeleteLcm(h);
4998 h->Clear();
4999 return 0;
5000 }
5001 h->SetShortExpVector();
5002
5003#if 0
5004 if ((strat->syzComp!=0) && !strat->honey)
5005 {
5006 if ((strat->syzComp>0) &&
5007 (h->Comp() > strat->syzComp))
5008 {
5009 assume(h->MinComp() > strat->syzComp);
5010#ifdef KDEBUG
5011 if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
5012#endif
5013 if (strat->homog)
5014 h->SetDegStuffReturnLDeg(strat->LDegLast);
5015 return -2;
5016 }
5017 }
5018#endif
5019 if (!strat->homog)
5020 {
5021 if (!TEST_OPT_OLDSTD && strat->honey)
5022 {
5023 h->SetpFDeg();
5024 if (strat->T[j].ecart <= h->ecart)
5025 h->ecart = d - h->GetpFDeg();
5026 else
5027 h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
5028
5029 d = h->GetpFDeg() + h->ecart;
5030 }
5031 else
5032 d = h->SetDegStuffReturnLDeg(strat->LDegLast);
5033 /*- try to reduce the s-polynomial -*/
5034 pass++;
5035 /*
5036 *test whether the polynomial should go to the lazyset L
5037 *-if the degree jumps
5038 *-if the number of pre-defined reductions jumps
5039 */
5040 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
5041 && ((d >= reddeg) || (pass > strat->LazyPass)))
5042 {
5043 h->SetLmCurrRing();
5044 if (strat->posInLDependsOnLength)
5045 h->SetLength(strat->length_pLength);
5046 at = strat->posInL(strat->L,strat->Ll,h,strat);
5047 if (at <= strat->Ll)
5048 {
5049 //int dummy=strat->sl;
5050 /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
5051 //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
5052 if (kFindDivisibleByInT(strat, h) < 0)
5053 return 1;
5054 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
5055#ifdef KDEBUG
5056 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
5057#endif
5058 h->Clear();
5059 return -1;
5060 }
5061 }
5062 if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
5063 {
5064 reddeg = d+1;
5065 Print(".%d",d);mflush();
5066 }
5067 }
5068 }
5069}
KINLINE poly kNoetherTail()
Definition kInline.h:66
char LDegLast
Definition kutil.h:382
char length_pLength
Definition kutil.h:384
#define Print
Definition emacs.cc:80
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat, BOOLEAN reduce)
Definition kspoly.cc:187
#define TEST_OPT_REDTHROUGH
Definition options.h:124
void wrp(poly p)
Definition polys.h:311

◆ redHomog()

int redHomog ( LObject * h,
kStrategy strat )

Definition at line 1150 of file kstd2.cc.

1151{
1152 if (strat->tl<0) return 1;
1153 //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1154 assume(h->FDeg == h->pFDeg());
1155
1156 poly h_p;
1157 int i,j,at,pass,cnt,ii;
1158 // long reddeg,d;
1159 int li;
1160 BOOLEAN test_opt_length=TEST_OPT_LENGTH;
1161
1162 pass = j = 0;
1163 cnt = RED_CANONICALIZE;
1164 h->SetShortExpVector();
1165 h_p = h->GetLmTailRing();
1166 h->PrepareRed(strat->use_buckets);
1167 loop
1168 {
1169 j = kFindDivisibleByInT(strat, h);
1170 if (j < 0) return 1;
1171
1172 li = strat->T[j].pLength;
1173 ii = j;
1174 /*
1175 * the polynomial to reduce with (up to the moment) is;
1176 * pi with length li
1177 */
1178 i = j;
1179#if 1
1180 if (test_opt_length)
1181 {
1182 if (li<=0) li=strat->T[j].GetpLength();
1183 if (li>2)
1184 {
1185 unsigned long not_sev = ~ h->sev;
1186 loop
1187 {
1188 /*- search the shortest possible with respect to length -*/
1189 i++;
1190 if (i > strat->tl)
1191 break;
1192 if ((strat->T[i].pLength < li)
1193 &&
1194 p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1195 h_p, not_sev, strat->tailRing))
1196 {
1197 /*
1198 * the polynomial to reduce with is now;
1199 */
1200 li = strat->T[i].pLength;
1201 if (li<=0) li=strat->T[i].GetpLength();
1202 ii = i;
1203 if (li<3) break;
1204 }
1205 }
1206 }
1207 }
1208#endif
1209
1210 /*
1211 * end of search: have to reduce with pi
1212 */
1213#ifdef KDEBUG
1214 if (TEST_OPT_DEBUG)
1215 {
1216 PrintS("red:");
1217 h->wrp();
1218 PrintS(" with ");
1219 strat->T[ii].wrp();
1220 }
1221#endif
1222 assume(strat->fromT == FALSE);
1223
1224 ksReducePoly(h, &(strat->T[ii]), NULL, NULL, NULL, strat);
1225#if SBA_PRINT_REDUCTION_STEPS
1226 sba_interreduction_steps++;
1227#endif
1228#if SBA_PRINT_OPERATIONS
1229 sba_interreduction_operations += pLength(strat->T[ii].p);
1230#endif
1231
1232#ifdef KDEBUG
1233 if (TEST_OPT_DEBUG)
1234 {
1235 PrintS("\nto ");
1236 h->wrp();
1237 PrintLn();
1238 }
1239#endif
1240
1241 h_p = h->GetLmTailRing();
1242 if (h_p == NULL)
1243 {
1244 kDeleteLcm(h);
1245 return 0;
1246 }
1248 {
1249 if (h->p!=NULL)
1250 {
1251 if(p_GetComp(h->p,currRing)>strat->syzComp)
1252 {
1253 h->Delete();
1254 return 0;
1255 }
1256 }
1257 else //if (h->t_p!=NULL)
1258 {
1259 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1260 {
1261 h->Delete();
1262 return 0;
1263 }
1264 }
1265 }
1266 #if 0
1267 else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
1268 {
1269 if (h->p!=NULL)
1270 {
1271 if(p_GetComp(h->p,currRing)>strat->syzComp)
1272 {
1273 return 1;
1274 }
1275 }
1276 else // if (h->t_p!=NULL)
1277 {
1278 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
1279 {
1280 return 1;
1281 }
1282 }
1283 }
1284 #endif
1285 h->SetShortExpVector();
1286 /*
1287 * try to reduce the s-polynomial h
1288 *test first whether h should go to the lazyset L
1289 *-if the degree jumps
1290 *-if the number of pre-defined reductions jumps
1291 */
1292 cnt--;
1293 pass++;
1294 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1295 {
1296 h->SetLmCurrRing();
1297 at = strat->posInL(strat->L,strat->Ll,h,strat);
1298 if (at <= strat->Ll)
1299 {
1300#ifdef HAVE_SHIFTBBA
1301 if (rIsLPRing(currRing))
1302 {
1303 if (kFindDivisibleByInT(strat, h) < 0)
1304 return 1;
1305 }
1306 else
1307#endif
1308 {
1309 int dummy=strat->sl;
1310 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1311 return 1;
1312 }
1313 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1314#ifdef KDEBUG
1315 if (TEST_OPT_DEBUG)
1316 Print(" lazy: -> L%d\n",at);
1317#endif
1318 h->Clear();
1319 return -1;
1320 }
1321 }
1322 else if (UNLIKELY(cnt==0))
1323 {
1324 h->CanonicalizeP();
1325 cnt=RED_CANONICALIZE;
1326 //if (TEST_OPT_PROT) { PrintS("!");mflush(); }
1327 }
1328 }
1329}
#define UNLIKELY(X)
Definition auxiliary.h:405
char fromT
Definition kutil.h:376
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
Definition kstd2.cc:464
#define RED_CANONICALIZE
Definition kutil.h:37
#define p_GetComp(p, r)
Definition monomials.h:64
#define TEST_OPT_REDTAIL_SYZ
Definition options.h:119

◆ redHoney()

int redHoney ( LObject * h,
kStrategy strat )

Definition at line 2110 of file kstd2.cc.

2111{
2112 if (strat->tl<0) return 1;
2113 //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
2114 assume(h->FDeg == h->pFDeg());
2115 int j,at,pass,ei, ii, h_d;
2116 long reddeg,d;
2117
2118 pass = j = 0;
2119 d = reddeg = h->GetpFDeg() + h->ecart;
2120 h->SetShortExpVector();
2121
2122 h->PrepareRed(strat->use_buckets);
2123 loop
2124 {
2125 j=kFindDivisibleByInT_ecart(strat, h, h->ecart);
2126 if (j < 0) return 1;
2127
2128 ii = j;
2129 ei = strat->T[ii].ecart;
2130 /*
2131 * the polynomial to reduce with (up to the moment) is;
2132 * pi with ecart ei (T[ii])
2133 */
2134
2135 /*
2136 * end of search: have to reduce with pi
2137 */
2138 if (UNLIKELY(!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart)))
2139 {
2140 h->GetTP(); // clears bucket
2141 h->SetLmCurrRing();
2142 /*
2143 * It is not possible to reduce h with smaller ecart;
2144 * if possible h goes to the lazy-set L,i.e
2145 * if its position in L would be not the last one
2146 */
2147 if (strat->Ll >= 0) /* L is not empty */
2148 {
2149 at = strat->posInL(strat->L,strat->Ll,h,strat);
2150 if(at <= strat->Ll)
2151 /*- h will not become the next element to reduce -*/
2152 {
2153 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
2154#ifdef KDEBUG
2155 if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
2156#endif
2157 h->Clear();
2158 return -1;
2159 }
2160 }
2161 }
2162#ifdef KDEBUG
2163 if (TEST_OPT_DEBUG)
2164 {
2165 PrintS("red:");
2166 h->wrp();
2167 Print("\nwith T[%d]:",ii);
2168 strat->T[ii].wrp();
2169 }
2170#endif
2171 assume(strat->fromT == FALSE);
2172
2173 ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),NULL,NULL, strat);
2174#if SBA_PRINT_REDUCTION_STEPS
2175 sba_interreduction_steps++;
2176#endif
2177#if SBA_PRINT_OPERATIONS
2178 sba_interreduction_operations += strat->T[ii].pLength;
2179#endif
2180#ifdef KDEBUG
2181 if (TEST_OPT_DEBUG)
2182 {
2183 PrintS("\nto:");
2184 h->wrp();
2185 PrintLn();
2186 }
2187#endif
2188 if(h->IsNull())
2189 {
2190 kDeleteLcm(h);
2191 h->Clear();
2192 return 0;
2193 }
2195 {
2196 if (h->p!=NULL)
2197 {
2198 if(p_GetComp(h->p,currRing)>strat->syzComp)
2199 {
2200 h->Delete();
2201 return 0;
2202 }
2203 }
2204 else //if (h->t_p!=NULL)
2205 {
2206 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
2207 {
2208 h->Delete();
2209 return 0;
2210 }
2211 }
2212 }
2213 else
2214 if (UNLIKELY((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ)))
2215 {
2216 if (h->p!=NULL)
2217 {
2218 if(p_GetComp(h->p,currRing)>strat->syzComp)
2219 {
2220 return 1;
2221 }
2222 }
2223 else // if (h->t_p!=NULL)
2224 {
2225 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
2226 {
2227 return 1;
2228 }
2229 }
2230 }
2231 h->SetShortExpVector();
2232 h_d = h->SetpFDeg();
2233 /* compute the ecart */
2234 if (ei <= h->ecart)
2235 h->ecart = d-h_d;
2236 else
2237 h->ecart = d-h_d+ei-h->ecart;
2238
2239 /*
2240 * try to reduce the s-polynomial h
2241 *test first whether h should go to the lazyset L
2242 *-if the degree jumps
2243 *-if the number of pre-defined reductions jumps
2244 */
2245 pass++;
2246 d = h_d + h->ecart;
2248 && (strat->Ll >= 0)
2249 && ((d > reddeg) || (pass > strat->LazyPass))))
2250 {
2251 h->GetTP(); // clear bucket
2252 h->SetLmCurrRing();
2253 at = strat->posInL(strat->L,strat->Ll,h,strat);
2254 if (at <= strat->Ll)
2255 {
2256#ifdef HAVE_SHIFTBBA
2257 if (rIsLPRing(currRing))
2258 {
2259 if (kFindDivisibleByInT(strat, h) < 0)
2260 return 1;
2261 }
2262 else
2263#endif
2264 {
2265 int dummy=strat->sl;
2266 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
2267 return 1;
2268 }
2269 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
2270#ifdef KDEBUG
2271 if (TEST_OPT_DEBUG)
2272 Print(" degree jumped: -> L%d\n",at);
2273#endif
2274 h->Clear();
2275 return -1;
2276 }
2277 }
2278 else if (d > reddeg)
2279 {
2280 if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
2281 {
2282 if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
2283 {
2284 strat->overflow=TRUE;
2285 //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
2286 h->GetP();
2287 at = strat->posInL(strat->L,strat->Ll,h,strat);
2288 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
2289 h->Clear();
2290 return -1;
2291 }
2292 }
2293 else if (UNLIKELY(TEST_OPT_PROT && (strat->Ll < 0) ))
2294 {
2295 //h->wrp(); Print("<%d>\n",h->GetpLength());
2296 reddeg = d;
2297 Print(".%ld",d); mflush();
2298 }
2299 }
2300 }
2301}
int kFindDivisibleByInT_ecart(const kStrategy strat, const LObject *L, const int ecart)
Definition kstd2.cc:416

◆ redLazy()

int redLazy ( LObject * h,
kStrategy strat )

TEST_OPT_REDTHROUGH &&

Definition at line 1905 of file kstd2.cc.

1906{
1907 if (strat->tl<0) return 1;
1908 int at,i,ii,li;
1909 int j = 0;
1910 int pass = 0;
1911 int cnt = RED_CANONICALIZE;
1912 assume(h->pFDeg() == h->FDeg);
1913 long reddeg = h->GetpFDeg();
1914 long d;
1915 BOOLEAN test_opt_length=TEST_OPT_LENGTH;
1916
1917 h->SetShortExpVector();
1918 poly h_p = h->GetLmTailRing();
1919 h->PrepareRed(strat->use_buckets);
1920 loop
1921 {
1922 j = kFindDivisibleByInT(strat, h);
1923 if (j < 0) return 1;
1924
1925 li = strat->T[j].pLength;
1926 ii = j;
1927 /*
1928 * the polynomial to reduce with (up to the moment) is;
1929 * pi with length li
1930 */
1931
1932 i = j;
1933#if 1
1934 if (test_opt_length)
1935 {
1936 if (li<=0) li=strat->T[j].GetpLength();
1937 if(li>2)
1938 {
1939 unsigned long not_sev = ~ h->sev;
1940 loop
1941 {
1942 /*- search the shortest possible with respect to length -*/
1943 i++;
1944 if (i > strat->tl)
1945 break;
1946 if ((strat->T[i].pLength < li)
1947 &&
1948 p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1949 h_p, not_sev, strat->tailRing))
1950 {
1951 /*
1952 * the polynomial to reduce with is now;
1953 */
1954 li = strat->T[i].pLength;
1955 if (li<=0) li=strat->T[i].GetpLength();
1956 ii = i;
1957 if (li<3) break;
1958 }
1959 }
1960 }
1961 }
1962#endif
1963
1964 /*
1965 * end of search: have to reduce with pi
1966 */
1967
1968
1969#ifdef KDEBUG
1970 if (TEST_OPT_DEBUG)
1971 {
1972 PrintS("red:");
1973 h->wrp();
1974 PrintS(" with ");
1975 strat->T[ii].wrp();
1976 }
1977#endif
1978
1979 ksReducePoly(h, &(strat->T[ii]), NULL, NULL, NULL, strat);
1980#if SBA_PRINT_REDUCTION_STEPS
1981 sba_interreduction_steps++;
1982#endif
1983#if SBA_PRINT_OPERATIONS
1984 sba_interreduction_operations += pLength(strat->T[ii].p);
1985#endif
1986
1987#ifdef KDEBUG
1988 if (TEST_OPT_DEBUG)
1989 {
1990 PrintS("\nto ");
1991 h->wrp();
1992 PrintLn();
1993 }
1994#endif
1995
1996 h_p=h->GetLmTailRing();
1997
1998 if (h_p == NULL)
1999 {
2000 kDeleteLcm(h);
2001 return 0;
2002 }
2004 {
2005 if (h->p!=NULL)
2006 {
2007 if(p_GetComp(h->p,currRing)>strat->syzComp)
2008 {
2009 h->Delete();
2010 return 0;
2011 }
2012 }
2013 else //if (h->t_p!=NULL)
2014 {
2015 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
2016 {
2017 h->Delete();
2018 return 0;
2019 }
2020 }
2021 }
2022 #if 0
2023 else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
2024 {
2025 if (h->p!=NULL)
2026 {
2027 if(p_GetComp(h->p,currRing)>strat->syzComp)
2028 {
2029 return 1;
2030 }
2031 }
2032 else // if (h->t_p!=NULL)
2033 {
2034 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
2035 {
2036 return 1;
2037 }
2038 }
2039 }
2040 #endif
2041 h->SetShortExpVector();
2042 d = h->SetpFDeg();
2043 /*- try to reduce the s-polynomial -*/
2044 cnt--;
2045 pass++;
2046 if (//!TEST_OPT_REDTHROUGH &&
2047 (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
2048 {
2049 h->SetLmCurrRing();
2050 at = strat->posInL(strat->L,strat->Ll,h,strat);
2051 if (at <= strat->Ll)
2052 {
2053#if 1
2054#ifdef HAVE_SHIFTBBA
2055 if (rIsLPRing(currRing))
2056 {
2057 if (kFindDivisibleByInT(strat, h) < 0)
2058 return 1;
2059 }
2060 else
2061#endif
2062 {
2063 int dummy=strat->sl;
2064 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
2065 return 1;
2066 }
2067#endif
2068#ifdef KDEBUG
2069 if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
2070#endif
2071 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
2072 h->Clear();
2073 return -1;
2074 }
2075 }
2076 else if (d != reddeg)
2077 {
2078 if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
2079 {
2080 if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
2081 {
2082 strat->overflow=TRUE;
2083 //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
2084 h->GetP();
2085 at = strat->posInL(strat->L,strat->Ll,h,strat);
2086 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
2087 h->Clear();
2088 return -1;
2089 }
2090 }
2091 else if ((TEST_OPT_PROT) && (strat->Ll < 0))
2092 {
2093 Print(".%ld",d);mflush();
2094 reddeg = d;
2095 }
2096 }
2097 else if (UNLIKELY(cnt==0))
2098 {
2099 h->CanonicalizeP();
2100 cnt=RED_CANONICALIZE;
2101 //if (TEST_OPT_PROT) { PrintS("!");mflush(); }
2102 }
2103 }
2104}

◆ redNF()

poly redNF ( poly h,
int & max_ind,
int nonorm,
kStrategy strat )

Definition at line 2307 of file kstd2.cc.

2308{
2309 if (h==NULL) return NULL;
2310 int j,j_ring;
2311 int cnt=REDNF_CANONICALIZE;
2312 max_ind=strat->sl;
2313
2314 if (0 > strat->sl)
2315 {
2316 return h;
2317 }
2318 LObject P(h);
2319 P.SetShortExpVector();
2320 P.t_p=NULL;
2321 BOOLEAN is_ring = rField_is_Ring(currRing);
2322 if(is_ring) nonorm=TRUE;
2323#ifdef KDEBUG
2324// if (TEST_OPT_DEBUG)
2325// {
2326// PrintS("redNF: starting S:\n");
2327// for( j = 0; j <= max_ind; j++ )
2328// {
2329// Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
2330// pWrite(strat->S[j]);
2331// }
2332// };
2333#endif
2334 if (rField_is_Z(currRing))
2335 {
2336 redRing_Z_S(&P,strat);
2337 if (P.bucket!=NULL)
2338 {
2339 P.p=kBucketClear(P.bucket);
2340 kBucketDestroy(&P.bucket);
2341 }
2342 return P.p;
2343 }
2344 else if (rField_is_Ring(currRing))
2345 {
2346 redRing_S(&P,strat);
2347 if (P.bucket!=NULL)
2348 {
2349 P.p=kBucketClear(P.bucket);
2350 kBucketDestroy(&P.bucket);
2351 }
2352 return P.p;
2353 }
2354
2355 P.bucket = kBucketCreate(currRing);
2356 kBucketInit(P.bucket,P.p,pLength(P.p));
2357 kbTest(P.bucket);
2358 P.p=kBucketGetLm(P.bucket);
2359 loop
2360 {
2361 j_ring=j=kFindDivisibleByInS_noCF(strat,&max_ind,&P);
2362 while ((j>=0)
2363 && (nonorm)
2364 && (!n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[j]),currRing->cf)))
2365 j=kFindNextDivisibleByInS(strat,j+1,max_ind,&P);
2366 if (j>=0)
2367 {
2368 int sl=pSize(strat->S[j]);
2369 int jj=j;
2370 loop
2371 {
2372 int sll;
2373 jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
2374 if (jj<0) break;
2375 if ((!nonorm)
2376 || (n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[jj]),currRing->cf)))
2377 {
2378 sll=pSize(strat->S[jj]);
2379 if (sll<sl)
2380 {
2381 #ifdef KDEBUG
2382 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
2383 #endif
2384 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
2385 j=jj;
2386 sl=sll;
2387 }
2388 }
2389 }
2390 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
2391 {
2392 pNorm(strat->S[j]);
2393 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
2394 }
2395 nNormalize(pGetCoeff(P.p));
2396#ifdef KDEBUG
2397 if (TEST_OPT_DEBUG)
2398 {
2399 PrintS("red:");
2400 wrp(P.p);
2401 PrintS(" with ");
2402 wrp(strat->S[j]);
2403 }
2404#endif
2405#ifdef HAVE_PLURAL
2407 {
2408 number coef;
2409 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm);
2410 nDelete(&coef);
2411 }
2412 else
2413#endif
2414 {
2415 kBucketPolyRedNF(P.bucket,strat->S[j],pLength(strat->S[j]),
2416 strat->kNoether);
2417 }
2418 cnt--;
2419 if (cnt==0)
2420 {
2421 kBucketCanonicalize(P.bucket);
2423 }
2424 P.p=kBucketGetLm(P.bucket);
2425 //P.t_p=NULL;
2426#ifdef KDEBUG
2427 if (TEST_OPT_DEBUG)
2428 {
2429 PrintS("\nto:");
2430 wrp(P.p);
2431 PrintLn();
2432 }
2433#endif
2434 if (P.p==NULL)
2435 {
2436 kBucketDestroy(&P.bucket);
2437 return NULL;
2438 }
2439 kbTest(P.bucket);
2440 P.SetShortExpVector();
2441 }
2442 else if (is_ring && (j_ring>=0) && (currRing->cf->cfQuotRem!=ndQuotRem))
2443 {
2444 number r;
2445 number n=n_QuotRem(pGetCoeff(P.p),pGetCoeff(strat->S[j_ring]),&r,currRing->cf);
2446 if(!n_IsZero(n,currRing->cf))
2447 {
2448 poly lm=kBucketGetLm(P.bucket);
2449 poly m=p_Head(lm,currRing);
2450 p_ExpVectorSub(m,strat->S[j_ring],currRing);
2451 if (p_GetComp(strat->S[j_ring], currRing) != p_GetComp(lm, currRing))
2452 {
2454 }
2456 p_Setm(m,currRing);
2457#ifdef KDEBUG
2458 if (TEST_OPT_DEBUG)
2459 {
2460 PrintS("redi (coeff):");
2461 wrp(P.p);
2462 PrintS(" with ");
2463 wrp(strat->S[j]);
2464 }
2465#endif
2466 int l=-1;
2467 kBucket_Minus_m_Mult_p(P.bucket,m,strat->S[j_ring],&l);
2468 P.p=kBucketGetLm(P.bucket);
2470#ifdef KDEBUG
2471 if (TEST_OPT_DEBUG)
2472 {
2473 PrintS("\nto:");
2474 wrp(P.p);
2475 PrintLn();
2476 }
2477#endif
2478 }
2479 else
2480 {
2481 n_Delete(&n,currRing->cf);
2482 }
2483 n_Delete(&r,currRing->cf);
2484 P.p=kBucketClear(P.bucket);
2485 kBucketDestroy(&P.bucket);
2486 pNormalize(P.p);
2487 return P.p;
2488 }
2489 else
2490 {
2491 P.p=kBucketClear(P.bucket);
2492 kBucketDestroy(&P.bucket);
2493 pNormalize(P.p);
2494 return P.p;
2495 }
2496 }
2497}
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
poly kNoether
Definition kutil.h:328
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition kbuckets.cc:521
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition kbuckets.cc:197
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
Definition kbuckets.cc:722
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition kbuckets.cc:216
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition kbuckets.cc:493
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition kbuckets.cc:209
void kBucketPolyRedNF(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition kbuckets.cc:1188
const poly kBucketGetLm(kBucket_pt bucket)
Definition kbuckets.cc:506
int kBucketCanonicalize(kBucket_pt bucket)
Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in one bucket: Returns number of bu...
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition kstd2.cc:567
int kFindDivisibleByInS_noCF(const kStrategy strat, int *max_ind, LObject *L)
Definition kstd2.cc:527
static int redRing_S(LObject *h, kStrategy strat)
Definition kstd2.cc:1090
static int redRing_Z_S(LObject *h, kStrategy strat)
Definition kstd2.cc:878
#define REDNF_CANONICALIZE
Definition kutil.h:38
static void nc_kBucketPolyRed_NF(kBucket_pt b, poly p, number *c, BOOLEAN reduce)
Definition nc.h:275
#define nDelete(n)
Definition numbers.h:16
#define nIsOne(n)
Definition numbers.h:25
#define nNormalize(n)
Definition numbers.h:30
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition p_polys.h:1461
static number p_SetCoeff(poly p, number n, ring r)
Definition p_polys.h:414
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
void pNorm(poly p)
Definition polys.h:363
#define pNormalize(p)
Definition polys.h:318
#define pSize(p)
Definition polys.h:319

◆ redNFBound()

poly redNFBound ( poly h,
int & max_ind,
int nonorm,
kStrategy strat,
int bound )

Definition at line 2503 of file kstd2.cc.

2504{
2505 h = pJet(h,bound);
2506 if (h==NULL) return NULL;
2507 int j;
2508 max_ind=strat->sl;
2509
2510 if (0 > strat->sl)
2511 {
2512 return h;
2513 }
2514 LObject P(h);
2515 P.SetShortExpVector();
2516 P.bucket = kBucketCreate(currRing);
2517 kBucketInit(P.bucket,P.p,pLength(P.p));
2518 kbTest(P.bucket);
2519 BOOLEAN is_ring = rField_is_Ring(currRing);
2520
2521 loop
2522 {
2523 j=kFindDivisibleByInS(strat,&max_ind,&P);
2524 if (j>=0)
2525 {
2526 if (!is_ring)
2527 {
2528 int sl=pSize(strat->S[j]);
2529 int jj=j;
2530 loop
2531 {
2532 int sll;
2533 jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
2534 if (jj<0) break;
2535 sll=pSize(strat->S[jj]);
2536 if (sll<sl)
2537 {
2538 #ifdef KDEBUG
2539 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
2540 #endif
2541 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
2542 j=jj;
2543 sl=sll;
2544 }
2545 }
2546 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
2547 {
2548 pNorm(strat->S[j]);
2549 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
2550 }
2551 }
2552 nNormalize(pGetCoeff(P.p));
2553#ifdef KDEBUG
2554 if (TEST_OPT_DEBUG)
2555 {
2556 PrintS("red:");
2557 wrp(h);
2558 PrintS(" with ");
2559 wrp(strat->S[j]);
2560 }
2561#endif
2562#ifdef HAVE_PLURAL
2564 {
2565 number coef;
2566 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm);
2567 nDelete(&coef);
2568 }
2569 else
2570#endif
2571 {
2572 kBucketPolyRedNF(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
2573 P.p = kBucketClear(P.bucket);
2574 P.p = pJet(P.p,bound);
2575 if(!P.IsNull())
2576 {
2577 kBucketDestroy(&P.bucket);
2578 P.SetShortExpVector();
2579 P.bucket = kBucketCreate(currRing);
2580 kBucketInit(P.bucket,P.p,pLength(P.p));
2581 }
2582 }
2583 h = kBucketGetLm(P.bucket); // FRAGE OLIVER
2584 if (h==NULL)
2585 {
2586 kBucketDestroy(&P.bucket);
2587 return NULL;
2588 }
2589 kbTest(P.bucket);
2590 P.p=h;
2591 P.t_p=NULL;
2592 P.SetShortExpVector();
2593#ifdef KDEBUG
2594 if (TEST_OPT_DEBUG)
2595 {
2596 PrintS("\nto:");
2597 wrp(h);
2598 PrintLn();
2599 }
2600#endif
2601 }
2602 else
2603 {
2604 P.p=kBucketClear(P.bucket);
2605 kBucketDestroy(&P.bucket);
2606 pNormalize(P.p);
2607 return P.p;
2608 }
2609 }
2610}
#define pJet(p, m)
Definition polys.h:368

◆ redRing()

int redRing ( LObject * h,
kStrategy strat )

Definition at line 988 of file kstd2.cc.

989{
990 if (strat->tl<0) return 1;
991 if (h->IsNull()) return 0; // spoly is zero (can only occur with zero divisors)
992
993 int at/*,i*/;
994 long d;
995 int j = 0;
996 int pass = 0;
997 // poly zeroPoly = NULL;
998
999// TODO warum SetpFDeg notwendig?
1000 h->SetpFDeg();
1001 assume(h->pFDeg() == h->FDeg);
1002 long reddeg = h->GetpFDeg();
1003
1004 h->SetShortExpVector();
1005 loop
1006 {
1007 j = kFindDivisibleByInT(strat, h);
1008 if (j < 0)
1009 {
1010 // over ZZ: cleanup coefficients by complete reduction with monomials
1011 postReduceByMon(h, strat);
1012 if(h->p == NULL)
1013 {
1014 kDeleteLcm(h);
1015 h->Clear();
1016 return 0;
1017 }
1018 if(nIsZero(pGetCoeff(h->p))) return 2;
1019 j = kFindDivisibleByInT(strat, h);
1020 if(j < 0)
1021 {
1022 if(strat->tl >= 0)
1023 h->i_r1 = strat->tl;
1024 else
1025 h->i_r1 = -1;
1026 if (h->GetLmTailRing() == NULL)
1027 {
1028 kDeleteLcm(h);
1029 h->Clear();
1030 return 0;
1031 }
1032 return 1;
1033 }
1034 }
1035 //printf("\nFound one: ");pWrite(strat->T[j].p);
1036 //enterT(*h, strat);
1037 ksReducePoly(h, &(strat->T[j]), NULL, NULL, NULL, strat); // with debug output
1038 //printf("\nAfter small red: ");pWrite(h->p);
1039 if (h->GetLmTailRing() == NULL)
1040 {
1041 kDeleteLcm(h);
1042 h->Clear();
1043 return 0;
1044 }
1045 h->SetShortExpVector();
1046 d = h->SetpFDeg();
1047 /*- try to reduce the s-polynomial -*/
1048 pass++;
1049 if (!TEST_OPT_REDTHROUGH &&
1050 (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1051 {
1052 h->SetLmCurrRing();
1053 if (strat->posInLDependsOnLength)
1054 h->SetLength(strat->length_pLength);
1055 at = strat->posInL(strat->L,strat->Ll,h,strat);
1056 if (at <= strat->Ll)
1057 {
1058#ifdef KDEBUG
1059 if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
1060#endif
1061 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
1062 h->Clear();
1063 return -1;
1064 }
1065 }
1066 if (d != reddeg)
1067 {
1068 if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
1069 {
1070 if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
1071 {
1072 strat->overflow=TRUE;
1073 //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1074 h->GetP();
1075 at = strat->posInL(strat->L,strat->Ll,h,strat);
1076 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1077 h->Clear();
1078 return -1;
1079 }
1080 }
1081 else if ((TEST_OPT_PROT) && (strat->Ll < 0))
1082 {
1083 Print(".%ld",d);mflush();
1084 reddeg = d;
1085 }
1086 }
1087 }
1088}
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition kutil.cc:10682

◆ redRing_S()

int redRing_S ( LObject * h,
kStrategy strat )
static

Definition at line 1090 of file kstd2.cc.

1091{
1092 if (strat->sl<0) return 1;
1093 if (h->IsNull()) return 0; // spoly is zero (can only occur with zero divisors)
1094
1095 int j = 0;
1096 int pass = 0;
1097 // poly zeroPoly = NULL;
1098
1099 h->SetpFDeg();
1100 assume(h->pFDeg() == h->FDeg);
1101 int max_ind;
1102
1103 h->SetShortExpVector();
1104 loop
1105 {
1106 max_ind=strat->sl;
1107 j = kFindDivisibleByInS(strat, &max_ind, h);
1108 if (j < 0)
1109 {
1110 // over ZZ: cleanup coefficients by complete reduction with monomials
1111 postReduceByMon(h, strat);
1112 if(h->p == NULL)
1113 {
1114 h->Clear();
1115 return 0;
1116 }
1117 if(nIsZero(pGetCoeff(h->p))) return 2;
1118 max_ind=strat->sl;
1119 j = kFindDivisibleByInS(strat, &max_ind,h);
1120 if(j < 0)
1121 {
1122 if (h->GetLmTailRing() == NULL)
1123 {
1124 h->Clear();
1125 return 0;
1126 }
1127 return 1;
1128 }
1129 }
1130 //printf("\nFound one: ");pWrite(strat->T[j].p);
1131 //enterT(*h, strat);
1132 TObject tj(strat->S[j]);
1133 ksReducePoly(h, &tj, NULL, NULL, NULL, strat); // with debug output
1134 //printf("\nAfter small red: ");pWrite(h->p);
1135 if (h->GetLmTailRing() == NULL)
1136 {
1137 h->Clear();
1138 return 0;
1139 }
1140 h->SetShortExpVector();
1141 /*- try to reduce the s-polynomial -*/
1142 pass++;
1143 }
1144}
class sTObject TObject
Definition kutil.h:58

◆ redRing_Z()

int redRing_Z ( LObject * h,
kStrategy strat )

Definition at line 720 of file kstd2.cc.

721{
722 if (h->IsNull()) return 0; // spoly is zero (can only occur with zero divisors)
723 if (strat->tl<0) return 1;
724
725 int at;
726 long d;
727 int j = 0;
728 int pass = 0;
729
730// TODO warum SetpFDeg notwendig?
731 h->SetpFDeg();
732 assume(h->pFDeg() == h->FDeg);
733 long reddeg = h->GetpFDeg();
734
735 h->SetShortExpVector();
736 loop
737 {
738 /* check if a reducer of the lead term exists */
739 j = kFindDivisibleByInT(strat, h);
740 if (j < 0)
741 {
742#if STDZ_EXCHANGE_DURING_REDUCTION
743 /* check if a reducer with the same lead monomial exists */
744 j = kFindSameLMInT_Z(strat, h);
745 if (j < 0)
746 {
747#endif
748 /* check if a reducer of the lead monomial exists, by the above
749 * check this is a real divisor of the lead monomial */
750 j = kFindDivisibleByInT_Z(strat, h);
751 if (j < 0)
752 {
753 // over ZZ: cleanup coefficients by complete reduction with monomials
755 postReduceByMon(h, strat);
756 if(h->p == NULL)
757 {
758 if (h->lcm!=NULL) pLmDelete(h->lcm);
759 h->Clear();
760 return 0;
761 }
762 if(nIsZero(pGetCoeff(h->p))) return 2;
763 j = kFindDivisibleByInT(strat, h);
764 if(j < 0)
765 {
766 if(strat->tl >= 0)
767 h->i_r1 = strat->tl;
768 else
769 h->i_r1 = -1;
770 if (h->GetLmTailRing() == NULL)
771 {
772 if (h->lcm!=NULL) pLmDelete(h->lcm);
773 h->Clear();
774 return 0;
775 }
776 return 1;
777 }
778 }
779 else
780 {
781 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
782 * => we try to cut down the lead coefficient at least */
783 /* first copy T[j] in order to multiply it with a coefficient later on */
784 number mult, rest;
785 TObject tj = strat->T[j];
786 tj.Copy();
787 /* tj.max_exp = strat->T[j].max_exp; */
788 /* compute division with remainder of lc(h) and lc(T[j]) */
789 mult = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p),
790 &rest, currRing->cf);
791 /* set corresponding new lead coefficient already. we do not
792 * remove the lead term in ksReducePolyLC, but only apply
793 * a lead coefficient reduction */
794 tj.Mult_nn(mult);
795 ksReducePolyLC(h, &tj, NULL, &rest, strat);
796 tj.Delete();
797 tj.Clear();
798 }
799#if STDZ_EXCHANGE_DURING_REDUCTION
800 }
801 else
802 {
803 /* same lead monomial but lead coefficients do not divide each other:
804 * change the polys to h <- spoly(h,tj) and h2 <- gpoly(h,tj). */
805 LObject h2 = *h;
806 h2.Copy();
807
808 ksReducePolyZ(h, &(strat->T[j]), NULL, NULL, strat);
809 ksReducePolyGCD(&h2, &(strat->T[j]), NULL, NULL, strat);
811 {
812 redtailBbaAlsoLC_Z(&h2, j, strat);
813 }
814 /* replace h2 for tj in L (already generated pairs with tj), S and T */
815 replaceInLAndSAndT(h2, j, strat);
816 }
817#endif
818 }
819 else
820 {
821 ksReducePoly(h, &(strat->T[j]), NULL, NULL, NULL, strat);
822 }
823 /* printf("\nAfter small red: ");pWrite(h->p); */
824 if (h->GetLmTailRing() == NULL)
825 {
826 if (h->lcm!=NULL) pLmDelete(h->lcm);
827#ifdef KDEBUG
828 h->lcm=NULL;
829#endif
830 h->Clear();
831 return 0;
832 }
833 h->SetShortExpVector();
834 d = h->SetpFDeg();
835 /*- try to reduce the s-polynomial -*/
836 pass++;
837 if (!TEST_OPT_REDTHROUGH &&
838 (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
839 {
840 h->SetLmCurrRing();
841 if (strat->posInLDependsOnLength)
842 h->SetLength(strat->length_pLength);
843 at = strat->posInL(strat->L,strat->Ll,h,strat);
844 if (at <= strat->Ll)
845 {
846#ifdef KDEBUG
847 if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
848#endif
849 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
850 h->Clear();
851 return -1;
852 }
853 }
854 if (d != reddeg)
855 {
856 if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
857 {
858 if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
859 {
860 strat->overflow=TRUE;
861 //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
862 h->GetP();
863 at = strat->posInL(strat->L,strat->Ll,h,strat);
864 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
865 h->Clear();
866 return -1;
867 }
868 }
869 else if ((TEST_OPT_PROT) && (strat->Ll < 0))
870 {
871 Print(".%ld",d);mflush();
872 reddeg = d;
873 }
874 }
875 }
876}
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:477
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition kstd2.cc:209
int ksReducePolyGCD(LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int kFindSameLMInT_Z(const kStrategy strat, const LObject *L, const int start=0)
int ksReducePolyZ(LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)

◆ redRing_Z_S()

int redRing_Z_S ( LObject * h,
kStrategy strat )
static

Definition at line 878 of file kstd2.cc.

879{
880 if (h->IsNull()) return 0; // spoly is zero (can only occur with zero divisors)
881 if (strat->sl<0) return 1;
882
883 int j = 0;
884 int pass = 0;
885
886// TODO warum SetpFDeg notwendig?
887 h->SetpFDeg();
888 assume(h->pFDeg() == h->FDeg);
889 h->SetShortExpVector();
890 int max_ind=strat->sl;
891
892 loop
893 {
894 /* check if a reducer of the lead term exists */
895 max_ind=strat->sl;
896 j = kFindDivisibleByInS(strat,&max_ind, h);
897 if (j < 0)
898 {
899#if STDZ_EXCHANGE_DURING_REDUCTION
900 /* check if a reducer with the same lead monomial exists */
901 j = kFindSameLMInT_Z(strat, h);
902 if (j < 0)
903 {
904#endif
905 /* check if a reducer of the lead monomial exists, by the above
906 * check this is a real divisor of the lead monomial */
907 j = kFindDivisibleByInS_Z(strat, h);
908 if (j < 0)
909 {
910 // over ZZ: cleanup coefficients by complete reduction with monomials
912 postReduceByMon(h, strat);
913 if(h->p == NULL)
914 {
915 h->Clear();
916 return 0;
917 }
918 if(nIsZero(pGetCoeff(h->p))) return 2;
919 max_ind=strat->sl;
920 j = kFindDivisibleByInS(strat, &max_ind, h);
921 if(j < 0)
922 {
923 if (h->GetLmTailRing() == NULL)
924 {
925 h->Clear();
926 return 0;
927 }
928 return 1;
929 }
930 }
931 else
932 {
933 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
934 * => we try to cut down the lead coefficient at least */
935 /* first copy T[j] in order to multiply it with a coefficient later on */
936 number mult, rest;
937 TObject tj(pCopy(strat->S[j]));
938 /* compute division with remainder of lc(h) and lc(S[j]) */
939 mult = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->S[j]),
940 &rest, currRing->cf);
941 /* set corresponding new lead coefficient already. we do not
942 * remove the lead term in ksReducePolyLC, but only apply
943 * a lead coefficient reduction */
944 tj.Mult_nn(mult);
945 ksReducePolyLC(h, &tj, NULL, &rest, strat);
946 tj.Delete();
947 tj.Clear();
948 }
949#if STDZ_EXCHANGE_DURING_REDUCTION
950 }
951 else
952 {
953 /* same lead monomial but lead coefficients do not divide each other:
954 * change the polys to h <- spoly(h,tj) and h2 <- gpoly(h,tj). */
955 LObject h2 = *h;
956 h2.Copy();
957 TObject tj(strat->S[j]);
958
959 ksReducePolyZ(h, &tj, NULL, NULL, strat);
960 ksReducePolyGCD(&h2, &tj, NULL, NULL, strat);
962 {
963 redtailBbaAlsoLC_Z_S(&h2, j, strat);
964 }
965 /* replace h2 for tj in L (already generated pairs with tj), S and T */
966 replaceInLAndSAndT(h2, j, strat);
967 }
968#endif
969 }
970 else
971 {
972 TObject tj(strat->S[j]);
973 ksReducePoly(h, &tj, NULL, NULL, NULL, strat);
974 }
975 /* printf("\nAfter small red: ");pWrite(h->p); */
976 if (h->GetLmCurrRing() == NULL)
977 {
978 h->Clear();
979 return 0;
980 }
981 h->SetShortExpVector();
982 h->SetpFDeg();
983 /*- try to reduce the s-polynomial -*/
984 pass++;
985 }
986}
static int kFindDivisibleByInS_Z(const kStrategy strat, LObject *L)
Definition kstd2.cc:272

◆ redSig()

int redSig ( LObject * h,
kStrategy strat )

Definition at line 1369 of file kstd2.cc.

1370{
1371 if (strat->tl<0) return 1;
1372 //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1373 //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
1374 assume(h->FDeg == h->pFDeg());
1375//#if 1
1376#ifdef DEBUGF5
1377 PrintS("------- IN REDSIG -------\n");
1378 Print("p: ");
1379 pWrite(pHead(h->p));
1380 PrintS("p1: ");
1381 pWrite(pHead(h->p1));
1382 PrintS("p2: ");
1383 pWrite(pHead(h->p2));
1384 PrintS("---------------------------\n");
1385#endif
1386 poly h_p;
1387 int i,j,at,pass, ii;
1388 int start=0;
1389 int sigSafe;
1390 unsigned long not_sev;
1391 // long reddeg,d;
1392 BOOLEAN test_opt_length=TEST_OPT_LENGTH;
1393 int li;
1394
1395 pass = j = 0;
1396 h->SetShortExpVector();
1397 h_p = h->GetLmTailRing();
1398 not_sev = ~ h->sev;
1399 loop
1400 {
1401 j = kFindDivisibleByInT(strat, h, start);
1402 if (j < 0)
1403 {
1404 return 1;
1405 }
1406
1407 li = strat->T[j].pLength;
1408 if (li<=0) li=strat->T[j].GetpLength();
1409 ii = j;
1410 /*
1411 * the polynomial to reduce with (up to the moment) is;
1412 * pi with length li
1413 */
1414 i = j;
1415#if 1
1416 if (test_opt_length)
1417 loop
1418 {
1419 /*- search the shortest possible with respect to length -*/
1420 i++;
1421 if (i > strat->tl)
1422 break;
1423 if (li==1)
1424 break;
1425 if ((strat->T[i].pLength < li)
1426 &&
1427 p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1428 h_p, not_sev, strat->tailRing))
1429 {
1430 /*
1431 * the polynomial to reduce with is now;
1432 */
1433 li = strat->T[i].pLength;
1434 if (li<=0) li=strat->T[i].GetpLength();
1435 ii = i;
1436 }
1437 }
1438 start = ii+1;
1439#endif
1440
1441 /*
1442 * end of search: have to reduce with pi
1443 */
1444#ifdef KDEBUG
1445 if (TEST_OPT_DEBUG)
1446 {
1447 PrintS("red:");
1448 h->wrp();
1449 PrintS(" with ");
1450 strat->T[ii].wrp();
1451 }
1452#endif
1453 assume(strat->fromT == FALSE);
1454//#if 1
1455#ifdef DEBUGF5
1456 Print("BEFORE REDUCTION WITH %d:\n",ii);
1457 PrintS("--------------------------------\n");
1458 pWrite(h->sig);
1459 pWrite(strat->T[ii].sig);
1460 pWrite(h->GetLmCurrRing());
1461 pWrite(pHead(h->p1));
1462 pWrite(pHead(h->p2));
1463 pWrite(pHead(strat->T[ii].p));
1464 PrintS("--------------------------------\n");
1465 printf("INDEX OF REDUCER T: %d\n",ii);
1466#endif
1467 sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
1468#if SBA_PRINT_REDUCTION_STEPS
1469 if (sigSafe != 3)
1470 sba_reduction_steps++;
1471#endif
1472#if SBA_PRINT_OPERATIONS
1473 if (sigSafe != 3)
1474 sba_operations += pLength(strat->T[ii].p);
1475#endif
1476 // if reduction has taken place, i.e. the reduction was sig-safe
1477 // otherwise start is already at the next position and the loop
1478 // searching reducers in T goes on from index start
1479//#if 1
1480#ifdef DEBUGF5
1481 Print("SigSAFE: %d\n",sigSafe);
1482#endif
1483 if (sigSafe != 3)
1484 {
1485 // start the next search for reducers in T from the beginning
1486 start = 0;
1487#ifdef KDEBUG
1488 if (TEST_OPT_DEBUG)
1489 {
1490 PrintS("\nto ");
1491 h->wrp();
1492 PrintLn();
1493 }
1494#endif
1495
1496 h_p = h->GetLmTailRing();
1497 if (h_p == NULL)
1498 {
1499 kDeleteLcm(h);
1500 return 0;
1501 }
1502 h->SetShortExpVector();
1503 not_sev = ~ h->sev;
1504 /*
1505 * try to reduce the s-polynomial h
1506 *test first whether h should go to the lazyset L
1507 *-if the degree jumps
1508 *-if the number of pre-defined reductions jumps
1509 */
1510 pass++;
1511 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1512 {
1513 h->SetLmCurrRing();
1514 at = strat->posInL(strat->L,strat->Ll,h,strat);
1515 if (at <= strat->Ll)
1516 {
1517 int dummy=strat->sl;
1518 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1519 {
1520 return 1;
1521 }
1522 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1523#ifdef KDEBUG
1524 if (TEST_OPT_DEBUG)
1525 Print(" lazy: -> L%d\n",at);
1526#endif
1527 h->Clear();
1528 return -1;
1529 }
1530 }
1531 }
1532 }
1533}

◆ redSigRing()

int redSigRing ( LObject * h,
kStrategy strat )

Definition at line 1536 of file kstd2.cc.

1537{
1538 //Since reduce is really bad for SBA we use the following idea:
1539 // We first check if we can build a gcd pair between h and S
1540 //where the sig remains the same and replace h by this gcd poly
1542 #if GCD_SBA
1543 while(sbaCheckGcdPair(h,strat))
1544 {
1545 h->sev = pGetShortExpVector(h->p);
1546 }
1547 #endif
1548 poly beforeredsig;
1549 beforeredsig = pCopy(h->sig);
1550
1551 if (strat->tl<0) return 1;
1552 //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1553 //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
1554 assume(h->FDeg == h->pFDeg());
1555//#if 1
1556#ifdef DEBUGF5
1557 Print("------- IN REDSIG -------\n");
1558 Print("p: ");
1559 pWrite(pHead(h->p));
1560 Print("p1: ");
1561 pWrite(pHead(h->p1));
1562 Print("p2: ");
1563 pWrite(pHead(h->p2));
1564 Print("---------------------------\n");
1565#endif
1566 poly h_p;
1567 int i,j,at,pass, ii;
1568 int start=0;
1569 int sigSafe;
1570 unsigned long not_sev;
1571 // long reddeg,d;
1572 int li;
1573 BOOLEAN test_opt_length=TEST_OPT_LENGTH;
1574
1575 pass = j = 0;
1576 h->SetShortExpVector();
1577 h_p = h->GetLmTailRing();
1578 not_sev = ~ h->sev;
1579 loop
1580 {
1581 j = kFindDivisibleByInT(strat, h, start);
1582 if (j < 0)
1583 {
1584 #if GCD_SBA
1585 while(sbaCheckGcdPair(h,strat))
1586 {
1587 h->sev = pGetShortExpVector(h->p);
1588 h->is_redundant = FALSE;
1589 start = 0;
1590 }
1591 #endif
1592 // over ZZ: cleanup coefficients by complete reduction with monomials
1593 postReduceByMonSig(h, strat);
1594 if(h->p == NULL || nIsZero(pGetCoeff(h->p))) return 2;
1595 j = kFindDivisibleByInT(strat, h,start);
1596 if(j < 0)
1597 {
1598 if(strat->tl >= 0)
1599 h->i_r1 = strat->tl;
1600 else
1601 h->i_r1 = -1;
1602 if (h->GetLmTailRing() == NULL)
1603 {
1604 kDeleteLcm(h);
1605 h->Clear();
1606 return 0;
1607 }
1608 //Check for sigdrop after reduction
1609 if(pLtCmp(beforeredsig,h->sig) == 1)
1610 {
1611 strat->sigdrop = TRUE;
1612 //Reduce it as much as you can
1613 int red_result = redRing(h,strat);
1614 if(red_result == 0)
1615 {
1616 //It reduced to 0, cancel the sigdrop
1617 strat->sigdrop = FALSE;
1618 p_Delete(&h->sig,currRing);h->sig = NULL;
1619 return 0;
1620 }
1621 else
1622 {
1623 //strat->enterS(*h, strat->sl+1, strat, strat->tl);
1624 return 0;
1625 }
1626 }
1627 p_Delete(&beforeredsig,currRing);
1628 return 1;
1629 }
1630 }
1631
1632 li = strat->T[j].pLength;
1633 if (li<=0) li=strat->T[j].GetpLength();
1634 ii = j;
1635 /*
1636 * the polynomial to reduce with (up to the moment) is;
1637 * pi with length li
1638 */
1639 i = j;
1640 if (test_opt_length)
1641 loop
1642 {
1643 /*- search the shortest possible with respect to length -*/
1644 i++;
1645 if (i > strat->tl)
1646 break;
1647 if (li==1)
1648 break;
1649 if ((strat->T[i].pLength < li)
1650 && n_DivBy(pGetCoeff(h_p),pGetCoeff(strat->T[i].p),currRing->cf)
1651 && p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1652 h_p, not_sev, strat->tailRing))
1653 {
1654 /*
1655 * the polynomial to reduce with is now;
1656 */
1657 li = strat->T[i].pLength;
1658 if (li<=0) li=strat->T[i].GetpLength();
1659 ii = i;
1660 }
1661 }
1662
1663 start = ii+1;
1664
1665 /*
1666 * end of search: have to reduce with pi
1667 */
1668#ifdef KDEBUG
1669 if (TEST_OPT_DEBUG)
1670 {
1671 PrintS("red:");
1672 h->wrp();
1673 PrintS(" with ");
1674 strat->T[ii].wrp();
1675 }
1676#endif
1677 assume(strat->fromT == FALSE);
1678//#if 1
1679#ifdef DEBUGF5
1680 Print("BEFORE REDUCTION WITH %d:\n",ii);
1681 Print("--------------------------------\n");
1682 pWrite(h->sig);
1683 pWrite(strat->T[ii].sig);
1684 pWrite(h->GetLmCurrRing());
1685 pWrite(pHead(h->p1));
1686 pWrite(pHead(h->p2));
1687 pWrite(pHead(strat->T[ii].p));
1688 Print("--------------------------------\n");
1689 printf("INDEX OF REDUCER T: %d\n",ii);
1690#endif
1691 sigSafe = ksReducePolySigRing(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
1692 if(h->p == NULL && h->sig == NULL)
1693 {
1694 //Trivial case catch
1695 strat->sigdrop = FALSE;
1696 }
1697 #if 0
1698 //If the reducer has the same lt (+ or -) as the other one, reduce it via redRing
1699 //In some cases this proves to be very bad
1700 if(rField_is_Ring(currRing) && h->p != NULL && pLmCmp(h->p,strat->T[ii].p)==0)
1701 {
1702 int red_result = redRing(h,strat);
1703 if(red_result == 0)
1704 {
1705 pDelete(&h->sig);h->sig = NULL;
1706 return 0;
1707 }
1708 else
1709 {
1710 strat->sigdrop = TRUE;
1711 return 1;
1712 }
1713 }
1714 #endif
1715 if(strat->sigdrop)
1716 return 1;
1717#if SBA_PRINT_REDUCTION_STEPS
1718 if (sigSafe != 3)
1719 sba_reduction_steps++;
1720#endif
1721#if SBA_PRINT_OPERATIONS
1722 if (sigSafe != 3)
1723 sba_operations += pLength(strat->T[ii].p);
1724#endif
1725 // if reduction has taken place, i.e. the reduction was sig-safe
1726 // otherwise start is already at the next position and the loop
1727 // searching reducers in T goes on from index start
1728//#if 1
1729#ifdef DEBUGF5
1730 Print("SigSAFE: %d\n",sigSafe);
1731#endif
1732 if (sigSafe != 3)
1733 {
1734 // start the next search for reducers in T from the beginning
1735 start = 0;
1736#ifdef KDEBUG
1737 if (TEST_OPT_DEBUG)
1738 {
1739 PrintS("\nto ");
1740 h->wrp();
1741 PrintLn();
1742 }
1743#endif
1744
1745 h_p = h->GetLmTailRing();
1746 if (h_p == NULL)
1747 {
1748 kDeleteLcm(h);
1749 return 0;
1750 }
1751 h->SetShortExpVector();
1752 not_sev = ~ h->sev;
1753 /*
1754 * try to reduce the s-polynomial h
1755 *test first whether h should go to the lazyset L
1756 *-if the degree jumps
1757 *-if the number of pre-defined reductions jumps
1758 */
1759 pass++;
1760 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
1761 {
1762 h->SetLmCurrRing();
1763 at = strat->posInL(strat->L,strat->Ll,h,strat);
1764 if (at <= strat->Ll)
1765 {
1766 int dummy=strat->sl;
1767 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1768 {
1769 return 1;
1770 }
1771 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1772#ifdef KDEBUG
1773 if (TEST_OPT_DEBUG)
1774 Print(" lazy: -> L%d\n",at);
1775#endif
1776 h->Clear();
1777 return -1;
1778 }
1779 }
1780 }
1781 }
1782}
bool sigdrop
Definition kutil.h:357
int redRing(LObject *h, kStrategy strat)
Definition kstd2.cc:988
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition kutil.cc:10758
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
Definition kutil.cc:1688
#define pLtCmp(p, q)
Definition polys.h:124
#define pDelete(p_ptr)
Definition polys.h:187

◆ redtailSba()

poly redtailSba ( LObject * L,
int pos,
kStrategy strat,
BOOLEAN withT,
BOOLEAN normalize )

Definition at line 1785 of file kstd2.cc.

1786{
1787 strat->redTailChange=FALSE;
1788 if (strat->noTailReduction) return L->GetLmCurrRing();
1789 poly h, p;
1790 p = h = L->GetLmTailRing();
1791 if ((h==NULL) || (pNext(h)==NULL))
1792 return L->GetLmCurrRing();
1793
1794 TObject* With;
1795 // placeholder in case strat->tl < 0
1796 TObject With_s(strat->tailRing);
1797
1798 LObject Ln(pNext(h), strat->tailRing);
1799 Ln.sig = L->sig;
1800 Ln.sevSig = L->sevSig;
1801 Ln.pLength = L->GetpLength() - 1;
1802
1803 pNext(h) = NULL;
1804 if (L->p != NULL) pNext(L->p) = NULL;
1805 L->pLength = 1;
1806
1807 Ln.PrepareRed(strat->use_buckets);
1808
1809 int cnt=REDTAIL_CANONICALIZE;
1810 while(!Ln.IsNull())
1811 {
1812 loop
1813 {
1814 if(rField_is_Ring(currRing) && strat->sigdrop)
1815 break;
1816 Ln.SetShortExpVector();
1817 if (withT)
1818 {
1819 int j;
1820 j = kFindDivisibleByInT(strat, &Ln);
1821 if (j < 0) break;
1822 With = &(strat->T[j]);
1823 }
1824 else
1825 {
1826 With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
1827 if (With == NULL) break;
1828 }
1829 cnt--;
1830 if (cnt==0)
1831 {
1833 /*poly tmp=*/Ln.CanonicalizeP();
1835 {
1836 Ln.Normalize();
1837 //pNormalize(tmp);
1838 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1839 }
1840 }
1842 {
1843 With->pNorm();
1844 }
1845 strat->redTailChange=TRUE;
1846 int ret = ksReducePolyTailSig(L, With, &Ln, strat);
1848 L->sig = Ln.sig;
1849 //Because Ln.sig is set to L->sig, but in ksReducePolyTailSig -> ksReducePolySig
1850 // I delete it an then set Ln.sig. Hence L->sig is lost
1851#if SBA_PRINT_REDUCTION_STEPS
1852 if (ret != 3)
1853 sba_reduction_steps++;
1854#endif
1855#if SBA_PRINT_OPERATIONS
1856 if (ret != 3)
1857 sba_operations += pLength(With->p);
1858#endif
1859 if (ret)
1860 {
1861 // reducing the tail would violate the exp bound
1862 // set a flag and hope for a retry (in bba)
1864 if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
1865 do
1866 {
1867 pNext(h) = Ln.LmExtractAndIter();
1868 pIter(h);
1869 L->pLength++;
1870 } while (!Ln.IsNull());
1871 goto all_done;
1872 }
1873 if (Ln.IsNull()) goto all_done;
1874 if (! withT) With_s.Init(currRing);
1875 if(rField_is_Ring(currRing) && strat->sigdrop)
1876 {
1877 //Cannot break the loop here so easily
1878 break;
1879 }
1880 }
1881 pNext(h) = Ln.LmExtractAndIter();
1882 pIter(h);
1884 pNormalize(h);
1885 L->pLength++;
1886 }
1887 all_done:
1888 Ln.Delete();
1889 if (L->p != NULL) pNext(L->p) = pNext(p);
1890
1891 if (strat->redTailChange)
1892 {
1893 L->length = 0;
1894 }
1895 //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
1896 //L->Normalize(); // HANNES: should have a test
1897 kTest_L(L,strat);
1898 return L->GetLmCurrRing();
1899}
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
Definition kstd2.cc:1331
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition kutil.cc:6697
BOOLEAN kTest_L(LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
Definition kutil.cc:916
#define REDTAIL_CANONICALIZE
Definition kutil.h:39
#define pIter(p)
Definition monomials.h:37
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition syz3.cc:1027

◆ rightgb()

ideal rightgb ( ideal F,
const ideal Q )

Definition at line 4935 of file kstd2.cc.

4936{
4938 assume(idIsInV(F));
4939 ideal RS = kStdShift(F, Q, testHomog, NULL, NULL, 0, 0, NULL, TRUE);
4940 idSkipZeroes(RS); // is this even necessary?
4941 assume(idIsInV(RS));
4942 return(RS);
4943}
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2965
#define idIsInV(I)
Definition shiftop.h:49
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
@ testHomog
Definition structs.h:34

◆ sba()

ideal sba ( ideal F0,
ideal Q,
intvec * w,
bigintmat * hilb,
kStrategy strat )

Definition at line 2971 of file kstd2.cc.

2972{
2973 // ring order stuff:
2974 // in sba we have (until now) two possibilities:
2975 // 1. an incremental computation w.r.t. (C,monomial order)
2976 // 2. a (possibly non-incremental) computation w.r.t. the
2977 // induced Schreyer order.
2978 // The corresponding orders are computed in sbaRing(), depending
2979 // on the flag strat->sbaOrder
2980#if SBA_PRINT_ZERO_REDUCTIONS
2981 long zeroreductions = 0;
2982#endif
2983#if SBA_PRINT_PRODUCT_CRITERION
2984 long product_criterion = 0;
2985#endif
2986#if SBA_PRINT_SIZE_G
2987 int size_g = 0;
2988 int size_g_non_red = 0;
2989#endif
2990#if SBA_PRINT_SIZE_SYZ
2991 long size_syz = 0;
2992#endif
2993 // global variable
2994#if SBA_PRINT_REDUCTION_STEPS
2995 sba_reduction_steps = 0;
2996 sba_interreduction_steps = 0;
2997#endif
2998#if SBA_PRINT_OPERATIONS
2999 sba_operations = 0;
3000 sba_interreduction_operations = 0;
3001#endif
3002
3003 ideal F1 = F0;
3004 ring currRingOld = currRing;
3005 ring sRing = currRing;
3006 if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
3007 {
3008 sRing = sbaRing(strat);
3009 if (sRing!=currRingOld)
3010 {
3011 rChangeCurrRing (sRing);
3012 F1 = idrMoveR (F0, currRingOld, currRing);
3013 }
3014 }
3015 ideal F;
3016 // sort ideal F
3017 //Put the SigDrop element on the correct position (think of sbaEnterS)
3018 //We also sort them
3019 if(rField_is_Ring(currRing) && strat->sigdrop)
3020 {
3021 #if 1
3022 F = idInit(IDELEMS(F1),F1->rank);
3023 for (int i=0; i<IDELEMS(F1);++i)
3024 F->m[i] = F1->m[i];
3025 if(strat->sbaEnterS >= 0)
3026 {
3027 poly dummy;
3028 dummy = pCopy(F->m[0]); //the sigdrop element
3029 for(int i = 0;i<strat->sbaEnterS;i++)
3030 F->m[i] = F->m[i+1];
3031 F->m[strat->sbaEnterS] = dummy;
3032 }
3033 #else
3034 F = idInit(1,F1->rank);
3035 //printf("\nBefore the initial block sorting:\n");idPrint(F1);
3036 F->m[0] = F1->m[0];
3037 int pos;
3038 if(strat->sbaEnterS >= 0)
3039 {
3040 for(int i=1;i<=strat->sbaEnterS;i++)
3041 {
3042 pos = posInIdealMonFirst(F,F1->m[i],1,strat->sbaEnterS);
3043 idInsertPolyOnPos(F,F1->m[i],pos);
3044 }
3045 for(int i=strat->sbaEnterS+1;i<IDELEMS(F1);i++)
3046 {
3047 pos = posInIdealMonFirst(F,F1->m[i],strat->sbaEnterS+1,IDELEMS(F));
3048 idInsertPolyOnPos(F,F1->m[i],pos);
3049 }
3050 poly dummy;
3051 dummy = pCopy(F->m[0]); //the sigdrop element
3052 for(int i = 0;i<strat->sbaEnterS;i++)
3053 F->m[i] = F->m[i+1];
3054 F->m[strat->sbaEnterS] = dummy;
3055 }
3056 else
3057 {
3058 for(int i=1;i<IDELEMS(F1);i++)
3059 {
3060 pos = posInIdealMonFirst(F,F1->m[i],1,IDELEMS(F));
3061 idInsertPolyOnPos(F,F1->m[i],pos);
3062 }
3063 }
3064 #endif
3065 //printf("\nAfter the initial block sorting:\n");idPrint(F);getchar();
3066 }
3067 else
3068 {
3069 F = idInit(IDELEMS(F1),F1->rank);
3070 intvec *sort = idSort(F1);
3071 for (int i=0; i<sort->length();++i)
3072 F->m[i] = F1->m[(*sort)[i]-1];
3074 {
3075 // put the monomials after the sbaEnterS polynomials
3076 //printf("\nThis is the ideal before sorting (sbaEnterS = %i)\n",strat->sbaEnterS);idPrint(F);
3077 int nrmon = 0;
3078 for(int i = IDELEMS(F)-1,j;i>strat->sbaEnterS+nrmon+1 ;i--)
3079 {
3080 //pWrite(F->m[i]);
3081 if(F->m[i] != NULL && pNext(F->m[i]) == NULL)
3082 {
3083 poly mon = F->m[i];
3084 for(j = i;j>strat->sbaEnterS+nrmon+1;j--)
3085 {
3086 F->m[j] = F->m[j-1];
3087 }
3088 F->m[j] = mon;
3089 nrmon++;
3090 }
3091 //idPrint(F);
3092 }
3093 }
3094 }
3095 //printf("\nThis is the ideal after sorting\n");idPrint(F);getchar();
3097 strat->sigdrop = FALSE;
3098 strat->nrsyzcrit = 0;
3099 strat->nrrewcrit = 0;
3100#if SBA_INTERRED_START
3101 F = kInterRed(F,NULL);
3102#endif
3103#if F5DEBUG
3104 printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
3105 rWrite (currRing);
3106 printf("ordSgn = %d\n",currRing->OrdSgn);
3107 printf("\n");
3108#endif
3109 int srmax,lrmax, red_result = 1;
3110 int olddeg,reduc;
3111 int hilbeledeg=1,hilbcount=0,minimcnt=0;
3112 LObject L;
3113 BOOLEAN withT = TRUE;
3114 strat->max_lower_index = 0;
3115 //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
3116 initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
3117 initSbaPos(strat);
3118 initHilbCrit(F,Q,&hilb,strat);
3119 initSba(F,strat);
3120 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3121 /*Shdl=*/initSbaBuchMora(F, Q,strat);
3122 idTest(strat->Shdl);
3123 if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
3124 srmax = strat->sl;
3125 reduc = olddeg = lrmax = 0;
3126#ifndef NO_BUCKETS
3128 strat->use_buckets = 1;
3129#endif
3130
3131 // redtailBBa against T for inhomogeneous input
3132 // if (!TEST_OPT_OLDSTD)
3133 // withT = ! strat->homog;
3134
3135 // strat->posInT = posInT_pLength;
3136 kTest_TS(strat);
3137
3138#ifdef HAVE_TAIL_RING
3139 if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
3141#endif
3142 // We add the elements directly in S from the previous loop
3143 if(rField_is_Ring(currRing) && strat->sbaEnterS >= 0)
3144 {
3145 for(int i = 0;i<strat->sbaEnterS;i++)
3146 {
3147 //Update: now the element is at the correct place
3148 //i+1 because on the 0 position is the sigdrop element
3149 enterT(&strat->L[strat->Ll-(i)],strat);
3150 strat->enterS(&strat->L[strat->Ll-(i)], strat->sl+1, strat, strat->tl);
3151 }
3152 strat->Ll = strat->Ll - strat->sbaEnterS;
3153 strat->sbaEnterS = -1;
3154 }
3155 kTest_TS(strat);
3156#ifdef KDEBUG
3157 //kDebugPrint(strat);
3158#endif
3159 /* compute------------------------------------------------------- */
3160 while (strat->Ll >= 0)
3161 {
3162 if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
3163 #ifdef KDEBUG
3164 if (TEST_OPT_DEBUG) messageSets(strat);
3165 #endif
3166 if (strat->Ll== 0) strat->interpt=TRUE;
3167 /*
3168 if (TEST_OPT_DEGBOUND
3169 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3170 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
3171 {
3172
3173 //stops computation if
3174 // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
3175 //a predefined number Kstd1_deg
3176 while ((strat->Ll >= 0)
3177 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
3178 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
3179 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
3180 )
3181 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
3182 if (strat->Ll<0) break;
3183 else strat->noClearS=TRUE;
3184 }
3185 */
3186 if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
3187 {
3188 strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
3189#if F5C
3190 // 1. interreduction of the current standard basis
3191 // 2. generation of new principal syzygy rules for syzCriterion
3192 f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
3193 lrmax, reduc, Q, w, hilb );
3194#endif
3195 // initialize new syzygy rules for the next iteration step
3196 initSyzRules(strat);
3197 }
3198 /*********************************************************************
3199 * interrreduction step is done, we can go on with the next iteration
3200 * step of the signature-based algorithm
3201 ********************************************************************/
3202 /* picks the last element from the lazyset L */
3203 strat->P = strat->L[strat->Ll];
3204 strat->Ll--;
3205
3207 strat->sbaEnterS = pGetComp(strat->P.sig) - 1;
3208 /* reduction of the element chosen from L */
3209 if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1))
3210 {
3211 //#if 1
3212#ifdef DEBUGF5
3213 PrintS("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
3214 PrintS("-------------------------------------------------\n");
3215 pWrite(strat->P.sig);
3216 pWrite(pHead(strat->P.p));
3217 pWrite(pHead(strat->P.p1));
3218 pWrite(pHead(strat->P.p2));
3219 PrintS("-------------------------------------------------\n");
3220#endif
3221 if (pNext(strat->P.p) == strat->tail)
3222 {
3223 // deletes the short spoly
3224 /*
3225 if (rField_is_Ring(currRing))
3226 pLmDelete(strat->P.p);
3227 else
3228 pLmFree(strat->P.p);
3229*/
3230 // TODO: needs some masking
3231 // TODO: masking needs to vanish once the signature
3232 // stuff is completely implemented
3233 strat->P.p = NULL;
3234 poly m1 = NULL, m2 = NULL;
3235
3236 // check that spoly creation is ok
3237 while (strat->tailRing != currRing &&
3238 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
3239 {
3240 assume(m1 == NULL && m2 == NULL);
3241 // if not, change to a ring where exponents are at least
3242 // large enough
3243 if (!kStratChangeTailRing(strat))
3244 {
3245 WerrorS("OVERFLOW...");
3246 break;
3247 }
3248 }
3249 // create the real one
3250 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
3251 strat->tailRing, m1, m2, strat->R);
3252
3253 }
3254 else if (strat->P.p1 == NULL)
3255 {
3256 if (strat->minim > 0)
3257 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
3258 // for input polys, prepare reduction
3260 strat->P.PrepareRed(strat->use_buckets);
3261 }
3262 if (strat->P.p == NULL && strat->P.t_p == NULL)
3263 {
3264 red_result = 0;
3265 }
3266 else
3267 {
3268 //#if 1
3269#ifdef DEBUGF5
3270 PrintS("Poly before red: ");
3271 pWrite(pHead(strat->P.p));
3272 pWrite(strat->P.sig);
3273#endif
3274#if SBA_PRODUCT_CRITERION
3275 if (strat->P.prod_crit)
3276 {
3277#if SBA_PRINT_PRODUCT_CRITERION
3278 product_criterion++;
3279#endif
3280 int pos = posInSyz(strat, strat->P.sig);
3281 enterSyz(strat->P, strat, pos);
3282 kDeleteLcm(&strat->P);
3283 red_result = 2;
3284 }
3285 else
3286 {
3287 red_result = strat->red(&strat->P,strat);
3288 }
3289#else
3290 red_result = strat->red(&strat->P,strat);
3291#endif
3292 }
3293 }
3294 else
3295 {
3296 /*
3297 if (strat->P.lcm != NULL)
3298 pLmFree(strat->P.lcm);
3299 */
3300 red_result = 2;
3301 }
3303 {
3304 if(strat->P.sig!= NULL && !nGreaterZero(pGetCoeff(strat->P.sig)))
3305 {
3306 strat->P.p = pNeg(strat->P.p);
3307 strat->P.sig = pNeg(strat->P.sig);
3308 }
3309 strat->P.pLength = pLength(strat->P.p);
3310 if(strat->P.sig != NULL)
3311 strat->P.sevSig = pGetShortExpVector(strat->P.sig);
3312 if(strat->P.p != NULL)
3313 strat->P.sev = pGetShortExpVector(strat->P.p);
3314 }
3315 //sigdrop case
3316 if(rField_is_Ring(currRing) && strat->sigdrop)
3317 {
3318 //First reduce it as much as one can
3319 red_result = redRing(&strat->P,strat);
3320 if(red_result == 0)
3321 {
3322 strat->sigdrop = FALSE;
3323 pDelete(&strat->P.sig);
3324 strat->P.sig = NULL;
3325 }
3326 else
3327 {
3328 strat->enterS(&strat->P, 0, strat, strat->tl);
3329 if (TEST_OPT_PROT)
3330 PrintS("-");
3331 break;
3332 }
3333 }
3334 if(rField_is_Ring(currRing) && strat->blockred > strat->blockredmax)
3335 {
3336 strat->sigdrop = TRUE;
3337 break;
3338 }
3339
3340 if (errorreported) break;
3341
3342//#if 1
3343#ifdef DEBUGF5
3344 if (red_result != 0)
3345 {
3346 PrintS("Poly after red: ");
3347 pWrite(pHead(strat->P.p));
3348 pWrite(strat->P.GetLmCurrRing());
3349 pWrite(strat->P.sig);
3350 printf("%d\n",red_result);
3351 }
3352#endif
3353 if (TEST_OPT_PROT)
3354 {
3355 if(strat->P.p != NULL)
3356 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3357 &olddeg,&reduc,strat, red_result);
3358 else
3359 message((strat->honey ? strat->P.ecart : 0),
3360 &olddeg,&reduc,strat, red_result);
3361 }
3362
3363 if (strat->overflow)
3364 {
3365 if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
3366 }
3367 // reduction to non-zero new poly
3368 if (red_result == 1)
3369 {
3370 // get the polynomial (canonicalize bucket, make sure P.p is set)
3371 strat->P.GetP(strat->lmBin);
3372
3373 // sig-safe computations may lead to wrong FDeg computation, thus we need
3374 // to recompute it to make sure everything is alright
3375 (strat->P).FDeg = (strat->P).pFDeg();
3376 // in the homogeneous case FDeg >= pFDeg (sugar/honey)
3377 // but now, for entering S, T, we reset it
3378 // in the inhomogeneous case: FDeg == pFDeg
3379 if (strat->homog) strat->initEcart(&(strat->P));
3380
3381 /* statistic */
3382 if (TEST_OPT_PROT) PrintS("s");
3383
3384 //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3385 // in F5E we know that the last reduced element is already the
3386 // the one with highest signature
3387 int pos = strat->sl+1;
3388
3389 // reduce the tail and normalize poly
3390 // in the ring case we cannot expect LC(f) = 1,
3391 poly beforetailred;
3393 beforetailred = pCopy(strat->P.sig);
3394#if SBA_TAIL_RED
3396 {
3398 strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
3399 }
3400 else
3401 {
3402 if (strat->sbaOrder != 2)
3403 {
3405 {
3406 strat->P.pCleardenom();
3408 {
3409 strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
3410 strat->P.pCleardenom();
3411 }
3412 }
3413 else
3414 {
3415 strat->P.pNorm();
3417 strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
3418 }
3419 }
3420 }
3421 // It may happen that we have lost the sig in redtailsba
3422 // It cannot reduce to 0 since here we are doing just tail reduction.
3423 // Best case scenario: remains the leading term
3424 if(rField_is_Ring(currRing) && strat->sigdrop)
3425 {
3426 strat->enterS(&strat->P, 0, strat, strat->tl);
3427 break;
3428 }
3429#endif
3431 {
3432 if(strat->P.sig == NULL || pLtCmp(beforetailred,strat->P.sig) == 1)
3433 {
3434 strat->sigdrop = TRUE;
3435 //Reduce it as much as you can
3436 red_result = redRing(&strat->P,strat);
3437 if(red_result == 0)
3438 {
3439 //It reduced to 0, cancel the sigdrop
3440 strat->sigdrop = FALSE;
3441 p_Delete(&strat->P.sig,currRing);strat->P.sig = NULL;
3442 }
3443 else
3444 {
3445 strat->enterS(&strat->P, 0, strat, strat->tl);
3446 break;
3447 }
3448 }
3449 p_Delete(&beforetailred,currRing);
3450 // strat->P.p = NULL may appear if we had a sigdrop above and reduced to 0 via redRing
3451 if(strat->P.p == NULL)
3452 goto case_when_red_result_changed;
3453 }
3454 // remove sigsafe label since it is no longer valid for the next element to
3455 // be reduced
3456 if (strat->sbaOrder == 1)
3457 {
3458 for (int jj = 0; jj<strat->tl+1; jj++)
3459 {
3460 if (pGetComp(strat->T[jj].sig) == strat->currIdx)
3461 {
3462 strat->T[jj].is_sigsafe = FALSE;
3463 }
3464 }
3465 }
3466 else
3467 {
3468 for (int jj = 0; jj<strat->tl+1; jj++)
3469 {
3470 strat->T[jj].is_sigsafe = FALSE;
3471 }
3472 }
3473#ifdef KDEBUG
3474 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3475#endif /* KDEBUG */
3476
3477 // min_std stuff
3478 if ((strat->P.p1==NULL) && (strat->minim>0))
3479 {
3480 if (strat->minim==1)
3481 {
3482 strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3483 p_Delete(&strat->P.p2, currRing, strat->tailRing);
3484 }
3485 else
3486 {
3487 strat->M->m[minimcnt]=strat->P.p2;
3488 strat->P.p2=NULL;
3489 }
3490 if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3491 pNext(strat->M->m[minimcnt])
3492 = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3493 strat->tailRing, currRing,
3494 currRing->PolyBin);
3495 minimcnt++;
3496 }
3497
3498 // enter into S, L, and T
3499 //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3500 enterT(&strat->P, strat);
3501 strat->T[strat->tl].is_sigsafe = FALSE;
3502 /*
3503 printf("hier\n");
3504 pWrite(strat->P.GetLmCurrRing());
3505 pWrite(strat->P.sig);
3506 */
3508 superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
3509 else
3510 enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
3511 if(rField_is_Ring(currRing) && strat->sigdrop)
3512 break;
3514 strat->P.sevSig = p_GetShortExpVector(strat->P.sig,currRing);
3515 strat->enterS(&strat->P, pos, strat, strat->tl);
3516 if(strat->sbaOrder != 1)
3517 {
3518 BOOLEAN overwrite = FALSE;
3519 for (int tk=0; tk<strat->sl+1; tk++)
3520 {
3521 if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
3522 {
3523 //printf("TK %d / %d\n",tk,strat->sl);
3524 overwrite = FALSE;
3525 break;
3526 }
3527 }
3528 //printf("OVERWRITE %d\n",overwrite);
3529 if (overwrite)
3530 {
3531 int cmp = pGetComp(strat->P.sig);
3532 int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
3533 p_GetExpV (strat->P.p,vv,currRing);
3534 p_SetExpV (strat->P.sig, vv,currRing);
3535 p_SetComp (strat->P.sig,cmp,currRing);
3536
3537 strat->P.sevSig = pGetShortExpVector (strat->P.sig);
3538 int i;
3539 LObject Q;
3540 for(int ps=0;ps<strat->sl+1;ps++)
3541 {
3542
3543 strat->newt = TRUE;
3544 if (strat->syzl == strat->syzmax)
3545 {
3546 pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
3547 strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
3548 (strat->syzmax)*sizeof(unsigned long),
3549 ((strat->syzmax)+setmaxTinc)
3550 *sizeof(unsigned long));
3551 strat->syzmax += setmaxTinc;
3552 }
3553 Q.sig = pCopy(strat->P.sig);
3554 // add LM(F->m[i]) to the signature to get a Schreyer order
3555 // without changing the underlying polynomial ring at all
3556 if (strat->sbaOrder == 0)
3557 p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
3558 // since p_Add_q() destroys all input
3559 // data we need to recreate help
3560 // each time
3561 // ----------------------------------------------------------
3562 // in the Schreyer order we always know that the multiplied
3563 // module monomial strat->P.sig gives the leading monomial of
3564 // the corresponding principal syzygy
3565 // => we do not need to compute the "real" syzygy completely
3566 poly help = p_Copy(strat->sig[ps],currRing);
3567 p_ExpVectorAdd (help,strat->P.p,currRing);
3568 Q.sig = p_Add_q(Q.sig,help,currRing);
3569 //printf("%d. SYZ ",i+1);
3570 //pWrite(strat->syz[i]);
3571 Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
3572 i = posInSyz(strat, Q.sig);
3573 enterSyz(Q, strat, i);
3574 }
3575 }
3576 }
3577 // deg - idx - lp/rp
3578 // => we need to add syzygies with indices > pGetComp(strat->P.sig)
3579 if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
3580 {
3581 int cmp = pGetComp(strat->P.sig);
3582 unsigned max_cmp = IDELEMS(F);
3583 int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
3584 p_GetExpV (strat->P.p,vv,currRing);
3585 LObject Q;
3586 int pos;
3587 int idx = __p_GetComp(strat->P.sig,currRing);
3588 //printf("++ -- adding syzygies -- ++\n");
3589 // if new element is the first one in this index
3590 if (strat->currIdx < idx)
3591 {
3592 for (int i=0; i<strat->sl; ++i)
3593 {
3594 Q.sig = p_Copy(strat->P.sig,currRing);
3595 p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
3596 poly help = p_Copy(strat->sig[i],currRing);
3597 p_ExpVectorAdd(help,strat->P.p,currRing);
3598 Q.sig = p_Add_q(Q.sig,help,currRing);
3599 //pWrite(Q.sig);
3600 pos = posInSyz(strat, Q.sig);
3601 enterSyz(Q, strat, pos);
3602 }
3603 strat->currIdx = idx;
3604 }
3605 else
3606 {
3607 // if the element is not the first one in the given index we build all
3608 // possible syzygies with elements of higher index
3609 for (unsigned i=cmp+1; i<=max_cmp; ++i)
3610 {
3611 pos = -1;
3612 for (int j=0; j<strat->sl; ++j)
3613 {
3614 if (__p_GetComp(strat->sig[j],currRing) == i)
3615 {
3616 pos = j;
3617 break;
3618 }
3619 }
3620 if (pos != -1)
3621 {
3622 Q.sig = p_One(currRing);
3623 p_SetExpV(Q.sig, vv, currRing);
3624 // F->m[i-1] corresponds to index i
3625 p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
3626 p_SetComp(Q.sig, i, currRing);
3627 poly help = p_Copy(strat->P.sig,currRing);
3628 p_ExpVectorAdd(help,strat->S[pos],currRing);
3629 Q.sig = p_Add_q(Q.sig,help,currRing);
3630 if (strat->sbaOrder == 0)
3631 {
3632 if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn)
3633 {
3634 pos = posInSyz(strat, Q.sig);
3635 enterSyz(Q, strat, pos);
3636 }
3637 }
3638 else
3639 {
3640 pos = posInSyz(strat, Q.sig);
3641 enterSyz(Q, strat, pos);
3642 }
3643 }
3644 }
3645 //printf("++ -- done adding syzygies -- ++\n");
3646 }
3647 }
3648//#if 1
3649#if DEBUGF50
3650 printf("---------------------------\n");
3651 Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
3652 PrintS("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
3653 PrintS("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
3654#endif
3655 /*
3656 if (newrules)
3657 {
3658 newrules = FALSE;
3659 }
3660 */
3661#if 0
3662 int pl=pLength(strat->P.p);
3663 if (pl==1)
3664 {
3665 //if (TEST_OPT_PROT)
3666 //PrintS("<1>");
3667 }
3668 else if (pl==2)
3669 {
3670 //if (TEST_OPT_PROT)
3671 //PrintS("<2>");
3672 }
3673#endif
3674 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3675// Print("[%d]",hilbeledeg);
3676 kDeleteLcm(&strat->P);
3677 if (strat->sl>srmax) srmax = strat->sl;
3678 }
3679 else
3680 {
3681 case_when_red_result_changed:
3682 // adds signature of the zero reduction to
3683 // strat->syz. This is the leading term of
3684 // syzygy and can be used in syzCriterion()
3685 // the signature is added if and only if the
3686 // pair was not detected by the rewritten criterion in strat->red = redSig
3687 if (red_result!=2)
3688 {
3689#if SBA_PRINT_ZERO_REDUCTIONS
3690 zeroreductions++;
3691#endif
3692 if(rField_is_Ring(currRing) && strat->P.p == NULL && strat->P.sig == NULL)
3693 {
3694 //Catch the case when p = 0, sig = 0
3695 }
3696 else
3697 {
3698 int pos = posInSyz(strat, strat->P.sig);
3699 enterSyz(strat->P, strat, pos);
3700 //#if 1
3701 #ifdef DEBUGF5
3702 Print("ADDING STUFF TO SYZ : ");
3703 //pWrite(strat->P.p);
3704 pWrite(strat->P.sig);
3705 #endif
3706 }
3707 }
3708 if (strat->P.p1 == NULL && strat->minim > 0)
3709 {
3710 p_Delete(&strat->P.p2, currRing, strat->tailRing);
3711 }
3712 }
3713
3714#ifdef KDEBUG
3715 strat->P.Init();
3716#endif /* KDEBUG */
3717 kTest_TS(strat);
3718 }
3719 #if 0
3720 if(strat->sigdrop)
3721 printf("\nSigDrop!\n");
3722 else
3723 printf("\nEnded with no SigDrop\n");
3724 #endif
3725// Clean strat->P for the next sba call
3726 if(rField_is_Ring(currRing) && strat->sigdrop)
3727 {
3728 //This is used to know how many elements can we directly add to S in the next run
3729 if(strat->P.sig != NULL)
3730 strat->sbaEnterS = pGetComp(strat->P.sig)-1;
3731 //else we already set it at the beginning of the loop
3732 #ifdef KDEBUG
3733 strat->P.Init();
3734 #endif /* KDEBUG */
3735 }
3736#ifdef KDEBUG
3737 if (TEST_OPT_DEBUG) messageSets(strat);
3738#endif /* KDEBUG */
3739
3740 if (TEST_OPT_SB_1)
3741 {
3743 {
3744 int k=1;
3745 int j;
3746 while(k<=strat->sl)
3747 {
3748 j=0;
3749 loop
3750 {
3751 if (j>=k) break;
3752 clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3753 j++;
3754 }
3755 k++;
3756 }
3757 }
3758 }
3759 /* complete reduction of the standard basis--------- */
3760 if (TEST_OPT_REDSB)
3761 {
3762 completeReduce(strat);
3763 if (strat->completeReduce_retry)
3764 {
3765 // completeReduce needed larger exponents, retry
3766 // to reduce with S (instead of T)
3767 // and in currRing (instead of strat->tailRing)
3768#ifdef HAVE_TAIL_RING
3769 if(currRing->bitmask>strat->tailRing->bitmask)
3770 {
3772 cleanT(strat);strat->tailRing=currRing;
3773 int i;
3774 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3775 completeReduce(strat);
3776 }
3777 if (strat->completeReduce_retry)
3778#endif
3779 Werror("exponent bound is %ld",currRing->bitmask);
3780 }
3781 }
3782 else if (TEST_OPT_PROT) PrintLn();
3783
3784#if SBA_PRINT_SIZE_SYZ
3785 // that is correct, syzl is counting one too far
3786 size_syz = strat->syzl;
3787#endif
3788// if (TEST_OPT_WEIGHTM)
3789// {
3790// pRestoreDegProcs(pFDegOld, pLDegOld);
3791// if (ecartWeights)
3792// {
3793// omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
3794// ecartWeights=NULL;
3795// }
3796// }
3797 if (TEST_OPT_PROT) messageStatSBA(hilbcount,strat);
3798 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3799#if SBA_PRINT_SIZE_G
3800 size_g_non_red = IDELEMS(strat->Shdl);
3801#endif
3803 exitSba(strat);
3804 // I have to add the initial input polynomials which where not used (p1 and p2 = NULL)
3805 int k;
3807 {
3808 //for(k = strat->sl;k>=0;k--)
3809 // {printf("\nS[%i] = %p\n",k,strat->Shdl->m[k]);pWrite(strat->Shdl->m[k]);}
3810 k = strat->Ll;
3811 #if 1
3812 // 1 - adds just the unused ones, 0 - adds everything
3813 for(;k>=0 && (strat->L[k].p1 != NULL || strat->L[k].p2 != NULL);k--)
3814 {
3815 //printf("\nDeleted k = %i, %p\n",k,strat->L[k].p);pWrite(strat->L[k].p);pWrite(strat->L[k].p1);pWrite(strat->L[k].p2);
3816 deleteInL(strat->L,&strat->Ll,k,strat);
3817 }
3818 #endif
3819 //for(int kk = strat->sl;kk>=0;kk--)
3820 // {printf("\nS[%i] = %p\n",kk,strat->Shdl->m[kk]);pWrite(strat->Shdl->m[kk]);}
3821 //idPrint(strat->Shdl);
3822 //printf("\nk = %i\n",k);
3823 for(;k>=0 && strat->L[k].p1 == NULL && strat->L[k].p2 == NULL;k--)
3824 {
3825 //printf("\nAdded k = %i\n",k);
3826 strat->enterS(&strat->L[k], strat->sl+1, strat, strat->tl);
3827 //printf("\nThis elements was added from L on pos %i\n",strat->sl);pWrite(strat->S[strat->sl]);pWrite(strat->sig[strat->sl]);
3828 }
3829 }
3830 // Find the "sigdrop element" and put the same signature as the previous one - do we really need this?? - now i put it on the 0 position - no more comparing needed
3831 #if 0
3832 if(strat->sigdrop && rField_is_Ring(currRing))
3833 {
3834 for(k=strat->sl;k>=0;k--)
3835 {
3836 printf("\nsig[%i] = ",i);pWrite(strat->sig[k]);
3837 if(strat->sig[k] == NULL)
3838 strat->sig[k] = pCopy(strat->sig[k-1]);
3839 }
3840 }
3841 #endif
3842 //Never do this - you will damage S
3843 //idSkipZeroes(strat->Shdl);
3844 //idPrint(strat->Shdl);
3845
3846 if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
3847 {
3848 rChangeCurrRing (currRingOld);
3849 F0 = idrMoveR (F1, sRing, currRing);
3850 strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
3851 rChangeCurrRing (sRing);
3853 exitSba(strat);
3854 rChangeCurrRing (currRingOld);
3855 if(strat->tailRing == sRing)
3856 strat->tailRing = currRing;
3857 rDelete (sRing);
3858 }
3859 if(rField_is_Ring(currRing) && !strat->sigdrop)
3860 id_DelDiv(strat->Shdl, currRing);
3862 id_DelDiv(strat->Shdl, currRing);
3863 idSkipZeroes(strat->Shdl);
3864 idTest(strat->Shdl);
3865
3866#if SBA_PRINT_SIZE_G
3867 size_g = IDELEMS(strat->Shdl);
3868#endif
3869#ifdef DEBUGF5
3870 printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
3871 int oo = 0;
3872 while (oo<IDELEMS(strat->Shdl))
3873 {
3874 printf(" %d. ",oo+1);
3875 pWrite(pHead(strat->Shdl->m[oo]));
3876 oo++;
3877 }
3878#endif
3879#if SBA_PRINT_ZERO_REDUCTIONS
3880 printf("----------------------------------------------------------\n");
3881 printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
3882 zeroreductions = 0;
3883#endif
3884#if SBA_PRINT_REDUCTION_STEPS
3885 printf("----------------------------------------------------------\n");
3886 printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
3887#endif
3888#if SBA_PRINT_OPERATIONS
3889 printf("OPERATIONS: %ld\n",sba_operations);
3890#endif
3891#if SBA_PRINT_REDUCTION_STEPS
3892 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3893 printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
3894#endif
3895#if SBA_PRINT_OPERATIONS
3896 printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
3897#endif
3898#if SBA_PRINT_REDUCTION_STEPS
3899 printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
3900 printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
3901 sba_interreduction_steps = 0;
3902 sba_reduction_steps = 0;
3903#endif
3904#if SBA_PRINT_OPERATIONS
3905 printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
3906 sba_interreduction_operations = 0;
3907 sba_operations = 0;
3908#endif
3909#if SBA_PRINT_SIZE_G
3910 printf("----------------------------------------------------------\n");
3911 printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
3912 size_g = 0;
3913 size_g_non_red = 0;
3914#endif
3915#if SBA_PRINT_SIZE_SYZ
3916 printf("SIZE OF SYZ: %ld\n",size_syz);
3917 printf("----------------------------------------------------------\n");
3918 size_syz = 0;
3919#endif
3920#if SBA_PRINT_PRODUCT_CRITERION
3921 printf("PRODUCT CRITERIA: %ld\n",product_criterion);
3922 product_criterion = 0;
3923#endif
3924 return (strat->Shdl);
3925}
static void sort(int **points, int sizePoints)
unsigned long * sevSyz
Definition kutil.h:322
int nrsyzcrit
Definition kutil.h:358
int nrrewcrit
Definition kutil.h:359
int syzmax
Definition kutil.h:348
int blockred
Definition kutil.h:362
int syzl
Definition kutil.h:348
unsigned sbaOrder
Definition kutil.h:315
int blockredmax
Definition kutil.h:363
polyset syz
Definition kutil.h:306
char newt
Definition kutil.h:398
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:293
int sbaEnterS
Definition kutil.h:360
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3803
void initSba(ideal F, kStrategy strat)
Definition kstd1.cc:1750
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition kstd2.cc:1785
void f5c(kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, bigintmat *hilb)
Definition kstd2.cc:4265
void initSbaPos(kStrategy strat)
Definition kutil.cc:9863
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9343
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4513
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4470
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition kutil.cc:11064
void messageStatSBA(int hilbcount, kStrategy strat)
Definition kutil.cc:7517
void initSyzRules(kStrategy strat)
Definition kutil.cc:7933
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9936
int posInSyz(const kStrategy strat, poly sig)
Definition kutil.cc:5758
void exitSba(kStrategy strat)
Definition kutil.cc:10011
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Definition kutil.cc:4841
void initSbaCrit(kStrategy strat)
Definition kutil.cc:9498
#define setmaxTinc
Definition kutil.h:35
#define help
Definition libparse.cc:1230
#define __p_GetComp(p, r)
Definition monomials.h:63
#define omAlloc(size)
#define omRealloc0Size(addr, o_size, size)
poly p_One(const ring r)
Definition p_polys.cc:1314
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition p_polys.h:1432
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1565
static int p_LmCmp(poly p, poly q, const ring r)
Definition p_polys.h:1601
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541
void rChangeCurrRing(ring r)
Definition polys.cc:16
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:261
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
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.