My Project
Loading...
Searching...
No Matches
Macros | Functions | Variables
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)
 

Variables

VAR int(* test_PosInT )(const TSet T, const int tl, LObject &h)
 
VAR int(* test_PosInL )(const LSet set, const int length, LObject *L, const 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 2618 of file kstd2.cc.

2619{
2620 int red_result = 1;
2621 int olddeg,reduc;
2622 int hilbeledeg=1,hilbcount=0,minimcnt=0;
2624 BITSET save;
2626
2627 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
2629 initBuchMoraPosRing(strat);
2630 else
2631 initBuchMoraPos(strat);
2632 initHilbCrit(F,Q,&hilb,strat);
2633 initBba(strat);
2634 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2635 initBuchMora(F, Q,strat);
2636 if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2637 reduc = olddeg = 0;
2638
2639#ifndef NO_BUCKETS
2641 strat->use_buckets = 1;
2642#endif
2643 // redtailBBa against T for inhomogeneous input
2644 if (!TEST_OPT_OLDSTD)
2645 withT = ! strat->homog;
2646
2647 // strat->posInT = posInT_pLength;
2648 #ifdef KDEBUG
2649 kTest_TS(strat);
2650 #endif
2651
2652#ifdef HAVE_TAIL_RING
2653 if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2655#endif
2656 if (BVERBOSE(23))
2657 {
2658 if (test_PosInT!=NULL) strat->posInT=test_PosInT;
2659 if (test_PosInL!=NULL) strat->posInL=test_PosInL;
2660 kDebugPrint(strat);
2661 }
2662
2663
2664#ifdef KDEBUG
2665 //kDebugPrint(strat);
2666#endif
2667 /* compute------------------------------------------------------- */
2668 while (strat->Ll >= 0)
2669 {
2670 #ifdef KDEBUG
2671 if (TEST_OPT_DEBUG) messageSets(strat);
2672 #endif
2673 if (siCntrlc)
2674 {
2675 while (strat->Ll >= 0)
2676 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2677 strat->noClearS=TRUE;
2678 }
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 *stops computation if
2685 * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2686 *a predefined number Kstd1_deg
2687 */
2688 while ((strat->Ll >= 0)
2689 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2690 && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2691 || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2692 )
2693 {
2694 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2695 if(TEST_OPT_PROT) PrintS("D");
2696 }
2697 if (strat->Ll<0) break;
2698 else strat->noClearS=TRUE;
2699 }
2700 if (strat->Ll== 0) strat->interpt=TRUE;
2701 /* picks the last element from the lazyset L */
2702 strat->P = strat->L[strat->Ll];
2703 strat->Ll--;
2704
2705 if (pNext(strat->P.p) == strat->tail)
2706 {
2707 // deletes the short spoly
2709 pLmDelete(strat->P.p);
2710 else
2711 pLmFree(strat->P.p);
2712 strat->P.p = NULL;
2713 poly m1 = NULL, m2 = NULL;
2714
2715 // check that spoly creation is ok
2716 while (strat->tailRing != currRing &&
2717 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2718 {
2719 assume(m1 == NULL && m2 == NULL);
2720 // if not, change to a ring where exponents are at least
2721 // large enough
2722 if (!kStratChangeTailRing(strat))
2723 {
2724 WerrorS("OVERFLOW...");
2725 break;
2726 }
2727 }
2728 // create the real one
2729 ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2730 strat->tailRing, m1, m2, strat->R);
2731 }
2732 else if (strat->P.p1 == NULL)
2733 {
2734 if (strat->minim > 0)
2735 strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2736 // for input polys, prepare reduction
2737 strat->P.PrepareRed(strat->use_buckets);
2738 }
2739
2740 if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
2741 {
2742 red_result = 0;
2743 }
2744 else
2745 {
2746 if (TEST_OPT_PROT)
2747 message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2748 &olddeg,&reduc,strat, red_result);
2749
2750 /* reduction of the element chosen from L */
2751 red_result = strat->red(&strat->P,strat);
2752 if (errorreported) break;
2753 }
2754
2755 if (strat->overflow)
2756 {
2757 if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
2758 }
2759
2760 // reduction to non-zero new poly
2761 if (red_result == 1)
2762 {
2763 // get the polynomial (canonicalize bucket, make sure P.p is set)
2764 strat->P.GetP(strat->lmBin);
2765 // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2766 // but now, for entering S, T, we reset it
2767 // in the inhomogeneous case: FDeg == pFDeg
2768 if (strat->homog) strat->initEcart(&(strat->P));
2769
2770 /* statistic */
2771 if (TEST_OPT_PROT) PrintS("s");
2772
2773 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2774
2775 // reduce the tail and normalize poly
2776 // in the ring case we cannot expect LC(f) = 1,
2777 strat->redTailChange=FALSE;
2778
2779 /* if we are computing over Z we always want to try and cut down
2780 * the coefficients in the tail terms */
2782 {
2783 redtailBbaAlsoLC_Z(&(strat->P), strat->tl, strat);
2784 }
2785
2787 {
2788 strat->P.pCleardenom();
2790 {
2791 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
2792 strat->P.pCleardenom();
2793 if (strat->redTailChange) { strat->P.t_p=NULL; }
2794 }
2795 }
2796 else
2797 {
2798 strat->P.pNorm();
2800 {
2801 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2802 if (strat->redTailChange) { strat->P.t_p=NULL; }
2803 }
2804 }
2805
2806#ifdef KDEBUG
2807 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2808#endif /* KDEBUG */
2809
2810 // min_std stuff
2811 if ((strat->P.p1==NULL) && (strat->minim>0))
2812 {
2813 if (strat->minim==1)
2814 {
2815 strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2816 p_Delete(&strat->P.p2, currRing, strat->tailRing);
2817 }
2818 else
2819 {
2820 strat->M->m[minimcnt]=strat->P.p2;
2821 strat->P.p2=NULL;
2822 }
2823 if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2824 pNext(strat->M->m[minimcnt])
2825 = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2826 strat->tailRing, currRing,
2827 currRing->PolyBin);
2828 minimcnt++;
2829 }
2830
2831 // enter into S, L, and T
2832 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2833 {
2834 strat->P.SetShortExpVector();
2835 enterT(strat->P, strat);
2837 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2838 else
2839 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2840 // posInS only depends on the leading term
2841 strat->enterS(strat->P, pos, strat, strat->tl);
2842#if 0
2843 int pl=pLength(strat->P.p);
2844 if (pl==1)
2845 {
2846 //if (TEST_OPT_PROT)
2847 //PrintS("<1>");
2848 }
2849 else if (pl==2)
2850 {
2851 //if (TEST_OPT_PROT)
2852 //PrintS("<2>");
2853 }
2854#endif
2855 }
2856 if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2857// Print("[%d]",hilbeledeg);
2858 kDeleteLcm(&strat->P);
2859 if (strat->s_poly!=NULL)
2860 {
2861 // the only valid entries are: strat->P.p,
2862 // strat->tailRing (read-only, keep it)
2863 // (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
2864 if (strat->s_poly(strat))
2865 {
2866 // we are called AFTER enterS, i.e. if we change P
2867 // we have to add it also to S/T
2868 // and add pairs
2869 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2870 enterT(strat->P, strat);
2872 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2873 else
2874 enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2875 strat->enterS(strat->P, pos, strat, strat->tl);
2876 }
2877 }
2878 }
2879 else if (strat->P.p1 == NULL && strat->minim > 0)
2880 {
2881 p_Delete(&strat->P.p2, currRing, strat->tailRing);
2882 }
2883
2884#ifdef KDEBUG
2885 strat->P.Init();
2886 kTest_TS(strat);
2887#endif /* KDEBUG */
2888 }
2889#ifdef KDEBUG
2890 if (TEST_OPT_DEBUG) messageSets(strat);
2891#endif /* KDEBUG */
2892
2893 if (TEST_OPT_SB_1)
2894 {
2896 {
2897 int k=1;
2898 int j;
2899 while(k<=strat->sl)
2900 {
2901 j=0;
2902 loop
2903 {
2904 if (j>=k) break;
2905 clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2906 j++;
2907 }
2908 k++;
2909 }
2910 }
2911 }
2912 /* complete reduction of the standard basis--------- */
2913 if (TEST_OPT_REDSB)
2914 {
2915 completeReduce(strat);
2916 if (strat->completeReduce_retry)
2917 {
2918 // completeReduce needed larger exponents, retry
2919 // to reduce with S (instead of T)
2920 // and in currRing (instead of strat->tailRing)
2921#ifdef HAVE_TAIL_RING
2922 if(currRing->bitmask>strat->tailRing->bitmask)
2923 {
2925 cleanT(strat);strat->tailRing=currRing;
2926 int i;
2927 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2928 completeReduce(strat);
2929 }
2930 if (strat->completeReduce_retry)
2931#endif
2932 Werror("exponent bound is %ld",currRing->bitmask);
2933 }
2934 }
2935 else if (TEST_OPT_PROT) PrintLn();
2936 /* release temp data-------------------------------- */
2937 exitBuchMora(strat);
2938 /* postprocessing for GB over ZZ --------------------*/
2939 if (!errorreported)
2940 {
2942 {
2943 for(int i = 0;i<=strat->sl;i++)
2944 {
2945 if(!nGreaterZero(pGetCoeff(strat->S[i])))
2946 {
2947 strat->S[i] = pNeg(strat->S[i]);
2948 }
2949 }
2950 finalReduceByMon(strat);
2951 for(int i = 0;i<IDELEMS(strat->Shdl);i++)
2952 {
2953 if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
2954 {
2955 strat->S[i] = pNeg(strat->Shdl->m[i]);
2956 }
2957 }
2958 }
2959 //else if (rField_is_Ring(currRing))
2960 // finalReduceByMon(strat);
2961 }
2962// if (TEST_OPT_WEIGHTM)
2963// {
2964// pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
2965// if (ecartWeights)
2966// {
2967// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2968// ecartWeights=NULL;
2969// }
2970// }
2973 /* postprocessing for GB over Q-rings ------------------*/
2974 if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
2975
2976 idTest(strat->Shdl);
2977
2978 return (strat->Shdl);
2979}
#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:355
int * S_2_R
Definition kutil.h:343
ring tailRing
Definition kutil.h:344
int Ll
Definition kutil.h:352
omBin lmBin
Definition kutil.h:345
char honey
Definition kutil.h:376
polyset S
Definition kutil.h:307
int minim
Definition kutil.h:358
TObject ** R
Definition kutil.h:341
ideal M
Definition kutil.h:306
int tl
Definition kutil.h:351
poly tail
Definition kutil.h:335
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:285
ideal Shdl
Definition kutil.h:304
pShallowCopyDeleteProc p_shallow_copy_delete
Definition kutil.h:339
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition kutil.h:287
char use_buckets
Definition kutil.h:382
char interpt
Definition kutil.h:370
char redTailChange
Definition kutil.h:398
char completeReduce_retry
Definition kutil.h:402
void(* initEcart)(TObject *L)
Definition kutil.h:281
LObject P
Definition kutil.h:303
char noClearS
Definition kutil.h:401
char overflow
Definition kutil.h:403
LSet L
Definition kutil.h:328
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:282
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
int sl
Definition kutil.h:349
unsigned long * sevS
Definition kutil.h:323
char homog
Definition kutil.h:371
s_poly_proc_t s_poly
Definition kutil.h:301
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
VAR int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kstd2.cc:83
void kDebugPrint(kStrategy strat)
Definition kutil.cc:11501
VAR int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition kstd2.cc:82
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9744
void enterT(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9136
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7460
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:7137
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9573
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10962
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9831
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:10482
void cleanT(kStrategy strat)
Definition kutil.cc:557
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10074
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:11059
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9428
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10280
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9658
void messageSets(kStrategy strat)
Definition kutil.cc:7533
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7501
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10870
void initHilbCrit(ideal, ideal, bigintmat **hilb, kStrategy strat)
Definition kutil.cc:9410
static void kDeleteLcm(LObject *P)
Definition kutil.h:881
#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 BVERBOSE(a)
Definition options.h:35
#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:515
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
#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 4593 of file kstd2.cc.

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

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

static long ind_fact_2 ( long  arg)
static

Definition at line 600 of file kstd2.cc.

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

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Definition at line 11501 of file kutil.cc.

11502{
11503 printf("red: ");
11504 if (strat->red==redFirst) printf("redFirst\n");
11505 else if (strat->red==redHoney) printf("redHoney\n");
11506 else if (strat->red==redEcart) printf("redEcart\n");
11507 else if (strat->red==redHomog) printf("redHomog\n");
11508 else if (strat->red==redLazy) printf("redLazy\n");
11509 else if (strat->red==redLiftstd) printf("redLiftstd\n");
11510 else printf("%p\n",(void*)strat->red);
11511 printf("posInT: ");
11512 if (strat->posInT==posInT0) printf("posInT0\n");
11513 else if (strat->posInT==posInT1) printf("posInT1\n");
11514 else if (strat->posInT==posInT11) printf("posInT11\n");
11515 else if (strat->posInT==posInT110) printf("posInT110\n");
11516 else if (strat->posInT==posInT13) printf("posInT13\n");
11517 else if (strat->posInT==posInT15) printf("posInT15\n");
11518 else if (strat->posInT==posInT17) printf("posInT17\n");
11519 else if (strat->posInT==posInT17_c) printf("posInT17_c\n");
11520 else if (strat->posInT==posInT19) printf("posInT19\n");
11521 else if (strat->posInT==posInT2) printf("posInT2\n");
11522 else if (strat->posInT==posInT11Ring) printf("posInT11Ring\n");
11523 else if (strat->posInT==posInT110Ring) printf("posInT110Ring\n");
11524 else if (strat->posInT==posInT15Ring) printf("posInT15Ring\n");
11525 else if (strat->posInT==posInT17Ring) printf("posInT17Ring\n");
11526 else if (strat->posInT==posInT17_cRing) printf("posInT17_cRing\n");
11527#ifdef HAVE_MORE_POS_IN_T
11528 else if (strat->posInT==posInT_EcartFDegpLength) printf("posInT_EcartFDegpLength\n");
11529 else if (strat->posInT==posInT_FDegpLength) printf("posInT_FDegpLength\n");
11530 else if (strat->posInT==posInT_pLength) printf("posInT_pLength\n");
11531#endif
11532 else if (strat->posInT==posInT_EcartpLength) printf("posInT_EcartpLength\n");
11533 else printf("%p\n",(void*)strat->posInT);
11534 printf("posInL: ");
11535 if (strat->posInL==posInL0) printf("posInL0\n");
11536 else if (strat->posInL==posInL10) printf("posInL10\n");
11537 else if (strat->posInL==posInL11) printf("posInL11\n");
11538 else if (strat->posInL==posInL110) printf("posInL110\n");
11539 else if (strat->posInL==posInL13) printf("posInL13\n");
11540 else if (strat->posInL==posInL15) printf("posInL15\n");
11541 else if (strat->posInL==posInL17) printf("posInL17\n");
11542 else if (strat->posInL==posInL17_c) printf("posInL17_c\n");
11543 else if (strat->posInL==posInL0) printf("posInL0Ring\n");
11544 else if (strat->posInL==posInL11Ring) printf("posInL11Ring\n");
11545 else if (strat->posInL==posInL11Ringls) printf("posInL11Ringls\n");
11546 else if (strat->posInL==posInL110Ring) printf("posInL110Ring\n");
11547 else if (strat->posInL==posInL15Ring) printf("posInL15Ring\n");
11548 else if (strat->posInL==posInL17Ring) printf("posInL17Ring\n");
11549 else if (strat->posInL==posInL17_cRing) printf("posInL17_cRing\n");
11550 else if (strat->posInL==posInLSpecial) printf("posInLSpecial\n");
11551 else printf("%p\n",(void*)strat->posInL);
11552 printf("enterS: ");
11553 if (strat->enterS==enterSBba) printf("enterSBba\n");
11554 else if (strat->enterS==enterSMora) printf("enterSMora\n");
11555 else if (strat->enterS==enterSMoraNF) printf("enterSMoraNF\n");
11556 else printf("%p\n",(void*)strat->enterS);
11557 printf("initEcart: ");
11558 if (strat->initEcart==initEcartBBA) printf("initEcartBBA\n");
11559 else if (strat->initEcart==initEcartNormal) printf("initEcartNormal\n");
11560 else printf("%p\n",(void*)strat->initEcart);
11561 printf("initEcartPair: ");
11562 if (strat->initEcartPair==initEcartPairBba) printf("initEcartPairBba\n");
11563 else if (strat->initEcartPair==initEcartPairMora) printf("initEcartPairMora\n");
11564 else printf("%p\n",(void*)strat->initEcartPair);
11565 printf("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11566 strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11567 printf("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11568 strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11569 printf("chainCrit: ");
11570 if (strat->chainCrit==chainCritNormal) printf("chainCritNormal\n");
11571 else if (strat->chainCrit==chainCritOpt_1) printf("chainCritOpt_1\n");
11572 else printf("%p\n",(void*)strat->chainCrit);
11573 printf("posInLDependsOnLength=%d\n",
11574 strat->posInLDependsOnLength);
11575 printf("%s\n",showOption());
11576 printf("LDeg: ");
11577 if (currRing->pLDeg==pLDeg0) printf("pLDeg0");
11578 else if (currRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11579 else if (currRing->pLDeg==pLDegb) printf("pLDegb");
11580 else if (currRing->pLDeg==pLDeg1) printf("pLDeg1");
11581 else if (currRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11582 else if (currRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11583 else if (currRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11584 else if (currRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11585 else if (currRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11586 else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11587 else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11588 else if (currRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11589 else printf("? (%lx)", (long)currRing->pLDeg);
11590 printf(" / ");
11591 if (strat->tailRing->pLDeg==pLDeg0) printf("pLDeg0");
11592 else if (strat->tailRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11593 else if (strat->tailRing->pLDeg==pLDegb) printf("pLDegb");
11594 else if (strat->tailRing->pLDeg==pLDeg1) printf("pLDeg1");
11595 else if (strat->tailRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11596 else if (strat->tailRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11597 else if (strat->tailRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11598 else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11599 else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11600 else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11601 else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11602 else if (strat->tailRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11603 else printf("? (%lx)", (long)strat->tailRing->pLDeg);
11604 printf("\n");
11605 printf("currRing->pFDeg: ");
11606 if (currRing->pFDeg==p_Totaldegree) printf("p_Totaldegree");
11607 else if (currRing->pFDeg==p_WFirstTotalDegree) printf("pWFirstTotalDegree");
11608 else if (currRing->pFDeg==p_Deg) printf("p_Deg");
11609 else if (currRing->pFDeg==kHomModDeg) printf("kHomModDeg");
11610 else if (currRing->pFDeg==kModDeg) printf("kModDeg");
11611 else if (currRing->pFDeg==totaldegreeWecart) printf("totaldegreeWecart");
11612 else if (currRing->pFDeg==p_WTotaldegree) printf("p_WTotaldegree");
11613 else printf("? (%lx)", (long)currRing->pFDeg);
11614 printf("\n");
11615 printf(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11617 printf(" degBound: %d\n", Kstd1_deg);
11618
11619 if( ecartWeights != NULL )
11620 {
11621 printf("ecartWeights: ");
11622 for (int i = rVar(currRing); i > 0; i--)
11623 printf("%hd ", ecartWeights[i]);
11624 printf("\n");
11626 }
11627
11628#ifndef SING_NDEBUG
11630#endif
11631}
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:292
char noTailReduction
Definition kutil.h:377
int ak
Definition kutil.h:354
char sugarCrit
Definition kutil.h:376
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:288
char Gebauer
Definition kutil.h:377
int LazyPass
Definition kutil.h:354
int LazyDegree
Definition kutil.h:354
char posInLDependsOnLength
Definition kutil.h:388
int redLiftstd(LObject *h, kStrategy strat)
Definition kLiftstd.cc:167
void enterSMora(LObject &p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1629
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2426
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:794
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2416
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:168
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1682
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1360
int redHoney(LObject *h, kStrategy strat)
Definition kstd2.cc:2114
int redHomog(LObject *h, kStrategy strat)
Definition kstd2.cc:1154
int redLazy(LObject *h, kStrategy strat)
Definition kstd2.cc:1909
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6296
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6409
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6055
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:5841
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
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:6142
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6096
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11472
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:6177
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:11381
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
VAR int Kstd1_deg
Definition kutil.cc:240
void initEcartNormal(TObject *h)
Definition kutil.cc:1293
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5909
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6252
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:6212
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:6345
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11435
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:5799
char * showOption()
Definition misc_ip.cc:711
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition kutil.cc:1308
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8787
#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:729
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition ring.h:726
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598
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 468 of file kstd2.cc.

469{
470 unsigned long not_sev = ~L->sev;
471 poly p = L->GetLmCurrRing();
472 int j = 0;
473
475
477#if 1
478 int ende;
479 if (is_Ring
480 || (strat->ak>0)
481 || currRing->pLexOrder)
482 ende=strat->sl;
483 else
484 {
485 ende=posInS(strat,*max_ind,p,0)+1;
486 if (ende>(*max_ind)) ende=(*max_ind);
487 }
488#else
489 int ende=strat->sl;
490#endif
491 if(is_Ring)
492 {
493 loop
494 {
495 if (j > ende) return -1;
496#if defined(PDEBUG) || defined(PDIV_DEBUG)
497 if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
498 p, not_sev, currRing))
499#else
500 if ( !(strat->sevS[j] & not_sev) &&
501 p_LmDivisibleBy(strat->S[j], p, currRing))
502#endif
503 {
504 if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
505 return j;
506 }
507 j++;
508 }
509 }
510 else
511 {
512 loop
513 {
514 if (j > ende) return -1;
515#if defined(PDEBUG) || defined(PDIV_DEBUG)
516 if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
517 p, not_sev, currRing))
518#else
519 if ( !(strat->sevS[j] & not_sev) &&
520 p_LmDivisibleBy(strat->S[j], p, currRing))
521#endif
522 {
523 return j;
524 }
525 j++;
526 }
527 }
528}
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:750
#define pAssume(cond)
Definition monomials.h:90
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition p_polys.cc:4889
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 531 of file kstd2.cc.

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

◆ kFindDivisibleByInS_Z()

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

Definition at line 276 of file kstd2.cc.

277{
278 unsigned long not_sev = ~L->sev;
279 int j = 0;
280 int o = -1;
281
282 const polyset S=strat->S;
283 const unsigned long* sevS=strat->sevS;
285 L->GetP();
286 if (L->p!=NULL)
287 {
288 const ring r=currRing;
289 const poly p=L->p;
290 orest = pGetCoeff(p);
291
293
294 loop
295 {
296 if (j > strat->sl) return o;
297#if defined(PDEBUG) || defined(PDIV_DEBUG)
298 if (p_LmShortDivisibleBy(S[j], sevS[j],p, not_sev, r))
299#else
300 if (!(sevS[j] & not_sev) && p_LmDivisibleBy(S[j], p, r))
301#endif
302 {
303 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(S[j]), &rest, r->cf);
304 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
305 {
306 o = j;
307 orest = rest;
308 }
309 }
310 j++;
311 }
312 }
313 else
314 {
315 return -1;
316 }
317}
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 321 of file kstd2.cc.

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

421{
422 if (TEST_OPT_LENGTH)
423 {
424 int r=-1; // found, but bad ecart
425 int j=-2; // found, good ecart
426 int jj=-1; // current search
427 loop
428 {
429 jj=kFindDivisibleByInT(strat,L,jj+1);
430 if (jj== -1)
431 {
432 if (j<0) return r; // nothing with good ecart
433 else return j; // end of search, return best found
434 }
435 else if (r<0) r=jj; // save bad ecart found
436 if (strat->T[jj].ecart<=ecart) // good enough
437 {
438 if (strat->T[jj].pLength<=0)
439 strat->T[jj].pLength=strat->T[jj].GetpLength();
440 if (j== -2) j=jj; // first found
441 else if (strat->T[j].pLength > strat->T[jj].pLength) // jj better then j
442 j=jj;
443 if (strat->T[j].pLength<=2) return j; // length already minimal
444 }
445 }
446 }
447 else
448 {
449 int r=-1;
450 int jj=-1;
451 loop
452 {
453 jj=kFindDivisibleByInT(strat,L,jj+1);
454 if (jj== -1)
455 {
456 return r; // nothing found
457 }
458 else if (r== -1) r=jj;
459 if (strat->T[jj].ecart<=ecart) // good enough
460 {
461 return jj;
462 }
463 }
464 }
465}
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:321
#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 213 of file kstd2.cc.

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

◆ kFindNextDivisibleByInS()

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

Definition at line 571 of file kstd2.cc.

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

◆ kFindZeroPoly()

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

Definition at line 613 of file kstd2.cc.

614{
615 // m = currRing->ch
616
617 if (input_p == NULL) return NULL;
618
619 poly p = input_p;
620 poly zeroPoly = NULL;
621 unsigned long a = (unsigned long) pGetCoeff(p);
622
623 int k_ind2 = 0;
624 int a_ind2 = SI_LOG2_LONG(a);
625
626 // unsigned long k = 1;
627 // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
628 for (int i = 1; i <= leadRing->N; i++)
629 {
631 }
632
633 a = (unsigned long) pGetCoeff(p);
634
635 number tmp1;
636 poly tmp2, tmp3;
637 poly lead_mult = p_ISet(1, tailRing);
638 if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
639 {
640 int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
641 int s_exp;
642 zeroPoly = p_ISet(a, tailRing);
643 for (int i = 1; i <= leadRing->N; i++)
644 {
646 if (s_exp % 2 != 0)
647 {
648 s_exp = s_exp - 1;
649 }
650 while ( (0 < SI_LOG2_LONG(s_exp)) && (SI_LOG2_LONG(s_exp) <= too_much) )
651 {
653 s_exp = s_exp - 2;
654 }
655 p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
656 for (int j = 1; j <= s_exp; j++)
657 {
658 tmp1 = nInit(j);
659 tmp2 = p_ISet(1, tailRing);
660 p_SetExp(tmp2, i, 1, tailRing);
661 p_Setm(tmp2, tailRing);
662 if (nIsZero(tmp1))
663 { // should nowbe obsolet, test ! TODO OLIVER
664 zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
665 }
666 else
667 {
668 tmp3 = p_NSet(nCopy(tmp1), tailRing);
669 zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
670 }
671 }
672 }
673 p_Setm(lead_mult, tailRing);
674 zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
676 for (int i = 1; i <= leadRing->N; i++)
677 {
678 pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
679 }
683 return tmp2;
684 }
685/* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
686 if (1 == 0 && alpha_k <= a)
687 { // Temporarily disabled, reducing coefficients not compatible with std TODO Oliver
688 zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
689 for (int i = 1; i <= leadRing->N; i++)
690 {
691 for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
692 {
693 tmp1 = nInit(j);
694 tmp2 = p_ISet(1, tailRing);
695 p_SetExp(tmp2, i, 1, tailRing);
696 p_Setm(tmp2, tailRing);
697 if (nIsZero(tmp1))
698 {
699 zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
700 }
701 else
702 {
703 tmp3 = p_ISet((unsigned long) tmp1, tailRing);
704 zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
705 }
706 }
707 }
708 tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
709 for (int i = 1; i <= leadRing->N; i++)
710 {
711 pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
712 }
713 p_Setm(tmp2, leadRing);
714 zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
715 pNext(tmp2) = zeroPoly;
716 return tmp2;
717 } */
718 return NULL;
719}
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:600
#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 4106 of file kstd2.cc.

4107{
4108 assume(!idIs0(q));
4109 assume(!(idIs0(F)&&(Q==NULL)));
4110// lazy_reduce flags: can be combined by |
4111//#define KSTD_NF_LAZY 1
4112 // do only a reduction of the leading term
4113//#define KSTD_NF_NONORM 4
4114 // only global: avoid normalization, return a multiply of NF
4115 poly p;
4116 int i;
4117 ideal res;
4118 int max_ind;
4119
4120 //if (idIs0(q))
4121 // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
4122 //if ((idIs0(F))&&(Q==NULL))
4123 // return idCopy(q); /*F=0*/
4124 //strat->ak = idRankFreeModule(F);
4125 /*- creating temp data structures------------------- -*/
4126 BITSET save1;
4129 initBuchMoraCrit(strat);
4130 strat->initEcart = initEcartBBA;
4131#ifdef HAVE_SHIFTBBA
4132 if (rIsLPRing(currRing))
4133 {
4134 strat->enterS = enterSBbaShift;
4135 }
4136 else
4137#endif
4138 {
4139 strat->enterS = enterSBba;
4140 }
4141 /*- set S -*/
4142 strat->sl = -1;
4143#ifndef NO_BUCKETS
4145#endif
4146 /*- init local data struct.---------------------------------------- -*/
4147 /*Shdl=*/initS(F,Q,strat);
4148 /*- compute------------------------------------------------------- -*/
4149 res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
4150 for (i=IDELEMS(q)-1; i>=0; i--)
4151 {
4152 if (q->m[i]!=NULL)
4153 {
4154 if (TEST_OPT_PROT) { PrintS("r");mflush(); }
4155 p = redNF(pCopy(q->m[i]),max_ind,
4157 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
4158 {
4159 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4161 {
4162 p = redtailBba_NF(p,strat);
4163 }
4164 else
4165 {
4166 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
4168 }
4169 }
4170 res->m[i]=p;
4171 }
4172 //else
4173 // res->m[i]=NULL;
4174 }
4175 /*- release temp data------------------------------- -*/
4176 assume(strat->L==NULL); /* strat->L unused */
4177 assume(strat->B==NULL); /* strat->B unused */
4178 omFree(strat->sevS);
4179 omFree(strat->ecartS);
4180 assume(strat->T==NULL);//omfree(strat->T);
4181 assume(strat->sevT==NULL);//omfree(strat->sevT);
4182 assume(strat->R==NULL);//omfree(strat->R);
4183 omfree(strat->S_2_R);
4184 omfree(strat->fromQ);
4185 strat->fromQ=NULL;
4186 idDelete(&strat->Shdl);
4188 if (TEST_OPT_PROT) PrintLn();
4189 return res;
4190}
static int si_max(const int a, const int b)
Definition auxiliary.h:125
intset ecartS
Definition kutil.h:310
LSet B
Definition kutil.h:329
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:2311
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7583
poly redtailBba_NF(poly p, kStrategy strat)
Definition kutil.cc:7347
void enterSBbaShift(LObject &p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8887
#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 3943 of file kstd2.cc.

3944{
3945 assume(q!=NULL);
3946 assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
3947
3948// lazy_reduce flags: can be combined by |
3949//#define KSTD_NF_LAZY 1
3950 // do only a reduction of the leading term
3951//#define KSTD_NF_NONORM 4
3952 // only global: avoid normalization, return a multiply of NF
3953//#define KSTD_NF_CANCELUNIT 8
3954 // apply cancelunit to f inf NF(f,I)
3955//#define KSTD_NF_NOLF 4096
3956 // avoid PrintLn with OPT_PROT
3957
3958 poly p;
3959
3960 //if ((idIs0(F))&&(Q==NULL))
3961 // return pCopy(q); /*F=0*/
3962 //strat->ak = idRankFreeModule(F);
3963 /*- creating temp data structures------------------- -*/
3964 BITSET save1;
3967 initBuchMoraCrit(strat);
3968 strat->initEcart = initEcartBBA;
3969#ifdef HAVE_SHIFTBBA
3970 if (rIsLPRing(currRing))
3971 {
3972 strat->enterS = enterSBbaShift;
3973 }
3974 else
3975#endif
3976 {
3977 strat->enterS = enterSBba;
3978 }
3979#ifndef NO_BUCKETS
3981#endif
3982 /*- set S -*/
3983 strat->sl = -1;
3984 /*- init local data struct.---------------------------------------- -*/
3985 /*Shdl=*/initS(F,Q,strat);
3986 /*- compute------------------------------------------------------- -*/
3987 //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
3988 //{
3989 // for (i=strat->sl;i>=0;i--)
3990 // pNorm(strat->S[i]);
3991 //}
3992 kTest(strat);
3993 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
3994 if (BVERBOSE(23)) kDebugPrint(strat);
3995 int max_ind;
3997 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
3998 {
3999 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4001 {
4002 p = redtailBba_NF(p,strat);
4003 }
4004 else if (rField_is_Ring(currRing))
4005 {
4006 p = redtailBba_Ring(p,max_ind,strat);
4007 }
4008 else
4009 {
4010 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
4012 }
4013 }
4014 /*- release temp data------------------------------- -*/
4015 assume(strat->L==NULL); /* strat->L unused */
4016 assume(strat->B==NULL); /* strat->B unused */
4017 omFree(strat->sevS);
4018 omFree(strat->ecartS);
4019 assume(strat->T==NULL);//omfree(strat->T);
4020 assume(strat->sevT==NULL);//omfree(strat->sevT);
4021 assume(strat->R==NULL);//omfree(strat->R);
4022 omfree(strat->S_2_R);
4023 omfree(strat->fromQ);
4024 strat->fromQ=NULL;
4025 idDelete(&strat->Shdl);
4027 if (TEST_OPT_PROT && ((lazyReduce &KSTD_NF_NOLF)==0)) PrintLn();
4028 return p;
4029}
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition kInline.h:1224
#define KSTD_NF_NOLF
Definition kstd1.h:26
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1004
static BOOLEAN rField_is_Zn(const ring r)
Definition ring.h:518

◆ kNF2Bound() [1/2]

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

Definition at line 4192 of file kstd2.cc.

4193{
4194 assume(!idIs0(q));
4195 assume(!(idIs0(F)&&(Q==NULL)));
4196// lazy_reduce flags: can be combined by |
4197//#define KSTD_NF_LAZY 1
4198 // do only a reduction of the leading term
4199//#define KSTD_NF_NONORM 4
4200 // only global: avoid normalization, return a multiply of NF
4201 poly p;
4202 int i;
4203 ideal res;
4204 int max_ind;
4205
4206 //if (idIs0(q))
4207 // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
4208 //if ((idIs0(F))&&(Q==NULL))
4209 // return idCopy(q); /*F=0*/
4210 //strat->ak = idRankFreeModule(F);
4211 /*- creating temp data structures------------------- -*/
4212 BITSET save1;
4215 initBuchMoraCrit(strat);
4216 strat->initEcart = initEcartBBA;
4217 strat->enterS = enterSBba;
4218 /*- set S -*/
4219 strat->sl = -1;
4220#ifndef NO_BUCKETS
4222#endif
4223 /*- init local data struct.---------------------------------------- -*/
4224 /*Shdl=*/initS(F,Q,strat);
4225 /*- compute------------------------------------------------------- -*/
4226 res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
4227 for (i=IDELEMS(q)-1; i>=0; i--)
4228 {
4229 if (q->m[i]!=NULL)
4230 {
4231 if (TEST_OPT_PROT) { PrintS("r");mflush(); }
4232 p = redNFBound(pCopy(q->m[i]),max_ind,
4234 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
4235 {
4236 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4238 {
4239 p = redtailBba_Z(p,max_ind,strat);
4240 }
4241 else if (rField_is_Ring(currRing))
4242 {
4243 p = redtailBba_Ring(p,max_ind,strat);
4244 }
4245 else
4246 {
4247 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
4249 }
4250 }
4251 res->m[i]=p;
4252 }
4253 //else
4254 // res->m[i]=NULL;
4255 }
4256 /*- release temp data------------------------------- -*/
4257 assume(strat->L==NULL); /* strat->L unused */
4258 assume(strat->B==NULL); /* strat->B unused */
4259 omFree(strat->sevS);
4260 omFree(strat->ecartS);
4261 assume(strat->T==NULL);//omfree(strat->T);
4262 assume(strat->sevT==NULL);//omfree(strat->sevT);
4263 assume(strat->R==NULL);//omfree(strat->R);
4264 omfree(strat->S_2_R);
4265 omfree(strat->fromQ);
4266 strat->fromQ=NULL;
4267 idDelete(&strat->Shdl);
4269 if (TEST_OPT_PROT) PrintLn();
4270 return res;
4271}
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:2507

◆ kNF2Bound() [2/2]

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

Definition at line 4031 of file kstd2.cc.

4032{
4033 assume(q!=NULL);
4034 assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
4035
4036// lazy_reduce flags: can be combined by |
4037//#define KSTD_NF_LAZY 1
4038 // do only a reduction of the leading term
4039//#define KSTD_NF_NONORM 4
4040 // only global: avoid normalization, return a multiply of NF
4041 poly p;
4042
4043 //if ((idIs0(F))&&(Q==NULL))
4044 // return pCopy(q); /*F=0*/
4045 //strat->ak = idRankFreeModule(F);
4046 /*- creating temp data structures------------------- -*/
4047 BITSET save1;
4050 initBuchMoraCrit(strat);
4051 strat->initEcart = initEcartBBA;
4052 strat->enterS = enterSBba;
4053#ifndef NO_BUCKETS
4055#endif
4056 /*- set S -*/
4057 strat->sl = -1;
4058 /*- init local data struct.---------------------------------------- -*/
4059 /*Shdl=*/initS(F,Q,strat);
4060 /*- compute------------------------------------------------------- -*/
4061 //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
4062 //{
4063 // for (i=strat->sl;i>=0;i--)
4064 // pNorm(strat->S[i]);
4065 //}
4066 kTest(strat);
4067 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
4068 if (BVERBOSE(23)) kDebugPrint(strat);
4069 int max_ind;
4071 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
4072 {
4073 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
4075 {
4076 p = redtailBba_Z(p,max_ind,strat);
4077 }
4078 else if (rField_is_Ring(currRing))
4079 {
4080 p = redtailBba_Ring(p,max_ind,strat);
4081 }
4082 else
4083 {
4084 si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
4086 //p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
4087 }
4088 }
4089 /*- release temp data------------------------------- -*/
4090 assume(strat->L==NULL); /* strat->L unused */
4091 assume(strat->B==NULL); /* strat->B unused */
4092 omFree(strat->sevS);
4093 omFree(strat->ecartS);
4094 assume(strat->T==NULL);//omfree(strat->T);
4095 assume(strat->sevT==NULL);//omfree(strat->sevT);
4096 assume(strat->R==NULL);//omfree(strat->R);
4097 omfree(strat->S_2_R);
4098 omfree(strat->fromQ);
4099 strat->fromQ=NULL;
4100 idDelete(&strat->Shdl);
4102 if (TEST_OPT_PROT) PrintLn();
4103 return p;
4104}

◆ ksReducePolyTailSig()

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

Definition at line 1335 of file kstd2.cc.

1336{
1337 BOOLEAN ret;
1338 number coef;
1339 assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
1341 Red->HeadNormalize();
1342 /*
1343 printf("------------------------\n");
1344 pWrite(Red->GetLmCurrRing());
1345 */
1347 ret = ksReducePolySigRing(Red, PW, 1, NULL, &coef, strat);
1348 else
1349 ret = ksReducePolySig(Red, PW, 1, NULL, &coef, strat);
1350 if (!ret)
1351 {
1352 if (! n_IsOne(coef, currRing->cf) && !rField_is_Ring(currRing))
1353 {
1354 PR->Mult_nn(coef);
1355 // HANNES: mark for Normalize
1356 }
1357 n_Delete(&coef, currRing->cf);
1358 }
1359 return ret;
1360}
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 146 of file kstd2.cc.

147{
148 if (strat->tl < 1)
149 return -1;
150
151 unsigned long not_sev = ~L->sev;
152 const unsigned long sevT0 = strat->sevT[0];
154 if (L->p!=NULL)
155 {
156 const poly T0p = strat->T[0].p;
157 const ring r = currRing;
158 const poly p = L->p;
159 orest = pGetCoeff(p);
160
162
163#if defined(PDEBUG) || defined(PDIV_DEBUG)
165#else
166 if (!(sevT0 & not_sev) && p_LmDivisibleBy(T0p, p, r))
167#endif
168 {
169 if (n_QuotRem!=ndQuotRem) /*euclidean ring*/
170 {
171 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T0p), &rest, r->cf);
172 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
173 {
174 n_Delete(&mult,r->cf);
175 n_Delete(&rest,r->cf);
176 return 0;
177 }
178 n_Delete(&mult,r->cf);
179 n_Delete(&rest,r->cf);
180 }
181 }
182 }
183 else
184 {
185 const poly T0p = strat->T[0].t_p;
186 const ring r = strat->tailRing;
187 const poly p = L->t_p;
188 orest = pGetCoeff(p);
189#if defined(PDEBUG) || defined(PDIV_DEBUG)
191 p, not_sev, r))
192#else
193 if (!(sevT0 & not_sev) && p_LmDivisibleBy(T0p, p, r))
194#endif
195 {
196 if (n_QuotRem!=ndQuotRem) /*euclidean ring*/
197 {
198 mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T0p), &rest, r->cf);
199 if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
200 {
201 n_Delete(&mult,r->cf);
202 n_Delete(&rest,r->cf);
203 return 0;
204 }
205 n_Delete(&mult,r->cf);
206 n_Delete(&rest,r->cf);
207 }
208 }
209 }
210 return -1;
211}
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 4973 of file kstd2.cc.

4974{
4975 if (h->IsNull()) return 0;
4976
4977 int at, reddeg,d;
4978 int pass = 0;
4979 int j = 0;
4980
4981 if (! strat->homog)
4982 {
4983 d = h->GetpFDeg() + h->ecart;
4984 reddeg = strat->LazyDegree+d;
4985 }
4986 h->SetShortExpVector();
4987 loop
4988 {
4989 j = kFindDivisibleByInT(strat, h);
4990 if (j < 0)
4991 {
4992 h->SetDegStuffReturnLDeg(strat->LDegLast);
4993 return 1;
4994 }
4995
4997 strat->T[j].pNorm();
4998#ifdef KDEBUG
4999 if (TEST_OPT_DEBUG)
5000 {
5001 PrintS("reduce ");
5002 h->wrp();
5003 PrintS(" with ");
5004 strat->T[j].wrp();
5005 }
5006#endif
5007 ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, NULL, strat);
5008
5009#ifdef KDEBUG
5010 if (TEST_OPT_DEBUG)
5011 {
5012 PrintS("\nto ");
5013 wrp(h->p);
5014 PrintLn();
5015 }
5016#endif
5017 if (h->IsNull())
5018 {
5019 kDeleteLcm(h);
5020 h->Clear();
5021 return 0;
5022 }
5023 h->SetShortExpVector();
5024
5025#if 0
5026 if ((strat->syzComp!=0) && !strat->honey)
5027 {
5028 if ((strat->syzComp>0) &&
5029 (h->Comp() > strat->syzComp))
5030 {
5031 assume(h->MinComp() > strat->syzComp);
5032#ifdef KDEBUG
5033 if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
5034#endif
5035 if (strat->homog)
5036 h->SetDegStuffReturnLDeg(strat->LDegLast);
5037 return -2;
5038 }
5039 }
5040#endif
5041 if (!strat->homog)
5042 {
5043 if (!TEST_OPT_OLDSTD && strat->honey)
5044 {
5045 h->SetpFDeg();
5046 if (strat->T[j].ecart <= h->ecart)
5047 h->ecart = d - h->GetpFDeg();
5048 else
5049 h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
5050
5051 d = h->GetpFDeg() + h->ecart;
5052 }
5053 else
5054 d = h->SetDegStuffReturnLDeg(strat->LDegLast);
5055 /*- try to reduce the s-polynomial -*/
5056 pass++;
5057 /*
5058 *test whether the polynomial should go to the lazyset L
5059 *-if the degree jumps
5060 *-if the number of pre-defined reductions jumps
5061 */
5062 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
5063 && ((d >= reddeg) || (pass > strat->LazyPass)))
5064 {
5065 h->SetLmCurrRing();
5066 if (strat->posInLDependsOnLength)
5067 h->SetLength(strat->length_pLength);
5068 at = strat->posInL(strat->L,strat->Ll,h,strat);
5069 if (at <= strat->Ll)
5070 {
5071 //int dummy=strat->sl;
5072 /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
5073 //if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
5074 if (kFindDivisibleByInT(strat, h) < 0)
5075 return 1;
5076 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
5077#ifdef KDEBUG
5078 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
5079#endif
5080 h->Clear();
5081 return -1;
5082 }
5083 }
5084 if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
5085 {
5086 reddeg = d+1;
5087 Print(".%d",d);mflush();
5088 }
5089 }
5090 }
5091}
KINLINE poly kNoetherTail()
Definition kInline.h:66
char LDegLast
Definition kutil.h:384
char length_pLength
Definition kutil.h:386
#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 1154 of file kstd2.cc.

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

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

◆ redLazy()

int redLazy ( LObject h,
kStrategy  strat 
)

TEST_OPT_REDTHROUGH &&

Definition at line 1909 of file kstd2.cc.

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

◆ redNF()

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

Definition at line 2311 of file kstd2.cc.

2312{
2313 if (h==NULL) return NULL;
2314 int j,j_ring;
2315 int cnt=REDNF_CANONICALIZE;
2316 max_ind=strat->sl;
2317
2318 if (0 > strat->sl)
2319 {
2320 return h;
2321 }
2322 LObject P(h);
2323 P.SetShortExpVector();
2324 P.t_p=NULL;
2326 if(is_ring) nonorm=TRUE;
2327#ifdef KDEBUG
2328// if (TEST_OPT_DEBUG)
2329// {
2330// PrintS("redNF: starting S:\n");
2331// for( j = 0; j <= max_ind; j++ )
2332// {
2333// Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
2334// pWrite(strat->S[j]);
2335// }
2336// };
2337#endif
2338 if (rField_is_Z(currRing))
2339 {
2340 redRing_Z_S(&P,strat);
2341 if (P.bucket!=NULL)
2342 {
2343 P.p=kBucketClear(P.bucket);
2344 kBucketDestroy(&P.bucket);
2345 }
2346 return P.p;
2347 }
2348 else if (rField_is_Ring(currRing))
2349 {
2350 redRing_S(&P,strat);
2351 if (P.bucket!=NULL)
2352 {
2353 P.p=kBucketClear(P.bucket);
2354 kBucketDestroy(&P.bucket);
2355 }
2356 return P.p;
2357 }
2358
2359 P.bucket = kBucketCreate(currRing);
2360 kBucketInit(P.bucket,P.p,pLength(P.p));
2361 kbTest(P.bucket);
2362 P.p=kBucketGetLm(P.bucket);
2363 loop
2364 {
2366 while ((j>=0)
2367 && (nonorm)
2368 && (!n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[j]),currRing->cf)))
2369 j=kFindNextDivisibleByInS(strat,j+1,max_ind,&P);
2370 if (j>=0)
2371 {
2372 int sl=pSize(strat->S[j]);
2373 int jj=j;
2374 loop
2375 {
2376 int sll;
2378 if (jj<0) break;
2379 if ((!nonorm)
2380 || (n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[jj]),currRing->cf)))
2381 {
2382 sll=pSize(strat->S[jj]);
2383 if (sll<sl)
2384 {
2385 #ifdef KDEBUG
2386 if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
2387 #endif
2388 //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
2389 j=jj;
2390 sl=sll;
2391 }
2392 }
2393 }
2394 if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
2395 {
2396 pNorm(strat->S[j]);
2397 //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
2398 }
2399 nNormalize(pGetCoeff(P.p));
2400#ifdef KDEBUG
2401 if (TEST_OPT_DEBUG)
2402 {
2403 PrintS("red:");
2404 wrp(P.p);
2405 PrintS(" with ");
2406 wrp(strat->S[j]);
2407 }
2408#endif
2409#ifdef HAVE_PLURAL
2411 {
2412 number coef;
2413 nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm);
2414 nDelete(&coef);
2415 }
2416 else
2417#endif
2418 {
2419 kBucketPolyRedNF(P.bucket,strat->S[j],pLength(strat->S[j]),
2420 strat->kNoether);
2421 }
2422 cnt--;
2423 if (cnt==0)
2424 {
2425 kBucketCanonicalize(P.bucket);
2427 }
2428 P.p=kBucketGetLm(P.bucket);
2429 //P.t_p=NULL;
2430#ifdef KDEBUG
2431 if (TEST_OPT_DEBUG)
2432 {
2433 PrintS("\nto:");
2434 wrp(P.p);
2435 PrintLn();
2436 }
2437#endif
2438 if (P.p==NULL)
2439 {
2440 kBucketDestroy(&P.bucket);
2441 return NULL;
2442 }
2443 kbTest(P.bucket);
2444 P.SetShortExpVector();
2445 }
2446 else if (is_ring && (j_ring>=0) && (currRing->cf->cfQuotRem!=ndQuotRem))
2447 {
2448 number r;
2449 number n=n_QuotRem(pGetCoeff(P.p),pGetCoeff(strat->S[j_ring]),&r,currRing->cf);
2450 if(!n_IsZero(n,currRing->cf))
2451 {
2452 poly lm=kBucketGetLm(P.bucket);
2453 poly m=p_Head(lm,currRing);
2454 p_ExpVectorSub(m,strat->S[j_ring],currRing);
2455 if (p_GetComp(strat->S[j_ring], currRing) != p_GetComp(lm, currRing))
2456 {
2458 }
2460 p_Setm(m,currRing);
2461#ifdef KDEBUG
2462 if (TEST_OPT_DEBUG)
2463 {
2464 PrintS("redi (coeff):");
2465 wrp(P.p);
2466 PrintS(" with ");
2467 wrp(strat->S[j]);
2468 }
2469#endif
2470 int l=-1;
2471 kBucket_Minus_m_Mult_p(P.bucket,m,strat->S[j_ring],&l);
2472 P.p=kBucketGetLm(P.bucket);
2474#ifdef KDEBUG
2475 if (TEST_OPT_DEBUG)
2476 {
2477 PrintS("\nto:");
2478 wrp(P.p);
2479 PrintLn();
2480 }
2481#endif
2482 }
2483 else
2484 {
2485 n_Delete(&n,currRing->cf);
2486 }
2487 n_Delete(&r,currRing->cf);
2488 P.p=kBucketClear(P.bucket);
2489 kBucketDestroy(&P.bucket);
2490 pNormalize(P.p);
2491 return P.p;
2492 }
2493 else
2494 {
2495 P.p=kBucketClear(P.bucket);
2496 kBucketDestroy(&P.bucket);
2497 pNormalize(P.p);
2498 return P.p;
2499 }
2500 }
2501}
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
poly kNoether
Definition kutil.h:330
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:571
int kFindDivisibleByInS_noCF(const kStrategy strat, int *max_ind, LObject *L)
Definition kstd2.cc:531
static int redRing_S(LObject *h, kStrategy strat)
Definition kstd2.cc:1094
static int redRing_Z_S(LObject *h, kStrategy strat)
Definition kstd2.cc:882
#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 2507 of file kstd2.cc.

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

◆ redRing()

int redRing ( LObject h,
kStrategy  strat 
)

Definition at line 992 of file kstd2.cc.

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

◆ redRing_S()

static int redRing_S ( LObject h,
kStrategy  strat 
)
static

Definition at line 1094 of file kstd2.cc.

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

◆ redRing_Z()

int redRing_Z ( LObject h,
kStrategy  strat 
)

Definition at line 724 of file kstd2.cc.

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

static int redRing_Z_S ( LObject h,
kStrategy  strat 
)
static

Definition at line 882 of file kstd2.cc.

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

◆ redSig()

int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 1373 of file kstd2.cc.

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

◆ redSigRing()

int redSigRing ( LObject h,
kStrategy  strat 
)

Definition at line 1540 of file kstd2.cc.

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

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

4958{
4960 assume(idIsInV(F));
4961 ideal RS = kStdShift(F, Q, testHomog, NULL, NULL, 0, 0, NULL, TRUE);
4962 idSkipZeroes(RS); // is this even necessary?
4963 assume(idIsInV(RS));
4964 return(RS);
4965}
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2968
#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 2981 of file kstd2.cc.

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

Variable Documentation

◆ test_PosInL

VAR int(* test_PosInL) (const LSet set, const int length, LObject *L, const kStrategy strat) ( const LSet  set,
const int  length,
LObject L,
const kStrategy  strat 
)

Definition at line 83 of file kstd2.cc.

◆ test_PosInT

VAR int(* test_PosInT) (const TSet T, const int tl, LObject &h) ( const TSet  T,
const int  tl,
LObject h 
)

Definition at line 82 of file kstd2.cc.