Macros | Functions | Variables
kstd2.cc File Reference
#include <kernel/mod2.h>
#include <kernel/GBEngine/kutil.h>
#include <misc/options.h>
#include <omalloc/omalloc.h>
#include <kernel/polys.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/kstd1.h>
#include <kernel/GBEngine/khstd.h>
#include <polys/kbuckets.h>
#include <polys/prCopy.h>
#include <polys/weight.h>
#include <misc/intvec.h>
#include <polys/nc/nc.h>
#include <kernel/GBEngine/shiftgb.h>

Go to the source code of this file.

Macros

#define MYTEST   0
 
#define PLURAL_INTERNAL_DECLARATIONS   1
 
#define DEBUGF50   0
 
#define DEBUGF51   0
 
#define F5C   1
 
#define F5CTAILRED   1
 
#define SBA_INTERRED_START   0
 
#define SBA_TAIL_RED   1
 
#define SBA_PRODUCT_CRITERION   0
 
#define SBA_PRINT_ZERO_REDUCTIONS   0
 
#define SBA_PRINT_REDUCTION_STEPS   0
 
#define SBA_PRINT_OPERATIONS   0
 
#define SBA_PRINT_SIZE_G   0
 
#define SBA_PRINT_SIZE_SYZ   0
 
#define SBA_PRINT_PRODUCT_CRITERION   0
 
#define REDTAIL_CANONICALIZE   100
 

Functions

int kFindDivisibleByInT (const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
 return -1 if no divisor is found number of first divisor in T, otherwise More...
 
int kFindDivisibleByInS (const kStrategy strat, int *max_ind, LObject *L)
 return -1 if no divisor is found number of first divisor in S, otherwise More...
 
int kFindNextDivisibleByInS (const kStrategy strat, int start, int max_ind, LObject *L)
 
poly kFindZeroPoly (poly input_p, ring leadRing, ring tailRing)
 
int redRing (LObject *h, kStrategy strat)
 
int redHomog (LObject *h, kStrategy strat)
 
KINLINE int ksReducePolyTailSig (LObject *PR, TObject *PW, LObject *Red)
 
int redSig (LObject *h, kStrategy strat)
 
poly redtailSba (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
int redLazy (LObject *h, kStrategy strat)
 
int redHoney (LObject *h, kStrategy strat)
 
poly redNF (poly h, int &max_ind, int nonorm, kStrategy strat)
 
void kDebugPrint (kStrategy strat)
 
ideal bba (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
ideal sba (ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
poly kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF2 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
void f5c (kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
 
ideal bbaShift (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat, int uptodeg, int lV)
 
ideal freegb (ideal I, int uptodeg, int lVblock)
 
int redFirstShift (LObject *h, kStrategy strat)
 
void initBbaShift (ideal, kStrategy strat)
 

Variables

int(* test_PosInT )(const TSet T, const int tl, LObject &h)
 
int(* test_PosInL )(const LSet set, const int length, LObject *L, const kStrategy strat)
 
static int bba_count = 0
 

Macro Definition Documentation

#define DEBUGF50   0

Definition at line 38 of file kstd2.cc.

#define DEBUGF51   0

Definition at line 39 of file kstd2.cc.

#define F5C   1

Definition at line 46 of file kstd2.cc.

#define F5CTAILRED   1

Definition at line 48 of file kstd2.cc.

#define MYTEST   0

Definition at line 17 of file kstd2.cc.

#define PLURAL_INTERNAL_DECLARATIONS   1

Definition at line 32 of file kstd2.cc.

#define REDTAIL_CANONICALIZE   100
#define SBA_INTERRED_START   0

Definition at line 51 of file kstd2.cc.

#define SBA_PRINT_OPERATIONS   0

Definition at line 56 of file kstd2.cc.

#define SBA_PRINT_PRODUCT_CRITERION   0

Definition at line 59 of file kstd2.cc.

#define SBA_PRINT_REDUCTION_STEPS   0

Definition at line 55 of file kstd2.cc.

#define SBA_PRINT_SIZE_G   0

Definition at line 57 of file kstd2.cc.

#define SBA_PRINT_SIZE_SYZ   0

Definition at line 58 of file kstd2.cc.

#define SBA_PRINT_ZERO_REDUCTIONS   0

Definition at line 54 of file kstd2.cc.

#define SBA_PRODUCT_CRITERION   0

Definition at line 53 of file kstd2.cc.

#define SBA_TAIL_RED   1

Definition at line 52 of file kstd2.cc.

Function Documentation

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

Definition at line 1338 of file kstd2.cc.

1339 {
1340 #ifdef KDEBUG
1341  bba_count++;
1342  int loop_count = 0;
1343 #endif /* KDEBUG */
1344  int red_result = 1;
1345  int olddeg,reduc;
1346  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1347  BOOLEAN withT = FALSE;
1348  BITSET save;
1349  SI_SAVE_OPT1(save);
1350 
1351  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1352  initBuchMoraPos(strat);
1353  initHilbCrit(F,Q,&hilb,strat);
1354  initBba(F,strat);
1355  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1356  /*Shdl=*/initBuchMora(F, Q,strat);
1357  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1358  reduc = olddeg = 0;
1359 
1360 #ifndef NO_BUCKETS
1361  if (!TEST_OPT_NOT_BUCKETS)
1362  strat->use_buckets = 1;
1363 #endif
1364  // redtailBBa against T for inhomogenous input
1365  if (!TEST_OPT_OLDSTD)
1366  withT = ! strat->homog;
1367 
1368  // strat->posInT = posInT_pLength;
1369  kTest_TS(strat);
1370 
1371 #ifdef KDEBUG
1372 #if MYTEST
1373  if (TEST_OPT_DEBUG)
1374  {
1375  PrintS("bba start GB: currRing: ");
1376  // rWrite(currRing);PrintLn();
1378  PrintLn();
1379  }
1380 #endif /* MYTEST */
1381 #endif /* KDEBUG */
1382 
1383 #ifdef HAVE_TAIL_RING
1384  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1385  kStratInitChangeTailRing(strat);
1386 #endif
1387  if (BVERBOSE(23))
1388  {
1389  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1390  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1391  kDebugPrint(strat);
1392  }
1393 
1394 
1395 #ifdef KDEBUG
1396  //kDebugPrint(strat);
1397 #endif
1398  /* compute------------------------------------------------------- */
1399  while (strat->Ll >= 0)
1400  {
1401  #ifdef KDEBUG
1402  loop_count++;
1403  if (TEST_OPT_DEBUG) messageSets(strat);
1404  #endif
1405  if (strat->Ll== 0) strat->interpt=TRUE;
1406  if (TEST_OPT_DEGBOUND
1407  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1408  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1409  {
1410  /*
1411  *stops computation if
1412  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1413  *a predefined number Kstd1_deg
1414  */
1415  while ((strat->Ll >= 0)
1416  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1417  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1418  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1419  )
1420  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1421  if (strat->Ll<0) break;
1422  else strat->noClearS=TRUE;
1423  }
1424  /* picks the last element from the lazyset L */
1425  strat->P = strat->L[strat->Ll];
1426  strat->Ll--;
1427 
1428  if (pNext(strat->P.p) == strat->tail)
1429  {
1430  // deletes the short spoly
1431 #ifdef HAVE_RINGS
1432  if (rField_is_Ring(currRing))
1433  pLmDelete(strat->P.p);
1434  else
1435 #endif
1436  pLmFree(strat->P.p);
1437  strat->P.p = NULL;
1438  poly m1 = NULL, m2 = NULL;
1439 
1440  // check that spoly creation is ok
1441  while (strat->tailRing != currRing &&
1442  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1443  {
1444  assume(m1 == NULL && m2 == NULL);
1445  // if not, change to a ring where exponents are at least
1446  // large enough
1447  if (!kStratChangeTailRing(strat))
1448  {
1449  WerrorS("OVERFLOW...");
1450  break;
1451  }
1452  }
1453  // create the real one
1454  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
1455  strat->tailRing, m1, m2, strat->R);
1456  }
1457  else if (strat->P.p1 == NULL)
1458  {
1459  if (strat->minim > 0)
1460  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
1461  // for input polys, prepare reduction
1462  strat->P.PrepareRed(strat->use_buckets);
1463  }
1464 
1465  if (strat->P.p == NULL && strat->P.t_p == NULL)
1466  {
1467  red_result = 0;
1468  }
1469  else
1470  {
1471  if (TEST_OPT_PROT)
1472  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
1473  &olddeg,&reduc,strat, red_result);
1474 
1475  /* reduction of the element chosen from L */
1476  red_result = strat->red(&strat->P,strat);
1477  if (errorreported) break;
1478  }
1479 
1480  if (strat->overflow)
1481  {
1482  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
1483  }
1484 
1485  // reduction to non-zero new poly
1486  if (red_result == 1)
1487  {
1488  // get the polynomial (canonicalize bucket, make sure P.p is set)
1489  strat->P.GetP(strat->lmBin);
1490  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
1491  // but now, for entering S, T, we reset it
1492  // in the inhomogeneous case: FDeg == pFDeg
1493  if (strat->homog) strat->initEcart(&(strat->P));
1494 
1495  /* statistic */
1496  if (TEST_OPT_PROT) PrintS("s");
1497 
1498  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1499 
1500 #ifdef KDEBUG
1501 #if MYTEST
1502  PrintS("New S: "); p_DebugPrint(strat->P.p, currRing); PrintLn();
1503 #endif /* MYTEST */
1504 #endif /* KDEBUG */
1505 
1506  // reduce the tail and normalize poly
1507  // in the ring case we cannot expect LC(f) = 1,
1508  // therefore we call pContent instead of pNorm
1510  {
1511  strat->P.pCleardenom();
1513  {
1514  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1515  strat->P.pCleardenom();
1516  }
1517  }
1518  else
1519  {
1520  strat->P.pNorm();
1522  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
1523  }
1524 
1525 #ifdef KDEBUG
1526  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
1527 #if MYTEST
1528  PrintS("New (reduced) S: "); p_DebugPrint(strat->P.p, currRing); PrintLn();
1529 #endif /* MYTEST */
1530 #endif /* KDEBUG */
1531 
1532  // min_std stuff
1533  if ((strat->P.p1==NULL) && (strat->minim>0))
1534  {
1535  if (strat->minim==1)
1536  {
1537  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
1538  p_Delete(&strat->P.p2, currRing, strat->tailRing);
1539  }
1540  else
1541  {
1542  strat->M->m[minimcnt]=strat->P.p2;
1543  strat->P.p2=NULL;
1544  }
1545  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
1546  pNext(strat->M->m[minimcnt])
1547  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
1548  strat->tailRing, currRing,
1549  currRing->PolyBin);
1550  minimcnt++;
1551  }
1552 
1553  // enter into S, L, and T
1554  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
1555  {
1556  enterT(strat->P, strat);
1557 #ifdef HAVE_RINGS
1558  if (rField_is_Ring(currRing))
1559  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1560  else
1561 #endif
1562  enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
1563  // posInS only depends on the leading term
1564  strat->enterS(strat->P, pos, strat, strat->tl);
1565 #if 0
1566  int pl=pLength(strat->P.p);
1567  if (pl==1)
1568  {
1569  //if (TEST_OPT_PROT)
1570  //PrintS("<1>");
1571  }
1572  else if (pl==2)
1573  {
1574  //if (TEST_OPT_PROT)
1575  //PrintS("<2>");
1576  }
1577 #endif
1578  }
1579  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
1580 // Print("[%d]",hilbeledeg);
1581  if (strat->P.lcm!=NULL)
1582 #ifdef HAVE_RINGS
1583  pLmDelete(strat->P.lcm);
1584 #else
1585  pLmFree(strat->P.lcm);
1586 #endif
1587  }
1588  else if (strat->P.p1 == NULL && strat->minim > 0)
1589  {
1590  p_Delete(&strat->P.p2, currRing, strat->tailRing);
1591  }
1592 
1593 #ifdef KDEBUG
1594  memset(&(strat->P), 0, sizeof(strat->P));
1595 #endif /* KDEBUG */
1596  kTest_TS(strat);
1597  }
1598 #ifdef KDEBUG
1599 #if MYTEST
1600  PrintS("bba finish GB: currRing: "); rWrite(currRing);
1601 #endif /* MYTEST */
1602  if (TEST_OPT_DEBUG) messageSets(strat);
1603 #endif /* KDEBUG */
1604 
1605  if (TEST_OPT_SB_1)
1606  {
1607  #ifdef HAVE_RINGS
1608  if(!rField_is_Ring(currRing))
1609  #endif
1610  {
1611  int k=1;
1612  int j;
1613  while(k<=strat->sl)
1614  {
1615  j=0;
1616  loop
1617  {
1618  if (j>=k) break;
1619  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
1620  j++;
1621  }
1622  k++;
1623  }
1624  }
1625  }
1626 
1627  /* complete reduction of the standard basis--------- */
1628  if (TEST_OPT_REDSB)
1629  {
1630  completeReduce(strat);
1631 #ifdef HAVE_TAIL_RING
1632  if (strat->completeReduce_retry)
1633  {
1634  // completeReduce needed larger exponents, retry
1635  // to reduce with S (instead of T)
1636  // and in currRing (instead of strat->tailRing)
1637  cleanT(strat);strat->tailRing=currRing;
1638  int i;
1639  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
1640  completeReduce(strat);
1641  }
1642 #endif
1643  }
1644  else if (TEST_OPT_PROT) PrintLn();
1645 
1646  /* release temp data-------------------------------- */
1647  exitBuchMora(strat);
1648 // if (TEST_OPT_WEIGHTM)
1649 // {
1650 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
1651 // if (ecartWeights)
1652 // {
1653 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
1654 // ecartWeights=NULL;
1655 // }
1656 // }
1657  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
1658  SI_RESTORE_OPT1(save);
1659  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
1660 
1661 #ifdef KDEBUG
1662 #if MYTEST
1663  PrintS("bba_end: currRing: "); rWrite(currRing);
1664 #endif /* MYTEST */
1665 #endif /* KDEBUG */
1666  idTest(strat->Shdl);
1667 
1668  return (strat->Shdl);
1669 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4176
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7558
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3671
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
char noClearS
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
#define SI_SAVE_OPT1(A)
Definition: options.h:20
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:17
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
int minim
Definition: kutil.h:361
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void rDebugPrint(ring r)
Definition: ring.cc:3971
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
BOOLEAN interpt
Definition: kutil.h:365
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:616
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:7305
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
void initBba(ideal, kStrategy strat)
Definition: kstd1.cc:1279
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:376
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
ideal M
Definition: kutil.h:303
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define IDELEMS(i)
Definition: simpleideals.h:19
short errorreported
Definition: feFopen.cc:22
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
#define BVERBOSE(a)
Definition: options.h:33
kStrategy strat
Definition: myNF.cc:319
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
static int bba_count
Definition: kstd2.cc:1334
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
void cleanT(kStrategy strat)
Definition: kutil.cc:491
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3597
ring tailRing
Definition: kutil.h:343
#define TEST_OPT_SB_1
Definition: options.h:113
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:95
BOOLEAN use_buckets
Definition: kutil.h:377
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:96
int Kstd1_deg
Definition: kutil.cc:228
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
void Werror(const char *fmt,...)
Definition: reporter.cc:199
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
#define idTest(id)
Definition: ideals.h:63
ideal bbaShift ( ideal  F,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 2868 of file kstd2.cc.

2869 {
2870 #ifdef KDEBUG
2871  bba_count++;
2872  int loop_count = 0;
2873 #endif
2874  int red_result = 1;
2875  int olddeg,reduc;
2876  int hilbeledeg=1,hilbcount=0,minimcnt=0;
2877  BOOLEAN withT = TRUE; // very important for shifts
2878 
2879  initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit, NO CHANGES */
2880  initBuchMoraPos(strat); /*NO CHANGES YET: perhaps later*/
2881  initHilbCrit(F,Q,&hilb,strat); /*NO CHANGES*/
2882  initBbaShift(F,strat); /* DONE */
2883  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
2884  /*Shdl=*/initBuchMoraShift(F, Q,strat); /* updateS with no toT, i.e. no init for T */
2885  updateSShift(strat,uptodeg,lV); /* initializes T */
2886 
2887  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
2888  reduc = olddeg = 0;
2889  strat->lV=lV;
2890 
2891 #ifndef NO_BUCKETS
2892  if (!TEST_OPT_NOT_BUCKETS)
2893  strat->use_buckets = 1;
2894 #endif
2895 
2896  // redtailBBa against T for inhomogenous input
2897  // if (!TEST_OPT_OLDSTD)
2898  // withT = ! strat->homog;
2899 
2900  // strat->posInT = posInT_pLength;
2901  kTest_TS(strat);
2902 
2903 #ifdef HAVE_TAIL_RING
2904  kStratInitChangeTailRing(strat);
2905 #endif
2906 
2907  /* compute------------------------------------------------------- */
2908  while (strat->Ll >= 0)
2909  {
2910 #ifdef KDEBUG
2911  loop_count++;
2912  if (TEST_OPT_DEBUG) messageSets(strat);
2913 #endif
2914  if (strat->Ll== 0) strat->interpt=TRUE;
2915  if (TEST_OPT_DEGBOUND
2916  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2917  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
2918  {
2919  /*
2920  *stops computation if
2921  * 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
2922  *a predefined number Kstd1_deg
2923  */
2924  while ((strat->Ll >= 0)
2925  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
2926  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
2927  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
2928  )
2929  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2930  if (strat->Ll<0) break;
2931  else strat->noClearS=TRUE;
2932  }
2933  /* picks the last element from the lazyset L */
2934  strat->P = strat->L[strat->Ll];
2935  strat->Ll--;
2936 
2937  if (pNext(strat->P.p) == strat->tail)
2938  {
2939  // deletes the short spoly
2940  pLmFree(strat->P.p);
2941  strat->P.p = NULL;
2942  poly m1 = NULL, m2 = NULL;
2943 
2944  // check that spoly creation is ok
2945  while (strat->tailRing != currRing &&
2946  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2947  {
2948  assume(m1 == NULL && m2 == NULL);
2949  // if not, change to a ring where exponents are at least
2950  // large enough
2951  kStratChangeTailRing(strat);
2952  }
2953  // create the real one
2954  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2955  strat->tailRing, m1, m2, strat->R);
2956  }
2957  else if (strat->P.p1 == NULL)
2958  {
2959  if (strat->minim > 0)
2960  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2961  // for input polys, prepare reduction
2962  strat->P.PrepareRed(strat->use_buckets);
2963  }
2964 
2965  poly qq;
2966 
2967  /* here in the nonhomog case we shrink the new spoly */
2968 
2969  if ( ! strat->homog)
2970  {
2971  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
2972  /* in the nonhomog case we have to shrink the polynomial */
2973  assume(strat->P.t_p!=NULL);
2974  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
2975  if (qq != NULL)
2976  {
2977  /* we're here if Shrink is nonzero */
2978  // strat->P.p = NULL;
2979  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
2980  strat->P.p = NULL; // is not set by Delete
2981  strat->P.t_p = qq;
2982  strat->P.GetP(strat->lmBin);
2983  // update sev and length
2984  strat->initEcart(&(strat->P));
2985  strat->P.sev = pGetShortExpVector(strat->P.p);
2986 // strat->P.FDeg = strat->P.pFDeg();
2987 // strat->P.length = strat->P.pLDeg();
2988 // strat->P.pLength =strat->P.GetpLength(); //pLength(strat->P.p);
2989  }
2990  else
2991  {
2992  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
2993 #ifdef KDEBUG
2994  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
2995 #endif
2996  // strat->P.Delete(); // cause error
2997  strat->P.p = NULL;
2998  strat->P.t_p = NULL;
2999  // strat->P.p = NULL; // or delete strat->P.p ?
3000  }
3001  }
3002  /* end shrinking poly in the nonhomog case */
3003 
3004  if (strat->P.p == NULL && strat->P.t_p == NULL)
3005  {
3006  red_result = 0;
3007  }
3008  else
3009  {
3010  if (TEST_OPT_PROT)
3011  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
3012  &olddeg,&reduc,strat, red_result);
3013 
3014  /* reduction of the element chosen from L */
3015  red_result = strat->red(&strat->P,strat);
3016  }
3017 
3018  // reduction to non-zero new poly
3019  if (red_result == 1)
3020  {
3021  /* statistic */
3022  if (TEST_OPT_PROT) PrintS("s");
3023 
3024  // get the polynomial (canonicalize bucket, make sure P.p is set)
3025  strat->P.GetP(strat->lmBin);
3026 
3027  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3028 
3029  // reduce the tail and normalize poly
3031  {
3032  strat->P.pCleardenom();
3034  {
3035  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3036  strat->P.pCleardenom();
3037  }
3038  }
3039  else
3040  {
3041  strat->P.pNorm();
3043  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3044  }
3045 
3046  // here we must shrink again! and optionally reduce again
3047  // or build shrink into redtailBba!
3048 
3049 #ifdef KDEBUG
3050  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3051 #endif
3052 
3053  // min_std stuff
3054  if ((strat->P.p1==NULL) && (strat->minim>0))
3055  {
3056  if (strat->minim==1)
3057  {
3058  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
3059  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3060  }
3061  else
3062  {
3063  strat->M->m[minimcnt]=strat->P.p2;
3064  strat->P.p2=NULL;
3065  }
3066  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
3067  pNext(strat->M->m[minimcnt])
3068  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
3069  strat->tailRing, currRing,
3070  currRing->PolyBin);
3071  minimcnt++;
3072  }
3073 
3074  /* here in the nonhomog case we shrink the reduced poly AGAIN */
3075 
3076  if ( ! strat->homog)
3077  {
3078  strat->P.GetP(strat->lmBin); // because shifts are counted with .p structure
3079  /* assume strat->P.t_p != NULL */
3080  /* in the nonhomog case we have to shrink the polynomial */
3081  assume(strat->P.t_p!=NULL); // poly qq defined above
3082  qq = p_Shrink(strat->P.t_p, lV, strat->tailRing); // direct shrink
3083  if (qq != NULL)
3084  {
3085  /* we're here if Shrink is nonzero */
3086  // strat->P.p = NULL;
3087  // strat->P.Delete(); /* deletes P.p and P.t_p */ //error
3088  strat->P.p = NULL; // is not set by Delete
3089  strat->P.t_p = qq;
3090  strat->P.GetP(strat->lmBin);
3091  // update sev and length
3092  strat->initEcart(&(strat->P));
3093  strat->P.sev = pGetShortExpVector(strat->P.p);
3094  }
3095  else
3096  {
3097  /* Shrink is zero, like y(1)*y(2) - y(1)*y(3)*/
3098 #ifdef PDEBUG
3099  if (TEST_OPT_DEBUG){PrintS("nonzero s shrinks to 0");PrintLn();}
3100 #endif
3101  // strat->P.Delete(); // cause error
3102  strat->P.p = NULL;
3103  strat->P.t_p = NULL;
3104  // strat->P.p = NULL; // or delete strat->P.p ?
3105  goto red_shrink2zero;
3106  }
3107  }
3108  /* end shrinking poly AGAIN in the nonhomog case */
3109 
3110 
3111  // enter into S, L, and T
3112  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3113  // enterT(strat->P, strat); // this was here before Shift stuff
3114  //enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV); // syntax
3115  // the default value for atT = -1 as in bba
3116  /* strat->P.GetP(); */
3117  // because shifts are counted with .p structure // done before, but ?
3118  enterTShift(strat->P,strat,-1,uptodeg, lV);
3119  enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3120  // enterpairsShift(vw,strat->sl,strat->P.ecart,pos,strat, strat->tl,uptodeg,lV);
3121  // posInS only depends on the leading term
3122  strat->enterS(strat->P, pos, strat, strat->tl);
3123 
3124  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
3125 // Print("[%d]",hilbeledeg);
3126  if (strat->P.lcm!=NULL) pLmFree(strat->P.lcm);
3127  }
3128  else
3129  {
3130  red_shrink2zero:
3131  if (strat->P.p1 == NULL && strat->minim > 0)
3132  {
3133  p_Delete(&strat->P.p2, currRing, strat->tailRing);
3134  }
3135  }
3136 #ifdef KDEBUG
3137  memset(&(strat->P), 0, sizeof(strat->P));
3138 #endif
3139  kTest_TS(strat);
3140  }
3141 #ifdef KDEBUG
3142  if (TEST_OPT_DEBUG) messageSets(strat);
3143 #endif
3144  /* complete reduction of the standard basis--------- */
3145  /* shift case: look for elt's in S such that they are divisible by elt in T */
3146  // if (TEST_OPT_SB_1)
3147  if (TEST_OPT_REDSB)
3148  {
3149  int k=0;
3150  int j=-1;
3151  while(k<=strat->sl)
3152  {
3153 // loop
3154 // {
3155 // if (j>=k) break;
3156 // clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
3157 // j++;
3158 // }
3159  LObject Ln (strat->S[k],currRing, strat->tailRing);
3160  Ln.SetShortExpVector();
3161  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln, j+1);
3162  if (j<0) { k++; j=-1;}
3163  else
3164  {
3165  if ( pLmCmp(strat->S[k],strat->T[j].p) == 0)
3166  {
3167  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln, j+1);
3168  if (j<0) { k++; j=-1;}
3169  else
3170  {
3171  deleteInS(k,strat);
3172  }
3173  }
3174  else
3175  {
3176  deleteInS(k,strat);
3177  }
3178  }
3179  }
3180  }
3181 
3182  if (TEST_OPT_REDSB)
3183  { completeReduce(strat, TRUE); //shift: withT = TRUE
3184  if (strat->completeReduce_retry)
3185  {
3186  // completeReduce needed larger exponents, retry
3187  // to reduce with S (instead of T)
3188  // and in currRing (instead of strat->tailRing)
3189  cleanT(strat);strat->tailRing=currRing;
3190  int i;
3191  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3192  completeReduce(strat, TRUE);
3193  }
3194  }
3195  else if (TEST_OPT_PROT) PrintLn();
3196 
3197  /* release temp data-------------------------------- */
3198  exitBuchMora(strat);
3199 // if (TEST_OPT_WEIGHTM)
3200 // {
3201 // pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
3202 // if (ecartWeights)
3203 // {
3204 // omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3205 // ecartWeights=NULL;
3206 // }
3207 // }
3208  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
3209  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3210  return (strat->Shdl);
3211 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define TEST_OPT_DEGBOUND
Definition: options.h:108
void initBuchMoraPos(kStrategy strat)
Definition: kutil.cc:7466
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
class sLObject LObject
Definition: kutil.h:58
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
char noClearS
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
int k
Definition: cfEzgcd.cc:93
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
Definition: kutil.cc:9571
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
int minim
Definition: kutil.h:361
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void updateSShift(kStrategy strat, int uptodeg, int lV)
Definition: kutil.cc:9021
BOOLEAN interpt
Definition: kutil.h:365
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:509
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:9678
int lV
Definition: kutil.h:363
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define kTest_TS(A)
Definition: kutil.h:616
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:7305
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:376
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
ideal M
Definition: kutil.h:303
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
void initBuchMoraShift(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:9049
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
kStrategy strat
Definition: myNF.cc:319
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
static int bba_count
Definition: kstd2.cc:1334
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:491
void initBbaShift(ideal, kStrategy strat)
Definition: kstd2.cc:3374
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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
omBin lmBin
Definition: kutil.h:344
BOOLEAN use_buckets
Definition: kutil.h:377
int Kstd1_deg
Definition: kutil.cc:228
int BOOLEAN
Definition: auxiliary.h:131
void exitBuchMora(kStrategy strat)
Definition: kutil.cc:7637
void f5c ( kStrategy  strat,
int olddeg,
int minimcnt,
int hilbeledeg,
int hilbcount,
int srmax,
int lrmax,
int reduc,
ideal  Q,
intvec w,
intvec hilb 
)

Definition at line 2551 of file kstd2.cc.

2554 {
2555  int Ll_old, red_result = 1;
2556  int pos = 0;
2557  hilbeledeg=1;
2558  hilbcount=0;
2559  minimcnt=0;
2560  srmax = 0; // strat->sl is 0 at this point
2561  reduc = olddeg = lrmax = 0;
2562  // we cannot use strat->T anymore
2563  //cleanT(strat);
2564  //strat->tl = -1;
2565  Ll_old = strat->Ll;
2566  while (strat->tl >= 0)
2567  {
2568  if(!strat->T[strat->tl].is_redundant)
2569  {
2570  LObject h;
2571  h.p = strat->T[strat->tl].p;
2572  h.tailRing = strat->T[strat->tl].tailRing;
2573  h.t_p = strat->T[strat->tl].t_p;
2574  if (h.p!=NULL)
2575  {
2576  if (currRing->OrdSgn==-1)
2577  {
2578  cancelunit(&h);
2579  deleteHC(&h, strat);
2580  }
2581  if (h.p!=NULL)
2582  {
2584  {
2585  //pContent(h.p);
2586  h.pCleardenom(); // also does a pContent
2587  }
2588  else
2589  {
2590  h.pNorm();
2591  }
2592  strat->initEcart(&h);
2593  pos = strat->Ll+1;
2594  h.sev = pGetShortExpVector(h.p);
2595  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
2596  }
2597  }
2598  }
2599  strat->tl--;
2600  }
2601  strat->sl = -1;
2602 #if 0
2603 //#ifdef HAVE_TAIL_RING
2604  if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
2605  kStratInitChangeTailRing(strat);
2606 #endif
2607  //enterpairs(pOne(),0,0,-1,strat,strat->tl);
2608  //strat->sl = -1;
2609  /* picks the last element from the lazyset L */
2610  while (strat->Ll>Ll_old)
2611  {
2612  strat->P = strat->L[strat->Ll];
2613  strat->Ll--;
2614 //#if 1
2615 #ifdef DEBUGF5
2616  Print("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
2617  Print("-------------------------------------------------\n");
2618  pWrite(pHead(strat->P.p));
2619  pWrite(pHead(strat->P.p1));
2620  pWrite(pHead(strat->P.p2));
2621  printf("%d\n",strat->tl);
2622  Print("-------------------------------------------------\n");
2623 #endif
2624  if (pNext(strat->P.p) == strat->tail)
2625  {
2626  // deletes the short spoly
2627 #ifdef HAVE_RINGS
2628  if (rField_is_Ring(currRing))
2629  pLmDelete(strat->P.p);
2630  else
2631 #endif
2632  pLmFree(strat->P.p);
2633 
2634  // TODO: needs some masking
2635  // TODO: masking needs to vanish once the signature
2636  // sutff is completely implemented
2637  strat->P.p = NULL;
2638  poly m1 = NULL, m2 = NULL;
2639 
2640  // check that spoly creation is ok
2641  while (strat->tailRing != currRing &&
2642  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
2643  {
2644  assume(m1 == NULL && m2 == NULL);
2645  // if not, change to a ring where exponents are at least
2646  // large enough
2647  if (!kStratChangeTailRing(strat))
2648  {
2649  WerrorS("OVERFLOW...");
2650  break;
2651  }
2652  }
2653  // create the real one
2654  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
2655  strat->tailRing, m1, m2, strat->R);
2656  }
2657  else if (strat->P.p1 == NULL)
2658  {
2659  if (strat->minim > 0)
2660  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
2661  // for input polys, prepare reduction
2662  strat->P.PrepareRed(strat->use_buckets);
2663  }
2664 
2665  if (strat->P.p == NULL && strat->P.t_p == NULL)
2666  {
2667  red_result = 0;
2668  }
2669  else
2670  {
2671  if (TEST_OPT_PROT)
2672  message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
2673  &olddeg,&reduc,strat, red_result);
2674 
2675 #ifdef DEBUGF5
2676  Print("Poly before red: ");
2677  pWrite(strat->P.p);
2678 #endif
2679  /* complete reduction of the element chosen from L */
2680  red_result = strat->red2(&strat->P,strat);
2681  if (errorreported) break;
2682  }
2683 
2684  if (strat->overflow)
2685  {
2686  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
2687  }
2688 
2689  // reduction to non-zero new poly
2690  if (red_result == 1)
2691  {
2692  // get the polynomial (canonicalize bucket, make sure P.p is set)
2693  strat->P.GetP(strat->lmBin);
2694  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
2695  // but now, for entering S, T, we reset it
2696  // in the inhomogeneous case: FDeg == pFDeg
2697  if (strat->homog) strat->initEcart(&(strat->P));
2698 
2699  /* statistic */
2700  if (TEST_OPT_PROT) PrintS("s");
2701 
2702  int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
2703 
2704 #ifdef KDEBUG
2705 #if MYTEST
2706  PrintS("New S: "); pDebugPrint(strat->P.p); PrintLn();
2707 #endif /* MYTEST */
2708 #endif /* KDEBUG */
2709 
2710  // reduce the tail and normalize poly
2711  // in the ring case we cannot expect LC(f) = 1,
2712  // therefore we call pContent instead of pNorm
2713 #if F5CTAILRED
2714  BOOLEAN withT = TRUE;
2716  {
2717  strat->P.pCleardenom();
2719  {
2720  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2721  strat->P.pCleardenom();
2722  }
2723  }
2724  else
2725  {
2726  strat->P.pNorm();
2728  strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
2729  }
2730 #endif
2731 #ifdef KDEBUG
2732  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2733 #if MYTEST
2734 //#if 1
2735  PrintS("New (reduced) S: "); pDebugPrint(strat->P.p); PrintLn();
2736 #endif /* MYTEST */
2737 #endif /* KDEBUG */
2738 
2739  // min_std stuff
2740  if ((strat->P.p1==NULL) && (strat->minim>0))
2741  {
2742  if (strat->minim==1)
2743  {
2744  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2745  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2746  }
2747  else
2748  {
2749  strat->M->m[minimcnt]=strat->P.p2;
2750  strat->P.p2=NULL;
2751  }
2752  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2753  pNext(strat->M->m[minimcnt])
2754  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2755  strat->tailRing, currRing,
2756  currRing->PolyBin);
2757  minimcnt++;
2758  }
2759 
2760  // enter into S, L, and T
2761  // here we need to recompute new signatures, but those are trivial ones
2762  if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2763  {
2764  enterT(strat->P, strat);
2765  // posInS only depends on the leading term
2766  strat->enterS(strat->P, pos, strat, strat->tl);
2767 //#if 1
2768 #ifdef DEBUGF5
2769  Print("ELEMENT ADDED TO GCURR DURING INTERRED: ");
2770  pWrite(pHead(strat->S[strat->sl]));
2771  pWrite(strat->sig[strat->sl]);
2772 #endif
2773  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2774  }
2775  // Print("[%d]",hilbeledeg);
2776  if (strat->P.lcm!=NULL)
2777 #ifdef HAVE_RINGS
2778  pLmDelete(strat->P.lcm);
2779 #else
2780  pLmFree(strat->P.lcm);
2781 #endif
2782  if (strat->sl>srmax) srmax = strat->sl;
2783  }
2784  else
2785  {
2786  // adds signature of the zero reduction to
2787  // strat->syz. This is the leading term of
2788  // syzygy and can be used in syzCriterion()
2789  // the signature is added if and only if the
2790  // pair was not detected by the rewritten criterion in strat->red = redSig
2791  if (strat->P.p1 == NULL && strat->minim > 0)
2792  {
2793  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2794  }
2795  }
2796 
2797 #ifdef KDEBUG
2798  memset(&(strat->P), 0, sizeof(strat->P));
2799 #endif /* KDEBUG */
2800  }
2801  int cc = 0;
2802  while (cc<strat->tl+1)
2803  {
2804  strat->T[cc].sig = pOne();
2805  p_SetComp(strat->T[cc].sig,cc+1,currRing);
2806  strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
2807  strat->sig[cc] = strat->T[cc].sig;
2808  strat->sevSig[cc] = strat->T[cc].sevSig;
2809  strat->T[cc].is_sigsafe = TRUE;
2810  cc++;
2811  }
2812  strat->max_lower_index = strat->tl;
2813  // set current signature index of upcoming iteration step
2814  // NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
2815  // the corresponding syzygy rules correctly
2816  strat->currIdx = cc+1;
2817  for (int cd=strat->Ll; cd>=0; cd--)
2818  {
2819  p_SetComp(strat->L[cd].sig,cc+1,currRing);
2820  cc++;
2821  }
2822  for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
2823  strat->Shdl->m[cc] = NULL;
2824 //#if 1
2825 #if DEBUGF5
2826  Print("------------------- STRAT S ---------------------\n");
2827  cc = 0;
2828  while (cc<strat->tl+1)
2829  {
2830  pWrite(pHead(strat->S[cc]));
2831  pWrite(strat->sig[cc]);
2832  printf("- - - - - -\n");
2833  cc++;
2834  }
2835  Print("-------------------------------------------------\n");
2836  Print("------------------- STRAT T ---------------------\n");
2837  cc = 0;
2838  while (cc<strat->tl+1)
2839  {
2840  pWrite(pHead(strat->T[cc].p));
2841  pWrite(strat->T[cc].sig);
2842  printf("- - - - - -\n");
2843  cc++;
2844  }
2845  Print("-------------------------------------------------\n");
2846  Print("------------------- STRAT L ---------------------\n");
2847  cc = 0;
2848  while (cc<strat->Ll+1)
2849  {
2850  pWrite(pHead(strat->L[cc].p));
2851  pWrite(pHead(strat->L[cc].p1));
2852  pWrite(pHead(strat->L[cc].p2));
2853  pWrite(strat->L[cc].sig);
2854  printf("- - - - - -\n");
2855  cc++;
2856  }
2857  Print("-------------------------------------------------\n");
2858  printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
2859 #endif
2860 
2861 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition: kutil.cc:5628
CanonicalForm cd(bCommonDen(FF))
Definition: cfModGcd.cc:4030
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
void pWrite(poly p)
Definition: polys.h:279
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define Q
Definition: sirandom.c:25
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define pGetComp(p)
Component.
Definition: polys.h:37
int minim
Definition: kutil.h:361
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:376
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define pOne()
Definition: polys.h:286
TObject ** R
Definition: kutil.h:340
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:19
short errorreported
Definition: feFopen.cc:22
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
kStrategy strat
Definition: myNF.cc:319
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
#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
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void Werror(const char *fmt,...)
Definition: reporter.cc:199
ideal freegb ( ideal  I,
int  uptodeg,
int  lVblock 
)

Definition at line 3214 of file kstd2.cc.

3215 {
3216  /* todo main call */
3217 
3218  /* assume: ring is prepared, ideal is copied into shifted ring */
3219  /* uptodeg and lVblock are correct - test them! */
3220 
3221  /* check whether the ideal is in V */
3222 
3223 // if (0)
3224  if (! ideal_isInV(I,lVblock) )
3225  {
3226  WerrorS("The input ideal contains incorrectly encoded elements! ");
3227  return(NULL);
3228  }
3229 
3230  // kStrategy strat = new skStrategy;
3231  /* ideal bbaShift(ideal F, ideal Q,intvec *w,intvec *hilb,kStrategy strat, int uptodeg, int lV) */
3232  /* at the moment:
3233 - no quotient (check)
3234 - no *w, no *hilb
3235  */
3236  /* ideal F, ideal Q, tHomog h,intvec ** w, intvec *hilb,int syzComp,
3237  int newIdeal, intvec *vw) */
3238  ideal RS = kStdShift(I,NULL, testHomog, NULL,NULL,0,0,NULL, uptodeg, lVblock);
3239  //bbaShift(I,NULL, NULL, NULL, strat, uptodeg, lVblock);
3240  idSkipZeroes(RS);
3241  return(RS);
3242 }
int ideal_isInV(ideal I, int lV)
Definition: shiftgb.cc:444
const ideal
Definition: gb_hack.h:42
void WerrorS(const char *s)
Definition: feFopen.cc:23
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, int uptodeg, int lV)
Definition: kstd1.cc:2345
void idSkipZeroes(ideal ide)
#define NULL
Definition: omList.c:10
void initBbaShift ( ideal  ,
kStrategy  strat 
)

Definition at line 3374 of file kstd2.cc.

3375 {
3376  /* setting global variables ------------------- */
3377  strat->enterS = enterSBba; /* remains as is, we change enterT! */
3378 
3379  strat->red = redFirstShift; /* no redHomog ! */
3380 
3381  if (currRing->pLexOrder && strat->honey)
3382  strat->initEcart = initEcartNormal;
3383  else
3384  strat->initEcart = initEcartBBA;
3385  if (strat->honey)
3387  else
3389 // if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
3390 // {
3391 // //interred machen Aenderung
3392 // pFDegOld=currRing->pFDeg;
3393 // pLDegOld=pLDeg;
3394 // //h=ggetid("ecart");
3395 // //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
3396 // //{
3397 // // ecartWeights=iv2array(IDINTVEC(h));
3398 // //}
3399 // //else
3400 // {
3401 // ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
3402 // /*uses automatic computation of the ecartWeights to set them*/
3403 // kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights,currRing);
3404 // }
3405 // pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
3406 // if (TEST_OPT_PROT)
3407 // {
3408 // for(int i=1; i<=rVar(currRing); i++)
3409 // Print(" %d",ecartWeights[i]);
3410 // PrintLn();
3411 // mflush();
3412 // }
3413 // }
3414 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
BOOLEAN honey
Definition: kutil.h:371
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
int redFirstShift(LObject *h, kStrategy strat)
Definition: kstd2.cc:3248
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1147
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
void initEcartNormal(TObject *h)
Definition: kutil.cc:1125
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
void kDebugPrint ( kStrategy  strat)

Definition at line 8780 of file kutil.cc.

8781 {
8782  PrintS("red: ");
8783  if (strat->red==redFirst) PrintS("redFirst\n");
8784  else if (strat->red==redHoney) PrintS("redHoney\n");
8785  else if (strat->red==redEcart) PrintS("redEcart\n");
8786  else if (strat->red==redHomog) PrintS("redHomog\n");
8787  else Print("%p\n",(void*)strat->red);
8788  PrintS("posInT: ");
8789  if (strat->posInT==posInT0) PrintS("posInT0\n");
8790  else if (strat->posInT==posInT1) PrintS("posInT1\n");
8791  else if (strat->posInT==posInT11) PrintS("posInT11\n");
8792  else if (strat->posInT==posInT110) PrintS("posInT110\n");
8793  else if (strat->posInT==posInT13) PrintS("posInT13\n");
8794  else if (strat->posInT==posInT15) PrintS("posInT15\n");
8795  else if (strat->posInT==posInT17) PrintS("posInT17\n");
8796  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
8797  else if (strat->posInT==posInT19) PrintS("posInT19\n");
8798  else if (strat->posInT==posInT2) PrintS("posInT2\n");
8799 #ifdef HAVE_MORE_POS_IN_T
8800  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
8801  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
8802  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
8803 #endif
8804  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
8805  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
8806  else Print("%p\n",(void*)strat->posInT);
8807  PrintS("posInL: ");
8808  if (strat->posInL==posInL0) PrintS("posInL0\n");
8809  else if (strat->posInL==posInL10) PrintS("posInL10\n");
8810  else if (strat->posInL==posInL11) PrintS("posInL11\n");
8811  else if (strat->posInL==posInL110) PrintS("posInL110\n");
8812  else if (strat->posInL==posInL13) PrintS("posInL13\n");
8813  else if (strat->posInL==posInL15) PrintS("posInL15\n");
8814  else if (strat->posInL==posInL17) PrintS("posInL17\n");
8815  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
8816  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
8817  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
8818  else Print("%p\n",(void*)strat->posInL);
8819  PrintS("enterS: ");
8820  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
8821  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
8822  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
8823  else Print("%p\n",(void*)strat->enterS);
8824  PrintS("initEcart: ");
8825  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
8826  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
8827  else Print("%p\n",(void*)strat->initEcart);
8828  PrintS("initEcartPair: ");
8829  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
8830  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
8831  else Print("%p\n",(void*)strat->initEcartPair);
8832  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
8833  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
8834  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
8835  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
8836  Print("posInLDependsOnLength=%d\n",
8837  strat->posInLDependsOnLength);
8838  PrintS(showOption());PrintLn();
8839  PrintS("LDeg: ");
8840  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
8841  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
8842  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
8843  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
8844  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
8845  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
8846  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
8847  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
8848  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
8849  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
8850  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
8851  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
8852  else Print("? (%lx)", (long)currRing->pLDeg);
8853  PrintS(" / ");
8854  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
8855  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
8856  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
8857  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
8858  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
8859  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
8860  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
8861  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
8862  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
8863  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
8864  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
8865  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
8866  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
8867  PrintLn();
8868  PrintS("currRing->pFDeg: ");
8869  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
8870  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
8871  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
8872  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
8873  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
8874  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
8875  else Print("? (%lx)", (long)currRing->pFDeg);
8876  PrintLn();
8877  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
8878  if(TEST_OPT_DEGBOUND)
8879  Print(" degBound: %d\n", Kstd1_deg);
8880 
8881  if( ecartWeights != NULL )
8882  {
8883  PrintS("ecartWeights: ");
8884  for (int i = rVar(currRing); i > 0; i--)
8885  Print("%hd ", ecartWeights[i]);
8886  PrintLn();
8888  }
8889 
8890 #ifndef SING_NDEBUG
8892 #endif
8893 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8746
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4091
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
void PrintLn()
Definition: reporter.cc:322
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4004
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:357
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
BOOLEAN noTailReduction
Definition: kutil.h:372
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4734
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:705
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:708
void enterSMora(LObject p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1215
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
int ak
Definition: kutil.h:356
char * showOption()
Definition: misc_ip.cc:726
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4281
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:406
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
void rDebugPrint(ring r)
Definition: ring.cc:3971
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1004
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:366
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1147
BOOLEAN Gebauer
Definition: kutil.h:372
#define assume(x)
Definition: mod2.h:405
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2054
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4339
BOOLEAN sugarCrit
Definition: kutil.h:371
int Kstd1_deg
Definition: kutil.cc:228
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8655
#define TEST_OPT_WEIGHTM
Definition: options.h:115
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:810
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:176
ring tailRing
Definition: kutil.h:343
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
void enterSMoraNF(LObject p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1269
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:1037
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:574
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
BOOLEAN use_buckets
Definition: kutil.h:377
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
void initEcartNormal(TObject *h)
Definition: kutil.cc:1125
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
int LazyPass
Definition: kutil.h:356
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8709
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:947
int LazyDegree
Definition: kutil.h:356
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
int kFindDivisibleByInS ( const kStrategy  strat,
int max_ind,
LObject L 
)

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

Definition at line 149 of file kstd2.cc.

150 {
151  unsigned long not_sev = ~L->sev;
152  poly p = L->GetLmCurrRing();
153  int j = 0;
154 
155  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
156 #if 1
157  int ende;
158  if ((strat->ak>0) || currRing->pLexOrder) ende=strat->sl;
159  else ende=posInS(strat,*max_ind,p,0)+1;
160  if (ende>(*max_ind)) ende=(*max_ind);
161 #else
162  int ende=strat->sl;
163 #endif
164  (*max_ind)=ende;
165  loop
166  {
167  if (j > ende) return -1;
168 #if defined(PDEBUG) || defined(PDIV_DEBUG)
169  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
170  p, not_sev, currRing))
171  return j;
172 #else
173  if ( !(strat->sevS[j] & not_sev) &&
174  p_LmDivisibleBy(strat->S[j], p, currRing))
175  return j;
176 #endif
177  j++;
178  }
179 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int & max_ind
Definition: myNF.cc:67
int ak
Definition: kutil.h:356
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
int kFindDivisibleByInT ( const TSet T,
const unsigned long *  sevT,
const int  tl,
const LObject L,
const int  start 
)

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

Definition at line 101 of file kstd2.cc.

103 {
104  unsigned long not_sev = ~L->sev;
105  int j = start;
106  poly p=L->p;
107  ring r=currRing;
108  L->GetLm(p, r);
109 
110  pAssume(~not_sev == p_GetShortExpVector(p, r));
111 
112  if (r == currRing)
113  {
114  loop
115  {
116  if (j > tl) return -1;
117 #if defined(PDEBUG) || defined(PDIV_DEBUG)
118  if (p_LmShortDivisibleBy(T[j].p, sevT[j],
119  p, not_sev, r))
120  return j;
121 #else
122  if (!(sevT[j] & not_sev) &&
123  p_LmDivisibleBy(T[j].p, p, r))
124  return j;
125 #endif
126  j++;
127  }
128  }
129  else
130  {
131  loop
132  {
133  if (j > tl) return -1;
134 #if defined(PDEBUG) || defined(PDIV_DEBUG)
135  if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
136  p, not_sev, r))
137  return j;
138 #else
139  if (!(sevT[j] & not_sev) &&
140  p_LmDivisibleBy(T[j].t_p, p, r))
141  return j;
142 #endif
143  j++;
144  }
145  }
146 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
static jList * T
Definition: janet.cc:37
int kFindNextDivisibleByInS ( const kStrategy  strat,
int  start,
int  max_ind,
LObject L 
)

Definition at line 181 of file kstd2.cc.

182 {
183  unsigned long not_sev = ~L->sev;
184  poly p = L->GetLmCurrRing();
185  int j = start;
186 
187  pAssume(~not_sev == p_GetShortExpVector(p, currRing));
188 #if 1
189  int ende=max_ind;
190 #else
191  int ende=strat->sl;
192 #endif
193  loop
194  {
195  if (j > ende) return -1;
196 #if defined(PDEBUG) || defined(PDIV_DEBUG)
197  if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
198  p, not_sev, currRing))
199  return j;
200 #else
201  if ( !(strat->sevS[j] & not_sev) &&
202  p_LmDivisibleBy(strat->S[j], p, currRing))
203  return j;
204 #endif
205  j++;
206  }
207 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pAssume(cond)
Definition: monomials.h:98
int & max_ind
Definition: myNF.cc:67
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
poly kFindZeroPoly ( poly  input_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 210 of file kstd2.cc.

211 {
212  // m = currRing->ch
213 
214  if (input_p == NULL) return NULL;
215 
216  poly p = input_p;
217  poly zeroPoly = NULL;
218  unsigned long a = (unsigned long) pGetCoeff(p);
219 
220  int k_ind2 = 0;
221  int a_ind2 = ind2(a);
222 
223  // unsigned long k = 1;
224  // of interest is only k_ind2, special routine for improvement ... TODO OLIVER
225  for (int i = 1; i <= leadRing->N; i++)
226  {
227  k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
228  }
229 
230  a = (unsigned long) pGetCoeff(p);
231 
232  number tmp1;
233  poly tmp2, tmp3;
234  poly lead_mult = p_ISet(1, tailRing);
235  if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
236  {
237  int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
238  int s_exp;
239  zeroPoly = p_ISet(a, tailRing);
240  for (int i = 1; i <= leadRing->N; i++)
241  {
242  s_exp = p_GetExp(p, i,leadRing);
243  if (s_exp % 2 != 0)
244  {
245  s_exp = s_exp - 1;
246  }
247  while ( (0 < ind2(s_exp)) && (ind2(s_exp) <= too_much) )
248  {
249  too_much = too_much - ind2(s_exp);
250  s_exp = s_exp - 2;
251  }
252  p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
253  for (unsigned long j = 1; j <= s_exp; j++)
254  {
255  tmp1 = nInit(j);
256  tmp2 = p_ISet(1, tailRing);
257  p_SetExp(tmp2, i, 1, tailRing);
258  p_Setm(tmp2, tailRing);
259  if (nIsZero(tmp1))
260  { // should nowbe obsolet, test ! TODO OLIVER
261  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
262  }
263  else
264  {
265  tmp3 = p_NSet(nCopy(tmp1), tailRing);
266  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
267  }
268  }
269  }
270  p_Setm(lead_mult, tailRing);
271  zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
272  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
273  for (int i = 1; i <= leadRing->N; i++)
274  {
275  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
276  }
277  p_Setm(tmp2, leadRing);
278  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
279  pNext(tmp2) = zeroPoly;
280  return tmp2;
281  }
282 /* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
283  if (1 == 0 && alpha_k <= a)
284  { // Temporarly disabled, reducing coefficients not compatible with std TODO Oliver
285  zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
286  for (int i = 1; i <= leadRing->N; i++)
287  {
288  for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
289  {
290  tmp1 = nInit(j);
291  tmp2 = p_ISet(1, tailRing);
292  p_SetExp(tmp2, i, 1, tailRing);
293  p_Setm(tmp2, tailRing);
294  if (nIsZero(tmp1))
295  {
296  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
297  }
298  else
299  {
300  tmp3 = p_ISet((unsigned long) tmp1, tailRing);
301  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
302  }
303  }
304  }
305  tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
306  for (int i = 1; i <= leadRing->N; i++)
307  {
308  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
309  }
310  p_Setm(tmp2, leadRing);
311  zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
312  pNext(tmp2) = zeroPoly;
313  return tmp2;
314  } */
315  return NULL;
316 }
const poly a
Definition: syzextra.cc:212
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:721
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:973
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition: coeffs.h:444
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
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:465
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:3048
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
long ind2(long arg)
Definition: kutil.cc:3036
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1302
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1025
poly kNF2 ( ideal  F,
ideal  Q,
poly  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 2395 of file kstd2.cc.

2396 {
2397  assume(q!=NULL);
2398  assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
2399 
2400 // lazy_reduce flags: can be combined by |
2401 //#define KSTD_NF_LAZY 1
2402  // do only a reduction of the leading term
2403 //#define KSTD_NF_NONORM 4
2404  // only global: avoid normalization, return a multiply of NF
2405  poly p;
2406 
2407  //if ((idIs0(F))&&(Q==NULL))
2408  // return pCopy(q); /*F=0*/
2409  //strat->ak = idRankFreeModule(F);
2410  /*- creating temp data structures------------------- -*/
2411  BITSET save1;
2412  SI_SAVE_OPT1(save1);
2414  initBuchMoraCrit(strat);
2415  strat->initEcart = initEcartBBA;
2416  strat->enterS = enterSBba;
2417 #ifndef NO_BUCKETS
2419 #endif
2420  /*- set S -*/
2421  strat->sl = -1;
2422  /*- init local data struct.---------------------------------------- -*/
2423  /*Shdl=*/initS(F,Q,strat);
2424  /*- compute------------------------------------------------------- -*/
2425  //if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
2426  //{
2427  // for (i=strat->sl;i>=0;i--)
2428  // pNorm(strat->S[i]);
2429  //}
2430  kTest(strat);
2431  if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2432  if (BVERBOSE(23)) kDebugPrint(strat);
2433  int max_ind;
2434  p = redNF(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2435  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2436  {
2437  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2438  #ifdef HAVE_RINGS
2439  if (rField_is_Ring(currRing))
2440  {
2441  p = redtailBba_Z(p,max_ind,strat);
2442  }
2443  else
2444  #endif
2445  {
2447  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2448  }
2449  }
2450  /*- release temp data------------------------------- -*/
2451  assume(strat->L==NULL); /* strat->L unused */
2452  assume(strat->B==NULL); /* strat->B unused */
2453  omFree(strat->sevS);
2454  omFree(strat->ecartS);
2455  assume(strat->T==NULL);//omfree(strat->T);
2456  assume(strat->sevT==NULL);//omfree(strat->sevT);
2457  assume(strat->R==NULL);//omfree(strat->R);
2458  omfree(strat->S_2_R);
2459  omfree(strat->fromQ);
2460  idDelete(&strat->Shdl);
2461  SI_RESTORE_OPT1(save1);
2462  if (TEST_OPT_PROT) PrintLn();
2463  return p;
2464 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:322
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int & max_ind
Definition: myNF.cc:67
#define kTest(A)
Definition: kutil.h:615
unsigned long * sevT
Definition: kutil.h:323
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:17
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1189
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:42
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5733
#define KSTD_NF_LAZY
Definition: kstd1.h:15
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
#define omfree(addr)
Definition: omAllocDecl.h:237
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
void PrintS(const char *s)
Definition: reporter.cc:294
TObject ** R
Definition: kutil.h:340
#define OPT_INTSTRATEGY
Definition: options.h:87
#define BVERBOSE(a)
Definition: options.h:33
#define KSTD_NF_NONORM
Definition: kstd1.h:19
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
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:156
ideal kNF2 ( ideal  F,
ideal  Q,
ideal  q,
kStrategy  strat,
int  lazyReduce 
)

Definition at line 2466 of file kstd2.cc.

2467 {
2468  assume(!idIs0(q));
2469  assume(!(idIs0(F)&&(Q==NULL)));
2470 // lazy_reduce flags: can be combined by |
2471 //#define KSTD_NF_LAZY 1
2472  // do only a reduction of the leading term
2473 //#define KSTD_NF_NONORM 4
2474  // only global: avoid normalization, return a multiply of NF
2475  poly p;
2476  int i;
2477  ideal res;
2478  int max_ind;
2479 
2480  //if (idIs0(q))
2481  // return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2482  //if ((idIs0(F))&&(Q==NULL))
2483  // return idCopy(q); /*F=0*/
2484  //strat->ak = idRankFreeModule(F);
2485  /*- creating temp data structures------------------- -*/
2486  BITSET save1;
2487  SI_SAVE_OPT1(save1);
2489  initBuchMoraCrit(strat);
2490  strat->initEcart = initEcartBBA;
2491  strat->enterS = enterSBba;
2492  /*- set S -*/
2493  strat->sl = -1;
2494 #ifndef NO_BUCKETS
2496 #endif
2497  /*- init local data struct.---------------------------------------- -*/
2498  /*Shdl=*/initS(F,Q,strat);
2499  /*- compute------------------------------------------------------- -*/
2500  res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
2502  for (i=IDELEMS(q)-1; i>=0; i--)
2503  {
2504  if (q->m[i]!=NULL)
2505  {
2506  if (TEST_OPT_PROT) { PrintS("r");mflush(); }
2507  p = redNF(pCopy(q->m[i]),max_ind,lazyReduce & KSTD_NF_NONORM,strat);
2508  if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2509  {
2510  if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2511  #ifdef HAVE_RINGS
2512  if (rField_is_Ring(currRing))
2513  {
2514  p = redtailBba_Z(p,max_ind,strat);
2515  }
2516  else
2517  #endif
2518  {
2519  p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
2520  }
2521  }
2522  res->m[i]=p;
2523  }
2524  //else
2525  // res->m[i]=NULL;
2526  }
2527  /*- release temp data------------------------------- -*/
2528  assume(strat->L==NULL); /* strat->L unused */
2529  assume(strat->B==NULL); /* strat->B unused */
2530  omFree(strat->sevS);
2531  omFree(strat->ecartS);
2532  assume(strat->T==NULL);//omfree(strat->T);
2533  assume(strat->sevT==NULL);//omfree(strat->sevT);
2534  assume(strat->R==NULL);//omfree(strat->R);
2535  omfree(strat->S_2_R);
2536  omfree(strat->fromQ);
2537  idDelete(&strat->Shdl);
2538  SI_RESTORE_OPT1(save1);
2539  if (TEST_OPT_PROT) PrintLn();
2540  return res;
2541 }
unsigned si_opt_1
Definition: options.c:5
void PrintLn()
Definition: reporter.cc:322
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition: kInline.h:1127
#define TEST_OPT_PROT
Definition: options.h:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
int & max_ind
Definition: myNF.cc:67
unsigned long * sevT
Definition: kutil.h:323
#define SI_SAVE_OPT1(A)
Definition: options.h:20
#define Q
Definition: sirandom.c:25
#define BITSET
Definition: structs.h:17
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition: kInline.h:1120
#define Sy_bit(x)
Definition: options.h:30
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition: kstd2.cc:1189
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
#define mflush()
Definition: reporter.h:42
poly res
Definition: myNF.cc:322
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void initS(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5733
#define KSTD_NF_LAZY
Definition: kstd1.h:15
#define OPT_REDTAIL
Definition: options.h:86
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
#define omfree(addr)
Definition: omAllocDecl.h:237
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
void initBuchMoraCrit(kStrategy strat)
Definition: kutil.cc:7325
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
#define OPT_INTSTRATEGY
Definition: options.h:87
#define KSTD_NF_NONORM
Definition: kstd1.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
BOOLEAN idIs0(ideal h)
#define SI_RESTORE_OPT1(A)
Definition: options.h:23
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:156
KINLINE int ksReducePolyTailSig ( LObject PR,
TObject PW,
LObject Red 
)

Definition at line 529 of file kstd2.cc.

530 {
531  BOOLEAN ret;
532  number coef;
533 
534  assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
535  Red->HeadNormalize();
536  /*
537  printf("------------------------\n");
538  pWrite(Red->GetLmCurrRing());
539  */
540  ret = ksReducePolySig(Red, PW, 1, NULL, &coef);
541 
542 
543  if (!ret)
544  {
545  if (! n_IsOne(coef, currRing->cf))
546  {
547  PR->Mult_nn(coef);
548  // HANNES: mark for Normalize
549  }
550  n_Delete(&coef, currRing->cf);
551  }
552  return ret;
553 }
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:172
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
int BOOLEAN
Definition: auxiliary.h:131
int redFirstShift ( LObject h,
kStrategy  strat 
)

Definition at line 3248 of file kstd2.cc.

3249 {
3250  if (h->IsNull()) return 0;
3251 
3252  int at, reddeg,d;
3253  int pass = 0;
3254  int j = 0;
3255 
3256  if (! strat->homog)
3257  {
3258  d = h->GetpFDeg() + h->ecart;
3259  reddeg = strat->LazyDegree+d;
3260  }
3261  h->SetShortExpVector();
3262  loop
3263  {
3264  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
3265  if (j < 0)
3266  {
3267  h->SetDegStuffReturnLDeg(strat->LDegLast);
3268  return 1;
3269  }
3270 
3271  if (!TEST_OPT_INTSTRATEGY)
3272  strat->T[j].pNorm();
3273 #ifdef KDEBUG
3274  if (TEST_OPT_DEBUG)
3275  {
3276  PrintS("reduce ");
3277  h->wrp();
3278  PrintS(" with ");
3279  strat->T[j].wrp();
3280  }
3281 #endif
3282  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
3283  if (!h->IsNull())
3284  {
3285  poly qq=p_Shrink(h->GetTP(),strat->lV,strat->tailRing);
3286  h->p=NULL;
3287  h->t_p=qq;
3288  if (qq!=NULL) h->GetP(strat->lmBin);
3289  }
3290 
3291 #ifdef KDEBUG
3292  if (TEST_OPT_DEBUG)
3293  {
3294  PrintS(" to ");
3295  wrp(h->p);
3296  PrintLn();
3297  }
3298 #endif
3299  if (h->IsNull())
3300  {
3301  if (h->lcm!=NULL) pLmFree(h->lcm);
3302  h->Clear();
3303  return 0;
3304  }
3305  h->SetShortExpVector();
3306 
3307 #if 0
3308  if ((strat->syzComp!=0) && !strat->honey)
3309  {
3310  if ((strat->syzComp>0) &&
3311  (h->Comp() > strat->syzComp))
3312  {
3313  assume(h->MinComp() > strat->syzComp);
3314 #ifdef KDEBUG
3315  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
3316 #endif
3317  if (strat->homog)
3318  h->SetDegStuffReturnLDeg(strat->LDegLast);
3319  return -2;
3320  }
3321  }
3322 #endif
3323  if (!strat->homog)
3324  {
3325  if (!TEST_OPT_OLDSTD && strat->honey)
3326  {
3327  h->SetpFDeg();
3328  if (strat->T[j].ecart <= h->ecart)
3329  h->ecart = d - h->GetpFDeg();
3330  else
3331  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
3332 
3333  d = h->GetpFDeg() + h->ecart;
3334  }
3335  else
3336  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
3337  /*- try to reduce the s-polynomial -*/
3338  pass++;
3339  /*
3340  *test whether the polynomial should go to the lazyset L
3341  *-if the degree jumps
3342  *-if the number of pre-defined reductions jumps
3343  */
3344  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
3345  && ((d >= reddeg) || (pass > strat->LazyPass)))
3346  {
3347  h->SetLmCurrRing();
3348  if (strat->posInLDependsOnLength)
3349  h->SetLength(strat->length_pLength);
3350  at = strat->posInL(strat->L,strat->Ll,h,strat);
3351  if (at <= strat->Ll)
3352  {
3353  int dummy=strat->sl;
3354  /* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
3355  if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
3356  return 1;
3357  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
3358 #ifdef KDEBUG
3359  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
3360 #endif
3361  h->Clear();
3362  return -1;
3363  }
3364  }
3365  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
3366  {
3367  reddeg = d+1;
3368  Print(".%d",d);mflush();
3369  }
3370  }
3371  }
3372 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:357
BOOLEAN length_pLength
Definition: kutil.h:382
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int tl
Definition: kutil.h:353
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define mflush()
Definition: reporter.h:42
poly p_Shrink(poly p, int lV, const ring r)
Definition: shiftgb.cc:509
int lV
Definition: kutil.h:363
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:405
void PrintS(const char *s)
Definition: reporter.cc:294
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
BOOLEAN LDegLast
Definition: kutil.h:380
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
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:351
TSet T
Definition: kutil.h:324
omBin lmBin
Definition: kutil.h:344
void wrp(poly p)
Definition: polys.h:281
int LazyPass
Definition: kutil.h:356
#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:356
int redHomog ( LObject h,
kStrategy  strat 
)

Definition at line 406 of file kstd2.cc.

407 {
408  if (strat->tl<0) return 1;
409  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
410  assume(h->FDeg == h->pFDeg());
411 
412  poly h_p;
413  int i,j,at,pass, ii;
414  unsigned long not_sev;
415  // long reddeg,d;
416 
417  pass = j = 0;
418  // d = reddeg = h->GetpFDeg();
419  h->SetShortExpVector();
420  int li;
421  h_p = h->GetLmTailRing();
422  not_sev = ~ h->sev;
423  loop
424  {
425  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
426  if (j < 0) return 1;
427 
428  li = strat->T[j].pLength;
429  ii = j;
430  /*
431  * the polynomial to reduce with (up to the moment) is;
432  * pi with length li
433  */
434  i = j;
435 #if 1
436  if (TEST_OPT_LENGTH)
437  loop
438  {
439  /*- search the shortest possible with respect to length -*/
440  i++;
441  if (i > strat->tl)
442  break;
443  if (li<=1)
444  break;
445  if ((strat->T[i].pLength < li)
446  &&
447  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
448  h_p, not_sev, strat->tailRing))
449  {
450  /*
451  * the polynomial to reduce with is now;
452  */
453  li = strat->T[i].pLength;
454  ii = i;
455  }
456  }
457 #endif
458 
459  /*
460  * end of search: have to reduce with pi
461  */
462 #ifdef KDEBUG
463  if (TEST_OPT_DEBUG)
464  {
465  PrintS("red:");
466  h->wrp();
467  PrintS(" with ");
468  strat->T[ii].wrp();
469  }
470 #endif
471  assume(strat->fromT == FALSE);
472 
473  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
474 #if SBA_PRINT_REDUCTION_STEPS
475  sba_interreduction_steps++;
476 #endif
477 #if SBA_PRINT_OPERATIONS
478  sba_interreduction_operations += pLength(strat->T[ii].p);
479 #endif
480 
481 #ifdef KDEBUG
482  if (TEST_OPT_DEBUG)
483  {
484  PrintS("\nto ");
485  h->wrp();
486  PrintLn();
487  }
488 #endif
489 
490  h_p = h->GetLmTailRing();
491  if (h_p == NULL)
492  {
493  if (h->lcm!=NULL) pLmFree(h->lcm);
494 #ifdef KDEBUG
495  h->lcm=NULL;
496 #endif
497  return 0;
498  }
499  h->SetShortExpVector();
500  not_sev = ~ h->sev;
501  /*
502  * try to reduce the s-polynomial h
503  *test first whether h should go to the lazyset L
504  *-if the degree jumps
505  *-if the number of pre-defined reductions jumps
506  */
507  pass++;
508  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
509  {
510  h->SetLmCurrRing();
511  at = strat->posInL(strat->L,strat->Ll,h,strat);
512  if (at <= strat->Ll)
513  {
514  int dummy=strat->sl;
515  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
516  return 1;
517  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
518 #ifdef KDEBUG
519  if (TEST_OPT_DEBUG)
520  Print(" lazy: -> L%d\n",at);
521 #endif
522  h->Clear();
523  return -1;
524  }
525  }
526  }
527 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int tl
Definition: kutil.h:353
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
static int pLength(poly a)
Definition: p_polys.h:189
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
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:351
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int redHoney ( LObject h,
kStrategy  strat 
)

Definition at line 1004 of file kstd2.cc.

1005 {
1006  if (strat->tl<0) return 1;
1007  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
1008  assume(h->FDeg == h->pFDeg());
1009  poly h_p;
1010  int i,j,at,pass,ei, ii, h_d;
1011  unsigned long not_sev;
1012  long reddeg,d;
1013 
1014  pass = j = 0;
1015  d = reddeg = h->GetpFDeg() + h->ecart;
1016  h->SetShortExpVector();
1017  int li;
1018  h_p = h->GetLmTailRing();
1019  not_sev = ~ h->sev;
1020 
1021  h->PrepareRed(strat->use_buckets);
1022  loop
1023  {
1024  j=kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
1025  if (j < 0) return 1;
1026 
1027  ei = strat->T[j].ecart;
1028  li = strat->T[j].pLength;
1029  ii = j;
1030  /*
1031  * the polynomial to reduce with (up to the moment) is;
1032  * pi with ecart ei
1033  */
1034  i = j;
1035  if (TEST_OPT_LENGTH)
1036  loop
1037  {
1038  /*- takes the first possible with respect to ecart -*/
1039  i++;
1040  if (i > strat->tl)
1041  break;
1042  //if (ei < h->ecart)
1043  // break;
1044  if (li<=1)
1045  break;
1046  if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
1047  || ((strat->T[i].ecart <= h->ecart) && (strat->T[i].pLength < li)))
1048  &&
1049  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
1050  h_p, not_sev, strat->tailRing))
1051  {
1052  /*
1053  * the polynomial to reduce with is now;
1054  */
1055  ei = strat->T[i].ecart;
1056  li = strat->T[i].pLength;
1057  ii = i;
1058  }
1059  }
1060 
1061  /*
1062  * end of search: have to reduce with pi
1063  */
1064  if (!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart))
1065  {
1066  h->GetTP(); // clears bucket
1067  h->SetLmCurrRing();
1068  /*
1069  * It is not possible to reduce h with smaller ecart;
1070  * if possible h goes to the lazy-set L,i.e
1071  * if its position in L would be not the last one
1072  */
1073  if (strat->Ll >= 0) /* L is not empty */
1074  {
1075  at = strat->posInL(strat->L,strat->Ll,h,strat);
1076  if(at <= strat->Ll)
1077  /*- h will not become the next element to reduce -*/
1078  {
1079  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1080 #ifdef KDEBUG
1081  if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
1082 #endif
1083  h->Clear();
1084  return -1;
1085  }
1086  }
1087  }
1088 #ifdef KDEBUG
1089  if (TEST_OPT_DEBUG)
1090  {
1091  PrintS("red:");
1092  h->wrp();
1093  PrintS(" with ");
1094  strat->T[ii].wrp();
1095  }
1096 #endif
1097  assume(strat->fromT == FALSE);
1098 
1099  number coef;
1100  ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),&coef,strat);
1101 #if SBA_PRINT_REDUCTION_STEPS
1102  sba_interreduction_steps++;
1103 #endif
1104 #if SBA_PRINT_OPERATIONS
1105  sba_interreduction_operations += pLength(strat->T[ii].p);
1106 #endif
1107 #ifdef KDEBUG
1108  if (TEST_OPT_DEBUG)
1109  {
1110  PrintS("\nto:");
1111  h->wrp();
1112  PrintLn();
1113  }
1114 #endif
1115  if(h->IsNull())
1116  {
1117  h->Clear();
1118  if (h->lcm!=NULL) pLmFree(h->lcm);
1119  #ifdef KDEBUG
1120  h->lcm=NULL;
1121  #endif
1122  return 0;
1123  }
1124  h->SetShortExpVector();
1125  not_sev = ~ h->sev;
1126  h_d = h->SetpFDeg();
1127  /* compute the ecart */
1128  if (ei <= h->ecart)
1129  h->ecart = d-h_d;
1130  else
1131  h->ecart = d-h_d+ei-h->ecart;
1132 
1133  /*
1134  * try to reduce the s-polynomial h
1135  *test first whether h should go to the lazyset L
1136  *-if the degree jumps
1137  *-if the number of pre-defined reductions jumps
1138  */
1139  pass++;
1140  d = h_d + h->ecart;
1141  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
1142  {
1143  h->GetTP(); // clear bucket
1144  h->SetLmCurrRing();
1145  at = strat->posInL(strat->L,strat->Ll,h,strat);
1146  if (at <= strat->Ll)
1147  {
1148  int dummy=strat->sl;
1149  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
1150  return 1;
1151  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1152 #ifdef KDEBUG
1153  if (TEST_OPT_DEBUG)
1154  Print(" degree jumped: -> L%d\n",at);
1155 #endif
1156  h->Clear();
1157  return -1;
1158  }
1159  }
1160  else if (d > reddeg)
1161  {
1162  if (d>=strat->tailRing->bitmask)
1163  {
1164  if (h->pTotalDeg()+h->ecart >= strat->tailRing->bitmask)
1165  {
1166  strat->overflow=TRUE;
1167  //Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
1168  h->GetP();
1169  at = strat->posInL(strat->L,strat->Ll,h,strat);
1170  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
1171  h->Clear();
1172  return -1;
1173  }
1174  }
1175  else if (TEST_OPT_PROT && (strat->Ll < 0) )
1176  {
1177  //h->wrp(); Print("<%d>\n",h->GetpLength());
1178  reddeg = d;
1179  Print(".%ld",d); mflush();
1180  }
1181  }
1182  }
1183 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
static int pLength(poly a)
Definition: p_polys.h:189
#define mflush()
Definition: reporter.h:42
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
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:351
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int redLazy ( LObject h,
kStrategy  strat 
)

TEST_OPT_REDTHROUGH &&

Definition at line 844 of file kstd2.cc.

845 {
846  if (strat->tl<0) return 1;
847  int at,i,ii,li;
848  int j = 0;
849  int pass = 0;
850  assume(h->pFDeg() == h->FDeg);
851  long reddeg = h->GetpFDeg();
852  long d;
853  unsigned long not_sev;
854 
855  h->SetShortExpVector();
856  poly h_p = h->GetLmTailRing();
857  not_sev = ~ h->sev;
858  loop
859  {
860  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
861  if (j < 0) return 1;
862 
863  li = strat->T[j].pLength;
864  #if 0
865  if (li==0)
866  {
867  li=strat->T[j].pLength=pLength(strat->T[j].p);
868  }
869  #endif
870  ii = j;
871  /*
872  * the polynomial to reduce with (up to the moment) is;
873  * pi with length li
874  */
875 
876  i = j;
877 #if 1
878  if (TEST_OPT_LENGTH)
879  loop
880  {
881  /*- search the shortest possible with respect to length -*/
882  i++;
883  if (i > strat->tl)
884  break;
885  if (li<=1)
886  break;
887  #if 0
888  if (strat->T[i].pLength==0)
889  {
890  PrintS("!");
891  strat->T[i].pLength=pLength(strat->T[i].p);
892  }
893  #endif
894  if ((strat->T[i].pLength < li)
895  &&
896  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
897  h_p, not_sev, strat->tailRing))
898  {
899  /*
900  * the polynomial to reduce with is now;
901  */
902  PrintS("+");
903  li = strat->T[i].pLength;
904  ii = i;
905  }
906  }
907 #endif
908 
909  /*
910  * end of search: have to reduce with pi
911  */
912 
913 
914 #ifdef KDEBUG
915  if (TEST_OPT_DEBUG)
916  {
917  PrintS("red:");
918  h->wrp();
919  PrintS(" with ");
920  strat->T[ii].wrp();
921  }
922 #endif
923 
924  ksReducePoly(h, &(strat->T[ii]), NULL, NULL, strat);
925 #if SBA_PRINT_REDUCTION_STEPS
926  sba_interreduction_steps++;
927 #endif
928 #if SBA_PRINT_OPERATIONS
929  sba_interreduction_operations += pLength(strat->T[ii].p);
930 #endif
931 
932 #ifdef KDEBUG
933  if (TEST_OPT_DEBUG)
934  {
935  PrintS("\nto ");
936  h->wrp();
937  PrintLn();
938  }
939 #endif
940 
941  h_p=h->GetLmTailRing();
942 
943  if (h_p == NULL)
944  {
945  if (h->lcm!=NULL) pLmFree(h->lcm);
946 #ifdef KDEBUG
947  h->lcm=NULL;
948 #endif
949  return 0;
950  }
951  h->SetShortExpVector();
952  not_sev = ~ h->sev;
953  d = h->SetpFDeg();
954  /*- try to reduce the s-polynomial -*/
955  pass++;
956  if (//!TEST_OPT_REDTHROUGH &&
957  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
958  {
959  h->SetLmCurrRing();
960  at = strat->posInL(strat->L,strat->Ll,h,strat);
961  if (at <= strat->Ll)
962  {
963 #if 1
964  int dummy=strat->sl;
965  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
966  return 1;
967 #endif
968 #ifdef KDEBUG
969  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
970 #endif
971  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
972  h->Clear();
973  return -1;
974  }
975  }
976  else if (d != reddeg)
977  {
978  if (d>=strat->tailRing->bitmask)
979  {
980  if (h->pTotalDeg() >= strat->tailRing->bitmask)
981  {
982  strat->overflow=TRUE;
983  //Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
984  h->GetP();
985  at = strat->posInL(strat->L,strat->Ll,h,strat);
986  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
987  h->Clear();
988  return -1;
989  }
990  }
991  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
992  {
993  Print(".%ld",d);mflush();
994  reddeg = d;
995  }
996  }
997  }
998 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
static int pLength(poly a)
Definition: p_polys.h:189
#define mflush()
Definition: reporter.h:42
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
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:351
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
static Poly * h
Definition: janet.cc:978
poly redNF ( poly  h,
int max_ind,
int  nonorm,
kStrategy  strat 
)

Definition at line 1189 of file kstd2.cc.

1190 {
1191  if (h==NULL) return NULL;
1192  int j;
1193  max_ind=strat->sl;
1194 
1195  if (0 > strat->sl)
1196  {
1197  return h;
1198  }
1199  LObject P(h);
1200  P.SetShortExpVector();
1201  P.bucket = kBucketCreate(currRing);
1202  kBucketInit(P.bucket,P.p,pLength(P.p));
1203  kbTest(P.bucket);
1204 #ifdef HAVE_RINGS
1206 #endif
1207 #ifdef KDEBUG
1208  if (TEST_OPT_DEBUG)
1209  {
1210  PrintS("redNF: starting S: ");
1211  for( j = 0; j <= max_ind; j++ )
1212  {
1213  Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1214  pWrite(strat->S[j]);
1215  }
1216  };
1217 #endif
1218 
1219  loop
1220  {
1221  j=kFindDivisibleByInS(strat,&max_ind,&P);
1222  if (j>=0)
1223  {
1224 #ifdef HAVE_RINGS
1225  if (!is_ring)
1226  {
1227 #endif
1228  int sl=pSize(strat->S[j]);
1229  int jj=j;
1230  loop
1231  {
1232  int sll;
1233  jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
1234  if (jj<0) break;
1235  sll=pSize(strat->S[jj]);
1236  if (sll<sl)
1237  {
1238  #ifdef KDEBUG
1239  if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
1240  #endif
1241  //else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
1242  j=jj;
1243  sl=sll;
1244  }
1245  }
1246  if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
1247  {
1248  pNorm(strat->S[j]);
1249  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
1250  }
1251 #ifdef HAVE_RINGS
1252  }
1253 #endif
1254  nNormalize(pGetCoeff(P.p));
1255 #ifdef KDEBUG
1256  if (TEST_OPT_DEBUG)
1257  {
1258  PrintS("red:");
1259  wrp(h);
1260  PrintS(" with ");
1261  wrp(strat->S[j]);
1262  }
1263 #endif
1264 #ifdef HAVE_PLURAL
1265  if (rIsPluralRing(currRing))
1266  {
1267  number coef;
1268  nc_kBucketPolyRed(P.bucket,strat->S[j],&coef);
1269  nDelete(&coef);
1270  }
1271  else
1272 #endif
1273  {
1274  number coef;
1275  coef=kBucketPolyRed(P.bucket,strat->S[j],pLength(strat->S[j]),strat->kNoether);
1276  nDelete(&coef);
1277  }
1278  h = kBucketGetLm(P.bucket); // FRAGE OLIVER
1279  if (h==NULL)
1280  {
1281  kBucketDestroy(&P.bucket);
1282 
1283 #ifdef KDEBUG
1284  if (TEST_OPT_DEBUG)
1285  {
1286  PrintS("redNF: starting S: ");
1287  for( j = 0; j <= max_ind; j++ )
1288  {
1289  Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1290  pWrite(strat->S[j]);
1291  }
1292  };
1293 #endif
1294 
1295  return NULL;
1296  }
1297  kbTest(P.bucket);
1298  P.p=h;
1299  P.t_p=NULL;
1300  P.SetShortExpVector();
1301 #ifdef KDEBUG
1302  if (TEST_OPT_DEBUG)
1303  {
1304  PrintS("\nto:");
1305  wrp(h);
1306  PrintLn();
1307  }
1308 #endif
1309  }
1310  else
1311  {
1312  P.p=kBucketClear(P.bucket);
1313  kBucketDestroy(&P.bucket);
1314  pNormalize(P.p);
1315 
1316 #ifdef KDEBUG
1317  if (TEST_OPT_DEBUG)
1318  {
1319  PrintS("redNF: starting S: ");
1320  for( j = 0; j <= max_ind; j++ )
1321  {
1322  Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
1323  pWrite(strat->S[j]);
1324  }
1325  };
1326 #endif
1327 
1328  return P.p;
1329  }
1330  }
1331 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition: kstd2.cc:181
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition: kbuckets.cc:186
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
static void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
Definition: nc.h:292
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:58
#define nNormalize(n)
Definition: numbers.h:30
loop
Definition: myNF.cc:98
number kBucketPolyRed(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition: kbuckets.cc:1064
const poly kBucketGetLm(kBucket_pt bucket)
Definition: kbuckets.cc:485
int & max_ind
Definition: myNF.cc:67
poly kNoether
Definition: kutil.h:328
#define nIsOne(n)
Definition: numbers.h:25
void pWrite(poly p)
Definition: polys.h:279
#define TEST_OPT_DEBUG
Definition: options.h:103
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
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
kBucket_pt kBucketCreate(ring bucket_ring)
Creation/Destruction of buckets.
Definition: kbuckets.cc:198
static int pLength(poly a)
Definition: p_polys.h:189
BOOLEAN is_ring
Definition: myNF.cc:83
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:205
int j
Definition: myNF.cc:70
pNormalize(P.p)
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:149
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
#define nDelete(n)
Definition: numbers.h:16
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
int sl
Definition: kutil.h:351
void wrp(poly p)
Definition: polys.h:281
kBucketDestroy & P
Definition: myNF.cc:191
static Poly * h
Definition: janet.cc:978
int int nonorm
Definition: myNF.cc:67
int BOOLEAN
Definition: auxiliary.h:131
#define pSize(p)
Definition: polys.h:289
int redRing ( LObject h,
kStrategy  strat 
)

Definition at line 324 of file kstd2.cc.

325 {
326  if (h->IsNull()) return 0; // spoly is zero (can only occure with zero divisors)
327  if (strat->tl<0) return 1;
328 
329  int at/*,i*/;
330  long d;
331  int j = 0;
332  int pass = 0;
333  // poly zeroPoly = NULL;
334 
335 // TODO warum SetpFDeg notwendig?
336  h->SetpFDeg();
337  assume(h->pFDeg() == h->FDeg);
338  long reddeg = h->GetpFDeg();
339 
340  h->SetShortExpVector();
341  loop
342  {
343  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
344  if (j < 0) return 1;
345  ksReducePoly(h, &(strat->T[j]), NULL, NULL, strat); // with debug output
346 
347  if (h->GetLmTailRing() == NULL)
348  {
349  if (h->lcm!=NULL) pLmDelete(h->lcm);
350 #ifdef KDEBUG
351  h->lcm=NULL;
352 #endif
353  h->Clear();
354  return 0;
355  }
356  h->SetShortExpVector();
357  d = h->SetpFDeg();
358  /*- try to reduce the s-polynomial -*/
359  pass++;
360  if (!TEST_OPT_REDTHROUGH &&
361  (strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
362  {
363  h->SetLmCurrRing();
364  if (strat->posInLDependsOnLength)
365  h->SetLength(strat->length_pLength);
366  at = strat->posInL(strat->L,strat->Ll,h,strat);
367  if (at <= strat->Ll)
368  {
369 #ifdef KDEBUG
370  if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
371 #endif
372  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
373  h->Clear();
374  return -1;
375  }
376  }
377  if (d != reddeg)
378  {
379  if (d >= strat->tailRing->bitmask)
380  {
381  if (h->pTotalDeg() >= strat->tailRing->bitmask)
382  {
383  strat->overflow=TRUE;
384  //Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
385  h->GetP();
386  at = strat->posInL(strat->L,strat->Ll,h,strat);
387  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
388  h->Clear();
389  return -1;
390  }
391  }
392  else if ((TEST_OPT_PROT) && (strat->Ll < 0))
393  {
394  Print(".%ld",d);mflush();
395  reddeg = d;
396  }
397  }
398  }
399 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define Print
Definition: emacs.cc:83
BOOLEAN length_pLength
Definition: kutil.h:382
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int tl
Definition: kutil.h:353
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define mflush()
Definition: reporter.h:42
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int redSig ( LObject h,
kStrategy  strat 
)

Definition at line 565 of file kstd2.cc.

566 {
567  if (strat->tl<0) return 1;
568  //if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
569  //printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
570  assume(h->FDeg == h->pFDeg());
571 //#if 1
572 #ifdef DEBUGF5
573  Print("------- IN REDSIG -------\n");
574  Print("p: ");
575  pWrite(pHead(h->p));
576  Print("p1: ");
577  pWrite(pHead(h->p1));
578  Print("p2: ");
579  pWrite(pHead(h->p2));
580  Print("---------------------------\n");
581 #endif
582  poly h_p;
583  int i,j,at,pass, ii;
584  int start=0;
585  int sigSafe;
586  unsigned long not_sev;
587  // long reddeg,d;
588 
589  pass = j = 0;
590  // d = reddeg = h->GetpFDeg();
591  h->SetShortExpVector();
592  int li;
593  h_p = h->GetLmTailRing();
594  not_sev = ~ h->sev;
595  loop
596  {
597  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h, start);
598  if (j < 0)
599  {
600  return 1;
601  }
602 
603  li = strat->T[j].pLength;
604  ii = j;
605  /*
606  * the polynomial to reduce with (up to the moment) is;
607  * pi with length li
608  */
609  i = j;
610 #if 1
611  if (TEST_OPT_LENGTH)
612  loop
613  {
614  /*- search the shortest possible with respect to length -*/
615  i++;
616  if (i > strat->tl)
617  break;
618  if (li<=1)
619  break;
620  if ((strat->T[i].pLength < li)
621  &&
622  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
623  h_p, not_sev, strat->tailRing))
624  {
625  /*
626  * the polynomial to reduce with is now;
627  */
628  li = strat->T[i].pLength;
629  ii = i;
630  }
631  }
632  start = ii+1;
633 #endif
634 
635  /*
636  * end of search: have to reduce with pi
637  */
638 #ifdef KDEBUG
639  if (TEST_OPT_DEBUG)
640  {
641  PrintS("red:");
642  h->wrp();
643  PrintS(" with ");
644  strat->T[ii].wrp();
645  }
646 #endif
647  assume(strat->fromT == FALSE);
648 //#if 1
649 #ifdef DEBUGF5
650  Print("BEFORE REDUCTION WITH %d:\n",ii);
651  Print("--------------------------------\n");
652  pWrite(h->sig);
653  pWrite(strat->T[ii].sig);
654  pWrite(h->GetLmCurrRing());
655  pWrite(pHead(h->p1));
656  pWrite(pHead(h->p2));
657  pWrite(pHead(strat->T[ii].p));
658  Print("--------------------------------\n");
659  printf("INDEX OF REDUCER T: %d\n",ii);
660 #endif
661  sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
662 #if SBA_PRINT_REDUCTION_STEPS
663  if (sigSafe != 3)
664  sba_reduction_steps++;
665 #endif
666 #if SBA_PRINT_OPERATIONS
667  if (sigSafe != 3)
668  sba_operations += pLength(strat->T[ii].p);
669 #endif
670  // if reduction has taken place, i.e. the reduction was sig-safe
671  // otherwise start is already at the next position and the loop
672  // searching reducers in T goes on from index start
673 //#if 1
674 #ifdef DEBUGF5
675  Print("SigSAFE: %d\n",sigSafe);
676 #endif
677  if (sigSafe != 3)
678  {
679  // start the next search for reducers in T from the beginning
680  start = 0;
681 #ifdef KDEBUG
682  if (TEST_OPT_DEBUG)
683  {
684  PrintS("\nto ");
685  h->wrp();
686  PrintLn();
687  }
688 #endif
689 
690  h_p = h->GetLmTailRing();
691  if (h_p == NULL)
692  {
693  if (h->lcm!=NULL) pLmFree(h->lcm);
694 #ifdef KDEBUG
695  h->lcm=NULL;
696 #endif
697  return 0;
698  }
699  h->SetShortExpVector();
700  not_sev = ~ h->sev;
701  /*
702  * try to reduce the s-polynomial h
703  *test first whether h should go to the lazyset L
704  *-if the degree jumps
705  *-if the number of pre-defined reductions jumps
706  */
707  pass++;
708  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
709  {
710  h->SetLmCurrRing();
711  at = strat->posInL(strat->L,strat->Ll,h,strat);
712  if (at <= strat->Ll)
713  {
714  int dummy=strat->sl;
715  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
716  {
717  return 1;
718  }
719  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
720 #ifdef KDEBUG
721  if (TEST_OPT_DEBUG)
722  Print(" lazy: -> L%d\n",at);
723 #endif
724  h->Clear();
725  return -1;
726  }
727  }
728  }
729  }
730 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
int tl
Definition: kutil.h:353
unsigned long * sevT
Definition: kutil.h:323
void pWrite(poly p)
Definition: polys.h:279
#define TEST_OPT_LENGTH
Definition: options.h:124
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
static int pLength(poly a)
Definition: p_polys.h:189
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:172
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
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:149
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
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:351
TSet T
Definition: kutil.h:324
int LazyPass
Definition: kutil.h:356
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
poly redtailSba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 733 of file kstd2.cc.

734 {
735 #define REDTAIL_CANONICALIZE 100
736  strat->redTailChange=FALSE;
737  if (strat->noTailReduction) return L->GetLmCurrRing();
738  poly h, p;
739  p = h = L->GetLmTailRing();
740  if ((h==NULL) || (pNext(h)==NULL))
741  return L->GetLmCurrRing();
742 
743  TObject* With;
744  // placeholder in case strat->tl < 0
745  TObject With_s(strat->tailRing);
746 
747  LObject Ln(pNext(h), strat->tailRing);
748  Ln.sig = L->sig;
749  Ln.sevSig = L->sevSig;
750  Ln.pLength = L->GetpLength() - 1;
751 
752  pNext(h) = NULL;
753  if (L->p != NULL) pNext(L->p) = NULL;
754  L->pLength = 1;
755 
756  Ln.PrepareRed(strat->use_buckets);
757 
758  int cnt=REDTAIL_CANONICALIZE;
759  while(!Ln.IsNull())
760  {
761  loop
762  {
763  Ln.SetShortExpVector();
764  if (withT)
765  {
766  int j;
767  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
768  if (j < 0) break;
769  With = &(strat->T[j]);
770  }
771  else
772  {
773  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
774  if (With == NULL) break;
775  }
776  cnt--;
777  if (cnt==0)
778  {
780  /*poly tmp=*/Ln.CanonicalizeP();
781  if (normalize)
782  {
783  Ln.Normalize();
784  //pNormalize(tmp);
785  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
786  }
787  }
788  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
789  {
790  With->pNorm();
791  }
792  strat->redTailChange=TRUE;
793  int ret = ksReducePolyTailSig(L, With, &Ln);
794 #if SBA_PRINT_REDUCTION_STEPS
795  if (ret != 3)
796  sba_reduction_steps++;
797 #endif
798 #if SBA_PRINT_OPERATIONS
799  if (ret != 3)
800  sba_operations += pLength(With->p);
801 #endif
802  if (ret)
803  {
804  // reducing the tail would violate the exp bound
805  // set a flag and hope for a retry (in bba)
806  strat->completeReduce_retry=TRUE;
807  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
808  do
809  {
810  pNext(h) = Ln.LmExtractAndIter();
811  pIter(h);
812  L->pLength++;
813  } while (!Ln.IsNull());
814  goto all_done;
815  }
816  if (Ln.IsNull()) goto all_done;
817  if (! withT) With_s.Init(currRing);
818  }
819  pNext(h) = Ln.LmExtractAndIter();
820  pIter(h);
821  pNormalize(h);
822  L->pLength++;
823  }
824 
825  all_done:
826  Ln.Delete();
827  if (L->p != NULL) pNext(L->p) = pNext(p);
828 
829  if (strat->redTailChange)
830  {
831  L->length = 0;
832  }
833 
834  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
835  //L->Normalize(); // HANNES: should have a test
836  kTest_L(L);
837  return L->GetLmCurrRing();
838 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red)
Definition: kstd2.cc:529
static int pLength(poly a)
Definition: p_polys.h:189
char completeReduce_retry
Definition: kutil.h:398
#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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
pNormalize(P.p)
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:149
#define kTest_L(T)
Definition: kutil.h:619
#define REDTAIL_CANONICALIZE
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
ideal sba ( ideal  F0,
ideal  Q,
intvec w,
intvec hilb,
kStrategy  strat 
)

Definition at line 1670 of file kstd2.cc.

1671 {
1672  // ring order stuff:
1673  // in sba we have (until now) two possibilities:
1674  // 1. an incremental computation w.r.t. (C,monomial order)
1675  // 2. a (possibly non-incremental) computation w.r.t. the
1676  // induced Schreyer order.
1677  // The corresponding orders are computed in sbaRing(), depending
1678  // on the flag strat->sbaOrder
1679 #if SBA_PRINT_ZERO_REDUCTIONS
1680  long zeroreductions = 0;
1681 #endif
1682 #if SBA_PRINT_PRODUCT_CRITERION
1683  long product_criterion = 0;
1684 #endif
1685 #if SBA_PRINT_SIZE_G
1686  int size_g = 0;
1687  int size_g_non_red = 0;
1688 #endif
1689 #if SBA_PRINT_SIZE_SYZ
1690  long size_syz = 0;
1691 #endif
1692  // global variable
1693 #if SBA_PRINT_REDUCTION_STEPS
1694  sba_reduction_steps = 0;
1695  sba_interreduction_steps = 0;
1696 #endif
1697 #if SBA_PRINT_OPERATIONS
1698  sba_operations = 0;
1699  sba_interreduction_operations = 0;
1700 #endif
1701 
1702  ideal F1 = F0;
1703  ring sRing, currRingOld;
1704  currRingOld = currRing;
1705  if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
1706  {
1707  sRing = sbaRing(strat);
1708  if (sRing!=currRingOld)
1709  {
1710  rChangeCurrRing (sRing);
1711  F1 = idrMoveR (F0, currRingOld, currRing);
1712  }
1713  }
1714  // sort ideal F
1715  ideal F = idInit(IDELEMS(F1),F1->rank);
1716  intvec *sort = idSort(F1);
1717  for (int i=0; i<sort->length();++i)
1718  F->m[i] = F1->m[(*sort)[i]-1];
1719 #if SBA_INTERRED_START
1720  F = kInterRed(F,NULL);
1721 #endif
1722 #if F5DEBUG
1723  printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
1724  rWrite (currRing);
1725  printf("ordSgn = %d\n",currRing->OrdSgn);
1726  printf("\n");
1727 #endif
1728 #ifdef KDEBUG
1729  bba_count++;
1730  int loop_count = 0;
1731 #endif /* KDEBUG */
1732  int srmax,lrmax, red_result = 1;
1733  int olddeg,reduc;
1734  int hilbeledeg=1,hilbcount=0,minimcnt=0;
1735  LObject L;
1736  BOOLEAN withT = TRUE;
1737  strat->max_lower_index = 0;
1738 
1739  //initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
1740  initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
1741  initSbaPos(strat);
1742  //initBuchMoraPos(strat);
1743  initHilbCrit(F,Q,&hilb,strat);
1744  initSba(F,strat);
1745  /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
1746  /*Shdl=*/initSbaBuchMora(F, Q,strat);
1747  if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
1748  srmax = strat->sl;
1749  reduc = olddeg = lrmax = 0;
1750 
1751 #ifndef NO_BUCKETS
1752  if (!TEST_OPT_NOT_BUCKETS)
1753  strat->use_buckets = 1;
1754 #endif
1755 
1756  // redtailBBa against T for inhomogenous input
1757  // if (!TEST_OPT_OLDSTD)
1758  // withT = ! strat->homog;
1759 
1760  // strat->posInT = posInT_pLength;
1761  kTest_TS(strat);
1762 
1763 #ifdef KDEBUG
1764 #if MYTEST
1765  if (TEST_OPT_DEBUG)
1766  {
1767  PrintS("bba start GB: currRing: ");
1768  // rWrite(currRing);PrintLn();
1770  PrintLn();
1771  }
1772 #endif /* MYTEST */
1773 #endif /* KDEBUG */
1774 
1775 #ifdef HAVE_TAIL_RING
1776  if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
1777  kStratInitChangeTailRing(strat);
1778 #endif
1779  if (BVERBOSE(23))
1780  {
1781  if (test_PosInT!=NULL) strat->posInT=test_PosInT;
1782  if (test_PosInL!=NULL) strat->posInL=test_PosInL;
1783  kDebugPrint(strat);
1784  }
1785 
1786 
1787 #ifdef KDEBUG
1788  //kDebugPrint(strat);
1789 #endif
1790  /* compute------------------------------------------------------- */
1791  while (strat->Ll >= 0)
1792  {
1793  if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
1794  #ifdef KDEBUG
1795  loop_count++;
1796  if (TEST_OPT_DEBUG) messageSets(strat);
1797  #endif
1798  if (strat->Ll== 0) strat->interpt=TRUE;
1799  /*
1800  if (TEST_OPT_DEGBOUND
1801  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1802  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
1803  {
1804 
1805  //stops computation if
1806  // 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
1807  //a predefined number Kstd1_deg
1808  while ((strat->Ll >= 0)
1809  && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1810  && ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
1811  || ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
1812  )
1813  deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1814  if (strat->Ll<0) break;
1815  else strat->noClearS=TRUE;
1816  }
1817  */
1818  if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
1819  {
1820  strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
1821 #if F5C
1822  // 1. interreduction of the current standard basis
1823  // 2. generation of new principal syzygy rules for syzCriterion
1824  f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
1825  lrmax, reduc, Q, w, hilb );
1826 #endif
1827  // initialize new syzygy rules for the next iteration step
1828  initSyzRules(strat);
1829 
1830  }
1831  /*********************************************************************
1832  * interrreduction step is done, we can go on with the next iteration
1833  * step of the signature-based algorithm
1834  ********************************************************************/
1835  /* picks the last element from the lazyset L */
1836  strat->P = strat->L[strat->Ll];
1837  strat->Ll--;
1838  /* reduction of the element chosen from L */
1839 
1840  if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1)) {
1841  //#if 1
1842 #ifdef DEBUGF5
1843  Print("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
1844  Print("-------------------------------------------------\n");
1845  pWrite(strat->P.sig);
1846  pWrite(pHead(strat->P.p));
1847  pWrite(pHead(strat->P.p1));
1848  pWrite(pHead(strat->P.p2));
1849  Print("-------------------------------------------------\n");
1850 #endif
1851  if (pNext(strat->P.p) == strat->tail)
1852  {
1853  // deletes the short spoly
1854  /*
1855 #ifdef HAVE_RINGS
1856  if (rField_is_Ring(currRing))
1857  pLmDelete(strat->P.p);
1858  else
1859 #endif
1860  pLmFree(strat->P.p);
1861 */
1862  // TODO: needs some masking
1863  // TODO: masking needs to vanish once the signature
1864  // sutff is completely implemented
1865  strat->P.p = NULL;
1866  poly m1 = NULL, m2 = NULL;
1867 
1868  // check that spoly creation is ok
1869  while (strat->tailRing != currRing &&
1870  !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1871  {
1872  assume(m1 == NULL && m2 == NULL);
1873  // if not, change to a ring where exponents are at least
1874  // large enough
1875  if (!kStratChangeTailRing(strat))
1876  {
1877  WerrorS("OVERFLOW...");
1878  break;
1879  }
1880  }
1881  // create the real one
1882  ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
1883  strat->tailRing, m1, m2, strat->R);
1884 
1885  }
1886  else if (strat->P.p1 == NULL)
1887  {
1888  if (strat->minim > 0)
1889  strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
1890  // for input polys, prepare reduction
1891  strat->P.PrepareRed(strat->use_buckets);
1892  }
1893  if (strat->P.p == NULL && strat->P.t_p == NULL)
1894  {
1895  red_result = 0;
1896  }
1897  else
1898  {
1899  //#if 1
1900 #ifdef DEBUGF5
1901  Print("Poly before red: ");
1902  pWrite(pHead(strat->P.p));
1903  pWrite(strat->P.sig);
1904 #endif
1905 #if SBA_PRODUCT_CRITERION
1906  if (strat->P.prod_crit) {
1907 #if SBA_PRINT_PRODUCT_CRITERION
1908  product_criterion++;
1909 #endif
1910  int pos = posInSyz(strat, strat->P.sig);
1911  enterSyz(strat->P, strat, pos);
1912  if (strat->P.lcm!=NULL)
1913  pLmFree(strat->P.lcm);
1914  red_result = 2;
1915  } else {
1916  red_result = strat->red(&strat->P,strat);
1917  }
1918 #else
1919  red_result = strat->red(&strat->P,strat);
1920 #endif
1921  }
1922  } else {
1923  /*
1924  if (strat->P.lcm != NULL)
1925  pLmFree(strat->P.lcm);
1926  */
1927  red_result = 2;
1928  }
1929  if (errorreported) break;
1930 
1931 //#if 1
1932 #ifdef DEBUGF5
1933  if (red_result != 0) {
1934  Print("Poly after red: ");
1935  pWrite(pHead(strat->P.p));
1936  pWrite(strat->P.GetLmCurrRing());
1937  pWrite(strat->P.sig);
1938  printf("%d\n",red_result);
1939  }
1940 #endif
1941 
1942  if (strat->overflow)
1943  {
1944  if (!kStratChangeTailRing(strat)) { Werror("OVERFLOW.."); break;}
1945  }
1946 
1947  // reduction to non-zero new poly
1948  if (red_result == 1)
1949  {
1950  // get the polynomial (canonicalize bucket, make sure P.p is set)
1951  strat->P.GetP(strat->lmBin);
1952 
1953  // sig-safe computations may lead to wrong FDeg computation, thus we need
1954  // to recompute it to make sure everything is alright
1955  (strat->P).FDeg = (strat->P).pFDeg();
1956  // in the homogeneous case FDeg >= pFDeg (sugar/honey)
1957  // but now, for entering S, T, we reset it
1958  // in the inhomogeneous case: FDeg == pFDeg
1959  if (strat->homog) strat->initEcart(&(strat->P));
1960 
1961  /* statistic */
1962  if (TEST_OPT_PROT) PrintS("s");
1963 
1964  //int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
1965  // in F5E we know that the last reduced element is already the
1966  // the one with highest signature
1967  int pos = strat->sl+1;
1968 
1969 #ifdef KDEBUG
1970 #if MYTEST
1971  PrintS("New S: "); pDebugPrint(strat->P.p); PrintLn();
1972 #endif /* MYTEST */
1973 #endif /* KDEBUG */
1974 
1975  // reduce the tail and normalize poly
1976  // in the ring case we cannot expect LC(f) = 1,
1977  // therefore we call pContent instead of pNorm
1978 #if SBA_TAIL_RED
1979  if (strat->sbaOrder != 2) {
1981  {
1982  strat->P.pCleardenom();
1984  {
1985  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
1986  strat->P.pCleardenom();
1987  }
1988  }
1989  else
1990  {
1991  strat->P.pNorm();
1993  strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
1994  }
1995  }
1996 #endif
1997 
1998  // remove sigsafe label since it is no longer valid for the next element to
1999  // be reduced
2000  if (strat->sbaOrder == 1)
2001  {
2002  for (int jj = 0; jj<strat->tl+1; jj++)
2003  {
2004  if (pGetComp(strat->T[jj].sig) == strat->currIdx)
2005  {
2006  strat->T[jj].is_sigsafe = FALSE;
2007  }
2008  }
2009  }
2010  else
2011  {
2012  for (int jj = 0; jj<strat->tl+1; jj++)
2013  {
2014  strat->T[jj].is_sigsafe = FALSE;
2015  }
2016  }
2017 #ifdef KDEBUG
2018  if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
2019 #if MYTEST
2020 //#if 1
2021  PrintS("New (reduced) S: "); pDebugPrint(strat->P.p); PrintLn();
2022 #endif /* MYTEST */
2023 #endif /* KDEBUG */
2024 
2025  // min_std stuff
2026  if ((strat->P.p1==NULL) && (strat->minim>0))
2027  {
2028  if (strat->minim==1)
2029  {
2030  strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
2031  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2032  }
2033  else
2034  {
2035  strat->M->m[minimcnt]=strat->P.p2;
2036  strat->P.p2=NULL;
2037  }
2038  if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
2039  pNext(strat->M->m[minimcnt])
2040  = strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
2041  strat->tailRing, currRing,
2042  currRing->PolyBin);
2043  minimcnt++;
2044  }
2045 
2046  // enter into S, L, and T
2047  //if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
2048  enterT(strat->P, strat);
2049  strat->T[strat->tl].is_sigsafe = FALSE;
2050  /*
2051  printf("hier\n");
2052  pWrite(strat->P.GetLmCurrRing());
2053  pWrite(strat->P.sig);
2054  */
2055 #ifdef HAVE_RINGS
2056  if (rField_is_Ring(currRing))
2057  superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2058  else
2059 #endif
2060  enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
2061  // posInS only depends on the leading term
2062  strat->enterS(strat->P, pos, strat, strat->tl);
2063  if(strat->sbaOrder != 1)
2064  {
2065  BOOLEAN overwrite = FALSE;
2066  for (int tk=0; tk<strat->sl+1; tk++)
2067  {
2068  if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
2069  {
2070  //printf("TK %d / %d\n",tk,strat->sl);
2071  overwrite = FALSE;
2072  break;
2073  }
2074  }
2075  //printf("OVERWRITE %d\n",overwrite);
2076  if (overwrite)
2077  {
2078  int cmp = pGetComp(strat->P.sig);
2079  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2080  pGetExpV (strat->P.p,vv);
2081  pSetExpV (strat->P.sig, vv);
2082  pSetComp (strat->P.sig,cmp);
2083 
2084  strat->P.sevSig = pGetShortExpVector (strat->P.sig);
2085  int i;
2086  LObject Q;
2087  for(int ps=0;ps<strat->sl+1;ps++)
2088  {
2089 
2090  strat->newt = TRUE;
2091  if (strat->syzl == strat->syzmax)
2092  {
2093  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
2094  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
2095  (strat->syzmax)*sizeof(unsigned long),
2096  ((strat->syzmax)+setmaxTinc)
2097  *sizeof(unsigned long));
2098  strat->syzmax += setmaxTinc;
2099  }
2100  Q.sig = pCopy(strat->P.sig);
2101  // add LM(F->m[i]) to the signature to get a Schreyer order
2102  // without changing the underlying polynomial ring at all
2103  if (strat->sbaOrder == 0)
2104  p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
2105  // since p_Add_q() destroys all input
2106  // data we need to recreate help
2107  // each time
2108  // ----------------------------------------------------------
2109  // in the Schreyer order we always know that the multiplied
2110  // module monomial strat->P.sig gives the leading monomial of
2111  // the corresponding principal syzygy
2112  // => we do not need to compute the "real" syzygy completely
2113  poly help = p_Copy(strat->sig[ps],currRing);
2114  p_ExpVectorAdd (help,strat->P.p,currRing);
2115  Q.sig = p_Add_q(Q.sig,help,currRing);
2116  //printf("%d. SYZ ",i+1);
2117  //pWrite(strat->syz[i]);
2118  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
2119  i = posInSyz(strat, Q.sig);
2120  enterSyz(Q, strat, i);
2121  }
2122  }
2123  }
2124  // deg - idx - lp/rp
2125  // => we need to add syzygies with indices > pGetComp(strat->P.sig)
2126  if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
2127  {
2128  int cmp = pGetComp(strat->P.sig);
2129  int max_cmp = IDELEMS(F);
2130  int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
2131  pGetExpV (strat->P.p,vv);
2132  LObject Q;
2133  int pos;
2134  int idx = p_GetComp(strat->P.sig,currRing);
2135  //printf("++ -- adding syzygies -- ++\n");
2136  // if new element is the first one in this index
2137  if (strat->currIdx < idx) {
2138  for (int i=0; i<strat->sl; ++i) {
2139  Q.sig = p_Copy(strat->P.sig,currRing);
2140  p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
2141  poly help = p_Copy(strat->sig[i],currRing);
2142  p_ExpVectorAdd(help,strat->P.p,currRing);
2143  Q.sig = p_Add_q(Q.sig,help,currRing);
2144  //pWrite(Q.sig);
2145  pos = posInSyz(strat, Q.sig);
2146  enterSyz(Q, strat, pos);
2147  }
2148  strat->currIdx = idx;
2149  } else {
2150  // if the element is not the first one in the given index we build all
2151  // possible syzygies with elements of higher index
2152  for (int i=cmp+1; i<=max_cmp; ++i) {
2153  pos = -1;
2154  for (int j=0; j<strat->sl; ++j) {
2155  if (p_GetComp(strat->sig[j],currRing) == i) {
2156  pos = j;
2157  break;
2158  }
2159  }
2160  if (pos != -1) {
2161  Q.sig = p_One(currRing);
2162  p_SetExpV(Q.sig, vv, currRing);
2163  // F->m[i-1] corresponds to index i
2164  p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
2165  p_SetComp(Q.sig, i, currRing);
2166  poly help = p_Copy(strat->P.sig,currRing);
2167  p_ExpVectorAdd(help,strat->S[pos],currRing);
2168  Q.sig = p_Add_q(Q.sig,help,currRing);
2169  if (strat->sbaOrder == 0) {
2170  if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn) {
2171  pos = posInSyz(strat, Q.sig);
2172  enterSyz(Q, strat, pos);
2173  }
2174  } else {
2175  pos = posInSyz(strat, Q.sig);
2176  enterSyz(Q, strat, pos);
2177  }
2178  }
2179  }
2180  //printf("++ -- done adding syzygies -- ++\n");
2181  }
2182  }
2183 //#if 1
2184 #if DEBUGF50
2185  printf("---------------------------\n");
2186  Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
2187  Print("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
2188  Print("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
2189 #endif
2190  /*
2191  if (newrules)
2192  {
2193  newrules = FALSE;
2194  }
2195  */
2196 #if 0
2197  int pl=pLength(strat->P.p);
2198  if (pl==1)
2199  {
2200  //if (TEST_OPT_PROT)
2201  //PrintS("<1>");
2202  }
2203  else if (pl==2)
2204  {
2205  //if (TEST_OPT_PROT)
2206  //PrintS("<2>");
2207  }
2208 #endif
2209  if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
2210 // Print("[%d]",hilbeledeg);
2211  if (strat->P.lcm!=NULL)
2212 #ifdef HAVE_RINGS
2213  pLmDelete(strat->P.lcm);
2214 #else
2215  pLmFree(strat->P.lcm);
2216 #endif
2217  if (strat->sl>srmax) srmax = strat->sl;
2218  }
2219  else
2220  {
2221  // adds signature of the zero reduction to
2222  // strat->syz. This is the leading term of
2223  // syzygy and can be used in syzCriterion()
2224  // the signature is added if and only if the
2225  // pair was not detected by the rewritten criterion in strat->red = redSig
2226  if (red_result!=2) {
2227 #if SBA_PRINT_ZERO_REDUCTIONS
2228  zeroreductions++;
2229 #endif
2230  int pos = posInSyz(strat, strat->P.sig);
2231  enterSyz(strat->P, strat, pos);
2232 //#if 1
2233 #ifdef DEBUGF5
2234  Print("ADDING STUFF TO SYZ : ");
2235  //pWrite(strat->P.p);
2236  pWrite(strat->P.sig);
2237 #endif
2238  }
2239  if (strat->P.p1 == NULL && strat->minim > 0)
2240  {
2241  p_Delete(&strat->P.p2, currRing, strat->tailRing);
2242  }
2243  }
2244 
2245 #ifdef KDEBUG
2246  memset(&(strat->P), 0, sizeof(strat->P));
2247 #endif /* KDEBUG */
2248  kTest_TS(strat);
2249  }
2250 #ifdef KDEBUG
2251 #if MYTEST
2252  PrintS("bba finish GB: currRing: "); rWrite(currRing);
2253 #endif /* MYTEST */
2254  if (TEST_OPT_DEBUG) messageSets(strat);
2255 #endif /* KDEBUG */
2256 
2257  if (TEST_OPT_SB_1)
2258  {
2259  #ifdef HAVE_RINGS
2260  if(!rField_is_Ring(currRing))
2261  #endif
2262  {
2263  int k=1;
2264  int j;
2265  while(k<=strat->sl)
2266  {
2267  j=0;
2268  loop
2269  {
2270  if (j>=k) break;
2271  clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
2272  j++;
2273  }
2274  k++;
2275  }
2276  }
2277  }
2278 
2279  /* complete reduction of the standard basis--------- */
2280  if (TEST_OPT_REDSB)
2281  {
2282  completeReduce(strat);
2283 #ifdef HAVE_TAIL_RING
2284  if (strat->completeReduce_retry)
2285  {
2286  // completeReduce needed larger exponents, retry
2287  // to reduce with S (instead of T)
2288  // and in currRing (instead of strat->tailRing)
2289  cleanT(strat);strat->tailRing=currRing;
2290  int i;
2291  for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
2292  completeReduce(strat);
2293  }
2294 #endif
2295  }
2296  else if (TEST_OPT_PROT) PrintLn();
2297 
2298 #if SBA_PRINT_SIZE_SYZ
2299  // that is correct, syzl is counting one too far
2300  size_syz = strat->syzl;
2301 #endif
2302  exitSba(strat);
2303 // if (TEST_OPT_WEIGHTM)
2304 // {
2305 // pRestoreDegProcs(pFDegOld, pLDegOld);
2306 // if (ecartWeights)
2307 // {
2308 // omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
2309 // ecartWeights=NULL;
2310 // }
2311 // }
2312  if (TEST_OPT_PROT) messageStat(hilbcount,strat);
2313  if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2314 
2315 #ifdef KDEBUG
2316 #if MYTEST
2317  PrintS("bba_end: currRing: "); rWrite(currRing);
2318 #endif /* MYTEST */
2319 #endif /* KDEBUG */
2320 #if SBA_PRINT_SIZE_G
2321  size_g_non_red = IDELEMS(strat->Shdl);
2322 #endif
2323  if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
2324  {
2325  rChangeCurrRing (currRingOld);
2326  F0 = idrMoveR (F1, sRing, currRing);
2327  strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
2328  rDelete (sRing);
2329  }
2330  id_DelDiv(strat->Shdl, currRing);
2331  idSkipZeroes(strat->Shdl);
2332  idTest(strat->Shdl);
2333 
2334 #if SBA_PRINT_SIZE_G
2335  size_g = IDELEMS(strat->Shdl);
2336 #endif
2337 #ifdef DEBUGF5
2338  printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
2339  int oo = 0;
2340  while (oo<IDELEMS(strat->Shdl))
2341  {
2342  printf(" %d. ",oo+1);
2343  pWrite(pHead(strat->Shdl->m[oo]));
2344  oo++;
2345  }
2346 #endif
2347 #if SBA_PRINT_ZERO_REDUCTIONS
2348  printf("----------------------------------------------------------\n");
2349  printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
2350  zeroreductions = 0;
2351 #endif
2352 #if SBA_PRINT_REDUCTION_STEPS
2353  printf("----------------------------------------------------------\n");
2354  printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
2355 #endif
2356 #if SBA_PRINT_OPERATIONS
2357  printf("OPERATIONS: %ld\n",sba_operations);
2358 #endif
2359 #if SBA_PRINT_REDUCTION_STEPS
2360  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2361  printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
2362 #endif
2363 #if SBA_PRINT_OPERATIONS
2364  printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
2365 #endif
2366 #if SBA_PRINT_REDUCTION_STEPS
2367  printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
2368  printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
2369  sba_interreduction_steps = 0;
2370  sba_reduction_steps = 0;
2371 #endif
2372 #if SBA_PRINT_OPERATIONS
2373  printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
2374  sba_interreduction_operations = 0;
2375  sba_operations = 0;
2376 #endif
2377 #if SBA_PRINT_SIZE_G
2378  printf("----------------------------------------------------------\n");
2379  printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
2380  size_g = 0;
2381  size_g_non_red = 0;
2382 #endif
2383 #if SBA_PRINT_SIZE_SYZ
2384  printf("SIZE OF SYZ: %ld\n",size_syz);
2385  printf("----------------------------------------------------------\n");
2386  size_syz = 0;
2387 #endif
2388 #if SBA_PRINT_PRODUCT_CRITERION
2389  printf("PRODUCT CRITERIA: %ld\n",product_criterion);
2390  product_criterion = 0;
2391 #endif
2392  return (strat->Shdl);
2393 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
polyset sig
Definition: kutil.h:306
#define TEST_OPT_REDTAIL
Definition: options.h:111
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void id_DelDiv(ideal id, const ring r)
void initSbaPos(kStrategy strat)
Definition: kutil.cc:7655
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:58
void messageStat(int hilbcount, kStrategy strat)
Definition: kutil.cc:5669
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
void enterSyz(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7240
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#define p_GetComp(p, r)
Definition: monomials.h:72
char newt
Definition: kutil.h:396
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:293
const ideal
Definition: gb_hack.h:42
void initSba(ideal F, kStrategy strat)
Definition: kstd1.cc:1334
void initSyzRules(kStrategy strat)
Definition: kutil.cc:6087
int tl
Definition: kutil.h:353
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
int length() const
Definition: intvec.h:85
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:338
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition: kutil.cc:8361
void pWrite(poly p)
Definition: polys.h:279
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:7751
#define TEST_OPT_DEBUG
Definition: options.h:103
#define Q
Definition: sirandom.c:25
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
#define omAlloc(size)
Definition: omAllocDecl.h:210
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
unsigned long currIdx
Definition: kutil.h:315
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3703
#define pGetComp(p)
Component.
Definition: polys.h:37
static int pLength(poly a)
Definition: p_polys.h:189
int minim
Definition: kutil.h:361
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1456
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void rDebugPrint(ring r)
Definition: ring.cc:3971
char completeReduce_retry
Definition: kutil.h:398
void kStratInitChangeTailRing(kStrategy strat)
Definition: kutil.cc:8334
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:100
BOOLEAN interpt
Definition: kutil.h:365
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN homog
Definition: kutil.h:366
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
Definition: intvec.h:16
#define kTest_TS(A)
Definition: kutil.h:616
poly p_One(const ring r)
Definition: p_polys.cc:1318
int max_lower_index
Definition: kutil.h:316
int j
Definition: myNF.cc:70
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition: kutil.cc:7305
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define messageSets(s)
Definition: kutil.h:506
#define pSetExpV(p, e)
Definition: polys.h:97
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition: kspoly.cc:376
ideal kInterRed(ideal F, ideal Q)
Definition: kstd1.cc:3059
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:248
#define pSetComp(p, v)
Definition: polys.h:38
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
ideal M
Definition: kutil.h:303
unsigned sbaOrder
Definition: kutil.h:314
void exitSba(kStrategy strat)
Definition: kutil.cc:7830
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1339
void f5c(kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, intvec *hilb)
Definition: kstd2.cc:2551
TObject ** R
Definition: kutil.h:340
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#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:304
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
short errorreported
Definition: feFopen.cc:22
#define help
Definition: libparse.cc:1228
void rChangeCurrRing(ring r)
Definition: polys.cc:14
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition: kutil.cc:8176
#define BVERBOSE(a)
Definition: options.h:33
kStrategy strat
Definition: myNF.cc:319
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition: khstd.cc:35
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
static int bba_count
Definition: kstd2.cc:1334
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void cleanT(kStrategy strat)
Definition: kutil.cc:491
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition: kutil.cc:3597
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:4624
ring tailRing
Definition: kutil.h:343
#define TEST_OPT_SB_1
Definition: options.h:113
void initSbaCrit(kStrategy strat)
Definition: kutil.cc:7382
char overflow
Definition: kutil.h:399
unsigned long * sevS
Definition: kutil.h:320
#define pGetExpV(p, e)
Gets a copy of (resp. set) the exponent vector, where e is assumed to point to (r->N +1)*sizeof(long)...
Definition: polys.h:96
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition: kutil.cc:7991
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:321
#define setmaxTinc
Definition: kutil.h:31
intvec * idSort(ideal id, BOOLEAN nolex=TRUE, const ring R=currRing)
Definition: ideals.h:187
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition: kutil.cc:7864
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
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
int(* test_PosInT)(const TSet T, const int tl, LObject &h)
Definition: kstd2.cc:95
polyset syz
Definition: kutil.h:305
int sl
Definition: kutil.h:351
void sort(CFArray &A, int l=0)
quick sort A
TSet T
Definition: kutil.h:324
omBin lmBin
Definition: kutil.h:344
BOOLEAN use_buckets
Definition: kutil.h:377
int(* test_PosInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kstd2.cc:96
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kstd2.cc:733
int BOOLEAN
Definition: auxiliary.h:131
BOOLEAN idIs0(ideal h)
void Werror(const char *fmt,...)
Definition: reporter.cc:199
int syzl
Definition: kutil.h:352
void kDebugPrint(kStrategy strat)
Definition: kutil.cc:8780
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:261
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define idTest(id)
Definition: ideals.h:63

Variable Documentation

int bba_count = 0
static

Definition at line 1334 of file kstd2.cc.

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

Definition at line 96 of file kstd2.cc.

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

Definition at line 95 of file kstd2.cc.