My Project  UNKNOWN_GIT_VERSION
Macros | Typedefs | Functions | Variables
kstd1.h File Reference
#include "kernel/structs.h"
#include "polys/monomials/ring.h"

Go to the source code of this file.

Macros

#define KSTD_NF_LAZY   1
 
#define KSTD_NF_ECART   2
 
#define KSTD_NF_NONORM   4
 

Typedefs

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)
 

Functions

ideal mora (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
poly kNF1 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF1 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
poly kNF (ideal F, ideal Q, poly p, int syzComp=0, int lazyReduce=0)
 
ideal kNF (ideal F, ideal Q, ideal p, int syzComp=0, int lazyReduce=0)
 
poly kNFBound (ideal F, ideal Q, poly p, int bound, int syzComp=0, int lazyReduce=0)
 
ideal kNFBound (ideal F, ideal Q, ideal p, int bound, int syzComp=0, int lazyReduce=0)
 
poly k_NF (ideal F, ideal Q, poly p, int syzComp, int lazyReduce, const ring _currRing)
 NOTE: this is just a wrapper which sets currRing for the actual kNF call. More...
 
ideal kSba (ideal F, ideal Q, tHomog h, intvec **mw, int incremental=0, int arri=0, intvec *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL)
 
ideal kStd (ideal F, ideal Q, tHomog h, intvec **mw, intvec *hilb=NULL, int syzComp=0, int newIdeal=0, intvec *vw=NULL, s_poly_proc_t sp=NULL)
 
ideal kStdShift (ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, int uptodeg, int lVblock)
 
void initMora (ideal F, kStrategy strat)
 
ideal kInterRed (ideal F, ideal Q=NULL)
 
ideal kInterRedOld (ideal F, ideal Q=NULL)
 
long kModDeg (poly p, ring r=currRing)
 
long kHomModDeg (poly p, ring r=currRing)
 
ideal stdred (ideal F, ideal Q, tHomog h, intvec **w)
 
ideal kMin_std (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb=NULL, int syzComp=0, int reduced=0)
 

Variables

int LazyPass
 
int LazyDegree
 
int Kstd1_mu
 
int Kstd1_deg
 
BITSET kOptions
 
BITSET validOpts
 
intveckModW
 
intveckHomW
 

Macro Definition Documentation

◆ KSTD_NF_ECART

#define KSTD_NF_ECART   2

Definition at line 19 of file kstd1.h.

◆ KSTD_NF_LAZY

#define KSTD_NF_LAZY   1

Definition at line 17 of file kstd1.h.

◆ KSTD_NF_NONORM

#define KSTD_NF_NONORM   4

Definition at line 21 of file kstd1.h.

Typedef Documentation

◆ s_poly_proc_t

typedef BOOLEAN(* s_poly_proc_t) (kStrategy strat)

Definition at line 14 of file kstd1.h.

Function Documentation

◆ initMora()

void initMora ( ideal  F,
kStrategy  strat 
)

Definition at line 1459 of file kstd1.cc.

1460 {
1461  int i,j;
1462 
1463  strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1464  for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1465  strat->enterS = enterSMora;
1466  strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1467  strat->posInLOld = strat->posInL;
1468  strat->posInLOldFlag = TRUE;
1469  strat->initEcart = initEcartNormal;
1470  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1471  if ( strat->kHEdgeFound )
1472  strat->kNoether = pCopy((currRing->ppNoether));
1473  else if (strat->kHEdgeFound || strat->homog)
1474  strat->red = redFirst; /*take the first possible in T*/
1475  else
1476  strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1477  if (strat->kHEdgeFound)
1478  {
1479  strat->HCord = currRing->pFDeg((currRing->ppNoether),currRing)+1;
1480  strat->posInT = posInT2;
1481  }
1482  else
1483  {
1484  strat->HCord = 32000;/*- very large -*/
1485  }
1486 
1487  if (rField_is_Ring(currRing))
1488  strat->red = redRiloc;
1489 
1490  /*reads the ecartWeights used for Graebes method from the
1491  *intvec ecart and set ecartWeights
1492  */
1493  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1494  {
1495  //interred machen Aenderung
1496  strat->pOrigFDeg=currRing->pFDeg;
1497  strat->pOrigLDeg=currRing->pLDeg;
1498  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1499  /*uses automatic computation of the ecartWeights to set them*/
1501 
1503  if (TEST_OPT_PROT)
1504  {
1505  for(i=1; i<=(currRing->N); i++)
1506  Print(" %d",ecartWeights[i]);
1507  PrintLn();
1508  mflush();
1509  }
1510  }
1511  kOptimizeLDeg(currRing->pLDeg, strat);
1512 }
int BOOLEAN
Definition: auxiliary.h:85
#define TRUE
Definition: auxiliary.h:98
int i
Definition: cfEzgcd.cc:125
char posInLOldFlag
Definition: kutil.h:376
poly kNoether
Definition: kutil.h:321
BOOLEAN * NotUsedAxis
Definition: kutil.h:325
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:275
pFDegProc pOrigFDeg
Definition: kutil.h:287
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:279
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:278
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:277
void(* initEcart)(TObject *L)
Definition: kutil.h:271
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:272
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:269
char kHEdgeFound
Definition: kutil.h:370
int HCord
Definition: kutil.h:348
char homog
Definition: kutil.h:366
pLDegProc pOrigLDeg
Definition: kutil.h:288
#define Print
Definition: emacs.cc:80
int j
Definition: facHensel.cc:105
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:530
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:168
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition: kstd1.cc:99
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:344
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1272
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5212
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1279
void initEcartNormal(TObject *h)
Definition: kutil.cc:1257
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define NULL
Definition: omList.c:10
#define TEST_OPT_WEIGHTM
Definition: options.h:119
#define TEST_OPT_PROT
Definition: options.h:102
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3588
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pCopy(p)
return a copy of the poly
Definition: polys.h:180
void PrintLn()
Definition: reporter.cc:310
#define mflush()
Definition: reporter.h:57
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:475
#define IDELEMS(i)
Definition: simpleideals.h:24
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:223
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:253
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:188
short * ecartWeights
Definition: weight0.c:28

◆ k_NF()

poly k_NF ( ideal  F,
ideal  Q,
poly  p,
int  syzComp,
int  lazyReduce,
const ring  _currRing 
)

NOTE: this is just a wrapper which sets currRing for the actual kNF call.

Definition at line 3015 of file kstd1.cc.

3016 {
3017  const ring save = currRing;
3018  if( currRing != _currRing ) rChangeCurrRing(_currRing);
3019  poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3020  if( currRing != save ) rChangeCurrRing(save);
3021  return ret;
3022 }
int p
Definition: cfModGcd.cc:4019
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2822
void rChangeCurrRing(ring r)
Definition: polys.cc:15
#define Q
Definition: sirandom.c:25

◆ kHomModDeg()

long kHomModDeg ( poly  p,
ring  r = currRing 
)

Definition at line 2074 of file kstd1.cc.

2075 {
2076  int i;
2077  long j=0;
2078 
2079  for (i=r->N;i>0;i--)
2080  j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2081  if (kModW == NULL) return j;
2082  i = __p_GetComp(p,r);
2083  if (i==0) return j;
2084  return j+(*kModW)[i-1];
2085 }
intvec * kModW
Definition: kstd1.cc:2062
#define __p_GetComp(p, r)
Definition: monomials.h:64
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:470

◆ kInterRed()

ideal kInterRed ( ideal  F,
ideal  Q = NULL 
)

Definition at line 3380 of file kstd1.cc.

3381 {
3382 #ifdef HAVE_PLURAL
3383  if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3384 #endif
3387  )
3388  return kInterRedOld(F,Q);
3389 
3390  //return kInterRedOld(F,Q);
3391 
3392  BITSET save1;
3393  SI_SAVE_OPT1(save1);
3394  //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3396  //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3397  //si_opt_1&= ~Sy_bit(OPT_REDSB);
3398  //extern char * showOption() ;
3399  //Print("%s\n",showOption());
3400 
3401  int need_retry;
3402  int counter=3;
3403  ideal res, res1;
3404  int elems;
3405  ideal null=NULL;
3406  if ((Q==NULL) || (!TEST_OPT_REDSB))
3407  {
3408  elems=idElem(F);
3409  res=kInterRedBba(F,Q,need_retry);
3410  }
3411  else
3412  {
3413  ideal FF=idSimpleAdd(F,Q);
3414  res=kInterRedBba(FF,NULL,need_retry);
3415  idDelete(&FF);
3416  null=idInit(1,1);
3417  if (need_retry)
3418  res1=kNF(null,Q,res,0,KSTD_NF_LAZY);
3419  else
3420  res1=kNF(null,Q,res);
3421  idDelete(&res);
3422  res=res1;
3423  need_retry=1;
3424  }
3425  if (idElem(res)<=1) need_retry=0;
3426  while (need_retry && (counter>0))
3427  {
3428  #ifdef KDEBUG
3429  if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3430  #endif
3431  res1=kInterRedBba(res,Q,need_retry);
3432  int new_elems=idElem(res1);
3433  counter -= (new_elems >= elems);
3434  elems = new_elems;
3435  idDelete(&res);
3436  if (idElem(res1)<=1) need_retry=0;
3437  if ((Q!=NULL) && (TEST_OPT_REDSB))
3438  {
3439  if (need_retry)
3440  res=kNF(null,Q,res1,0,KSTD_NF_LAZY);
3441  else
3442  res=kNF(null,Q,res1);
3443  idDelete(&res1);
3444  }
3445  else
3446  res = res1;
3447  if (idElem(res)<=1) need_retry=0;
3448  }
3449  if (null!=NULL) idDelete(&null);
3450  SI_RESTORE_OPT1(save1);
3451  idSkipZeroes(res);
3452  return res;
3453 }
CanonicalForm res
Definition: facAbsFact.cc:64
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define idSimpleAdd(A, B)
Definition: ideals.h:42
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3028
ideal kInterRedBba(ideal F, ideal Q, int &need_retry)
Definition: kstd1.cc:3120
#define KSTD_NF_LAZY
Definition: kstd1.h:17
unsigned si_opt_1
Definition: options.c:5
#define SI_SAVE_OPT1(A)
Definition: options.h:22
#define SI_RESTORE_OPT1(A)
Definition: options.h:25
#define OPT_REDTHROUGH
Definition: options.h:81
#define Sy_bit(x)
Definition: options.h:32
#define TEST_OPT_REDSB
Definition: options.h:103
#define TEST_OPT_DEBUG
Definition: options.h:107
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:398
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:506
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:37
int idElem(const ideal F)
count non-zero elements
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
#define BITSET
Definition: structs.h:18

◆ kInterRedOld()

ideal kInterRedOld ( ideal  F,
ideal  Q = NULL 
)

Definition at line 3028 of file kstd1.cc.

3029 {
3030  int j;
3031  kStrategy strat = new skStrategy;
3032 
3033  ideal tempF = F;
3034  ideal tempQ = Q;
3035 
3036 #ifdef HAVE_PLURAL
3037  if(rIsSCA(currRing))
3038  {
3039  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3040  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3041  tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
3042 
3043  // this should be done on the upper level!!! :
3044  // tempQ = SCAQuotient(currRing);
3045 
3046  if(Q == currRing->qideal)
3047  tempQ = SCAQuotient(currRing);
3048  }
3049 #endif
3050 
3051 // if (TEST_OPT_PROT)
3052 // {
3053 // writeTime("start InterRed:");
3054 // mflush();
3055 // }
3056  //strat->syzComp = 0;
3057  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
3058  strat->kNoether=pCopy((currRing->ppNoether));
3059  strat->ak = id_RankFreeModule(tempF,currRing);
3060  initBuchMoraCrit(strat);
3061  strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3062  for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3063  strat->enterS = enterSBba;
3064  strat->posInT = posInT17;
3065  strat->initEcart = initEcartNormal;
3066  strat->sl = -1;
3067  strat->tl = -1;
3068  strat->tmax = setmaxT;
3069  strat->T = initT();
3070  strat->R = initR();
3071  strat->sevT = initsevT();
3073  initS(tempF, tempQ, strat);
3074  if (TEST_OPT_REDSB)
3075  strat->noTailReduction=FALSE;
3076  updateS(TRUE,strat);
3078  completeReduce(strat);
3079  //else if (TEST_OPT_PROT) PrintLn();
3080  cleanT(strat);
3081  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
3082  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3083  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3084  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3085  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3086  omfree(strat->sevT);
3087  omfree(strat->S_2_R);
3088  omfree(strat->R);
3089 
3090  if (strat->fromQ)
3091  {
3092  for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3093  {
3094  if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3095  }
3096  omFreeSize((ADDRESS)strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
3097  }
3098 // if (TEST_OPT_PROT)
3099 // {
3100 // writeTime("end Interred:");
3101 // mflush();
3102 // }
3103  ideal shdl=strat->Shdl;
3104  idSkipZeroes(shdl);
3105  if (strat->fromQ)
3106  {
3107  strat->fromQ=NULL;
3108  ideal res=kInterRed(shdl,NULL);
3109  idDelete(&shdl);
3110  shdl=res;
3111  }
3112  delete(strat);
3113 #ifdef HAVE_PLURAL
3114  if( tempF != F )
3115  id_Delete( &tempF, currRing);
3116 #endif
3117  return shdl;
3118 }
#define FALSE
Definition: auxiliary.h:94
void * ADDRESS
Definition: auxiliary.h:133
int * S_2_R
Definition: kutil.h:335
char noTailReduction
Definition: kutil.h:372
TSet T
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:300
char honey
Definition: kutil.h:371
int ak
Definition: kutil.h:346
TObject ** R
Definition: kutil.h:333
poly kHEdge
Definition: kutil.h:320
int tl
Definition: kutil.h:343
unsigned long * sevT
Definition: kutil.h:316
ideal Shdl
Definition: kutil.h:294
int tmax
Definition: kutil.h:343
intset fromQ
Definition: kutil.h:312
int sl
Definition: kutil.h:341
unsigned long * sevS
Definition: kutil.h:313
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
KINLINE TSet initT()
Definition: kInline.h:81
KINLINE TObject ** initR()
Definition: kInline.h:92
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3380
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5647
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8823
void cleanT(kStrategy strat)
Definition: kutil.cc:537
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9570
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10415
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9050
#define setmaxT
Definition: kutil.h:33
class sTObject TObject
Definition: kutil.h:53
static bool rIsSCA(const ring r)
Definition: nc.h:190
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1520
#define omfree(addr)
Definition: omAllocDecl.h:237
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define TEST_OPT_INTSTRATEGY
Definition: options.h:109
#define pDelete(p_ptr)
Definition: polys.h:181
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:70
ideal SCAQuotient(const ring r)
Definition: sca.h:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static short scaFirstAltVar(ring r)
Definition: sca.h:18
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s

◆ kMin_std()

ideal kMin_std ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
ideal &  M,
intvec hilb = NULL,
int  syzComp = 0,
int  reduced = 0 
)

Definition at line 2673 of file kstd1.cc.

2675 {
2676  if(idIs0(F))
2677  {
2678  M=idInit(1,F->rank);
2679  return idInit(1,F->rank);
2680  }
2682  {
2683  ideal sb;
2684  sb = kStd(F, Q, h, w, hilb);
2685  idSkipZeroes(sb);
2686  if(IDELEMS(sb) <= IDELEMS(F))
2687  {
2688  M = idCopy(sb);
2689  idSkipZeroes(M);
2690  return(sb);
2691  }
2692  else
2693  {
2694  M = idCopy(F);
2695  idSkipZeroes(M);
2696  return(sb);
2697  }
2698  }
2699  ideal r=NULL;
2700  int Kstd1_OldDeg = Kstd1_deg,i;
2701  intvec* temp_w=NULL;
2702  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2703  BOOLEAN delete_w=(w==NULL);
2704  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
2705  kStrategy strat=new skStrategy;
2706 
2707  if(!TEST_OPT_RETURN_SB)
2708  strat->syzComp = syzComp;
2710  strat->LazyPass=20;
2711  else
2712  strat->LazyPass=2;
2713  strat->LazyDegree = 1;
2714  strat->minim=(reduced % 2)+1;
2715  strat->ak = id_RankFreeModule(F,currRing);
2716  if (delete_w)
2717  {
2718  temp_w=new intvec((strat->ak)+1);
2719  w = &temp_w;
2720  }
2721  if (h==testHomog)
2722  {
2723  if (strat->ak == 0)
2724  {
2725  h = (tHomog)idHomIdeal(F,Q);
2726  w=NULL;
2727  }
2728  else
2729  {
2730  h = (tHomog)idHomModule(F,Q,w);
2731  }
2732  }
2733  if (h==isHomog)
2734  {
2735  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2736  {
2737  kModW = *w;
2738  strat->kModW = *w;
2739  assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
2740  strat->pOrigFDeg = currRing->pFDeg;
2741  strat->pOrigLDeg = currRing->pLDeg;
2743 
2744  toReset = TRUE;
2745  if (reduced>1)
2746  {
2747  Kstd1_OldDeg=Kstd1_deg;
2748  Kstd1_deg = -1;
2749  for (i=IDELEMS(F)-1;i>=0;i--)
2750  {
2751  if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
2752  Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
2753  }
2754  }
2755  }
2756  currRing->pLexOrder = TRUE;
2757  strat->LazyPass*=2;
2758  }
2759  strat->homog=h;
2761  {
2762  if (w!=NULL)
2763  r=mora(F,Q,*w,hilb,strat);
2764  else
2765  r=mora(F,Q,NULL,hilb,strat);
2766  }
2767  else
2768  {
2769  if (w!=NULL)
2770  r=bba(F,Q,*w,hilb,strat);
2771  else
2772  r=bba(F,Q,NULL,hilb,strat);
2773  }
2774 #ifdef KDEBUG
2775  {
2776  int i;
2777  for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
2778  }
2779 #endif
2780  idSkipZeroes(r);
2781  if (toReset)
2782  {
2783  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2784  kModW = NULL;
2785  }
2786  currRing->pLexOrder = b;
2787  HCord=strat->HCord;
2788  if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
2789  if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
2790  {
2791  M=idInit(1,F->rank);
2792  M->m[0]=pOne();
2793  //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
2794  if (strat->M!=NULL) idDelete(&strat->M);
2795  }
2796  else if (strat->M==NULL)
2797  {
2798  M=idInit(1,F->rank);
2799  WarnS("no minimal generating set computed");
2800  }
2801  else
2802  {
2803  idSkipZeroes(strat->M);
2804  M=strat->M;
2805  }
2806  delete(strat);
2807  if (reduced>2)
2808  {
2809  Kstd1_deg=Kstd1_OldDeg;
2810  if (!oldDegBound)
2812  }
2813  else
2814  {
2815  if (IDELEMS(M)>IDELEMS(r)) {
2816  idDelete(&M);
2817  M=idCopy(r); }
2818  }
2819  return r;
2820 }
CanonicalForm b
Definition: cfModGcd.cc:4044
Definition: intvec.h:21
intvec * kModW
Definition: kutil.h:328
int syzComp
Definition: kutil.h:347
int minim
Definition: kutil.h:351
ideal M
Definition: kutil.h:296
int LazyPass
Definition: kutil.h:346
int LazyDegree
Definition: kutil.h:346
#define WarnS
Definition: emacs.cc:78
const CanonicalForm & w
Definition: facAbsFact.cc:55
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
ideal idCopy(ideal A)
Definition: ideals.h:60
static Poly * h
Definition: janet.cc:972
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1516
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2064
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2087
int Kstd1_deg
Definition: kstd1.h:47
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:1901
int HCord
Definition: kutil.cc:235
#define assume(x)
Definition: mod2.h:390
#define TEST_OPT_DEGBOUND
Definition: options.h:112
#define TEST_OPT_RETURN_SB
Definition: options.h:111
#define OPT_DEGBOUND
Definition: options.h:89
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3600
#define pTest(p)
Definition: polys.h:409
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:233
#define pOne()
Definition: polys.h:309
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:539
#define M
Definition: sirandom.c:24
tHomog
Definition: structs.h:38
@ isHomog
Definition: structs.h:40
@ testHomog
Definition: structs.h:41

◆ kModDeg()

long kModDeg ( poly  p,
ring  r = currRing 
)

Definition at line 2064 of file kstd1.cc.

2065 {
2066  long o=p_WDegree(p, r);
2067  long i=__p_GetComp(p, r);
2068  if (i==0) return o;
2069  //assume((i>0) && (i<=kModW->length()));
2070  if (i<=kModW->length())
2071  return o+(*kModW)[i-1];
2072  return o;
2073 }
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
long p_WDegree(poly p, const ring r)
Definition: p_polys.cc:706

◆ kNF() [1/2]

ideal kNF ( ideal  F,
ideal  Q,
ideal  p,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 2910 of file kstd1.cc.

2911 {
2912  ideal res;
2913  if (TEST_OPT_PROT)
2914  {
2915  Print("(S:%d)",IDELEMS(p));mflush();
2916  }
2917  if (idIs0(p))
2918  return idInit(IDELEMS(p),si_max(p->rank,F->rank));
2919 
2920  ideal pp = p;
2921 #ifdef HAVE_PLURAL
2922  if(rIsSCA(currRing))
2923  {
2924  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2925  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2926  pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
2927 
2928  if(Q == currRing->qideal)
2929  Q = SCAQuotient(currRing);
2930  }
2931 #endif
2932 
2933  if ((idIs0(F))&&(Q==NULL))
2934  {
2935 #ifdef HAVE_PLURAL
2936  if(p != pp)
2937  return pp;
2938 #endif
2939  return idCopy(p); /*F+Q=0*/
2940  }
2941 
2942  kStrategy strat=new skStrategy;
2943  strat->syzComp = syzComp;
2945  if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
2946  {
2947  strat->ak = si_max(strat->ak,(int)F->rank);
2948  }
2949 
2951  res=kNF1(F,Q,pp,strat,lazyReduce);
2952  else
2953  res=kNF2(F,Q,pp,strat,lazyReduce);
2954  delete(strat);
2955 
2956 #ifdef HAVE_PLURAL
2957  if(pp != p)
2958  id_Delete(&pp, currRing);
2959 #endif
2960 
2961  return res;
2962 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:138
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd1.cc:1765
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3218

◆ kNF() [2/2]

poly kNF ( ideal  F,
ideal  Q,
poly  p,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 2822 of file kstd1.cc.

2823 {
2824  if (p==NULL)
2825  return NULL;
2826 
2827  poly pp = p;
2828 
2829 #ifdef HAVE_PLURAL
2830  if(rIsSCA(currRing))
2831  {
2832  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2833  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2834  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
2835 
2836  if(Q == currRing->qideal)
2837  Q = SCAQuotient(currRing);
2838  }
2839 #endif
2840 
2841  if ((idIs0(F))&&(Q==NULL))
2842  {
2843 #ifdef HAVE_PLURAL
2844  if(p != pp)
2845  return pp;
2846 #endif
2847  return pCopy(p); /*F+Q=0*/
2848  }
2849 
2850  kStrategy strat=new skStrategy;
2851  strat->syzComp = syzComp;
2852  strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p));
2853  poly res;
2854 
2856  res=kNF1(F,Q,pp,strat,lazyReduce);
2857  else
2858  res=kNF2(F,Q,pp,strat,lazyReduce);
2859  delete(strat);
2860 
2861 #ifdef HAVE_PLURAL
2862  if(pp != p)
2863  p_Delete(&pp, currRing);
2864 #endif
2865  return res;
2866 }
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1465
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:858
#define pMaxComp(p)
Definition: polys.h:293

◆ kNF1() [1/2]

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

Definition at line 1909 of file kstd1.cc.

1910 {
1911  assume(!idIs0(q));
1912  assume(!(idIs0(F)&&(Q==NULL)));
1913 
1914 // lazy_reduce flags: can be combined by |
1915 //#define KSTD_NF_LAZY 1
1916  // do only a reduction of the leading term
1917 //#define KSTD_NF_ECART 2
1918  // only local: recude even with bad ecart
1919  poly p;
1920  int i;
1921  int j;
1922  int o;
1923  LObject h;
1924  ideal res;
1925  BITSET save1;
1926  SI_SAVE_OPT1(save1);
1927 
1928  //if (idIs0(q)) return idInit(IDELEMS(q),si_max(q->rank,F->rank));
1929  //if ((idIs0(F))&&(Q==NULL))
1930  // return idCopy(q); /*F=0*/
1931  //strat->ak = si_max(idRankFreeModule(F),idRankFreeModule(q));
1932  /*- creating temp data structures------------------- -*/
1933  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1934  strat->kNoether=pCopy((currRing->ppNoether));
1937  && (0<Kstd1_deg)
1938  && ((!strat->kHEdgeFound)
1940  {
1941  pLmDelete(&strat->kNoether);
1942  strat->kNoether=pOne();
1943  pSetExp(strat->kNoether,1, Kstd1_deg+1);
1944  pSetm(strat->kNoether);
1945  strat->kHEdgeFound=TRUE;
1946  }
1947  initBuchMoraCrit(strat);
1949  initBuchMoraPosRing(strat);
1950  else
1951  initBuchMoraPos(strat);
1952  initMora(F,strat);
1953  strat->enterS = enterSMoraNF;
1954  /*- set T -*/
1955  strat->tl = -1;
1956  strat->tmax = setmaxT;
1957  strat->T = initT();
1958  strat->R = initR();
1959  strat->sevT = initsevT();
1960  /*- set S -*/
1961  strat->sl = -1;
1962  /*- init local data struct.-------------------------- -*/
1963  /*Shdl=*/initS(F,Q,strat);
1964  if ((strat->ak!=0)
1965  && (strat->kHEdgeFound))
1966  {
1967  if (strat->ak!=1)
1968  {
1969  pSetComp(strat->kNoether,1);
1970  pSetmComp(strat->kNoether);
1971  poly p=pHead(strat->kNoether);
1972  pSetComp(p,strat->ak);
1973  pSetmComp(p);
1974  p=pAdd(strat->kNoether,p);
1975  strat->kNoether=pNext(p);
1977  }
1978  }
1979  if (TEST_OPT_INTSTRATEGY && ((lazyReduce & KSTD_NF_LAZY)==0))
1980  {
1981  for (i=strat->sl; i>=0; i--)
1982  pNorm(strat->S[i]);
1983  }
1984  /*- compute------------------------------------------- -*/
1985  res=idInit(IDELEMS(q),strat->ak);
1986  for (i=0; i<IDELEMS(q); i++)
1987  {
1988  if (q->m[i]!=NULL)
1989  {
1990  p = pCopy(q->m[i]);
1991  deleteHC(&p,&o,&j,strat);
1992  if (p!=NULL)
1993  {
1994  /*- puts the elements of S also to T -*/
1995  for (j=0; j<=strat->sl; j++)
1996  {
1997  h.p = strat->S[j];
1998  h.ecart = strat->ecartS[j];
1999  h.pLength = h.length = pLength(h.p);
2000  if (strat->sevS[j] == 0) strat->sevS[j] = pGetShortExpVector(h.p);
2001  else assume(strat->sevS[j] == pGetShortExpVector(h.p));
2002  h.sev = strat->sevS[j];
2003  h.SetpFDeg();
2005  enterT_strong(h,strat);
2006  else
2007  enterT(h,strat);
2008  }
2009  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2011  {
2012  p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
2013  }
2014  else
2015  p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
2016  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2017  {
2018  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2019  p = redtail(p,strat->sl,strat);
2020  }
2021  cleanT(strat);
2022  }
2023  res->m[i]=p;
2024  }
2025  //else
2026  // res->m[i]=NULL;
2027  }
2028  /*- release temp data------------------------------- -*/
2029  assume(strat->L==NULL); /*strat->L unsed */
2030  assume(strat->B==NULL); /*strat->B unused */
2031  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2032  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2033  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2034  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2035  omFree(strat->sevT);
2036  omFree(strat->S_2_R);
2037  omFree(strat->R);
2038  if ((Q!=NULL)&&(strat->fromQ!=NULL))
2039  {
2041  omFreeSize((ADDRESS)strat->fromQ,i*sizeof(int));
2042  strat->fromQ=NULL;
2043  }
2044  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
2045  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
2046 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2047 // {
2048 // pFDeg=strat->pOrigFDeg;
2049 // pLDeg=strat->pOrigLDeg;
2050 // if (ecartWeights)
2051 // {
2052 // omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2053 // ecartWeights=NULL;
2054 // }
2055 // }
2056  idDelete(&strat->Shdl);
2057  SI_RESTORE_OPT1(save1);
2058  if (TEST_OPT_PROT) PrintLn();
2059  return res;
2060 }
polyset S
Definition: kutil.h:297
LSet B
Definition: kutil.h:319
LSet L
Definition: kutil.h:318
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1459
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1326
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:764
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:664
#define KSTD_NF_ECART
Definition: kstd1.h:19
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7321
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9291
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9721
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9372
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:9807
#define setmaxTinc
Definition: kutil.h:34
class sLObject LObject
Definition: kutil.h:54
#define pNext(p)
Definition: monomials.h:37
#define omFree(addr)
Definition: omAllocDecl.h:261
#define OPT_REDTAIL
Definition: options.h:90
#define TEST_OPT_STAIRCASEBOUND
Definition: options.h:114
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:712
static unsigned pLength(poly a)
Definition: p_polys.h:193
#define pAdd(p, q)
Definition: polys.h:198
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition: polys.h:67
#define pSetm(p)
Definition: polys.h:265
#define pSetComp(p, v)
Definition: polys.h:38
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition: polys.h:152
#define pSetmComp(p)
TODO:
Definition: polys.h:267
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:357
#define pSetExp(p, i, v)
Definition: polys.h:42
#define pWTotaldegree(p)
Definition: polys.h:277
void PrintS(const char *s)
Definition: reporter.cc:284

◆ kNF1() [2/2]

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

Definition at line 1765 of file kstd1.cc.

1766 {
1767  assume(q!=NULL);
1768  assume(!(idIs0(F)&&(Q==NULL)));
1769 
1770 // lazy_reduce flags: can be combined by |
1771 //#define KSTD_NF_LAZY 1
1772  // do only a reduction of the leading term
1773 //#define KSTD_NF_ECART 2
1774  // only local: recude even with bad ecart
1775  poly p;
1776  int i;
1777  int j;
1778  int o;
1779  LObject h;
1780  BITSET save1;
1781  SI_SAVE_OPT1(save1);
1782 
1783  //if ((idIs0(F))&&(Q==NULL))
1784  // return pCopy(q); /*F=0*/
1785  //strat->ak = si_max(idRankFreeModule(F),pMaxComp(q));
1786  /*- creating temp data structures------------------- -*/
1787  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1788  strat->kNoether = pCopy((currRing->ppNoether));
1792  && (! TEST_V_DEG_STOP)
1793  && (0<Kstd1_deg)
1794  && ((!strat->kHEdgeFound)
1796  {
1797  pLmDelete(&strat->kNoether);
1798  strat->kNoether=pOne();
1799  pSetExp(strat->kNoether,1, Kstd1_deg+1);
1800  pSetm(strat->kNoether);
1801  strat->kHEdgeFound=TRUE;
1802  }
1803  initBuchMoraCrit(strat);
1805  initBuchMoraPosRing(strat);
1806  else
1807  initBuchMoraPos(strat);
1808  initMora(F,strat);
1809  strat->enterS = enterSMoraNF;
1810  /*- set T -*/
1811  strat->tl = -1;
1812  strat->tmax = setmaxT;
1813  strat->T = initT();
1814  strat->R = initR();
1815  strat->sevT = initsevT();
1816  /*- set S -*/
1817  strat->sl = -1;
1818  /*- init local data struct.-------------------------- -*/
1819  /*Shdl=*/initS(F,Q,strat);
1820  if ((strat->ak!=0)
1821  && (strat->kHEdgeFound))
1822  {
1823  if (strat->ak!=1)
1824  {
1825  pSetComp(strat->kNoether,1);
1826  pSetmComp(strat->kNoether);
1827  poly p=pHead(strat->kNoether);
1828  pSetComp(p,strat->ak);
1829  pSetmComp(p);
1830  p=pAdd(strat->kNoether,p);
1831  strat->kNoether=pNext(p);
1833  }
1834  }
1835  if ((lazyReduce & KSTD_NF_LAZY)==0)
1836  {
1837  for (i=strat->sl; i>=0; i--)
1838  pNorm(strat->S[i]);
1839  }
1840  /*- puts the elements of S also to T -*/
1841  for (i=0; i<=strat->sl; i++)
1842  {
1843  h.p = strat->S[i];
1844  h.ecart = strat->ecartS[i];
1845  if (strat->sevS[i] == 0) strat->sevS[i] = pGetShortExpVector(h.p);
1846  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
1847  h.length = pLength(h.p);
1848  h.sev = strat->sevS[i];
1849  h.SetpFDeg();
1850  enterT(h,strat);
1851  }
1852 #ifdef KDEBUG
1853 // kDebugPrint(strat);
1854 #endif
1855  /*- compute------------------------------------------- -*/
1856  p = pCopy(q);
1857  deleteHC(&p,&o,&j,strat);
1858  kTest(strat);
1859  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
1860  if (BVERBOSE(23)) kDebugPrint(strat);
1862  {
1863  if (p!=NULL) p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
1864  }
1865  else
1866  {
1867  if (p!=NULL) p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
1868  }
1869  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
1870  {
1871  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
1872  p = redtail(p,strat->sl,strat);
1873  }
1874  /*- release temp data------------------------------- -*/
1875  cleanT(strat);
1876  assume(strat->L==NULL); /*strat->L unsed */
1877  assume(strat->B==NULL); /*strat->B unused */
1878  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
1879  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
1880  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
1881  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
1882  omFree(strat->sevT);
1883  omFree(strat->S_2_R);
1884  omFree(strat->R);
1885 
1886  if ((Q!=NULL)&&(strat->fromQ!=NULL))
1887  {
1888  i=((IDELEMS(Q)+IDELEMS(F)+15)/16)*16;
1889  omFreeSize((ADDRESS)strat->fromQ,i*sizeof(int));
1890  strat->fromQ=NULL;
1891  }
1892  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
1893  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
1894 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1895 // {
1896 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1897 // if (ecartWeights)
1898 // {
1899 // omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
1900 // ecartWeights=NULL;
1901 // }
1902 // }
1903  idDelete(&strat->Shdl);
1904  SI_RESTORE_OPT1(save1);
1905  if (TEST_OPT_PROT) PrintLn();
1906  return p;
1907 }
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11619
BOOLEAN kTest(kStrategy strat)
Definition: kutil.cc:933
#define OPT_INTSTRATEGY
Definition: options.h:91
#define BVERBOSE(a)
Definition: options.h:35
#define TEST_V_DEG_STOP
Definition: options.h:135

◆ kNFBound() [1/2]

ideal kNFBound ( ideal  F,
ideal  Q,
ideal  p,
int  bound,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 2964 of file kstd1.cc.

2965 {
2966  ideal res;
2967  if (TEST_OPT_PROT)
2968  {
2969  Print("(S:%d)",IDELEMS(p));mflush();
2970  }
2971  if (idIs0(p))
2972  return idInit(IDELEMS(p),si_max(p->rank,F->rank));
2973 
2974  ideal pp = p;
2975 #ifdef HAVE_PLURAL
2976  if(rIsSCA(currRing))
2977  {
2978  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2979  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2980  pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
2981 
2982  if(Q == currRing->qideal)
2983  Q = SCAQuotient(currRing);
2984  }
2985 #endif
2986 
2987  if ((idIs0(F))&&(Q==NULL))
2988  {
2989 #ifdef HAVE_PLURAL
2990  if(p != pp)
2991  return pp;
2992 #endif
2993  return idCopy(p); /*F+Q=0*/
2994  }
2995 
2996  kStrategy strat=new skStrategy;
2997  strat->syzComp = syzComp;
2999  if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3000  {
3001  strat->ak = si_max(strat->ak,(int)F->rank);
3002  }
3003 
3004  res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3005  delete(strat);
3006 
3007 #ifdef HAVE_PLURAL
3008  if(pp != p)
3009  id_Delete(&pp, currRing);
3010 #endif
3011 
3012  return res;
3013 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3287

◆ kNFBound() [2/2]

poly kNFBound ( ideal  F,
ideal  Q,
poly  p,
int  bound,
int  syzComp = 0,
int  lazyReduce = 0 
)

Definition at line 2868 of file kstd1.cc.

2869 {
2870  if (p==NULL)
2871  return NULL;
2872 
2873  poly pp = p;
2874 
2875 #ifdef HAVE_PLURAL
2876  if(rIsSCA(currRing))
2877  {
2878  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2879  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2880  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
2881 
2882  if(Q == currRing->qideal)
2883  Q = SCAQuotient(currRing);
2884  }
2885 #endif
2886 
2887  if ((idIs0(F))&&(Q==NULL))
2888  {
2889 #ifdef HAVE_PLURAL
2890  if(p != pp)
2891  return pp;
2892 #endif
2893  return pCopy(p); /*F+Q=0*/
2894  }
2895 
2896  kStrategy strat=new skStrategy;
2897  strat->syzComp = syzComp;
2898  strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p));
2899  poly res;
2900  res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
2901  delete(strat);
2902 
2903 #ifdef HAVE_PLURAL
2904  if(pp != p)
2905  p_Delete(&pp, currRing);
2906 #endif
2907  return res;
2908 }

◆ kSba()

ideal kSba ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  mw,
int  incremental = 0,
int  arri = 0,
intvec hilb = NULL,
int  syzComp = 0,
int  newIdeal = 0,
intvec vw = NULL 
)

Definition at line 2268 of file kstd1.cc.

2270 {
2271  if(idIs0(F))
2272  return idInit(1,F->rank);
2273  if(!rField_is_Ring(currRing))
2274  {
2275  ideal r;
2276  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2277  BOOLEAN delete_w=(w==NULL);
2278  kStrategy strat=new skStrategy;
2279  strat->sbaOrder = sbaOrder;
2280  if (arri!=0)
2281  {
2282  strat->rewCrit1 = arriRewDummy;
2283  strat->rewCrit2 = arriRewCriterion;
2284  strat->rewCrit3 = arriRewCriterionPre;
2285  }
2286  else
2287  {
2288  strat->rewCrit1 = faugereRewCriterion;
2289  strat->rewCrit2 = faugereRewCriterion;
2290  strat->rewCrit3 = faugereRewCriterion;
2291  }
2292 
2293  if(!TEST_OPT_RETURN_SB)
2294  strat->syzComp = syzComp;
2295  if (TEST_OPT_SB_1)
2296  //if(!rField_is_Ring(currRing)) // always true here
2297  strat->newIdeal = newIdeal;
2299  strat->LazyPass=20;
2300  else
2301  strat->LazyPass=2;
2302  strat->LazyDegree = 1;
2304  strat->chainCrit=chainCritNormal;
2306  strat->ak = id_RankFreeModule(F,currRing);
2307  strat->kModW=kModW=NULL;
2308  strat->kHomW=kHomW=NULL;
2309  if (vw != NULL)
2310  {
2311  currRing->pLexOrder=FALSE;
2312  strat->kHomW=kHomW=vw;
2313  strat->pOrigFDeg = currRing->pFDeg;
2314  strat->pOrigLDeg = currRing->pLDeg;
2316  toReset = TRUE;
2317  }
2318  if (h==testHomog)
2319  {
2320  if (strat->ak == 0)
2321  {
2322  h = (tHomog)idHomIdeal(F,Q);
2323  w=NULL;
2324  }
2325  else if (!TEST_OPT_DEGBOUND)
2326  {
2327  if (w!=NULL)
2328  h = (tHomog)idHomModule(F,Q,w);
2329  else
2330  h = (tHomog)idHomIdeal(F,Q);
2331  }
2332  }
2333  currRing->pLexOrder=b;
2334  if (h==isHomog)
2335  {
2336  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2337  {
2338  strat->kModW = kModW = *w;
2339  if (vw == NULL)
2340  {
2341  strat->pOrigFDeg = currRing->pFDeg;
2342  strat->pOrigLDeg = currRing->pLDeg;
2344  toReset = TRUE;
2345  }
2346  }
2347  currRing->pLexOrder = TRUE;
2348  if (hilb==NULL) strat->LazyPass*=2;
2349  }
2350  strat->homog=h;
2351  #ifdef KDEBUG
2352  idTest(F);
2353  if(Q != NULL)
2354  idTest(Q);
2355  #endif
2356  #ifdef HAVE_PLURAL
2357  if (rIsPluralRing(currRing))
2358  {
2359  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2360  strat->no_prod_crit = ! bIsSCA;
2361  if (w!=NULL)
2362  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2363  else
2364  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2365  }
2366  else
2367  #endif
2368  {
2370  {
2371  if (w!=NULL)
2372  r=mora(F,Q,*w,hilb,strat);
2373  else
2374  r=mora(F,Q,NULL,hilb,strat);
2375  }
2376  else
2377  {
2378  strat->sigdrop = FALSE;
2379  if (w!=NULL)
2380  r=sba(F,Q,*w,hilb,strat);
2381  else
2382  r=sba(F,Q,NULL,hilb,strat);
2383  }
2384  }
2385  #ifdef KDEBUG
2386  idTest(r);
2387  #endif
2388  if (toReset)
2389  {
2390  kModW = NULL;
2391  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2392  }
2393  currRing->pLexOrder = b;
2394  //Print("%d reductions canceled \n",strat->cel);
2395  HCord=strat->HCord;
2396  //delete(strat);
2397  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2398  return r;
2399  }
2400  else
2401  {
2402  //--------------------------RING CASE-------------------------
2403  assume(sbaOrder == 1);
2404  assume(arri == 0);
2405  ideal r;
2406  r = idCopy(F);
2407  int sbaEnterS = -1;
2408  bool sigdrop = TRUE;
2409  //This is how we set the SBA algorithm;
2410  int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2411  while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2412  && (blockred <= blockedreductions))
2413  {
2414  loops++;
2415  if(loops == 1)
2416  sigdrop = FALSE;
2417  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2418  BOOLEAN delete_w=(w==NULL);
2419  kStrategy strat=new skStrategy;
2420  strat->sbaEnterS = sbaEnterS;
2421  strat->sigdrop = sigdrop;
2422  #if 0
2423  strat->blockred = blockred;
2424  #else
2425  strat->blockred = 0;
2426  #endif
2427  strat->blockredmax = blockedreductions;
2428  //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2429  //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2430  strat->sbaOrder = sbaOrder;
2431  if (arri!=0)
2432  {
2433  strat->rewCrit1 = arriRewDummy;
2434  strat->rewCrit2 = arriRewCriterion;
2435  strat->rewCrit3 = arriRewCriterionPre;
2436  }
2437  else
2438  {
2439  strat->rewCrit1 = faugereRewCriterion;
2440  strat->rewCrit2 = faugereRewCriterion;
2441  strat->rewCrit3 = faugereRewCriterion;
2442  }
2443 
2444  if(!TEST_OPT_RETURN_SB)
2445  strat->syzComp = syzComp;
2446  if (TEST_OPT_SB_1)
2447  if(!rField_is_Ring(currRing))
2448  strat->newIdeal = newIdeal;
2450  strat->LazyPass=20;
2451  else
2452  strat->LazyPass=2;
2453  strat->LazyDegree = 1;
2455  strat->chainCrit=chainCritNormal;
2457  strat->ak = id_RankFreeModule(F,currRing);
2458  strat->kModW=kModW=NULL;
2459  strat->kHomW=kHomW=NULL;
2460  if (vw != NULL)
2461  {
2462  currRing->pLexOrder=FALSE;
2463  strat->kHomW=kHomW=vw;
2464  strat->pOrigFDeg = currRing->pFDeg;
2465  strat->pOrigLDeg = currRing->pLDeg;
2467  toReset = TRUE;
2468  }
2469  if (h==testHomog)
2470  {
2471  if (strat->ak == 0)
2472  {
2473  h = (tHomog)idHomIdeal(F,Q);
2474  w=NULL;
2475  }
2476  else if (!TEST_OPT_DEGBOUND)
2477  {
2478  if (w!=NULL)
2479  h = (tHomog)idHomModule(F,Q,w);
2480  else
2481  h = (tHomog)idHomIdeal(F,Q);
2482  }
2483  }
2484  currRing->pLexOrder=b;
2485  if (h==isHomog)
2486  {
2487  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2488  {
2489  strat->kModW = kModW = *w;
2490  if (vw == NULL)
2491  {
2492  strat->pOrigFDeg = currRing->pFDeg;
2493  strat->pOrigLDeg = currRing->pLDeg;
2495  toReset = TRUE;
2496  }
2497  }
2498  currRing->pLexOrder = TRUE;
2499  if (hilb==NULL) strat->LazyPass*=2;
2500  }
2501  strat->homog=h;
2502  #ifdef KDEBUG
2503  idTest(F);
2504  if(Q != NULL)
2505  idTest(Q);
2506  #endif
2507  #ifdef HAVE_PLURAL
2508  if (rIsPluralRing(currRing))
2509  {
2510  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2511  strat->no_prod_crit = ! bIsSCA;
2512  if (w!=NULL)
2513  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2514  else
2515  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2516  }
2517  else
2518  #endif
2519  {
2521  {
2522  if (w!=NULL)
2523  r=mora(F,Q,*w,hilb,strat);
2524  else
2525  r=mora(F,Q,NULL,hilb,strat);
2526  }
2527  else
2528  {
2529  if (w!=NULL)
2530  r=sba(r,Q,*w,hilb,strat);
2531  else
2532  {
2533  r=sba(r,Q,NULL,hilb,strat);
2534  }
2535  }
2536  }
2537  #ifdef KDEBUG
2538  idTest(r);
2539  #endif
2540  if (toReset)
2541  {
2542  kModW = NULL;
2543  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2544  }
2545  currRing->pLexOrder = b;
2546  //Print("%d reductions canceled \n",strat->cel);
2547  HCord=strat->HCord;
2548  sigdrop = strat->sigdrop;
2549  sbaEnterS = strat->sbaEnterS;
2550  blockred = strat->blockred;
2551  delete(strat);
2552  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2553  }
2554  // Go to std
2555  if(sigdrop || blockred > blockedreductions)
2556  {
2557  r = kStd(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2558  }
2559  return r;
2560  }
2561 }
bool sigdrop
Definition: kutil.h:353
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:282
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:284
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:286
intvec * kHomW
Definition: kutil.h:329
int blockred
Definition: kutil.h:358
unsigned sbaOrder
Definition: kutil.h:307
int blockredmax
Definition: kutil.h:359
int newIdeal
Definition: kutil.h:350
char z2homog
Definition: kutil.h:368
char no_prod_crit
Definition: kutil.h:388
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:281
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:285
int sbaEnterS
Definition: kutil.h:356
#define idTest(id)
Definition: ideals.h:47
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition: kInline.h:1132
static ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
Definition: nc.h:27
intvec * kHomW
Definition: kstd1.cc:2062
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2074
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:2251
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition: kutil.cc:7129
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition: kutil.cc:7104
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1877
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition: kutil.cc:7045
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3353
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3140
if(yy_init)
Definition: libparse.cc:1418
#define TEST_OPT_SB_1
Definition: options.h:117

◆ kStd()

ideal kStd ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  mw,
intvec hilb = NULL,
int  syzComp = 0,
int  newIdeal = 0,
intvec vw = NULL,
s_poly_proc_t  sp = NULL 
)

Definition at line 2087 of file kstd1.cc.

2089 {
2090  if(idIs0(F))
2091  return idInit(1,F->rank);
2092 
2093  ideal r;
2094  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2095  BOOLEAN delete_w=(w==NULL);
2096  kStrategy strat=new skStrategy;
2097 
2098  strat->s_poly=sp;
2099  if(!TEST_OPT_RETURN_SB)
2100  strat->syzComp = syzComp;
2101  if (TEST_OPT_SB_1
2102  &&(!rField_is_Ring(currRing))
2103  )
2104  strat->newIdeal = newIdeal;
2106  strat->LazyPass=20;
2107  else
2108  strat->LazyPass=2;
2109  strat->LazyDegree = 1;
2110  strat->ak = id_RankFreeModule(F,currRing);
2111  strat->kModW=kModW=NULL;
2112  strat->kHomW=kHomW=NULL;
2113  if (vw != NULL)
2114  {
2115  currRing->pLexOrder=FALSE;
2116  strat->kHomW=kHomW=vw;
2117  strat->pOrigFDeg = currRing->pFDeg;
2118  strat->pOrigLDeg = currRing->pLDeg;
2120  toReset = TRUE;
2121  }
2122  if (h==testHomog)
2123  {
2124  if (strat->ak == 0)
2125  {
2126  h = (tHomog)idHomIdeal(F,Q);
2127  w=NULL;
2128  }
2129  else if (!TEST_OPT_DEGBOUND)
2130  {
2131  if (w!=NULL)
2132  h = (tHomog)idHomModule(F,Q,w);
2133  else
2134  h = (tHomog)idHomIdeal(F,Q);
2135  }
2136  }
2137  currRing->pLexOrder=b;
2138  if (h==isHomog)
2139  {
2140  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2141  {
2142  strat->kModW = kModW = *w;
2143  if (vw == NULL)
2144  {
2145  strat->pOrigFDeg = currRing->pFDeg;
2146  strat->pOrigLDeg = currRing->pLDeg;
2148  toReset = TRUE;
2149  }
2150  }
2151  currRing->pLexOrder = TRUE;
2152  if (hilb==NULL) strat->LazyPass*=2;
2153  }
2154  strat->homog=h;
2155 #ifdef KDEBUG
2156  idTest(F);
2157  if (Q!=NULL) idTest(Q);
2158 #endif
2159 #ifdef HAVE_PLURAL
2160  if (rIsPluralRing(currRing))
2161  {
2162  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2163  strat->no_prod_crit = ! bIsSCA;
2164  if (w!=NULL)
2165  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2166  else
2167  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2168  }
2169  else
2170 #endif
2171  {
2172  #if PRE_INTEGER_CHECK
2173  //the preinteger check strategy is not for modules
2174  if(nCoeff_is_Z(currRing->cf) && strat->ak <= 0)
2175  {
2176  ideal FCopy = idCopy(F);
2177  poly pFmon = preIntegerCheck(FCopy, Q);
2178  if(pFmon != NULL)
2179  {
2180  idInsertPoly(FCopy, pFmon);
2181  strat->kModW=kModW=NULL;
2182  if (h==testHomog)
2183  {
2184  if (strat->ak == 0)
2185  {
2186  h = (tHomog)idHomIdeal(FCopy,Q);
2187  w=NULL;
2188  }
2189  else if (!TEST_OPT_DEGBOUND)
2190  {
2191  if (w!=NULL)
2192  h = (tHomog)idHomModule(FCopy,Q,w);
2193  else
2194  h = (tHomog)idHomIdeal(FCopy,Q);
2195  }
2196  }
2197  currRing->pLexOrder=b;
2198  if (h==isHomog)
2199  {
2200  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2201  {
2202  strat->kModW = kModW = *w;
2203  if (vw == NULL)
2204  {
2205  strat->pOrigFDeg = currRing->pFDeg;
2206  strat->pOrigLDeg = currRing->pLDeg;
2208  toReset = TRUE;
2209  }
2210  }
2211  currRing->pLexOrder = TRUE;
2212  if (hilb==NULL) strat->LazyPass*=2;
2213  }
2214  strat->homog=h;
2215  }
2216  omTestMemory(1);
2217  if(w == NULL)
2218  {
2220  r=mora(FCopy,Q,NULL,hilb,strat);
2221  else
2222  r=bba(FCopy,Q,NULL,hilb,strat);
2223  }
2224  else
2225  {
2227  r=mora(FCopy,Q,*w,hilb,strat);
2228  else
2229  r=bba(FCopy,Q,*w,hilb,strat);
2230  }
2231  idDelete(&FCopy);
2232  }
2233  else
2234  #endif
2235  {
2236  if(w==NULL)
2237  {
2239  r=mora(F,Q,NULL,hilb,strat);
2240  else
2241  r=bba(F,Q,NULL,hilb,strat);
2242  }
2243  else
2244  {
2246  r=mora(F,Q,*w,hilb,strat);
2247  else
2248  r=bba(F,Q,*w,hilb,strat);
2249  }
2250  }
2251  }
2252 #ifdef KDEBUG
2253  idTest(r);
2254 #endif
2255  if (toReset)
2256  {
2257  kModW = NULL;
2258  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2259  }
2260  currRing->pLexOrder = b;
2261 //Print("%d reductions canceled \n",strat->cel);
2262  HCord=strat->HCord;
2263  delete(strat);
2264  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2265  return r;
2266 }
s_poly_proc_t s_poly
Definition: kutil.h:291
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
poly preIntegerCheck(const ideal Forig, const ideal Q)
used for GB over ZZ: look for constant and monomial elements in the ideal background: any known const...
Definition: kutil.cc:10664
omError_t omTestMemory(int check_level)
Definition: omDebug.c:94

◆ kStdShift()

ideal kStdShift ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
intvec hilb,
int  syzComp,
int  newIdeal,
intvec vw,
int  uptodeg,
int  lVblock 
)

Definition at line 2564 of file kstd1.cc.

2566 {
2567  ideal r;
2568  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2569  BOOLEAN delete_w=(w==NULL);
2570  kStrategy strat=new skStrategy;
2571  intvec* temp_w=NULL;
2572 
2573  if(!TEST_OPT_RETURN_SB)
2574  strat->syzComp = syzComp;
2575  if (TEST_OPT_SB_1)
2576  if(!rField_is_Ring(currRing))
2577  strat->newIdeal = newIdeal;
2579  strat->LazyPass=20;
2580  else
2581  strat->LazyPass=2;
2582  strat->LazyDegree = 1;
2583  strat->ak = id_RankFreeModule(F,currRing);
2584  strat->kModW=kModW=NULL;
2585  strat->kHomW=kHomW=NULL;
2586  if (vw != NULL)
2587  {
2588  currRing->pLexOrder=FALSE;
2589  strat->kHomW=kHomW=vw;
2590  strat->pOrigFDeg = currRing->pFDeg;
2591  strat->pOrigLDeg = currRing->pLDeg;
2593  toReset = TRUE;
2594  }
2595  if (h==testHomog)
2596  {
2597  if (delete_w)
2598  {
2599  temp_w=new intvec((strat->ak)+1);
2600  w = &temp_w;
2601  }
2602  if (strat->ak == 0)
2603  {
2604  h = (tHomog)idHomIdeal(F,Q);
2605  w=NULL;
2606  }
2607  else if (!TEST_OPT_DEGBOUND)
2608  {
2609  if (w!=NULL)
2610  h = (tHomog)idHomModule(F,Q,w);
2611  else
2612  h = (tHomog)idHomIdeal(F,Q);
2613  }
2614  }
2615  currRing->pLexOrder=b;
2616  if (h==isHomog)
2617  {
2618  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2619  {
2620  strat->kModW = kModW = *w;
2621  if (vw == NULL)
2622  {
2623  strat->pOrigFDeg = currRing->pFDeg;
2624  strat->pOrigLDeg = currRing->pLDeg;
2626  toReset = TRUE;
2627  }
2628  }
2629  currRing->pLexOrder = TRUE;
2630  if (hilb==NULL) strat->LazyPass*=2;
2631  }
2632  strat->homog=h;
2633 #ifdef KDEBUG
2634  idTest(F);
2635 #endif
2637  {
2638  /* error: no local ord yet with shifts */
2639  WerrorS("No local ordering possible for shift algebra");
2640  return(NULL);
2641  }
2642  else
2643  {
2644  /* global ordering */
2645  if (w!=NULL)
2646  r=bbaShift(F,Q,*w,hilb,strat,uptodeg,lV);
2647  else
2648  r=bbaShift(F,Q,NULL,hilb,strat,uptodeg,lV);
2649  }
2650 #ifdef KDEBUG
2651  idTest(r);
2652 #endif
2653  if (toReset)
2654  {
2655  kModW = NULL;
2656  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2657  }
2658  currRing->pLexOrder = b;
2659 //Print("%d reductions canceled \n",strat->cel);
2660  HCord=strat->HCord;
2661  delete(strat);
2662  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2663  return r;
2664 }
void WerrorS(const char *s)
Definition: feFopen.cc:24
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
Definition: kstd2.cc:3830

◆ mora()

ideal mora ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1516 of file kstd1.cc.

1517 {
1518  int olddeg = 0;
1519  int reduc = 0;
1520  int red_result = 1;
1521  int hilbeledeg=1,hilbcount=0;
1522  BITSET save1;
1523  SI_SAVE_OPT1(save1);
1525  {
1526  si_opt_1 &= ~Sy_bit(OPT_REDSB);
1528  }
1529 
1530  strat->update = TRUE;
1531  /*- setting global variables ------------------- -*/
1532  initBuchMoraCrit(strat);
1533  initHilbCrit(F,Q,&hilb,strat);
1534  initMora(F,strat);
1536  initBuchMoraPosRing(strat);
1537  else
1538  initBuchMoraPos(strat);
1539  /*Shdl=*/initBuchMora(F,Q,strat);
1540  if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
1541  /*updateS in initBuchMora has Hecketest
1542  * and could have put strat->kHEdgdeFound FALSE*/
1543  if ((currRing->ppNoether)!=NULL)
1544  {
1545  strat->kHEdgeFound = TRUE;
1546  }
1547  if (strat->kHEdgeFound && strat->update)
1548  {
1549  firstUpdate(strat);
1550  updateLHC(strat);
1551  reorderL(strat);
1552  }
1553  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
1554  {
1555  strat->posInLOld = strat->posInL;
1556  strat->posInLOldFlag = FALSE;
1557  strat->posInL = posInL10;
1558  updateL(strat);
1559  reorderL(strat);
1560  }
1561  kTest_TS(strat);
1562  strat->use_buckets = kMoraUseBucket(strat);
1563 
1564 #ifdef HAVE_TAIL_RING
1565  if (strat->homog && strat->red == redFirst)
1566  if(!idIs0(F) &&(!rField_is_Ring(currRing)))
1567  kStratInitChangeTailRing(strat);
1568 #endif
1569 
1570  if (BVERBOSE(23))
1571  {
1572  kDebugPrint(strat);
1573  }
1574 //deleteInL(strat->L,&strat->Ll,1,strat);
1575 //deleteInL(strat->L,&strat->Ll,0,strat);
1576 
1577  /*- compute-------------------------------------------*/
1578  while (strat->Ll >= 0)
1579  {
1580  #ifdef KDEBUG
1581  if (TEST_OPT_DEBUG) messageSets(strat);
1582  #endif
1583  if (siCntrlc)
1584  {
1585  while (strat->Ll >= 0)
1586  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1587  strat->noClearS=TRUE;
1588  }
1589  if (TEST_OPT_DEGBOUND
1590  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1591  {
1592  /*
1593  * stops computation if
1594  * - 24 (degBound)
1595  * && upper degree is bigger than Kstd1_deg
1596  */
1597  while ((strat->Ll >= 0)
1598  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1599  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1600  )
1601  {
1602  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1603  //if (TEST_OPT_PROT)
1604  //{
1605  // PrintS("D"); mflush();
1606  //}
1607  }
1608  if (strat->Ll<0) break;
1609  else strat->noClearS=TRUE;
1610  }
1611  strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1612  if (strat->Ll==0) strat->interpt=TRUE;
1613  strat->Ll--;
1614  // create the real Spoly
1615  if (pNext(strat->P.p) == strat->tail)
1616  {
1617  /*- deletes the short spoly and computes -*/
1618  if (rField_is_Ring(currRing))
1619  pLmDelete(strat->P.p);
1620  else
1621  pLmFree(strat->P.p);
1622  strat->P.p = NULL;
1623  poly m1 = NULL, m2 = NULL;
1624  // check that spoly creation is ok
1625  while (strat->tailRing != currRing &&
1626  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1627  {
1628  assume(m1 == NULL && m2 == NULL);
1629  // if not, change to a ring where exponents are large enough
1630  kStratChangeTailRing(strat);
1631  }
1632  /* create the real one */
1633  ksCreateSpoly(&(strat->P), strat->kNoetherTail(), strat->use_buckets,
1634  strat->tailRing, m1, m2, strat->R);
1635  if (!strat->use_buckets)
1636  strat->P.SetLength(strat->length_pLength);
1637  }
1638  else if (strat->P.p1 == NULL)
1639  {
1640  // for input polys, prepare reduction (buckets !)
1641  strat->P.SetLength(strat->length_pLength);
1642  strat->P.PrepareRed(strat->use_buckets);
1643  }
1644 
1645  // the s-poly
1646  if (!strat->P.IsNull())
1647  {
1648  // might be NULL from noether !!!
1649  if (TEST_OPT_PROT)
1650  message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
1651  // reduce
1652  red_result = strat->red(&strat->P,strat);
1653  }
1654 
1655  // the reduced s-poly
1656  if (! strat->P.IsNull())
1657  {
1658  strat->P.GetP();
1659  // statistics
1660  if (TEST_OPT_PROT) PrintS("s");
1661  // normalization
1663  strat->P.pCleardenom();
1664  else
1665  strat->P.pNorm();
1666  // tailreduction
1667  strat->P.p = redtail(&(strat->P),strat->sl,strat);
1668  if (strat->P.p==NULL)
1669  {
1670  WerrorS("expoent overflow - wrong ordering");
1671  return(idInit(1,1));
1672  }
1673  // set ecart -- might have changed because of tail reductions
1674  if ((!strat->noTailReduction) && (!strat->honey))
1675  strat->initEcart(&strat->P);
1676  // cancel unit
1677  cancelunit(&strat->P);
1678  // for char 0, clear denominators
1679  if ((strat->P.p->next==NULL) /* i.e. cancelunit did something*/
1681  strat->P.pCleardenom();
1682 
1683  enterT(strat->P,strat);
1684  // build new pairs
1685  if (rField_is_Ring(currRing))
1686  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1687  else
1688  enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1689  // put in S
1690  strat->enterS(strat->P,
1691  posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
1692  strat, strat->tl);
1693  // apply hilbert criterion
1694  if (hilb!=NULL)
1695  {
1696  if (strat->homog==isHomog)
1697  khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1698  else
1699  khCheckLocInhom(Q,w,hilb,hilbcount,strat);
1700  }
1701 
1702  // clear strat->P
1703  kDeleteLcm(&strat->P);
1704 
1705 #ifdef KDEBUG
1706  // make sure kTest_TS does not complain about strat->P
1707  memset(&strat->P,0,sizeof(strat->P));
1708 #endif
1709  }
1710  if (strat->kHEdgeFound)
1711  {
1712  if ((TEST_OPT_FINDET)
1713  || ((TEST_OPT_MULTBOUND) && (scMult0Int(strat->Shdl,NULL,strat->tailRing) < Kstd1_mu)))
1714  {
1715  // obachman: is this still used ???
1716  /*
1717  * stops computation if strat->kHEdgeFound and
1718  * - 27 (finiteDeterminacyTest)
1719  * or
1720  * - 23
1721  * (multBound)
1722  * && multiplicity of the ideal is smaller then a predefined number mu
1723  */
1724  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1725  }
1726  }
1727  kTest_TS(strat);
1728  }
1729  /*- complete reduction of the standard basis------------------------ -*/
1730  if (TEST_OPT_REDSB) completeReduce(strat);
1731  else if (TEST_OPT_PROT) PrintLn();
1732  /*- release temp data------------------------------- -*/
1733  exitBuchMora(strat);
1734  /*- polynomials used for HECKE: HC, noether -*/
1735  if (TEST_OPT_FINDET)
1736  {
1737  if (strat->kHEdge!=NULL)
1738  Kstd1_mu=currRing->pFDeg(strat->kHEdge,currRing);
1739  else
1740  Kstd1_mu=-1;
1741  }
1742  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
1743  strat->update = TRUE; //???
1744  strat->lastAxis = 0; //???
1745  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
1746  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
1747  if ((TEST_OPT_PROT)||(TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
1748 // if (TEST_OPT_WEIGHTM)
1749 // {
1750 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1751 // if (ecartWeights)
1752 // {
1753 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1754 // ecartWeights=NULL;
1755 // }
1756 // }
1757  if(nCoeff_is_Z(currRing->cf))
1758  finalReduceByMon(strat);
1759  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1760  SI_RESTORE_OPT1(save1);
1761  idTest(strat->Shdl);
1762  return (strat->Shdl);
1763 }
KINLINE poly kNoetherTail()
Definition: kInline.h:63
ring tailRing
Definition: kutil.h:336
int Ll
Definition: kutil.h:344
int lastAxis
Definition: kutil.h:349
poly tail
Definition: kutil.h:327
char use_buckets
Definition: kutil.h:377
char interpt
Definition: kutil.h:365
LObject P
Definition: kutil.h:293
char noClearS
Definition: kutil.h:396
char length_pLength
Definition: kutil.h:381
char update
Definition: kutil.h:375
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:919
void khCheckLocInhom(ideal Q, intvec *w, intvec *hilb, int &count, kStrategy strat)
Definition: khstd.cc:133
void khCheck(ideal Q, intvec *w, intvec *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:752
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1205
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1112
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:927
void reorderL(kStrategy strat)
Definition: kstd1.cc:869
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1008
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition: kstd1.cc:3456
void updateL(kStrategy strat)
Definition: kstd1.cc:1041
int Kstd1_mu
Definition: kstd1.h:47
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7745
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:9894
BOOLEAN kTest_TS(kStrategy strat)
Definition: kutil.cc:1006
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4775
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9552
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11073
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:9970
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:4951
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10601
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10203
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4747
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1176
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11172
void messageSets(kStrategy strat)
Definition: kutil.cc:7816
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7786
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:10988
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
static void kDeleteLcm(LObject *P)
Definition: kutil.h:844
BOOLEAN siCntrlc
Definition: options.c:14
#define TEST_OPT_FINDET
Definition: options.h:110
#define OPT_REDSB
Definition: options.h:75
#define TEST_OPT_MULTBOUND
Definition: options.h:113
#define TEST_OPT_FASTHC
Definition: options.h:108
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752

◆ stdred()

ideal stdred ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w 
)

Variable Documentation

◆ kHomW

intvec* kHomW
extern

Definition at line 2062 of file kstd1.cc.

◆ kModW

intvec* kModW
extern

Definition at line 2062 of file kstd1.cc.

◆ kOptions

BITSET kOptions
extern

Definition at line 44 of file kstd1.cc.

◆ Kstd1_deg

int Kstd1_deg

Definition at line 47 of file kstd1.h.

◆ Kstd1_mu

int Kstd1_mu

Definition at line 47 of file kstd1.h.

◆ LazyDegree

int LazyDegree

Definition at line 47 of file kstd1.h.

◆ LazyPass

int LazyPass
extern

◆ validOpts

BITSET validOpts
extern

Definition at line 59 of file kstd1.cc.