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

Go to the source code of this file.

Macros

#define MORA_USE_BUCKETS
 
#define PRE_INTEGER_CHECK   0
 

Functions

static BOOLEAN kMoraUseBucket (kStrategy strat)
 
static void kOptimizeLDeg (pLDegProc ldeg, kStrategy strat)
 
static int doRed (LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
 
int redEcart (LObject *h, kStrategy strat)
 
int redRiloc (LObject *h, kStrategy strat)
 
int redRiloc_Z (LObject *h, kStrategy strat)
 
int redFirst (LObject *h, kStrategy strat)
 
static poly redMoraNF (poly h, kStrategy strat, int flag)
 
static poly redMoraNFRing (poly h, kStrategy strat, int flag)
 
void reorderL (kStrategy strat)
 
void reorderT (kStrategy strat)
 
void missingAxis (int *last, kStrategy strat)
 
BOOLEAN hasPurePower (const poly p, int last, int *length, kStrategy strat)
 
BOOLEAN hasPurePower (LObject *L, int last, int *length, kStrategy strat)
 
int posInL10 (const LSet set, const int length, LObject *p, const kStrategy strat)
 
void updateL (kStrategy strat)
 
void updateLHC (kStrategy strat)
 
void updateT (kStrategy strat)
 
void firstUpdate (kStrategy strat)
 
void enterSMora (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSMoraNF (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void initBba (kStrategy strat)
 
void initSba (ideal F, kStrategy strat)
 
void initMora (ideal F, kStrategy strat)
 
void kDebugPrint (kStrategy strat)
 
ideal mora (ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
 
poly kNF1 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
 
ideal kNF1 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
 
long kModDeg (poly p, const ring r)
 
long kHomModDeg (poly p, const ring r)
 
static int kFindLuckyPrime (ideal F, ideal Q)
 
static poly kTryHC (ideal F, ideal Q)
 
ideal kStd (ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
 
ideal kSba (ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, intvec *hilb, int syzComp, int newIdeal, intvec *vw)
 
ideal kStdShift (ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
 
ideal kMin_std (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, intvec *hilb, int syzComp, int reduced)
 
poly kNF (ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
 
poly kNFBound (ideal F, ideal Q, poly p, int bound, int syzComp, int lazyReduce)
 
ideal kNF (ideal F, ideal Q, ideal p, int syzComp, int lazyReduce)
 
ideal kNFBound (ideal F, ideal Q, ideal p, int bound, int syzComp, int lazyReduce)
 
poly k_NF (ideal F, ideal Q, poly p, int syzComp, int lazyReduce, const ring _currRing)
 NOTE: this is just a wrapper which sets currRing for the actual kNF call.
 
ideal kInterRedOld (ideal F, const ideal Q)
 
ideal kInterRedBba (ideal F, ideal Q, int &need_retry)
 
ideal kInterRed (ideal F, const ideal Q)
 

Variables

VAR BITSET kOptions
 
VAR BITSET validOpts
 
VAR intveckModW
 
VAR intveckHomW
 

Macro Definition Documentation

◆ MORA_USE_BUCKETS

#define MORA_USE_BUCKETS

Definition at line 12 of file kstd1.cc.

◆ PRE_INTEGER_CHECK

#define PRE_INTEGER_CHECK   0

Definition at line 14 of file kstd1.cc.

Function Documentation

◆ doRed()

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

Definition at line 119 of file kstd1.cc.

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

◆ enterSMora()

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

Definition at line 1624 of file kstd1.cc.

1625{
1626 enterSBba(p, atS, strat, atR);
1627 #ifdef KDEBUG
1628 if (TEST_OPT_DEBUG)
1629 {
1630 Print("new s%d:",atS);
1631 p_wrp(p.p,currRing,strat->tailRing);
1632 PrintLn();
1633 }
1634 #endif
1635 HEckeTest(p.p,strat);
1636 if (strat->kAllAxis)
1637 {
1638 if (newHEdge(strat))
1639 {
1640 firstUpdate(strat);
1641 if (TEST_OPT_FINDET)
1642 return;
1643
1644 /*- cuts elements in L above noether and reorders L -*/
1645 updateLHC(strat);
1646 /*- reorders L with respect to posInL -*/
1647 reorderL(strat);
1648 }
1649 }
1650 else if ((strat->kNoether==NULL)
1651 && (TEST_OPT_FASTHC))
1652 {
1653 if (strat->posInLOldFlag)
1654 {
1655 missingAxis(&strat->lastAxis,strat);
1656 if (strat->lastAxis)
1657 {
1658 strat->posInLOld = strat->posInL;
1659 strat->posInLOldFlag = FALSE;
1660 strat->posInL = posInL10;
1661 strat->posInLDependsOnLength = TRUE;
1662 updateL(strat);
1663 reorderL(strat);
1664 }
1665 }
1666 else if (strat->lastAxis)
1667 updateL(strat);
1668 }
1669}
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
int p
Definition cfModGcd.cc:4086
char posInLOldFlag
Definition kutil.h:380
poly kNoether
Definition kutil.h:329
int lastAxis
Definition kutil.h:355
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:284
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:288
char kAllAxis
Definition kutil.h:374
char posInLDependsOnLength
Definition kutil.h:387
#define Print
Definition emacs.cc:80
void firstUpdate(kStrategy strat)
Definition kstd1.cc:1557
void updateLHC(kStrategy strat)
Definition kstd1.cc:1465
void missingAxis(int *last, kStrategy strat)
Definition kstd1.cc:1280
void reorderL(kStrategy strat)
Definition kstd1.cc:1222
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1361
void updateL(kStrategy strat)
Definition kstd1.cc:1394
void HEckeTest(poly pp, kStrategy strat)
Definition kutil.cc:498
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8791
BOOLEAN newHEdge(kStrategy strat)
Definition kutil.cc:10404
#define TEST_OPT_FINDET
Definition options.h:112
#define TEST_OPT_FASTHC
Definition options.h:110
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373

◆ enterSMoraNF()

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

Definition at line 1677 of file kstd1.cc.

1678{
1679 enterSBba(p, atS, strat, atR);
1680 if ((!strat->kAllAxis) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1681 if (strat->kAllAxis)
1682 newHEdge(strat);
1683}

◆ firstUpdate()

void firstUpdate ( kStrategy  strat)

Definition at line 1557 of file kstd1.cc.

1558{
1559 if (strat->update)
1560 {
1561 kTest_TS(strat);
1562 strat->update = (strat->tl == -1);
1563 if (TEST_OPT_WEIGHTM)
1564 {
1566 if (strat->tailRing != currRing)
1567 {
1568 strat->tailRing->pFDeg = strat->pOrigFDeg_TailRing;
1569 strat->tailRing->pLDeg = strat->pOrigLDeg_TailRing;
1570 }
1571 int i;
1572 for (i=strat->Ll; i>=0; i--)
1573 {
1574 strat->L[i].SetpFDeg();
1575 }
1576 for (i=strat->tl; i>=0; i--)
1577 {
1578 strat->T[i].SetpFDeg();
1579 }
1580 if (ecartWeights)
1581 {
1582 omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
1584 }
1585 }
1586 if (TEST_OPT_FASTHC)
1587 {
1588 strat->posInL = strat->posInLOld;
1589 strat->lastAxis = 0;
1590 }
1591 if (TEST_OPT_FINDET)
1592 return;
1593
1595 {
1596 strat->red = redFirst;
1597 strat->use_buckets = kMoraUseBucket(strat);
1598 }
1599 updateT(strat);
1600
1602 {
1603 strat->posInT = posInT2;
1604 reorderT(strat);
1605 }
1606 }
1607 kTest_TS(strat);
1608}
int i
Definition cfEzgcd.cc:132
pFDegProc pOrigFDeg_TailRing
Definition kutil.h:298
int Ll
Definition kutil.h:351
TSet T
Definition kutil.h:326
int tl
Definition kutil.h:350
pFDegProc pOrigFDeg
Definition kutil.h:296
char use_buckets
Definition kutil.h:381
LSet L
Definition kutil.h:327
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:281
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:278
pLDegProc pOrigLDeg
Definition kutil.h:297
char update
Definition kutil.h:379
pLDegProc pOrigLDeg_TailRing
Definition kutil.h:299
void reorderT(kStrategy strat)
Definition kstd1.cc:1242
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:795
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition kstd1.cc:3888
void updateT(kStrategy strat)
Definition kstd1.cc:1531
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1071
int posInT2(const TSet set, const int length, LObject &p)
Definition kutil.cc:4930
#define omFreeSize(addr, size)
#define TEST_OPT_WEIGHTM
Definition options.h:122
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3670
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:597
BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:766
EXTERN_VAR short * ecartWeights
Definition weight.h:12

◆ hasPurePower() [1/2]

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

Definition at line 1313 of file kstd1.cc.

1314{
1315 poly h;
1316 int i;
1317
1318 if (pNext(p) == strat->tail)
1319 return FALSE;
1320 pp_Test(p, currRing, strat->tailRing);
1321 if (strat->ak <= 0 || p_MinComp(p, currRing, strat->tailRing) == strat->ak)
1322 {
1324 if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(p), currRing->cf))) i=0;
1325 if (i == last)
1326 {
1327 *length = 0;
1328 return TRUE;
1329 }
1330 *length = 1;
1331 h = pNext(p);
1332 while (h != NULL)
1333 {
1334 i = p_IsPurePower(h, strat->tailRing);
1335 if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(h), currRing->cf))) i=0;
1336 if (i==last) return TRUE;
1337 (*length)++;
1338 pIter(h);
1339 }
1340 }
1341 return FALSE;
1342}
int ak
Definition kutil.h:353
poly tail
Definition kutil.h:334
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition coeffs.h:519
STATIC_VAR poly last
Definition hdegree.cc:1144
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
#define pIter(p)
Definition monomials.h:37
#define pNext(p)
Definition monomials.h:36
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition monomials.h:44
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition p_polys.cc:1227
static long p_MinComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:313
#define pp_Test(p, lmRing, tailRing)
Definition p_polys.h:163

◆ hasPurePower() [2/2]

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

Definition at line 1344 of file kstd1.cc.

1345{
1346 if (L->bucket != NULL)
1347 {
1348 poly p = L->GetP();
1349 return hasPurePower(p, last, length, strat);
1350 }
1351 else
1352 {
1353 return hasPurePower(L->p, last, length, strat);
1354 }
1355}
BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition kstd1.cc:1313

◆ initBba()

void initBba ( kStrategy  strat)

Definition at line 1685 of file kstd1.cc.

1686{
1687 /* setting global variables ------------------- */
1688 strat->enterS = enterSBba;
1689 strat->red = redHoney;
1690 if (strat->honey)
1691 strat->red = redHoney;
1692 else if (currRing->pLexOrder && !strat->homog)
1693 strat->red = redLazy;
1694 else
1695 {
1696 strat->LazyPass *=4;
1697 strat->red = redHomog;
1698 }
1700 {
1701 if (rField_is_Z(currRing))
1702 strat->red = redRing_Z;
1703 else
1704 strat->red = redRing;
1705 }
1706 if (TEST_OPT_IDLIFT
1707 && (!rIsNCRing(currRing))
1708 && (!rField_is_Ring(currRing)))
1709 strat->red=redLiftstd;
1710 if (currRing->pLexOrder && strat->honey)
1711 strat->initEcart = initEcartNormal;
1712 else
1713 strat->initEcart = initEcartBBA;
1714 if (strat->honey)
1716 else
1718// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1719// {
1720// //interred machen Aenderung
1721// strat->pOrigFDeg=pFDeg;
1722// strat->pOrigLDeg=pLDeg;
1723// //h=ggetid("ecart");
1724// //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1725// //{
1726// // ecartWeights=iv2array(IDINTVEC(h));
1727// //}
1728// //else
1729// {
1730// ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1731// /*uses automatic computation of the ecartWeights to set them*/
1732// kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1733// }
1734// pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1735// if (TEST_OPT_PROT)
1736// {
1737// for(i=1; i<=(currRing->N); i++)
1738// Print(" %d",ecartWeights[i]);
1739// PrintLn();
1740// mflush();
1741// }
1742// }
1743}
char honey
Definition kutil.h:375
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:287
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition kutil.h:286
void(* initEcart)(TObject *L)
Definition kutil.h:280
int LazyPass
Definition kutil.h:353
char homog
Definition kutil.h:370
int redLiftstd(LObject *h, kStrategy strat)
Definition kLiftstd.cc:167
int redRing_Z(LObject *h, kStrategy strat)
Definition kstd2.cc:677
int redHoney(LObject *h, kStrategy strat)
Definition kstd2.cc:2067
int redHomog(LObject *h, kStrategy strat)
Definition kstd2.cc:1107
int redLazy(LObject *h, kStrategy strat)
Definition kstd2.cc:1862
int redRing(LObject *h, kStrategy strat)
Definition kstd2.cc:945
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1320
void initEcartNormal(TObject *h)
Definition kutil.cc:1298
void initEcartBBA(TObject *h)
Definition kutil.cc:1306
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition kutil.cc:1313
#define TEST_OPT_IDLIFT
Definition options.h:130
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:514
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:426

◆ initMora()

void initMora ( ideal  F,
kStrategy  strat 
)

Definition at line 1815 of file kstd1.cc.

1816{
1817 int i,j;
1818
1819 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1820 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1821 strat->enterS = enterSMora;
1822 strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1823 strat->posInLOld = strat->posInL;
1824 strat->posInLOldFlag = TRUE;
1825 strat->initEcart = initEcartNormal;
1826 strat->kAllAxis = (currRing->ppNoether) != NULL;
1827 if ( strat->kAllAxis )
1828 {
1829 strat->kNoether = pCopy((currRing->ppNoether));
1830 strat->red = redFirst; /*take the first possible in T*/
1831 if (TEST_OPT_PROT)
1832 {
1833 Print("H(%ld)",p_FDeg(strat->kNoether,currRing)+1);
1834 mflush();
1835 }
1836 }
1837 else if (strat->homog)
1838 strat->red = redFirst; /*take the first possible in T*/
1839 else
1840 strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1841 if (strat->kAllAxis)
1842 {
1843 HCord = currRing->pFDeg((strat->kNoether),currRing)+1;
1844 }
1845 else
1846 {
1847 HCord = 32000;/*- very large -*/
1848 }
1849
1851 {
1852 if (rField_is_Z(currRing))
1853 strat->red = redRiloc_Z;
1854 else
1855 strat->red = redRiloc;
1856 }
1857
1858 /*reads the ecartWeights used for Graebes method from the
1859 *intvec ecart and set ecartWeights
1860 */
1861 if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1862 {
1863 //interred machen Aenderung
1864 strat->pOrigFDeg=currRing->pFDeg;
1865 strat->pOrigLDeg=currRing->pLDeg;
1866 ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1867 /*uses automatic computation of the ecartWeights to set them*/
1869
1871 if (TEST_OPT_PROT)
1872 {
1873 for(i=1; i<=(currRing->N); i++)
1874 Print(" %d",ecartWeights[i]);
1875 PrintLn();
1876 mflush();
1877 }
1878 }
1879 kOptimizeLDeg(currRing->pLDeg, strat);
1880}
int BOOLEAN
Definition auxiliary.h:87
BOOLEAN * NotUsedAxis
Definition kutil.h:332
int j
Definition facHensel.cc:110
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:169
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition kstd1.cc:100
int redRiloc(LObject *h, kStrategy strat)
Definition kstd1.cc:386
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition kstd1.cc:1624
int redRiloc_Z(LObject *h, kStrategy strat)
Definition kstd1.cc:567
VAR int HCord
Definition kutil.cc:244
#define omAlloc(size)
#define TEST_OPT_PROT
Definition options.h:104
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3658
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:380
#define pCopy(p)
return a copy of the poly
Definition polys.h:185
#define mflush()
Definition reporter.h:58
#define IDELEMS(i)
long totaldegreeWecart(poly p, ring r)
Definition weight.cc:217
long maxdegreeWecart(poly p, int *l, ring r)
Definition weight.cc:247
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition weight.cc:182

◆ initSba()

void initSba ( ideal  F,
kStrategy  strat 
)

Definition at line 1745 of file kstd1.cc.

1746{
1747 int i;
1748 //idhdl h;
1749 /* setting global variables ------------------- */
1750 strat->enterS = enterSSba;
1751 strat->red2 = redHoney;
1752 if (strat->honey)
1753 strat->red2 = redHoney;
1754 else if (currRing->pLexOrder && !strat->homog)
1755 strat->red2 = redLazy;
1756 else
1757 {
1758 strat->LazyPass *=4;
1759 strat->red2 = redHomog;
1760 }
1762 {
1764 {strat->red2 = redRiloc;}
1765 else
1766 {strat->red2 = redRing;}
1767 }
1768 if (currRing->pLexOrder && strat->honey)
1769 strat->initEcart = initEcartNormal;
1770 else
1771 strat->initEcart = initEcartBBA;
1772 if (strat->honey)
1774 else
1776 //strat->kIdeal = NULL;
1777 //if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
1778 //else strat->kIdeal->rtyp=MODUL_CMD;
1779 //strat->kIdeal->data=(void *)strat->Shdl;
1780 if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1781 {
1782 //interred machen Aenderung
1783 strat->pOrigFDeg = currRing->pFDeg;
1784 strat->pOrigLDeg = currRing->pLDeg;
1785 //h=ggetid("ecart");
1786 //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1787 //{
1788 // ecartWeights=iv2array(IDINTVEC(h));
1789 //}
1790 //else
1791 {
1792 ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1793 /*uses automatic computation of the ecartWeights to set them*/
1795 }
1797 if (TEST_OPT_PROT)
1798 {
1799 for(i=1; i<=(currRing->N); i++)
1800 Print(" %d",ecartWeights[i]);
1801 PrintLn();
1802 mflush();
1803 }
1804 }
1805 // for sig-safe reductions in signature-based
1806 // standard basis computations
1808 strat->red = redSigRing;
1809 else
1810 strat->red = redSig;
1811 //strat->sbaOrder = 1;
1812 strat->currIdx = 1;
1813}
int currIdx
Definition kutil.h:317
int(* red2)(LObject *L, kStrategy strat)
Definition kutil.h:279
int redSigRing(LObject *h, kStrategy strat)
Definition kstd2.cc:1493
int redSig(LObject *h, kStrategy strat)
Definition kstd2.cc:1326
void enterSSba(LObject &p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8914
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:767

◆ k_NF()

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

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

Definition at line 3445 of file kstd1.cc.

3446{
3447 const ring save = currRing;
3449 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3451 return ret;
3452}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3231
void rChangeCurrRing(ring r)
Definition polys.cc:15
#define Q
Definition sirandom.c:26

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Definition at line 11497 of file kutil.cc.

11498{
11499 printf("red: ");
11500 if (strat->red==redFirst) printf("redFirst\n");
11501 else if (strat->red==redHoney) printf("redHoney\n");
11502 else if (strat->red==redEcart) printf("redEcart\n");
11503 else if (strat->red==redHomog) printf("redHomog\n");
11504 else if (strat->red==redLazy) printf("redLazy\n");
11505 else if (strat->red==redLiftstd) printf("redLiftstd\n");
11506 else printf("%p\n",(void*)strat->red);
11507 printf("posInT: ");
11508 if (strat->posInT==posInT0) printf("posInT0\n");
11509 else if (strat->posInT==posInT1) printf("posInT1\n");
11510 else if (strat->posInT==posInT11) printf("posInT11\n");
11511 else if (strat->posInT==posInT110) printf("posInT110\n");
11512 else if (strat->posInT==posInT13) printf("posInT13\n");
11513 else if (strat->posInT==posInT15) printf("posInT15\n");
11514 else if (strat->posInT==posInT17) printf("posInT17\n");
11515 else if (strat->posInT==posInT17_c) printf("posInT17_c\n");
11516 else if (strat->posInT==posInT19) printf("posInT19\n");
11517 else if (strat->posInT==posInT2) printf("posInT2\n");
11518 else if (strat->posInT==posInT11Ring) printf("posInT11Ring\n");
11519 else if (strat->posInT==posInT110Ring) printf("posInT110Ring\n");
11520 else if (strat->posInT==posInT15Ring) printf("posInT15Ring\n");
11521 else if (strat->posInT==posInT17Ring) printf("posInT17Ring\n");
11522 else if (strat->posInT==posInT17_cRing) printf("posInT17_cRing\n");
11523#ifdef HAVE_MORE_POS_IN_T
11524 else if (strat->posInT==posInT_EcartFDegpLength) printf("posInT_EcartFDegpLength\n");
11525 else if (strat->posInT==posInT_FDegpLength) printf("posInT_FDegpLength\n");
11526 else if (strat->posInT==posInT_pLength) printf("posInT_pLength\n");
11527#endif
11528 else if (strat->posInT==posInT_EcartpLength) printf("posInT_EcartpLength\n");
11529 else printf("%p\n",(void*)strat->posInT);
11530 printf("posInL: ");
11531 if (strat->posInL==posInL0) printf("posInL0\n");
11532 else if (strat->posInL==posInL10) printf("posInL10\n");
11533 else if (strat->posInL==posInL11) printf("posInL11\n");
11534 else if (strat->posInL==posInL110) printf("posInL110\n");
11535 else if (strat->posInL==posInL13) printf("posInL13\n");
11536 else if (strat->posInL==posInL15) printf("posInL15\n");
11537 else if (strat->posInL==posInL17) printf("posInL17\n");
11538 else if (strat->posInL==posInL17_c) printf("posInL17_c\n");
11539 else if (strat->posInL==posInL0) printf("posInL0Ring\n");
11540 else if (strat->posInL==posInL11Ring) printf("posInL11Ring\n");
11541 else if (strat->posInL==posInL11Ringls) printf("posInL11Ringls\n");
11542 else if (strat->posInL==posInL110Ring) printf("posInL110Ring\n");
11543 else if (strat->posInL==posInL15Ring) printf("posInL15Ring\n");
11544 else if (strat->posInL==posInL17Ring) printf("posInL17Ring\n");
11545 else if (strat->posInL==posInL17_cRing) printf("posInL17_cRing\n");
11546 else if (strat->posInL==posInLSpecial) printf("posInLSpecial\n");
11547 else printf("%p\n",(void*)strat->posInL);
11548 printf("enterS: ");
11549 if (strat->enterS==enterSBba) printf("enterSBba\n");
11550 else if (strat->enterS==enterSMora) printf("enterSMora\n");
11551 else if (strat->enterS==enterSMoraNF) printf("enterSMoraNF\n");
11552 else printf("%p\n",(void*)strat->enterS);
11553 printf("initEcart: ");
11554 if (strat->initEcart==initEcartBBA) printf("initEcartBBA\n");
11555 else if (strat->initEcart==initEcartNormal) printf("initEcartNormal\n");
11556 else printf("%p\n",(void*)strat->initEcart);
11557 printf("initEcartPair: ");
11558 if (strat->initEcartPair==initEcartPairBba) printf("initEcartPairBba\n");
11559 else if (strat->initEcartPair==initEcartPairMora) printf("initEcartPairMora\n");
11560 else printf("%p\n",(void*)strat->initEcartPair);
11561 printf("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11562 strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11563 printf("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11564 strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11565 printf("chainCrit: ");
11566 if (strat->chainCrit==chainCritNormal) printf("chainCritNormal\n");
11567 else if (strat->chainCrit==chainCritOpt_1) printf("chainCritOpt_1\n");
11568 else printf("%p\n",(void*)strat->chainCrit);
11569 printf("posInLDependsOnLength=%d\n",
11570 strat->posInLDependsOnLength);
11571 printf("%s\n",showOption());
11572 printf("LDeg: ");
11573 if (currRing->pLDeg==pLDeg0) printf("pLDeg0");
11574 else if (currRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11575 else if (currRing->pLDeg==pLDegb) printf("pLDegb");
11576 else if (currRing->pLDeg==pLDeg1) printf("pLDeg1");
11577 else if (currRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11578 else if (currRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11579 else if (currRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11580 else if (currRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11581 else if (currRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11582 else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11583 else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11584 else if (currRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11585 else printf("? (%lx)", (long)currRing->pLDeg);
11586 printf(" / ");
11587 if (strat->tailRing->pLDeg==pLDeg0) printf("pLDeg0");
11588 else if (strat->tailRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11589 else if (strat->tailRing->pLDeg==pLDegb) printf("pLDegb");
11590 else if (strat->tailRing->pLDeg==pLDeg1) printf("pLDeg1");
11591 else if (strat->tailRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11592 else if (strat->tailRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11593 else if (strat->tailRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11594 else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11595 else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11596 else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11597 else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11598 else if (strat->tailRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11599 else printf("? (%lx)", (long)strat->tailRing->pLDeg);
11600 printf("\n");
11601 printf("currRing->pFDeg: ");
11602 if (currRing->pFDeg==p_Totaldegree) printf("p_Totaldegree");
11603 else if (currRing->pFDeg==p_WFirstTotalDegree) printf("pWFirstTotalDegree");
11604 else if (currRing->pFDeg==p_Deg) printf("p_Deg");
11605 else if (currRing->pFDeg==kHomModDeg) printf("kHomModDeg");
11606 else if (currRing->pFDeg==totaldegreeWecart) printf("totaldegreeWecart");
11607 else if (currRing->pFDeg==p_WTotaldegree) printf("p_WTotaldegree");
11608 else printf("? (%lx)", (long)currRing->pFDeg);
11609 printf("\n");
11610 printf(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11612 printf(" degBound: %d\n", Kstd1_deg);
11613
11614 if( ecartWeights != NULL )
11615 {
11616 printf("ecartWeights: ");
11617 for (int i = rVar(currRing); i > 0; i--)
11618 printf("%hd ", ecartWeights[i]);
11619 printf("\n");
11621 }
11622
11623#ifndef SING_NDEBUG
11625#endif
11626}
int syzComp
Definition kutil.h:354
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:291
char noTailReduction
Definition kutil.h:376
char sugarCrit
Definition kutil.h:375
char Gebauer
Definition kutil.h:376
int LazyDegree
Definition kutil.h:353
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2422
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6301
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6414
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6060
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5283
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:795
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5846
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:169
int posInT11(const TSet set, const int length, LObject &p)
Definition kutil.cc:4958
int posInT1(const TSet set, const int length, LObject &p)
Definition kutil.cc:4901
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5076
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition kstd1.cc:1677
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:5151
int posInT0(const TSet, const int length, LObject &)
Definition kutil.cc:4890
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6147
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6101
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11463
int posInT13(const TSet set, const int length, LObject &p)
Definition kutil.cc:5122
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5616
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3450
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:4994
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6182
int posInT17_c(const TSet set, const int length, LObject &p)
Definition kutil.cc:5389
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11372
int posInT15(const TSet set, const int length, LObject &p)
Definition kutil.cc:5189
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5572
VAR int Kstd1_deg
Definition kutil.cc:245
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5914
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6257
int posInT110(const TSet set, const int length, LObject &p)
Definition kutil.cc:5034
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6217
int posInT19(const TSet set, const int length, LObject &p)
Definition kutil.cc:5515
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5243
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5344
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition kstd1.cc:1624
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition kutil.cc:5450
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6350
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11426
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3209
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5804
char * showOption()
Definition misc_ip.cc:709
#define assume(x)
Definition mod2.h:387
#define TEST_OPT_DEGBOUND
Definition options.h:114
long pLDegb(poly p, int *l, const ring r)
Definition p_polys.cc:812
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition p_polys.cc:976
long p_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:595
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition p_polys.cc:1039
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition p_polys.cc:1069
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition p_polys.cc:942
long pLDeg1(poly p, int *l, const ring r)
Definition p_polys.cc:842
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition p_polys.cc:911
long p_WTotaldegree(poly p, const ring r)
Definition p_polys.cc:612
long pLDeg1c(poly p, int *l, const ring r)
Definition p_polys.cc:878
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition p_polys.cc:1006
long pLDeg0c(poly p, int *l, const ring r)
Definition p_polys.cc:771
long pLDeg0(poly p, int *l, const ring r)
Definition p_polys.cc:740
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1521
void rDebugPrint(const ring r)
Definition ring.cc:4153
static int rGetCurrSyzLimit(const ring r)
Definition ring.h:728
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition ring.h:725

◆ kFindLuckyPrime()

static int kFindLuckyPrime ( ideal  F,
ideal  Q 
)
static

Definition at line 2434 of file kstd1.cc.

2435{
2436 int prim=32003;
2437 // assume coeff are in Q
2438 return prim;
2439}

◆ kHomModDeg()

long kHomModDeg ( poly  p,
const ring  r 
)

Definition at line 2422 of file kstd1.cc.

2423{
2424 int i;
2425 long j=0;
2426
2427 for (i=r->N;i>0;i--)
2428 j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2429 if (kModW == NULL) return j;
2430 i = __p_GetComp(p,r);
2431 if (i==0) return j;
2432 return j+(*kModW)[i-1];
2433}
VAR intvec * kModW
Definition kstd1.cc:2410
#define __p_GetComp(p, r)
Definition monomials.h:63
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition p_polys.h:469

◆ kInterRed()

ideal kInterRed ( ideal  F,
const ideal  Q 
)

Definition at line 3812 of file kstd1.cc.

3813{
3814#ifdef HAVE_PLURAL
3815 if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3816#endif
3819 )
3820 return kInterRedOld(F,Q);
3821
3822 //return kInterRedOld(F,Q);
3823
3824 BITSET save1;
3826 //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3828 //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3829 //si_opt_1&= ~Sy_bit(OPT_REDSB);
3830 //extern char * showOption() ;
3831 //Print("%s\n",showOption());
3832
3833 int need_retry;
3834 int counter=3;
3835 ideal res, res1;
3836 int elems;
3837 ideal null=NULL;
3838 if ((Q==NULL) || (!TEST_OPT_REDSB))
3839 {
3840 elems=idElem(F);
3842 }
3843 else
3844 {
3845 ideal FF=idSimpleAdd(F,Q);
3847 idDelete(&FF);
3848 null=idInit(1,1);
3849 if (need_retry)
3851 else
3852 res1=kNF(null,Q,res);
3853 idDelete(&res);
3854 res=res1;
3855 need_retry=1;
3856 }
3857 if (idElem(res)<=1) need_retry=0;
3858 while (need_retry && (counter>0))
3859 {
3860 #ifdef KDEBUG
3861 if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3862 #endif
3864 int new_elems=idElem(res1);
3865 counter -= (new_elems >= elems);
3866 elems = new_elems;
3867 idDelete(&res);
3868 if (idElem(res1)<=1) need_retry=0;
3869 if ((Q!=NULL) && (TEST_OPT_REDSB))
3870 {
3871 if (need_retry)
3873 else
3874 res=kNF(null,Q,res1);
3875 idDelete(&res1);
3876 }
3877 else
3878 res = res1;
3879 if (idElem(res)<=1) need_retry=0;
3880 }
3881 if (null!=NULL) idDelete(&null);
3884 return res;
3885}
CanonicalForm res
Definition facAbsFact.cc:60
#define idDelete(H)
delete an ideal
Definition ideals.h:29
#define idSimpleAdd(A, B)
Definition ideals.h:42
ideal kInterRedBba(ideal F, ideal Q, int &need_retry)
Definition kstd1.cc:3552
ideal kInterRedOld(ideal F, const ideal Q)
Definition kstd1.cc:3458
#define KSTD_NF_LAZY
Definition kstd1.h:17
#define KSTD_NF_NONORM
Definition kstd1.h:21
VAR unsigned si_opt_1
Definition options.c:5
#define SI_SAVE_OPT1(A)
Definition options.h:21
#define SI_RESTORE_OPT1(A)
Definition options.h:24
#define OPT_REDTHROUGH
Definition options.h:82
#define Sy_bit(x)
Definition options.h:31
#define TEST_OPT_REDSB
Definition options.h:105
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:520
ideal idInit(int idsize, int rank)
initialise an ideal / module
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static int idElem(const ideal F)
number of non-zero polys in F
#define BITSET
Definition structs.h:16

◆ kInterRedBba()

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

Definition at line 3552 of file kstd1.cc.

3553{
3554 need_retry=0;
3555 int red_result = 1;
3556 int olddeg,reduc;
3558 // BOOLEAN toReset=FALSE;
3559 kStrategy strat=new skStrategy;
3560 tHomog h;
3561
3563 strat->LazyPass=20;
3564 else
3565 strat->LazyPass=2;
3566 strat->LazyDegree = 1;
3567 strat->ak = id_RankFreeModule(F,currRing);
3568 strat->syzComp = strat->ak;
3569 strat->kModW=kModW=NULL;
3570 strat->kHomW=kHomW=NULL;
3571 if (strat->ak == 0)
3572 {
3573 h = (tHomog)idHomIdeal(F,Q);
3574 }
3575 else if (!TEST_OPT_DEGBOUND)
3576 {
3577 h = (tHomog)idHomIdeal(F,Q);
3578 }
3579 else
3580 h = isNotHomog;
3581 if (h==isHomog)
3582 {
3583 strat->LazyPass*=2;
3584 }
3585 strat->homog=h;
3586#ifdef KDEBUG
3587 idTest(F);
3588#endif
3589
3590 initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
3592 initBuchMoraPosRing(strat);
3593 else
3594 initBuchMoraPos(strat);
3595 initBba(strat);
3596 /*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
3597 strat->posInL=posInL0; /* ord according pComp */
3598
3599 /*Shdl=*/initBuchMora(F, Q, strat);
3600 reduc = olddeg = 0;
3601
3602#ifndef NO_BUCKETS
3604 strat->use_buckets = 1;
3605#endif
3606
3607 // redtailBBa against T for inhomogeneous input
3608 if (!TEST_OPT_OLDSTD)
3609 withT = ! strat->homog;
3610
3611 // strat->posInT = posInT_pLength;
3612 kTest_TS(strat);
3613
3614#ifdef HAVE_TAIL_RING
3616#endif
3617
3618 /* compute------------------------------------------------------- */
3619 while (strat->Ll >= 0)
3620 {
3621 #ifdef KDEBUG
3622 if (TEST_OPT_DEBUG) messageSets(strat);
3623 #endif
3624 if (strat->Ll== 0) strat->interpt=TRUE;
3625 /* picks the last element from the lazyset L */
3626 strat->P = strat->L[strat->Ll];
3627 strat->Ll--;
3628
3629 if (strat->P.p1 == NULL)
3630 {
3631 // for input polys, prepare reduction
3632 strat->P.PrepareRed(strat->use_buckets);
3633 }
3634
3635 if (strat->P.p == NULL && strat->P.t_p == NULL)
3636 {
3637 red_result = 0;
3638 }
3639 else
3640 {
3641 if (TEST_OPT_PROT)
3642 message(strat->P.pFDeg(),
3643 &olddeg,&reduc,strat, red_result);
3644
3645 /* reduction of the element chosen from L */
3646 red_result = strat->red(&strat->P,strat);
3647 }
3648
3649 // reduction to non-zero new poly
3650 if (red_result == 1)
3651 {
3652 /* statistic */
3653 if (TEST_OPT_PROT) PrintS("s");
3654
3655 // get the polynomial (canonicalize bucket, make sure P.p is set)
3656 strat->P.GetP(strat->lmBin);
3657
3658 int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
3659
3660 // reduce the tail and normalize poly
3661 // in the ring case we cannot expect LC(f) = 1,
3662 // therefore we call pCleardenom instead of pNorm
3664 {
3665 strat->P.pCleardenom();
3666 if (0)
3667 //if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
3668 {
3669 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3670 strat->P.pCleardenom();
3671 }
3672 }
3673 else
3674 {
3675 strat->P.pNorm();
3676 if (0)
3677 //if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
3678 strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
3679 }
3680
3681#ifdef KDEBUG
3682 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3683#endif
3684
3685 // enter into S, L, and T
3686 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3687 {
3688 enterT(strat->P, strat);
3689 // posInS only depends on the leading term
3690 strat->enterS(strat->P, pos, strat, strat->tl);
3691
3692 if (pos<strat->sl)
3693 {
3694 need_retry++;
3695 // move all "larger" elements fromS to L
3696 // remove them from T
3697 int ii=pos+1;
3698 for(;ii<=strat->sl;ii++)
3699 {
3700 LObject h;
3701 h.Clear();
3702 h.tailRing=strat->tailRing;
3703 h.p=strat->S[ii]; strat->S[ii]=NULL;
3704 strat->initEcart(&h);
3705 h.sev=strat->sevS[ii];
3706 int jj=strat->tl;
3707 while (jj>=0)
3708 {
3709 if (strat->T[jj].p==h.p)
3710 {
3711 strat->T[jj].p=NULL;
3712 if (jj<strat->tl)
3713 {
3714 memmove(&(strat->T[jj]),&(strat->T[jj+1]),
3715 (strat->tl-jj)*sizeof(strat->T[jj]));
3716 memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),
3717 (strat->tl-jj)*sizeof(strat->sevT[jj]));
3718 }
3719 strat->tl--;
3720 break;
3721 }
3722 jj--;
3723 }
3724 int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);
3725 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);
3726 #ifdef KDEBUG
3727 if (TEST_OPT_DEBUG)
3728 {
3729 Print("move S[%d] -> L[%d]: ",ii,pos);
3730 p_wrp(h.p,currRing, strat->tailRing);
3731 PrintLn();
3732 }
3733 #endif
3734 }
3735 if (strat->fromQ!=NULL)
3736 {
3737 for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;
3738 }
3739 strat->sl=pos;
3740 }
3741 }
3742 else
3743 {
3744 // clean P
3745 }
3746 kDeleteLcm(&strat->P);
3747 }
3748
3749#ifdef KDEBUG
3750 if (TEST_OPT_DEBUG)
3751 {
3752 messageSets(strat);
3753 }
3754 strat->P.Clear();
3755#endif
3756 //kTest_TS(strat);: i_r out of sync in kInterRedBba, but not used!
3757 }
3758#ifdef KDEBUG
3759 //if (TEST_OPT_DEBUG) messageSets(strat);
3760#endif
3761 /* complete reduction of the standard basis--------- */
3762
3763 if((need_retry<=0) && (TEST_OPT_REDSB))
3764 {
3765 completeReduce(strat);
3766 if (strat->completeReduce_retry)
3767 {
3768 // completeReduce needed larger exponents, retry
3769 // hopefully: kStratChangeTailRing already provided a larger tailRing
3770 // (otherwise: it will fail again)
3772 completeReduce(strat);
3773 if (strat->completeReduce_retry)
3774 {
3775#ifdef HAVE_TAIL_RING
3776 if(currRing->bitmask>strat->tailRing->bitmask)
3777 {
3778 // retry without T
3780 cleanT(strat);strat->tailRing=currRing;
3781 int i;
3782 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3783 completeReduce(strat);
3784 }
3785 if (strat->completeReduce_retry)
3786#endif
3787 Werror("exponent bound is %ld",currRing->bitmask);
3788 }
3789 }
3790 }
3791 else if (TEST_OPT_PROT) PrintLn();
3792
3793
3794 /* release temp data-------------------------------- */
3795 exitBuchMora(strat);
3796// if (TEST_OPT_WEIGHTM)
3797// {
3798// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
3799// if (ecartWeights)
3800// {
3801// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3802// ecartWeights=NULL;
3803// }
3804// }
3805 //if (TEST_OPT_PROT) messageStat(0/*hilbcount*/,strat);
3806 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3807 ideal res=strat->Shdl;
3808 strat->Shdl=NULL;
3809 delete strat;
3810 return res;
3811}
intvec * kModW
Definition kutil.h:335
int * S_2_R
Definition kutil.h:342
omBin lmBin
Definition kutil.h:344
polyset S
Definition kutil.h:306
unsigned long * sevT
Definition kutil.h:325
intvec * kHomW
Definition kutil.h:336
ideal Shdl
Definition kutil.h:303
intset fromQ
Definition kutil.h:321
char interpt
Definition kutil.h:369
char completeReduce_retry
Definition kutil.h:401
LObject P
Definition kutil.h:302
int Lmax
Definition kutil.h:351
int sl
Definition kutil.h:348
unsigned long * sevS
Definition kutil.h:322
#define idTest(id)
Definition ideals.h:47
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition kInline.h:1209
void initBba(kStrategy strat)
Definition kstd1.cc:1685
VAR intvec * kHomW
Definition kstd1.cc:2410
void message(int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
Definition kutil.cc:7465
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9748
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition kutil.cc:1274
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9577
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9833
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4668
void cleanT(kStrategy strat)
Definition kutil.cc:563
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10076
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11050
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9432
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10282
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9662
void messageSets(kStrategy strat)
Definition kutil.cc:7538
static void kDeleteLcm(LObject *P)
Definition kutil.h:868
#define TEST_OPT_OLDSTD
Definition options.h:124
#define TEST_OPT_NOT_BUCKETS
Definition options.h:106
#define pGetComp(p)
Component.
Definition polys.h:37
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:553
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition structs.h:35
@ isHomog
Definition structs.h:37
@ isNotHomog
Definition structs.h:36

◆ kInterRedOld()

ideal kInterRedOld ( ideal  F,
const ideal  Q 
)

Definition at line 3458 of file kstd1.cc.

3459{
3460 int j;
3461 kStrategy strat = new skStrategy;
3462
3463 ideal tempF = F;
3464 ideal tempQ = Q;
3465
3466#ifdef HAVE_PLURAL
3467 if(rIsSCA(currRing))
3468 {
3469 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3470 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3472
3473 // this should be done on the upper level!!! :
3474 // tempQ = SCAQuotient(currRing);
3475
3476 if(Q == currRing->qideal)
3478 }
3479#endif
3480
3481// if (TEST_OPT_PROT)
3482// {
3483// writeTime("start InterRed:");
3484// mflush();
3485// }
3486 //strat->syzComp = 0;
3487 strat->kAllAxis = (currRing->ppNoether) != NULL;
3488 strat->kNoether=pCopy((currRing->ppNoether));
3490 initBuchMoraCrit(strat);
3491 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
3492 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
3493 strat->enterS = enterSBba;
3494 strat->posInT = posInT17;
3495 strat->initEcart = initEcartNormal;
3496 strat->sl = -1;
3497 strat->tl = -1;
3498 strat->tmax = setmaxT;
3499 strat->T = initT();
3500 strat->R = initR();
3501 strat->sevT = initsevT();
3503 initS(tempF, tempQ, strat);
3504 if (TEST_OPT_REDSB)
3505 strat->noTailReduction=FALSE;
3506 updateS(TRUE,strat);
3508 completeReduce(strat);
3509 //else if (TEST_OPT_PROT) PrintLn();
3510 cleanT(strat);
3511 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
3512 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
3513 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
3514 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
3515 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
3516 omfree(strat->sevT);
3517 omfree(strat->S_2_R);
3518 omfree(strat->R);
3519
3520 if (strat->fromQ)
3521 {
3522 for (j=IDELEMS(strat->Shdl)-1;j>=0;j--)
3523 {
3524 if(strat->fromQ[j]) pDelete(&strat->Shdl->m[j]);
3525 }
3526 omFree((ADDRESS)strat->fromQ);
3527 strat->fromQ=NULL;
3528 }
3529// if (TEST_OPT_PROT)
3530// {
3531// writeTime("end Interred:");
3532// mflush();
3533// }
3534 ideal shdl=strat->Shdl;
3536 if (strat->fromQ)
3537 {
3538 omfree(strat->fromQ);
3539 strat->fromQ=NULL;
3541 idDelete(&shdl);
3542 shdl=res;
3543 }
3544 delete(strat);
3545#ifdef HAVE_PLURAL
3546 if( tempF != F )
3548#endif
3549 return shdl;
3550}
intset ecartS
Definition kutil.h:309
TObject ** R
Definition kutil.h:340
int tmax
Definition kutil.h:350
KINLINE TSet initT()
Definition kInline.h:84
KINLINE TObject ** initR()
Definition kInline.h:95
KINLINE unsigned long * initsevT()
Definition kInline.h:100
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3812
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7588
void updateS(BOOLEAN toT, kStrategy strat)
Definition kutil.cc:8556
#define setmaxT
Definition kutil.h:33
class sTObject TObject
Definition kutil.h:57
static bool rIsSCA(const ring r)
Definition nc.h:190
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition sca.cc:1518
#define omfree(addr)
#define omFree(addr)
#define pDelete(p_ptr)
Definition polys.h:186
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition polys.h:70
ideal SCAQuotient(const ring r)
Definition sca.h:10
static short scaLastAltVar(ring r)
Definition sca.h:25
static short scaFirstAltVar(ring r)
Definition sca.h:18
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix

◆ kMin_std()

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

Definition at line 3080 of file kstd1.cc.

3082{
3083 if(idIs0(F))
3084 {
3085 M=idInit(1,F->rank);
3086 return idInit(1,F->rank);
3087 }
3089 {
3090 ideal sb;
3091 sb = kStd(F, Q, h, w, hilb);
3093 if(IDELEMS(sb) <= IDELEMS(F))
3094 {
3095 M = idCopy(sb);
3096 idSkipZeroes(M);
3097 return(sb);
3098 }
3099 else
3100 {
3101 M = idCopy(F);
3102 idSkipZeroes(M);
3103 return(sb);
3104 }
3105 }
3106 ideal r=NULL;
3107 int Kstd1_OldDeg = Kstd1_deg,i;
3109 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3112 kStrategy strat=new skStrategy;
3113
3115 strat->syzComp = syzComp;
3117 strat->LazyPass=20;
3118 else
3119 strat->LazyPass=2;
3120 strat->LazyDegree = 1;
3121 strat->minim=(reduced % 2)+1;
3122 strat->ak = id_RankFreeModule(F,currRing);
3123 if (delete_w)
3124 {
3125 temp_w=new intvec((strat->ak)+1);
3126 w = &temp_w;
3127 }
3128 if (h==testHomog)
3129 {
3130 if (strat->ak == 0)
3131 {
3132 h = (tHomog)idHomIdeal(F,Q);
3133 w=NULL;
3134 }
3135 else
3136 {
3137 h = (tHomog)idHomModule(F,Q,w);
3138 }
3139 }
3140 if (h==isHomog)
3141 {
3142 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3143 {
3144 kModW = *w;
3145 strat->kModW = *w;
3146 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3147 strat->pOrigFDeg = currRing->pFDeg;
3148 strat->pOrigLDeg = currRing->pLDeg;
3150
3151 toReset = TRUE;
3152 if (reduced>1)
3153 {
3155 Kstd1_deg = -1;
3156 for (i=IDELEMS(F)-1;i>=0;i--)
3157 {
3158 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3159 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3160 }
3161 }
3162 }
3163 currRing->pLexOrder = TRUE;
3164 strat->LazyPass*=2;
3165 }
3166 strat->homog=h;
3167 ideal SB=NULL;
3169 {
3170 r=idMinBase(F,&SB); // SB and M via minbase
3171 strat->M=r;
3172 r=SB;
3173 }
3174 else
3175 {
3176 if (w!=NULL)
3177 r=bba(F,Q,*w,hilb,strat);
3178 else
3179 r=bba(F,Q,NULL,hilb,strat);
3180 }
3181#ifdef KDEBUG
3182 {
3183 int i;
3184 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3185 }
3186#endif
3187 idSkipZeroes(r);
3188 if (toReset)
3189 {
3191 kModW = NULL;
3192 }
3193 currRing->pLexOrder = b;
3194 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3195 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3196 {
3197 M=idInit(1,F->rank);
3198 M->m[0]=pOne();
3199 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3200 if (strat->M!=NULL) idDelete(&strat->M);
3201 }
3202 else if (strat->M==NULL)
3203 {
3204 M=idInit(1,F->rank);
3205 WarnS("no minimal generating set computed");
3206 }
3207 else
3208 {
3209 idSkipZeroes(strat->M);
3210 M=strat->M;
3211 strat->M=NULL;
3212 }
3213 delete(strat);
3214 if (reduced>2)
3215 {
3217 if (!oldDegBound)
3218 si_opt_1 &= ~Sy_bit(OPT_DEGBOUND);
3219 }
3220 else
3221 {
3222 if (IDELEMS(M)>IDELEMS(r))
3223 {
3224 idDelete(&M);
3225 M=idCopy(r);
3226 }
3227 }
3228 return r;
3229}
CanonicalForm b
Definition cfModGcd.cc:4111
int minim
Definition kutil.h:357
ideal M
Definition kutil.h:305
#define WarnS
Definition emacs.cc:78
const CanonicalForm & w
Definition facAbsFact.cc:51
ideal idMinBase(ideal h1, ideal *SB)
Definition ideals.cc:51
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
static BOOLEAN idHomModule(ideal m, ideal Q, intvec **w)
Definition ideals.h:96
ideal idCopy(ideal A)
Definition ideals.h:60
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2412
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition kstd1.cc:2483
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:52
ideal bba(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd2.cc:2609
#define TEST_OPT_RETURN_SB
Definition options.h:113
#define OPT_DEGBOUND
Definition options.h:90
#define pTest(p)
Definition polys.h:414
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:238
#define pOne()
Definition polys.h:315
#define M
Definition sirandom.c:25
@ testHomog
Definition structs.h:38

◆ kModDeg()

long kModDeg ( poly  p,
const ring  r 
)

Definition at line 2412 of file kstd1.cc.

2413{
2414 long o=p_WDegree(p, r);
2415 long i=__p_GetComp(p, r);
2416 if (i==0) return o;
2417 //assume((i>0) && (i<=kModW->length()));
2418 if (i<=kModW->length())
2419 return o+(*kModW)[i-1];
2420 return o;
2421}
long p_WDegree(poly p, const ring r)
Definition p_polys.cc:715

◆ kMoraUseBucket()

static BOOLEAN kMoraUseBucket ( kStrategy  strat)
static

Definition at line 3888 of file kstd1.cc.

3889{
3890#ifdef MORA_USE_BUCKETS
3892 return FALSE;
3893 if (strat->red == redFirst)
3894 {
3895#ifdef NO_LDEG
3896 if (strat->syzComp==0)
3897 return TRUE;
3898#else
3899 if ((strat->homog || strat->honey) && (strat->syzComp==0))
3900 return TRUE;
3901#endif
3902 }
3903 else
3904 {
3905 assume(strat->red == redEcart || strat->red == redRiloc || strat->red == redRiloc_Z);
3906 if (strat->honey && (strat->syzComp==0))
3907 return TRUE;
3908 }
3909#endif
3910 return FALSE;
3911}

◆ kNF() [1/2]

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

Definition at line 3329 of file kstd1.cc.

3330{
3331 ideal res;
3332 if (TEST_OPT_PROT)
3333 {
3334 Print("(S:%d)",IDELEMS(p));mflush();
3335 }
3336 if (idIs0(p))
3337 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3338
3339 ideal pp = p;
3340#ifdef HAVE_PLURAL
3341 if(rIsSCA(currRing))
3342 {
3343 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3344 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3346
3347 if(Q == currRing->qideal)
3349 }
3350#endif
3351
3352 if ((Q!=NULL)&&(idIs0(Q))) Q=NULL;
3353
3354 if ((idIs0(F))&&(Q==NULL))
3355 {
3356#ifdef HAVE_PLURAL
3357 if(p != pp)
3358 return pp;
3359#endif
3360 return idCopy(p); /*F+Q=0*/
3361 }
3362
3363 kStrategy strat=new skStrategy;
3364 strat->syzComp = syzComp;
3366 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3367 {
3368 strat->ak = si_max(strat->ak,(int)F->rank);
3369 }
3370
3372 {
3373#ifdef HAVE_SHIFTBBA
3374 if (currRing->isLPring)
3375 {
3376 WerrorS("No local ordering possible for shift algebra");
3377 return(NULL);
3378 }
3379#endif
3380 res=kNF1(F,Q,pp,strat,lazyReduce);
3381 }
3382 else
3383 res=kNF2(F,Q,pp,strat,lazyReduce);
3384 delete(strat);
3385
3386#ifdef HAVE_PLURAL
3387 if(pp != p)
3389#endif
3390
3391 return res;
3392}
static int si_max(const int a, const int b)
Definition auxiliary.h:124
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition cf_gcd.cc:676
void WerrorS(const char *s)
Definition feFopen.cc:24
poly kNF1(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition kstd1.cc:2120
poly kNF2(ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
Definition kstd2.cc:3929

◆ kNF() [2/2]

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

Definition at line 3231 of file kstd1.cc.

3232{
3233 if (p==NULL)
3234 return NULL;
3235
3236 poly pp = p;
3237
3238#ifdef HAVE_PLURAL
3239 if(rIsSCA(currRing))
3240 {
3241 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3242 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3244
3245 if(Q == currRing->qideal)
3247 }
3248#endif
3249 if((Q!=NULL) &&(idIs0(Q))) Q=NULL;
3250
3251 if ((idIs0(F))&&(Q==NULL))
3252 {
3253#ifdef HAVE_PLURAL
3254 if(p != pp)
3255 return pp;
3256#endif
3257 return pCopy(p); /*F+Q=0*/
3258 }
3259
3260 kStrategy strat=new skStrategy;
3261 strat->syzComp = syzComp;
3263 poly res;
3264
3266 {
3267#ifdef HAVE_SHIFTBBA
3268 if (currRing->isLPring)
3269 {
3270 WerrorS("No local ordering possible for shift algebra");
3271 return(NULL);
3272 }
3273#endif
3274 res=kNF1(F,Q,pp,strat,lazyReduce);
3275 }
3276 else
3277 res=kNF2(F,Q,pp,strat,lazyReduce);
3278 delete(strat);
3279
3280#ifdef HAVE_PLURAL
3281 if(pp != p)
3282 p_Delete(&pp, currRing);
3283#endif
3284 return res;
3285}
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition sca.cc:1463
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:901
#define pMaxComp(p)
Definition polys.h:299

◆ kNF1() [1/2]

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

Definition at line 2261 of file kstd1.cc.

2262{
2263 assume(!idIs0(q));
2264 assume(!(idIs0(F)&&(Q==NULL)));
2265
2266// lazy_reduce flags: can be combined by |
2267//#define KSTD_NF_LAZY 1
2268 // do only a reduction of the leading term
2269//#define KSTD_NF_ECART 2
2270 // only local: reduce even with bad ecart
2271 poly p;
2272 int i;
2273 int j;
2274 int o;
2275 LObject h;
2276 ideal res;
2277 BITSET save1;
2279
2280 //if (idIs0(q)) return idInit(IDELEMS(q),si_max(q->rank,F->rank));
2281 //if ((idIs0(F))&&(Q==NULL))
2282 // return idCopy(q); /*F=0*/
2283 //strat->ak = si_max(idRankFreeModule(F),idRankFreeModule(q));
2284 /*- creating temp data structures------------------- -*/
2285 strat->kAllAxis = (currRing->ppNoether) != NULL;
2286 strat->kNoether=pCopy((currRing->ppNoether));
2289 && (0<Kstd1_deg)
2290 && ((strat->kNoether==NULL)
2292 {
2293 pLmDelete(&strat->kNoether);
2294 strat->kNoether=pOne();
2295 pSetExp(strat->kNoether,1, Kstd1_deg+1);
2296 pSetm(strat->kNoether);
2297 //strat->kAllAxis=TRUE;
2298 }
2299 initBuchMoraCrit(strat);
2301 initBuchMoraPosRing(strat);
2302 else
2303 initBuchMoraPos(strat);
2304 initMora(F,strat);
2305 strat->enterS = enterSMoraNF;
2306 /*- set T -*/
2307 strat->tl = -1;
2308 strat->tmax = setmaxT;
2309 strat->T = initT();
2310 strat->R = initR();
2311 strat->sevT = initsevT();
2312 /*- set S -*/
2313 strat->sl = -1;
2314 /*- init local data struct.-------------------------- -*/
2315 /*Shdl=*/initS(F,Q,strat);
2316 if ((strat->ak!=0)
2317 && (strat->kNoether!=NULL))
2318 {
2319 if (strat->ak!=1)
2320 {
2321 pSetComp(strat->kNoether,1);
2322 pSetmComp(strat->kNoether);
2323 poly p=pHead(strat->kNoether);
2324 pSetComp(p,strat->ak);
2325 pSetmComp(p);
2326 p=pAdd(strat->kNoether,p);
2327 strat->kNoether=pNext(p);
2329 }
2330 }
2331 if (((lazyReduce & KSTD_NF_LAZY)==0)
2332 && (!rField_is_Ring(currRing)))
2333 {
2334 for (i=strat->sl; i>=0; i--)
2335 pNorm(strat->S[i]);
2336 }
2337 /*- compute------------------------------------------- -*/
2338 res=idInit(IDELEMS(q),strat->ak);
2339 for (i=0; i<IDELEMS(q); i++)
2340 {
2341 if (q->m[i]!=NULL)
2342 {
2343 p = pCopy(q->m[i]);
2344 deleteHC(&p,&o,&j,strat);
2345 if (p!=NULL)
2346 {
2347 /*- puts the elements of S also to T -*/
2348 for (j=0; j<=strat->sl; j++)
2349 {
2350 h.p = strat->S[j];
2351 h.ecart = strat->ecartS[j];
2352 h.pLength = h.length = pLength(h.p);
2353 if (strat->sevS[j] == 0) strat->sevS[j] = pGetShortExpVector(h.p);
2354 else assume(strat->sevS[j] == pGetShortExpVector(h.p));
2355 h.sev = strat->sevS[j];
2356 h.SetpFDeg();
2358 enterT_strong(h,strat);
2359 else
2360 enterT(h,strat);
2361 }
2362 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2364 {
2365 p = redMoraNFRing(p,strat, lazyReduce);
2366 }
2367 else
2368 p = redMoraNF(p,strat, lazyReduce);
2369 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2370 {
2371 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2372 p = redtail(p,strat->sl,strat);
2373 }
2374 cleanT(strat);
2375 }
2376 res->m[i]=p;
2377 }
2378 //else
2379 // res->m[i]=NULL;
2380 }
2381 /*- release temp data------------------------------- -*/
2382 assume(strat->L==NULL); /*strat->L unused */
2383 assume(strat->B==NULL); /*strat->B unused */
2384 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2385 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2386 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2387 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2388 omFree(strat->sevT);
2389 omFree(strat->S_2_R);
2390 omFree(strat->R);
2391 omfree((ADDRESS)strat->fromQ);
2392 strat->fromQ=NULL;
2393 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
2394// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2395// {
2396// pFDeg=strat->pOrigFDeg;
2397// pLDeg=strat->pOrigLDeg;
2398// if (ecartWeights)
2399// {
2400// omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2401// ecartWeights=NULL;
2402// }
2403// }
2404 idDelete(&strat->Shdl);
2406 if (TEST_OPT_PROT) PrintLn();
2407 return res;
2408}
LSet B
Definition kutil.h:328
void initMora(ideal F, kStrategy strat)
Definition kstd1.cc:1815
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition kstd1.cc:1677
static poly redMoraNFRing(poly h, kStrategy strat, int flag)
Definition kstd1.cc:1080
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition kutil.cc:6838
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition kutil.cc:291
#define OPT_REDTAIL
Definition options.h:91
#define TEST_OPT_STAIRCASEBOUND
Definition options.h:116
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:723
#define pAdd(p, q)
Definition polys.h:203
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:67
#define pSetm(p)
Definition polys.h:271
void pNorm(poly p)
Definition polys.h:362
#define pSetComp(p, v)
Definition polys.h:38
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:76
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:152
#define pSetmComp(p)
TODO:
Definition polys.h:273
#define pSetExp(p, i, v)
Definition polys.h:42
#define pWTotaldegree(p)
Definition polys.h:283

◆ kNF1() [2/2]

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

Definition at line 2120 of file kstd1.cc.

2121{
2122 assume(q!=NULL);
2123 assume(!(idIs0(F)&&(Q==NULL)));
2124
2125// lazy_reduce flags: can be combined by |
2126//#define KSTD_NF_LAZY 1
2127 // do only a reduction of the leading term
2128//#define KSTD_NF_ECART 2
2129 // only local: reduce even with bad ecart
2130 poly p;
2131 int i;
2132 int j;
2133 int o;
2134 LObject h;
2135 BITSET save1;
2137
2138 //if ((idIs0(F))&&(Q==NULL))
2139 // return pCopy(q); /*F=0*/
2140 //strat->ak = si_max(idRankFreeModule(F),pMaxComp(q));
2141 /*- creating temp data structures------------------- -*/
2142 strat->kAllAxis = (currRing->ppNoether) != NULL;
2143 strat->kNoether = pCopy((currRing->ppNoether));
2146 si_opt_1&=~Sy_bit(OPT_INTSTRATEGY);
2148 && (! TEST_V_DEG_STOP)
2149 && (0<Kstd1_deg)
2150 && ((strat->kNoether==NULL)
2152 {
2153 pLmDelete(&strat->kNoether);
2154 strat->kNoether=pOne();
2155 pSetExp(strat->kNoether,1, Kstd1_deg+1);
2156 pSetm(strat->kNoether);
2157 // strat->kAllAxis=TRUE;
2158 }
2159 initBuchMoraCrit(strat);
2161 initBuchMoraPosRing(strat);
2162 else
2163 initBuchMoraPos(strat);
2164 initMora(F,strat);
2165 strat->enterS = enterSMoraNF;
2166 /*- set T -*/
2167 strat->tl = -1;
2168 strat->tmax = setmaxT;
2169 strat->T = initT();
2170 strat->R = initR();
2171 strat->sevT = initsevT();
2172 /*- set S -*/
2173 strat->sl = -1;
2174 /*- init local data struct.-------------------------- -*/
2175 /*Shdl=*/initS(F,Q,strat);
2176 if ((strat->ak!=0)
2177 && (strat->kAllAxis)) /*never true for ring-cf*/
2178 {
2179 if (strat->ak!=1)
2180 {
2181 pSetComp(strat->kNoether,1);
2182 pSetmComp(strat->kNoether);
2183 poly p=pHead(strat->kNoether);
2184 pSetComp(p,strat->ak);
2185 pSetmComp(p);
2186 p=pAdd(strat->kNoether,p);
2187 strat->kNoether=pNext(p);
2189 }
2190 }
2191 if (((lazyReduce & KSTD_NF_LAZY)==0)
2192 && (!rField_is_Ring(currRing)))
2193 {
2194 for (i=strat->sl; i>=0; i--)
2195 pNorm(strat->S[i]);
2196 }
2197 /*- puts the elements of S also to T -*/
2198 for (i=0; i<=strat->sl; i++)
2199 {
2200 h.p = strat->S[i];
2201 h.ecart = strat->ecartS[i];
2202 if (strat->sevS[i] == 0) strat->sevS[i] = pGetShortExpVector(h.p);
2203 else assume(strat->sevS[i] == pGetShortExpVector(h.p));
2204 h.length = pLength(h.p);
2205 h.sev = strat->sevS[i];
2206 h.SetpFDeg();
2207 enterT(h,strat);
2208 }
2209#ifdef KDEBUG
2210// kDebugPrint(strat);
2211#endif
2212 /*- compute------------------------------------------- -*/
2213 p = pCopy(q);
2214 deleteHC(&p,&o,&j,strat);
2215 kTest(strat);
2216 if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
2217 if (BVERBOSE(23)) kDebugPrint(strat);
2219 {
2220 if (p!=NULL) p = redMoraNFRing(p,strat, lazyReduce & KSTD_NF_ECART);
2221 }
2222 else
2223 {
2224 if (p!=NULL) p = redMoraNF(p,strat, lazyReduce & KSTD_NF_ECART);
2225 }
2226 if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
2227 {
2228 if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
2229 p = redtail(p,strat->sl,strat);
2230 }
2231 /*- release temp data------------------------------- -*/
2232 cleanT(strat);
2233 assume(strat->L==NULL); /*strat->L unused */
2234 assume(strat->B==NULL); /*strat->B unused */
2235 omFreeSize((ADDRESS)strat->T,strat->tmax*sizeof(TObject));
2236 omFreeSize((ADDRESS)strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
2237 omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
2238 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2239 omFree(strat->sevT);
2240 omFree(strat->S_2_R);
2241 omFree(strat->R);
2242
2243 omfree((ADDRESS)strat->fromQ);
2244 strat->fromQ=NULL;
2245 if (strat->kNoether!=NULL) pLmFree(&strat->kNoether);
2246// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
2247// {
2248// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2249// if (ecartWeights)
2250// {
2251// omFreeSize((ADDRESS *)&ecartWeights,((currRing->N)+1)*sizeof(short));
2252// ecartWeights=NULL;
2253// }
2254// }
2255 idDelete(&strat->Shdl);
2257 if (TEST_OPT_PROT) PrintLn();
2258 return p;
2259}
void kDebugPrint(kStrategy strat)
Definition kutil.cc:11497
#define KSTD_NF_ECART
Definition kstd1.h:19
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1010
#define OPT_INTSTRATEGY
Definition options.h:92
#define BVERBOSE(a)
Definition options.h:35
#define TEST_V_DEG_STOP
Definition options.h:138

◆ kNFBound() [1/2]

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

Definition at line 3394 of file kstd1.cc.

3395{
3396 ideal res;
3397 if (TEST_OPT_PROT)
3398 {
3399 Print("(S:%d)",IDELEMS(p));mflush();
3400 }
3401 if (idIs0(p))
3402 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3403
3404 ideal pp = p;
3405#ifdef HAVE_PLURAL
3406 if(rIsSCA(currRing))
3407 {
3408 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3409 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3411
3412 if(Q == currRing->qideal)
3414 }
3415#endif
3416
3417 if ((idIs0(F))&&(Q==NULL))
3418 {
3419#ifdef HAVE_PLURAL
3420 if(p != pp)
3421 return pp;
3422#endif
3423 return idCopy(p); /*F+Q=0*/
3424 }
3425
3426 kStrategy strat=new skStrategy;
3427 strat->syzComp = syzComp;
3429 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3430 {
3431 strat->ak = si_max(strat->ak,(int)F->rank);
3432 }
3433
3434 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3435 delete(strat);
3436
3437#ifdef HAVE_PLURAL
3438 if(pp != p)
3440#endif
3441
3442 return res;
3443}
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
poly kNF2Bound(ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
Definition kstd2.cc:4015

◆ kNFBound() [2/2]

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

Definition at line 3287 of file kstd1.cc.

3288{
3289 if (p==NULL)
3290 return NULL;
3291
3292 poly pp = p;
3293
3294#ifdef HAVE_PLURAL
3295 if(rIsSCA(currRing))
3296 {
3297 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3298 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3300
3301 if(Q == currRing->qideal)
3303 }
3304#endif
3305
3306 if ((idIs0(F))&&(Q==NULL))
3307 {
3308#ifdef HAVE_PLURAL
3309 if(p != pp)
3310 return pp;
3311#endif
3312 return pCopy(p); /*F+Q=0*/
3313 }
3314
3315 kStrategy strat=new skStrategy;
3316 strat->syzComp = syzComp;
3318 poly res;
3319 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3320 delete(strat);
3321
3322#ifdef HAVE_PLURAL
3323 if(pp != p)
3324 p_Delete(&pp, currRing);
3325#endif
3326 return res;
3327}

◆ kOptimizeLDeg()

static void kOptimizeLDeg ( pLDegProc  ldeg,
kStrategy  strat 
)
static

Definition at line 100 of file kstd1.cc.

101{
102// if (strat->ak == 0 && !rIsSyzIndexRing(currRing))
103 strat->length_pLength = TRUE;
104// else
105// strat->length_pLength = FALSE;
106
107 if ((ldeg == pLDeg0c /*&& !rIsSyzIndexRing(currRing)*/) ||
108 (ldeg == pLDeg0 && strat->ak == 0))
109 {
110 strat->LDegLast = TRUE;
111 }
112 else
113 {
114 strat->LDegLast = FALSE;
115 }
116}
char LDegLast
Definition kutil.h:383
char length_pLength
Definition kutil.h:385

◆ kSba()

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

Definition at line 2682 of file kstd1.cc.

2684{
2685 if(idIs0(F))
2686 return idInit(1,F->rank);
2688 {
2689 ideal r;
2690 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2692 kStrategy strat=new skStrategy;
2693 strat->sbaOrder = sbaOrder;
2694 if (arri!=0)
2695 {
2696 strat->rewCrit1 = arriRewDummy;
2697 strat->rewCrit2 = arriRewCriterion;
2699 }
2700 else
2701 {
2705 }
2706
2708 strat->syzComp = syzComp;
2709 if (TEST_OPT_SB_1)
2710 //if(!rField_is_Ring(currRing)) // always true here
2711 strat->newIdeal = newIdeal;
2713 strat->LazyPass=20;
2714 else
2715 strat->LazyPass=2;
2716 strat->LazyDegree = 1;
2720 strat->ak = id_RankFreeModule(F,currRing);
2721 strat->kModW=kModW=NULL;
2722 strat->kHomW=kHomW=NULL;
2723 if (vw != NULL)
2724 {
2725 currRing->pLexOrder=FALSE;
2726 strat->kHomW=kHomW=vw;
2727 strat->pOrigFDeg = currRing->pFDeg;
2728 strat->pOrigLDeg = currRing->pLDeg;
2730 toReset = TRUE;
2731 }
2732 if (h==testHomog)
2733 {
2734 if (strat->ak == 0)
2735 {
2736 h = (tHomog)idHomIdeal(F,Q);
2737 w=NULL;
2738 }
2739 else if (!TEST_OPT_DEGBOUND)
2740 {
2741 if (w!=NULL)
2742 h = (tHomog)idHomModule(F,Q,w);
2743 else
2744 h = (tHomog)idHomIdeal(F,Q);
2745 }
2746 }
2747 currRing->pLexOrder=b;
2748 if (h==isHomog)
2749 {
2750 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2751 {
2752 strat->kModW = kModW = *w;
2753 if (vw == NULL)
2754 {
2755 strat->pOrigFDeg = currRing->pFDeg;
2756 strat->pOrigLDeg = currRing->pLDeg;
2758 toReset = TRUE;
2759 }
2760 }
2761 currRing->pLexOrder = TRUE;
2762 if (hilb==NULL) strat->LazyPass*=2;
2763 }
2764 strat->homog=h;
2765 #ifdef KDEBUG
2766 idTest(F);
2767 if(Q != NULL)
2768 idTest(Q);
2769 #endif
2770 #ifdef HAVE_PLURAL
2772 {
2773 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2774 strat->no_prod_crit = ! bIsSCA;
2775 if (w!=NULL)
2776 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2777 else
2778 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2779 }
2780 else
2781 #endif
2782 {
2784 {
2785 if (w!=NULL)
2786 r=mora(F,Q,*w,hilb,strat);
2787 else
2788 r=mora(F,Q,NULL,hilb,strat);
2789 }
2790 else
2791 {
2792 strat->sigdrop = FALSE;
2793 if (w!=NULL)
2794 r=sba(F,Q,*w,hilb,strat);
2795 else
2796 r=sba(F,Q,NULL,hilb,strat);
2797 }
2798 }
2799 #ifdef KDEBUG
2800 idTest(r);
2801 #endif
2802 if (toReset)
2803 {
2804 kModW = NULL;
2806 }
2807 currRing->pLexOrder = b;
2808 //Print("%d reductions canceled \n",strat->cel);
2809 //delete(strat);
2810 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2811 return r;
2812 }
2813 else
2814 {
2815 //--------------------------RING CASE-------------------------
2816 assume(sbaOrder == 1);
2817 assume(arri == 0);
2818 ideal r;
2819 r = idCopy(F);
2820 int sbaEnterS = -1;
2821 bool sigdrop = TRUE;
2822 //This is how we set the SBA algorithm;
2823 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2824 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2825 && (blockred <= blockedreductions))
2826 {
2827 loops++;
2828 if(loops == 1)
2829 sigdrop = FALSE;
2830 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2832 kStrategy strat=new skStrategy;
2833 strat->sbaEnterS = sbaEnterS;
2834 strat->sigdrop = sigdrop;
2835 #if 0
2836 strat->blockred = blockred;
2837 #else
2838 strat->blockred = 0;
2839 #endif
2841 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2842 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2843 strat->sbaOrder = sbaOrder;
2844 if (arri!=0)
2845 {
2846 strat->rewCrit1 = arriRewDummy;
2847 strat->rewCrit2 = arriRewCriterion;
2849 }
2850 else
2851 {
2855 }
2856
2858 strat->syzComp = syzComp;
2859 if (TEST_OPT_SB_1)
2861 strat->newIdeal = newIdeal;
2863 strat->LazyPass=20;
2864 else
2865 strat->LazyPass=2;
2866 strat->LazyDegree = 1;
2870 strat->ak = id_RankFreeModule(F,currRing);
2871 strat->kModW=kModW=NULL;
2872 strat->kHomW=kHomW=NULL;
2873 if (vw != NULL)
2874 {
2875 currRing->pLexOrder=FALSE;
2876 strat->kHomW=kHomW=vw;
2877 strat->pOrigFDeg = currRing->pFDeg;
2878 strat->pOrigLDeg = currRing->pLDeg;
2880 toReset = TRUE;
2881 }
2882 if (h==testHomog)
2883 {
2884 if (strat->ak == 0)
2885 {
2886 h = (tHomog)idHomIdeal(F,Q);
2887 w=NULL;
2888 }
2889 else if (!TEST_OPT_DEGBOUND)
2890 {
2891 if (w!=NULL)
2892 h = (tHomog)idHomModule(F,Q,w);
2893 else
2894 h = (tHomog)idHomIdeal(F,Q);
2895 }
2896 }
2897 currRing->pLexOrder=b;
2898 if (h==isHomog)
2899 {
2900 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2901 {
2902 strat->kModW = kModW = *w;
2903 if (vw == NULL)
2904 {
2905 strat->pOrigFDeg = currRing->pFDeg;
2906 strat->pOrigLDeg = currRing->pLDeg;
2908 toReset = TRUE;
2909 }
2910 }
2911 currRing->pLexOrder = TRUE;
2912 if (hilb==NULL) strat->LazyPass*=2;
2913 }
2914 strat->homog=h;
2915 #ifdef KDEBUG
2916 idTest(F);
2917 if(Q != NULL)
2918 idTest(Q);
2919 #endif
2920 #ifdef HAVE_PLURAL
2922 {
2923 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2924 strat->no_prod_crit = ! bIsSCA;
2925 if (w!=NULL)
2926 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2927 else
2928 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2929 }
2930 else
2931 #endif
2932 {
2934 {
2935 if (w!=NULL)
2936 r=mora(F,Q,*w,hilb,strat);
2937 else
2938 r=mora(F,Q,NULL,hilb,strat);
2939 }
2940 else
2941 {
2942 if (w!=NULL)
2943 r=sba(r,Q,*w,hilb,strat);
2944 else
2945 {
2946 r=sba(r,Q,NULL,hilb,strat);
2947 }
2948 }
2949 }
2950 #ifdef KDEBUG
2951 idTest(r);
2952 #endif
2953 if (toReset)
2954 {
2955 kModW = NULL;
2957 }
2958 currRing->pLexOrder = b;
2959 //Print("%d reductions canceled \n",strat->cel);
2960 sigdrop = strat->sigdrop;
2961 sbaEnterS = strat->sbaEnterS;
2962 blockred = strat->blockred;
2963 delete(strat);
2964 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2965 }
2966 // Go to std
2967 if(sigdrop || blockred > blockedreductions)
2968 {
2969 r = kStd(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2970 }
2971 return r;
2972 }
2973}
bool sigdrop
Definition kutil.h:358
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:293
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:295
int blockred
Definition kutil.h:363
unsigned sbaOrder
Definition kutil.h:316
int blockredmax
Definition kutil.h:364
int newIdeal
Definition kutil.h:356
char z2homog
Definition kutil.h:372
char no_prod_crit
Definition kutil.h:392
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:290
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
int sbaEnterS
Definition kutil.h:361
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition kInline.h:1255
static ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat, const ring r)
Definition nc.h:27
ideal mora(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd1.cc:1884
ideal sba(ideal F0, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd2.cc:2967
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition kutil.cc:6648
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition kutil.cc:6623
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:1944
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition kutil.cc:6564
#define TEST_OPT_SB_1
Definition options.h:120

◆ kStd()

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

Definition at line 2483 of file kstd1.cc.

2485{
2486 if(idIs0(F))
2487 return idInit(1,F->rank);
2488
2489 if((Q!=NULL)&&(idIs0(Q))) Q=NULL;
2490#ifdef HAVE_SHIFTBBA
2491 if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
2492#endif
2493
2494 /* test HC precomputation*/
2495 int ak = id_RankFreeModule(F,currRing);
2496 kStrategy strat=new skStrategy;
2497 if((ak==0)
2498 && (h!=isHomog)
2499 && (hilb==NULL)
2500 && (vw==NULL)
2501 && (newIdeal==0)
2502 && (sp==NULL)
2506 && (currRing->ppNoether==NULL))
2507 strat->kNoether=kTryHC(F,Q);
2508
2509 ideal r;
2510 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2512
2513 strat->s_poly=sp;
2515 strat->syzComp = syzComp;
2516 if (TEST_OPT_SB_1
2518 )
2519 strat->newIdeal = newIdeal;
2521 strat->LazyPass=20;
2522 else
2523 strat->LazyPass=2;
2524 strat->LazyDegree = 1;
2525 strat->ak = ak;
2526 strat->kModW=kModW=NULL;
2527 strat->kHomW=kHomW=NULL;
2528 if (vw != NULL)
2529 {
2530 currRing->pLexOrder=FALSE;
2531 strat->kHomW=kHomW=vw;
2532 strat->pOrigFDeg = currRing->pFDeg;
2533 strat->pOrigLDeg = currRing->pLDeg;
2535 toReset = TRUE;
2536 }
2537 if (h==testHomog)
2538 {
2539 if (strat->ak == 0)
2540 {
2541 h = (tHomog)idHomIdeal(F,Q);
2542 w=NULL;
2543 }
2544 else if (!TEST_OPT_DEGBOUND)
2545 {
2546 if (w!=NULL)
2547 h = (tHomog)idHomModule(F,Q,w);
2548 else
2549 h = (tHomog)idHomIdeal(F,Q);
2550 }
2551 }
2552 currRing->pLexOrder=b;
2553 if (h==isHomog)
2554 {
2555 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2556 {
2557 strat->kModW = kModW = *w;
2558 if (vw == NULL)
2559 {
2560 strat->pOrigFDeg = currRing->pFDeg;
2561 strat->pOrigLDeg = currRing->pLDeg;
2563 toReset = TRUE;
2564 }
2565 }
2566 currRing->pLexOrder = TRUE;
2567 if (hilb==NULL) strat->LazyPass*=2;
2568 }
2569 strat->homog=h;
2570#ifdef KDEBUG
2571 idTest(F);
2572 if (Q!=NULL) idTest(Q);
2573#endif
2574#ifdef HAVE_PLURAL
2576 {
2577 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2578 strat->no_prod_crit = ! bIsSCA;
2579 if (w!=NULL)
2580 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2581 else
2582 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2583 }
2584 else
2585#endif
2586 {
2587 #if PRE_INTEGER_CHECK
2588 //the preinteger check strategy is not for modules
2589 if(nCoeff_is_Z(currRing->cf) && strat->ak <= 0)
2590 {
2591 ideal FCopy = idCopy(F);
2592 poly pFmon = preIntegerCheck(FCopy, Q);
2593 if(pFmon != NULL)
2594 {
2596 strat->kModW=kModW=NULL;
2597 if (h==testHomog)
2598 {
2599 if (strat->ak == 0)
2600 {
2602 w=NULL;
2603 }
2604 else if (!TEST_OPT_DEGBOUND)
2605 {
2606 if (w!=NULL)
2608 else
2610 }
2611 }
2612 currRing->pLexOrder=b;
2613 if (h==isHomog)
2614 {
2615 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2616 {
2617 strat->kModW = kModW = *w;
2618 if (vw == NULL)
2619 {
2620 strat->pOrigFDeg = currRing->pFDeg;
2621 strat->pOrigLDeg = currRing->pLDeg;
2623 toReset = TRUE;
2624 }
2625 }
2626 currRing->pLexOrder = TRUE;
2627 if (hilb==NULL) strat->LazyPass*=2;
2628 }
2629 strat->homog=h;
2630 }
2631 omTestMemory(1);
2632 if(w == NULL)
2633 {
2635 r=mora(FCopy,Q,NULL,hilb,strat);
2636 else
2637 r=bba(FCopy,Q,NULL,hilb,strat);
2638 }
2639 else
2640 {
2642 r=mora(FCopy,Q,*w,hilb,strat);
2643 else
2644 r=bba(FCopy,Q,*w,hilb,strat);
2645 }
2646 idDelete(&FCopy);
2647 }
2648 else
2649 #endif
2650 {
2651 if(w==NULL)
2652 {
2654 r=mora(F,Q,NULL,hilb,strat);
2655 else
2656 r=bba(F,Q,NULL,hilb,strat);
2657 }
2658 else
2659 {
2661 r=mora(F,Q,*w,hilb,strat);
2662 else
2663 r=bba(F,Q,*w,hilb,strat);
2664 }
2665 }
2666 }
2667#ifdef KDEBUG
2668 idTest(r);
2669#endif
2670 if (toReset)
2671 {
2672 kModW = NULL;
2674 }
2675 currRing->pLexOrder = b;
2676//Print("%d reductions canceled \n",strat->cel);
2677 delete(strat);
2678 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2679 return r;
2680}
s_poly_proc_t s_poly
Definition kutil.h:300
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:809
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2976
static poly kTryHC(ideal F, ideal Q)
Definition kstd1.cc:2441
poly preIntegerCheck(const ideal Forig, const ideal Q)
used for GB over ZZ: look for constant and monomial elements in the ideal background: any known const...
Definition kutil.cc:10535
omError_t omTestMemory(int check_level)
Definition omDebug.c:94
BOOLEAN rOrd_is_ds(const ring r)
Definition ring.cc:2036
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:416
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:511

◆ kStdShift()

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

Definition at line 2976 of file kstd1.cc.

2978{
2980 assume(idIsInV(F));
2982 {
2983 /* error: no local ord yet with shifts */
2984 WerrorS("No local ordering possible for shift algebra");
2985 return(NULL);
2986 }
2987 ideal r;
2988 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2990 kStrategy strat=new skStrategy;
2991
2992 strat->rightGB = rightGB;
2993
2995 strat->syzComp = syzComp;
2996 if (TEST_OPT_SB_1)
2998 strat->newIdeal = newIdeal;
3000 strat->LazyPass=20;
3001 else
3002 strat->LazyPass=2;
3003 strat->LazyDegree = 1;
3004 strat->ak = id_RankFreeModule(F,currRing);
3005 strat->kModW=kModW=NULL;
3006 strat->kHomW=kHomW=NULL;
3007 if (vw != NULL)
3008 {
3009 currRing->pLexOrder=FALSE;
3010 strat->kHomW=kHomW=vw;
3011 strat->pOrigFDeg = currRing->pFDeg;
3012 strat->pOrigLDeg = currRing->pLDeg;
3014 toReset = TRUE;
3015 }
3016 if (h==testHomog)
3017 {
3018 if (strat->ak == 0)
3019 {
3020 h = (tHomog)idHomIdeal(F,Q);
3021 w=NULL;
3022 }
3023 else if (!TEST_OPT_DEGBOUND)
3024 {
3025 if (w!=NULL)
3026 h = (tHomog)idHomModule(F,Q,w);
3027 else
3028 h = (tHomog)idHomIdeal(F,Q);
3029 }
3030 }
3031 currRing->pLexOrder=b;
3032 if (h==isHomog)
3033 {
3034 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3035 {
3036 strat->kModW = kModW = *w;
3037 if (vw == NULL)
3038 {
3039 strat->pOrigFDeg = currRing->pFDeg;
3040 strat->pOrigLDeg = currRing->pLDeg;
3042 toReset = TRUE;
3043 }
3044 }
3045 currRing->pLexOrder = TRUE;
3046 if (hilb==NULL) strat->LazyPass*=2;
3047 }
3048 strat->homog=h;
3049#ifdef KDEBUG
3050 idTest(F);
3051#endif
3052 /* global ordering */
3053 if (w!=NULL)
3054 r=bbaShift(F,Q,*w,hilb,strat);
3055 else
3056 r=bbaShift(F,Q,NULL,hilb,strat);
3057#ifdef KDEBUG
3058 idTest(r);
3059#endif
3060 if (toReset)
3061 {
3062 kModW = NULL;
3064 }
3065 currRing->pLexOrder = b;
3066//Print("%d reductions canceled \n",strat->cel);
3067 delete(strat);
3068 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
3069 assume(idIsInV(r));
3070 return r;
3071}
char rightGB
Definition kutil.h:367
ideal bbaShift(ideal F, ideal Q, intvec *w, intvec *hilb, kStrategy strat)
Definition kstd2.cc:4577
#define idIsInV(I)
Definition shiftop.h:49

◆ kTryHC()

static poly kTryHC ( ideal  F,
ideal  Q 
)
static

Definition at line 2441 of file kstd1.cc.

2442{
2443 int prim=kFindLuckyPrime(F,Q);
2444 if (TEST_OPT_PROT) Print("try HC in ring over ZZ/%d\n",prim);
2445 // create Zp_ring
2448 nKillChar(Zp_ring->cf);
2449 Zp_ring->cf=nInitChar(n_Zp, (void*)(long)prim);
2451 // map data
2455 ideal QQ=NULL;
2457 // call std
2458 kStrategy strat=new skStrategy;
2459 strat->LazyPass=20;
2460 strat->LazyDegree = 1;
2461 strat->kModW=kModW=NULL;
2462 strat->kHomW=kHomW=NULL;
2463 strat->homog = (tHomog)idHomIdeal(F,Q);
2464 ideal res=mora(FF,QQ,NULL,NULL,strat);
2465 // clean
2466 idDelete(&FF);
2467 if (QQ!=NULL) idDelete(&QQ);
2468 idDelete(&res);
2469 poly HC=strat->kNoether; strat->kNoether=NULL;
2470 delete strat;
2471 // map back
2473 if (HC!=NULL)
2474 {
2477 if (TEST_OPT_PROT) Print("HC(%ld) found\n",pTotaldegree(HC));
2478 }
2480 return HC;
2481}
@ n_Zp
\F{p < 2^31}
Definition coeffs.h:29
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:701
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:406
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:556
static int kFindLuckyPrime(ideal F, ideal Q)
Definition kstd1.cc:2434
static long p_IncrExp(poly p, int v, ring r)
Definition p_polys.h:591
static void p_Setm(poly p, const ring r)
Definition p_polys.h:233
static long pTotaldegree(poly p)
Definition polys.h:282
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition ring.cc:3465
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1424
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
ideal id_PermIdeal(ideal I, int R, int C, const int *perm, const ring src, const ring dst, nMapFunc nMap, const int *par_perm, int P, BOOLEAN use_mult)
mapping ideals/matrices to other rings

◆ missingAxis()

void missingAxis ( int last,
kStrategy  strat 
)

Definition at line 1280 of file kstd1.cc.

1281{
1282 int i = 0;
1283 int k = 0;
1284
1285 *last = 0;
1287 {
1288 loop
1289 {
1290 i++;
1291 if (i > (currRing->N)) break;
1292 if (strat->NotUsedAxis[i])
1293 {
1294 *last = i;
1295 k++;
1296 }
1297 if (k>1)
1298 {
1299 *last = 0;
1300 break;
1301 }
1302 }
1303 }
1304}
int k
Definition cfEzgcd.cc:99
BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:768
#define loop
Definition structs.h:75

◆ mora()

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

Definition at line 1884 of file kstd1.cc.

1885{
1886 int olddeg = 0;
1887 int reduc = 0;
1888 int red_result = 1;
1889 int hilbeledeg=1,hilbcount=0;
1890 BITSET save1;
1893 {
1894 si_opt_1 &= ~Sy_bit(OPT_REDSB);
1895 si_opt_1 &= ~Sy_bit(OPT_REDTAIL);
1896 }
1897
1898 strat->update = TRUE;
1899 /*- setting global variables ------------------- -*/
1900 initBuchMoraCrit(strat);
1901 initHilbCrit(F,Q,&hilb,strat);
1902 initMora(F,strat);
1904 initBuchMoraPosRing(strat);
1905 else
1906 initBuchMoraPos(strat);
1907 /*Shdl=*/initBuchMora(F,Q,strat);
1908 if (TEST_OPT_FASTHC) missingAxis(&strat->lastAxis,strat);
1909 /*updateS in initBuchMora has Hecketest
1910 * and could have put strat->kHEdgdeFound FALSE*/
1911 if (TEST_OPT_FASTHC && (strat->lastAxis) && strat->posInLOldFlag)
1912 {
1913 strat->posInLOld = strat->posInL;
1914 strat->posInLOldFlag = FALSE;
1915 strat->posInL = posInL10;
1916 updateL(strat);
1917 reorderL(strat);
1918 }
1919 kTest_TS(strat);
1920 strat->use_buckets = kMoraUseBucket(strat);
1921
1922#ifdef HAVE_TAIL_RING
1923 if (strat->homog && strat->red == redFirst)
1924 if(!idIs0(F) &&(!rField_is_Ring(currRing)))
1926#endif
1927
1928 if (BVERBOSE(23))
1929 {
1930 kDebugPrint(strat);
1931 }
1932//deleteInL(strat->L,&strat->Ll,1,strat);
1933//deleteInL(strat->L,&strat->Ll,0,strat);
1934
1935 /*- compute-------------------------------------------*/
1936 while (strat->Ll >= 0)
1937 {
1938 #ifdef KDEBUG
1939 if (TEST_OPT_DEBUG) messageSets(strat);
1940 #endif
1941 if (siCntrlc)
1942 {
1943 while (strat->Ll >= 0)
1944 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1945 strat->noClearS=TRUE;
1946 }
1948 && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg))
1949 {
1950 /*
1951 * stops computation if
1952 * - 24 (degBound)
1953 * && upper degree is bigger than Kstd1_deg
1954 */
1955 while ((strat->Ll >= 0)
1956 && (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
1957 && (strat->L[strat->Ll].ecart+strat->L[strat->Ll].GetpFDeg()> Kstd1_deg)
1958 )
1959 {
1960 deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
1961 //if (TEST_OPT_PROT)
1962 //{
1963 // PrintS("D"); mflush();
1964 //}
1965 }
1966 if (strat->Ll<0) break;
1967 else strat->noClearS=TRUE;
1968 }
1969 strat->P = strat->L[strat->Ll];/*- picks the last element from the lazyset L -*/
1970 if (strat->Ll==0) strat->interpt=TRUE;
1971 strat->Ll--;
1972 // create the real Spoly
1973 if (pNext(strat->P.p) == strat->tail)
1974 {
1975 /*- deletes the short spoly and computes -*/
1977 pLmDelete(strat->P.p);
1978 else
1979 pLmFree(strat->P.p);
1980 strat->P.p = NULL;
1981 poly m1 = NULL, m2 = NULL;
1982 // check that spoly creation is ok
1983 while (strat->tailRing != currRing &&
1984 !kCheckSpolyCreation(&(strat->P), strat, m1, m2))
1985 {
1986 assume(m1 == NULL && m2 == NULL);
1987 // if not, change to a ring where exponents are large enough
1988 kStratChangeTailRing(strat);
1989 }
1990 /* create the real one */
1991 ksCreateSpoly(&(strat->P), strat->kNoetherTail(), strat->use_buckets,
1992 strat->tailRing, m1, m2, strat->R);
1993 if (!strat->use_buckets)
1994 strat->P.SetLength(strat->length_pLength);
1995 }
1996 else if (strat->P.p1 == NULL)
1997 {
1998 // for input polys, prepare reduction (buckets !)
1999 strat->P.SetLength(strat->length_pLength);
2000 strat->P.PrepareRed(strat->use_buckets);
2001 }
2002
2003 // the s-poly
2004 if (!strat->P.IsNull())
2005 {
2006 // might be NULL from noether !!!
2007 if (TEST_OPT_PROT)
2008 message(strat->P.ecart+strat->P.GetpFDeg(),&olddeg,&reduc,strat, red_result);
2009 // reduce
2010 red_result = strat->red(&strat->P,strat);
2011 }
2012
2013 // the reduced s-poly
2014 if (! strat->P.IsNull())
2015 {
2016 strat->P.GetP();
2017 // statistics
2018 if (TEST_OPT_PROT) PrintS("s");
2019 // normalization
2021 strat->P.pCleardenom();
2022 else
2023 strat->P.pNorm();
2024 // tailreduction
2025 strat->P.p = redtail(&(strat->P),strat->sl,strat);
2026 if (strat->P.p==NULL)
2027 {
2028 WerrorS("exponent overflow - wrong ordering");
2029 return(idInit(1,1));
2030 }
2031 // set ecart -- might have changed because of tail reductions
2032 if ((!strat->noTailReduction) && (!strat->honey))
2033 strat->initEcart(&strat->P);
2034 // cancel unit
2035 cancelunit(&strat->P);
2036 // for char 0, clear denominators
2037 if ((strat->P.p->next==NULL) /* i.e. cancelunit did something*/
2039 strat->P.pCleardenom();
2040
2041 strat->P.SetShortExpVector();
2042 enterT(strat->P,strat);
2043 // build new pairs
2045 superenterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
2046 else
2047 enterpairs(strat->P.p,strat->sl,strat->P.ecart,0,strat, strat->tl);
2048 // put in S
2049 strat->enterS(strat->P,
2050 posInS(strat,strat->sl,strat->P.p, strat->P.ecart),
2051 strat, strat->tl);
2052 // apply hilbert criterion
2053 if (hilb!=NULL)
2054 {
2055 if (strat->homog==isHomog)
2057 else
2059 }
2060
2061 // clear strat->P
2062 kDeleteLcm(&strat->P);
2063
2064#ifdef KDEBUG
2065 // make sure kTest_TS does not complain about strat->P
2066 strat->P.Clear();
2067#endif
2068 }
2069 if (strat->kAllAxis)
2070 {
2071 if ((TEST_OPT_FINDET)
2072 || ((TEST_OPT_MULTBOUND) && (scMult0Int(strat->Shdl,NULL) < Kstd1_mu)))
2073 {
2074 // obachman: is this still used ???
2075 /*
2076 * stops computation if strat->kAllAxis and
2077 * - 27 (finiteDeterminacyTest)
2078 * or
2079 * - 23
2080 * (multBound)
2081 * && multiplicity of the ideal is smaller then a predefined number mu
2082 */
2083 while (strat->Ll >= 0) deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
2084 }
2085 }
2086 kTest_TS(strat);
2087 }
2088 /*- complete reduction of the standard basis------------------------ -*/
2089 if (TEST_OPT_REDSB) completeReduce(strat);
2090 else if (TEST_OPT_PROT) PrintLn();
2091 /*- release temp data------------------------------- -*/
2092 exitBuchMora(strat);
2093 /*- polynomials used for HECKE: HC, noether -*/
2094 if (TEST_OPT_FINDET)
2095 {
2096 if (strat->kNoether!=NULL)
2097 Kstd1_mu=currRing->pFDeg(strat->kNoether,currRing);
2098 else
2099 Kstd1_mu=-1;
2100 }
2101 omFreeSize((ADDRESS)strat->NotUsedAxis,((currRing->N)+1)*sizeof(BOOLEAN));
2103// if (TEST_OPT_WEIGHTM)
2104// {
2105// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
2106// if (ecartWeights)
2107// {
2108// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
2109// ecartWeights=NULL;
2110// }
2111// }
2112 if(nCoeff_is_Z(currRing->cf))
2113 finalReduceByMon(strat);
2114 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
2116 idTest(strat->Shdl);
2117 return (strat->Shdl);
2118}
char noClearS
Definition kutil.h:400
long scMult0Int(ideal S, ideal Q)
Definition hdegree.cc:924
void khCheckLocInhom(ideal Q, intvec *w, intvec *hilb, int &count, kStrategy strat)
Definition khstd.cc:244
void khCheck(ideal Q, intvec *w, intvec *hilb, int &eledeg, int &count, kStrategy strat)
Definition khstd.cc:28
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition kspoly.cc:1204
EXTERN_VAR int Kstd1_mu
Definition kstd1.h:52
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4492
void initHilbCrit(ideal, ideal, intvec **hilb, kStrategy strat)
Definition kutil.cc:9414
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10957
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition kutil.cc:10476
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4462
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1213
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7506
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10865
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:370
VAR BOOLEAN siCntrlc
Definition options.c:14
#define OPT_REDSB
Definition options.h:76
#define TEST_OPT_MULTBOUND
Definition options.h:115

◆ posInL10()

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

Definition at line 1361 of file kstd1.cc.

1362{
1363 int j,dp,dL;
1364
1365 if (length<0) return 0;
1366 if (hasPurePower(p,strat->lastAxis,&dp,strat))
1367 {
1368 int op= p->GetpFDeg() +p->ecart;
1369 for (j=length; j>=0; j--)
1370 {
1371 if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
1372 return j+1;
1373 if (dp < dL)
1374 return j+1;
1375 if ((dp == dL)
1376 && (set[j].GetpFDeg()+set[j].ecart >= op))
1377 return j+1;
1378 }
1379 }
1380 j=length;
1381 loop
1382 {
1383 if (j<0) break;
1384 if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
1385 j--;
1386 }
1387 return strat->posInLOld(set,j,p,strat);
1388}

◆ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 169 of file kstd1.cc.

170{
171 int i,at,ei,li,ii;
172 int j = 0;
173 int pass = 0;
174 long d,reddeg;
175
176 d = h->GetpFDeg()+ h->ecart;
177 reddeg = strat->LazyDegree+d;
178 h->SetShortExpVector();
179 loop
180 {
181 j = kFindDivisibleByInT(strat, h);
182 if (j < 0)
183 {
184 if (strat->honey) h->SetLength(strat->length_pLength);
185 return 1;
186 }
187
188 ei = strat->T[j].ecart;
189 ii = j;
190
191 if (ei > h->ecart && ii < strat->tl)
192 {
193 unsigned long not_sev=~h->sev;
194 poly h_t= h->GetLmTailRing();
195 li = strat->T[j].length;
196 if (li<=0) li=strat->T[j].GetpLength();
197 // the polynomial to reduce with (up to the moment) is;
198 // pi with ecart ei and length li
199 // look for one with smaller ecart
200 i = j;
201 loop
202 {
203 /*- takes the first possible with respect to ecart -*/
204 i++;
205#if 1
206 if (i > strat->tl) break;
207 if (strat->T[i].length<=0) strat->T[i].GetpLength();
208 if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
209 strat->T[i].length < li))
210 &&
211 p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h_t, not_sev, strat->tailRing))
212#else
213 j = kFindDivisibleByInT(strat, h, i);
214 if (j < 0) break;
215 i = j;
216 if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
217 strat->T[i].length < li))
218#endif
219 {
220 // the polynomial to reduce with is now
221 ii = i;
222 ei = strat->T[i].ecart;
223 if (ei <= h->ecart) break;
224 li = strat->T[i].length;
225 }
226 }
227 }
228
229 // end of search: have to reduce with pi
230 if (ei > h->ecart)
231 {
232 // It is not possible to reduce h with smaller ecart;
233 // if possible h goes to the lazy-set L,i.e
234 // if its position in L would be not the last one
235 strat->fromT = TRUE;
236 if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
237 {
238 h->SetLmCurrRing();
239 if (strat->honey && strat->posInLDependsOnLength)
240 h->SetLength(strat->length_pLength);
241 assume(h->FDeg == h->pFDeg());
242 at = strat->posInL(strat->L,strat->Ll,h,strat);
243 if (at <= strat->Ll)
244 {
245 /*- h will not become the next element to reduce -*/
246 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
247#ifdef KDEBUG
248 if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
249#endif
250 h->Clear();
251 strat->fromT = FALSE;
252 return -1;
253 }
254 }
255 }
256
257 // now we finally can reduce
258 doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
259 strat->fromT=FALSE;
260
261 // are we done ???
262 if (h->IsNull())
263 {
265 kDeleteLcm(h);
266 h->Clear();
267 return 0;
268 }
269 if (TEST_OPT_IDLIFT)
270 {
271 if (h->p!=NULL)
272 {
273 if(p_GetComp(h->p,currRing)>strat->syzComp)
274 {
275 h->Delete();
276 return 0;
277 }
278 }
279 else if (h->t_p!=NULL)
280 {
281 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
282 {
283 h->Delete();
284 return 0;
285 }
286 }
287 }
288 #if 0
289 else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
290 {
291 if (h->p!=NULL)
292 {
293 if(p_GetComp(h->p,currRing)>strat->syzComp)
294 {
295 return 1;
296 }
297 }
298 else if (h->t_p!=NULL)
299 {
300 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
301 {
302 return 1;
303 }
304 }
305 }
306 #endif
307
308 // done ? NO!
309 h->SetShortExpVector();
310 h->SetpFDeg();
311 if (strat->honey)
312 {
313 if (ei <= h->ecart)
314 h->ecart = d-h->GetpFDeg();
315 else
316 h->ecart = d-h->GetpFDeg()+ei-h->ecart;
317 }
318 else
319 // this has the side effect of setting h->length
320 h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
321#if 0
322 if (strat->syzComp!=0)
323 {
324 if ((strat->syzComp>0) && (h->Comp() > strat->syzComp))
325 {
326 assume(h->MinComp() > strat->syzComp);
327 if (strat->honey) h->SetLength();
328#ifdef KDEBUG
329 if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
330#endif
331 return -2;
332 }
333 }
334#endif
335 /*- try to reduce the s-polynomial -*/
336 pass++;
337 d = h->GetpFDeg()+h->ecart;
338 /*
339 *test whether the polynomial should go to the lazyset L
340 *-if the degree jumps
341 *-if the number of pre-defined reductions jumps
342 */
343 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
344 && ((d >= reddeg) || (pass > strat->LazyPass)))
345 {
346 h->SetLmCurrRing();
347 if (strat->honey && strat->posInLDependsOnLength)
348 h->SetLength(strat->length_pLength);
349 assume(h->FDeg == h->pFDeg());
350 at = strat->posInL(strat->L,strat->Ll,h,strat);
351 if (at <= strat->Ll)
352 {
353 int dummy=strat->sl;
354 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
355 {
356 if (strat->honey && !strat->posInLDependsOnLength)
357 h->SetLength(strat->length_pLength);
358 return 1;
359 }
360 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
361#ifdef KDEBUG
362 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
363#endif
364 h->Clear();
365 return -1;
366 }
367 }
368 else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
369 {
370 Print(".%ld",d);mflush();
371 reddeg = d+1;
372 if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
373 {
374 strat->overflow=TRUE;
375 //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
376 h->GetP();
377 at = strat->posInL(strat->L,strat->Ll,h,strat);
378 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
379 h->Clear();
380 return -1;
381 }
382 }
383 }
384}
int length() const
char fromT
Definition kutil.h:377
char overflow
Definition kutil.h:402
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition kstd1.cc:119
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:421
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition kstd2.cc:321
#define p_GetComp(p, r)
Definition monomials.h:64
#define TEST_OPT_REDTHROUGH
Definition options.h:123
#define TEST_OPT_REDTAIL_SYZ
Definition options.h:118
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition p_polys.h:1924

◆ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 795 of file kstd1.cc.

796{
797 if (strat->tl<0) return 1;
798 if (h->IsNull()) return 0;
799
800 int at;
801 long reddeg,d;
802 int pass = 0;
803 int cnt = RED_CANONICALIZE;
804 int j = 0;
805
806 if (! strat->homog)
807 {
808 d = h->GetpFDeg() + h->ecart;
809 reddeg = strat->LazyDegree+d;
810 }
811 h->SetShortExpVector();
812 loop
813 {
814 j = kFindDivisibleByInT(strat, h);
815 if (j < 0)
816 {
817 h->SetDegStuffReturnLDeg(strat->LDegLast);
818 return 1;
819 }
820
822 strat->T[j].pNorm();
823#ifdef KDEBUG
824 if (TEST_OPT_DEBUG)
825 {
826 PrintS("reduce ");
827 h->wrp();
828 PrintS(" with ");
829 strat->T[j].wrp();
830 }
831#endif
832 ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, NULL, strat);
833#ifdef KDEBUG
834 if (TEST_OPT_DEBUG)
835 {
836 PrintS(" to ");
837 wrp(h->p);
838 PrintLn();
839 }
840#endif
841 if (h->IsNull())
842 {
844 kDeleteLcm(h);
845 h->Clear();
846 return 0;
847 }
848 if (TEST_OPT_IDLIFT)
849 {
850 if (h->p!=NULL)
851 {
852 if(p_GetComp(h->p,currRing)>strat->syzComp)
853 {
854 h->Delete();
855 return 0;
856 }
857 }
858 else if (h->t_p!=NULL)
859 {
860 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
861 {
862 h->Delete();
863 return 0;
864 }
865 }
866 }
867 #if 0
868 else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
869 {
870 if (h->p!=NULL)
871 {
872 if(p_GetComp(h->p,currRing)>strat->syzComp)
873 {
874 return 1;
875 }
876 }
877 else if (h->t_p!=NULL)
878 {
879 if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
880 {
881 return 1;
882 }
883 }
884 }
885 #endif
886 h->SetShortExpVector();
887
888#if 0
889 if ((strat->syzComp!=0) && !strat->honey)
890 {
891 if ((strat->syzComp>0) &&
892 (h->Comp() > strat->syzComp))
893 {
894 assume(h->MinComp() > strat->syzComp);
895#ifdef KDEBUG
896 if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
897#endif
898 if (strat->homog)
899 h->SetDegStuffReturnLDeg(strat->LDegLast);
900 return -2;
901 }
902 }
903#endif
904 if (!strat->homog)
905 {
906 if (!TEST_OPT_OLDSTD && strat->honey)
907 {
908 h->SetpFDeg();
909 if (strat->T[j].ecart <= h->ecart)
910 h->ecart = d - h->GetpFDeg();
911 else
912 h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
913
914 d = h->GetpFDeg() + h->ecart;
915 }
916 else
917 d = h->SetDegStuffReturnLDeg(strat->LDegLast);
918 /*- try to reduce the s-polynomial -*/
919 cnt--;
920 pass++;
921 /*
922 *test whether the polynomial should go to the lazyset L
923 *-if the degree jumps
924 *-if the number of pre-defined reductions jumps
925 */
926 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
927 && ((d >= reddeg) || (pass > strat->LazyPass)))
928 {
929 h->SetLmCurrRing();
930 if (strat->posInLDependsOnLength)
931 h->SetLength(strat->length_pLength);
932 at = strat->posInL(strat->L,strat->Ll,h,strat);
933 if (at <= strat->Ll)
934 {
935 int dummy=strat->sl;
936 if (kFindDivisibleByInS(strat,&dummy, h) < 0)
937 return 1;
938 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
939#ifdef KDEBUG
940 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
941#endif
942 h->Clear();
943 return -1;
944 }
945 }
946 if (UNLIKELY(cnt==0))
947 {
948 h->CanonicalizeP();
950 //if (TEST_OPT_PROT) { PrintS("!");mflush(); }
951 }
952 if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
953 {
954 reddeg = d+1;
955 Print(".%ld",d);mflush();
956 if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
957 {
958 strat->overflow=TRUE;
959 //Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
960 h->GetP();
961 at = strat->posInL(strat->L,strat->Ll,h,strat);
962 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
963 h->Clear();
964 return -1;
965 }
966 }
967 }
968 }
969}
#define UNLIKELY(X)
Definition auxiliary.h:404
#define RED_CANONICALIZE
Definition kutil.h:36
void wrp(poly p)
Definition polys.h:310

◆ redMoraNF()

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

Definition at line 976 of file kstd1.cc.

977{
978 LObject H;
979 H.p = h;
980 int j = 0;
981 int z = 10;
982 int o = H.SetpFDeg();
983 H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;
984 if ((flag & 2) == 0) cancelunit(&H,TRUE);
985 H.sev = pGetShortExpVector(H.p);
986 loop
987 {
988 if (j > strat->tl)
989 {
990 return H.p;
991 }
992 if (TEST_V_DEG_STOP)
993 {
994 if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p);
995 if (H.p==NULL) return NULL;
996 }
997 unsigned long not_sev = ~ H.sev;
998 if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing)
999 )
1000 {
1001 /*- remember the found T-poly -*/
1002 // poly pi = strat->T[j].p;
1003 int ei = strat->T[j].ecart;
1004 int li = strat->T[j].length;
1005 int ii = j;
1006 /*
1007 * the polynomial to reduce with (up to the moment) is;
1008 * pi with ecart ei and length li
1009 */
1010 loop
1011 {
1012 /*- look for a better one with respect to ecart -*/
1013 /*- stop, if the ecart is small enough (<=ecart(H)) -*/
1014 j++;
1015 if (j > strat->tl) break;
1016 if (ei <= H.ecart) break;
1017 if (((strat->T[j].ecart < ei)
1018 || ((strat->T[j].ecart == ei)
1019 && (strat->T[j].length < li)))
1020 && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
1021 )
1022 {
1023 /*
1024 * the polynomial to reduce with is now;
1025 */
1026 // pi = strat->T[j].p;
1027 ei = strat->T[j].ecart;
1028 li = strat->T[j].length;
1029 ii = j;
1030 }
1031 }
1032 /*
1033 * end of search: have to reduce with pi
1034 */
1035 z++;
1036 if (z>10)
1037 {
1038 pNormalize(H.p);
1039 z=0;
1040 }
1041 if ((ei > H.ecart) && (strat->kNoether==NULL))
1042 {
1043 /*
1044 * It is not possible to reduce h with smaller ecart;
1045 * we have to reduce with bad ecart: H has to enter in T
1046 */
1047 LObject L= H;
1048 L.Copy();
1049 H.GetP();
1050 H.length=H.pLength=pLength(H.p);
1051 ksReducePoly(&L, &(strat->T[ii]), strat->kNoetherTail(), NULL, NULL, strat,
1052 (flag & KSTD_NF_NONORM)==0);
1053 enterT(H,strat);
1054 H = L;
1055 }
1056 else
1057 {
1058 /*
1059 * we reduce with good ecart, h need not to be put to T
1060 */
1061 ksReducePoly(&H, &(strat->T[ii]), strat->kNoetherTail(), NULL, NULL, strat,
1062 (flag & KSTD_NF_NONORM)==0);
1063 }
1064 if (H.p == NULL)
1065 return NULL;
1066 /*- try to reduce the s-polynomial -*/
1067 o = H.SetpFDeg();
1068 if ((flag & KSTD_NF_ECART) == 0) cancelunit(&H,TRUE);
1069 H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o;
1070 j = 0;
1071 H.sev = pGetShortExpVector(H.p);
1072 }
1073 else
1074 {
1075 j++;
1076 }
1077 }
1078}
CanonicalForm H
Definition facAbsFact.cc:60
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition polys.h:146
#define pNormalize(p)
Definition polys.h:317

◆ redMoraNFRing()

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

Definition at line 1080 of file kstd1.cc.

1081{
1082 LObject H;
1083 H.p = h;
1084 int j0, j = 0;
1085 int docoeffred = 0;
1086 poly T0p = strat->T[0].p;
1087 int T0ecart = strat->T[0].ecart;
1088 int o = H.SetpFDeg();
1089 H.ecart = currRing->pLDeg(H.p,&H.length,currRing)-o;
1090 if ((flag & KSTD_NF_ECART) == 0) cancelunit(&H,TRUE);
1091 H.sev = pGetShortExpVector(H.p);
1092 unsigned long not_sev = ~ H.sev;
1093 if (strat->T[0].GetpFDeg() == 0 && strat->T[0].length <= 2)
1094 {
1095 docoeffred = 1; // euclidean ring required: n_QuotRem
1096 if (currRing->cf->cfQuotRem==ndQuotRem)
1097 {
1098 docoeffred = 0;
1099 }
1100 }
1101 loop
1102 {
1103 /* cut down the lead coefficients, only possible if the degree of
1104 * T[0] is 0 (constant). This is only efficient if T[0] is short, thus
1105 * we ask for the length of T[0] to be <= 2 */
1106 if (docoeffred)
1107 {
1108 j0 = kTestDivisibleByT0_Z(strat, &H);
1109 if ((j0 == 0)
1110 && (n_DivBy(pGetCoeff(H.p), pGetCoeff(T0p), currRing->cf) == FALSE)
1111 && (T0ecart <= H.ecart))
1112 {
1113 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
1114 * => we try to cut down the lead coefficient at least */
1115 /* first copy T[j0] in order to multiply it with a coefficient later on */
1116 number mult, rest;
1117 TObject tj = strat->T[0];
1118 tj.Copy();
1119 /* compute division with remainder of lc(h) and lc(T[j]) */
1121 &rest, currRing->cf);
1122 /* set corresponding new lead coefficient already. we do not
1123 * remove the lead term in ksReducePolyLC, but only apply
1124 * a lead coefficient reduction */
1125 tj.Mult_nn(mult);
1126 ksReducePolyLC(&H, &tj, NULL, &rest, strat);
1127 tj.Delete();
1128 tj.Clear();
1129 }
1130 }
1131 if (j > strat->tl)
1132 {
1133 return H.p;
1134 }
1135 if (TEST_V_DEG_STOP)
1136 {
1137 if (kModDeg(H.p)>Kstd1_deg) pLmDelete(&H.p);
1138 if (H.p==NULL) return NULL;
1139 }
1140 if (p_LmShortDivisibleBy(strat->T[j].GetLmTailRing(), strat->sevT[j], H.GetLmTailRing(), not_sev, strat->tailRing)
1141 && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf))
1142 )
1143 {
1144 /*- remember the found T-poly -*/
1145 // poly pi = strat->T[j].p;
1146 int ei = strat->T[j].ecart;
1147 int li = strat->T[j].length;
1148 int ii = j;
1149 /*
1150 * the polynomial to reduce with (up to the moment) is;
1151 * pi with ecart ei and length li
1152 */
1153 loop
1154 {
1155 /*- look for a better one with respect to ecart -*/
1156 /*- stop, if the ecart is small enough (<=ecart(H)) -*/
1157 j++;
1158 if (j > strat->tl) break;
1159 if (ei <= H.ecart) break;
1160 if (((strat->T[j].ecart < ei)
1161 || ((strat->T[j].ecart == ei)
1162 && (strat->T[j].length < li)))
1163 && pLmShortDivisibleBy(strat->T[j].p,strat->sevT[j], H.p, not_sev)
1164 && (n_DivBy(H.p->coef, strat->T[j].p->coef,strat->tailRing->cf))
1165 )
1166 {
1167 /*
1168 * the polynomial to reduce with is now;
1169 */
1170 // pi = strat->T[j].p;
1171 ei = strat->T[j].ecart;
1172 li = strat->T[j].length;
1173 ii = j;
1174 }
1175 }
1176 /*
1177 * end of search: have to reduce with pi
1178 */
1179 if ((ei > H.ecart) && (strat->kNoether==NULL))
1180 {
1181 /*
1182 * It is not possible to reduce h with smaller ecart;
1183 * we have to reduce with bad ecart: H has to enter in T
1184 */
1185 LObject L= H;
1186 L.Copy();
1187 H.GetP();
1188 H.length=H.pLength=pLength(H.p);
1189 ksReducePoly(&L, &(strat->T[ii]), strat->kNoetherTail(), NULL, NULL, strat,
1190 (flag & KSTD_NF_NONORM)==0);
1191 enterT_strong(H,strat);
1192 H = L;
1193 }
1194 else
1195 {
1196 /*
1197 * we reduce with good ecart, h need not to be put to T
1198 */
1199 ksReducePoly(&H, &(strat->T[ii]), strat->kNoetherTail(), NULL, NULL, strat,
1200 (flag & KSTD_NF_NONORM)==0);
1201 }
1202 if (H.p == NULL)
1203 return NULL;
1204 /*- try to reduce the s-polynomial -*/
1205 o = H.SetpFDeg();
1206 if ((flag &2 ) == 0) cancelunit(&H,TRUE);
1207 H.ecart = currRing->pLDeg(H.p,&(H.length),currRing)-o;
1208 j = 0;
1209 H.sev = pGetShortExpVector(H.p);
1210 not_sev = ~ H.sev;
1211 }
1212 else
1213 {
1214 j++;
1215 }
1216 }
1217}
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition coeffs.h:682
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition coeffs.h:748
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:477
int kTestDivisibleByT0_Z(const kStrategy strat, const LObject *L)
tests if T[0] divides the leading monomial of L, returns -1 if not
Definition kstd2.cc:146
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:647
number ndQuotRem(number a, number b, number *r, const coeffs R)
Definition numbers.cc:350

◆ redRiloc()

int redRiloc ( LObject h,
kStrategy  strat 
)

Definition at line 386 of file kstd1.cc.

387{
388 int i,at,ei,li,ii;
389 int j = 0;
390 int pass = 0;
391 long d,reddeg;
392
393 d = h->GetpFDeg()+ h->ecart;
394 reddeg = strat->LazyDegree+d;
395 h->SetShortExpVector();
396 loop
397 {
398 j = kFindDivisibleByInT(strat, h);
399 if (j < 0)
400 {
401 // over ZZ: cleanup coefficients by complete reduction with monomials
402 postReduceByMon(h, strat);
403 if(h->p == NULL)
404 {
405 kDeleteLcm(h);
406 h->Clear();
407 return 0;
408 }
409 if (strat->honey) h->SetLength(strat->length_pLength);
410 if(strat->tl >= 0)
411 h->i_r1 = strat->tl;
412 else
413 h->i_r1 = -1;
414 if (h->GetLmTailRing() == NULL)
415 {
416 kDeleteLcm(h);
417 h->Clear();
418 return 0;
419 }
420 return 1;
421 }
422
423 ei = strat->T[j].ecart;
424 ii = j;
425 if (ei > h->ecart && ii < strat->tl)
426 {
427 li = strat->T[j].length;
428 // the polynomial to reduce with (up to the moment) is;
429 // pi with ecart ei and length li
430 // look for one with smaller ecart
431 i = j;
432 loop
433 {
434 /*- takes the first possible with respect to ecart -*/
435 i++;
436#if 1
437 if (i > strat->tl) break;
438 if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
439 strat->T[i].length < li))
440 &&
441 p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
442 &&
443 n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
444#else
445 j = kFindDivisibleByInT(strat, h, i);
446 if (j < 0) break;
447 i = j;
448 if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
449 strat->T[i].length < li))
450#endif
451 {
452 // the polynomial to reduce with is now
453 ii = i;
454 ei = strat->T[i].ecart;
455 if (ei <= h->ecart) break;
456 li = strat->T[i].length;
457 }
458 }
459 }
460
461 // end of search: have to reduce with pi
462 if (ei > h->ecart)
463 {
464 // It is not possible to reduce h with smaller ecart;
465 // if possible h goes to the lazy-set L,i.e
466 // if its position in L would be not the last one
467 strat->fromT = TRUE;
468 if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
469 {
470 h->SetLmCurrRing();
471 if (strat->honey && strat->posInLDependsOnLength)
472 h->SetLength(strat->length_pLength);
473 assume(h->FDeg == h->pFDeg());
474 at = strat->posInL(strat->L,strat->Ll,h,strat);
475 if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
476 {
477 /*- h will not become the next element to reduce -*/
478 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
479 #ifdef KDEBUG
480 if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
481 #endif
482 h->Clear();
483 strat->fromT = FALSE;
484 return -1;
485 }
486 }
487 doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
488 }
489 else
490 {
491 // now we finally can reduce
492 doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
493 }
494 strat->fromT=FALSE;
495 // are we done ???
496 if (h->IsNull())
497 {
498 kDeleteLcm(h);
499 h->Clear();
500 return 0;
501 }
502
503 // NO!
504 h->SetShortExpVector();
505 h->SetpFDeg();
506 if (strat->honey)
507 {
508 if (ei <= h->ecart)
509 h->ecart = d-h->GetpFDeg();
510 else
511 h->ecart = d-h->GetpFDeg()+ei-h->ecart;
512 }
513 else
514 // this has the side effect of setting h->length
515 h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
516 /*- try to reduce the s-polynomial -*/
517 pass++;
518 d = h->GetpFDeg()+h->ecart;
519 /*
520 *test whether the polynomial should go to the lazyset L
521 *-if the degree jumps
522 *-if the number of pre-defined reductions jumps
523 */
524 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
525 && ((d >= reddeg) || (pass > strat->LazyPass)))
526 {
527 h->SetLmCurrRing();
528 if (strat->honey && strat->posInLDependsOnLength)
529 h->SetLength(strat->length_pLength);
530 assume(h->FDeg == h->pFDeg());
531 at = strat->posInL(strat->L,strat->Ll,h,strat);
532 if (at <= strat->Ll)
533 {
534 int dummy=strat->sl;
535 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
536 {
537 if (strat->honey && !strat->posInLDependsOnLength)
538 h->SetLength(strat->length_pLength);
539 return 1;
540 }
541 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
542#ifdef KDEBUG
543 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
544#endif
545 h->Clear();
546 return -1;
547 }
548 }
549 else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
550 {
551 Print(".%ld",d);mflush();
552 reddeg = d+1;
553 if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
554 {
555 strat->overflow=TRUE;
556 //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
557 h->GetP();
558 at = strat->posInL(strat->L,strat->Ll,h,strat);
559 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
560 h->Clear();
561 return -1;
562 }
563 }
564 }
565}
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition kutil.cc:10700
#define nEqual(n1, n2)
Definition numbers.h:20
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition polys.h:105

◆ redRiloc_Z()

int redRiloc_Z ( LObject h,
kStrategy  strat 
)

Definition at line 567 of file kstd1.cc.

568{
569 int i,at,ei,li,ii;
570 int j = 0;
571 int pass = 0;
572 long d,reddeg;
573 int docoeffred = 0;
574 poly T0p = strat->T[0].p;
575 int T0ecart = strat->T[0].ecart;
576
577
578 d = h->GetpFDeg()+ h->ecart;
579 reddeg = strat->LazyDegree+d;
580 h->SetShortExpVector();
581 if ((strat->tl>=0)
582 &&strat->T[0].GetpFDeg() == 0
583 && strat->T[0].length <= 2)
584 {
585 docoeffred = 1;
586 }
587 loop
588 {
589 /* cut down the lead coefficients, only possible if the degree of
590 * T[0] is 0 (constant). This is only efficient if T[0] is short, thus
591 * we ask for the length of T[0] to be <= 2 */
592 if (docoeffred)
593 {
594 j = kTestDivisibleByT0_Z(strat, h);
595 if (j == 0 && n_DivBy(pGetCoeff(h->p), pGetCoeff(T0p), currRing->cf) == FALSE
596 && T0ecart <= h->ecart)
597 {
598 /* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
599 * => we try to cut down the lead coefficient at least */
600 /* first copy T[j] in order to multiply it with a coefficient later on */
602 TObject tj = strat->T[0];
603 tj.Copy();
604 /* compute division with remainder of lc(h) and lc(T[j]) */
606 &rest, currRing->cf);
607 /* set corresponding new lead coefficient already. we do not
608 * remove the lead term in ksReducePolyLC, but only apply
609 * a lead coefficient reduction */
610 tj.Mult_nn(mult);
611 ksReducePolyLC(h, &tj, NULL, &rest, strat);
612 tj.Delete();
613 tj.Clear();
614 if (n_IsZero(pGetCoeff(h->GetP()),currRing->cf))
615 {
616 h->LmDeleteAndIter();
617 }
618 }
619 }
620 j = kFindDivisibleByInT(strat, h);
621 if (j < 0)
622 {
623 // over ZZ: cleanup coefficients by complete reduction with monomials
624 postReduceByMon(h, strat);
625 if(h->p == NULL)
626 {
627 kDeleteLcm(h);
628 h->Clear();
629 return 0;
630 }
631 if (strat->honey) h->SetLength(strat->length_pLength);
632 if(strat->tl >= 0)
633 h->i_r1 = strat->tl;
634 else
635 h->i_r1 = -1;
636 if (h->GetLmTailRing() == NULL)
637 {
638 kDeleteLcm(h);
639 h->Clear();
640 return 0;
641 }
642 return 1;
643 }
644
645 ei = strat->T[j].ecart;
646 ii = j;
647#if 1
648 if (ei > h->ecart && ii < strat->tl)
649 {
650 li = strat->T[j].length;
651 // the polynomial to reduce with (up to the moment) is;
652 // pi with ecart ei and length li
653 // look for one with smaller ecart
654 i = j;
655 loop
656 {
657 /*- takes the first possible with respect to ecart -*/
658 i++;
659#if 1
660 if (i > strat->tl) break;
661 if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
662 strat->T[i].length < li))
663 &&
664 p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
665 &&
666 n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
667#else
668 j = kFindDivisibleByInT(strat, h, i);
669 if (j < 0) break;
670 i = j;
671 if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
672 strat->T[i].length < li))
673#endif
674 {
675 // the polynomial to reduce with is now
676 ii = i;
677 ei = strat->T[i].ecart;
678 if (ei <= h->ecart) break;
679 li = strat->T[i].length;
680 }
681 }
682 }
683#endif
684
685 // end of search: have to reduce with pi
686 if (ei > h->ecart)
687 {
688 // It is not possible to reduce h with smaller ecart;
689 // if possible h goes to the lazy-set L,i.e
690 // if its position in L would be not the last one
691 strat->fromT = TRUE;
692 if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
693 {
694 h->SetLmCurrRing();
695 if (strat->honey && strat->posInLDependsOnLength)
696 h->SetLength(strat->length_pLength);
697 assume(h->FDeg == h->pFDeg());
698 at = strat->posInL(strat->L,strat->Ll,h,strat);
699 if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
700 {
701 /*- h will not become the next element to reduce -*/
702 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
703#ifdef KDEBUG
704 if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
705#endif
706 h->Clear();
707 strat->fromT = FALSE;
708 return -1;
709 }
710 }
711 doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
712 }
713 else
714 {
715 // now we finally can reduce
716 doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
717 }
718 strat->fromT=FALSE;
719 // are we done ???
720 if (h->IsNull())
721 {
722 kDeleteLcm(h);
723 h->Clear();
724 return 0;
725 }
726
727 // NO!
728 h->SetShortExpVector();
729 h->SetpFDeg();
730 if (strat->honey)
731 {
732 if (ei <= h->ecart)
733 h->ecart = d-h->GetpFDeg();
734 else
735 h->ecart = d-h->GetpFDeg()+ei-h->ecart;
736 }
737 else
738 // this has the side effect of setting h->length
739 h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
740 /*- try to reduce the s-polynomial -*/
741 pass++;
742 d = h->GetpFDeg()+h->ecart;
743 /*
744 *test whether the polynomial should go to the lazyset L
745 *-if the degree jumps
746 *-if the number of pre-defined reductions jumps
747 */
748 if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
749 && ((d >= reddeg) || (pass > strat->LazyPass)))
750 {
751 h->SetLmCurrRing();
752 if (strat->honey && strat->posInLDependsOnLength)
753 h->SetLength(strat->length_pLength);
754 assume(h->FDeg == h->pFDeg());
755 at = strat->posInL(strat->L,strat->Ll,h,strat);
756 if (at <= strat->Ll)
757 {
758 int dummy=strat->sl;
759 if (kFindDivisibleByInS(strat, &dummy, h) < 0)
760 {
761 if (strat->honey && !strat->posInLDependsOnLength)
762 h->SetLength(strat->length_pLength);
763 return 1;
764 }
765 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
766#ifdef KDEBUG
767 if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
768#endif
769 h->Clear();
770 return -1;
771 }
772 }
773 else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
774 {
775 Print(".%ld",d);mflush();
776 reddeg = d+1;
777 if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
778 {
779 strat->overflow=TRUE;
780 //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
781 h->GetP();
782 at = strat->posInL(strat->L,strat->Ll,h,strat);
783 enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
784 h->Clear();
785 return -1;
786 }
787 }
788 }
789}
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:468

◆ reorderL()

void reorderL ( kStrategy  strat)

Definition at line 1222 of file kstd1.cc.

1223{
1224 int i,j,at;
1225 LObject p;
1226
1227 for (i=1; i<=strat->Ll; i++)
1228 {
1229 at = strat->posInL(strat->L,i-1,&(strat->L[i]),strat);
1230 if (at != i)
1231 {
1232 p = strat->L[i];
1233 for (j=i-1; j>=at; j--) strat->L[j+1] = strat->L[j];
1234 strat->L[at] = p;
1235 }
1236 }
1237}

◆ reorderT()

void reorderT ( kStrategy  strat)

Definition at line 1242 of file kstd1.cc.

1243{
1244 int i,j,at;
1245 TObject p;
1246 unsigned long sev;
1247
1248
1249 for (i=1; i<=strat->tl; i++)
1250 {
1251 if (strat->T[i-1].length > strat->T[i].length)
1252 {
1253 p = strat->T[i];
1254 sev = strat->sevT[i];
1255 at = i-1;
1256 loop
1257 {
1258 at--;
1259 if (at < 0) break;
1260 if (strat->T[i].length > strat->T[at].length) break;
1261 }
1262 for (j = i-1; j>at; j--)
1263 {
1264 strat->T[j+1]=strat->T[j];
1265 strat->sevT[j+1]=strat->sevT[j];
1266 strat->R[strat->T[j+1].i_r] = &(strat->T[j+1]);
1267 }
1268 strat->T[at+1]=p;
1269 strat->sevT[at+1] = sev;
1270 strat->R[p.i_r] = &(strat->T[at+1]);
1271 }
1272 }
1273}

◆ updateL()

void updateL ( kStrategy  strat)

Definition at line 1394 of file kstd1.cc.

1395{
1396 LObject p;
1397 int dL;
1398 int j=strat->Ll;
1399 loop
1400 {
1401 if (j<0) break;
1402 if (hasPurePower(&(strat->L[j]),strat->lastAxis,&dL,strat))
1403 {
1404 p=strat->L[strat->Ll];
1405 strat->L[strat->Ll]=strat->L[j];
1406 strat->L[j]=p;
1407 break;
1408 }
1409 j--;
1410 }
1411 if (j<0)
1412 {
1413 j=strat->Ll;
1414 loop
1415 {
1416 if (j<0) break;
1417 if (pNext(strat->L[j].p) == strat->tail)
1418 {
1420 pLmDelete(strat->L[j].p); /*deletes the short spoly and computes*/
1421 else
1422 pLmFree(strat->L[j].p); /*deletes the short spoly and computes*/
1423 strat->L[j].p = NULL;
1424 poly m1 = NULL, m2 = NULL;
1425 // check that spoly creation is ok
1426 while (strat->tailRing != currRing &&
1427 !kCheckSpolyCreation(&(strat->L[j]), strat, m1, m2))
1428 {
1429 assume(m1 == NULL && m2 == NULL);
1430 // if not, change to a ring where exponents are at least
1431 // large enough
1432 kStratChangeTailRing(strat);
1433 }
1434 /* create the real one */
1435 ksCreateSpoly(&(strat->L[j]), strat->kNoetherTail(), FALSE,
1436 strat->tailRing, m1, m2, strat->R);
1437
1438 strat->L[j].SetLmCurrRing();
1439 if (!strat->honey)
1440 strat->initEcart(&strat->L[j]);
1441 else
1442 strat->L[j].SetLength(strat->length_pLength);
1443
1444 BOOLEAN pp = hasPurePower(&(strat->L[j]),strat->lastAxis,&dL,strat);
1445
1446 if (strat->use_buckets) strat->L[j].PrepareRed(TRUE);
1447
1448 if (pp)
1449 {
1450 p=strat->L[strat->Ll];
1451 strat->L[strat->Ll]=strat->L[j];
1452 strat->L[j]=p;
1453 break;
1454 }
1455 }
1456 j--;
1457 }
1458 }
1459}

◆ updateLHC()

void updateLHC ( kStrategy  strat)

Definition at line 1465 of file kstd1.cc.

1466{
1467
1468 int i = 0;
1469 kTest_TS(strat);
1470 while (i <= strat->Ll)
1471 {
1472 if (pNext(strat->L[i].p) == strat->tail)
1473 {
1474 /*- deletes the int spoly and computes -*/
1475 if (pLmCmp(strat->L[i].p,strat->kNoether) == -1)
1476 {
1478 pLmDelete(strat->L[i].p);
1479 else
1480 pLmFree(strat->L[i].p);
1481 strat->L[i].p = NULL;
1482 }
1483 else
1484 {
1486 pLmDelete(strat->L[i].p);
1487 else
1488 pLmFree(strat->L[i].p);
1489 strat->L[i].p = NULL;
1490 poly m1 = NULL, m2 = NULL;
1491 // check that spoly creation is ok
1492 while (strat->tailRing != currRing &&
1493 !kCheckSpolyCreation(&(strat->L[i]), strat, m1, m2))
1494 {
1495 assume(m1 == NULL && m2 == NULL);
1496 // if not, change to a ring where exponents are at least
1497 // large enough
1498 kStratChangeTailRing(strat);
1499 }
1500 /* create the real one */
1501 ksCreateSpoly(&(strat->L[i]), strat->kNoetherTail(), FALSE,
1502 strat->tailRing, m1, m2, strat->R);
1503 if (! strat->L[i].IsNull())
1504 {
1505 strat->L[i].SetLmCurrRing();
1506 strat->L[i].SetpFDeg();
1507 strat->L[i].ecart
1508 = strat->L[i].pLDeg(strat->LDegLast) - strat->L[i].GetpFDeg();
1509 if (strat->use_buckets) strat->L[i].PrepareRed(TRUE);
1510 }
1511 }
1512 }
1513 deleteHC(&(strat->L[i]), strat);
1514 if (strat->L[i].IsNull())
1515 deleteInL(strat->L,&strat->Ll,i,strat);
1516 else
1517 {
1518#ifdef KDEBUG
1519 kTest_L(&(strat->L[i]), strat, TRUE, i, strat->T, strat->tl);
1520#endif
1521 i++;
1522 }
1523 }
1524 kTest_TS(strat);
1525}

◆ updateT()

void updateT ( kStrategy  strat)

Definition at line 1531 of file kstd1.cc.

1532{
1533 int i = 0;
1534 LObject p;
1535
1536 while (i <= strat->tl)
1537 {
1538 p = strat->T[i];
1539 deleteHC(&p,strat, TRUE);
1540 /*- tries to cancel a unit: -*/
1541 cancelunit(&p);
1542 if (TEST_OPT_INTSTRATEGY) /* deleteHC and/or cancelunit may have changed p*/
1543 p.pCleardenom();
1544 if (p.p != strat->T[i].p)
1545 {
1546 strat->sevT[i] = pGetShortExpVector(p.p);
1547 p.SetpFDeg();
1548 }
1549 strat->T[i] = p;
1550 i++;
1551 }
1552}

Variable Documentation

◆ kHomW

VAR intvec * kHomW

Definition at line 2410 of file kstd1.cc.

◆ kModW

VAR intvec* kModW

Definition at line 2410 of file kstd1.cc.

◆ kOptions

VAR BITSET kOptions
Initial value:
#define OPT_SUGARCRIT
Definition options.h:80
#define OPT_PROT
Definition options.h:75
#define OPT_INFREDTAIL
Definition options.h:94
#define OPT_WEIGHTM
Definition options.h:97
#define OPT_NOT_SUGAR
Definition options.h:78
#define OPT_NOTREGULARITY
Definition options.h:96
#define OPT_INTERRUPT
Definition options.h:79
#define OPT_FASTHC
Definition options.h:85
#define OPT_OLDSTD
Definition options.h:86

Definition at line 45 of file kstd1.cc.

◆ validOpts

VAR BITSET validOpts

Definition at line 60 of file kstd1.cc.