Macros | Functions | Variables
kstd1.cc File Reference
#include <kernel/mod2.h>
#include <omalloc/omalloc.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, int uptodeg, int lV)
 
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

BITSET kOptions
 
BITSET validOpts
 
intveckModW
 
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 16 of file kstd1.cc.

Function Documentation

◆ doRed()

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

Definition at line 122 of file kstd1.cc.

123 {
124  int ret;
125 #if KDEBUG > 0
126  kTest_L(h);
127  kTest_T(with);
128 #endif
129  // Hmmm ... why do we do this -- polys from T should already be normalized
131  with->pNorm();
132 #ifdef KDEBUG
133  if (TEST_OPT_DEBUG)
134  {
135  PrintS("reduce ");h->wrp();PrintS(" with ");with->wrp();PrintLn();
136  }
137 #endif
138  if (intoT)
139  {
140  // need to do it exacly like this: otherwise
141  // we might get errors
142  LObject L= *h;
143  L.Copy();
144  h->GetP();
145  h->length=h->pLength=pLength(h->p);
146  ret = ksReducePoly(&L, with, strat->kNoetherTail(), NULL, strat);
147  if (ret)
148  {
149  if (ret < 0) return ret;
150  if (h->tailRing != strat->tailRing)
151  h->ShallowCopyDelete(strat->tailRing,
152  pGetShallowCopyDeleteProc(h->tailRing,
153  strat->tailRing));
154  }
156  enterT_strong(*h,strat);
157  else
158  enterT(*h,strat);
159  *h = L;
160  }
161  else
162  ret = ksReducePoly(h, with, strat->kNoetherTail(), NULL, strat);
163 #ifdef KDEBUG
164  if (TEST_OPT_DEBUG)
165  {
166  PrintS("to ");h->wrp();PrintLn();
167  }
168 #endif
169  return ret;
170 }
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:52
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
#define TEST_OPT_DEBUG
Definition: options.h:103
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_L(T)
Definition: kutil.h:644
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9554
int int kStrategy strat
Definition: myNF.cc:68
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:735
#define kTest_T(T)
Definition: kutil.h:642
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ enterSMora()

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

Definition at line 1362 of file kstd1.cc.

1363 {
1364  enterSBba(p, atS, strat, atR);
1365  #ifdef KDEBUG
1366  if (TEST_OPT_DEBUG)
1367  {
1368  Print("new s%d:",atS);
1369  p_wrp(p.p,currRing,strat->tailRing);
1370  PrintLn();
1371  }
1372  #endif
1373  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1374  if (strat->kHEdgeFound)
1375  {
1376  if (newHEdge(strat))
1377  {
1378  firstUpdate(strat);
1379  if (TEST_OPT_FINDET)
1380  return;
1381 
1382  /*- cuts elements in L above noether and reorders L -*/
1383  updateLHC(strat);
1384  /*- reorders L with respect to posInL -*/
1385  reorderL(strat);
1386  }
1387  }
1388  else if (strat->kNoether!=NULL)
1389  strat->kHEdgeFound = TRUE;
1390  else if (TEST_OPT_FASTHC)
1391  {
1392  if (strat->posInLOldFlag)
1393  {
1394  missingAxis(&strat->lastAxis,strat);
1395  if (strat->lastAxis)
1396  {
1397  strat->posInLOld = strat->posInL;
1398  strat->posInLOldFlag = FALSE;
1399  strat->posInL = posInL10;
1400  strat->posInLDependsOnLength = TRUE;
1401  updateL(strat);
1402  reorderL(strat);
1403  }
1404  }
1405  else if (strat->lastAxis)
1406  updateL(strat);
1407  }
1408 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
poly kNoether
Definition: kutil.h:316
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:103
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
void updateL(kStrategy strat)
Definition: kstd1.cc:1131
int lastAxis
Definition: kutil.h:344
#define TEST_OPT_FINDET
Definition: options.h:106
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:1015
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1202
void reorderL(kStrategy strat)
Definition: kstd1.cc:957
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:274
BOOLEAN kHEdgeFound
Definition: kutil.h:365
#define NULL
Definition: omList.c:10
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1295
ring tailRing
Definition: kutil.h:331
BOOLEAN posInLOldFlag
Definition: kutil.h:371
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10736
#define TEST_OPT_FASTHC
Definition: options.h:104
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ enterSMoraNF()

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

Definition at line 1416 of file kstd1.cc.

1417 {
1418  enterSBba(p, atS, strat, atR);
1419  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1420  if (strat->kHEdgeFound)
1421  newHEdge(strat);
1422  else if (strat->kNoether!=NULL)
1423  strat->kHEdgeFound = TRUE;
1424 }
return P p
Definition: myNF.cc:203
poly kNoether
Definition: kutil.h:316
#define TRUE
Definition: auxiliary.h:98
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
BOOLEAN kHEdgeFound
Definition: kutil.h:365
#define NULL
Definition: omList.c:10
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10736
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ firstUpdate()

void firstUpdate ( kStrategy  strat)

Definition at line 1295 of file kstd1.cc.

1296 {
1297  if (strat->update)
1298  {
1299  kTest_TS(strat);
1300  strat->update = (strat->tl == -1);
1301  if (TEST_OPT_WEIGHTM)
1302  {
1303  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1304  if (strat->tailRing != currRing)
1305  {
1306  strat->tailRing->pFDeg = strat->pOrigFDeg_TailRing;
1307  strat->tailRing->pLDeg = strat->pOrigLDeg_TailRing;
1308  }
1309  int i;
1310  for (i=strat->Ll; i>=0; i--)
1311  {
1312  strat->L[i].SetpFDeg();
1313  }
1314  for (i=strat->tl; i>=0; i--)
1315  {
1316  strat->T[i].SetpFDeg();
1317  }
1318  if (ecartWeights)
1319  {
1320  omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
1321  ecartWeights=NULL;
1322  }
1323  }
1324  if (TEST_OPT_FASTHC)
1325  {
1326  strat->posInL = strat->posInLOld;
1327  strat->lastAxis = 0;
1328  }
1329  if (TEST_OPT_FINDET)
1330  return;
1331 
1333  {
1334  strat->red = redFirst;
1335  strat->use_buckets = kMoraUseBucket(strat);
1336  }
1337  updateT(strat);
1338 
1340  {
1341  strat->posInT = posInT2;
1342  reorderT(strat);
1343  }
1344  }
1345  kTest_TS(strat);
1346 }
void updateT(kStrategy strat)
Definition: kstd1.cc:1269
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5363
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:285
int Ll
Definition: kutil.h:339
short * ecartWeights
Definition: weight0.c:28
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int tl
Definition: kutil.h:338
void * ADDRESS
Definition: auxiliary.h:115
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int lastAxis
Definition: kutil.h:344
#define TEST_OPT_FINDET
Definition: options.h:106
pFDegProc pOrigFDeg
Definition: kutil.h:282
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pLDegProc pOrigLDeg
Definition: kutil.h:283
#define kTest_TS(A)
Definition: kutil.h:641
BOOLEAN update
Definition: kutil.h:370
int i
Definition: cfEzgcd.cc:123
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:274
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3555
#define TEST_OPT_WEIGHTM
Definition: options.h:115
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:751
ring tailRing
Definition: kutil.h:331
void reorderT(kStrategy strat)
Definition: kstd1.cc:977
TSet T
Definition: kutil.h:312
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition: kstd1.cc:3618
BOOLEAN use_buckets
Definition: kutil.h:372
#define TEST_OPT_FASTHC
Definition: options.h:104
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:284

◆ hasPurePower() [1/2]

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

Definition at line 1048 of file kstd1.cc.

1049 {
1050  poly h;
1051  int i;
1052 
1053  if (pNext(p) == strat->tail)
1054  return FALSE;
1055  pp_Test(p, currRing, strat->tailRing);
1056  if (strat->ak <= 0 || p_MinComp(p, currRing, strat->tailRing) == strat->ak)
1057  {
1058  i = p_IsPurePower(p, currRing);
1059  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(p), currRing->cf))) i=0;
1060  if (i == last)
1061  {
1062  *length = 0;
1063  return TRUE;
1064  }
1065  *length = 1;
1066  h = pNext(p);
1067  while (h != NULL)
1068  {
1069  i = p_IsPurePower(h, strat->tailRing);
1070  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(h), currRing->cf))) i=0;
1071  if (i==last) return TRUE;
1072  (*length)++;
1073  pIter(h);
1074  }
1075  }
1076  return FALSE;
1077 }
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:519
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static poly last
Definition: hdegree.cc:1077
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:341
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:162
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition: p_polys.h:308
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1227
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ hasPurePower() [2/2]

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

Definition at line 1079 of file kstd1.cc.

1080 {
1081  if (L->bucket != NULL)
1082  {
1083  poly p = L->CanonicalizeP();
1084  BOOLEAN ret = hasPurePower(p, last, length, strat);
1085  pNext(p) = NULL;
1086  return ret;
1087  }
1088  else
1089  {
1090  return hasPurePower(L->p, last, length, strat);
1091  }
1092 }
return P p
Definition: myNF.cc:203
static poly last
Definition: hdegree.cc:1077
#define NULL
Definition: omList.c:10
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:1048
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85

◆ initBba()

void initBba ( kStrategy  strat)

Definition at line 1426 of file kstd1.cc.

1427 {
1428  /* setting global variables ------------------- */
1429  strat->enterS = enterSBba;
1430  strat->red = redHoney;
1431  if (strat->honey)
1432  strat->red = redHoney;
1433  else if (currRing->pLexOrder && !strat->homog)
1434  strat->red = redLazy;
1435  else
1436  {
1437  strat->LazyPass *=4;
1438  strat->red = redHomog;
1439  }
1440  if (rField_is_Ring(currRing))
1441  {
1442  strat->red = redRing;
1443  }
1444  if (currRing->pLexOrder && strat->honey)
1445  strat->initEcart = initEcartNormal;
1446  else
1447  strat->initEcart = initEcartBBA;
1448  if (strat->honey)
1450  else
1452 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1453 // {
1454 // //interred machen Aenderung
1455 // strat->pOrigFDeg=pFDeg;
1456 // strat->pOrigLDeg=pLDeg;
1457 // //h=ggetid("ecart");
1458 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1459 // //{
1460 // // ecartWeights=iv2array(IDINTVEC(h));
1461 // //}
1462 // //else
1463 // {
1464 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1465 // /*uses automatic computation of the ecartWeights to set them*/
1466 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1467 // }
1468 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1469 // if (TEST_OPT_PROT)
1470 // {
1471 // for(i=1; i<=(currRing->N); i++)
1472 // Print(" %d",ecartWeights[i]);
1473 // PrintLn();
1474 // mflush();
1475 // }
1476 // }
1477 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:366
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1296
BOOLEAN homog
Definition: kutil.h:361
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:341
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ initMora()

void initMora ( ideal  F,
kStrategy  strat 
)

Definition at line 1549 of file kstd1.cc.

1550 {
1551  int i,j;
1552 
1553  strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1554  for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1555  strat->enterS = enterSMora;
1556  strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1557  strat->posInLOld = strat->posInL;
1558  strat->posInLOldFlag = TRUE;
1559  strat->initEcart = initEcartNormal;
1560  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1561  if ( strat->kHEdgeFound )
1562  strat->kNoether = pCopy((currRing->ppNoether));
1563  else if (strat->kHEdgeFound || strat->homog)
1564  strat->red = redFirst; /*take the first possible in T*/
1565  else
1566  strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1567  if (strat->kHEdgeFound)
1568  {
1569  strat->HCord = currRing->pFDeg((currRing->ppNoether),currRing)+1;
1570  strat->posInT = posInT2;
1571  }
1572  else
1573  {
1574  strat->HCord = 32000;/*- very large -*/
1575  }
1576 
1577  if (rField_is_Ring(currRing))
1578  strat->red = redRiloc;
1579 
1580  /*reads the ecartWeights used for Graebes method from the
1581  *intvec ecart and set ecartWeights
1582  */
1583  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1584  {
1585  //interred machen Aenderung
1586  strat->pOrigFDeg=currRing->pFDeg;
1587  strat->pOrigLDeg=currRing->pLDeg;
1588  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1589  /*uses automatic computation of the ecartWeights to set them*/
1591 
1593  if (TEST_OPT_PROT)
1594  {
1595  for(i=1; i<=(currRing->N); i++)
1596  Print(" %d",ecartWeights[i]);
1597  PrintLn();
1598  mflush();
1599  }
1600  }
1601  kOptimizeLDeg(currRing->pLDeg, strat);
1602 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5363
#define Print
Definition: emacs.cc:83
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
#define TEST_OPT_PROT
Definition: options.h:98
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:190
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
short * ecartWeights
Definition: weight0.c:28
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
BOOLEAN * NotUsedAxis
Definition: kutil.h:320
poly kNoether
Definition: kutil.h:316
#define TRUE
Definition: auxiliary.h:98
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int HCord
Definition: kutil.h:343
#define mflush()
Definition: reporter.h:57
pFDegProc pOrigFDeg
Definition: kutil.h:282
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:348
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pLDegProc pOrigLDeg
Definition: kutil.h:283
BOOLEAN homog
Definition: kutil.h:361
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
int j
Definition: myNF.cc:70
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1362
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
int i
Definition: cfEzgcd.cc:123
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition: kstd1.cc:103
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:274
#define IDELEMS(i)
Definition: simpleideals.h:24
BOOLEAN kHEdgeFound
Definition: kutil.h:365
#define TEST_OPT_WEIGHTM
Definition: options.h:115
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN posInLOldFlag
Definition: kutil.h:371
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int BOOLEAN
Definition: auxiliary.h:85
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSba()

void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1479 of file kstd1.cc.

1480 {
1481  int i;
1482  //idhdl h;
1483  /* setting global variables ------------------- */
1484  strat->enterS = enterSSba;
1485  strat->red2 = redHoney;
1486  if (strat->honey)
1487  strat->red2 = redHoney;
1488  else if (currRing->pLexOrder && !strat->homog)
1489  strat->red2 = redLazy;
1490  else
1491  {
1492  strat->LazyPass *=4;
1493  strat->red2 = redHomog;
1494  }
1495  if (rField_is_Ring(currRing))
1496  {
1498  {strat->red2 = redRiloc;}
1499  else
1500  {strat->red2 = redRing;}
1501  }
1502  if (currRing->pLexOrder && strat->honey)
1503  strat->initEcart = initEcartNormal;
1504  else
1505  strat->initEcart = initEcartBBA;
1506  if (strat->honey)
1508  else
1510  //strat->kIdeal = NULL;
1511  //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1512  //else strat->kIdeal->rtyp=MODUL_CMD;
1513  //strat->kIdeal->data=(void *)strat->Shdl;
1514  if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1515  {
1516  //interred machen Aenderung
1517  strat->pOrigFDeg = currRing->pFDeg;
1518  strat->pOrigLDeg = currRing->pLDeg;
1519  //h=ggetid("ecart");
1520  //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1521  //{
1522  // ecartWeights=iv2array(IDINTVEC(h));
1523  //}
1524  //else
1525  {
1526  ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1527  /*uses automatic computation of the ecartWeights to set them*/
1529  }
1531  if (TEST_OPT_PROT)
1532  {
1533  for(i=1; i<=(currRing->N); i++)
1534  Print(" %d",ecartWeights[i]);
1535  PrintLn();
1536  mflush();
1537  }
1538  }
1539  // for sig-safe reductions in signature-based
1540  // standard basis computations
1542  strat->red = redSigRing;
1543  else
1544  strat->red = redSig;
1545  //strat->sbaOrder = 1;
1546  strat->currIdx = 1;
1547 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
BOOLEAN honey
Definition: kutil.h:366
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9331
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition: weight.cc:190
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
short * ecartWeights
Definition: weight0.c:28
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int redSig(LObject *h, kStrategy strat)
Definition: kstd2.cc:703
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
#define omAlloc(size)
Definition: omAllocDecl.h:210
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int currIdx
Definition: kutil.h:303
#define mflush()
Definition: reporter.h:57
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
pFDegProc pOrigFDeg
Definition: kutil.h:282
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:348
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int redLazy(LObject *h, kStrategy strat)
Definition: kstd2.cc:1296
pLDegProc pOrigLDeg
Definition: kutil.h:283
BOOLEAN homog
Definition: kutil.h:361
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
int i
Definition: cfEzgcd.cc:123
int redSigRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:871
#define IDELEMS(i)
Definition: simpleideals.h:24
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3555
#define TEST_OPT_WEIGHTM
Definition: options.h:115
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:341
int(* red2)(LObject *L, kStrategy strat)
Definition: kutil.h:265

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

3165 {
3166  const ring save = currRing;
3167  if( currRing != _currRing ) rChangeCurrRing(_currRing);
3168  poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3169  if( currRing != save ) rChangeCurrRing(save);
3170  return ret;
3171 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
return P p
Definition: myNF.cc:203
#define Q
Definition: sirandom.c:25
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
void rChangeCurrRing(ring r)
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Definition at line 11800 of file kutil.cc.

11801 {
11802  PrintS("red: ");
11803  if (strat->red==redFirst) PrintS("redFirst\n");
11804  else if (strat->red==redHoney) PrintS("redHoney\n");
11805  else if (strat->red==redEcart) PrintS("redEcart\n");
11806  else if (strat->red==redHomog) PrintS("redHomog\n");
11807  else Print("%p\n",(void*)strat->red);
11808  PrintS("posInT: ");
11809  if (strat->posInT==posInT0) PrintS("posInT0\n");
11810  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11811  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11812  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11813  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11814  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11815  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11816  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11817  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11818  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11819  #ifdef HAVE_RINGS
11820  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11821  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11822  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11823  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11824  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11825  #endif
11826 #ifdef HAVE_MORE_POS_IN_T
11827  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11828  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11829  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11830 #endif
11831  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11832  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11833  else Print("%p\n",(void*)strat->posInT);
11834  PrintS("posInL: ");
11835  if (strat->posInL==posInL0) PrintS("posInL0\n");
11836  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11837  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11838  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11839  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11840  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11841  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11842  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11843  #ifdef HAVE_RINGS
11844  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11845  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11846  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11847  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11848  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11849  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11850  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11851  #endif
11852  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11853  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11854  else Print("%p\n",(void*)strat->posInL);
11855  PrintS("enterS: ");
11856  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11857  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11858  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11859  else Print("%p\n",(void*)strat->enterS);
11860  PrintS("initEcart: ");
11861  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11862  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11863  else Print("%p\n",(void*)strat->initEcart);
11864  PrintS("initEcartPair: ");
11865  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11866  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11867  else Print("%p\n",(void*)strat->initEcartPair);
11868  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11869  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11870  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11871  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11872  PrintS("chainCrit: ");
11873  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11874  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11875  else Print("%p\n",(void*)strat->chainCrit);
11876  Print("posInLDependsOnLength=%d\n",
11877  strat->posInLDependsOnLength);
11878  PrintS(showOption());PrintLn();
11879  PrintS("LDeg: ");
11880  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11881  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11882  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11883  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11884  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11885  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11886  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11887  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11888  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11889  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11890  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11891  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11892  else Print("? (%lx)", (long)currRing->pLDeg);
11893  PrintS(" / ");
11894  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11895  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11896  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11897  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11898  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11899  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11900  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11901  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11902  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11903  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11904  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11905  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11906  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11907  PrintLn();
11908  PrintS("currRing->pFDeg: ");
11909  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11910  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11911  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11912  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11913  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11914  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11915  else Print("? (%lx)", (long)currRing->pFDeg);
11916  PrintLn();
11917  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11918  if(TEST_OPT_DEGBOUND)
11919  Print(" degBound: %d\n", Kstd1_deg);
11920 
11921  if( ecartWeights != NULL )
11922  {
11923  PrintS("ecartWeights: ");
11924  for (int i = rVar(currRing); i > 0; i--)
11925  Print("%hd ", ecartWeights[i]);
11926  PrintLn();
11928  }
11929 
11930 #ifndef SING_NDEBUG
11932 #endif
11933 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6390
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11766
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5470
BOOLEAN honey
Definition: kutil.h:366
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6887
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1362
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5363
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:842
#define TEST_OPT_DEGBOUND
Definition: options.h:108
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6432
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6502
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1006
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6846
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:878
BOOLEAN noTailReduction
Definition: kutil.h:367
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5335
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3247
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6604
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6931
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6811
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6776
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6729
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5757
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:771
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:273
int ak
Definition: kutil.h:341
char * showOption()
Definition: misc_ip.cc:717
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:911
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7045
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5703
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6688
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5324
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:942
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5393
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5905
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:588
BOOLEAN homog
Definition: kutil.h:361
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5429
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
BOOLEAN Gebauer
Definition: kutil.h:367
#define assume(x)
Definition: mod2.h:394
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:597
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5859
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:740
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6132
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6981
void rDebugPrint(const ring r)
Definition: ring.cc:4012
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5798
BOOLEAN sugarCrit
Definition: kutil.h:366
int Kstd1_deg
Definition: kutil.cc:236
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1416
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11675
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:277
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:812
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:976
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
ring tailRing
Definition: kutil.h:331
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5546
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5588
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3460
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1039
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6089
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1069
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:614
BOOLEAN use_buckets
Definition: kutil.h:372
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6032
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:341
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11729
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5664
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
int LazyDegree
Definition: kutil.h:341
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5966
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5635
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229

◆ kHomModDeg()

long kHomModDeg ( poly  p,
ring  r 
)

Definition at line 2218 of file kstd1.cc.

2219 {
2220  int i;
2221  long j=0;
2222 
2223  for (i=r->N;i>0;i--)
2224  j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2225  if (kModW == NULL) return j;
2226  i = p_GetComp(p,r);
2227  if (i==0) return j;
2228  return j+(*kModW)[i-1];
2229 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
const ring r
Definition: syzextra.cc:208
intvec * kModW
Definition: kstd1.cc:2206
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:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ kInterRed()

ideal kInterRed ( ideal  F,
ideal  Q 
)

Definition at line 3542 of file kstd1.cc.

3543 {
3544 #ifdef HAVE_PLURAL
3545  if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3546 #endif
3549  )
3550  return kInterRedOld(F,Q);
3551 
3552  //return kInterRedOld(F,Q);
3553 
3554  BITSET save1;
3555  SI_SAVE_OPT1(save1);
3556  //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3558  //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3559  //si_opt_1&= ~Sy_bit(OPT_REDSB);
3560  //extern char * showOption() ;
3561  //Print("%s\n",showOption());
3562 
3563  int need_retry;
3564  int counter=3;
3565  ideal res, res1;
3566  int elems;
3567  ideal null=NULL;
3568  if ((Q==NULL) || (!TEST_OPT_REDSB))
3569  {
3570  elems=idElem(F);
3571  res=kInterRedBba(F,Q,need_retry);
3572  }
3573  else
3574  {
3575  ideal FF=idSimpleAdd(F,Q);
3576  res=kInterRedBba(FF,NULL,need_retry);
3577  idDelete(&FF);
3578  null=idInit(1,1);
3579  if (need_retry)
3580  res1=kNF(null,Q,res,0,KSTD_NF_LAZY);
3581  else
3582  res1=kNF(null,Q,res);
3583  idDelete(&res);
3584  res=res1;
3585  need_retry=1;
3586  }
3587  if (idElem(res)<=1) need_retry=0;
3588  while (need_retry && (counter>0))
3589  {
3590  #ifdef KDEBUG
3591  if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3592  #endif
3593  res1=kInterRedBba(res,Q,need_retry);
3594  int new_elems=idElem(res1);
3595  counter -= (new_elems >= elems);
3596  elems = new_elems;
3597  idDelete(&res);
3598  if (idElem(res1)<=1) need_retry=0;
3599  if ((Q!=NULL) && (TEST_OPT_REDSB))
3600  {
3601  if (need_retry)
3602  res=kNF(null,Q,res1,0,KSTD_NF_LAZY);
3603  else
3604  res=kNF(null,Q,res1);
3605  idDelete(&res1);
3606  }
3607  else
3608  res = res1;
3609  if (idElem(res)<=1) need_retry=0;
3610  }
3611  if (null!=NULL) idDelete(&null);
3612  SI_RESTORE_OPT1(save1);
3613  idSkipZeroes(res);
3614  return res;
3615 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
unsigned si_opt_1
Definition: options.c:5
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define Print
Definition: emacs.cc:83
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define idSimpleAdd(A, B)
Definition: ideals.h:42
#define TEST_OPT_REDSB
Definition: options.h:99
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
ideal kInterRedBba(ideal F, ideal Q, int &need_retry)
Definition: kstd1.cc:3268
#define KSTD_NF_LAZY
Definition: kstd1.h:17
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ideal kInterRedOld(ideal F, ideal Q)
Definition: kstd1.cc:3177
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:38
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define OPT_REDTHROUGH
Definition: options.h:77
int idElem(const ideal F)
count non-zero elements
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
static BOOLEAN rField_is_numeric(const ring r)
Definition: ring.h:507

◆ kInterRedBba()

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

Definition at line 3268 of file kstd1.cc.

3269 {
3270  need_retry=0;
3271  int red_result = 1;
3272  int olddeg,reduc;
3273  BOOLEAN withT = FALSE;
3274  // BOOLEAN toReset=FALSE;
3276  tHomog h;
3277  intvec * w=NULL;
3278 
3280  strat->LazyPass=20;
3281  else
3282  strat->LazyPass=2;
3283  strat->LazyDegree = 1;
3284  strat->ak = id_RankFreeModule(F,currRing);
3285  strat->syzComp = strat->ak;
3286  strat->kModW=kModW=NULL;
3287  strat->kHomW=kHomW=NULL;
3288  if (strat->ak == 0)
3289  {
3290  h = (tHomog)idHomIdeal(F,Q);
3291  w=NULL;
3292  }
3293  else if (!TEST_OPT_DEGBOUND)
3294  {
3295  h = (tHomog)idHomModule(F,Q,&w);
3296  }
3297  if (h==isHomog)
3298  {
3299  if (strat->ak > 0 && (w!=NULL) && (w!=NULL))
3300  {
3301  strat->kModW = kModW = w;
3302  strat->pOrigFDeg = currRing->pFDeg;
3303  strat->pOrigLDeg = currRing->pLDeg;
3305  // toReset = TRUE;
3306  }
3307  strat->LazyPass*=2;
3308  }
3309  strat->homog=h;
3310 #ifdef KDEBUG
3311  idTest(F);
3312 #endif
3313 
3314  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
3316  initBuchMoraPosRing(strat);
3317  else
3318  initBuchMoraPos(strat);
3319  initBba(strat);
3320  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3321  strat->posInL=posInL0; /* ord according pComp */
3322 
3323  /*Shdl=*/initBuchMora(F, Q, strat);
3324  reduc = olddeg = 0;
3325 
3326 #ifndef NO_BUCKETS
3327  if (!TEST_OPT_NOT_BUCKETS)
3328  strat->use_buckets = 1;
3329 #endif
3330 
3331  // redtailBBa against T for inhomogenous input
3332  if (!TEST_OPT_OLDSTD)
3333  withT = ! strat->homog;
3334 
3335  // strat->posInT = posInT_pLength;
3336  kTest_TS(strat);
3337 
3338 #ifdef HAVE_TAIL_RING
3339  kStratInitChangeTailRing(strat);
3340 #endif
3341 
3342  /* compute------------------------------------------------------- */
3343  while (strat->Ll >= 0)
3344  {
3345  #ifdef KDEBUG
3346  if (TEST_OPT_DEBUG) messageSets(strat);
3347  #endif
3348  if (strat->Ll== 0) strat->interpt=TRUE;
3349  /* picks the last element from the lazyset L */
3350  strat->P = strat->L[strat->Ll];
3351  strat->Ll--;
3352 
3353  if (strat->P.p1 == NULL)
3354  {
3355  // for input polys, prepare reduction
3356  strat->P.PrepareRed(strat->use_buckets);
3357  }
3358 
3359  if (strat->P.p == NULL && strat->P.t_p == NULL)
3360  {
3361  red_result = 0;
3362  }
3363  else
3364  {
3365  if (TEST_OPT_PROT)
3366  message(strat->P.pFDeg(),
3367  &olddeg,&reduc,strat, red_result);
3368 
3369  /* reduction of the element chosen from L */
3370  red_result = strat->red(&strat->P,strat);
3371  }
3372 
3373  // reduction to non-zero new poly
3374  if (red_result == 1)
3375  {
3376  /* statistic */
3377  if (TEST_OPT_PROT) PrintS("s");
3378 
3379  // get the polynomial (canonicalize bucket, make sure P.p is set)
3380  strat->P.GetP(strat->lmBin);
3381 
3382  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3383 
3384  // reduce the tail and normalize poly
3385  // in the ring case we cannot expect LC(f) = 1,
3386  // therefore we call pContent instead of pNorm
3388  {
3389  strat->P.pCleardenom();
3390  if (0)
3391  //if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
3392  {
3393  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3394  strat->P.pCleardenom();
3395  }
3396  }
3397  else
3398  {
3399  strat->P.pNorm();
3400  if (0)
3401  //if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
3402  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3403  }
3404 
3405 #ifdef KDEBUG
3406  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3407 #endif
3408 
3409  // enter into S, L, and T
3410  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3411  {
3412  enterT(strat->P, strat);
3413  // posInS only depends on the leading term
3414  strat->enterS(strat->P, pos, strat, strat->tl);
3415 
3416  if (pos<strat->sl)
3417  {
3418  need_retry++;
3419  // move all "larger" elements fromS to L
3420  // remove them from T
3421  int ii=pos+1;
3422  for(;ii<=strat->sl;ii++)
3423  {
3424  LObject h;
3425  memset(&h,0,sizeof(h));
3426  h.tailRing=strat->tailRing;
3427  h.p=strat->S[ii]; strat->S[ii]=NULL;
3428  strat->initEcart(&h);
3429  h.sev=strat->sevS[ii];
3430  int jj=strat->tl;
3431  while (jj>=0)
3432  {
3433  if (strat->T[jj].p==h.p)
3434  {
3435  strat->T[jj].p=NULL;
3436  if (jj<strat->tl)
3437  {
3438  memmove(&(strat->T[jj]),&(strat->T[jj+1]),
3439  (strat->tl-jj)*sizeof(strat->T[jj]));
3440  memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),
3441  (strat->tl-jj)*sizeof(strat->sevT[jj]));
3442  }
3443  strat->tl--;
3444  break;
3445  }
3446  jj--;
3447  }
3448  int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);
3449  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);
3450  #ifdef KDEBUG
3451  if (TEST_OPT_DEBUG)
3452  {
3453  Print("move S[%d] -> L[%d]: ",ii,pos);
3454  p_wrp(h.p,currRing, strat->tailRing);
3455  PrintLn();
3456  }
3457  #endif
3458  }
3459  if (strat->fromQ!=NULL)
3460  {
3461  for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;
3462  }
3463  strat->sl=pos;
3464  }
3465  }
3466  else
3467  {
3468  // clean P
3469  }
3470  if (strat->P.lcm!=NULL)
3471 #ifdef HAVE_RINGS
3472  pLmDelete(strat->P.lcm);
3473 #else
3474  pLmFree(strat->P.lcm);
3475 #endif
3476  }
3477 
3478 #ifdef KDEBUG
3479  if (TEST_OPT_DEBUG)
3480  {
3481  messageSets(strat);
3482  }
3483  memset(&(strat->P), 0, sizeof(strat->P));
3484 #endif
3485  //kTest_TS(strat);: i_r out of sync in kInterRedBba, but not used!
3486  }
3487 #ifdef KDEBUG
3488  //if (TEST_OPT_DEBUG) messageSets(strat);
3489 #endif
3490  /* complete reduction of the standard basis--------- */
3491 
3492  if((need_retry<=0) && (TEST_OPT_REDSB))
3493  {
3494  completeReduce(strat);
3495  if (strat->completeReduce_retry)
3496  {
3497  // completeReduce needed larger exponents, retry
3498  // hopefully: kStratChangeTailRing already provided a larger tailRing
3499  // (otherwise: it will fail again)
3500  strat->completeReduce_retry=FALSE;
3501  completeReduce(strat);
3502  if (strat->completeReduce_retry)
3503  {
3504 #ifdef HAVE_TAIL_RING
3505  if(currRing->bitmask>strat->tailRing->bitmask)
3506  {
3507  // retry without T
3508  strat->completeReduce_retry=FALSE;
3509  cleanT(strat);strat->tailRing=currRing;
3510  int i;
3511  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3512  completeReduce(strat);
3513  }
3514  if (strat->completeReduce_retry)
3515 #endif
3516  Werror("exponent bound is %ld",currRing->bitmask);
3517  }
3518  }
3519  }
3520  else if (TEST_OPT_PROT) PrintLn();
3521 
3522 
3523  /* release temp data-------------------------------- */
3524  exitBuchMora(strat);
3525 // if (TEST_OPT_WEIGHTM)
3526 // {
3527 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
3528 // if (ecartWeights)
3529 // {
3530 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3531 // ecartWeights=NULL;
3532 // }
3533 // }
3534  //if (TEST_OPT_PROT) messageStat(0/*hilbcount*/,strat);
3535  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3536  ideal res=strat->Shdl;
3537  strat->Shdl=NULL;
3538  delete strat;
3539  if (w!=NULL) delete w;
3540  return res;
3541 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9919
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:7915
class sLObject LObject
Definition: kutil.h:52
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10092
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:341
void initBba(kStrategy strat)
Definition: kstd1.cc:1426
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define Q
Definition: sirandom.c:25
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10005
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1091
#define pGetComp(p)
Component.
Definition: polys.h:37
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11353
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
pFDegProc pOrigFDeg
Definition: kutil.h:282
poly res
Definition: myNF.cc:322
BOOLEAN interpt
Definition: kutil.h:360
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
intvec * kHomW
Definition: kstd1.cc:2206
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pLDegProc pOrigLDeg
Definition: kutil.h:283
intvec * kModW
Definition: kstd1.cc:2206
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:14
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:641
tHomog
Definition: structs.h:37
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define messageSets(s)
Definition: kutil.h:528
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6132
LObject P
Definition: kutil.h:288
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
intvec * kHomW
Definition: kutil.h:324
void cleanT(kStrategy strat)
Definition: kutil.cc:552
const CanonicalForm & w
Definition: facAbsFact.cc:55
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
intvec * kModW
Definition: kutil.h:323
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10613
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10401
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
BOOLEAN use_buckets
Definition: kutil.h:372
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
int LazyPass
Definition: kutil.h:341
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10168
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int LazyDegree
Definition: kutil.h:341
#define idTest(id)
Definition: ideals.h:47

◆ kInterRedOld()

ideal kInterRedOld ( ideal  F,
ideal  Q 
)

Definition at line 3177 of file kstd1.cc.

3178 {
3179  int j;
3180  kStrategy strat = new skStrategy;
3181 
3182  ideal tempF = F;
3183  ideal tempQ = Q;
3184 
3185 #ifdef HAVE_PLURAL
3186  if(rIsSCA(currRing))
3187  {
3188  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3189  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3190  tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
3191 
3192  // this should be done on the upper level!!! :
3193  // tempQ = SCAQuotient(currRing);
3194 
3195  if(Q == currRing->qideal)
3196  tempQ = SCAQuotient(currRing);
3197  }
3198 #endif
3199 
3200 // if (TEST_OPT_PROT)
3201 // {
3202 // writeTime("start InterRed:");
3203 // mflush();
3204 // }
3205  //strat->syzComp = 0;
3206  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
3207  strat->kNoether=pCopy((currRing->ppNoether));
3208  strat->ak = id_RankFreeModule(tempF,currRing);
3209  initBuchMoraCrit(strat);
3210  strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3211  for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3212  strat->enterS = enterSBba;
3213  strat->posInT = posInT17;
3214  strat->initEcart = initEcartNormal;
3215  strat->sl = -1;
3216  strat->tl = -1;
3217  strat->tmax = setmaxT;
3218  strat->T = initT();
3219  strat->R = initR();
3220  strat->sevT = initsevT();
3222  initS(tempF, tempQ, strat);
3223  if (TEST_OPT_REDSB)
3224  strat->noTailReduction=FALSE;
3225  updateS(TRUE,strat);
3227  completeReduce(strat);
3228  //else if (TEST_OPT_PROT) PrintLn();
3229  pDelete(&strat->kHEdge);
3230  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3231  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3232  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3233  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3234  omfree(strat->sevT);
3235  omfree(strat->S_2_R);
3236  omfree(strat->R);
3237 
3238  if (strat->fromQ)
3239  {
3240  for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3241  {
3242  if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3243  }
3244  omFreeSize((ADDRESS)strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
3245  }
3246 // if (TEST_OPT_PROT)
3247 // {
3248 // writeTime("end Interred:");
3249 // mflush();
3250 // }
3251  ideal shdl=strat->Shdl;
3252  idSkipZeroes(shdl);
3253  if (strat->fromQ)
3254  {
3255  strat->fromQ=NULL;
3256  ideal res=kInterRed(shdl,NULL);
3257  idDelete(&shdl);
3258  shdl=res;
3259  }
3260  delete(strat);
3261 #ifdef HAVE_PLURAL
3262  if( tempF != F )
3263  id_Delete( &tempF, currRing);
3264 #endif
3265  return shdl;
3266 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
ideal SCAQuotient(const ring r)
Definition: sca.h:10
KINLINE TObject ** initR()
Definition: kInline.h:92
BOOLEAN honey
Definition: kutil.h:366
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:315
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:367
int * S_2_R
Definition: kutil.h:330
BOOLEAN * NotUsedAxis
Definition: kutil.h:320
#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:316
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
unsigned long * sevT
Definition: kutil.h:311
void * ADDRESS
Definition: auxiliary.h:115
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:267
poly res
Definition: myNF.cc:322
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
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:31
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:307
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:272
#define omfree(addr)
Definition: omAllocDecl.h:237
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3542
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5798
TObject ** R
Definition: kutil.h:328
#define IDELEMS(i)
Definition: simpleideals.h:24
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:338
int int kStrategy strat
Definition: myNF.cc:68
BOOLEAN kHEdgeFound
Definition: kutil.h:365
intset ecartS
Definition: kutil.h:295
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1533
#define pDelete(p_ptr)
Definition: polys.h:169
static short scaLastAltVar(ring r)
Definition: sca.h:25
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9000
unsigned long * sevS
Definition: kutil.h:308
static bool rIsSCA(const ring r)
Definition: nc.h:206
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10613
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
ideal Shdl
Definition: kutil.h:289
int BOOLEAN
Definition: auxiliary.h:85
class sTObject TObject
Definition: kutil.h:51
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9229
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kMin_std()

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

Definition at line 2822 of file kstd1.cc.

2824 {
2825  if(idIs0(F))
2826  {
2827  M=idInit(1,F->rank);
2828  return idInit(1,F->rank);
2829  }
2831  {
2832  ideal sb;
2833  sb = kStd(F, Q, h, w, hilb);
2834  idSkipZeroes(sb);
2835  if(IDELEMS(sb) <= IDELEMS(F))
2836  {
2837  M = idCopy(sb);
2838  idSkipZeroes(M);
2839  return(sb);
2840  }
2841  else
2842  {
2843  M = idCopy(F);
2844  idSkipZeroes(M);
2845  return(sb);
2846  }
2847  }
2848  ideal r=NULL;
2849  int Kstd1_OldDeg = Kstd1_deg,i;
2850  intvec* temp_w=NULL;
2851  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2852  BOOLEAN delete_w=(w==NULL);
2853  BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
2855 
2856  if(!TEST_OPT_RETURN_SB)
2857  strat->syzComp = syzComp;
2859  strat->LazyPass=20;
2860  else
2861  strat->LazyPass=2;
2862  strat->LazyDegree = 1;
2863  strat->minim=(reduced % 2)+1;
2864  strat->ak = id_RankFreeModule(F,currRing);
2865  if (delete_w)
2866  {
2867  temp_w=new intvec((strat->ak)+1);
2868  w = &temp_w;
2869  }
2870  if (h==testHomog)
2871  {
2872  if (strat->ak == 0)
2873  {
2874  h = (tHomog)idHomIdeal(F,Q);
2875  w=NULL;
2876  }
2877  else
2878  {
2879  h = (tHomog)idHomModule(F,Q,w);
2880  }
2881  }
2882  if (h==isHomog)
2883  {
2884  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2885  {
2886  kModW = *w;
2887  strat->kModW = *w;
2888  assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
2889  strat->pOrigFDeg = currRing->pFDeg;
2890  strat->pOrigLDeg = currRing->pLDeg;
2892 
2893  toReset = TRUE;
2894  if (reduced>1)
2895  {
2896  Kstd1_OldDeg=Kstd1_deg;
2897  Kstd1_deg = -1;
2898  for (i=IDELEMS(F)-1;i>=0;i--)
2899  {
2900  if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
2901  Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
2902  }
2903  }
2904  }
2905  currRing->pLexOrder = TRUE;
2906  strat->LazyPass*=2;
2907  }
2908  strat->homog=h;
2910  {
2911  if (w!=NULL)
2912  r=mora(F,Q,*w,hilb,strat);
2913  else
2914  r=mora(F,Q,NULL,hilb,strat);
2915  }
2916  else
2917  {
2918  if (w!=NULL)
2919  r=bba(F,Q,*w,hilb,strat);
2920  else
2921  r=bba(F,Q,NULL,hilb,strat);
2922  }
2923 #ifdef KDEBUG
2924  {
2925  int i;
2926  for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
2927  }
2928 #endif
2929  idSkipZeroes(r);
2930  if (toReset)
2931  {
2932  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2933  kModW = NULL;
2934  }
2935  currRing->pLexOrder = b;
2936  HCord=strat->HCord;
2937  if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
2938  if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
2939  {
2940  M=idInit(1,F->rank);
2941  M->m[0]=pOne();
2942  //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
2943  if (strat->M!=NULL) idDelete(&strat->M);
2944  }
2945  else if (strat->M==NULL)
2946  {
2947  M=idInit(1,F->rank);
2948  Warn("no minimal generating set computed");
2949  }
2950  else
2951  {
2952  idSkipZeroes(strat->M);
2953  M=strat->M;
2954  }
2955  delete(strat);
2956  if (reduced>2)
2957  {
2958  Kstd1_deg=Kstd1_OldDeg;
2959  if (!oldDegBound)
2961  }
2962  else
2963  {
2964  if (IDELEMS(M)>IDELEMS(r)) {
2965  idDelete(&M);
2966  M=idCopy(r); }
2967  }
2968  return r;
2969 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
unsigned si_opt_1
Definition: options.c:5
int HCord
Definition: kutil.cc:235
int syzComp
Definition: kutil.h:342
#define TEST_OPT_DEGBOUND
Definition: options.h:108
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:94
#define pTest(p)
Definition: polys.h:398
#define TRUE
Definition: auxiliary.h:98
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:2231
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:1972
#define Sy_bit(x)
Definition: options.h:30
int minim
Definition: kutil.h:346
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
int HCord
Definition: kutil.h:343
pFDegProc pOrigFDeg
Definition: kutil.h:282
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
#define M
Definition: sirandom.c:24
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
pLDegProc pOrigLDeg
Definition: kutil.h:283
intvec * kModW
Definition: kstd1.cc:2206
BOOLEAN homog
Definition: kutil.h:361
Definition: intvec.h:14
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
#define assume(x)
Definition: mod2.h:394
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
ideal M
Definition: kutil.h:291
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define IDELEMS(i)
Definition: simpleideals.h:24
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:3555
int int kStrategy strat
Definition: myNF.cc:68
#define TEST_OPT_RETURN_SB
Definition: options.h:107
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:323
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
#define OPT_DEGBOUND
Definition: options.h:85
int LazyPass
Definition: kutil.h:341
int Kstd1_deg
Definition: kutil.cc:236
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
const poly b
Definition: syzextra.cc:213
int LazyDegree
Definition: kutil.h:341
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1606
#define Warn
Definition: emacs.cc:80

◆ kModDeg()

long kModDeg ( poly  p,
ring  r 
)

Definition at line 2208 of file kstd1.cc.

2209 {
2210  long o=p_WDegree(p, r);
2211  long i=p_GetComp(p, r);
2212  if (i==0) return o;
2213  //assume((i>0) && (i<=kModW->length()));
2214  if (i<=kModW->length())
2215  return o+(*kModW)[i-1];
2216  return o;
2217 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
long p_WDegree(poly p, const ring r)
Definition: p_polys.cc:715
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123

◆ kMoraUseBucket()

static BOOLEAN kMoraUseBucket ( kStrategy  strat)
static

Definition at line 3618 of file kstd1.cc.

3619 {
3620 #ifdef MORA_USE_BUCKETS
3622  return FALSE;
3623  if (strat->red == redFirst)
3624  {
3625 #ifdef NO_LDEG
3626  if (strat->syzComp==0)
3627  return TRUE;
3628 #else
3629  if ((strat->homog || strat->honey) && (strat->syzComp==0))
3630  return TRUE;
3631 #endif
3632  }
3633  else
3634  {
3635  #ifdef HAVE_RINGS
3636  assume(strat->red == redEcart || strat->red == redRiloc);
3637  #else
3638  assume(strat->red == redEcart);
3639  #endif
3640  if (strat->honey && (strat->syzComp==0))
3641  return TRUE;
3642  }
3643 #endif
3644  return FALSE;
3645 }
BOOLEAN honey
Definition: kutil.h:366
int syzComp
Definition: kutil.h:342
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
#define FALSE
Definition: auxiliary.h:94
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
#define TRUE
Definition: auxiliary.h:98
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
int redRiloc(LObject *h, kStrategy strat)
Definition: kstd1.cc:348
BOOLEAN homog
Definition: kutil.h:361
#define assume(x)
Definition: mod2.h:394

◆ kNF() [1/2]

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

Definition at line 2971 of file kstd1.cc.

2972 {
2973  if (p==NULL)
2974  return NULL;
2975 
2976  poly pp = p;
2977 
2978 #ifdef HAVE_PLURAL
2979  if(rIsSCA(currRing))
2980  {
2981  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
2982  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
2983  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
2984 
2985  if(Q == currRing->qideal)
2986  Q = SCAQuotient(currRing);
2987  }
2988 #endif
2989 
2990  if ((idIs0(F))&&(Q==NULL))
2991  {
2992 #ifdef HAVE_PLURAL
2993  if(p != pp)
2994  return pp;
2995 #endif
2996  return pCopy(p); /*F+Q=0*/
2997  }
2998 
3000  strat->syzComp = syzComp;
3001  strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p));
3002  poly res;
3003 
3005  res=kNF1(F,Q,pp,strat,lazyReduce);
3006  else
3007  res=kNF2(F,Q,pp,strat,lazyReduce);
3008  delete(strat);
3009 
3010 #ifdef HAVE_PLURAL
3011  if(pp != p)
3012  p_Delete(&pp, currRing);
3013 #endif
3014  return res;
3015 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
ideal SCAQuotient(const ring r)
Definition: sca.h:10
int syzComp
Definition: kutil.h:342
#define pMaxComp(p)
Definition: polys.h:281
return P p
Definition: myNF.cc:203
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1478
poly pp
Definition: myNF.cc:296
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3399
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd1.cc:1909
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
static short scaFirstAltVar(ring r)
Definition: sca.h:18
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNF() [2/2]

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

Definition at line 3059 of file kstd1.cc.

3060 {
3061  ideal res;
3062  if (TEST_OPT_PROT)
3063  {
3064  Print("(S:%d)",IDELEMS(p));mflush();
3065  }
3066  if (idIs0(p))
3067  return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3068 
3069  ideal pp = p;
3070 #ifdef HAVE_PLURAL
3071  if(rIsSCA(currRing))
3072  {
3073  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3074  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3075  pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
3076 
3077  if(Q == currRing->qideal)
3078  Q = SCAQuotient(currRing);
3079  }
3080 #endif
3081 
3082  if ((idIs0(F))&&(Q==NULL))
3083  {
3084 #ifdef HAVE_PLURAL
3085  if(p != pp)
3086  return pp;
3087 #endif
3088  return idCopy(p); /*F+Q=0*/
3089  }
3090 
3092  strat->syzComp = syzComp;
3094  if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3095  {
3096  strat->ak = si_max(strat->ak,(int)F->rank);
3097  }
3098 
3100  res=kNF1(F,Q,pp,strat,lazyReduce);
3101  else
3102  res=kNF2(F,Q,pp,strat,lazyReduce);
3103  delete(strat);
3104 
3105 #ifdef HAVE_PLURAL
3106  if(pp != p)
3107  id_Delete(&pp, currRing);
3108 #endif
3109 
3110  return res;
3111 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
ideal SCAQuotient(const ring r)
Definition: sca.h:10
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
poly pp
Definition: myNF.cc:296
#define mflush()
Definition: reporter.h:57
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd2.cc:3399
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition: kstd1.cc:1909
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
#define IDELEMS(i)
Definition: simpleideals.h:24
static short scaFirstAltVar(ring r)
Definition: sca.h:18
ideal idCopy(ideal A)
Definition: ideals.h:60
int int kStrategy strat
Definition: myNF.cc:68
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1533
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292

◆ kNF1() [1/2]

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

Definition at line 1909 of file kstd1.cc.

1910 {
1911  assume(q!=NULL);
1912  assume(!(idIs0(F)&&(Q==NULL)));
1913 
1914 // lazy_reduce flags: can be combined by |
1915 //#define KSTD_NF_LAZY 1
1916  // do only a reduction of the leading term
1917 //#define KSTD_NF_ECART 2
1918  // only local: recude even with bad ecart
1919  poly p;
1920  int i;
1921  int j;
1922  int o;
1923  LObject h;
1924  BITSET save1;
1925  SI_SAVE_OPT1(save1);
1926 
1927  //if ((idIs0(F))&&(Q==NULL))
1928  // return pCopy(q); /*F=0*/
1929  //strat->ak = si_max(idRankFreeModule(F),pMaxComp(q));
1930  /*- creating temp data structures------------------- -*/
1931  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
1932  strat->kNoether = pCopy((currRing->ppNoether));
1936  && (! TEST_V_DEG_STOP)
1937  && (0<Kstd1_deg)
1938  && ((!strat->kHEdgeFound)
1940  {
1941  pDelete(&strat->kNoether);
1942  strat->kNoether=pOne();
1943  pSetExp(strat->kNoether,1, Kstd1_deg+1);
1944  pSetm(strat->kNoether);
1945  strat->kHEdgeFound=TRUE;
1946  }
1947  initBuchMoraCrit(strat);
1949  initBuchMoraPosRing(strat);
1950  else
1951  initBuchMoraPos(strat);
1952  initMora(F,strat);
1953  strat->enterS = enterSMoraNF;
1954  /*- set T -*/
1955  strat->tl = -1;
1956  strat->tmax = setmaxT;
1957  strat->T = initT();
1958  strat->R = initR();
1959  strat->sevT = initsevT();
1960  /*- set S -*/
1961  strat->sl = -1;
1962  /*- init local data struct.-------------------------- -*/
1963  /*Shdl=*/initS(F,Q,strat);
1964  if ((strat->ak!=0)
1965  && (strat->kHEdgeFound))
1966  {
1967  if (strat->ak!=1)
1968  {
1969  pSetComp(strat->kNoether,1);
1970  pSetmComp(strat->kNoether);
1971  poly p=pHead(strat->kNoether);
1972  pSetComp(p,strat->ak);
1973  pSetmComp(p);
1974  p=pAdd(strat->kNoether,p);
1975  strat->kNoether=pNext(p);
1976  p_LmFree(p,currRing);
1977  }
1978  }
1979  if ((lazyReduce & KSTD_NF_LAZY)==0)
1980  {
1981  for (i=strat->sl; i>=0; i--)
1982  pNorm(strat->S[i]);
1983  }
1984  /*- puts the elements of S also to T -*/
1985  for (i=0; i<=strat->sl; i++)
1986  {
1987  h.p = strat->S[i];
1988  h.ecart = strat->ecartS[i];
1989  if (strat->sevS[i] == 0) strat->sevS[i] = pGetShortExpVector(h.p);
1990  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
1991  h.length = pLength(h.p);
1992  h.sev = strat->sevS[i];
1993  h.SetpFDeg();
1994  enterT(h,strat);
1995  }
1996 #ifdef KDEBUG
1997 // kDebugPrint(strat);
1998 #endif
1999  /*- compute------------------------------------------- -*/
2000  p = pCopy(q);
2001  deleteHC(&p,&o,&j,strat);
2002  kTest(strat);
2003  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2004  if (BVERBOSE(23)) kDebugPrint(strat);
2006  {
2007  if (p!=NULL) p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
2008  }
2009  else
2010  {
2011  if (p!=NULL) p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
2012  }
2013  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2014  {
2015  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2016  p = redtail(p,strat->sl,strat);
2017  }
2018  /*- release temp data------------------------------- -*/
2019  cleanT(strat);
2020  assume(strat->L==NULL); /*strat->L unsed */
2021  assume(strat->B==NULL); /*strat->B unused */
2022  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2023  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2024  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2025  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2026  omFree(strat->sevT);
2027  omFree(strat->S_2_R);
2028  omFree(strat->R);
2029 
2030  if ((Q!=NULL)&&(strat->fromQ!=NULL))
2031  {
2032  i=((IDELEMS(Q)+IDELEMS(F)+15)/16)*16;
2033  omFreeSize((ADDRESS)strat->fromQ,i*sizeof(int));
2034  strat->fromQ=NULL;
2035  }
2036  pDelete(&strat->kHEdge);
2037  pDelete(&strat->kNoether);
2038 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2039 // {
2040 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2041 // if (ecartWeights)
2042 // {
2043 // omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2044 // ecartWeights=NULL;
2045 // }
2046 // }
2047  idDelete(&strat->Shdl);
2048  SI_RESTORE_OPT1(save1);
2049  if (TEST_OPT_PROT) PrintLn();
2050  return p;
2051 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
KINLINE TObject ** initR()
Definition: kInline.h:92
unsigned si_opt_1
Definition: options.c:5
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
#define pSetm(p)
Definition: polys.h:253
void PrintLn()
Definition: reporter.cc:310
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:835
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
#define TEST_OPT_DEGBOUND
Definition: options.h:108
#define pAdd(p, q)
Definition: polys.h:186
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9919
poly kHEdge
Definition: kutil.h:315
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1549
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
class sLObject LObject
Definition: kutil.h:52
KINLINE TSet initT()
Definition: kInline.h:81
#define TEST_OPT_PROT
Definition: options.h:98
#define pSetExp(p, i, v)
Definition: polys.h:42
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:320
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:316
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
#define kTest(A)
Definition: kutil.h:640
unsigned long * sevT
Definition: kutil.h:311
void * ADDRESS
Definition: auxiliary.h:115
#define SI_SAVE_OPT1(A)
Definition: options.h:20
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10005
#define Sy_bit(x)
Definition: options.h:30
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define setmaxT
Definition: kutil.h:31
#define OPT_REDTAIL
Definition: options.h:86
#define TEST_V_DEG_STOP
Definition: options.h:130
int j
Definition: myNF.cc:70
#define TEST_OPT_STAIRCASEBOUND
Definition: options.h:110
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
#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:272
#define KSTD_NF_ECART
Definition: kstd1.h:19
#define pSetComp(p, v)
Definition: polys.h:38
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define pOne()
Definition: polys.h:297
TObject ** R
Definition: kutil.h:328
static unsigned pLength(poly a)
Definition: p_polys.h:189
#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:292
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
BOOLEAN kHEdgeFound
Definition: kutil.h:365
intset ecartS
Definition: kutil.h:295
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:314
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pWTotaldegree(p)
Definition: polys.h:265
#define pDelete(p_ptr)
Definition: polys.h:169
unsigned long * sevS
Definition: kutil.h:308
#define pNext(p)
Definition: monomials.h:43
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:735
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1416
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:236
ideal Shdl
Definition: kutil.h:289
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11800
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
class sTObject TObject
Definition: kutil.h:51
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNF1() [2/2]

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

Definition at line 2053 of file kstd1.cc.

2054 {
2055  assume(!idIs0(q));
2056  assume(!(idIs0(F)&&(Q==NULL)));
2057 
2058 // lazy_reduce flags: can be combined by |
2059 //#define KSTD_NF_LAZY 1
2060  // do only a reduction of the leading term
2061 //#define KSTD_NF_ECART 2
2062  // only local: recude even with bad ecart
2063  poly p;
2064  int i;
2065  int j;
2066  int o;
2067  LObject h;
2068  ideal res;
2069  BITSET save1;
2070  SI_SAVE_OPT1(save1);
2071 
2072  //if (idIs0(q)) return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2073  //if ((idIs0(F))&&(Q==NULL))
2074  // return idCopy(q); /*F=0*/
2075  //strat->ak = si_max(idRankFreeModule(F),idRankFreeModule(q));
2076  /*- creating temp data structures------------------- -*/
2077  strat->kHEdgeFound = (currRing->ppNoether) != NULL;
2078  strat->kNoether=pCopy((currRing->ppNoether));
2081  && (0<Kstd1_deg)
2082  && ((!strat->kHEdgeFound)
2084  {
2085  pDelete(&strat->kNoether);
2086  strat->kNoether=pOne();
2087  pSetExp(strat->kNoether,1, Kstd1_deg+1);
2088  pSetm(strat->kNoether);
2089  strat->kHEdgeFound=TRUE;
2090  }
2091  initBuchMoraCrit(strat);
2093  initBuchMoraPosRing(strat);
2094  else
2095  initBuchMoraPos(strat);
2096  initMora(F,strat);
2097  strat->enterS = enterSMoraNF;
2098  /*- set T -*/
2099  strat->tl = -1;
2100  strat->tmax = setmaxT;
2101  strat->T = initT();
2102  strat->R = initR();
2103  strat->sevT = initsevT();
2104  /*- set S -*/
2105  strat->sl = -1;
2106  /*- init local data struct.-------------------------- -*/
2107  /*Shdl=*/initS(F,Q,strat);
2108  if ((strat->ak!=0)
2109  && (strat->kHEdgeFound))
2110  {
2111  if (strat->ak!=1)
2112  {
2113  pSetComp(strat->kNoether,1);
2114  pSetmComp(strat->kNoether);
2115  poly p=pHead(strat->kNoether);
2116  pSetComp(p,strat->ak);
2117  pSetmComp(p);
2118  p=pAdd(strat->kNoether,p);
2119  strat->kNoether=pNext(p);
2120  p_LmFree(p,currRing);
2121  }
2122  }
2124  {
2125  for (i=strat->sl; i>=0; i--)
2126  pNorm(strat->S[i]);
2127  }
2128  /*- compute------------------------------------------- -*/
2129  res=idInit(IDELEMS(q),strat->ak);
2130  for (i=0; i<IDELEMS(q); i++)
2131  {
2132  if (q->m[i]!=NULL)
2133  {
2134  p = pCopy(q->m[i]);
2135  deleteHC(&p,&o,&j,strat);
2136  if (p!=NULL)
2137  {
2138  /*- puts the elements of S also to T -*/
2139  for (j=0; j<=strat->sl; j++)
2140  {
2141  h.p = strat->S[j];
2142  h.ecart = strat->ecartS[j];
2143  h.pLength = h.length = pLength(h.p);
2144  if (strat->sevS[j] == 0) strat->sevS[j] = pGetShortExpVector(h.p);
2145  else assume(strat->sevS[j] == pGetShortExpVector(h.p));
2146  h.sev = strat->sevS[j];
2147  h.SetpFDeg();
2149  enterT_strong(h,strat);
2150  else
2151  enterT(h,strat);
2152  }
2153  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2155  {
2156  p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
2157  }
2158  else
2159  p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
2160  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2161  {
2162  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2163  p = redtail(p,strat->sl,strat);
2164  }
2165  cleanT(strat);
2166  }
2167  res->m[i]=p;
2168  }
2169  //else
2170  // res->m[i]=NULL;
2171  }
2172  /*- release temp data------------------------------- -*/
2173  assume(strat->L==NULL); /*strat->L unsed */
2174  assume(strat->B==NULL); /*strat->B unused */
2175  omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2176  omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2177  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2178  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2179  omFree(strat->sevT);
2180  omFree(strat->S_2_R);
2181  omFree(strat->R);
2182  if ((Q!=NULL)&&(strat->fromQ!=NULL))
2183  {
2184  i=((IDELEMS(Q)+IDELEMS(F)+15)/16)*16;
2185  omFreeSize((ADDRESS)strat->fromQ,i*sizeof(int));
2186  strat->fromQ=NULL;
2187  }
2188  pDelete(&strat->kHEdge);
2189  pDelete(&strat->kNoether);
2190 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2191 // {
2192 // pFDeg=strat->pOrigFDeg;
2193 // pLDeg=strat->pOrigLDeg;
2194 // if (ecartWeights)
2195 // {
2196 // omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2197 // ecartWeights=NULL;
2198 // }
2199 // }
2200  idDelete(&strat->Shdl);
2201  SI_RESTORE_OPT1(save1);
2202  if (TEST_OPT_PROT) PrintLn();
2203  return res;
2204 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
#define pSetmComp(p)
TODO:
Definition: polys.h:255
KINLINE TObject ** initR()
Definition: kInline.h:92
unsigned si_opt_1
Definition: options.c:5
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
#define pSetm(p)
Definition: polys.h:253
void PrintLn()
Definition: reporter.cc:310
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:835
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
#define TEST_OPT_DEGBOUND
Definition: options.h:108
#define pAdd(p, q)
Definition: polys.h:186
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9919
poly kHEdge
Definition: kutil.h:315
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1549
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
class sLObject LObject
Definition: kutil.h:52
KINLINE TSet initT()
Definition: kInline.h:81
#define TEST_OPT_PROT
Definition: options.h:98
#define pSetExp(p, i, v)
Definition: polys.h:42
int * S_2_R
Definition: kutil.h:330
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:320
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:316
int tl
Definition: kutil.h:338
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
void * ADDRESS
Definition: auxiliary.h:115
#define SI_SAVE_OPT1(A)
Definition: options.h:20
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10005
#define Sy_bit(x)
Definition: options.h:30
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
#define mflush()
Definition: reporter.h:57
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8033
#define KSTD_NF_LAZY
Definition: kstd1.h:17
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:31
#define OPT_REDTAIL
Definition: options.h:86
int j
Definition: myNF.cc:70
#define TEST_OPT_STAIRCASEBOUND
Definition: options.h:110
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:307
#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:272
#define KSTD_NF_ECART
Definition: kstd1.h:19
#define pSetComp(p, v)
Definition: polys.h:38
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define pOne()
Definition: polys.h:297
TObject ** R
Definition: kutil.h:328
static unsigned pLength(poly a)
Definition: p_polys.h:189
#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:292
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:338
void enterT_strong(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9554
BOOLEAN kHEdgeFound
Definition: kutil.h:365
intset ecartS
Definition: kutil.h:295
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:314
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pWTotaldegree(p)
Definition: polys.h:265
#define pDelete(p_ptr)
Definition: polys.h:169
unsigned long * sevS
Definition: kutil.h:308
#define pNext(p)
Definition: monomials.h:43
static poly redMoraNF(poly h, kStrategy strat, int flag)
Definition: kstd1.cc:735
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1416
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:236
ideal Shdl
Definition: kutil.h:289
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
class sTObject TObject
Definition: kutil.h:51
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNFBound() [1/2]

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

Definition at line 3017 of file kstd1.cc.

3018 {
3019  if (p==NULL)
3020  return NULL;
3021 
3022  poly pp = p;
3023 
3024 #ifdef HAVE_PLURAL
3025  if(rIsSCA(currRing))
3026  {
3027  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3028  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3029  pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
3030 
3031  if(Q == currRing->qideal)
3032  Q = SCAQuotient(currRing);
3033  }
3034 #endif
3035 
3036  if ((idIs0(F))&&(Q==NULL))
3037  {
3038 #ifdef HAVE_PLURAL
3039  if(p != pp)
3040  return pp;
3041 #endif
3042  return pCopy(p); /*F+Q=0*/
3043  }
3044 
3046  strat->syzComp = syzComp;
3047  strat->ak = si_max(id_RankFreeModule(F,currRing),pMaxComp(p));
3048  poly res;
3049  res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3050  delete(strat);
3051 
3052 #ifdef HAVE_PLURAL
3053  if(pp != p)
3054  p_Delete(&pp, currRing);
3055 #endif
3056  return res;
3057 }
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:3468
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:342
#define pMaxComp(p)
Definition: polys.h:281
return P p
Definition: myNF.cc:203
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1478
poly pp
Definition: myNF.cc:296
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
static short scaFirstAltVar(ring r)
Definition: sca.h:18
int int kStrategy strat
Definition: myNF.cc:68
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ kNFBound() [2/2]

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

Definition at line 3113 of file kstd1.cc.

3114 {
3115  ideal res;
3116  if (TEST_OPT_PROT)
3117  {
3118  Print("(S:%d)",IDELEMS(p));mflush();
3119  }
3120  if (idIs0(p))
3121  return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3122 
3123  ideal pp = p;
3124 #ifdef HAVE_PLURAL
3125  if(rIsSCA(currRing))
3126  {
3127  const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3128  const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3129  pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
3130 
3131  if(Q == currRing->qideal)
3132  Q = SCAQuotient(currRing);
3133  }
3134 #endif
3135 
3136  if ((idIs0(F))&&(Q==NULL))
3137  {
3138 #ifdef HAVE_PLURAL
3139  if(p != pp)
3140  return pp;
3141 #endif
3142  return idCopy(p); /*F+Q=0*/
3143  }
3144 
3146  strat->syzComp = syzComp;
3148  if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3149  {
3150  strat->ak = si_max(strat->ak,(int)F->rank);
3151  }
3152 
3153  res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3154  delete(strat);
3155 
3156 #ifdef HAVE_PLURAL
3157  if(pp != p)
3158  id_Delete(&pp, currRing);
3159 #endif
3160 
3161  return res;
3162 }
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:3468
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
#define TEST_OPT_PROT
Definition: options.h:98
return P p
Definition: myNF.cc:203
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
poly pp
Definition: myNF.cc:296
#define mflush()
Definition: reporter.h:57
poly res
Definition: myNF.cc:322
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
#define IDELEMS(i)
Definition: simpleideals.h:24
static short scaFirstAltVar(ring r)
Definition: sca.h:18
ideal idCopy(ideal A)
Definition: ideals.h:60
int int kStrategy strat
Definition: myNF.cc:68
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1533
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int int lazyReduce
Definition: myNF.cc:292

◆ kOptimizeLDeg()

static void kOptimizeLDeg ( pLDegProc  ldeg,
kStrategy  strat 
)
static

Definition at line 103 of file kstd1.cc.

104 {
105 // if (strat->ak == 0 && !rIsSyzIndexRing(currRing))
106  strat->length_pLength = TRUE;
107 // else
108 // strat->length_pLength = FALSE;
109 
110  if ((ldeg == pLDeg0c /*&& !rIsSyzIndexRing(currRing)*/) ||
111  (ldeg == pLDeg0 && strat->ak == 0))
112  {
113  strat->LDegLast = TRUE;
114  }
115  else
116  {
117  strat->LDegLast = FALSE;
118  }
119 }
BOOLEAN length_pLength
Definition: kutil.h:376
#define FALSE
Definition: auxiliary.h:94
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:771
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:341
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:740
BOOLEAN LDegLast
Definition: kutil.h:374

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

2418 {
2419  if(idIs0(F))
2420  return idInit(1,F->rank);
2421  if(!rField_is_Ring(currRing))
2422  {
2423  ideal r;
2424  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2425  BOOLEAN delete_w=(w==NULL);
2427  strat->sbaOrder = sbaOrder;
2428  if (arri!=0)
2429  {
2430  strat->rewCrit1 = arriRewDummy;
2431  strat->rewCrit2 = arriRewCriterion;
2432  strat->rewCrit3 = arriRewCriterionPre;
2433  }
2434  else
2435  {
2436  strat->rewCrit1 = faugereRewCriterion;
2437  strat->rewCrit2 = faugereRewCriterion;
2438  strat->rewCrit3 = faugereRewCriterion;
2439  }
2440 
2441  if(!TEST_OPT_RETURN_SB)
2442  strat->syzComp = syzComp;
2443  if (TEST_OPT_SB_1)
2444  //if(!rField_is_Ring(currRing)) // always true here
2445  strat->newIdeal = newIdeal;
2447  strat->LazyPass=20;
2448  else
2449  strat->LazyPass=2;
2450  strat->LazyDegree = 1;
2452  strat->chainCrit=chainCritNormal;
2454  strat->ak = id_RankFreeModule(F,currRing);
2455  strat->kModW=kModW=NULL;
2456  strat->kHomW=kHomW=NULL;
2457  if (vw != NULL)
2458  {
2459  currRing->pLexOrder=FALSE;
2460  strat->kHomW=kHomW=vw;
2461  strat->pOrigFDeg = currRing->pFDeg;
2462  strat->pOrigLDeg = currRing->pLDeg;
2464  toReset = TRUE;
2465  }
2466  if (h==testHomog)
2467  {
2468  if (strat->ak == 0)
2469  {
2470  h = (tHomog)idHomIdeal(F,Q);
2471  w=NULL;
2472  }
2473  else if (!TEST_OPT_DEGBOUND)
2474  {
2475  h = (tHomog)idHomModule(F,Q,w);
2476  }
2477  }
2478  currRing->pLexOrder=b;
2479  if (h==isHomog)
2480  {
2481  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2482  {
2483  strat->kModW = kModW = *w;
2484  if (vw == NULL)
2485  {
2486  strat->pOrigFDeg = currRing->pFDeg;
2487  strat->pOrigLDeg = currRing->pLDeg;
2489  toReset = TRUE;
2490  }
2491  }
2492  currRing->pLexOrder = TRUE;
2493  if (hilb==NULL) strat->LazyPass*=2;
2494  }
2495  strat->homog=h;
2496  #ifdef KDEBUG
2497  idTest(F);
2498  if(Q != NULL)
2499  idTest(Q);
2500  #endif
2501  #ifdef HAVE_PLURAL
2502  if (rIsPluralRing(currRing))
2503  {
2504  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2505  strat->no_prod_crit = ! bIsSCA;
2506  if (w!=NULL)
2507  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2508  else
2509  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2510  }
2511  else
2512  #endif
2513  {
2515  {
2516  if (w!=NULL)
2517  r=mora(F,Q,*w,hilb,strat);
2518  else
2519  r=mora(F,Q,NULL,hilb,strat);
2520  }
2521  else
2522  {
2523  strat->sigdrop = FALSE;
2524  if (w!=NULL)
2525  r=sba(F,Q,*w,hilb,strat);
2526  else
2527  r=sba(F,Q,NULL,hilb,strat);
2528  }
2529  }
2530  #ifdef KDEBUG
2531  idTest(r);
2532  #endif
2533  if (toReset)
2534  {
2535  kModW = NULL;
2536  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2537  }
2538  currRing->pLexOrder = b;
2539  //Print("%d reductions canceled \n",strat->cel);
2540  HCord=strat->HCord;
2541  //delete(strat);
2542  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2543  return r;
2544  }
2545  else
2546  {
2547  //--------------------------RING CASE-------------------------
2548  assume(sbaOrder == 1);
2549  assume(arri == 0);
2550  ideal r;
2551  r = idCopy(F);
2552  int sbaEnterS = -1;
2553  bool sigdrop = TRUE;
2554  #ifdef ADIDEBUG
2555  printf("\nEnter the nice kSba loop\n");
2556  #endif
2557  //This is how we set the SBA algorithm;
2558  int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2559  while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2560  && (blockred <= blockedreductions))
2561  {
2562  loops++;
2563  if(loops == 1)
2564  sigdrop = FALSE;
2565  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2566  BOOLEAN delete_w=(w==NULL);
2567  kStrategy strat=new skStrategy;
2568  strat->sbaEnterS = sbaEnterS;
2569  strat->sigdrop = sigdrop;
2570  #if 0
2571  strat->blockred = blockred;
2572  #else
2573  strat->blockred = 0;
2574  #endif
2575  strat->blockredmax = blockedreductions;
2576  //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2577  //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2578  strat->sbaOrder = sbaOrder;
2579  if (arri!=0)
2580  {
2581  strat->rewCrit1 = arriRewDummy;
2582  strat->rewCrit2 = arriRewCriterion;
2583  strat->rewCrit3 = arriRewCriterionPre;
2584  }
2585  else
2586  {
2587  strat->rewCrit1 = faugereRewCriterion;
2588  strat->rewCrit2 = faugereRewCriterion;
2589  strat->rewCrit3 = faugereRewCriterion;
2590  }
2591 
2592  if(!TEST_OPT_RETURN_SB)
2593  strat->syzComp = syzComp;
2594  if (TEST_OPT_SB_1)
2595  if(!rField_is_Ring(currRing))
2596  strat->newIdeal = newIdeal;
2598  strat->LazyPass=20;
2599  else
2600  strat->LazyPass=2;
2601  strat->LazyDegree = 1;
2603  strat->chainCrit=chainCritNormal;
2605  strat->ak = id_RankFreeModule(F,currRing);
2606  strat->kModW=kModW=NULL;
2607  strat->kHomW=kHomW=NULL;
2608  if (vw != NULL)
2609  {
2610  currRing->pLexOrder=FALSE;
2611  strat->kHomW=kHomW=vw;
2612  strat->pOrigFDeg = currRing->pFDeg;
2613  strat->pOrigLDeg = currRing->pLDeg;
2615  toReset = TRUE;
2616  }
2617  if (h==testHomog)
2618  {
2619  if (strat->ak == 0)
2620  {
2621  h = (tHomog)idHomIdeal(F,Q);
2622  w=NULL;
2623  }
2624  else if (!TEST_OPT_DEGBOUND)
2625  {
2626  h = (tHomog)idHomModule(F,Q,w);
2627  }
2628  }
2629  currRing->pLexOrder=b;
2630  if (h==isHomog)
2631  {
2632  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2633  {
2634  strat->kModW = kModW = *w;
2635  if (vw == NULL)
2636  {
2637  strat->pOrigFDeg = currRing->pFDeg;
2638  strat->pOrigLDeg = currRing->pLDeg;
2640  toReset = TRUE;
2641  }
2642  }
2643  currRing->pLexOrder = TRUE;
2644  if (hilb==NULL) strat->LazyPass*=2;
2645  }
2646  strat->homog=h;
2647  #ifdef KDEBUG
2648  idTest(F);
2649  if(Q != NULL)
2650  idTest(Q);
2651  #endif
2652  #ifdef HAVE_PLURAL
2653  if (rIsPluralRing(currRing))
2654  {
2655  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2656  strat->no_prod_crit = ! bIsSCA;
2657  if (w!=NULL)
2658  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2659  else
2660  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2661  }
2662  else
2663  #endif
2664  {
2666  {
2667  if (w!=NULL)
2668  r=mora(F,Q,*w,hilb,strat);
2669  else
2670  r=mora(F,Q,NULL,hilb,strat);
2671  }
2672  else
2673  {
2674  if (w!=NULL)
2675  r=sba(r,Q,*w,hilb,strat);
2676  else
2677  {
2678  r=sba(r,Q,NULL,hilb,strat);
2679  }
2680  #ifdef ADIDEBUG
2681  printf("\nSBA Run %i: %i elements (syzCrit = %i,rewCrit = %i)\n",loops,IDELEMS(r),strat->nrsyzcrit,strat->nrrewcrit);
2682  idPrint(r);
2683  //getchar();
2684  #endif
2685  }
2686  }
2687  #ifdef KDEBUG
2688  idTest(r);
2689  #endif
2690  if (toReset)
2691  {
2692  kModW = NULL;
2693  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2694  }
2695  currRing->pLexOrder = b;
2696  //Print("%d reductions canceled \n",strat->cel);
2697  HCord=strat->HCord;
2698  sigdrop = strat->sigdrop;
2699  sbaEnterS = strat->sbaEnterS;
2700  blockred = strat->blockred;
2701  #ifdef ADIDEBUG
2702  printf("\nsbaEnterS = %i\n",sbaEnterS);
2703  #endif
2704  delete(strat);
2705  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2706  }
2707  // Go to std
2708  if(sigdrop || blockred > blockedreductions)
2709  {
2710  #ifdef ADIDEBUG
2711  printf("\nWent to std\n");
2712  idPrint(r);
2713  getchar();
2714  #endif
2715  r = kStd(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2716  }
2717  return r;
2718  }
2719 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
int HCord
Definition: kutil.cc:235
int syzComp
Definition: kutil.h:342
#define TEST_OPT_DEGBOUND
Definition: options.h:108
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:279
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
bool sigdrop
Definition: kutil.h:348
if(0 > strat->sl)
Definition: myNF.cc:73
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition: kutil.cc:7202
#define FALSE
Definition: auxiliary.h:94
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3247
int sbaEnterS
Definition: kutil.h:351
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:280
BOOLEAN z2homog
Definition: kutil.h:363
#define TRUE
Definition: auxiliary.h:98
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:2231
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:281
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:2355
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1952
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
int HCord
Definition: kutil.h:343
pFDegProc pOrigFDeg
Definition: kutil.h:282
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
intvec * kHomW
Definition: kstd1.cc:2206
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int blockredmax
Definition: kutil.h:354
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:276
#define idPrint(id)
Definition: ideals.h:46
int nrsyzcrit
Definition: kutil.h:349
int nrrewcrit
Definition: kutil.h:350
const ring r
Definition: syzextra.cc:208
pLDegProc pOrigLDeg
Definition: kutil.h:283
intvec * kModW
Definition: kstd1.cc:2206
BOOLEAN homog
Definition: kutil.h:361
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
unsigned sbaOrder
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idCopy(ideal A)
Definition: ideals.h:60
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3555
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition: kutil.cc:7264
int int kStrategy strat
Definition: myNF.cc:68
#define TEST_OPT_RETURN_SB
Definition: options.h:107
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition: kutil.cc:7295
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:277
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
intvec * kHomW
Definition: kutil.h:324
#define TEST_OPT_SB_1
Definition: options.h:113
int blockred
Definition: kutil.h:353
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:323
BOOLEAN no_prod_crit
Definition: kutil.h:383
static bool rIsSCA(const ring r)
Definition: nc.h:206
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3460
int LazyPass
Definition: kutil.h:341
int newIdeal
Definition: kutil.h:345
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
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
const poly b
Definition: syzextra.cc:213
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition: kInline.h:1147
int LazyDegree
Definition: kutil.h:341
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1606
#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 2231 of file kstd1.cc.

2233 {
2234  if(idIs0(F))
2235  return idInit(1,F->rank);
2236 
2237  ideal r;
2238  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2239  BOOLEAN delete_w=(w==NULL);
2241 
2242  strat->s_poly=sp;
2243  if(!TEST_OPT_RETURN_SB)
2244  strat->syzComp = syzComp;
2245  if (TEST_OPT_SB_1
2246  &&(!rField_is_Ring(currRing))
2247  )
2248  strat->newIdeal = newIdeal;
2250  strat->LazyPass=20;
2251  else
2252  strat->LazyPass=2;
2253  strat->LazyDegree = 1;
2254  strat->ak = id_RankFreeModule(F,currRing);
2255  strat->kModW=kModW=NULL;
2256  strat->kHomW=kHomW=NULL;
2257  if (vw != NULL)
2258  {
2259  currRing->pLexOrder=FALSE;
2260  strat->kHomW=kHomW=vw;
2261  strat->pOrigFDeg = currRing->pFDeg;
2262  strat->pOrigLDeg = currRing->pLDeg;
2264  toReset = TRUE;
2265  }
2266  if (h==testHomog)
2267  {
2268  if (strat->ak == 0)
2269  {
2270  h = (tHomog)idHomIdeal(F,Q);
2271  w=NULL;
2272  }
2273  else if (!TEST_OPT_DEGBOUND)
2274  {
2275  h = (tHomog)idHomModule(F,Q,w);
2276  }
2277  }
2278  currRing->pLexOrder=b;
2279  if (h==isHomog)
2280  {
2281  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2282  {
2283  strat->kModW = kModW = *w;
2284  if (vw == NULL)
2285  {
2286  strat->pOrigFDeg = currRing->pFDeg;
2287  strat->pOrigLDeg = currRing->pLDeg;
2289  toReset = TRUE;
2290  }
2291  }
2292  currRing->pLexOrder = TRUE;
2293  if (hilb==NULL) strat->LazyPass*=2;
2294  }
2295  strat->homog=h;
2296 #ifdef KDEBUG
2297  idTest(F);
2298  if (Q!=NULL) idTest(Q);
2299 #endif
2300 #ifdef HAVE_PLURAL
2301  if (rIsPluralRing(currRing))
2302  {
2303  const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2304  strat->no_prod_crit = ! bIsSCA;
2305  if (w!=NULL)
2306  r = nc_GB(F, Q, *w, hilb, strat, currRing);
2307  else
2308  r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2309  }
2310  else
2311 #endif
2312  {
2313  #if PRE_INTEGER_CHECK
2314  //the preinteger check strategy is not for modules
2315  if(rField_is_Ring(currRing) && nCoeff_is_Ring_Z(currRing->cf) && strat->ak <= 0)
2316  {
2317  ideal FCopy = idCopy(F);
2318  poly pFmon = preIntegerCheck(FCopy, Q);
2319  if(pFmon != NULL)
2320  {
2321  idInsertPoly(FCopy, pFmon);
2322  #ifdef ADIDEBUG
2323  printf("\nPreintegerCheck found this constant:\n");pWrite(pFmon);
2324  #endif
2325 
2326  strat->kModW=kModW=NULL;
2327  if (h==testHomog)
2328  {
2329  if (strat->ak == 0)
2330  {
2331  h = (tHomog)idHomIdeal(FCopy,Q);
2332  w=NULL;
2333  }
2334  else if (!TEST_OPT_DEGBOUND)
2335  {
2336  h = (tHomog)idHomModule(FCopy,Q,w);
2337  }
2338  }
2339  currRing->pLexOrder=b;
2340  if (h==isHomog)
2341  {
2342  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2343  {
2344  strat->kModW = kModW = *w;
2345  if (vw == NULL)
2346  {
2347  strat->pOrigFDeg = currRing->pFDeg;
2348  strat->pOrigLDeg = currRing->pLDeg;
2350  toReset = TRUE;
2351  }
2352  }
2353  currRing->pLexOrder = TRUE;
2354  if (hilb==NULL) strat->LazyPass*=2;
2355  }
2356  strat->homog=h;
2357  }
2358  else
2359  {
2360  #ifdef ADIDEBUG
2361  printf("\npreIntegerCheck didn't found any new information\n");
2362  #endif
2363  }
2364  omTestMemory(1);
2365  if(w == NULL)
2366  {
2368  r=mora(FCopy,Q,NULL,hilb,strat);
2369  else
2370  r=bba(FCopy,Q,NULL,hilb,strat);
2371  }
2372  else
2373  {
2375  r=mora(FCopy,Q,*w,hilb,strat);
2376  else
2377  r=bba(FCopy,Q,*w,hilb,strat);
2378  }
2379  idDelete(&FCopy);
2380  }
2381  else
2382  #endif
2383  {
2384  if(w==NULL)
2385  {
2387  r=mora(F,Q,NULL,hilb,strat);
2388  else
2389  r=bba(F,Q,NULL,hilb,strat);
2390  }
2391  else
2392  {
2394  r=mora(F,Q,*w,hilb,strat);
2395  else
2396  r=bba(F,Q,*w,hilb,strat);
2397  }
2398  }
2399  }
2400 #ifdef KDEBUG
2401  idTest(r);
2402 #endif
2403  if (toReset)
2404  {
2405  kModW = NULL;
2406  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2407  }
2408  currRing->pLexOrder = b;
2409 //Print("%d reductions canceled \n",strat->cel);
2410  HCord=strat->HCord;
2411  delete(strat);
2412  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2413  return r;
2414 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
int HCord
Definition: kutil.cc:235
int syzComp
Definition: kutil.h:342
#define TEST_OPT_DEGBOUND
Definition: options.h:108
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
if(0 > strat->sl)
Definition: myNF.cc:73
#define FALSE
Definition: auxiliary.h:94
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
BOOLEAN z2homog
Definition: kutil.h:363
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int ak
Definition: kutil.h:341
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:10863
#define Q
Definition: sirandom.c:25
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd2.cc:1972
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
int HCord
Definition: kutil.h:343
pFDegProc pOrigFDeg
Definition: kutil.h:282
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
intvec * kHomW
Definition: kstd1.cc:2206
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
omError_t omTestMemory(int check_level)
Definition: omDebug.c:94
const ring r
Definition: syzextra.cc:208
pLDegProc pOrigLDeg
Definition: kutil.h:283
intvec * kModW
Definition: kstd1.cc:2206
BOOLEAN homog
Definition: kutil.h:361
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
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:3555
int int kStrategy strat
Definition: myNF.cc:68
#define TEST_OPT_RETURN_SB
Definition: options.h:107
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
s_poly_proc_t s_poly
Definition: kutil.h:286
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
intvec * kHomW
Definition: kutil.h:324
#define TEST_OPT_SB_1
Definition: options.h:113
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:323
BOOLEAN no_prod_crit
Definition: kutil.h:383
static bool rIsSCA(const ring r)
Definition: nc.h:206
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
int LazyPass
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10
int newIdeal
Definition: kutil.h:345
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
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
const poly b
Definition: syzextra.cc:213
int LazyDegree
Definition: kutil.h:341
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition: kstd1.cc:1606
#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,
int  uptodeg,
int  lV 
)

Definition at line 2722 of file kstd1.cc.

2724 {
2725  ideal r;
2726  BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2727  BOOLEAN delete_w=(w==NULL);
2729 
2730  if(!TEST_OPT_RETURN_SB)
2731  strat->syzComp = syzComp;
2732  if (TEST_OPT_SB_1)
2733  if(!rField_is_Ring(currRing))
2734  strat->newIdeal = newIdeal;
2736  strat->LazyPass=20;
2737  else
2738  strat->LazyPass=2;
2739  strat->LazyDegree = 1;
2740  strat->ak = id_RankFreeModule(F,currRing);
2741  strat->kModW=kModW=NULL;
2742  strat->kHomW=kHomW=NULL;
2743  if (vw != NULL)
2744  {
2745  currRing->pLexOrder=FALSE;
2746  strat->kHomW=kHomW=vw;
2747  strat->pOrigFDeg = currRing->pFDeg;
2748  strat->pOrigLDeg = currRing->pLDeg;
2750  toReset = TRUE;
2751  }
2752  if (h==testHomog)
2753  {
2754  if (strat->ak == 0)
2755  {
2756  h = (tHomog)idHomIdeal(F,Q);
2757  w=NULL;
2758  }
2759  else if (!TEST_OPT_DEGBOUND)
2760  {
2761  h = (tHomog)idHomModule(F,Q,w);
2762  }
2763  }
2764  currRing->pLexOrder=b;
2765  if (h==isHomog)
2766  {
2767  if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2768  {
2769  strat->kModW = kModW = *w;
2770  if (vw == NULL)
2771  {
2772  strat->pOrigFDeg = currRing->pFDeg;
2773  strat->pOrigLDeg = currRing->pLDeg;
2775  toReset = TRUE;
2776  }
2777  }
2778  currRing->pLexOrder = TRUE;
2779  if (hilb==NULL) strat->LazyPass*=2;
2780  }
2781  strat->homog=h;
2782 #ifdef KDEBUG
2783  idTest(F);
2784 #endif
2786  {
2787  /* error: no local ord yet with shifts */
2788  PrintS("No local ordering possible for shifts");
2789  return(NULL);
2790  }
2791  else
2792  {
2793  /* global ordering */
2794  if (w!=NULL)
2795  r=bbaShift(F,Q,*w,hilb,strat,uptodeg,lV);
2796  else
2797  r=bbaShift(F,Q,NULL,hilb,strat,uptodeg,lV);
2798  }
2799 #ifdef KDEBUG
2800  idTest(r);
2801 #endif
2802  if (toReset)
2803  {
2804  kModW = NULL;
2805  pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2806  }
2807  currRing->pLexOrder = b;
2808 //Print("%d reductions canceled \n",strat->cel);
2809  HCord=strat->HCord;
2810  delete(strat);
2811  if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2812  return r;
2813 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:752
int HCord
Definition: kutil.cc:235
int syzComp
Definition: kutil.h:342
#define TEST_OPT_DEGBOUND
Definition: options.h:108
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition: ideals.h:91
if(0 > strat->sl)
Definition: myNF.cc:73
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:341
#define Q
Definition: sirandom.c:25
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition: ring.h:540
int HCord
Definition: kutil.h:343
pFDegProc pOrigFDeg
Definition: kutil.h:282
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition: ideals.h:96
intvec * kHomW
Definition: kstd1.cc:2206
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
pLDegProc pOrigLDeg
Definition: kutil.h:283
intvec * kModW
Definition: kstd1.cc:2206
BOOLEAN homog
Definition: kutil.h:361
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition: structs.h:37
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition: p_polys.cc:3543
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
void PrintS(const char *s)
Definition: reporter.cc:284
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition: p_polys.cc:3555
int int kStrategy strat
Definition: myNF.cc:68
#define TEST_OPT_RETURN_SB
Definition: options.h:107
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
intvec * kHomW
Definition: kutil.h:324
#define TEST_OPT_SB_1
Definition: options.h:113
const CanonicalForm & w
Definition: facAbsFact.cc:55
intvec * kModW
Definition: kutil.h:323
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
Definition: kstd2.cc:4017
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
int LazyPass
Definition: kutil.h:341
int newIdeal
Definition: kutil.h:345
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213
int LazyDegree
Definition: kutil.h:341
#define idTest(id)
Definition: ideals.h:47

◆ missingAxis()

void missingAxis ( int *  last,
kStrategy  strat 
)

Definition at line 1015 of file kstd1.cc.

1016 {
1017  int i = 0;
1018  int k = 0;
1019 
1020  *last = 0;
1022  {
1023  loop
1024  {
1025  i++;
1026  if (i > (currRing->N)) break;
1027  if (strat->NotUsedAxis[i])
1028  {
1029  *last = i;
1030  k++;
1031  }
1032  if (k>1)
1033  {
1034  *last = 0;
1035  break;
1036  }
1037  }
1038  }
1039 }
loop
Definition: myNF.cc:98
static poly last
Definition: hdegree.cc:1077
BOOLEAN * NotUsedAxis
Definition: kutil.h:320
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753

◆ mora()

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

Definition at line 1606 of file kstd1.cc.

1607 {
1608 #ifdef HAVE_RINGS
1609 #ifdef ADIDEBUG
1610 int loop_count;
1611 loop_count = 1;
1612 #endif
1613 #endif
1614  int olddeg = 0;
1615  int reduc = 0;
1616  int red_result = 1;
1617  int hilbeledeg=1,hilbcount=0;
1618  BITSET save1;
1619  SI_SAVE_OPT1(save1);
1621  {
1622  si_opt_1 &= ~Sy_bit(OPT_REDSB);
1624  }
1625 
1626  strat->update = TRUE;
1627  /*- setting global variables ------------------- -*/
1628  initBuchMoraCrit(strat);
1629  initHilbCrit(F,Q,&hilb,strat);
1630  initMora(F,strat);
1632  initBuchMoraPosRing(strat);
1633  else
1634  initBuchMoraPos(strat);
1635  /*Shdl=*/initBuchMora(F,Q,strat);
1636  if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
1637  /*updateS in initBuchMora has Hecketest
1638  * and could have put strat->kHEdgdeFound FALSE*/
1639  if ((currRing->ppNoether)!=NULL)
1640  {
1641  strat->kHEdgeFound = TRUE;
1642  }
1643  if (strat->kHEdgeFound && strat->update)
1644  {
1645  firstUpdate(strat);
1646  updateLHC(strat);
1647  reorderL(strat);
1648  }
1649  if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
1650  {
1651  strat->posInLOld = strat->posInL;
1652  strat->posInLOldFlag = FALSE;
1653  strat->posInL = posInL10;
1654  updateL(strat);
1655  reorderL(strat);
1656  }
1657  kTest_TS(strat);
1658  strat->use_buckets = kMoraUseBucket(strat);
1659 
1660 #ifdef HAVE_TAIL_RING
1661  if (strat->homog && strat->red == redFirst)
1662  if(!idIs0(F) &&(!rField_is_Ring(currRing)))
1663  kStratInitChangeTailRing(strat);
1664 #endif
1665 
1666  if (BVERBOSE(23))
1667  {
1668  kDebugPrint(strat);
1669  }
1670 //deleteInL(strat->L,&strat->Ll,1,strat);
1671 //deleteInL(strat->L,&strat->Ll,0,strat);
1672 
1673  /*- compute-------------------------------------------*/
1674  while (strat->Ll >= 0)
1675  {
1676  #ifdef ADIDEBUG
1677  printf("\n ------------------------NEW LOOP\n");
1678  printf("\nShdl = \n");
1679  for(int iii = 0; iii<= strat->sl; iii++)
1680  {
1681  printf("S[%i]:",iii);
1682  p_Write(strat->S[iii], strat->tailRing);
1683  }
1684  printf("\n list L has %i\n", strat->Ll);
1685  int iii;
1686  #ifdef ADIDEBUG
1687  for(iii = 0; iii<= strat->Ll; iii++)
1688  {
1689  printf("L[%i]:",iii);
1690  pWrite(strat->L[iii].p);
1691  pWrite(strat->L[iii].p1);
1692  pWrite(strat->L[iii].p2);
1693  }
1694  #endif
1695  getchar();
1696  #endif
1697  #ifdef KDEBUG
1698  if (TEST_OPT_DEBUG) messageSets(strat);
1699  #endif
1700  if (TEST_OPT_DEGBOUND
1701  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1702  {
1703  /*
1704  * stops computation if
1705  * - 24 (degBound)
1706  * && upper degree is bigger than Kstd1_deg
1707  */
1708  while ((strat->Ll >= 0)
1709  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1710  && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1711  )
1712  {
1713  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1714  //if (TEST_OPT_PROT)
1715  //{
1716  // PrintS("D"); mflush();
1717  //}
1718  }
1719  if (strat->Ll<0) break;
1720  else strat->noClearS=TRUE;
1721  }
1722  strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1723  if (strat->Ll==0) strat->interpt=TRUE;
1724  strat->Ll--;
1725  // create the real Spoly
1726  if (pNext(strat->P.p) == strat->tail)
1727  {
1728  /*- deletes the short spoly and computes -*/
1729  if (rField_is_Ring(currRing))
1730  pLmDelete(strat->P.p);
1731  else
1732  pLmFree(strat->P.p);
1733  strat->P.p = NULL;
1734  poly m1 = NULL, m2 = NULL;
1735  // check that spoly creation is ok
1736  while (strat->tailRing != currRing &&
1737  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1738  {
1739  assume(m1 == NULL && m2 == NULL);
1740  // if not, change to a ring where exponents are large enough
1741  kStratChangeTailRing(strat);
1742  }
1743  /* create the real one */
1744  ksCreateSpoly(&(strat->P), strat->kNoetherTail(), strat->use_buckets,
1745  strat->tailRing, m1, m2, strat->R);
1746  if (!strat->use_buckets)
1747  strat->P.SetLength(strat->length_pLength);
1748  }
1749  else if (strat->P.p1 == NULL)
1750  {
1751  // for input polys, prepare reduction (buckets !)
1752  strat->P.SetLength(strat->length_pLength);
1753  strat->P.PrepareRed(strat->use_buckets);
1754  }
1755 
1756  // the s-poly
1757  if (!strat->P.IsNull())
1758  {
1759  // might be NULL from noether !!!
1760  if (TEST_OPT_PROT)
1761  message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
1762  // reduce
1763  #ifdef ADIDEBUG
1764  printf("\nThis is P vor red:\n");p_Write(strat->P.p,strat->tailRing);p_Write(strat->P.p1,strat->tailRing);p_Write(strat->P.p2,strat->tailRing);
1765  printf("\nBefore Ll = %i\n", strat->Ll);
1766  #endif
1767  red_result = strat->red(&strat->P,strat);
1768  #ifdef ADIDEBUG
1769  printf("\nThis is P nach red:\n");p_Write(strat->P.p,strat->tailRing);p_Write(strat->P.p1,strat->tailRing);p_Write(strat->P.p2,strat->tailRing);
1770  printf("\nAfter Ll = %i\n", strat->Ll);
1771  #endif
1772  }
1773 
1774  // the reduced s-poly
1775  if (! strat->P.IsNull())
1776  {
1777  strat->P.GetP();
1778  // statistics
1779  if (TEST_OPT_PROT) PrintS("s");
1780  // normalization
1782  strat->P.pCleardenom();
1783  else
1784  strat->P.pNorm();
1785  // tailreduction
1786  strat->P.p = redtail(&(strat->P),strat->sl,strat);
1787  if (strat->P.p==NULL)
1788  {
1789  WerrorS("expoent overflow - wrong ordering");
1790  return(idInit(1,1));
1791  }
1792  // set ecart -- might have changed because of tail reductions
1793  if ((!strat->noTailReduction) && (!strat->honey))
1794  strat->initEcart(&strat->P);
1795  // cancel unit
1796  cancelunit(&strat->P);
1797  // for char 0, clear denominators
1798  if ((strat->P.p->next==NULL) /* i.e. cancelunit did something*/
1800  strat->P.pCleardenom();
1801 
1802  enterT(strat->P,strat);
1803  // build new pairs
1804  if (rField_is_Ring(currRing))
1805  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1806  else
1807  enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
1808  // put in S
1809 
1810  #ifdef ADIDEBUG
1811  Print("\n The new pair list L -- after superenterpairs in loop %d -- is:\n",loop_count);
1812  for(int iii=0;iii<=strat->Ll;iii++)
1813  {
1814  printf("\n L[%d]:\n",iii);
1815  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
1816  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
1817  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
1818  }
1819  #endif
1820  strat->enterS(strat->P,
1821  posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
1822  strat, strat->tl);
1823  #ifdef ADIDEBUG
1824  printf("\nThis pair has been added to S:\n");
1825  pWrite(strat->P.p);
1826  pWrite(strat->P.p1);
1827  pWrite(strat->P.p2);
1828  #endif
1829 
1830  // apply hilbert criterion
1831  if (hilb!=NULL)
1832  {
1833  if (strat->homog==isHomog)
1834  khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1835  else
1836  khCheckLocInhom(Q,w,hilb,hilbcount,strat);
1837  }
1838 
1839  // clear strat->P
1840  if (strat->P.lcm!=NULL)
1841  {
1842  if (rField_is_Ring(currRing))
1843  pLmDelete(strat->P.lcm);
1844  else
1845  pLmFree(strat->P.lcm);
1846  strat->P.lcm=NULL;
1847  }
1848 
1849 #ifdef KDEBUG
1850  // make sure kTest_TS does not complain about strat->P
1851  memset(&strat->P,0,sizeof(strat->P));
1852 #endif
1853  }
1854  if (strat->kHEdgeFound)
1855  {
1856  if ((TEST_OPT_FINDET)
1857  || ((TEST_OPT_MULTBOUND) && (scMult0Int(strat->Shdl,NULL,strat->tailRing) < Kstd1_mu)))
1858  {
1859  // obachman: is this still used ???
1860  /*
1861  * stops computation if strat->kHEdgeFound and
1862  * - 27 (finiteDeterminacyTest)
1863  * or
1864  * - 23
1865  * (multBound)
1866  * && multiplicity of the ideal is smaller then a predefined number mu
1867  */
1868  while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1869  }
1870  }
1871  kTest_TS(strat);
1872  }
1873  /*- complete reduction of the standard basis------------------------ -*/
1874  if (TEST_OPT_REDSB) completeReduce(strat);
1875  else if (TEST_OPT_PROT) PrintLn();
1876  /*- release temp data------------------------------- -*/
1877  exitBuchMora(strat);
1878  /*- polynomials used for HECKE: HC, noether -*/
1879  if (TEST_OPT_FINDET)
1880  {
1881  if (strat->kHEdge!=NULL)
1882  Kstd1_mu=currRing->pFDeg(strat->kHEdge,currRing);
1883  else
1884  Kstd1_mu=-1;
1885  }
1886  pDelete(&strat->kHEdge);
1887  strat->update = TRUE; //???
1888  strat->lastAxis = 0; //???
1889  pDelete(&strat->kNoether);
1890  omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
1891  if ((TEST_OPT_PROT)||(TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
1892 // if (TEST_OPT_WEIGHTM)
1893 // {
1894 // pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
1895 // if (ecartWeights)
1896 // {
1897 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1898 // ecartWeights=NULL;
1899 // }
1900 // }
1901  if(nCoeff_is_Ring_Z(currRing->cf))
1902  finalReduceByMon(strat);
1903  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1904  SI_RESTORE_OPT1(save1);
1905  idTest(strat->Shdl);
1906  return (strat->Shdl);
1907 }
#define OPT_REDSB
Definition: options.h:71
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
unsigned si_opt_1
Definition: options.c:5
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7496
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:9919
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:7915
void initMora(ideal F, kStrategy strat)
Definition: kstd1.cc:1549
BOOLEAN length_pLength
Definition: kutil.h:376
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:7956
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:10092
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#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:4926
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TEST_OPT_MULTBOUND
Definition: options.h:109
char noClearS
Definition: kutil.h:391
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
void * ADDRESS
Definition: auxiliary.h:115
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void pWrite(poly p)
Definition: polys.h:290
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void WerrorS(const char *s)
Definition: feFopen.cc:24
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:18
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:264
void initBuchMoraPosRing(kStrategy strat)
Definition: kutil.cc:10005
#define Sy_bit(x)
Definition: options.h:30
void updateL(kStrategy strat)
Definition: kstd1.cc:1131
int lastAxis
Definition: kutil.h:344
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:11353
int Kstd1_mu
Definition: kutil.cc:237
#define TEST_OPT_FINDET
Definition: options.h:106
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9469
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:1015
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
BOOLEAN interpt
Definition: kutil.h:360
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:641
#define OPT_REDTAIL
Definition: options.h:86
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:9750
int scMult0Int(ideal S, ideal Q, const ring tailRing)
Definition: hdegree.cc:919
#define assume(x)
Definition: mod2.h:394
#define messageSets(s)
Definition: kutil.h:528
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1202
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
LObject P
Definition: kutil.h:288
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:9768
void reorderL(kStrategy strat)
Definition: kstd1.cc:957
BOOLEAN update
Definition: kutil.h:370
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:322
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:274
TObject ** R
Definition: kutil.h:328
polyset S
Definition: kutil.h:292
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:753
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
#define BVERBOSE(a)
Definition: options.h:33
int int kStrategy strat
Definition: myNF.cc:68
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
BOOLEAN kHEdgeFound
Definition: kutil.h:365
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:4889
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1295
ring tailRing
Definition: kutil.h:331
void khCheckLocInhom(ideal Q, intvec *w, intvec *hilb, int &count, kStrategy strat)
Definition: khstd.cc:140
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5102
#define pDelete(p_ptr)
Definition: polys.h:169
BOOLEAN posInLOldFlag
Definition: kutil.h:371
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:10613
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:10401
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:336
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition: kstd1.cc:3618
BOOLEAN use_buckets
Definition: kutil.h:372
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
#define TEST_OPT_FASTHC
Definition: options.h:104
polyrec * poly
Definition: hilb.h:10
int Kstd1_deg
Definition: kutil.cc:236
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition: kutil.cc:11188
int BOOLEAN
Definition: auxiliary.h:85
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
KINLINE poly kNoetherTail()
Definition: kInline.h:63
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:10168
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:11800
#define idTest(id)
Definition: ideals.h:47

◆ posInL10()

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

Definition at line 1098 of file kstd1.cc.

1099 {
1100  int j,dp,dL;
1101 
1102  if (length<0) return 0;
1103  if (hasPurePower(p,strat->lastAxis,&dp,strat))
1104  {
1105  int op= p->GetpFDeg() +p->ecart;
1106  for (j=length; j>=0; j--)
1107  {
1108  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1109  return j+1;
1110  if (dp < dL)
1111  return j+1;
1112  if ((dp == dL)
1113  && (set[j].GetpFDeg()+set[j].ecart >= op))
1114  return j+1;
1115  }
1116  }
1117  j=length;
1118  loop
1119  {
1120  if (j<0) break;
1121  if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1122  j--;
1123  }
1124  return strat->posInLOld(set,j,p,strat);
1125 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int lastAxis
Definition: kutil.h:344
int j
Definition: myNF.cc:70
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:274
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:1048

◆ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 172 of file kstd1.cc.

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

◆ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 601 of file kstd1.cc.

602 {
603  if (h->IsNull()) return 0;
604 
605  int at;
606  long reddeg,d;
607  int pass = 0;
608  int j = 0;
609 
610  if (! strat->homog)
611  {
612  d = h->GetpFDeg() + h->ecart;
613  reddeg = strat->LazyDegree+d;
614  }
615  h->SetShortExpVector();
616  loop
617  {
618  j = kFindDivisibleByInT(strat, h);
619  if (j < 0)
620  {
621  h->SetDegStuffReturnLDeg(strat->LDegLast);
622  return 1;
623  }
624 
626  strat->T[j].pNorm();
627 #ifdef KDEBUG
628  if (TEST_OPT_DEBUG)
629  {
630  PrintS("reduce ");
631  h->wrp();
632  PrintS(" with ");
633  strat->T[j].wrp();
634  }
635 #endif
636  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
637 #ifdef KDEBUG
638  if (TEST_OPT_DEBUG)
639  {
640  PrintS(" to ");
641  wrp(h->p);
642  PrintLn();
643  }
644 #endif
645  if (h->IsNull())
646  {
648  if (h->lcm!=NULL) pLmFree(h->lcm);
649  h->Clear();
650  return 0;
651  }
652  h->SetShortExpVector();
653 
654 #if 0
655  if ((strat->syzComp!=0) && !strat->honey)
656  {
657  if ((strat->syzComp>0) &&
658  (h->Comp() > strat->syzComp))
659  {
660  assume(h->MinComp() > strat->syzComp);
661 #ifdef KDEBUG
662  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
663 #endif
664  if (strat->homog)
665  h->SetDegStuffReturnLDeg(strat->LDegLast);
666  return -2;
667  }
668  }
669 #endif
670  if (!strat->homog)
671  {
672  if (!TEST_OPT_OLDSTD && strat->honey)
673  {
674  h->SetpFDeg();
675  if (strat->T[j].ecart <= h->ecart)
676  h->ecart = d - h->GetpFDeg();
677  else
678  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
679 
680  d = h->GetpFDeg() + h->ecart;
681  }
682  else
683  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
684  /*- try to reduce the s-polynomial -*/
685  pass++;
686  /*
687  *test whether the polynomial should go to the lazyset L
688  *-if the degree jumps
689  *-if the number of pre-defined reductions jumps
690  */
691  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
692  && ((d >= reddeg) || (pass > strat->LazyPass)))
693  {
694  h->SetLmCurrRing();
695  if (strat->posInLDependsOnLength)
696  h->SetLength(strat->length_pLength);
697  at = strat->posInL(strat->L,strat->Ll,h,strat);
698  if (at <= strat->Ll)
699  {
700  int dummy=strat->sl;
701  if (kFindDivisibleByInS(strat,&dummy, h) < 0)
702  return 1;
703  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
704 #ifdef KDEBUG
705  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
706 #endif
707  h->Clear();
708  return -1;
709  }
710  }
711  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
712  {
713  reddeg = d+1;
714  Print(".%ld",d);mflush();
715  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
716  {
717  strat->overflow=TRUE;
718  //Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
719  h->GetP();
720  at = strat->posInL(strat->L,strat->Ll,h,strat);
721  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
722  h->Clear();
723  return -1;
724  }
725  }
726  }
727  }
728 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:342
BOOLEAN length_pLength
Definition: kutil.h:376
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
#define TRUE
Definition: auxiliary.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:361
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:394
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:197
void PrintS(const char *s)
Definition: reporter.cc:284
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:313
BOOLEAN LDegLast
Definition: kutil.h:374
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
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:336
TSet T
Definition: kutil.h:312
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:88
void wrp(poly p)
Definition: polys.h:292
int LazyPass
Definition: kutil.h:341
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int LazyDegree
Definition: kutil.h:341

◆ redMoraNF()

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

Definition at line 735 of file kstd1.cc.

736 {
737  LObject H;
738  H.p = h;
739  int j = 0;
740  int z = 10;
741  int o = H.SetpFDeg();
742  H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;
743  if ((flag & 2) == 0) cancelunit(&H,TRUE);
744  H.sev = pGetShortExpVector(H.p);
745  unsigned long not_sev = ~ H.sev;
746  loop
747  {
748  if (j > strat->tl)
749  {
750  return H.p;
751  }
752  if (TEST_V_DEG_STOP)
753  {
754  if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p);
755  if (H.p==NULL) return NULL;
756  }
757  if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing)
758  )
759  {
760  /*- remember the found T-poly -*/
761  // poly pi = strat->T[j].p;
762  int ei = strat->T[j].ecart;
763  int li = strat->T[j].length;
764  int ii = j;
765  /*
766  * the polynomial to reduce with (up to the moment) is;
767  * pi with ecart ei and length li
768  */
769  loop
770  {
771  /*- look for a better one with respect to ecart -*/
772  /*- stop, if the ecart is small enough (<=ecart(H)) -*/
773  j++;
774  if (j > strat->tl) break;
775  if (ei <= H.ecart) break;
776  if (((strat->T[j].ecart < ei)
777  || ((strat->T[j].ecart == ei)
778  && (strat->T[j].length < li)))
779  && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
780  )
781  {
782  /*
783  * the polynomial to reduce with is now;
784  */
785  // pi = strat->T[j].p;
786  ei = strat->T[j].ecart;
787  li = strat->T[j].length;
788  ii = j;
789  }
790  }
791  /*
792  * end of search: have to reduce with pi
793  */
794  z++;
795  if (z>10)
796  {
797  pNormalize(H.p);
798  z=0;
799  }
800  if ((ei > H.ecart) && (!strat->kHEdgeFound))
801  {
802  /*
803  * It is not possible to reduce h with smaller ecart;
804  * we have to reduce with bad ecart: H has to enter in T
805  */
806  doRed(&H,&(strat->T[ii]),TRUE,strat,TRUE);
807  if (H.p == NULL)
808  return NULL;
809  }
810  else
811  {
812  /*
813  * we reduce with good ecart, h need not to be put to T
814  */
815  doRed(&H,&(strat->T[ii]),FALSE,strat,TRUE);
816  if (H.p == NULL)
817  return NULL;
818  }
819  /*- try to reduce the s-polynomial -*/
820  o = H.SetpFDeg();
821  if ((flag &2 ) == 0) cancelunit(&H,TRUE);
822  H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o;
823  j = 0;
824  H.sev = pGetShortExpVector(H.p);
825  not_sev = ~ H.sev;
826  }
827  else
828  {
829  j++;
830  }
831  }
832 }
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_V_DEG_STOP
Definition: options.h:130
int j
Definition: myNF.cc:70
#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
pNormalize(P.p)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
CanonicalForm H
Definition: facAbsFact.cc:64
BOOLEAN kHEdgeFound
Definition: kutil.h:365
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
TSet T
Definition: kutil.h:312
int Kstd1_deg
Definition: kutil.cc:236
static Poly * h
Definition: janet.cc:978

◆ redMoraNFRing()

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

Definition at line 835 of file kstd1.cc.

836 {
837  LObject H;
838  H.p = h;
839  int j = 0;
840  int z = 10;
841  int o = H.SetpFDeg();
842  H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;
843  if ((flag & 2) == 0) cancelunit(&H,TRUE);
844  H.sev = pGetShortExpVector(H.p);
845  unsigned long not_sev = ~ H.sev;
846  loop
847  {
848  if (j > strat->tl)
849  {
850  return H.p;
851  }
852  if (TEST_V_DEG_STOP)
853  {
854  if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p);
855  if (H.p==NULL) return NULL;
856  }
857  #ifdef ADIDEBUG_NF
858  printf("\nSearching for a reducer...\n");
859  #endif
860  if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing)
861  && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf))
862  )
863  {
864  /*- remember the found T-poly -*/
865  // poly pi = strat->T[j].p;
866  int ei = strat->T[j].ecart;
867  int li = strat->T[j].length;
868  int ii = j;
869  #ifdef ADIDEBUG_NF
870  printf("\nFound: j = %i, ecart = %i\nTrying to find a better one...\n",j,ei);pWrite(strat->T[j].p);
871  #endif
872  /*
873  * the polynomial to reduce with (up to the moment) is;
874  * pi with ecart ei and length li
875  */
876  loop
877  {
878  /*- look for a better one with respect to ecart -*/
879  /*- stop, if the ecart is small enough (<=ecart(H)) -*/
880  j++;
881  if (j > strat->tl) break;
882  if (ei <= H.ecart) break;
883  if (((strat->T[j].ecart < ei)
884  || ((strat->T[j].ecart == ei)
885  && (strat->T[j].length < li)))
886  && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
887  && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf))
888  )
889  {
890  /*
891  * the polynomial to reduce with is now;
892  */
893  // pi = strat->T[j].p;
894  ei = strat->T[j].ecart;
895  li = strat->T[j].length;
896  ii = j;
897  #ifdef ADIDEBUG_NF
898  printf("\nFound a better one: j = %i, ecart = %i\nTrying to find a better one...\n",j,ei);
899  pWrite(strat->T[j].p);
900  #endif
901  }
902  }
903  /*
904  * end of search: have to reduce with pi
905  */
906  z++;
907  if (z>10)
908  {
909  pNormalize(H.p);
910  z=0;
911  }
912  if ((ei > H.ecart) && (!strat->kHEdgeFound))
913  {
914  /*
915  * It is not possible to reduce h with smaller ecart;
916  * we have to reduce with bad ecart: H has to enter in T
917  */
918  #ifdef ADIDEBUG_NF
919  printf("\nHAVE TO REDUCE IT WITH BIGGER ECART\n");
920  #endif
921  doRed(&H,&(strat->T[ii]),TRUE,strat,TRUE);
922  if (H.p == NULL)
923  return NULL;
924  }
925  else
926  {
927  /*
928  * we reduce with good ecart, h need not to be put to T
929  */
930  doRed(&H,&(strat->T[ii]),FALSE,strat,TRUE);
931  if (H.p == NULL)
932  return NULL;
933  }
934  #ifdef ADIDEBUG_NF
935  printf("\nAfter the small reduction it looks like this:\n");pWrite(H.p);
936  getchar();
937  #endif
938  /*- try to reduce the s-polynomial -*/
939  o = H.SetpFDeg();
940  if ((flag &2 ) == 0) cancelunit(&H,TRUE);
941  H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o;
942  j = 0;
943  H.sev = pGetShortExpVector(H.p);
944  not_sev = ~ H.sev;
945  }
946  else
947  {
948  j++;
949  }
950  }
951 }
class sLObject LObject
Definition: kutil.h:52
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
void pWrite(poly p)
Definition: polys.h:290
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_V_DEG_STOP
Definition: options.h:130
int j
Definition: myNF.cc:70
#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:787
#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
pNormalize(P.p)
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
CanonicalForm H
Definition: facAbsFact.cc:64
BOOLEAN kHEdgeFound
Definition: kutil.h:365
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
long kModDeg(poly p, ring r)
Definition: kstd1.cc:2208
TSet T
Definition: kutil.h:312
int Kstd1_deg
Definition: kutil.cc:236
static Poly * h
Definition: janet.cc:978

◆ redRiloc()

int redRiloc ( LObject h,
kStrategy  strat 
)

Definition at line 348 of file kstd1.cc.

349 {
350  int i,at,ei,li,ii;
351  int j = 0;
352  int pass = 0;
353  long d,reddeg;
354 
355 
356 #ifdef ADIDEBUG_NF
357  int iii;
358  PrintS("\n---------------------------- NEW REDRILOC COMPUTATION ----------------------------\n");
359  PrintS(" The pair h :\n");
360  PrintS("\n p1 = "); p_Write(h->p1,strat->tailRing);
361  PrintS("\n p2 = "); p_Write(h->p2,strat->tailRing);
362  PrintS("\n p = "); p_Write(h->p,strat->tailRing);
363  PrintS("\n The actual reducer T is: ");
364  if(strat->tl<0)
365  {PrintS(" Empty.\n");}
366  else
367  {
368  for (iii=0;iii<=strat->tl;iii++)
369  {
370  Print("\n T[%i] = ",iii);p_Write(strat->T[iii].p,strat->tailRing);
371  }
372  }
373 #endif /* ADIDEBUG_NF */
374 
375  d = h->GetpFDeg()+ h->ecart;
376  reddeg = strat->LazyDegree+d;
377  h->SetShortExpVector();
378 #ifdef ADIDEBUG_NF
379  Print("\n Searching for a poly in T that divides h (of ecart %i) ...\n",h->ecart);
380 #endif
381  loop
382  {
383  j = kFindDivisibleByInT(strat, h);
384 #ifdef ADIDEBUG_NF
385  if(j != -1)
386  {
387  ei = strat->T[j].ecart;
388  Print("\n Found one: T[%i] of ecart %i: ",j,ei);
389  p_Write(strat->T[j].p,strat->tailRing);
390  PrintS("\n Try to find another with smaller ecart:\n");
391  }
392  else
393  {
394  PrintS("\n No poly in T divides h.\n");
395  }
396  //getchar();
397 #endif
398  if (j < 0)
399  {
400  // over ZZ: cleanup coefficients by complete reduction with monomials
401  postReduceByMon(h, strat);
402  if(h->p == NULL)
403  {
404  if (h->lcm!=NULL) pLmDelete(h->lcm);
405  h->Clear();
406  return 0;
407  }
408  if (strat->honey) h->SetLength(strat->length_pLength);
409  if(strat->tl >= 0)
410  h->i_r1 = strat->tl;
411  else
412  h->i_r1 = -1;
413  if (h->GetLmTailRing() == NULL)
414  {
415  if (h->lcm!=NULL) pLmDelete(h->lcm);
416  h->Clear();
417  return 0;
418  }
419  return 1;
420  }
421 
422  ei = strat->T[j].ecart;
423  ii = j;
424 #ifdef ADIDEBUG_NF
425  iii=ii;
426 #endif
427  if (ei > h->ecart && ii < strat->tl)
428  {
429  li = strat->T[j].length;
430  // the polynomial to reduce with (up to the moment) is;
431  // pi with ecart ei and length li
432  // look for one with smaller ecart
433  i = j;
434  loop
435  {
436  /*- takes the first possible with respect to ecart -*/
437  i++;
438 #if 1
439  if (i > strat->tl) break;
440  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
441  strat->T[i].length < li))
442  &&
443  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
444  &&
445  n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
446 #else
447  j = kFindDivisibleByInT(strat, h, i);
448  if (j < 0) break;
449  i = j;
450  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
451  strat->T[i].length < li))
452 #endif
453  {
454  // the polynomial to reduce with is now
455  #ifdef ADIDEBUG_NF
456  printf("\n Intermidiate one, h.ecart = %i < ecart = %i < ei = %i: ",h->ecart,strat->T[i].ecart, ei);
457  pWrite(strat->T[i].p);
458  #endif
459  ii = i;
460  ei = strat->T[i].ecart;
461  if (ei <= h->ecart) break;
462  li = strat->T[i].length;
463  }
464  }
465 
466 #ifdef ADIDEBUG_NF
467  if(iii == ii)
468  {
469  PrintS("\n None was found.\n");
470  }
471  else
472  {
473  Print("\n A better one (ecart = %i): T[%i] = ",ei,ii);
474  p_Write(strat->T[ii].p,strat->tailRing);
475  PrintLn();
476  }
477 #endif
478  }
479 
480  // end of search: have to reduce with pi
481  if (ei > h->ecart)
482  {
483  #ifdef ADIDEBUG_NF
484  printf("\nHAD TO REDUCE WITH BIGGER ECART!!!\n");
485  #endif
486  // It is not possible to reduce h with smaller ecart;
487  // if possible h goes to the lazy-set L,i.e
488  // if its position in L would be not the last one
489  strat->fromT = TRUE;
490  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
491  {
492  h->SetLmCurrRing();
493  if (strat->honey && strat->posInLDependsOnLength)
494  h->SetLength(strat->length_pLength);
495  assume(h->FDeg == h->pFDeg());
496  at = strat->posInL(strat->L,strat->Ll,h,strat);
497  if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
498  {
499  /*- h will not become the next element to reduce -*/
500  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
501  #ifdef KDEBUG
502  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
503  #endif
504  h->Clear();
505  strat->fromT = FALSE;
506  return -1;
507  }
508  }
509  doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
510  }
511  else
512  {
513  // now we finally can reduce
514  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
515  }
516  strat->fromT=FALSE;
517  // are we done ???
518  if (h->IsNull())
519  {
520  #ifdef ADIDEBUG_NF
521  printf("\nReduced to 0. Exit\n");
522  #endif
523  if (h->lcm!=NULL) pLmDelete(h->lcm);
524  h->Clear();
525  return 0;
526  }
527 
528  // NO!
529  h->SetShortExpVector();
530  h->SetpFDeg();
531  if (strat->honey)
532  {
533  if (ei <= h->ecart)
534  h->ecart = d-h->GetpFDeg();
535  else
536  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
537  }
538  else
539  // this has the side effect of setting h->length
540  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
541  #ifdef ADIDEBUG_NF
542  printf("\n Partial Reduced (ecart %i) h = ",h->ecart);p_Write(h->p,strat->tailRing);
543  PrintLn();
544  #endif
545  /*- try to reduce the s-polynomial -*/
546  pass++;
547  d = h->GetpFDeg()+h->ecart;
548  /*
549  *test whether the polynomial should go to the lazyset L
550  *-if the degree jumps
551  *-if the number of pre-defined reductions jumps
552  */
553  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
554  && ((d >= reddeg) || (pass > strat->LazyPass)))
555  {
556  h->SetLmCurrRing();
557  if (strat->honey && strat->posInLDependsOnLength)
558  h->SetLength(strat->length_pLength);
559  assume(h->FDeg == h->pFDeg());
560  at = strat->posInL(strat->L,strat->Ll,h,strat);
561  if (at <= strat->Ll)
562  {
563  int dummy=strat->sl;
564  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
565  {
566  if (strat->honey && !strat->posInLDependsOnLength)
567  h->SetLength(strat->length_pLength);
568  return 1;
569  }
570  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
571 #ifdef KDEBUG
572  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
573 #endif
574  h->Clear();
575  return -1;
576  }
577  }
578  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
579  {
580  Print(".%ld",d);mflush();
581  reddeg = d+1;
582  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
583  {
584  strat->overflow=TRUE;
585  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
586  h->GetP();
587  at = strat->posInL(strat->L,strat->Ll,h,strat);
588  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
589  h->Clear();
590  return -1;
591  }
592  }
593  }
594 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
BOOLEAN honey
Definition: kutil.h:366
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:376
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
BOOLEAN posInLDependsOnLength
Definition: kutil.h:378
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define nEqual(n1, n2)
Definition: numbers.h:20
#define mflush()
Definition: reporter.h:57
BOOLEAN fromT
Definition: kutil.h:368
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
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:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:313
BOOLEAN LDegLast
Definition: kutil.h:374
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition: kutil.cc:11031
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:339
ring tailRing
Definition: kutil.h:331
char overflow
Definition: kutil.h:393
int sl
Definition: kutil.h:336
TSet T
Definition: kutil.h:312
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
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:88
int LazyPass
Definition: kutil.h:341
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:341

◆ reorderL()

void reorderL ( kStrategy  strat)

Definition at line 957 of file kstd1.cc.

958 {
959  int i,j,at;
960  LObject p;
961 
962  for (i=1; i<=strat->Ll; i++)
963  {
964  at = strat->posInL(strat->L,i-1,&(strat->L[i]),strat);
965  if (at != i)
966  {
967  p = strat->L[i];
968  for (j=i-1; j>=at; j--) strat->L[j+1] = strat->L[j];
969  strat->L[at] = p;
970  }
971  }
972 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:270
class sLObject LObject
Definition: kutil.h:52
int Ll
Definition: kutil.h:339
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:313

◆ reorderT()

void reorderT ( kStrategy  strat)

Definition at line 977 of file kstd1.cc.

978 {
979  int i,j,at;
980  TObject p;
981  unsigned long sev;
982 
983 
984  for (i=1; i<=strat->tl; i++)
985  {
986  if (strat->T[i-1].length > strat->T[i].length)
987  {
988  p = strat->T[i];
989  sev = strat->sevT[i];
990  at = i-1;
991  loop
992  {
993  at--;
994  if (at < 0) break;
995  if (strat->T[i].length > strat->T[at].length) break;
996  }
997  for (j = i-1; j>at; j--)
998  {
999  strat->T[j+1]=strat->T[j];
1000  strat->sevT[j+1]=strat->sevT[j];
1001  strat->R[strat->T[j+1].i_r] = &(strat->T[j+1]);
1002  }
1003  strat->T[at+1]=p;
1004  strat->sevT[at+1] = sev;
1005  strat->R[p.i_r] = &(strat->T[at+1]);
1006  }
1007  }
1008 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:338
unsigned long * sevT
Definition: kutil.h:311
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:328
TSet T
Definition: kutil.h:312
class sTObject TObject
Definition: kutil.h:51

◆ updateL()

void updateL ( kStrategy  strat)

Definition at line 1131 of file kstd1.cc.

1132 {
1133  LObject p;
1134  int dL;
1135  int j=strat->Ll;
1136  loop
1137  {
1138  if (j<0) break;
1139  if (hasPurePower(&(strat->L[j]),strat->lastAxis,&dL,strat))
1140  {
1141  p=strat->L[strat->Ll];
1142  strat->L[strat->Ll]=strat->L[j];
1143  strat->L[j]=p;
1144  break;
1145  }
1146  j--;
1147  }
1148  if (j<0)
1149  {
1150  j=strat->Ll;
1151  loop
1152  {
1153  if (j<0) break;
1154  if (pNext(strat->L[j].p) == strat->tail)
1155  {
1156  if (rField_is_Ring(currRing))
1157  pLmDelete(strat->L[j].p); /*deletes the short spoly and computes*/
1158  else
1159  pLmFree(strat->L[j].p); /*deletes the short spoly and computes*/
1160  strat->L[j].p = NULL;
1161  poly m1 = NULL, m2 = NULL;
1162  // check that spoly creation is ok
1163  while (strat->tailRing != currRing &&
1164  !kCheckSpolyCreation(&(strat->L[j]), strat, m1, m2))
1165  {
1166  assume(m1 == NULL && m2 == NULL);
1167  // if not, change to a ring where exponents are at least
1168  // large enough
1169  kStratChangeTailRing(strat);
1170  }
1171  /* create the real one */
1172  ksCreateSpoly(&(strat->L[j]), strat->kNoetherTail(), FALSE,
1173  strat->tailRing, m1, m2, strat->R);
1174 
1175  strat->L[j].SetLmCurrRing();
1176  if (!strat->honey)
1177  strat->initEcart(&strat->L[j]);
1178  else
1179  strat->L[j].SetLength(strat->length_pLength);
1180 
1181  BOOLEAN pp = hasPurePower(&(strat->L[j]),strat->lastAxis,&dL,strat);
1182 
1183  if (strat->use_buckets) strat->L[j].PrepareRed(TRUE);
1184 
1185  if (pp)
1186  {
1187  p=strat->L[strat->Ll];
1188  strat->L[strat->Ll]=strat->L[j];
1189  strat->L[j]=p;
1190  break;
1191  }
1192  }
1193  j--;
1194  }
1195  }
1196 }
BOOLEAN honey
Definition: kutil.h:366
class sLObject LObject
Definition: kutil.h:52
BOOLEAN length_pLength
Definition: kutil.h:376
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
poly pp
Definition: myNF.cc:296
int lastAxis
Definition: kutil.h:344
void(* initEcart)(TObject *L)
Definition: kutil.h:266
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
poly tail
Definition: kutil.h:322
TObject ** R
Definition: kutil.h:328
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
LSet L
Definition: kutil.h:313
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition: kstd1.cc:1048
#define pNext(p)
Definition: monomials.h:43
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
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ updateLHC()

void updateLHC ( kStrategy  strat)

Definition at line 1202 of file kstd1.cc.

1203 {
1204 
1205  int i = 0;
1206  kTest_TS(strat);
1207  while (i <= strat->Ll)
1208  {
1209  if (pNext(strat->L[i].p) == strat->tail)
1210  {
1211  /*- deletes the int spoly and computes -*/
1212  if (pLmCmp(strat->L[i].p,strat->kNoether) == -1)
1213  {
1214  if (rField_is_Ring(currRing))
1215  pLmDelete(strat->L[i].p);
1216  else
1217  pLmFree(strat->L[i].p);
1218  strat->L[i].p = NULL;
1219  }
1220  else
1221  {
1222  if (rField_is_Ring(currRing))
1223  pLmDelete(strat->L[i].p);
1224  else
1225  pLmFree(strat->L[i].p);
1226  strat->L[i].p = NULL;
1227  poly m1 = NULL, m2 = NULL;
1228  // check that spoly creation is ok
1229  while (strat->tailRing != currRing &&
1230  !kCheckSpolyCreation(&(strat->L[i]), strat, m1, m2))
1231  {
1232  assume(m1 == NULL && m2 == NULL);
1233  // if not, change to a ring where exponents are at least
1234  // large enough
1235  kStratChangeTailRing(strat);
1236  }
1237  /* create the real one */
1238  ksCreateSpoly(&(strat->L[i]), strat->kNoetherTail(), FALSE,
1239  strat->tailRing, m1, m2, strat->R);
1240  if (! strat->L[i].IsNull())
1241  {
1242  strat->L[i].SetLmCurrRing();
1243  strat->L[i].SetpFDeg();
1244  strat->L[i].ecart
1245  = strat->L[i].pLDeg(strat->LDegLast) - strat->L[i].GetpFDeg();
1246  if (strat->use_buckets) strat->L[i].PrepareRed(TRUE);
1247  }
1248  }
1249  }
1250  else
1251  deleteHC(&(strat->L[i]), strat);
1252  if (strat->L[i].IsNull())
1253  deleteInL(strat->L,&strat->Ll,i,strat);
1254  else
1255  {
1256 #ifdef KDEBUG
1257  kTest_L(&(strat->L[i]), strat->tailRing, TRUE, i, strat->T, strat->tl);
1258 #endif
1259  i++;
1260  }
1261  }
1262  kTest_TS(strat);
1263 }
int Ll
Definition: kutil.h:339
#define FALSE
Definition: auxiliary.h:94
#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:316
int tl
Definition: kutil.h:338
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define kTest_TS(A)
Definition: kutil.h:641
#define assume(x)
Definition: mod2.h:394
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:774
#define kTest_L(T)
Definition: kutil.h:644
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11254
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:322
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
TObject ** R
Definition: kutil.h:328
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:10802
LSet L
Definition: kutil.h:313
BOOLEAN LDegLast
Definition: kutil.h:374
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:331
#define pNext(p)
Definition: monomials.h:43
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:312
BOOLEAN use_buckets
Definition: kutil.h:372
polyrec * poly
Definition: hilb.h:10
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ updateT()

void updateT ( kStrategy  strat)

Definition at line 1269 of file kstd1.cc.

1270 {
1271  int i = 0;
1272  LObject p;
1273 
1274  while (i <= strat->tl)
1275  {
1276  p = strat->T[i];
1277  deleteHC(&p,strat, TRUE);
1278  /*- tries to cancel a unit: -*/
1279  cancelunit(&p);
1280  if (TEST_OPT_INTSTRATEGY) /* deleteHC and/or cancelunit may have changed p*/
1281  p.pCleardenom();
1282  if (p.p != strat->T[i].p)
1283  {
1284  strat->sevT[i] = pGetShortExpVector(p.p);
1285  p.SetpFDeg();
1286  }
1287  strat->T[i] = p;
1288  i++;
1289  }
1290 }
class sLObject LObject
Definition: kutil.h:52
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:311
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#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:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
TSet T
Definition: kutil.h:312

Variable Documentation

◆ kHomW

intvec * kHomW

Definition at line 2206 of file kstd1.cc.

◆ kModW

intvec* kModW

Definition at line 2206 of file kstd1.cc.

◆ kOptions

BITSET kOptions
Initial value:
#define OPT_REDSB
Definition: options.h:71
#define OPT_PROT
Definition: options.h:70
#define OPT_INFREDTAIL
Definition: options.h:89
#define OPT_OLDSTD
Definition: options.h:81
#define Sy_bit(x)
Definition: options.h:30
#define OPT_NOT_SUGAR
Definition: options.h:73
#define OPT_SUGARCRIT
Definition: options.h:75
#define OPT_INTSTRATEGY
Definition: options.h:87
#define OPT_WEIGHTM
Definition: options.h:92
#define OPT_REDTHROUGH
Definition: options.h:77
#define OPT_NOTREGULARITY
Definition: options.h:91
#define OPT_INTERRUPT
Definition: options.h:74
#define OPT_FASTHC
Definition: options.h:80

Definition at line 48 of file kstd1.cc.

◆ validOpts

BITSET validOpts

Definition at line 63 of file kstd1.cc.