Macros | Functions | Variables
kstd1.cc File Reference
#include "kernel/mod2.h"
#include "misc/options.h"
#include "misc/intvec.h"
#include "polys/weight.h"
#include "kernel/polys.h"
#include "kernel/GBEngine/kutil.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/khstd.h"
#include "kernel/combinatorics/stairc.h"
#include "kernel/ideals.h"
#include "polys/nc/nc.h"
#include "polys/nc/sca.h"
#include "kernel/GBEngine/nc.h"
#include "kernel/GBEngine/kInline.h"

Go to the source code of this file.

Macros

#define MORA_USE_BUCKETS
 
#define PRE_INTEGER_CHECK   0
 

Functions

static BOOLEAN kMoraUseBucket (kStrategy strat)
 
static void kOptimizeLDeg (pLDegProc ldeg, kStrategy strat)
 
static int doRed (LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
 
int redEcart (LObject *h, kStrategy strat)
 
int redRiloc (LObject *h, kStrategy strat)
 
int redFirst (LObject *h, kStrategy strat)
 
static poly redMoraNF (poly h, kStrategy strat, int flag)
 
static poly redMoraNFRing (poly h, kStrategy strat, int flag)
 
void reorderL (kStrategy strat)
 
void reorderT (kStrategy strat)
 
void missingAxis (int *last, kStrategy strat)
 
BOOLEAN hasPurePower (const poly p, int last, int *length, kStrategy strat)
 
BOOLEAN hasPurePower (LObject *L, int last, int *length, kStrategy strat)
 
int posInL10 (const LSet set, const int length, LObject *p, const kStrategy strat)
 
void updateL (kStrategy strat)
 
void updateLHC (kStrategy strat)
 
void updateT (kStrategy strat)
 
void firstUpdate (kStrategy strat)
 
void enterSMora (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSMoraNF (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void initBba (kStrategy strat)
 
void initSba (ideal F, kStrategy strat)
 
void initMora (ideal F, kStrategy strat)
 
void kDebugPrint (kStrategy strat)
 
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)
 
long kModDeg (poly p, ring r)
 
long kHomModDeg (poly p, ring r)
 
ideal kStd (ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
 
ideal kSba (ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
 
ideal kStdShift (ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
 
ideal kMin_std (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
 
poly kNF (ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
 
poly kNFBound (ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
 
ideal kNF (ideal F, ideal Q, ideal p, int syzComp, int lazyReduce)
 
ideal kNFBound (ideal F, ideal Q, ideal p, int bound, int syzComp, int lazyReduce)
 
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 kInterRedOld (ideal F, ideal Q)
 
ideal kInterRedBba (ideal F, ideal Q, int &need_retry)
 
ideal kInterRed (ideal F, ideal Q)
 

Variables

VAR BITSET kOptions
 
VAR BITSET validOpts
 
VAR intveckModW
 
VAR intveckHomW
 

Macro Definition Documentation

◆ MORA_USE_BUCKETS

#define MORA_USE_BUCKETS

Definition at line 12 of file kstd1.cc.

◆ PRE_INTEGER_CHECK

#define PRE_INTEGER_CHECK   0

Definition at line 14 of file kstd1.cc.

Function Documentation

◆ doRed()

static int doRed ( LObject h,
TObject with,
BOOLEAN  intoT,
kStrategy  strat,
bool  redMoraNF 
)
static

Definition at line 116 of file kstd1.cc.

117 {
118  int ret;
119 #if KDEBUG > 0
120  kTest_L(h);
121  kTest_T(with);
122 #endif
123  // Hmmm ... why do we do this -- polys from T should already be normalized
125  with->pNorm();
126 #ifdef KDEBUG
127  if (TEST_OPT_DEBUG)
128  {
129  PrintS("reduce ");h->wrp();PrintS(" with ");with->wrp();PrintLn();
130  }
131 #endif
132  if (intoT)
133  {
134  // need to do it exacly like this: otherwise
135  // we might get errors
136  LObject L= *h;
137  L.Copy();
138  h->GetP();
139  h->length=h->pLength=pLength(h->p);
140  ret = ksReducePoly(&L, with, strat->kNoetherTail(), NULL, strat);
141  if (ret)
142  {
143  if (ret < 0) return ret;
144  if (h->tailRing != strat->tailRing)
145  h->ShallowCopyDelete(strat->tailRing,
146  pGetShallowCopyDeleteProc(h->tailRing,
147  strat->tailRing));
148  }
150  enterT_strong(*h,strat);
151  else
152  enterT(*h,strat);
153  *h = L;
154  }
155  else
156  ret = ksReducePoly(h, with, strat->kNoetherTail(), NULL, strat);
157 #ifdef KDEBUG
158  if (TEST_OPT_DEBUG)
159  {
160  PrintS("to ");h->wrp();PrintLn();
161  }
162 #endif
163  return ret;
164 }
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:54
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:188
#define TEST_OPT_DEBUG
Definition: options.h:106
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9586
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
#define kTest_L(T, R)
Definition: kutil.h:658
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:191
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9686
STATIC_VAR Poly * h
Definition: janet.cc:971
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:662
#define kTest_T(T)
Definition: kutil.h:656
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ enterSMora()

void enterSMora ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1270 of file kstd1.cc.

1271 {
1272  enterSBba(p, atS, strat, atR);
1273  #ifdef KDEBUG
1274  if (TEST_OPT_DEBUG)
1275  {
1276  Print("new s%d:",atS);
1277  p_wrp(p.p,currRing,strat->tailRing);
1278  PrintLn();
1279  }
1280  #endif
1281  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1282  if (strat->kHEdgeFound)
1283  {
1284  if (newHEdge(strat))
1285  {
1286  firstUpdate(strat);
1287  if (TEST_OPT_FINDET)
1288  return;
1289 
1290  /*- cuts elements in L above noether and reorders L -*/
1291  updateLHC(strat);
1292  /*- reorders L with respect to posInL -*/
1293  reorderL(strat);
1294  }
1295  }
1296  else if (strat->kNoether!=NULL)
1297  strat->kHEdgeFound = TRUE;
1298  else if (TEST_OPT_FASTHC)
1299  {
1300  if (strat->posInLOldFlag)
1301  {
1302  missingAxis(&strat->lastAxis,strat);
1303  if (strat->lastAxis)
1304  {
1305  strat->posInLOld = strat->posInL;
1306  strat->posInLOldFlag = FALSE;
1307  strat->posInL = posInL10;
1308  strat->posInLDependsOnLength = TRUE;
1309  updateL(strat);
1310  reorderL(strat);
1311  }
1312  }
1313  else if (strat->lastAxis)
1314  updateL(strat);
1315  }
1316 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char kHEdgeFound
Definition: kutil.h:375
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#define FALSE
Definition: auxiliary.h:96
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:100
#define TEST_OPT_DEBUG
Definition: options.h:106
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:468
char posInLOldFlag
Definition: kutil.h:381
void updateL(kStrategy strat)
Definition: kstd1.cc:1039
int lastAxis
Definition: kutil.h:354
#define TEST_OPT_FINDET
Definition: options.h:109
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:925
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1110
void reorderL(kStrategy strat)
Definition: kstd1.cc:867
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
#define NULL
Definition: omList.c:12
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1203
ring tailRing
Definition: kutil.h:341
char posInLDependsOnLength
Definition: kutil.h:388
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:373
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10867
int p
Definition: cfModGcd.cc:4019
#define TEST_OPT_FASTHC
Definition: options.h:107
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9271

◆ enterSMoraNF()

void enterSMoraNF ( LObject p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1324 of file kstd1.cc.

1325 {
1326  enterSBba(p, atS, strat, atR);
1327  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1328  if (strat->kHEdgeFound)
1329  newHEdge(strat);
1330  else if (strat->kNoether!=NULL)
1331  strat->kHEdgeFound = TRUE;
1332 }
char kHEdgeFound
Definition: kutil.h:375
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:100
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:468
#define NULL
Definition: omList.c:12
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10867
int p
Definition: cfModGcd.cc:4019
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9271

◆ firstUpdate()

void firstUpdate ( kStrategy  strat)

Definition at line 1203 of file kstd1.cc.

1204 {
1205  if (strat->update)
1206  {
1207  kTest_TS(strat);
1208  strat->update = (strat->tl == -1);
1209  if (TEST_OPT_WEIGHTM)
1210  {
1211  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1212  if (strat->tailRing != currRing)
1213  {
1214  strat->tailRing->pFDeg = strat->pOrigFDeg_TailRing;
1215  strat->tailRing->pLDeg = strat->pOrigLDeg_TailRing;
1216  }
1217  int i;
1218  for (i=strat->Ll; i>=0; i--)
1219  {
1220  strat->L[i].SetpFDeg();
1221  }
1222  for (i=strat->tl; i>=0; i--)
1223  {
1224  strat->T[i].SetpFDeg();
1225  }
1226  if (ecartWeights)
1227  {
1228  omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
1229  ecartWeights=NULL;
1230  }
1231  }
1232  if (TEST_OPT_FASTHC)
1233  {
1234  strat->posInL = strat->posInLOld;
1235  strat->lastAxis = 0;
1236  }
1237  if (TEST_OPT_FINDET)
1238  return;
1239 
1241  {
1242  strat->red = redFirst;
1243  strat->use_buckets = kMoraUseBucket(strat);
1244  }
1245  updateT(strat);
1246 
1248  {
1249  strat->posInT = posInT2;
1250  reorderT(strat);
1251  }
1252  }
1253  kTest_TS(strat);
1254 }
void updateT(kStrategy strat)
Definition: kstd1.cc:1177
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
EXTERN_VAR short * ecartWeights
Definition: weight.h:12
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5296
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
int Ll
Definition: kutil.h:349
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:587
int tl
Definition: kutil.h:348
void * ADDRESS
Definition: auxiliary.h:135
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
char use_buckets
Definition: kutil.h:382
int lastAxis
Definition: kutil.h:354
#define TEST_OPT_FINDET
Definition: options.h:109
pFDegProc pOrigFDeg
Definition: kutil.h:292
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
pLDegProc pOrigLDeg
Definition: kutil.h:293
#define kTest_TS(A)
Definition: kutil.h:655
int i
Definition: cfEzgcd.cc:125
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
#define TEST_OPT_WEIGHTM
Definition: options.h:118
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:754
ring tailRing
Definition: kutil.h:341
void reorderT(kStrategy strat)
Definition: kstd1.cc:887
char update
Definition: kutil.h:380
TSet T
Definition: kutil.h:322
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition: kstd1.cc:3476
#define TEST_OPT_FASTHC
Definition: options.h:107
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294

◆ hasPurePower() [1/2]

BOOLEAN hasPurePower ( const poly  p,
int  last,
int *  length,
kStrategy  strat 
)

Definition at line 958 of file kstd1.cc.

959 {
960  poly h;
961  int i;
962 
963  if (pNext(p) == strat->tail)
964  return FALSE;
965  pp_Test(p, currRing, strat->tailRing);
966  if (strat->ak <= 0 || p_MinComp(p, currRing, strat->tailRing) == strat->ak)
967  {
968  i = p_IsPurePower(p, currRing);
969  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(p), currRing->cf))) i=0;
970  if (i == last)
971  {
972  *length = 0;
973  return TRUE;
974  }
975  *length = 1;
976  h = pNext(p);
977  while (h != NULL)
978  {
979  i = p_IsPurePower(h, strat->tailRing);
980  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(h), currRing->cf))) i=0;
981  if (i==last) return TRUE;
982  (*length)++;
983  pIter(h);
984  }
985  }
986  return FALSE;
987 }
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:515
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
int ak
Definition: kutil.h:351
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 pIter(p)
Definition: monomials.h:37
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:164
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:312
STATIC_VAR poly last
Definition: hdegree.cc:1076
STATIC_VAR Poly * h
Definition: janet.cc:971
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1216
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
#define pNext(p)
Definition: monomials.h:36
int p
Definition: cfModGcd.cc:4019

◆ hasPurePower() [2/2]

BOOLEAN hasPurePower ( LObject L,
int  last,
int *  length,
kStrategy  strat 
)

Definition at line 989 of file kstd1.cc.

990 {
991  if (L->bucket != NULL)
992  {
993  poly p = L->GetP();
994  return hasPurePower(p, last, length, strat);
995  }
996  else
997  {
998  return hasPurePower(L->p, last, length, strat);
999  }
1000 }
STATIC_VAR poly last
Definition: hdegree.cc:1076
#define NULL
Definition: omList.c:12
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:958
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ initBba()

void initBba ( kStrategy  strat)

Definition at line 1334 of file kstd1.cc.

1335 {
1336  /* setting global variables ------------------- */
1337  strat->enterS = enterSBba;
1338  strat->red = redHoney;
1339  if (strat->honey)
1340  strat->red = redHoney;
1341  else if (currRing->pLexOrder && !strat->homog)
1342  strat->red = redLazy;
1343  else
1344  {
1345  strat->LazyPass *=4;
1346  strat->red = redHomog;
1347  }
1348  if (rField_is_Ring(currRing))
1349  {
1350  if (rField_is_Z(currRing))
1351  strat->red = redRing_Z;
1352  else
1353  strat->red = redRing;
1354  }
1355  if (currRing->pLexOrder && strat->honey)
1356  strat->initEcart = initEcartNormal;
1357  else
1358  strat->initEcart = initEcartBBA;
1359  if (strat->honey)
1361  else
1363 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1364 // {
1365 // //interred machen Aenderung
1366 // strat->pOrigFDeg=pFDeg;
1367 // strat->pOrigLDeg=pLDeg;
1368 // //h=ggetid("ecart");
1369 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1370 // //{
1371 // // ecartWeights=iv2array(IDINTVEC(h));
1372 // //}
1373 // //else
1374 // {
1375 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1376 // /*uses automatic computation of the ecartWeights to set them*/
1377 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1378 // }
1379 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1380 // if (TEST_OPT_PROT)
1381 // {
1382 // for(i=1; i<=(currRing->N); i++)
1383 // Print(" %d",ecartWeights[i]);
1384 // PrintLn();
1385 // mflush();
1386 // }
1387 // }
1388 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
int redRing_Z(LObject *h, kStrategy strat)
Definition: kstd2.cc:568
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
static BOOLEAN rField_is_Z(const ring r)
Definition: ring.h:504
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1519
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
char homog
Definition: kutil.h:371
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
char honey
Definition: kutil.h:376
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9271

◆ initMora()

void initMora ( ideal  F,
kStrategy  strat 
)

Definition at line 1460 of file kstd1.cc.

1461 {
1462  int i,j;
1463 
1464  strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1465  for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1466  strat->enterS = enterSMora;
1467  strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1468  strat->posInLOld = strat->posInL;
1469  strat->posInLOldFlag = TRUE;
1470  strat->initEcart = initEcartNormal;
1471  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1472  if ( strat->kHEdgeFound )
1473  strat->kNoether = pCopy((currRing->ppNoether));
1474  else if (strat->kHEdgeFound || strat->homog)
1475  strat->red = redFirst; /*take the first possible in T*/
1476  else
1477  strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1478  if (strat->kHEdgeFound)
1479  {
1480  strat->HCord = currRing->pFDeg((currRing->ppNoether),currRing)+1;
1481  strat->posInT = posInT2;
1482  }
1483  else
1484  {
1485  strat->HCord = 32000;/*- very large -*/
1486  }
1487 
1488  if (rField_is_Ring(currRing))
1489  strat->red = redRiloc;
1490 
1491  /*reads the ecartWeights used for Graebes method from the
1492  *intvec ecart and set ecartWeights
1493  */
1494  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1495  {
1496  //interred machen Aenderung
1497  strat->pOrigFDeg=currRing->pFDeg;
1498  strat->pOrigLDeg=currRing->pLDeg;
1499  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1500  /*uses automatic computation of the ecartWeights to set them*/
1502 
1504  if (TEST_OPT_PROT)
1505  {
1506  for(i=1; i<=(currRing->N); i++)
1507  Print(" %d",ecartWeights[i]);
1508  PrintLn();
1509  mflush();
1510  }
1511  }
1512  kOptimizeLDeg(currRing->pLDeg, strat);
1513 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:375
EXTERN_VAR short * ecartWeights
Definition: weight.h:12
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5296
#define Print
Definition: emacs.cc:80
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:166
#define TEST_OPT_PROT
Definition: options.h:101
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:182
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:217
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:100
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
char posInLOldFlag
Definition: kutil.h:381
int HCord
Definition: kutil.h:353
#define mflush()
Definition: reporter.h:57
pFDegProc pOrigFDeg
Definition: kutil.h:292
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:342
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void(* initEcart)(TObject *L)
Definition: kutil.h:276
pLDegProc pOrigLDeg
Definition: kutil.h:293
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1270
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition: kstd1.cc:97
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
#define IDELEMS(i)
Definition: simpleideals.h:23
#define TEST_OPT_WEIGHTM
Definition: options.h:118
char homog
Definition: kutil.h:371
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:247
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int BOOLEAN
Definition: auxiliary.h:87
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ initSba()

void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1390 of file kstd1.cc.

1391 {
1392  int i;
1393  //idhdl h;
1394  /* setting global variables ------------------- */
1395  strat->enterS = enterSSba;
1396  strat->red2 = redHoney;
1397  if (strat->honey)
1398  strat->red2 = redHoney;
1399  else if (currRing->pLexOrder && !strat->homog)
1400  strat->red2 = redLazy;
1401  else
1402  {
1403  strat->LazyPass *=4;
1404  strat->red2 = redHomog;
1405  }
1406  if (rField_is_Ring(currRing))
1407  {
1409  {strat->red2 = redRiloc;}
1410  else
1411  {strat->red2 = redRing;}
1412  }
1413  if (currRing->pLexOrder && strat->honey)
1414  strat->initEcart = initEcartNormal;
1415  else
1416  strat->initEcart = initEcartBBA;
1417  if (strat->honey)
1419  else
1421  //strat->kIdeal = NULL;
1422  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1423  //else strat->kIdeal->rtyp=MODUL_CMD;
1424  //strat->kIdeal->data=(void *)strat->Shdl;
1425  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1426  {
1427  //interred machen Aenderung
1428  strat->pOrigFDeg = currRing->pFDeg;
1429  strat->pOrigLDeg = currRing->pLDeg;
1430  //h=ggetid("ecart");
1431  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1432  //{
1433  // ecartWeights=iv2array(IDINTVEC(h));
1434  //}
1435  //else
1436  {
1437  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1438  /*uses automatic computation of the ecartWeights to set them*/
1440  }
1442  if (TEST_OPT_PROT)
1443  {
1444  for(i=1; i<=(currRing->N); i++)
1445  Print(" %d",ecartWeights[i]);
1446  PrintLn();
1447  mflush();
1448  }
1449  }
1450  // for sig-safe reductions in signature-based
1451  // standard basis computations
1453  strat->red = redSigRing;
1454  else
1455  strat->red = redSig;
1456  //strat->sbaOrder = 1;
1457  strat->currIdx = 1;
1458 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9390
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:715
EXTERN_VAR short * ecartWeights
Definition: weight.h:12
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
#define TEST_OPT_PROT
Definition: options.h:101
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:182
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:217
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:982
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int currIdx
Definition: kutil.h:313
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
pFDegProc pOrigFDeg
Definition: kutil.h:292
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:342
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1519
pLDegProc pOrigLDeg
Definition: kutil.h:293
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
int i
Definition: cfEzgcd.cc:125
int redSigRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:1149
#define IDELEMS(i)
Definition: simpleideals.h:23
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
#define TEST_OPT_WEIGHTM
Definition: options.h:118
char homog
Definition: kutil.h:371
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
char honey
Definition: kutil.h:376
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:247
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:275

◆ 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 3035 of file kstd1.cc.

3036 {
3037  const ring save = currRing;
3038  if( currRing != _currRing ) rChangeCurrRing(_currRing);
3039  poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3040  if( currRing != save ) rChangeCurrRing(save);
3041  return ret;
3042 }
STATIC_VAR jList * Q
Definition: janet.cc:30
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2824
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void rChangeCurrRing(ring r)
Definition: polys.cc:15
int p
Definition: cfModGcd.cc:4019

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Definition at line 11949 of file kutil.cc.

11950 {
11951  PrintS("red: ");
11952  if (strat->red==redFirst) PrintS("redFirst\n");
11953  else if (strat->red==redHoney) PrintS("redHoney\n");
11954  else if (strat->red==redEcart) PrintS("redEcart\n");
11955  else if (strat->red==redHomog) PrintS("redHomog\n");
11956  else Print("%p\n",(void*)strat->red);
11957  PrintS("posInT: ");
11958  if (strat->posInT==posInT0) PrintS("posInT0\n");
11959  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11960  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11961  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11962  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11963  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11964  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11965  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11966  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11967  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11968  #ifdef HAVE_RINGS
11969  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11970  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11971  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11972  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11973  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11974  #endif
11975 #ifdef HAVE_MORE_POS_IN_T
11976  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11977  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11978  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11979 #endif
11980  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11981  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11982  else Print("%p\n",(void*)strat->posInT);
11983  PrintS("posInL: ");
11984  if (strat->posInL==posInL0) PrintS("posInL0\n");
11985  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11986  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11987  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11988  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11989  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11990  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11991  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11992  #ifdef HAVE_RINGS
11993  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11994  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11995  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11996  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11997  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11998  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11999  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
12000  #endif
12001  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
12002  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
12003  else Print("%p\n",(void*)strat->posInL);
12004  PrintS("enterS: ");
12005  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
12006  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
12007  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
12008  else Print("%p\n",(void*)strat->enterS);
12009  PrintS("initEcart: ");
12010  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
12011  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
12012  else Print("%p\n",(void*)strat->initEcart);
12013  PrintS("initEcartPair: ");
12014  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
12015  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
12016  else Print("%p\n",(void*)strat->initEcartPair);
12017  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
12018  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
12019  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
12020  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
12021  PrintS("chainCrit: ");
12022  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
12023  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
12024  else Print("%p\n",(void*)strat->chainCrit);
12025  Print("posInLDependsOnLength=%d\n",
12026  strat->posInLDependsOnLength);
12027  PrintS(showOption());PrintLn();
12028  PrintS("LDeg: ");
12029  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12030  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12031  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
12032  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12033  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12034  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12035  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12036  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12037  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12038  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12039  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12040  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12041  else Print("? (%lx)", (long)currRing->pLDeg);
12042  PrintS(" / ");
12043  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
12044  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
12045  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
12046  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
12047  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
12048  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
12049  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
12050  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
12051  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
12052  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
12053  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
12054  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
12055  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
12056  PrintLn();
12057  PrintS("currRing->pFDeg: ");
12058  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
12059  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
12060  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
12061  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
12062  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
12063  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
12064  else Print("? (%lx)", (long)currRing->pFDeg);
12065  PrintLn();
12066  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
12067  if(TEST_OPT_DEGBOUND)
12068  Print(" degBound: %d\n", Kstd1_deg);
12069 
12070  if( ecartWeights != NULL )
12071  {
12072  PrintS("ecartWeights: ");
12073  for (int i = rVar(currRing); i > 0; i--)
12074  Print("%hd ", ecartWeights[i]);
12075  PrintLn();
12077  }
12078 
12079 #ifndef SING_NDEBUG
12081 #endif
12082 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1299
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6323
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11915
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5403
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1270
EXTERN_VAR short * ecartWeights
Definition: weight.h:12
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5296
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:831
#define TEST_OPT_DEGBOUND
Definition: options.h:111
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6365
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6435
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:995
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6779
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:867
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5268
char noTailReduction
Definition: kutil.h:377
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:217
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3192
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6537
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6864
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:715
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6744
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:718
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6709
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6662
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:587
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:760
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1446
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:723
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:900
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6978
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5636
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:822
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6621
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5257
char use_buckets
Definition: kutil.h:382
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:931
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1664
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void(* initEcart)(TObject *L)
Definition: kutil.h:276
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5326
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5838
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:577
char sugarCrit
Definition: kutil.h:376
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5362
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1306
#define assume(x)
Definition: mod2.h:390
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:586
void initEcartBBA(TObject *h)
Definition: kutil.cc:1292
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5792
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:729
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6065
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6914
void rDebugPrint(const ring r)
Definition: ring.cc:4045
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11824
#define TEST_OPT_WEIGHTM
Definition: options.h:118
char homog
Definition: kutil.h:371
VAR int Kstd1_deg
Definition: kutil.cc:237
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:801
#define NULL
Definition: omList.c:12
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:965
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:166
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5479
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5521
char honey
Definition: kutil.h:376
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3405
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:247
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1028
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6022
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1058
char posInLDependsOnLength
Definition: kutil.h:388
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:603
char Gebauer
Definition: kutil.h:377
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5965
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11878
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006
int LazyDegree
Definition: kutil.h:351
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5899
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5568
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9271

◆ kHomModDeg()

long kHomModDeg ( poly  p,
ring  r 
)

Definition at line 2075 of file kstd1.cc.

2076 {
2077  int i;
2078  long j=0;
2079 
2080  for (i=r->N;i>0;i--)
2081  j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2082  if (kModW == NULL) return j;
2083  i = __p_GetComp(p,r);
2084  if (i==0) return j;
2085  return j+(*kModW)[i-1];
2086 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
int j
Definition: facHensel.cc:105
VAR intvec * kModW
Definition: kstd1.cc:2063
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:468
int i
Definition: cfEzgcd.cc:125
#define NULL
Definition: omList.c:12
int p
Definition: cfModGcd.cc:4019

◆ kInterRed()

ideal kInterRed ( ideal  F,
ideal  Q 
)

Definition at line 3400 of file kstd1.cc.

3401 {
3402 #ifdef HAVE_PLURAL
3403  if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3404 #endif
3407  )
3408  return kInterRedOld(F,Q);
3409 
3410  //return kInterRedOld(F,Q);
3411 
3412  BITSET save1;
3413  SI_SAVE_OPT1(save1);
3414  //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3416  //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3417  //si_opt_1&= ~Sy_bit(OPT_REDSB);
3418  //extern char * showOption() ;
3419  //Print("%s\n",showOption());
3420 
3421  int need_retry;
3422  int counter=3;
3423  ideal res, res1;
3424  int elems;
3425  ideal null=NULL;
3426  if ((Q==NULL) || (!TEST_OPT_REDSB))
3427  {
3428  elems=idElem(F);
3429  res=kInterRedBba(F,Q,need_retry);
3430  }
3431  else
3432  {
3433  ideal FF=idSimpleAdd(F,Q);
3434  res=kInterRedBba(FF,NULL,need_retry);
3435  idDelete(&FF);
3436  null=idInit(1,1);
3437  if (need_retry)
3438  res1=kNF(null,Q,res,0,KSTD_NF_LAZY);
3439  else
3440  res1=kNF(null,Q,res);
3441  idDelete(&res);
3442  res=res1;
3443  need_retry=1;
3444  }
3445  if (idElem(res)<=1) need_retry=0;
3446  while (need_retry && (counter>0))
3447  {
3448  #ifdef KDEBUG
3449  if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3450  #endif
3451  res1=kInterRedBba(res,Q,need_retry);
3452  int new_elems=idElem(res1);
3453  counter -= (new_elems >= elems);
3454  elems = new_elems;
3455  idDelete(&res);
3456  if (idElem(res1)<=1) need_retry=0;
3457  if ((Q!=NULL) && (TEST_OPT_REDSB))
3458  {
3459  if (need_retry)
3460  res=kNF(null,Q,res1,0,KSTD_NF_LAZY);
3461  else
3462  res=kNF(null,Q,res1);
3463  idDelete(&res1);
3464  }
3465  else
3466  res = res1;
3467  if (idElem(res)<=1) need_retry=0;
3468  }
3469  if (null!=NULL) idDelete(&null);
3470  SI_RESTORE_OPT1(save1);
3471  idSkipZeroes(res);
3472  return res;
3473 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2824
#define Print
Definition: emacs.cc:80
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
VAR unsigned si_opt_1
Definition: options.c:5
#define idSimpleAdd(A, B)
Definition: ideals.h:42
#define TEST_OPT_REDSB
Definition: options.h:102
#define SI_SAVE_OPT1(A)
Definition: options.h:21
#define TEST_OPT_DEBUG
Definition: options.h:106
#define BITSET
Definition: structs.h:20
#define Sy_bit(x)
Definition: options.h:31
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
ideal kInterRedBba(ideal F, ideal Q, int &need_retry)
Definition: kstd1.cc:3140
#define KSTD_NF_LAZY
Definition: kstd1.h:17
CanonicalForm res
Definition: facAbsFact.cc:64
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3048
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define OPT_REDTHROUGH
Definition: options.h:80
int idElem(const ideal F)
count non-zero elements
#define SI_RESTORE_OPT1(A)
Definition: options.h:24
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:510

◆ kInterRedBba()

ideal kInterRedBba ( ideal  F,
ideal  Q,
int &  need_retry 
)

Definition at line 3140 of file kstd1.cc.

3141 {
3142  need_retry=0;
3143  int red_result = 1;
3144  int olddeg,reduc;
3145  BOOLEAN withT = FALSE;
3146  // BOOLEAN toReset=FALSE;
3147  kStrategy strat=new skStrategy;
3148  tHomog h;
3149 
3151  strat->LazyPass=20;
3152  else
3153  strat->LazyPass=2;
3154  strat->LazyDegree = 1;
3155  strat->ak = id_RankFreeModule(F,currRing);
3156  strat->syzComp = strat->ak;
3157  strat->kModW=kModW=NULL;
3158  strat->kHomW=kHomW=NULL;
3159  if (strat->ak == 0)
3160  {
3161  h = (tHomog)idHomIdeal(F,Q);
3162  }
3163  else if (!TEST_OPT_DEGBOUND)
3164  {
3165  h = (tHomog)idHomIdeal(F,Q);
3166  }
3167  else
3168  h = isNotHomog;
3169  if (h==isHomog)
3170  {
3171  strat->LazyPass*=2;
3172  }
3173  strat->homog=h;
3174 #ifdef KDEBUG
3175  idTest(F);
3176 #endif
3177 
3178  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
3180  initBuchMoraPosRing(strat);
3181  else
3182  initBuchMoraPos(strat);
3183  initBba(strat);
3184  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3185  strat->posInL=posInL0; /* ord according pComp */
3186 
3187  /*Shdl=*/initBuchMora(F, Q, strat);
3188  reduc = olddeg = 0;
3189 
3190 #ifndef NO_BUCKETS
3191  if (!TEST_OPT_NOT_BUCKETS)
3192  strat->use_buckets = 1;
3193 #endif
3194 
3195  // redtailBBa against T for inhomogenous input
3196  if (!TEST_OPT_OLDSTD)
3197  withT = ! strat->homog;
3198 
3199  // strat->posInT = posInT_pLength;
3200  kTest_TS(strat);
3201 
3202 #ifdef HAVE_TAIL_RING
3203  kStratInitChangeTailRing(strat);
3204 #endif
3205 
3206  /* compute------------------------------------------------------- */
3207  while (strat->Ll >= 0)
3208  {
3209  #ifdef KDEBUG
3210  if (TEST_OPT_DEBUG) messageSets(strat);
3211  #endif
3212  if (strat->Ll== 0) strat->interpt=TRUE;
3213  /* picks the last element from the lazyset L */
3214  strat->P = strat->L[strat->Ll];
3215  strat->Ll--;
3216 
3217  if (strat->P.p1 == NULL)
3218  {
3219  // for input polys, prepare reduction
3220  strat->P.PrepareRed(strat->use_buckets);
3221  }
3222 
3223  if (strat->P.p == NULL && strat->P.t_p == NULL)
3224  {
3225  red_result = 0;
3226  }
3227  else
3228  {
3229  if (TEST_OPT_PROT)
3230  message(strat->P.pFDeg(),
3231  &olddeg,&reduc,strat, red_result);
3232 
3233  /* reduction of the element chosen from L */
3234  red_result = strat->red(&strat->P,strat);
3235  }
3236 
3237  // reduction to non-zero new poly
3238  if (red_result == 1)
3239  {
3240  /* statistic */
3241  if (TEST_OPT_PROT) PrintS("s");
3242 
3243  // get the polynomial (canonicalize bucket, make sure P.p is set)
3244  strat->P.GetP(strat->lmBin);
3245 
3246  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3247 
3248  // reduce the tail and normalize poly
3249  // in the ring case we cannot expect LC(f) = 1,
3250  // therefore we call pCleardenom instead of pNorm
3252  {
3253  strat->P.pCleardenom();
3254  if (0)
3255  //if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
3256  {
3257  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3258  strat->P.pCleardenom();
3259  }
3260  }
3261  else
3262  {
3263  strat->P.pNorm();
3264  if (0)
3265  //if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
3266  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3267  }
3268 
3269 #ifdef KDEBUG
3270  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3271 #endif
3272 
3273  // enter into S, L, and T
3274  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3275  {
3276  enterT(strat->P, strat);
3277  // posInS only depends on the leading term
3278  strat->enterS(strat->P, pos, strat, strat->tl);
3279 
3280  if (pos<strat->sl)
3281  {
3282  need_retry++;
3283  // move all "larger" elements fromS to L
3284  // remove them from T
3285  int ii=pos+1;
3286  for(;ii<=strat->sl;ii++)
3287  {
3288  LObject h;
3289  memset(&h,0,sizeof(h));
3290  h.tailRing=strat->tailRing;
3291  h.p=strat->S[ii]; strat->S[ii]=NULL;
3292  strat->initEcart(&h);
3293  h.sev=strat->sevS[ii];
3294  int jj=strat->tl;
3295  while (jj>=0)
3296  {
3297  if (strat->T[jj].p==h.p)
3298  {
3299  strat->T[jj].p=NULL;
3300  if (jj<strat->tl)
3301  {
3302  memmove(&(strat->T[jj]),&(strat->T[jj+1]),
3303  (strat->tl-jj)*sizeof(strat->T[jj]));
3304  memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),
3305  (strat->tl-jj)*sizeof(strat->sevT[jj]));
3306  }
3307  strat->tl--;
3308  break;
3309  }
3310  jj--;
3311  }
3312  int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);
3313  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);
3314  #ifdef KDEBUG
3315  if (TEST_OPT_DEBUG)
3316  {
3317  Print("move S[%d] -> L[%d]: ",ii,pos);
3318  p_wrp(h.p,currRing, strat->tailRing);
3319  PrintLn();
3320  }
3321  #endif
3322  }
3323  if (strat->fromQ!=NULL)
3324  {
3325  for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;
3326  }
3327  strat->sl=pos;
3328  }
3329  }
3330  else
3331  {
3332  // clean P
3333  }
3334  kDeleteLcm(&strat->P);
3335  }
3336 
3337 #ifdef KDEBUG
3338  if (TEST_OPT_DEBUG)
3339  {
3340  messageSets(strat);
3341  }
3342  memset(&(strat->P), 0, sizeof(strat->P));
3343 #endif
3344  //kTest_TS(strat);: i_r out of sync in kInterRedBba, but not used!
3345  }
3346 #ifdef KDEBUG
3347  //if (TEST_OPT_DEBUG) messageSets(strat);
3348 #endif
3349  /* complete reduction of the standard basis--------- */
3350 
3351  if((need_retry<=0) && (TEST_OPT_REDSB))
3352  {
3353  completeReduce(strat);
3354  if (strat->completeReduce_retry)
3355  {
3356  // completeReduce needed larger exponents, retry
3357  // hopefully: kStratChangeTailRing already provided a larger tailRing
3358  // (otherwise: it will fail again)
3359  strat->completeReduce_retry=FALSE;
3360  completeReduce(strat);
3361  if (strat->completeReduce_retry)
3362  {
3363 #ifdef HAVE_TAIL_RING
3364  if(currRing->bitmask>strat->tailRing->bitmask)
3365  {
3366  // retry without T
3367  strat->completeReduce_retry=FALSE;
3368  cleanT(strat);strat->tailRing=currRing;
3369  int i;
3370  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3371  completeReduce(strat);
3372  }
3373  if (strat->completeReduce_retry)
3374 #endif
3375  Werror("exponent bound is %ld",currRing->bitmask);
3376  }
3377  }
3378  }
3379  else if (TEST_OPT_PROT) PrintLn();
3380 
3381 
3382  /* release temp data-------------------------------- */
3383  exitBuchMora(strat);
3384 // if (TEST_OPT_WEIGHTM)
3385 // {
3386 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
3387 // if (ecartWeights)
3388 // {
3389 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3390 // ecartWeights=NULL;
3391 // }
3392 // }
3393  //if (TEST_OPT_PROT) messageStat(0/*hilbcount*/,strat);
3394  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3395  ideal res=strat->Shdl;
3396  strat->Shdl=NULL;
3397  delete strat;
3398  return res;
3399 }
STATIC_VAR jList * Q
Definition: janet.cc:30
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
VAR intvec * kModW
Definition: kstd1.cc:2063
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_DEGBOUND
Definition: options.h:111
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:10035
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7954
class sLObject LObject
Definition: kutil.h:54
#define TEST_OPT_PROT
Definition: options.h:101
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:96
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10208
char interpt
Definition: kutil.h:370
#define TRUE
Definition: auxiliary.h:100
#define TEST_OPT_REDSB
Definition: options.h:102
static void kDeleteLcm(LObject *P)
Definition: kutil.h:869
int ak
Definition: kutil.h:351
void initBba(kStrategy strat)
Definition: kstd1.cc:1334
#define TEST_OPT_DEBUG
Definition: options.h:106
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10121
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1158
#define pGetComp(p)
Component.
Definition: polys.h:37
char use_buckets
Definition: kutil.h:382
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11502
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:103
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:543
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9586
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
VAR intvec * kHomW
Definition: kstd1.cc:2063
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define kTest_TS(A)
Definition: kutil.h:655
CanonicalForm res
Definition: facAbsFact.cc:64
tHomog
Definition: structs.h:39
#define TEST_OPT_OLDSTD
Definition: options.h:120
#define messageSets(s)
Definition: kutil.h:541
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6065
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9884
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
STATIC_VAR Poly * h
Definition: janet.cc:971
char homog
Definition: kutil.h:371
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
#define TEST_OPT_IDLIFT
Definition: options.h:126
intvec * kHomW
Definition: kutil.h:334
void cleanT(kStrategy strat)
Definition: kutil.cc:538
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
intvec * kModW
Definition: kutil.h:333
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10745
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10533
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:373
int LazyPass
Definition: kutil.h:351
int BOOLEAN
Definition: auxiliary.h:87
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10292
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int LazyDegree
Definition: kutil.h:351
#define idTest(id)
Definition: ideals.h:47

◆ kInterRedOld()

ideal kInterRedOld ( ideal  F,
ideal  Q 
)

Definition at line 3048 of file kstd1.cc.

3049 {
3050  int j;
3051  kStrategy strat = new skStrategy;
3052 
3053  ideal tempF = F;
3054  ideal tempQ = Q;
3055 
3056 #ifdef HAVE_PLURAL
3057  if(rIsSCA(currRing))
3058  {
3059  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3060  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3061  tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
3062 
3063  // this should be done on the upper level!!! :
3064  // tempQ = SCAQuotient(currRing);
3065 
3066  if(Q == currRing->qideal)
3067  tempQ = SCAQuotient(currRing);
3068  }
3069 #endif
3070 
3071 // if (TEST_OPT_PROT)
3072 // {
3073 // writeTime("start InterRed:");
3074 // mflush();
3075 // }
3076  //strat->syzComp = 0;
3077  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
3078  strat->kNoether=pCopy((currRing->ppNoether));
3079  strat->ak = id_RankFreeModule(tempF,currRing);
3080  initBuchMoraCrit(strat);
3081  strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3082  for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3083  strat->enterS = enterSBba;
3084  strat->posInT = posInT17;
3085  strat->initEcart = initEcartNormal;
3086  strat->sl = -1;
3087  strat->tl = -1;
3088  strat->tmax = setmaxT;
3089  strat->T = initT();
3090  strat->R = initR();
3091  strat->sevT = initsevT();
3093  initS(tempF, tempQ, strat);
3094  if (TEST_OPT_REDSB)
3095  strat->noTailReduction=FALSE;
3096  updateS(TRUE,strat);
3098  completeReduce(strat);
3099  //else if (TEST_OPT_PROT) PrintLn();
3100  cleanT(strat);
3101  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
3102  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3103  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3104  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3105  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3106  omfree(strat->sevT);
3107  omfree(strat->S_2_R);
3108  omfree(strat->R);
3109 
3110  if (strat->fromQ)
3111  {
3112  for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3113  {
3114  if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3115  }
3116  omFreeSize((ADDRESS)strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
3117  }
3118 // if (TEST_OPT_PROT)
3119 // {
3120 // writeTime("end Interred:");
3121 // mflush();
3122 // }
3123  ideal shdl=strat->Shdl;
3124  idSkipZeroes(shdl);
3125  if (strat->fromQ)
3126  {
3127  strat->fromQ=NULL;
3128  ideal res=kInterRed(shdl,NULL);
3129  idDelete(&shdl);
3130  shdl=res;
3131  }
3132  delete(strat);
3133 #ifdef HAVE_PLURAL
3134  if( tempF != F )
3135  id_Delete( &tempF, currRing);
3136 #endif
3137  return shdl;
3138 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
ideal SCAQuotient(const ring r)
Definition: sca.h:10
KINLINE TObject ** initR()
Definition: kInline.h:95
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:375
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:84
#define FALSE
Definition: auxiliary.h:96
int * S_2_R
Definition: kutil.h:340
char noTailReduction
Definition: kutil.h:377
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:100
#define TEST_OPT_REDSB
Definition: options.h:102
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:135
int ak
Definition: kutil.h:351
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8077
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
#define setmaxT
Definition: kutil.h:33
CanonicalForm res
Definition: facAbsFact.cc:64
intset fromQ
Definition: kutil.h:317
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define omfree(addr)
Definition: omAllocDecl.h:237
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3400
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9884
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5731
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static short scaFirstAltVar(ring r)
Definition: sca.h:18
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:12
void cleanT(kStrategy strat)
Definition: kutil.cc:538
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1520
#define pDelete(p_ptr)
Definition: polys.h:182
static short scaLastAltVar(ring r)
Definition: sca.h:25
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9036
unsigned long * sevS
Definition: kutil.h:318
static bool rIsSCA(const ring r)
Definition: nc.h:190
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10745
char honey
Definition: kutil.h:376
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
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
void initEcartNormal(TObject *h)
Definition: kutil.cc:1284
ideal Shdl
Definition: kutil.h:299
int BOOLEAN
Definition: auxiliary.h:87
class sTObject TObject
Definition: kutil.h:53
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9271
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ kMin_std()

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

Definition at line 2675 of file kstd1.cc.

2677 {
2678  if(idIs0(F))
2679  {
2680  M=idInit(1,F->rank);
2681  return idInit(1,F->rank);
2682  }
2684  {
2685  ideal sb;
2686  sb = kStd(F, Q, h, w, hilb);
2687  idSkipZeroes(sb);
2688  if(IDELEMS(sb) <= IDELEMS(F))
2689  {
2690  M = idCopy(sb);
2691  idSkipZeroes(M);
2692  return(sb);
2693  }
2694  else
2695  {
2696  M = idCopy(F);
2697  idSkipZeroes(M);
2698  return(sb);
2699  }
2700  }
2701  ideal r=NULL;
2702  int Kstd1_OldDeg = Kstd1_deg,i;
2703  intvec* temp_w=NULL;
2704  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2705  BOOLEAN delete_w=(w==NULL);
2706  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
2707  kStrategy strat=new skStrategy;
2708 
2709  if(!TEST_OPT_RETURN_SB)
2710  strat->syzComp = syzComp;
2712  strat->LazyPass=20;
2713  else
2714  strat->LazyPass=2;
2715  strat->LazyDegree = 1;
2716  strat->minim=(reduced % 2)+1;
2717  strat->ak = id_RankFreeModule(F,currRing);
2718  if (delete_w)
2719  {
2720  temp_w=new intvec((strat->ak)+1);
2721  w = &temp_w;
2722  }
2723  if (h==testHomog)
2724  {
2725  if (strat->ak == 0)
2726  {
2727  h = (tHomog)idHomIdeal(F,Q);
2728  w=NULL;
2729  }
2730  else
2731  {
2732  h = (tHomog)idHomModule(F,Q,w);
2733  }
2734  }
2735  if (h==isHomog)
2736  {
2737  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2738  {
2739  kModW = *w;
2740  strat->kModW = *w;
2741  assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
2742  strat->pOrigFDeg = currRing->pFDeg;
2743  strat->pOrigLDeg = currRing->pLDeg;
2745 
2746  toReset = TRUE;
2747  if (reduced>1)
2748  {
2749  Kstd1_OldDeg=Kstd1_deg;
2750  Kstd1_deg = -1;
2751  for (i=IDELEMS(F)-1;i>=0;i--)
2752  {
2753  if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
2754  Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
2755  }
2756  }
2757  }
2758  currRing->pLexOrder = TRUE;
2759  strat->LazyPass*=2;
2760  }
2761  strat->homog=h;
2763  {
2764  if (w!=NULL)
2765  r=mora(F,Q,*w,hilb,strat);
2766  else
2767  r=mora(F,Q,NULL,hilb,strat);
2768  }
2769  else
2770  {
2771  if (w!=NULL)
2772  r=bba(F,Q,*w,hilb,strat);
2773  else
2774  r=bba(F,Q,NULL,hilb,strat);
2775  }
2776 #ifdef KDEBUG
2777  {
2778  int i;
2779  for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
2780  }
2781 #endif
2782  idSkipZeroes(r);
2783  if (toReset)
2784  {
2785  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2786  kModW = NULL;
2787  }
2788  currRing->pLexOrder = b;
2789  HCord=strat->HCord;
2790  if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
2791  if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
2792  {
2793  M=idInit(1,F->rank);
2794  M->m[0]=pOne();
2795  //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
2796  if (strat->M!=NULL) idDelete(&strat->M);
2797  }
2798  else if (strat->M==NULL)
2799  {
2800  M=idInit(1,F->rank);
2801  WarnS("no minimal generating set computed");
2802  }
2803  else
2804  {
2805  idSkipZeroes(strat->M);
2806  M=strat->M;
2807  }
2808  delete(strat);
2809  if (reduced>2)
2810  {
2811  Kstd1_deg=Kstd1_OldDeg;
2812  if (!oldDegBound)
2814  }
2815  else
2816  {
2817  if (IDELEMS(M)>IDELEMS(r)) {
2818  idDelete(&M);
2819  M=idCopy(r); }
2820  }
2821  return r;
2822 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
STATIC_VAR jList * Q
Definition: janet.cc:30
VAR intvec * kModW
Definition: kstd1.cc:2063
int syzComp
Definition: kutil.h:352
#define TEST_OPT_DEGBOUND
Definition: options.h:111
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
VAR unsigned si_opt_1
Definition: options.c:5
#define FALSE
Definition: auxiliary.h:96
#define pTest(p)
Definition: polys.h:411
#define TRUE
Definition: auxiliary.h:100
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:2088
int ak
Definition: kutil.h:351
VAR int HCord
Definition: kutil.cc:236
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:2178
#define WarnS
Definition: emacs.cc:78
#define Sy_bit(x)
Definition: options.h:31
int minim
Definition: kutil.h:356
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:543
int HCord
Definition: kutil.h:353
pFDegProc pOrigFDeg
Definition: kutil.h:292
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define M
Definition: sirandom.c:25
CanonicalForm b
Definition: cfModGcd.cc:4044
pLDegProc pOrigLDeg
Definition: kutil.h:293
Definition: intvec.h:19
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:39
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
#define assume(x)
Definition: mod2.h:390
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:234
ideal M
Definition: kutil.h:301
int i
Definition: cfEzgcd.cc:125
#define pOne()
Definition: polys.h:311
#define IDELEMS(i)
Definition: simpleideals.h:23
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
#define TEST_OPT_RETURN_SB
Definition: options.h:110
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
STATIC_VAR Poly * h
Definition: janet.cc:971
char homog
Definition: kutil.h:371
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:333
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2065
#define OPT_DEGBOUND
Definition: options.h:88
int LazyPass
Definition: kutil.h:351
int BOOLEAN
Definition: auxiliary.h:87
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
int LazyDegree
Definition: kutil.h:351
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1517

◆ kModDeg()

long kModDeg ( poly  p,
ring  r 
)

Definition at line 2065 of file kstd1.cc.

2066 {
2067  long o=p_WDegree(p, r);
2068  long i=__p_GetComp(p, r);
2069  if (i==0) return o;
2070  //assume((i>0) && (i<=kModW->length()));
2071  if (i<=kModW->length())
2072  return o+(*kModW)[i-1];
2073  return o;
2074 }
#define __p_GetComp(p, r)
Definition: monomials.h:63
long p_WDegree(poly p, const ring r)
Definition: p_polys.cc:704
int i
Definition: cfEzgcd.cc:125
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ kMoraUseBucket()

static BOOLEAN kMoraUseBucket ( kStrategy  strat)
static

Definition at line 3476 of file kstd1.cc.

3477 {
3478 #ifdef MORA_USE_BUCKETS
3480  return FALSE;
3481  if (strat->red == redFirst)
3482  {
3483 #ifdef NO_LDEG
3484  if (strat->syzComp==0)
3485  return TRUE;
3486 #else
3487  if ((strat->homog || strat->honey) && (strat->syzComp==0))
3488  return TRUE;
3489 #endif
3490  }
3491  else
3492  {
3493  #ifdef HAVE_RINGS
3494  assume(strat->red == redEcart || strat->red == redRiloc);
3495  #else
3496  assume(strat->red == redEcart);
3497  #endif
3498  if (strat->honey && (strat->syzComp==0))
3499  return TRUE;
3500  }
3501 #endif
3502  return FALSE;
3503 }
int syzComp
Definition: kutil.h:352
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:166
#define FALSE
Definition: auxiliary.h:96
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
#define TRUE
Definition: auxiliary.h:100
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:103
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:342
#define assume(x)
Definition: mod2.h:390
char homog
Definition: kutil.h:371
char honey
Definition: kutil.h:376

◆ kNF() [1/2]

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

Definition at line 2824 of file kstd1.cc.

2825 {
2826  if (p==NULL)
2827  return NULL;
2828 
2829  poly pp = p;
2830 
2831 #ifdef HAVE_PLURAL
2832  if(rIsSCA(currRing))
2833  {
2834  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2835  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2836  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
2837 
2838  if(Q == currRing->qideal)
2839  Q = SCAQuotient(currRing);
2840  }
2841 #endif
2842 
2843  if ((idIs0(F))&&(Q==NULL))
2844  {
2845 #ifdef HAVE_PLURAL
2846  if(p != pp)
2847  return pp;
2848 #endif
2849  return pCopy(p); /*F+Q=0*/
2850  }
2851 
2852  kStrategy strat=new skStrategy;
2853  strat->syzComp = syzComp;
2854  strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p));
2855  poly res;
2856 
2858  {
2859 #ifdef HAVE_SHIFTBBA
2860  if (currRing->isLPring)
2861  {
2862  WerrorS("No local ordering possible for shift algebra");
2863  return(NULL);
2864  }
2865 #endif
2866  res=kNF1(F,Q,pp,strat,lazyReduce);
2867  }
2868  else
2869  res=kNF2(F,Q,pp,strat,lazyReduce);
2870  delete(strat);
2871 
2872 #ifdef HAVE_PLURAL
2873  if(pp != p)
2874  p_Delete(&pp, currRing);
2875 #endif
2876  return res;
2877 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
ideal SCAQuotient(const ring r)
Definition: sca.h:10
int syzComp
Definition: kutil.h:352
#define pMaxComp(p)
Definition: polys.h:295
int ak
Definition: kutil.h:351
void WerrorS(const char *s)
Definition: feFopen.cc:24
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1465
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3503
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
CanonicalForm res
Definition: facAbsFact.cc:64
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd1.cc:1766
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
static short scaFirstAltVar(ring r)
Definition: sca.h:18
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:860
#define NULL
Definition: omList.c:12
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:190
int p
Definition: cfModGcd.cc:4019
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ kNF() [2/2]

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

Definition at line 2921 of file kstd1.cc.

2922 {
2923  ideal res;
2924  if (TEST_OPT_PROT)
2925  {
2926  Print("(S:%d)",IDELEMS(p));mflush();
2927  }
2928  if (idIs0(p))
2929  return idInit(IDELEMS(p),si_max(p->rank,F->rank));
2930 
2931  ideal pp = p;
2932 #ifdef HAVE_PLURAL
2933  if(rIsSCA(currRing))
2934  {
2935  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2936  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2937  pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
2938 
2939  if(Q == currRing->qideal)
2940  Q = SCAQuotient(currRing);
2941  }
2942 #endif
2943 
2944  if ((idIs0(F))&&(Q==NULL))
2945  {
2946 #ifdef HAVE_PLURAL
2947  if(p != pp)
2948  return pp;
2949 #endif
2950  return idCopy(p); /*F+Q=0*/
2951  }
2952 
2953  kStrategy strat=new skStrategy;
2954  strat->syzComp = syzComp;
2956  if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
2957  {
2958  strat->ak = si_max(strat->ak,(int)F->rank);
2959  }
2960 
2962  {
2963 #ifdef HAVE_SHIFTBBA
2964  if (currRing->isLPring)
2965  {
2966  WerrorS("No local ordering possible for shift algebra");
2967  return(NULL);
2968  }
2969 #endif
2970  res=kNF1(F,Q,pp,strat,lazyReduce);
2971  }
2972  else
2973  res=kNF2(F,Q,pp,strat,lazyReduce);
2974  delete(strat);
2975 
2976 #ifdef HAVE_PLURAL
2977  if(pp != p)
2978  id_Delete(&pp, currRing);
2979 #endif
2980 
2981  return res;
2982 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
ideal SCAQuotient(const ring r)
Definition: sca.h:10
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:101
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int ak
Definition: kutil.h:351
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define mflush()
Definition: reporter.h:57
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3503
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
CanonicalForm res
Definition: facAbsFact.cc:64
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd1.cc:1766
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
#define IDELEMS(i)
Definition: simpleideals.h:23
static short scaFirstAltVar(ring r)
Definition: sca.h:18
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1520
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:190
int p
Definition: cfModGcd.cc:4019
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ kNF1() [1/2]

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

Definition at line 1766 of file kstd1.cc.

1767 {
1768  assume(q!=NULL);
1769  assume(!(idIs0(F)&&(Q==NULL)));
1770 
1771 // lazy_reduce flags: can be combined by |
1772 //#define KSTD_NF_LAZY 1
1773  // do only a reduction of the leading term
1774 //#define KSTD_NF_ECART 2
1775  // only local: recude even with bad ecart
1776  poly p;
1777  int i;
1778  int j;
1779  int o;
1780  LObject h;
1781  BITSET save1;
1782  SI_SAVE_OPT1(save1);
1783 
1784  //if ((idIs0(F))&&(Q==NULL))
1785  // return pCopy(q); /*F=0*/
1786  //strat->ak = si_max(idRankFreeModule(F),pMaxComp(q));
1787  /*- creating temp data structures------------------- -*/
1788  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1789  strat->kNoether = pCopy((currRing->ppNoether));
1793  && (! TEST_V_DEG_STOP)
1794  && (0<Kstd1_deg)
1795  && ((!strat->kHEdgeFound)
1797  {
1798  pLmDelete(&strat->kNoether);
1799  strat->kNoether=pOne();
1800  pSetExp(strat->kNoether,1, Kstd1_deg+1);
1801  pSetm(strat->kNoether);
1802  strat->kHEdgeFound=TRUE;
1803  }
1804  initBuchMoraCrit(strat);
1806  initBuchMoraPosRing(strat);
1807  else
1808  initBuchMoraPos(strat);
1809  initMora(F,strat);
1810  strat->enterS = enterSMoraNF;
1811  /*- set T -*/
1812  strat->tl = -1;
1813  strat->tmax = setmaxT;
1814  strat->T = initT();
1815  strat->R = initR();
1816  strat->sevT = initsevT();
1817  /*- set S -*/
1818  strat->sl = -1;
1819  /*- init local data struct.-------------------------- -*/
1820  /*Shdl=*/initS(F,Q,strat);
1821  if ((strat->ak!=0)
1822  && (strat->kHEdgeFound))
1823  {
1824  if (strat->ak!=1)
1825  {
1826  pSetComp(strat->kNoether,1);
1827  pSetmComp(strat->kNoether);
1828  poly p=pHead(strat->kNoether);
1829  pSetComp(p,strat->ak);
1830  pSetmComp(p);
1831  p=pAdd(strat->kNoether,p);
1832  strat->kNoether=pNext(p);
1833  p_LmDelete(p,currRing);
1834  }
1835  }
1836  if ((lazyReduce & KSTD_NF_LAZY)==0)
1837  {
1838  for (i=strat->sl; i>=0; i--)
1839  pNorm(strat->S[i]);
1840  }
1841  /*- puts the elements of S also to T -*/
1842  for (i=0; i<=strat->sl; i++)
1843  {
1844  h.p = strat->S[i];
1845  h.ecart = strat->ecartS[i];
1846  if (strat->sevS[i] == 0) strat->sevS[i] = pGetShortExpVector(h.p);
1847  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
1848  h.length = pLength(h.p);
1849  h.sev = strat->sevS[i];
1850  h.SetpFDeg();
1851  enterT(h,strat);
1852  }
1853 #ifdef KDEBUG
1854 // kDebugPrint(strat);
1855 #endif
1856  /*- compute------------------------------------------- -*/
1857  p = pCopy(q);
1858  deleteHC(&p,&o,&j,strat);
1859  kTest(strat);
1860  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
1861  if (BVERBOSE(23)) kDebugPrint(strat);
1863  {
1864  if (p!=NULL) p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
1865  }
1866  else
1867  {
1868  if (p!=NULL) p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
1869  }
1870  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
1871  {
1872  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
1873  p = redtail(p,strat->sl,strat);
1874  }
1875  /*- release temp data------------------------------- -*/
1876  cleanT(strat);
1877  assume(strat->L==NULL); /*strat->L unsed */
1878  assume(strat->B==NULL); /*strat->B unused */
1879  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
1880  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
1881  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
1882  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
1883  omFree(strat->sevT);
1884  omFree(strat->S_2_R);
1885  omFree(strat->R);
1886 
1887  if ((Q!=NULL)&&(strat->fromQ!=NULL))
1888  {
1889  i=((IDELEMS(Q)+IDELEMS(F)+15)/16)*16;
1890  omFreeSize((ADDRESS)strat->fromQ,i*sizeof(int));
1891  strat->fromQ=NULL;
1892  }
1893  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
1894  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
1895 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1896 // {
1897 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1898 // if (ecartWeights)
1899 // {
1900 // omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
1901 // ecartWeights=NULL;
1902 // }
1903 // }
1904  idDelete(&strat->Shdl);
1905  SI_RESTORE_OPT1(save1);
1906  if (TEST_OPT_PROT) PrintLn();
1907  return p;
1908 }
#define pSetmComp(p)
TODO:
Definition: polys.h:269
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
STATIC_VAR jList * Q
Definition: janet.cc:30
KINLINE TObject ** initR()
Definition: kInline.h:95
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:375
#define pSetm(p)
Definition: polys.h:267
void PrintLn()
Definition: reporter.cc:310
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:762
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
#define TEST_OPT_DEGBOUND
Definition: options.h:111
#define pAdd(p, q)
Definition: polys.h:199
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:10035
poly kHEdge
Definition: kutil.h:325
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1460
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
VAR unsigned si_opt_1
Definition: options.c:5
class sLObject LObject
Definition: kutil.h:54
KINLINE TSet initT()
Definition: kInline.h:84
#define TEST_OPT_PROT
Definition: options.h:101
#define pSetExp(p, i, v)
Definition: polys.h:42
int * S_2_R
Definition: kutil.h:340
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:100
#define kTest(A)
Definition: kutil.h:654
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:135
#define SI_SAVE_OPT1(A)
Definition: options.h:21
int ak
Definition: kutil.h:351
#define BITSET
Definition: structs.h:20
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10121
#define Sy_bit(x)
Definition: options.h:31
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9586
#define mflush()
Definition: reporter.h:57
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8077
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define setmaxT
Definition: kutil.h:33
#define OPT_REDTAIL
Definition: options.h:89
#define TEST_V_DEG_STOP
Definition: options.h:134
#define TEST_OPT_STAIRCASEBOUND
Definition: options.h:113
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define KSTD_NF_ECART
Definition: kstd1.h:19
#define pSetComp(p, v)
Definition: polys.h:38
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9884
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
#define pOne()
Definition: polys.h:311
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
#define OPT_INTSTRATEGY
Definition: options.h:90
#define BVERBOSE(a)
Definition: options.h:34
intset ecartS
Definition: kutil.h:305
STATIC_VAR Poly * h
Definition: janet.cc:971
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void cleanT(kStrategy strat)
Definition: kutil.cc:538
LSet B
Definition: kutil.h:324
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:359
#define pWTotaldegree(p)
Definition: polys.h:279
unsigned long * sevS
Definition: kutil.h:318
#define pNext(p)
Definition: monomials.h:36
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:662
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
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299
int BOOLEAN
Definition: auxiliary.h:87
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:24
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11949
class sTObject TObject
Definition: kutil.h:53
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ kNF1() [2/2]

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

Definition at line 1910 of file kstd1.cc.

1911 {
1912  assume(!idIs0(q));
1913  assume(!(idIs0(F)&&(Q==NULL)));
1914 
1915 // lazy_reduce flags: can be combined by |
1916 //#define KSTD_NF_LAZY 1
1917  // do only a reduction of the leading term
1918 //#define KSTD_NF_ECART 2
1919  // only local: recude even with bad ecart
1920  poly p;
1921  int i;
1922  int j;
1923  int o;
1924  LObject h;
1925  ideal res;
1926  BITSET save1;
1927  SI_SAVE_OPT1(save1);
1928 
1929  //if (idIs0(q)) return idInit(IDELEMS(q),si_max(q->rank,F->rank));
1930  //if ((idIs0(F))&&(Q==NULL))
1931  // return idCopy(q); /*F=0*/
1932  //strat->ak = si_max(idRankFreeModule(F),idRankFreeModule(q));
1933  /*- creating temp data structures------------------- -*/
1934  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1935  strat->kNoether=pCopy((currRing->ppNoether));
1938  && (0<Kstd1_deg)
1939  && ((!strat->kHEdgeFound)
1941  {
1942  pLmDelete(&strat->kNoether);
1943  strat->kNoether=pOne();
1944  pSetExp(strat->kNoether,1, Kstd1_deg+1);
1945  pSetm(strat->kNoether);
1946  strat->kHEdgeFound=TRUE;
1947  }
1948  initBuchMoraCrit(strat);
1950  initBuchMoraPosRing(strat);
1951  else
1952  initBuchMoraPos(strat);
1953  initMora(F,strat);
1954  strat->enterS = enterSMoraNF;
1955  /*- set T -*/
1956  strat->tl = -1;
1957  strat->tmax = setmaxT;
1958  strat->T = initT();
1959  strat->R = initR();
1960  strat->sevT = initsevT();
1961  /*- set S -*/
1962  strat->sl = -1;
1963  /*- init local data struct.-------------------------- -*/
1964  /*Shdl=*/initS(F,Q,strat);
1965  if ((strat->ak!=0)
1966  && (strat->kHEdgeFound))
1967  {
1968  if (strat->ak!=1)
1969  {
1970  pSetComp(strat->kNoether,1);
1971  pSetmComp(strat->kNoether);
1972  poly p=pHead(strat->kNoether);
1973  pSetComp(p,strat->ak);
1974  pSetmComp(p);
1975  p=pAdd(strat->kNoether,p);
1976  strat->kNoether=pNext(p);
1977  p_LmDelete(p,currRing);
1978  }
1979  }
1980  if (TEST_OPT_INTSTRATEGY && ((lazyReduce & KSTD_NF_LAZY)==0))
1981  {
1982  for (i=strat->sl; i>=0; i--)
1983  pNorm(strat->S[i]);
1984  }
1985  /*- compute------------------------------------------- -*/
1986  res=idInit(IDELEMS(q),strat->ak);
1987  for (i=0; i<IDELEMS(q); i++)
1988  {
1989  if (q->m[i]!=NULL)
1990  {
1991  p = pCopy(q->m[i]);
1992  deleteHC(&p,&o,&j,strat);
1993  if (p!=NULL)
1994  {
1995  /*- puts the elements of S also to T -*/
1996  for (j=0; j<=strat->sl; j++)
1997  {
1998  h.p = strat->S[j];
1999  h.ecart = strat->ecartS[j];
2000  h.pLength = h.length = pLength(h.p);
2001  if (strat->sevS[j] == 0) strat->sevS[j] = pGetShortExpVector(h.p);
2002  else assume(strat->sevS[j] == pGetShortExpVector(h.p));
2003  h.sev = strat->sevS[j];
2004  h.SetpFDeg();
2006  enterT_strong(h,strat);
2007  else
2008  enterT(h,strat);
2009  }
2010  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2012  {
2013  p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
2014  }
2015  else
2016  p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
2017  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2018  {
2019  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2020  p = redtail(p,strat->sl,strat);
2021  }
2022  cleanT(strat);
2023  }
2024  res->m[i]=p;
2025  }
2026  //else
2027  // res->m[i]=NULL;
2028  }
2029  /*- release temp data------------------------------- -*/
2030  assume(strat->L==NULL); /*strat->L unsed */
2031  assume(strat->B==NULL); /*strat->B unused */
2032  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2033  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2034  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2035  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2036  omFree(strat->sevT);
2037  omFree(strat->S_2_R);
2038  omFree(strat->R);
2039  if ((Q!=NULL)&&(strat->fromQ!=NULL))
2040  {
2042  omFreeSize((ADDRESS)strat->fromQ,i*sizeof(int));
2043  strat->fromQ=NULL;
2044  }
2045  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
2046  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
2047 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2048 // {
2049 // pFDeg=strat->pOrigFDeg;
2050 // pLDeg=strat->pOrigLDeg;
2051 // if (ecartWeights)
2052 // {
2053 // omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2054 // ecartWeights=NULL;
2055 // }
2056 // }
2057  idDelete(&strat->Shdl);
2058  SI_RESTORE_OPT1(save1);
2059  if (TEST_OPT_PROT) PrintLn();
2060  return res;
2061 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
#define pSetmComp(p)
TODO:
Definition: polys.h:269
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
STATIC_VAR jList * Q
Definition: janet.cc:30
KINLINE TObject ** initR()
Definition: kInline.h:95
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:375
#define pSetm(p)
Definition: polys.h:267
void PrintLn()
Definition: reporter.cc:310
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:762
KINLINE unsigned long * initsevT()
Definition: kInline.h:100
#define TEST_OPT_DEGBOUND
Definition: options.h:111
#define pAdd(p, q)
Definition: polys.h:199
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:10035
poly kHEdge
Definition: kutil.h:325
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1460
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
VAR unsigned si_opt_1
Definition: options.c:5
class sLObject LObject
Definition: kutil.h:54
KINLINE TSet initT()
Definition: kInline.h:84
#define TEST_OPT_PROT
Definition: options.h:101
#define pSetExp(p, i, v)
Definition: polys.h:42
int * S_2_R
Definition: kutil.h:340
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:100
unsigned long * sevT
Definition: kutil.h:321
void * ADDRESS
Definition: auxiliary.h:135
#define SI_SAVE_OPT1(A)
Definition: options.h:21
int ak
Definition: kutil.h:351
#define BITSET
Definition: structs.h:20
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10121
#define Sy_bit(x)
Definition: options.h:31
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9586
#define mflush()
Definition: reporter.h:57
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8077
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
#define setmaxT
Definition: kutil.h:33
CanonicalForm res
Definition: facAbsFact.cc:64
#define OPT_REDTAIL
Definition: options.h:89
#define TEST_OPT_STAIRCASEBOUND
Definition: options.h:113
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
intset fromQ
Definition: kutil.h:317
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
#define KSTD_NF_ECART
Definition: kstd1.h:19
#define pSetComp(p, v)
Definition: polys.h:38
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9884
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
#define pOne()
Definition: polys.h:311
TObject ** R
Definition: kutil.h:338
static unsigned pLength(poly a)
Definition: p_polys.h:191
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:23
int tmax
Definition: kutil.h:348
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9686
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
STATIC_VAR Poly * h
Definition: janet.cc:971
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void cleanT(kStrategy strat)
Definition: kutil.cc:538
LSet B
Definition: kutil.h:324
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:359
#define pWTotaldegree(p)
Definition: polys.h:279
unsigned long * sevS
Definition: kutil.h:318
#define pNext(p)
Definition: monomials.h:36
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:662
#define setmaxTinc
Definition: kutil.h:34
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
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:710
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1324
int p
Definition: cfModGcd.cc:4019
ideal Shdl
Definition: kutil.h:299
int BOOLEAN
Definition: auxiliary.h:87
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:24
class sTObject TObject
Definition: kutil.h:53
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ kNFBound() [1/2]

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

Definition at line 2879 of file kstd1.cc.

2880 {
2881  if (p==NULL)
2882  return NULL;
2883 
2884  poly pp = p;
2885 
2886 #ifdef HAVE_PLURAL
2887  if(rIsSCA(currRing))
2888  {
2889  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2890  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2891  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
2892 
2893  if(Q == currRing->qideal)
2894  Q = SCAQuotient(currRing);
2895  }
2896 #endif
2897 
2898  if ((idIs0(F))&&(Q==NULL))
2899  {
2900 #ifdef HAVE_PLURAL
2901  if(p != pp)
2902  return pp;
2903 #endif
2904  return pCopy(p); /*F+Q=0*/
2905  }
2906 
2907  kStrategy strat=new skStrategy;
2908  strat->syzComp = syzComp;
2909  strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p));
2910  poly res;
2911  res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
2912  delete(strat);
2913 
2914 #ifdef HAVE_PLURAL
2915  if(pp != p)
2916  p_Delete(&pp, currRing);
2917 #endif
2918  return res;
2919 }
STATIC_VAR jList * Q
Definition: janet.cc:30
ideal SCAQuotient(const ring r)
Definition: sca.h:10
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3596
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:352
#define pMaxComp(p)
Definition: polys.h:295
int ak
Definition: kutil.h:351
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1465
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
CanonicalForm res
Definition: facAbsFact.cc:64
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
static short scaFirstAltVar(ring r)
Definition: sca.h:18
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:860
#define NULL
Definition: omList.c:12
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:190
int p
Definition: cfModGcd.cc:4019
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pCopy(p)
return a copy of the poly
Definition: polys.h:181

◆ kNFBound() [2/2]

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

Definition at line 2984 of file kstd1.cc.

2985 {
2986  ideal res;
2987  if (TEST_OPT_PROT)
2988  {
2989  Print("(S:%d)",IDELEMS(p));mflush();
2990  }
2991  if (idIs0(p))
2992  return idInit(IDELEMS(p),si_max(p->rank,F->rank));
2993 
2994  ideal pp = p;
2995 #ifdef HAVE_PLURAL
2996  if(rIsSCA(currRing))
2997  {
2998  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2999  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3000  pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
3001 
3002  if(Q == currRing->qideal)
3003  Q = SCAQuotient(currRing);
3004  }
3005 #endif
3006 
3007  if ((idIs0(F))&&(Q==NULL))
3008  {
3009 #ifdef HAVE_PLURAL
3010  if(p != pp)
3011  return pp;
3012 #endif
3013  return idCopy(p); /*F+Q=0*/
3014  }
3015 
3016  kStrategy strat=new skStrategy;
3017  strat->syzComp = syzComp;
3019  if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3020  {
3021  strat->ak = si_max(strat->ak,(int)F->rank);
3022  }
3023 
3024  res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3025  delete(strat);
3026 
3027 #ifdef HAVE_PLURAL
3028  if(pp != p)
3029  id_Delete(&pp, currRing);
3030 #endif
3031 
3032  return res;
3033 }
STATIC_VAR jList * Q
Definition: janet.cc:30
ideal SCAQuotient(const ring r)
Definition: sca.h:10
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3596
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:101
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int ak
Definition: kutil.h:351
#define mflush()
Definition: reporter.h:57
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
CanonicalForm res
Definition: facAbsFact.cc:64
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
static int si_max(const int a, const int b)
Definition: auxiliary.h:140
#define IDELEMS(i)
Definition: simpleideals.h:23
static short scaFirstAltVar(ring r)
Definition: sca.h:18
ideal idCopy(ideal A)
Definition: ideals.h:60
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define NULL
Definition: omList.c:12
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1520
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:190
int p
Definition: cfModGcd.cc:4019
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal

◆ kOptimizeLDeg()

static void kOptimizeLDeg ( pLDegProc  ldeg,
kStrategy  strat 
)
static

Definition at line 97 of file kstd1.cc.

98 {
99 // if (strat->ak == 0 && !rIsSyzIndexRing(currRing))
100  strat->length_pLength = TRUE;
101 // else
102 // strat->length_pLength = FALSE;
103 
104  if ((ldeg == pLDeg0c /*&& !rIsSyzIndexRing(currRing)*/) ||
105  (ldeg == pLDeg0 && strat->ak == 0))
106  {
107  strat->LDegLast = TRUE;
108  }
109  else
110  {
111  strat->LDegLast = FALSE;
112  }
113 }
#define FALSE
Definition: auxiliary.h:96
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:760
#define TRUE
Definition: auxiliary.h:100
char LDegLast
Definition: kutil.h:384
int ak
Definition: kutil.h:351
char length_pLength
Definition: kutil.h:386
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:729

◆ kSba()

ideal kSba ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
int  sbaOrder,
int  arri,
intvec hilb,
int  syzComp,
int  newIdeal,
intvec vw 
)

Definition at line 2273 of file kstd1.cc.

2275 {
2276  if(idIs0(F))
2277  return idInit(1,F->rank);
2278  if(!rField_is_Ring(currRing))
2279  {
2280  ideal r;
2281  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2282  BOOLEAN delete_w=(w==NULL);
2283  kStrategy strat=new skStrategy;
2284  strat->sbaOrder = sbaOrder;
2285  if (arri!=0)
2286  {
2287  strat->rewCrit1 = arriRewDummy;
2288  strat->rewCrit2 = arriRewCriterion;
2289  strat->rewCrit3 = arriRewCriterionPre;
2290  }
2291  else
2292  {
2293  strat->rewCrit1 = faugereRewCriterion;
2294  strat->rewCrit2 = faugereRewCriterion;
2295  strat->rewCrit3 = faugereRewCriterion;
2296  }
2297 
2298  if(!TEST_OPT_RETURN_SB)
2299  strat->syzComp = syzComp;
2300  if (TEST_OPT_SB_1)
2301  //if(!rField_is_Ring(currRing)) // always true here
2302  strat->newIdeal = newIdeal;
2304  strat->LazyPass=20;
2305  else
2306  strat->LazyPass=2;
2307  strat->LazyDegree = 1;
2309  strat->chainCrit=chainCritNormal;
2311  strat->ak = id_RankFreeModule(F,currRing);
2312  strat->kModW=kModW=NULL;
2313  strat->kHomW=kHomW=NULL;
2314  if (vw != NULL)
2315  {
2316  currRing->pLexOrder=FALSE;
2317  strat->kHomW=kHomW=vw;
2318  strat->pOrigFDeg = currRing->pFDeg;
2319  strat->pOrigLDeg = currRing->pLDeg;
2321  toReset = TRUE;
2322  }
2323  if (h==testHomog)
2324  {
2325  if (strat->ak == 0)
2326  {
2327  h = (tHomog)idHomIdeal(F,Q);
2328  w=NULL;
2329  }
2330  else if (!TEST_OPT_DEGBOUND)
2331  {
2332  if (w!=NULL)
2333  h = (tHomog)idHomModule(F,Q,w);
2334  else
2335  h = (tHomog)idHomIdeal(F,Q);
2336  }
2337  }
2338  currRing->pLexOrder=b;
2339  if (h==isHomog)
2340  {
2341  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2342  {
2343  strat->kModW = kModW = *w;
2344  if (vw == NULL)
2345  {
2346  strat->pOrigFDeg = currRing->pFDeg;
2347  strat->pOrigLDeg = currRing->pLDeg;
2349  toReset = TRUE;
2350  }
2351  }
2352  currRing->pLexOrder = TRUE;
2353  if (hilb==NULL) strat->LazyPass*=2;
2354  }
2355  strat->homog=h;
2356  #ifdef KDEBUG
2357  idTest(F);
2358  if(Q != NULL)
2359  idTest(Q);
2360  #endif
2361  #ifdef HAVE_PLURAL
2362  if (rIsPluralRing(currRing))
2363  {
2364  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2365  strat->no_prod_crit = ! bIsSCA;
2366  if (w!=NULL)
2367  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2368  else
2369  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2370  }
2371  else
2372  #endif
2373  {
2375  {
2376  if (w!=NULL)
2377  r=mora(F,Q,*w,hilb,strat);
2378  else
2379  r=mora(F,Q,NULL,hilb,strat);
2380  }
2381  else
2382  {
2383  strat->sigdrop = FALSE;
2384  if (w!=NULL)
2385  r=sba(F,Q,*w,hilb,strat);
2386  else
2387  r=sba(F,Q,NULL,hilb,strat);
2388  }
2389  }
2390  #ifdef KDEBUG
2391  idTest(r);
2392  #endif
2393  if (toReset)
2394  {
2395  kModW = NULL;
2396  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2397  }
2398  currRing->pLexOrder = b;
2399  //Print("%d reductions canceled \n",strat->cel);
2400  HCord=strat->HCord;
2401  //delete(strat);
2402  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2403  return r;
2404  }
2405  else
2406  {
2407  //--------------------------RING CASE-------------------------
2408  assume(sbaOrder == 1);
2409  assume(arri == 0);
2410  ideal r;
2411  r = idCopy(F);
2412  int sbaEnterS = -1;
2413  bool sigdrop = TRUE;
2414  //This is how we set the SBA algorithm;
2415  int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2416  while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2417  && (blockred <= blockedreductions))
2418  {
2419  loops++;
2420  if(loops == 1)
2421  sigdrop = FALSE;
2422  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2423  BOOLEAN delete_w=(w==NULL);
2424  kStrategy strat=new skStrategy;
2425  strat->sbaEnterS = sbaEnterS;
2426  strat->sigdrop = sigdrop;
2427  #if 0
2428  strat->blockred = blockred;
2429  #else
2430  strat->blockred = 0;
2431  #endif
2432  strat->blockredmax = blockedreductions;
2433  //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2434  //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2435  strat->sbaOrder = sbaOrder;
2436  if (arri!=0)
2437  {
2438  strat->rewCrit1 = arriRewDummy;
2439  strat->rewCrit2 = arriRewCriterion;
2440  strat->rewCrit3 = arriRewCriterionPre;
2441  }
2442  else
2443  {
2444  strat->rewCrit1 = faugereRewCriterion;
2445  strat->rewCrit2 = faugereRewCriterion;
2446  strat->rewCrit3 = faugereRewCriterion;
2447  }
2448 
2449  if(!TEST_OPT_RETURN_SB)
2450  strat->syzComp = syzComp;
2451  if (TEST_OPT_SB_1)
2452  if(!rField_is_Ring(currRing))
2453  strat->newIdeal = newIdeal;
2455  strat->LazyPass=20;
2456  else
2457  strat->LazyPass=2;
2458  strat->LazyDegree = 1;
2460  strat->chainCrit=chainCritNormal;
2462  strat->ak = id_RankFreeModule(F,currRing);
2463  strat->kModW=kModW=NULL;
2464  strat->kHomW=kHomW=NULL;
2465  if (vw != NULL)
2466  {
2467  currRing->pLexOrder=FALSE;
2468  strat->kHomW=kHomW=vw;
2469  strat->pOrigFDeg = currRing->pFDeg;
2470  strat->pOrigLDeg = currRing->pLDeg;
2472  toReset = TRUE;
2473  }
2474  if (h==testHomog)
2475  {
2476  if (strat->ak == 0)
2477  {
2478  h = (tHomog)idHomIdeal(F,Q);
2479  w=NULL;
2480  }
2481  else if (!TEST_OPT_DEGBOUND)
2482  {
2483  if (w!=NULL)
2484  h = (tHomog)idHomModule(F,Q,w);
2485  else
2486  h = (tHomog)idHomIdeal(F,Q);
2487  }
2488  }
2489  currRing->pLexOrder=b;
2490  if (h==isHomog)
2491  {
2492  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2493  {
2494  strat->kModW = kModW = *w;
2495  if (vw == NULL)
2496  {
2497  strat->pOrigFDeg = currRing->pFDeg;
2498  strat->pOrigLDeg = currRing->pLDeg;
2500  toReset = TRUE;
2501  }
2502  }
2503  currRing->pLexOrder = TRUE;
2504  if (hilb==NULL) strat->LazyPass*=2;
2505  }
2506  strat->homog=h;
2507  #ifdef KDEBUG
2508  idTest(F);
2509  if(Q != NULL)
2510  idTest(Q);
2511  #endif
2512  #ifdef HAVE_PLURAL
2513  if (rIsPluralRing(currRing))
2514  {
2515  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2516  strat->no_prod_crit = ! bIsSCA;
2517  if (w!=NULL)
2518  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2519  else
2520  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2521  }
2522  else
2523  #endif
2524  {
2526  {
2527  if (w!=NULL)
2528  r=mora(F,Q,*w,hilb,strat);
2529  else
2530  r=mora(F,Q,NULL,hilb,strat);
2531  }
2532  else
2533  {
2534  if (w!=NULL)
2535  r=sba(r,Q,*w,hilb,strat);
2536  else
2537  {
2538  r=sba(r,Q,NULL,hilb,strat);
2539  }
2540  }
2541  }
2542  #ifdef KDEBUG
2543  idTest(r);
2544  #endif
2545  if (toReset)
2546  {
2547  kModW = NULL;
2548  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2549  }
2550  currRing->pLexOrder = b;
2551  //Print("%d reductions canceled \n",strat->cel);
2552  HCord=strat->HCord;
2553  sigdrop = strat->sigdrop;
2554  sbaEnterS = strat->sbaEnterS;
2555  blockred = strat->blockred;
2556  delete(strat);
2557  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2558  }
2559  // Go to std
2560  if(sigdrop || blockred > blockedreductions)
2561  {
2562  r = kStd(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2563  }
2564  return r;
2565  }
2566 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
VAR intvec * kModW
Definition: kstd1.cc:2063
int syzComp
Definition: kutil.h:352
#define TEST_OPT_DEGBOUND
Definition: options.h:111
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:289
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
bool sigdrop
Definition: kutil.h:358
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition: kutil.cc:7129
#define FALSE
Definition: auxiliary.h:96
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3192
int sbaEnterS
Definition: kutil.h:361
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:290
#define TRUE
Definition: auxiliary.h:100
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:2088
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:291
int ak
Definition: kutil.h:351
VAR int HCord
Definition: kutil.cc:236
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:2536
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1929
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:543
int HCord
Definition: kutil.h:353
pFDegProc pOrigFDeg
Definition: kutil.h:292
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int blockredmax
Definition: kutil.h:364
VAR intvec * kHomW
Definition: kstd1.cc:2063
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
CanonicalForm b
Definition: cfModGcd.cc:4044
if(yy_init)
Definition: libparse.cc:1420
pLDegProc pOrigLDeg
Definition: kutil.h:293
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:39
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
#define assume(x)
Definition: mod2.h:390
char no_prod_crit
Definition: kutil.h:393
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
unsigned sbaOrder
Definition: kutil.h:312
ideal idCopy(ideal A)
Definition: ideals.h:60
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition: kutil.cc:7188
#define TEST_OPT_RETURN_SB
Definition: options.h:110
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
STATIC_VAR Poly * h
Definition: janet.cc:971
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition: kutil.cc:7213
char homog
Definition: kutil.h:371
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
char z2homog
Definition: kutil.h:373
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
intvec * kHomW
Definition: kutil.h:334
#define TEST_OPT_SB_1
Definition: options.h:116
int blockred
Definition: kutil.h:363
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:333
static bool rIsSCA(const ring r)
Definition: nc.h:190
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2065
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3405
int LazyPass
Definition: kutil.h:351
int newIdeal
Definition: kutil.h:355
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
int BOOLEAN
Definition: auxiliary.h:87
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition: kInline.h:1203
int LazyDegree
Definition: kutil.h:351
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1517
#define idTest(id)
Definition: ideals.h:47

◆ kStd()

ideal kStd ( ideal  F,
ideal  Q,
tHomog  h,
intvec **  w,
intvec hilb,
int  syzComp,
int  newIdeal,
intvec vw,
s_poly_proc_t  sp 
)

Definition at line 2088 of file kstd1.cc.

2090 {
2091  if(idIs0(F))
2092  return idInit(1,F->rank);
2093 
2094 #ifdef HAVE_SHIFTBBA
2095  if(rIsLPRing(currRing)) return freegb(F, Q);
2096 #endif
2097 
2098  ideal r;
2099  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2100  BOOLEAN delete_w=(w==NULL);
2101  kStrategy strat=new skStrategy;
2102 
2103  strat->s_poly=sp;
2104  if(!TEST_OPT_RETURN_SB)
2105  strat->syzComp = syzComp;
2106  if (TEST_OPT_SB_1
2107  &&(!rField_is_Ring(currRing))
2108  )
2109  strat->newIdeal = newIdeal;
2111  strat->LazyPass=20;
2112  else
2113  strat->LazyPass=2;
2114  strat->LazyDegree = 1;
2115  strat->ak = id_RankFreeModule(F,currRing);
2116  strat->kModW=kModW=NULL;
2117  strat->kHomW=kHomW=NULL;
2118  if (vw != NULL)
2119  {
2120  currRing->pLexOrder=FALSE;
2121  strat->kHomW=kHomW=vw;
2122  strat->pOrigFDeg = currRing->pFDeg;
2123  strat->pOrigLDeg = currRing->pLDeg;
2125  toReset = TRUE;
2126  }
2127  if (h==testHomog)
2128  {
2129  if (strat->ak == 0)
2130  {
2131  h = (tHomog)idHomIdeal(F,Q);
2132  w=NULL;
2133  }
2134  else if (!TEST_OPT_DEGBOUND)
2135  {
2136  if (w!=NULL)
2137  h = (tHomog)idHomModule(F,Q,w);
2138  else
2139  h = (tHomog)idHomIdeal(F,Q);
2140  }
2141  }
2142  currRing->pLexOrder=b;
2143  if (h==isHomog)
2144  {
2145  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2146  {
2147  strat->kModW = kModW = *w;
2148  if (vw == NULL)
2149  {
2150  strat->pOrigFDeg = currRing->pFDeg;
2151  strat->pOrigLDeg = currRing->pLDeg;
2153  toReset = TRUE;
2154  }
2155  }
2156  currRing->pLexOrder = TRUE;
2157  if (hilb==NULL) strat->LazyPass*=2;
2158  }
2159  strat->homog=h;
2160 #ifdef KDEBUG
2161  idTest(F);
2162  if (Q!=NULL) idTest(Q);
2163 #endif
2164 #ifdef HAVE_PLURAL
2165  if (rIsPluralRing(currRing))
2166  {
2167  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2168  strat->no_prod_crit = ! bIsSCA;
2169  if (w!=NULL)
2170  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2171  else
2172  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2173  }
2174  else
2175 #endif
2176  {
2177  #if PRE_INTEGER_CHECK
2178  //the preinteger check strategy is not for modules
2179  if(nCoeff_is_Z(currRing->cf) && strat->ak <= 0)
2180  {
2181  ideal FCopy = idCopy(F);
2182  poly pFmon = preIntegerCheck(FCopy, Q);
2183  if(pFmon != NULL)
2184  {
2185  idInsertPoly(FCopy, pFmon);
2186  strat->kModW=kModW=NULL;
2187  if (h==testHomog)
2188  {
2189  if (strat->ak == 0)
2190  {
2191  h = (tHomog)idHomIdeal(FCopy,Q);
2192  w=NULL;
2193  }
2194  else if (!TEST_OPT_DEGBOUND)
2195  {
2196  if (w!=NULL)
2197  h = (tHomog)idHomModule(FCopy,Q,w);
2198  else
2199  h = (tHomog)idHomIdeal(FCopy,Q);
2200  }
2201  }
2202  currRing->pLexOrder=b;
2203  if (h==isHomog)
2204  {
2205  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2206  {
2207  strat->kModW = kModW = *w;
2208  if (vw == NULL)
2209  {
2210  strat->pOrigFDeg = currRing->pFDeg;
2211  strat->pOrigLDeg = currRing->pLDeg;
2213  toReset = TRUE;
2214  }
2215  }
2216  currRing->pLexOrder = TRUE;
2217  if (hilb==NULL) strat->LazyPass*=2;
2218  }
2219  strat->homog=h;
2220  }
2221  omTestMemory(1);
2222  if(w == NULL)
2223  {
2225  r=mora(FCopy,Q,NULL,hilb,strat);
2226  else
2227  r=bba(FCopy,Q,NULL,hilb,strat);
2228  }
2229  else
2230  {
2232  r=mora(FCopy,Q,*w,hilb,strat);
2233  else
2234  r=bba(FCopy,Q,*w,hilb,strat);
2235  }
2236  idDelete(&FCopy);
2237  }
2238  else
2239  #endif
2240  {
2241  if(w==NULL)
2242  {
2244  r=mora(F,Q,NULL,hilb,strat);
2245  else
2246  r=bba(F,Q,NULL,hilb,strat);
2247  }
2248  else
2249  {
2251  r=mora(F,Q,*w,hilb,strat);
2252  else
2253  r=bba(F,Q,*w,hilb,strat);
2254  }
2255  }
2256  }
2257 #ifdef KDEBUG
2258  idTest(r);
2259 #endif
2260  if (toReset)
2261  {
2262  kModW = NULL;
2263  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2264  }
2265  currRing->pLexOrder = b;
2266 //Print("%d reductions canceled \n",strat->cel);
2267  HCord=strat->HCord;
2268  delete(strat);
2269  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2270  return r;
2271 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
VAR intvec * kModW
Definition: kstd1.cc:2063
int syzComp
Definition: kutil.h:352
#define TEST_OPT_DEGBOUND
Definition: options.h:111
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
int ak
Definition: kutil.h:351
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:10994
VAR int HCord
Definition: kutil.cc:236
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:2178
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:408
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:543
int HCord
Definition: kutil.h:353
pFDegProc pOrigFDeg
Definition: kutil.h:292
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
VAR intvec * kHomW
Definition: kstd1.cc:2063
CanonicalForm b
Definition: cfModGcd.cc:4044
if(yy_init)
Definition: libparse.cc:1420
omError_t omTestMemory(int check_level)
Definition: omDebug.c:94
pLDegProc pOrigLDeg
Definition: kutil.h:293
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:39
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
char no_prod_crit
Definition: kutil.h:393
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:397
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
ideal freegb(ideal F, ideal Q)
Definition: kstd2.cc:4461
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
ideal idCopy(ideal A)
Definition: ideals.h:60
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
#define TEST_OPT_RETURN_SB
Definition: options.h:110
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
STATIC_VAR Poly * h
Definition: janet.cc:971
s_poly_proc_t s_poly
Definition: kutil.h:296
char homog
Definition: kutil.h:371
char z2homog
Definition: kutil.h:373
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
intvec * kHomW
Definition: kutil.h:334
#define TEST_OPT_SB_1
Definition: options.h:116
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:333
static bool rIsSCA(const ring r)
Definition: nc.h:190
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2065
int LazyPass
Definition: kutil.h:351
int newIdeal
Definition: kutil.h:355
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
int BOOLEAN
Definition: auxiliary.h:87
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
int LazyDegree
Definition: kutil.h:351
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1517
#define idTest(id)
Definition: ideals.h:47

◆ kStdShift()

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

Definition at line 2569 of file kstd1.cc.

2571 {
2572  ideal r;
2573  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2574  BOOLEAN delete_w=(w==NULL);
2575  kStrategy strat=new skStrategy;
2576  intvec* temp_w=NULL;
2577 
2578  strat->rightGB = rightGB;
2579 
2580  if(!TEST_OPT_RETURN_SB)
2581  strat->syzComp = syzComp;
2582  if (TEST_OPT_SB_1)
2583  if(!rField_is_Ring(currRing))
2584  strat->newIdeal = newIdeal;
2586  strat->LazyPass=20;
2587  else
2588  strat->LazyPass=2;
2589  strat->LazyDegree = 1;
2590  strat->ak = id_RankFreeModule(F,currRing);
2591  strat->kModW=kModW=NULL;
2592  strat->kHomW=kHomW=NULL;
2593  if (vw != NULL)
2594  {
2595  currRing->pLexOrder=FALSE;
2596  strat->kHomW=kHomW=vw;
2597  strat->pOrigFDeg = currRing->pFDeg;
2598  strat->pOrigLDeg = currRing->pLDeg;
2600  toReset = TRUE;
2601  }
2602  if (h==testHomog)
2603  {
2604  if (strat->ak == 0)
2605  {
2606  h = (tHomog)idHomIdeal(F,Q);
2607  w=NULL;
2608  }
2609  else if (!TEST_OPT_DEGBOUND)
2610  {
2611  if (w!=NULL)
2612  h = (tHomog)idHomModule(F,Q,w);
2613  else
2614  h = (tHomog)idHomIdeal(F,Q);
2615  }
2616  }
2617  currRing->pLexOrder=b;
2618  if (h==isHomog)
2619  {
2620  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2621  {
2622  strat->kModW = kModW = *w;
2623  if (vw == NULL)
2624  {
2625  strat->pOrigFDeg = currRing->pFDeg;
2626  strat->pOrigLDeg = currRing->pLDeg;
2628  toReset = TRUE;
2629  }
2630  }
2631  currRing->pLexOrder = TRUE;
2632  if (hilb==NULL) strat->LazyPass*=2;
2633  }
2634  strat->homog=h;
2635 #ifdef KDEBUG
2636  idTest(F);
2637 #endif
2639  {
2640  /* error: no local ord yet with shifts */
2641  WerrorS("No local ordering possible for shift algebra");
2642  return(NULL);
2643  }
2644  else
2645  {
2646  /* global ordering */
2647  if (w!=NULL)
2648  r=bbaShift(F,Q,*w,hilb,strat);
2649  else
2650  r=bbaShift(F,Q,NULL,hilb,strat);
2651  }
2652 #ifdef KDEBUG
2653  idTest(r);
2654 #endif
2655  if (toReset)
2656  {
2657  kModW = NULL;
2658  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2659  }
2660  currRing->pLexOrder = b;
2661 //Print("%d reductions canceled \n",strat->cel);
2662  HCord=strat->HCord;
2663  delete(strat);
2664  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2665  return r;
2666 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:755
STATIC_VAR jList * Q
Definition: janet.cc:30
VAR intvec * kModW
Definition: kstd1.cc:2063
int syzComp
Definition: kutil.h:352
#define TEST_OPT_DEGBOUND
Definition: options.h:111
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
char rightGB
Definition: kutil.h:368
#define FALSE
Definition: auxiliary.h:96
#define TRUE
Definition: auxiliary.h:100
int ak
Definition: kutil.h:351
void WerrorS(const char *s)
Definition: feFopen.cc:24
VAR int HCord
Definition: kutil.cc:236
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:543
int HCord
Definition: kutil.h:353
pFDegProc pOrigFDeg
Definition: kutil.h:292
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
VAR intvec * kHomW
Definition: kstd1.cc:2063
CanonicalForm b
Definition: cfModGcd.cc:4044
if(yy_init)
Definition: libparse.cc:1420
pLDegProc pOrigLDeg
Definition: kutil.h:293
Definition: intvec.h:19
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:39
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3597
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2075
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:4163
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3609
#define TEST_OPT_RETURN_SB
Definition: options.h:110
STATIC_VAR Poly * h
Definition: janet.cc:971
char homog
Definition: kutil.h:371
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
intvec * kHomW
Definition: kutil.h:334
#define TEST_OPT_SB_1
Definition: options.h:116
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:333
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2065
int LazyPass
Definition: kutil.h:351
int newIdeal
Definition: kutil.h:355
int BOOLEAN
Definition: auxiliary.h:87
int LazyDegree
Definition: kutil.h:351
#define idTest(id)
Definition: ideals.h:47

◆ missingAxis()

void missingAxis ( int *  last,
kStrategy  strat 
)

Definition at line 925 of file kstd1.cc.

926 {
927  int i = 0;
928  int k = 0;
929 
930  *last = 0;
932  {
933  loop
934  {
935  i++;
936  if (i > (currRing->N)) break;
937  if (strat->NotUsedAxis[i])
938  {
939  *last = i;
940  k++;
941  }
942  if (k>1)
943  {
944  *last = 0;
945  break;
946  }
947  }
948  }
949 }
BOOLEAN * NotUsedAxis
Definition: kutil.h:330
int k
Definition: cfEzgcd.cc:92
#define loop
Definition: structs.h:80
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
int i
Definition: cfEzgcd.cc:125
STATIC_VAR poly last
Definition: hdegree.cc:1076
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756

◆ mora()

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

Definition at line 1517 of file kstd1.cc.

1518 {
1519  int olddeg = 0;
1520  int reduc = 0;
1521  int red_result = 1;
1522  int hilbeledeg=1,hilbcount=0;
1523  BITSET save1;
1524  SI_SAVE_OPT1(save1);
1526  {
1527  si_opt_1 &= ~Sy_bit(OPT_REDSB);
1529  }
1530 
1531  strat->update = TRUE;
1532  /*- setting global variables ------------------- -*/
1533  initBuchMoraCrit(strat);
1534  initHilbCrit(F,Q,&hilb,strat);
1535  initMora(F,strat);
1537  initBuchMoraPosRing(strat);
1538  else
1539  initBuchMoraPos(strat);
1540  /*Shdl=*/initBuchMora(F,Q,strat);
1541  if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
1542  /*updateS in initBuchMora has Hecketest
1543  * and could have put strat->kHEdgdeFound FALSE*/
1544  if ((currRing->ppNoether)!=NULL)
1545  {
1546  strat->kHEdgeFound = TRUE;
1547  }
1548  if (strat->kHEdgeFound && strat->update)
1549  {
1550  firstUpdate(strat);
1551  updateLHC(strat);
1552  reorderL(strat);
1553  }
1554  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
1555  {
1556  strat->posInLOld = strat->posInL;
1557  strat->posInLOldFlag = FALSE;
1558  strat->posInL = posInL10;
1559  updateL(strat);
1560  reorderL(strat);
1561  }
1562  kTest_TS(strat);
1563  strat->use_buckets = kMoraUseBucket(strat);
1564 
1565 #ifdef HAVE_TAIL_RING
1566  if (strat->homog && strat->red == redFirst)
1567  if(!idIs0(F) &&(!rField_is_Ring(currRing)))
1568  kStratInitChangeTailRing(strat);
1569 #endif
1570 
1571  if (BVERBOSE(23))
1572  {
1573  kDebugPrint(strat);
1574  }
1575 //deleteInL(strat->L,&strat->Ll,1,strat);
1576 //deleteInL(strat->L,&strat->Ll,0,strat);
1577 
1578  /*- compute-------------------------------------------*/
1579  while (strat->Ll >= 0)
1580  {
1581  #ifdef KDEBUG
1582  if (TEST_OPT_DEBUG) messageSets(strat);
1583  #endif
1584  if (siCntrlc)
1585  {
1586  while (strat->Ll >= 0)
1587  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1588  strat->noClearS=TRUE;
1589  }
1590  if (TEST_OPT_DEGBOUND
1591  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1592  {
1593  /*
1594  * stops computation if
1595  * - 24 (degBound)
1596  * && upper degree is bigger than Kstd1_deg
1597  */
1598  while ((strat->Ll >= 0)
1599  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1600  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1601  )
1602  {
1603  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1604  //if (TEST_OPT_PROT)
1605  //{
1606  // PrintS("D"); mflush();
1607  //}
1608  }
1609  if (strat->Ll<0) break;
1610  else strat->noClearS=TRUE;
1611  }
1612  strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1613  if (strat->Ll==0) strat->interpt=TRUE;
1614  strat->Ll--;
1615  // create the real Spoly
1616  if (pNext(strat->P.p) == strat->tail)
1617  {
1618  /*- deletes the short spoly and computes -*/
1619  if (rField_is_Ring(currRing))
1620  pLmDelete(strat->P.p);
1621  else
1622  pLmFree(strat->P.p);
1623  strat->P.p = NULL;
1624  poly m1 = NULL, m2 = NULL;
1625  // check that spoly creation is ok
1626  while (strat->tailRing != currRing &&
1627  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1628  {
1629  assume(m1 == NULL && m2 == NULL);
1630  // if not, change to a ring where exponents are large enough
1631  kStratChangeTailRing(strat);
1632  }
1633  /* create the real one */
1634  ksCreateSpoly(&(strat->P), strat->kNoetherTail(), strat->use_buckets,
1635  strat->tailRing, m1, m2, strat->R);
1636  if (!strat->use_buckets)
1637  strat->P.SetLength(strat->length_pLength);
1638  }
1639  else if (strat->P.p1 == NULL)
1640  {
1641  // for input polys, prepare reduction (buckets !)
1642  strat->P.SetLength(strat->length_pLength);
1643  strat->P.PrepareRed(strat->use_buckets);
1644  }
1645 
1646  // the s-poly
1647  if (!strat->P.IsNull())
1648  {
1649  // might be NULL from noether !!!
1650  if (TEST_OPT_PROT)
1651  message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
1652  // reduce
1653  red_result = strat->red(&strat->P,strat);
1654  }
1655 
1656  // the reduced s-poly
1657  if (! strat->P.IsNull())
1658  {
1659  strat->P.GetP();
1660  // statistics
1661  if (TEST_OPT_PROT) PrintS("s");
1662  // normalization
1664  strat->P.pCleardenom();
1665  else
1666  strat->P.pNorm();
1667  // tailreduction
1668  strat->P.p = redtail(&(strat->P),strat->sl,strat);
1669  if (strat->P.p==NULL)
1670  {
1671  WerrorS("expoent overflow - wrong ordering");
1672  return(idInit(1,1));
1673  }
1674  // set ecart -- might have changed because of tail reductions
1675  if ((!strat->noTailReduction) && (!strat->honey))
1676  strat->initEcart(&strat->P);
1677  // cancel unit
1678  cancelunit(&strat->P);
1679  // for char 0, clear denominators
1680  if ((strat->P.p->next==NULL) /* i.e. cancelunit did something*/
1682  strat->P.pCleardenom();
1683 
1684  enterT(strat->P,strat);
1685  // build new pairs
1686  if (rField_is_Ring(currRing))
1687  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1688  else
1689  enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1690  // put in S
1691  strat->enterS(strat->P,
1692  posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
1693  strat, strat->tl);
1694  // apply hilbert criterion
1695  if (hilb!=NULL)
1696  {
1697  if (strat->homog==isHomog)
1698  khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1699  else
1700  khCheckLocInhom(Q,w,hilb,hilbcount,strat);
1701  }
1702 
1703  // clear strat->P
1704  kDeleteLcm(&strat->P);
1705 
1706 #ifdef KDEBUG
1707  // make sure kTest_TS does not complain about strat->P
1708  memset(&strat->P,0,sizeof(strat->P));
1709 #endif
1710  }
1711  if (strat->kHEdgeFound)
1712  {
1713  if ((TEST_OPT_FINDET)
1714  || ((TEST_OPT_MULTBOUND) && (scMult0Int(strat->Shdl,NULL,strat->tailRing) < Kstd1_mu)))
1715  {
1716  // obachman: is this still used ???
1717  /*
1718  * stops computation if strat->kHEdgeFound and
1719  * - 27 (finiteDeterminacyTest)
1720  * or
1721  * - 23
1722  * (multBound)
1723  * && multiplicity of the ideal is smaller then a predefined number mu
1724  */
1725  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1726  }
1727  }
1728  kTest_TS(strat);
1729  }
1730  /*- complete reduction of the standard basis------------------------ -*/
1731  if (TEST_OPT_REDSB) completeReduce(strat);
1732  else if (TEST_OPT_PROT) PrintLn();
1733  /*- release temp data------------------------------- -*/
1734  exitBuchMora(strat);
1735  /*- polynomials used for HECKE: HC, noether -*/
1736  if (TEST_OPT_FINDET)
1737  {
1738  if (strat->kHEdge!=NULL)
1739  Kstd1_mu=currRing->pFDeg(strat->kHEdge,currRing);
1740  else
1741  Kstd1_mu=-1;
1742  }
1743  if (strat->kHEdge!=NULL) pLmFree(&strat->kHEdge);
1744  strat->update = TRUE; //???
1745  strat->lastAxis = 0; //???
1746  if (strat->kNoether!=NULL) pLmDelete(&strat->kNoether);
1747  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
1748  if ((TEST_OPT_PROT)||(TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
1749 // if (TEST_OPT_WEIGHTM)
1750 // {
1751 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1752 // if (ecartWeights)
1753 // {
1754 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1755 // ecartWeights=NULL;
1756 // }
1757 // }
1758  if(nCoeff_is_Z(currRing->cf))
1759  finalReduceByMon(strat);
1760  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1761  SI_RESTORE_OPT1(save1);
1762  idTest(strat->Shdl);
1763  return (strat->Shdl);
1764 }
#define OPT_REDSB
Definition: options.h:74
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
STATIC_VAR jList * Q
Definition: janet.cc:30
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
VAR BOOLEAN siCntrlc
Definition: options.c:14
char kHEdgeFound
Definition: kutil.h:375
void PrintLn()
Definition: reporter.cc:310
#define TEST_OPT_DEGBOUND
Definition: options.h:111
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:10035
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7954
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1460
VAR unsigned si_opt_1
Definition: options.c:5
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7995
#define TEST_OPT_PROT
Definition: options.h:101
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:96
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10208
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:528
char interpt
Definition: kutil.h:370
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4859
EXTERN_VAR int Kstd1_mu
Definition: kstd1.h:50
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TEST_OPT_MULTBOUND
Definition: options.h:112
char noClearS
Definition: kutil.h:401
#define TRUE
Definition: auxiliary.h:100
#define TEST_OPT_REDSB
Definition: options.h:102
static void kDeleteLcm(LObject *P)
Definition: kutil.h:869
void * ADDRESS
Definition: auxiliary.h:135
#define SI_SAVE_OPT1(A)
Definition: options.h:21
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define TEST_OPT_DEBUG
Definition: options.h:106
#define BITSET
Definition: structs.h:20
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10121
#define Sy_bit(x)
Definition: options.h:31
char posInLOldFlag
Definition: kutil.h:381
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:838
char length_pLength
Definition: kutil.h:386
void updateL(kStrategy strat)
Definition: kstd1.cc:1039
char use_buckets
Definition: kutil.h:382
int lastAxis
Definition: kutil.h:354
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11502
#define TEST_OPT_FINDET
Definition: options.h:109
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9586
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:925
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
#define kTest_TS(A)
Definition: kutil.h:655
#define OPT_REDTAIL
Definition: options.h:89
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition: kutil.cc:7405
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9866
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:918
#define assume(x)
Definition: mod2.h:390
#define messageSets(s)
Definition: kutil.h:541
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1110
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1159
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11403
LObject P
Definition: kutil.h:298
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9884
void reorderL(kStrategy strat)
Definition: kstd1.cc:867
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
TObject ** R
Definition: kutil.h:338
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:756
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10931
#define BVERBOSE(a)
Definition: options.h:34
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:28
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
char homog
Definition: kutil.h:371
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4831
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1203
ring tailRing
Definition: kutil.h:341
void khCheckLocInhom(ideal Q, intvec *w, intvec *hilb, int &count, kStrategy strat)
Definition: khstd.cc:133
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5035
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10745
#define pNext(p)
Definition: monomials.h:36
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10533
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
char update
Definition: kutil.h:380
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition: kstd1.cc:3476
#define TEST_OPT_FASTHC
Definition: options.h:107
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:11318
int BOOLEAN
Definition: auxiliary.h:87
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
KINLINE poly kNoetherTail()
Definition: kInline.h:66
#define SI_RESTORE_OPT1(A)
Definition: options.h:24
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10292
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1006
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11949
#define idTest(id)
Definition: ideals.h:47

◆ posInL10()

int posInL10 ( const LSet  set,
const int  length,
LObject p,
const kStrategy  strat 
)

Definition at line 1006 of file kstd1.cc.

1007 {
1008  int j,dp,dL;
1009 
1010  if (length<0) return 0;
1011  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1012  {
1013  int op= p->GetpFDeg() +p->ecart;
1014  for (j=length; j>=0; j--)
1015  {
1016  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1017  return j+1;
1018  if (dp < dL)
1019  return j+1;
1020  if ((dp == dL)
1021  && (set[j].GetpFDeg()+set[j].ecart >= op))
1022  return j+1;
1023  }
1024  }
1025  j=length;
1026  loop
1027  {
1028  if (j<0) break;
1029  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1030  j--;
1031  }
1032  return strat->posInLOld(set,j,p,strat);
1033 }
int j
Definition: facHensel.cc:105
#define loop
Definition: structs.h:80
int lastAxis
Definition: kutil.h:354
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:284
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:958
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:263
int p
Definition: cfModGcd.cc:4019

◆ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 166 of file kstd1.cc.

167 {
168  int i,at,ei,li,ii;
169  int j = 0;
170  int pass = 0;
171  long d,reddeg;
172 
173  d = h->GetpFDeg()+ h->ecart;
174  reddeg = strat->LazyDegree+d;
175  h->SetShortExpVector();
176  loop
177  {
178  j = kFindDivisibleByInT(strat, h);
179  if (j < 0)
180  {
181  if (strat->honey) h->SetLength(strat->length_pLength);
182  return 1;
183  }
184 
185  ei = strat->T[j].ecart;
186  ii = j;
187 
188  if (ei > h->ecart && ii < strat->tl)
189  {
190  li = strat->T[j].length;
191  // the polynomial to reduce with (up to the moment) is;
192  // pi with ecart ei and length li
193  // look for one with smaller ecart
194  i = j;
195  loop
196  {
197  /*- takes the first possible with respect to ecart -*/
198  i++;
199 #if 1
200  if (i > strat->tl) break;
201  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
202  strat->T[i].length < li))
203  &&
204  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing))
205 #else
206  j = kFindDivisibleByInT(strat, h, i);
207  if (j < 0) break;
208  i = j;
209  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
210  strat->T[i].length < li))
211 #endif
212  {
213  // the polynomial to reduce with is now
214  ii = i;
215  ei = strat->T[i].ecart;
216  if (ei <= h->ecart) break;
217  li = strat->T[i].length;
218  }
219  }
220  }
221 
222  // end of search: have to reduce with pi
223  if (ei > h->ecart)
224  {
225  // It is not possible to reduce h with smaller ecart;
226  // if possible h goes to the lazy-set L,i.e
227  // if its position in L would be not the last one
228  strat->fromT = TRUE;
229  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
230  {
231  h->SetLmCurrRing();
232  if (strat->honey && strat->posInLDependsOnLength)
233  h->SetLength(strat->length_pLength);
234  assume(h->FDeg == h->pFDeg());
235  at = strat->posInL(strat->L,strat->Ll,h,strat);
236  if (at <= strat->Ll)
237  {
238  /*- h will not become the next element to reduce -*/
239  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
240 #ifdef KDEBUG
241  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
242 #endif
243  h->Clear();
244  strat->fromT = FALSE;
245  return -1;
246  }
247  }
248  }
249 
250  // now we finally can reduce
251  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
252  strat->fromT=FALSE;
253 
254  // are we done ???
255  if (h->IsNull())
256  {
258  kDeleteLcm(h);
259  h->Clear();
260  return 0;
261  }
262 
263  // NO!
264  h->SetShortExpVector();
265  h->SetpFDeg();
266  if (strat->honey)
267  {
268  if (ei <= h->ecart)
269  h->ecart = d-h->GetpFDeg();
270  else
271  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
272  }
273  else
274  // this has the side effect of setting h->length
275  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
276 #if 0
277  if (strat->syzComp!=0)
278  {
279  if ((strat->syzComp>0) && (h->Comp() > strat->syzComp))
280  {
281  assume(h->MinComp() > strat->syzComp);
282  if (strat->honey) h->SetLength();
283 #ifdef KDEBUG
284  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
285 #endif
286  return -2;
287  }
288  }
289 #endif
290  /*- try to reduce the s-polynomial -*/
291  pass++;
292  d = h->GetpFDeg()+h->ecart;
293  /*
294  *test whether the polynomial should go to the lazyset L
295  *-if the degree jumps
296  *-if the number of pre-defined reductions jumps
297  */
298  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
299  && ((d >= reddeg) || (pass > strat->LazyPass)))
300  {
301  h->SetLmCurrRing();
302  if (strat->honey && strat->posInLDependsOnLength)
303  h->SetLength(strat->length_pLength);
304  assume(h->FDeg == h->pFDeg());
305  at = strat->posInL(strat->L,strat->Ll,h,strat);
306  if (at <= strat->Ll)
307  {
308  int dummy=strat->sl;
309  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
310  {
311  if (strat->honey && !strat->posInLDependsOnLength)
312  h->SetLength(strat->length_pLength);
313  return 1;
314  }
315  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
316 #ifdef KDEBUG
317  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
318 #endif
319  h->Clear();
320  return -1;
321  }
322  }
323  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
324  {
325  Print(".%ld",d);mflush();
326  reddeg = d+1;
327  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
328  {
329  strat->overflow=TRUE;
330  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
331  h->GetP();
332  at = strat->posInL(strat->L,strat->Ll,h,strat);
333  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
334  h->Clear();
335  return -1;
336  }
337  }
338  }
339 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:378
int j
Definition: facHensel.cc:105
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:101
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:96
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:116
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:100
static void kDeleteLcm(LObject *P)
Definition: kutil.h:869
char LDegLast
Definition: kutil.h:384
unsigned long * sevT
Definition: kutil.h:321
#define TEST_OPT_DEBUG
Definition: options.h:106
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:386
#define mflush()
Definition: reporter.h:57
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define assume(x)
Definition: mod2.h:390
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1857
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:326
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
STATIC_VAR Poly * h
Definition: janet.cc:971
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
char honey
Definition: kutil.h:376
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:388
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:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:119
int LazyDegree
Definition: kutil.h:351

◆ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 528 of file kstd1.cc.

529 {
530  if (h->IsNull()) return 0;
531 
532  int at;
533  long reddeg,d;
534  int pass = 0;
535  int j = 0;
536 
537  if (! strat->homog)
538  {
539  d = h->GetpFDeg() + h->ecart;
540  reddeg = strat->LazyDegree+d;
541  }
542  h->SetShortExpVector();
543  loop
544  {
545  j = kFindDivisibleByInT(strat, h);
546  if (j < 0)
547  {
548  h->SetDegStuffReturnLDeg(strat->LDegLast);
549  return 1;
550  }
551 
553  strat->T[j].pNorm();
554 #ifdef KDEBUG
555  if (TEST_OPT_DEBUG)
556  {
557  PrintS("reduce ");
558  h->wrp();
559  PrintS(" with ");
560  strat->T[j].wrp();
561  }
562 #endif
563  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
564 #ifdef KDEBUG
565  if (TEST_OPT_DEBUG)
566  {
567  PrintS(" to ");
568  wrp(h->p);
569  PrintLn();
570  }
571 #endif
572  if (h->IsNull())
573  {
575  kDeleteLcm(h);
576  h->Clear();
577  return 0;
578  }
579  h->SetShortExpVector();
580 
581 #if 0
582  if ((strat->syzComp!=0) && !strat->honey)
583  {
584  if ((strat->syzComp>0) &&
585  (h->Comp() > strat->syzComp))
586  {
587  assume(h->MinComp() > strat->syzComp);
588 #ifdef KDEBUG
589  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
590 #endif
591  if (strat->homog)
592  h->SetDegStuffReturnLDeg(strat->LDegLast);
593  return -2;
594  }
595  }
596 #endif
597  if (!strat->homog)
598  {
599  if (!TEST_OPT_OLDSTD && strat->honey)
600  {
601  h->SetpFDeg();
602  if (strat->T[j].ecart <= h->ecart)
603  h->ecart = d - h->GetpFDeg();
604  else
605  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
606 
607  d = h->GetpFDeg() + h->ecart;
608  }
609  else
610  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
611  /*- try to reduce the s-polynomial -*/
612  pass++;
613  /*
614  *test whether the polynomial should go to the lazyset L
615  *-if the degree jumps
616  *-if the number of pre-defined reductions jumps
617  */
618  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
619  && ((d >= reddeg) || (pass > strat->LazyPass)))
620  {
621  h->SetLmCurrRing();
622  if (strat->posInLDependsOnLength)
623  h->SetLength(strat->length_pLength);
624  at = strat->posInL(strat->L,strat->Ll,h,strat);
625  if (at <= strat->Ll)
626  {
627  int dummy=strat->sl;
628  if (kFindDivisibleByInS(strat,&dummy, h) < 0)
629  return 1;
630  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
631 #ifdef KDEBUG
632  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
633 #endif
634  h->Clear();
635  return -1;
636  }
637  }
638  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
639  {
640  reddeg = d+1;
641  Print(".%ld",d);mflush();
642  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
643  {
644  strat->overflow=TRUE;
645  //Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
646  h->GetP();
647  at = strat->posInL(strat->L,strat->Ll,h,strat);
648  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
649  h->Clear();
650  return -1;
651  }
652  }
653  }
654  }
655 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:80
int syzComp
Definition: kutil.h:352
#define TEST_OPT_PROT
Definition: options.h:101
int Ll
Definition: kutil.h:349
#define TRUE
Definition: auxiliary.h:100
static void kDeleteLcm(LObject *P)
Definition: kutil.h:869
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:188
char LDegLast
Definition: kutil.h:384
#define TEST_OPT_DEBUG
Definition: options.h:106
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:386
#define mflush()
Definition: reporter.h:57
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
#define TEST_OPT_OLDSTD
Definition: options.h:120
#define assume(x)
Definition: mod2.h:390
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:326
void PrintS(const char *s)
Definition: reporter.cc:284
STATIC_VAR Poly * h
Definition: janet.cc:971
char homog
Definition: kutil.h:371
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
char honey
Definition: kutil.h:376
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:388
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:216
void wrp(poly p)
Definition: polys.h:306
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:119
KINLINE poly kNoetherTail()
Definition: kInline.h:66
int LazyDegree
Definition: kutil.h:351

◆ redMoraNF()

static poly redMoraNF ( poly  h,
kStrategy  strat,
int  flag 
)
static

Definition at line 662 of file kstd1.cc.

663 {
664  LObject H;
665  H.p = h;
666  int j = 0;
667  int z = 10;
668  int o = H.SetpFDeg();
669  H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;
670  if ((flag & 2) == 0) cancelunit(&H,TRUE);
671  H.sev = pGetShortExpVector(H.p);
672  unsigned long not_sev = ~ H.sev;
673  loop
674  {
675  if (j > strat->tl)
676  {
677  return H.p;
678  }
679  if (TEST_V_DEG_STOP)
680  {
681  if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p);
682  if (H.p==NULL) return NULL;
683  }
684  if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing)
685  )
686  {
687  /*- remember the found T-poly -*/
688  // poly pi = strat->T[j].p;
689  int ei = strat->T[j].ecart;
690  int li = strat->T[j].length;
691  int ii = j;
692  /*
693  * the polynomial to reduce with (up to the moment) is;
694  * pi with ecart ei and length li
695  */
696  loop
697  {
698  /*- look for a better one with respect to ecart -*/
699  /*- stop, if the ecart is small enough (<=ecart(H)) -*/
700  j++;
701  if (j > strat->tl) break;
702  if (ei <= H.ecart) break;
703  if (((strat->T[j].ecart < ei)
704  || ((strat->T[j].ecart == ei)
705  && (strat->T[j].length < li)))
706  && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
707  )
708  {
709  /*
710  * the polynomial to reduce with is now;
711  */
712  // pi = strat->T[j].p;
713  ei = strat->T[j].ecart;
714  li = strat->T[j].length;
715  ii = j;
716  }
717  }
718  /*
719  * end of search: have to reduce with pi
720  */
721  z++;
722  if (z>10)
723  {
724  pNormalize(H.p);
725  z=0;
726  }
727  if ((ei > H.ecart) && (!strat->kHEdgeFound))
728  {
729  /*
730  * It is not possible to reduce h with smaller ecart;
731  * we have to reduce with bad ecart: H has to enter in T
732  */
733  doRed(&H,&(strat->T[ii]),TRUE,strat,TRUE);
734  if (H.p == NULL)
735  return NULL;
736  }
737  else
738  {
739  /*
740  * we reduce with good ecart, h need not to be put to T
741  */
742  doRed(&H,&(strat->T[ii]),FALSE,strat,TRUE);
743  if (H.p == NULL)
744  return NULL;
745  }
746  /*- try to reduce the s-polynomial -*/
747  o = H.SetpFDeg();
748  if ((flag &2 ) == 0) cancelunit(&H,TRUE);
749  H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o;
750  j = 0;
751  H.sev = pGetShortExpVector(H.p);
752  not_sev = ~ H.sev;
753  }
754  else
755  {
756  j++;
757  }
758  }
759 }
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:375
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:96
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:116
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:100
unsigned long * sevT
Definition: kutil.h:321
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
#define loop
Definition: structs.h:80
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define TEST_V_DEG_STOP
Definition: options.h:134
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#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:146
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1857
CanonicalForm H
Definition: facAbsFact.cc:64
STATIC_VAR Poly * h
Definition: janet.cc:971
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2065
TSet T
Definition: kutil.h:322
#define pNormalize(p)
Definition: polys.h:313

◆ redMoraNFRing()

static poly redMoraNFRing ( poly  h,
kStrategy  strat,
int  flag 
)
static

Definition at line 762 of file kstd1.cc.

763 {
764  LObject H;
765  H.p = h;
766  int j = 0;
767  int z = 10;
768  int o = H.SetpFDeg();
769  H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;
770  if ((flag & 2) == 0) cancelunit(&H,TRUE);
771  H.sev = pGetShortExpVector(H.p);
772  unsigned long not_sev = ~ H.sev;
773  loop
774  {
775  if (j > strat->tl)
776  {
777  return H.p;
778  }
779  if (TEST_V_DEG_STOP)
780  {
781  if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p);
782  if (H.p==NULL) return NULL;
783  }
784  if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing)
785  && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf))
786  )
787  {
788  /*- remember the found T-poly -*/
789  // poly pi = strat->T[j].p;
790  int ei = strat->T[j].ecart;
791  int li = strat->T[j].length;
792  int ii = j;
793  /*
794  * the polynomial to reduce with (up to the moment) is;
795  * pi with ecart ei and length li
796  */
797  loop
798  {
799  /*- look for a better one with respect to ecart -*/
800  /*- stop, if the ecart is small enough (<=ecart(H)) -*/
801  j++;
802  if (j > strat->tl) break;
803  if (ei <= H.ecart) break;
804  if (((strat->T[j].ecart < ei)
805  || ((strat->T[j].ecart == ei)
806  && (strat->T[j].length < li)))
807  && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
808  && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf))
809  )
810  {
811  /*
812  * the polynomial to reduce with is now;
813  */
814  // pi = strat->T[j].p;
815  ei = strat->T[j].ecart;
816  li = strat->T[j].length;
817  ii = j;
818  }
819  }
820  /*
821  * end of search: have to reduce with pi
822  */
823  z++;
824  if (z>10)
825  {
826  pNormalize(H.p);
827  z=0;
828  }
829  if ((ei > H.ecart) && (!strat->kHEdgeFound))
830  {
831  /*
832  * It is not possible to reduce h with smaller ecart;
833  * we have to reduce with bad ecart: H has to enter in T
834  */
835  doRed(&H,&(strat->T[ii]),TRUE,strat,TRUE);
836  if (H.p == NULL)
837  return NULL;
838  }
839  else
840  {
841  /*
842  * we reduce with good ecart, h need not to be put to T
843  */
844  doRed(&H,&(strat->T[ii]),FALSE,strat,TRUE);
845  if (H.p == NULL)
846  return NULL;
847  }
848  /*- try to reduce the s-polynomial -*/
849  o = H.SetpFDeg();
850  if ((flag &2 ) == 0) cancelunit(&H,TRUE);
851  H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o;
852  j = 0;
853  H.sev = pGetShortExpVector(H.p);
854  not_sev = ~ H.sev;
855  }
856  else
857  {
858  j++;
859  }
860  }
861 }
EXTERN_VAR int Kstd1_deg
Definition: kstd1.h:50
int j
Definition: facHensel.cc:105
char kHEdgeFound
Definition: kutil.h:375
class sLObject LObject
Definition: kutil.h:54
#define FALSE
Definition: auxiliary.h:96
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:116
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:100
unsigned long * sevT
Definition: kutil.h:321
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
#define loop
Definition: structs.h:80
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define TEST_V_DEG_STOP
Definition: options.h:134
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
#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:146
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1857
CanonicalForm H
Definition: facAbsFact.cc:64
STATIC_VAR Poly * h
Definition: janet.cc:971
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2065
TSet T
Definition: kutil.h:322
#define pNormalize(p)
Definition: polys.h:313

◆ redRiloc()

int redRiloc ( LObject h,
kStrategy  strat 
)

Definition at line 342 of file kstd1.cc.

343 {
344  int i,at,ei,li,ii;
345  int j = 0;
346  int pass = 0;
347  long d,reddeg;
348 
349  d = h->GetpFDeg()+ h->ecart;
350  reddeg = strat->LazyDegree+d;
351  h->SetShortExpVector();
352  loop
353  {
354  j = kFindDivisibleByInT(strat, h);
355  if (j < 0)
356  {
357  // over ZZ: cleanup coefficients by complete reduction with monomials
358  postReduceByMon(h, strat);
359  if(h->p == NULL)
360  {
361  kDeleteLcm(h);
362  h->Clear();
363  return 0;
364  }
365  if (strat->honey) h->SetLength(strat->length_pLength);
366  if(strat->tl >= 0)
367  h->i_r1 = strat->tl;
368  else
369  h->i_r1 = -1;
370  if (h->GetLmTailRing() == NULL)
371  {
372  kDeleteLcm(h);
373  h->Clear();
374  return 0;
375  }
376  return 1;
377  }
378 
379  ei = strat->T[j].ecart;
380  ii = j;
381  if (ei > h->ecart && ii < strat->tl)
382  {
383  li = strat->T[j].length;
384  // the polynomial to reduce with (up to the moment) is;
385  // pi with ecart ei and length li
386  // look for one with smaller ecart
387  i = j;
388  loop
389  {
390  /*- takes the first possible with respect to ecart -*/
391  i++;
392 #if 1
393  if (i > strat->tl) break;
394  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
395  strat->T[i].length < li))
396  &&
397  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
398  &&
399  n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
400 #else
401  j = kFindDivisibleByInT(strat, h, i);
402  if (j < 0) break;
403  i = j;
404  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
405  strat->T[i].length < li))
406 #endif
407  {
408  // the polynomial to reduce with is now
409  ii = i;
410  ei = strat->T[i].ecart;
411  if (ei <= h->ecart) break;
412  li = strat->T[i].length;
413  }
414  }
415  }
416 
417  // end of search: have to reduce with pi
418  if (ei > h->ecart)
419  {
420  // It is not possible to reduce h with smaller ecart;
421  // if possible h goes to the lazy-set L,i.e
422  // if its position in L would be not the last one
423  strat->fromT = TRUE;
424  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
425  {
426  h->SetLmCurrRing();
427  if (strat->honey && strat->posInLDependsOnLength)
428  h->SetLength(strat->length_pLength);
429  assume(h->FDeg == h->pFDeg());
430  at = strat->posInL(strat->L,strat->Ll,h,strat);
431  if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
432  {
433  /*- h will not become the next element to reduce -*/
434  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
435  #ifdef KDEBUG
436  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
437  #endif
438  h->Clear();
439  strat->fromT = FALSE;
440  return -1;
441  }
442  }
443  doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
444  }
445  else
446  {
447  // now we finally can reduce
448  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
449  }
450  strat->fromT=FALSE;
451  // are we done ???
452  if (h->IsNull())
453  {
454  kDeleteLcm(h);
455  h->Clear();
456  return 0;
457  }
458 
459  // NO!
460  h->SetShortExpVector();
461  h->SetpFDeg();
462  if (strat->honey)
463  {
464  if (ei <= h->ecart)
465  h->ecart = d-h->GetpFDeg();
466  else
467  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
468  }
469  else
470  // this has the side effect of setting h->length
471  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
472  /*- try to reduce the s-polynomial -*/
473  pass++;
474  d = h->GetpFDeg()+h->ecart;
475  /*
476  *test whether the polynomial should go to the lazyset L
477  *-if the degree jumps
478  *-if the number of pre-defined reductions jumps
479  */
480  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
481  && ((d >= reddeg) || (pass > strat->LazyPass)))
482  {
483  h->SetLmCurrRing();
484  if (strat->honey && strat->posInLDependsOnLength)
485  h->SetLength(strat->length_pLength);
486  assume(h->FDeg == h->pFDeg());
487  at = strat->posInL(strat->L,strat->Ll,h,strat);
488  if (at <= strat->Ll)
489  {
490  int dummy=strat->sl;
491  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
492  {
493  if (strat->honey && !strat->posInLDependsOnLength)
494  h->SetLength(strat->length_pLength);
495  return 1;
496  }
497  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
498 #ifdef KDEBUG
499  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
500 #endif
501  h->Clear();
502  return -1;
503  }
504  }
505  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
506  {
507  Print(".%ld",d);mflush();
508  reddeg = d+1;
509  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
510  {
511  strat->overflow=TRUE;
512  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
513  h->GetP();
514  at = strat->posInL(strat->L,strat->Ll,h,strat);
515  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
516  h->Clear();
517  return -1;
518  }
519  }
520  }
521 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
char fromT
Definition: kutil.h:378
int j
Definition: facHensel.cc:105
#define Print
Definition: emacs.cc:80
#define TEST_OPT_PROT
Definition: options.h:101
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:96
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:116
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:100
static void kDeleteLcm(LObject *P)
Definition: kutil.h:869
char LDegLast
Definition: kutil.h:384
unsigned long * sevT
Definition: kutil.h:321
#define TEST_OPT_DEBUG
Definition: options.h:106
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1260
#define nEqual(n1, n2)
Definition: numbers.h:20
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:386
#define mflush()
Definition: reporter.h:57
#define assume(x)
Definition: mod2.h:390
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:775
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1857
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:326
int i
Definition: cfEzgcd.cc:125
STATIC_VAR Poly * h
Definition: janet.cc:971
LSet L
Definition: kutil.h:323
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11161
#define NULL
Definition: omList.c:12
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
char honey
Definition: kutil.h:376
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
char posInLDependsOnLength
Definition: kutil.h:388
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:216
int LazyPass
Definition: kutil.h:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:119
int LazyDegree
Definition: kutil.h:351

◆ reorderL()

void reorderL ( kStrategy  strat)

Definition at line 867 of file kstd1.cc.

868 {
869  int i,j,at;
870  LObject p;
871 
872  for (i=1; i<=strat->Ll; i++)
873  {
874  at = strat->posInL(strat->L,i-1,&(strat->L[i]),strat);
875  if (at != i)
876  {
877  p = strat->L[i];
878  for (j=i-1; j>=at; j--) strat->L[j+1] = strat->L[j];
879  strat->L[at] = p;
880  }
881  }
882 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int j
Definition: facHensel.cc:105
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
int i
Definition: cfEzgcd.cc:125
LSet L
Definition: kutil.h:323
int p
Definition: cfModGcd.cc:4019

◆ reorderT()

void reorderT ( kStrategy  strat)

Definition at line 887 of file kstd1.cc.

888 {
889  int i,j,at;
890  TObject p;
891  unsigned long sev;
892 
893 
894  for (i=1; i<=strat->tl; i++)
895  {
896  if (strat->T[i-1].length > strat->T[i].length)
897  {
898  p = strat->T[i];
899  sev = strat->sevT[i];
900  at = i-1;
901  loop
902  {
903  at--;
904  if (at < 0) break;
905  if (strat->T[i].length > strat->T[at].length) break;
906  }
907  for (j = i-1; j>at; j--)
908  {
909  strat->T[j+1]=strat->T[j];
910  strat->sevT[j+1]=strat->sevT[j];
911  strat->R[strat->T[j+1].i_r] = &(strat->T[j+1]);
912  }
913  strat->T[at+1]=p;
914  strat->sevT[at+1] = sev;
915  strat->R[p.i_r] = &(strat->T[at+1]);
916  }
917  }
918 }
int j
Definition: facHensel.cc:105
int tl
Definition: kutil.h:348
unsigned long * sevT
Definition: kutil.h:321
#define loop
Definition: structs.h:80
int i
Definition: cfEzgcd.cc:125
TObject ** R
Definition: kutil.h:338
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019
class sTObject TObject
Definition: kutil.h:53

◆ updateL()

void updateL ( kStrategy  strat)

Definition at line 1039 of file kstd1.cc.

1040 {
1041  LObject p;
1042  int dL;
1043  int j=strat->Ll;
1044  loop
1045  {
1046  if (j<0) break;
1047  if (hasPurePower(&(strat->L[j]),strat->lastAxis,&dL,strat))
1048  {
1049  p=strat->L[strat->Ll];
1050  strat->L[strat->Ll]=strat->L[j];
1051  strat->L[j]=p;
1052  break;
1053  }
1054  j--;
1055  }
1056  if (j<0)
1057  {
1058  j=strat->Ll;
1059  loop
1060  {
1061  if (j<0) break;
1062  if (pNext(strat->L[j].p) == strat->tail)
1063  {
1064  if (rField_is_Ring(currRing))
1065  pLmDelete(strat->L[j].p); /*deletes the short spoly and computes*/
1066  else
1067  pLmFree(strat->L[j].p); /*deletes the short spoly and computes*/
1068  strat->L[j].p = NULL;
1069  poly m1 = NULL, m2 = NULL;
1070  // check that spoly creation is ok
1071  while (strat->tailRing != currRing &&
1072  !kCheckSpolyCreation(&(strat->L[j]), strat, m1, m2))
1073  {
1074  assume(m1 == NULL && m2 == NULL);
1075  // if not, change to a ring where exponents are at least
1076  // large enough
1077  kStratChangeTailRing(strat);
1078  }
1079  /* create the real one */
1080  ksCreateSpoly(&(strat->L[j]), strat->kNoetherTail(), FALSE,
1081  strat->tailRing, m1, m2, strat->R);
1082 
1083  strat->L[j].SetLmCurrRing();
1084  if (!strat->honey)
1085  strat->initEcart(&strat->L[j]);
1086  else
1087  strat->L[j].SetLength(strat->length_pLength);
1088 
1089  BOOLEAN pp = hasPurePower(&(strat->L[j]),strat->lastAxis,&dL,strat);
1090 
1091  if (strat->use_buckets) strat->L[j].PrepareRed(TRUE);
1092 
1093  if (pp)
1094  {
1095  p=strat->L[strat->Ll];
1096  strat->L[strat->Ll]=strat->L[j];
1097  strat->L[j]=p;
1098  break;
1099  }
1100  }
1101  j--;
1102  }
1103  }
1104 }
int j
Definition: facHensel.cc:105
class sLObject LObject
Definition: kutil.h:54
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:96
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:100
#define loop
Definition: structs.h:80
char length_pLength
Definition: kutil.h:386
char use_buckets
Definition: kutil.h:382
int lastAxis
Definition: kutil.h:354
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void(* initEcart)(TObject *L)
Definition: kutil.h:276
#define assume(x)
Definition: mod2.h:390
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1159
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11403
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10931
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:958
#define pNext(p)
Definition: monomials.h:36
char honey
Definition: kutil.h:376
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
int p
Definition: cfModGcd.cc:4019
int BOOLEAN
Definition: auxiliary.h:87
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ updateLHC()

void updateLHC ( kStrategy  strat)

Definition at line 1110 of file kstd1.cc.

1111 {
1112 
1113  int i = 0;
1114  kTest_TS(strat);
1115  while (i <= strat->Ll)
1116  {
1117  if (pNext(strat->L[i].p) == strat->tail)
1118  {
1119  /*- deletes the int spoly and computes -*/
1120  if (pLmCmp(strat->L[i].p,strat->kNoether) == -1)
1121  {
1122  if (rField_is_Ring(currRing))
1123  pLmDelete(strat->L[i].p);
1124  else
1125  pLmFree(strat->L[i].p);
1126  strat->L[i].p = NULL;
1127  }
1128  else
1129  {
1130  if (rField_is_Ring(currRing))
1131  pLmDelete(strat->L[i].p);
1132  else
1133  pLmFree(strat->L[i].p);
1134  strat->L[i].p = NULL;
1135  poly m1 = NULL, m2 = NULL;
1136  // check that spoly creation is ok
1137  while (strat->tailRing != currRing &&
1138  !kCheckSpolyCreation(&(strat->L[i]), strat, m1, m2))
1139  {
1140  assume(m1 == NULL && m2 == NULL);
1141  // if not, change to a ring where exponents are at least
1142  // large enough
1143  kStratChangeTailRing(strat);
1144  }
1145  /* create the real one */
1146  ksCreateSpoly(&(strat->L[i]), strat->kNoetherTail(), FALSE,
1147  strat->tailRing, m1, m2, strat->R);
1148  if (! strat->L[i].IsNull())
1149  {
1150  strat->L[i].SetLmCurrRing();
1151  strat->L[i].SetpFDeg();
1152  strat->L[i].ecart
1153  = strat->L[i].pLDeg(strat->LDegLast) - strat->L[i].GetpFDeg();
1154  if (strat->use_buckets) strat->L[i].PrepareRed(TRUE);
1155  }
1156  }
1157  }
1158  else
1159  deleteHC(&(strat->L[i]), strat);
1160  if (strat->L[i].IsNull())
1161  deleteInL(strat->L,&strat->Ll,i,strat);
1162  else
1163  {
1164 #ifdef KDEBUG
1165  kTest_L(&(strat->L[i]), strat->tailRing, TRUE, i, strat->T, strat->tl);
1166 #endif
1167  i++;
1168  }
1169  }
1170  kTest_TS(strat);
1171 }
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:96
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:100
char LDegLast
Definition: kutil.h:384
char use_buckets
Definition: kutil.h:382
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1203
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define kTest_TS(A)
Definition: kutil.h:655
#define assume(x)
Definition: mod2.h:390
#define kTest_L(T, R)
Definition: kutil.h:658
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:1159
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11403
int i
Definition: cfEzgcd.cc:125
poly tail
Definition: kutil.h:332
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
TObject ** R
Definition: kutil.h:338
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10931
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:479
#define NULL
Definition: omList.c:12
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:36
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
TSet T
Definition: kutil.h:322
KINLINE poly kNoetherTail()
Definition: kInline.h:66

◆ updateT()

void updateT ( kStrategy  strat)

Definition at line 1177 of file kstd1.cc.

1178 {
1179  int i = 0;
1180  LObject p;
1181 
1182  while (i <= strat->tl)
1183  {
1184  p = strat->T[i];
1185  deleteHC(&p,strat, TRUE);
1186  /*- tries to cancel a unit: -*/
1187  cancelunit(&p);
1188  if (TEST_OPT_INTSTRATEGY) /* deleteHC and/or cancelunit may have changed p*/
1189  p.pCleardenom();
1190  if (p.p != strat->T[i].p)
1191  {
1192  strat->sevT[i] = pGetShortExpVector(p.p);
1193  p.SetpFDeg();
1194  }
1195  strat->T[i] = p;
1196  i++;
1197  }
1198 }
class sLObject LObject
Definition: kutil.h:54
#define TRUE
Definition: auxiliary.h:100
unsigned long * sevT
Definition: kutil.h:321
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:333
#define TEST_OPT_INTSTRATEGY
Definition: options.h:108
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:125
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:244
TSet T
Definition: kutil.h:322
int p
Definition: cfModGcd.cc:4019

Variable Documentation

◆ kHomW

VAR intvec * kHomW

Definition at line 2063 of file kstd1.cc.

◆ kModW

VAR intvec* kModW

Definition at line 2063 of file kstd1.cc.

◆ kOptions

VAR BITSET kOptions
Initial value:
#define OPT_REDSB
Definition: options.h:74
#define OPT_PROT
Definition: options.h:73
#define OPT_INFREDTAIL
Definition: options.h:92
#define OPT_OLDSTD
Definition: options.h:84
#define Sy_bit(x)
Definition: options.h:31
#define OPT_NOT_SUGAR
Definition: options.h:76
#define OPT_SUGARCRIT
Definition: options.h:78
#define OPT_INTSTRATEGY
Definition: options.h:90
#define OPT_WEIGHTM
Definition: options.h:95
#define OPT_REDTHROUGH
Definition: options.h:80
#define OPT_NOTREGULARITY
Definition: options.h:94
#define OPT_INTERRUPT
Definition: options.h:77
#define OPT_FASTHC
Definition: options.h:83

Definition at line 42 of file kstd1.cc.

◆ validOpts

VAR BITSET validOpts

Definition at line 57 of file kstd1.cc.