My Project
Loading...
Searching...
No Matches
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)
static void reorderL (kStrategy strat)
static void reorderT (kStrategy strat)
static void missingAxis (int *last, kStrategy strat)
static BOOLEAN hasPurePower (const poly p, int last, int *length, kStrategy strat)
static BOOLEAN hasPurePower (LObject *L, int last, int *length, kStrategy strat)
int posInL10 (const LSet set, const int length, LObject *p, const kStrategy strat)
static void updateL (BOOLEAN searchPP, kStrategy strat)
static void updateLHC (kStrategy strat)
static void updateT (kStrategy strat)
static void firstUpdate (kStrategy strat)
void enterSMora (LObject *p, int atS, kStrategy strat, int atR)
void enterSMoraNF (LObject *p, int atS, kStrategy strat, int atR)
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, bigintmat *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)
ideal kStd_internal (ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
 pure GB/SB computations
ideal kStd2 (ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
 generic interface to GB/SB computations, large hilbert vectors
ideal kStd (ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
 generic interface to GB/SB computations
ideal kSba (ideal F, ideal Q, tHomog h, intvec **w, int sbaOrder, int arri, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw)
ideal kStdShift (ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
ideal kMin_std2 (ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp, int reduced)
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()

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

Definition at line 118 of file kstd1.cc.

119{
120 int ret;
121#if KDEBUG > 0
122 kTest_L(h);
123 kTest_T(with);
124#endif
125 // Hmmm ... why do we do this -- polys from T should already be normalized
127 with->pNorm();
128#ifdef KDEBUG
129 if (TEST_OPT_DEBUG)
130 {
131 PrintS("reduce ");h->wrp();PrintS(" with ");with->wrp();PrintLn();
132 }
133#endif
134 if (intoT)
135 {
136 // need to do it exactly like this: otherwise
137 // we might get errors
138 LObject L= *h;
139 L.Copy();
140 h->GetP();
141 h->length=h->pLength=pLength(h->p);
142 ret = ksReducePoly(&L, with, strat->kNoetherTail(), NULL, NULL, strat);
143 if (ret)
144 {
145 if (ret < 0) return ret;
146 if (h->tailRing != strat->tailRing)
147 h->ShallowCopyDelete(strat->tailRing,
149 strat->tailRing));
150 }
152 enterT_strong(h,strat);
153 else
154 enterT(h,strat);
155 *h = L;
156 }
157 else
158 ret = ksReducePoly(h, with, strat->kNoetherTail(), NULL, NULL, strat);
159#ifdef KDEBUG
160 if (TEST_OPT_DEBUG)
161 {
162 PrintS("to ");h->wrp();PrintLn();
163 }
164#endif
165 return ret;
166}
KINLINE poly kNoetherTail()
Definition kInline.h:66
ring tailRing
Definition kutil.h:342
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_strong(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9242
BOOLEAN kTest_L(LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
Definition kutil.cc:916
void enterT(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9143
BOOLEAN kTest_T(TObject *T, kStrategy strat, int i, char TN)
Definition kutil.cc:789
class sLObject LObject
Definition kutil.h:59
#define NULL
Definition omList.c:12
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
#define TEST_OPT_DEBUG
Definition options.h:110
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:288
void PrintLn()
Definition reporter.cc:314
#define rField_is_Ring(R)
Definition ring.h:491

◆ enterSMora()

void enterSMora ( LObject * p,
int atS,
kStrategy strat,
int atR )

Definition at line 1629 of file kstd1.cc.

1630{
1631 enterSBba(p, atS, strat, atR);
1632 #ifdef KDEBUG
1633 if (TEST_OPT_DEBUG)
1634 {
1635 Print("new s%d:",atS);
1636 p_wrp(p->p,currRing,strat->tailRing);
1637 PrintLn();
1638 }
1639 #endif
1640 HEckeTest(p->p,strat);
1641 if (strat->kAllAxis)
1642 {
1643 if (newHEdge(strat))
1644 {
1645 firstUpdate(strat);
1646 if (TEST_OPT_FINDET)
1647 return;
1648
1649 /*- cuts elements in L above noether and reorders L -*/
1650 updateLHC(strat);
1651 /*- reorders L with respect to posInL -*/
1652 reorderL(strat);
1653 }
1654 }
1655 else if ((strat->kNoether==NULL)
1656 && (TEST_OPT_FASTHC))
1657 {
1658 if (strat->posInLOldFlag)
1659 {
1660 missingAxis(&strat->lastAxis,strat);
1661 if (strat->lastAxis)
1662 {
1663 strat->posInLOld = strat->posInL;
1664 strat->posInLOldFlag = FALSE;
1665 strat->posInL = posInL10;
1666 strat->posInLDependsOnLength = TRUE;
1667 updateL(FALSE,strat);
1668 reorderL(strat);
1669 }
1670 }
1671 else if (strat->lastAxis)
1672 updateL(TRUE,strat);
1673 }
1674}
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
int p
Definition cfModGcd.cc:4086
char posInLOldFlag
Definition kutil.h:379
poly kNoether
Definition kutil.h:328
int lastAxis
Definition kutil.h:354
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:283
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:287
char kAllAxis
Definition kutil.h:373
char posInLDependsOnLength
Definition kutil.h:386
#define Print
Definition emacs.cc:80
static void firstUpdate(kStrategy strat)
Definition kstd1.cc:1566
static void updateL(BOOLEAN searchPP, kStrategy strat)
Definition kstd1.cc:1394
static void missingAxis(int *last, kStrategy strat)
Definition kstd1.cc:1279
static void updateLHC(kStrategy strat)
Definition kstd1.cc:1474
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1360
static void reorderL(kStrategy strat)
Definition kstd1.cc:1222
void enterSBba(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8792
void HEckeTest(poly pp, kStrategy strat)
Definition kutil.cc:493
BOOLEAN newHEdge(kStrategy strat)
Definition kutil.cc:10379
#define TEST_OPT_FINDET
Definition options.h:113
#define TEST_OPT_FASTHC
Definition options.h:111
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373

◆ enterSMoraNF()

void enterSMoraNF ( LObject * p,
int atS,
kStrategy strat,
int atR )

Definition at line 1682 of file kstd1.cc.

1683{
1684 enterSBba(p, atS, strat, atR);
1685 if ((!strat->kAllAxis) || (strat->kNoether!=NULL)) HEckeTest(p->p,strat);
1686 if (strat->kAllAxis)
1687 newHEdge(strat);
1688}

◆ firstUpdate()

void firstUpdate ( kStrategy strat)
static

Definition at line 1566 of file kstd1.cc.

1567{
1568 if (strat->update)
1569 {
1570 kTest_TS(strat);
1571 strat->update = (strat->tl == -1);
1572 if (TEST_OPT_WEIGHTM)
1573 {
1575 if (strat->tailRing != currRing)
1576 {
1577 strat->tailRing->pFDeg = strat->pOrigFDeg_TailRing;
1578 strat->tailRing->pLDeg = strat->pOrigLDeg_TailRing;
1579 }
1580 int i;
1581 for (i=strat->Ll; i>=0; i--)
1582 {
1583 strat->L[i].SetpFDeg();
1584 }
1585 for (i=strat->tl; i>=0; i--)
1586 {
1587 strat->T[i].SetpFDeg();
1588 }
1589 if (ecartWeights)
1590 {
1591 omFreeSize((ADDRESS)ecartWeights,(rVar(currRing)+1)*sizeof(short));
1593 }
1594 }
1595 if (TEST_OPT_FASTHC)
1596 {
1597 strat->posInL = strat->posInLOld;
1598 strat->lastAxis = 0;
1599 }
1600 if (TEST_OPT_FINDET)
1601 return;
1602
1603 strat->use_buckets = kMoraUseBucket(strat);
1604 updateT(strat);
1605
1607 {
1608 strat->posInT = posInT2;
1609 reorderT(strat);
1610 }
1611 }
1612 kTest_TS(strat);
1613}
void * ADDRESS
Definition auxiliary.h:120
int i
Definition cfEzgcd.cc:132
pFDegProc pOrigFDeg_TailRing
Definition kutil.h:297
int Ll
Definition kutil.h:350
TSet T
Definition kutil.h:325
int tl
Definition kutil.h:349
pFDegProc pOrigFDeg
Definition kutil.h:295
char use_buckets
Definition kutil.h:380
LSet L
Definition kutil.h:326
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:282
pLDegProc pOrigLDeg
Definition kutil.h:296
char update
Definition kutil.h:378
pLDegProc pOrigLDeg_TailRing
Definition kutil.h:298
static void updateT(kStrategy strat)
Definition kstd1.cc:1540
static BOOLEAN kMoraUseBucket(kStrategy strat)
Definition kstd1.cc:3879
static void reorderT(kStrategy strat)
Definition kstd1.cc:1241
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1067
int posInT2(const TSet set, const int length, LObject &p)
Definition kutil.cc:4925
#define omFreeSize(addr, size)
#define TEST_OPT_WEIGHTM
Definition options.h:123
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3774
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:773
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:603
EXTERN_VAR short * ecartWeights
Definition weight.h:12

◆ hasPurePower() [1/2]

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

Definition at line 1312 of file kstd1.cc.

1313{
1314 poly h;
1315 int i;
1316
1317 if (pNext(p) == strat->tail)
1318 return FALSE;
1319 pp_Test(p, currRing, strat->tailRing);
1320 if (strat->ak <= 0 || p_MinComp(p, currRing, strat->tailRing) == strat->ak)
1321 {
1323 if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(p), currRing->cf))) i=0;
1324 if (i == last)
1325 {
1326 *length = 0;
1327 return TRUE;
1328 }
1329 *length = 1;
1330 h = pNext(p);
1331 while (h != NULL)
1332 {
1333 i = p_IsPurePower(h, strat->tailRing);
1334 if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(h), currRing->cf))) i=0;
1335 if (i==last) return TRUE;
1336 (*length)++;
1337 pIter(h);
1338 }
1339 }
1340 return FALSE;
1341}
int ak
Definition kutil.h:352
poly tail
Definition kutil.h:333
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:521
STATIC_VAR poly last
Definition hdegree.cc:1138
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:315
#define pp_Test(p, lmRing, tailRing)
Definition p_polys.h:163

◆ hasPurePower() [2/2]

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

Definition at line 1343 of file kstd1.cc.

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

◆ initBba()

void initBba ( kStrategy strat)

Definition at line 1690 of file kstd1.cc.

1691{
1692 /* setting global variables ------------------- */
1693 strat->enterS = enterSBba;
1694 strat->red = redHoney;
1695 if (strat->honey)
1696 strat->red = redHoney;
1697 else if (currRing->pLexOrder && !strat->homog)
1698 strat->red = redLazy;
1699 else
1700 {
1701 strat->LazyPass *=4;
1702 strat->red = redHomog;
1703 }
1705 {
1706 if (rField_is_Z(currRing))
1707 strat->red = redRing_Z;
1708 else
1709 strat->red = redRing;
1710 }
1711 if (TEST_OPT_IDLIFT
1712 && (!rIsNCRing(currRing))
1713 && (!rField_is_Ring(currRing)))
1714 strat->red=redLiftstd;
1715 if (currRing->pLexOrder && strat->honey)
1716 strat->initEcart = initEcartNormal;
1717 else
1718 strat->initEcart = initEcartBBA;
1719 if (strat->honey)
1721 else
1723// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1724// {
1725// //interred machen Aenderung
1726// strat->pOrigFDeg=pFDeg;
1727// strat->pOrigLDeg=pLDeg;
1728// //h=ggetid("ecart");
1729// //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
1730// //{
1731// // ecartWeights=iv2array(IDINTVEC(h));
1732// //}
1733// //else
1734// {
1735// ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1736// /*uses automatic computation of the ecartWeights to set them*/
1737// kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
1738// }
1739// pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
1740// if (TEST_OPT_PROT)
1741// {
1742// for(i=1; i<=(currRing->N); i++)
1743// Print(" %d",ecartWeights[i]);
1744// PrintLn();
1745// mflush();
1746// }
1747// }
1748}
char honey
Definition kutil.h:374
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:286
void(* enterS)(LObject *h, int pos, kStrategy strat, int atR)
Definition kutil.h:285
void(* initEcart)(TObject *L)
Definition kutil.h:281
int LazyPass
Definition kutil.h:352
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
char homog
Definition kutil.h:369
int redLiftstd(LObject *h, kStrategy strat)
Definition kLiftstd.cc:167
int redRing_Z(LObject *h, kStrategy strat)
Definition kstd2.cc:720
int redHoney(LObject *h, kStrategy strat)
Definition kstd2.cc:2110
int redHomog(LObject *h, kStrategy strat)
Definition kstd2.cc:1150
int redLazy(LObject *h, kStrategy strat)
Definition kstd2.cc:1905
int redRing(LObject *h, kStrategy strat)
Definition kstd2.cc:988
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1315
void initEcartNormal(TObject *h)
Definition kutil.cc:1293
void initEcartBBA(TObject *h)
Definition kutil.cc:1301
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition kutil.cc:1308
#define TEST_OPT_IDLIFT
Definition options.h:131
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:520
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:427

◆ initMora()

void initMora ( ideal F,
kStrategy strat )

Definition at line 1820 of file kstd1.cc.

1821{
1822 int i,j;
1823
1824 strat->NotUsedAxis = (BOOLEAN *)omAlloc(((currRing->N)+1)*sizeof(BOOLEAN));
1825 for (j=(currRing->N); j>0; j--) strat->NotUsedAxis[j] = TRUE;
1826 strat->enterS = enterSMora;
1827 strat->initEcartPair = initEcartPairMora; /*- ecart approximation -*/
1828 strat->posInLOld = strat->posInL;
1829 strat->posInLOldFlag = TRUE;
1830 strat->initEcart = initEcartNormal;
1831 if (strat->homog)
1832 strat->red = redFirst; /*take the first possible in T*/
1833 else
1834 strat->red = redEcart;/*take the first possible in under ecart-restriction*/
1835 if ( currRing->ppNoether!=NULL )
1836 {
1837 strat->kNoether = pCopy((currRing->ppNoether));
1838 if (TEST_OPT_PROT)
1839 {
1840 Print("H(%ld)",p_FDeg(strat->kNoether,currRing)+1);
1841 mflush();
1842 }
1843 }
1844 if (strat->kNoether!=NULL)
1845 {
1846 HCord = currRing->pFDeg((strat->kNoether),currRing)+1;
1847 }
1848 else
1849 {
1850 HCord = INT_MAX-3;/*- very large -*/
1851 }
1852
1854 {
1855 if (rField_is_Z(currRing))
1856 strat->red = redRiloc_Z;
1857 else
1858 strat->red = redRiloc;
1859 }
1860
1861 /*reads the ecartWeights used for Graebes method from the
1862 *intvec ecart and set ecartWeights
1863 */
1864 if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
1865 {
1866 //interred machen Aenderung
1867 strat->pOrigFDeg=currRing->pFDeg;
1868 strat->pOrigLDeg=currRing->pLDeg;
1869 ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
1870 /*uses automatic computation of the ecartWeights to set them*/
1872
1874 if (TEST_OPT_PROT)
1875 {
1876 for(i=1; i<=(currRing->N); i++)
1877 Print(" %d",ecartWeights[i]);
1878 PrintLn();
1879 mflush();
1880 }
1881 }
1882 kOptimizeLDeg(currRing->pLDeg, strat);
1883}
int BOOLEAN
Definition auxiliary.h:88
BOOLEAN * NotUsedAxis
Definition kutil.h:331
int j
Definition facHensel.cc:110
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:794
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:168
void enterSMora(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1629
static void kOptimizeLDeg(pLDegProc ldeg, kStrategy strat)
Definition kstd1.cc:100
int redRiloc(LObject *h, kStrategy strat)
Definition kstd1.cc:385
int redRiloc_Z(LObject *h, kStrategy strat)
Definition kstd1.cc:566
VAR int HCord
Definition kutil.cc:239
#define omAlloc(size)
#define TEST_OPT_PROT
Definition options.h:105
void pSetDegProcs(ring r, pFDegProc new_FDeg, pLDegProc new_lDeg)
Definition p_polys.cc:3762
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:382
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
#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 1750 of file kstd1.cc.

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

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

3445{
3446 const ring save = currRing;
3447 if( currRing != _currRing ) rChangeCurrRing(_currRing);
3448 poly ret = kNF(F, Q, p, syzComp, lazyReduce);
3449 if( currRing != save ) rChangeCurrRing(save);
3450 return ret;
3451}
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3230
void rChangeCurrRing(ring r)
Definition polys.cc:16
#define Q
Definition sirandom.c:26

◆ kDebugPrint()

void kDebugPrint ( kStrategy strat)

Definition at line 11478 of file kutil.cc.

11479{
11480 printf("red: ");
11481 if (strat->red==redFirst) printf("redFirst\n");
11482 else if (strat->red==redHoney) printf("redHoney\n");
11483 else if (strat->red==redEcart) printf("redEcart\n");
11484 else if (strat->red==redHomog) printf("redHomog\n");
11485 else if (strat->red==redLazy) printf("redLazy\n");
11486 else if (strat->red==redLiftstd) printf("redLiftstd\n");
11487 else printf("%p\n",(void*)strat->red);
11488 printf("posInT: ");
11489 if (strat->posInT==posInT0) printf("posInT0\n");
11490 else if (strat->posInT==posInT1) printf("posInT1\n");
11491 else if (strat->posInT==posInT11) printf("posInT11\n");
11492 else if (strat->posInT==posInT110) printf("posInT110\n");
11493 else if (strat->posInT==posInT13) printf("posInT13\n");
11494 else if (strat->posInT==posInT15) printf("posInT15\n");
11495 else if (strat->posInT==posInT17) printf("posInT17\n");
11496 else if (strat->posInT==posInT17_c) printf("posInT17_c\n");
11497 else if (strat->posInT==posInT19) printf("posInT19\n");
11498 else if (strat->posInT==posInT2) printf("posInT2\n");
11499 else if (strat->posInT==posInT11Ring) printf("posInT11Ring\n");
11500 else if (strat->posInT==posInT110Ring) printf("posInT110Ring\n");
11501 else if (strat->posInT==posInT15Ring) printf("posInT15Ring\n");
11502 else if (strat->posInT==posInT17Ring) printf("posInT17Ring\n");
11503 else if (strat->posInT==posInT17_cRing) printf("posInT17_cRing\n");
11504#ifdef HAVE_MORE_POS_IN_T
11505 else if (strat->posInT==posInT_EcartFDegpLength) printf("posInT_EcartFDegpLength\n");
11506 else if (strat->posInT==posInT_FDegpLength) printf("posInT_FDegpLength\n");
11507 else if (strat->posInT==posInT_pLength) printf("posInT_pLength\n");
11508#endif
11509 else if (strat->posInT==posInT_EcartpLength) printf("posInT_EcartpLength\n");
11510 else printf("%p\n",(void*)strat->posInT);
11511 printf("posInL: ");
11512 if (strat->posInL==posInL0) printf("posInL0\n");
11513 else if (strat->posInL==posInL10) printf("posInL10\n");
11514 else if (strat->posInL==posInL11) printf("posInL11\n");
11515 else if (strat->posInL==posInL110) printf("posInL110\n");
11516 else if (strat->posInL==posInL13) printf("posInL13\n");
11517 else if (strat->posInL==posInL15) printf("posInL15\n");
11518 else if (strat->posInL==posInL17) printf("posInL17\n");
11519 else if (strat->posInL==posInL17_c) printf("posInL17_c\n");
11520 else if (strat->posInL==posInL0) printf("posInL0Ring\n");
11521 else if (strat->posInL==posInL11Ring) printf("posInL11Ring\n");
11522 else if (strat->posInL==posInL11Ringls) printf("posInL11Ringls\n");
11523 else if (strat->posInL==posInL110Ring) printf("posInL110Ring\n");
11524 else if (strat->posInL==posInL15Ring) printf("posInL15Ring\n");
11525 else if (strat->posInL==posInL17Ring) printf("posInL17Ring\n");
11526 else if (strat->posInL==posInL17_cRing) printf("posInL17_cRing\n");
11527 else if (strat->posInL==posInLSpecial) printf("posInLSpecial\n");
11528 else printf("%p\n",(void*)strat->posInL);
11529 printf("enterS: ");
11530 if (strat->enterS==enterSBba) printf("enterSBba\n");
11531 else if (strat->enterS==enterSMora) printf("enterSMora\n");
11532 else if (strat->enterS==enterSMoraNF) printf("enterSMoraNF\n");
11533 else printf("%p\n",(void*)strat->enterS);
11534 printf("initEcart: ");
11535 if (strat->initEcart==initEcartBBA) printf("initEcartBBA\n");
11536 else if (strat->initEcart==initEcartNormal) printf("initEcartNormal\n");
11537 else printf("%p\n",(void*)strat->initEcart);
11538 printf("initEcartPair: ");
11539 if (strat->initEcartPair==initEcartPairBba) printf("initEcartPairBba\n");
11540 else if (strat->initEcartPair==initEcartPairMora) printf("initEcartPairMora\n");
11541 else printf("%p\n",(void*)strat->initEcartPair);
11542 printf("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11543 strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11544 printf("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11545 strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11546 printf("chainCrit: ");
11547 if (strat->chainCrit==chainCritNormal) printf("chainCritNormal\n");
11548 else if (strat->chainCrit==chainCritOpt_1) printf("chainCritOpt_1\n");
11549 else printf("%p\n",(void*)strat->chainCrit);
11550 printf("posInLDependsOnLength=%d\n",
11551 strat->posInLDependsOnLength);
11552 printf("%s\n",showOption());
11553 printf("LDeg: ");
11554 if (currRing->pLDeg==pLDeg0) printf("pLDeg0");
11555 else if (currRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11556 else if (currRing->pLDeg==pLDegb) printf("pLDegb");
11557 else if (currRing->pLDeg==pLDeg1) printf("pLDeg1");
11558 else if (currRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11559 else if (currRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11560 else if (currRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11561 else if (currRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11562 else if (currRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11563 else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11564 else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11565 else if (currRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11566 else printf("? (%lx)", (long)currRing->pLDeg);
11567 printf(" / ");
11568 if (strat->tailRing->pLDeg==pLDeg0) printf("pLDeg0");
11569 else if (strat->tailRing->pLDeg==pLDeg0c) printf("pLDeg0c");
11570 else if (strat->tailRing->pLDeg==pLDegb) printf("pLDegb");
11571 else if (strat->tailRing->pLDeg==pLDeg1) printf("pLDeg1");
11572 else if (strat->tailRing->pLDeg==pLDeg1c) printf("pLDeg1c");
11573 else if (strat->tailRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
11574 else if (strat->tailRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
11575 else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
11576 else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
11577 else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
11578 else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
11579 else if (strat->tailRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
11580 else printf("? (%lx)", (long)strat->tailRing->pLDeg);
11581 printf("\n");
11582 printf("currRing->pFDeg: ");
11583 if (currRing->pFDeg==p_Totaldegree) printf("p_Totaldegree");
11584 else if (currRing->pFDeg==p_WFirstTotalDegree) printf("pWFirstTotalDegree");
11585 else if (currRing->pFDeg==p_Deg) printf("p_Deg");
11586 else if (currRing->pFDeg==kHomModDeg) printf("kHomModDeg");
11587 else if (currRing->pFDeg==kModDeg) printf("kModDeg");
11588 else if (currRing->pFDeg==totaldegreeWecart) printf("totaldegreeWecart");
11589 else if (currRing->pFDeg==p_WTotaldegree) printf("p_WTotaldegree");
11590 else printf("? (%lx)", (long)currRing->pFDeg);
11591 printf("\n");
11592 printf(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11594 printf(" degBound: %d\n", Kstd1_deg);
11595
11596 if( ecartWeights != NULL )
11597 {
11598 printf("ecartWeights: ");
11599 for (int i = rVar(currRing); i > 0; i--)
11600 printf("%hd ", ecartWeights[i]);
11601 printf("\n");
11603 }
11604
11605#ifndef SING_NDEBUG
11607#endif
11608}
int syzComp
Definition kutil.h:353
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:290
char noTailReduction
Definition kutil.h:375
char sugarCrit
Definition kutil.h:374
char Gebauer
Definition kutil.h:375
int LazyDegree
Definition kutil.h:352
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2421
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2411
void enterSMoraNF(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1682
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6299
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6412
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6058
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5278
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5844
int posInT11(const TSet set, const int length, LObject &p)
Definition kutil.cc:4953
int posInT1(const TSet set, const int length, LObject &p)
Definition kutil.cc:4896
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5071
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:5146
int posInT0(const TSet, const int length, LObject &)
Definition kutil.cc:4885
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6145
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6099
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11449
int posInT13(const TSet set, const int length, LObject &p)
Definition kutil.cc:5117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5611
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3445
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:4989
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6180
int posInT17_c(const TSet set, const int length, LObject &p)
Definition kutil.cc:5384
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11358
int posInT15(const TSet set, const int length, LObject &p)
Definition kutil.cc:5184
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5567
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5912
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6255
int posInT110(const TSet set, const int length, LObject &p)
Definition kutil.cc:5029
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6215
int posInT19(const TSet set, const int length, LObject &p)
Definition kutil.cc:5510
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5238
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5339
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition kutil.cc:5445
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6348
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11412
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3204
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5802
char * showOption()
Definition misc_ip.cc:713
#define assume(x)
Definition mod2.h:389
#define TEST_OPT_DEGBOUND
Definition options.h:115
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:1528
void rDebugPrint(const ring r)
Definition ring.cc:4214
static int rGetCurrSyzLimit(const ring r)
Definition ring.h:734
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition ring.h:731

◆ kHomModDeg()

long kHomModDeg ( poly p,
const ring r )

Definition at line 2421 of file kstd1.cc.

2422{
2423 int i;
2424 long j=0;
2425
2426 for (i=r->N;i>0;i--)
2427 j+=p_GetExp(p,i,r)*(*kHomW)[i-1];
2428 if (kModW == NULL) return j;
2429 i = __p_GetComp(p,r);
2430 if (i==0) return j;
2431 return j+(*kModW)[i-1];
2432}
VAR intvec * kModW
Definition kstd1.cc:2409
#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:471

◆ kInterRed()

ideal kInterRed ( ideal F,
const ideal Q )

Definition at line 3803 of file kstd1.cc.

3804{
3805#ifdef HAVE_PLURAL
3806 if(rIsPluralRing(currRing)) return kInterRedOld(F,Q);
3807#endif
3810 )
3811 return kInterRedOld(F,Q);
3812
3813 //return kInterRedOld(F,Q);
3814
3815 BITSET save1;
3816 SI_SAVE_OPT1(save1);
3817 //si_opt_1|=Sy_bit(OPT_NOT_SUGAR);
3819 //si_opt_1&= ~Sy_bit(OPT_REDTAIL);
3820 //si_opt_1&= ~Sy_bit(OPT_REDSB);
3821 //extern char * showOption() ;
3822 //Print("%s\n",showOption());
3823
3824 int need_retry;
3825 int counter=3;
3826 ideal res, res1;
3827 int elems=0;
3828 ideal null=NULL;
3829 if ((Q==NULL) || (!TEST_OPT_REDSB))
3830 {
3831 elems=idElem(F);
3832 res=kInterRedBba(F,Q,need_retry);
3833 }
3834 else
3835 {
3836 ideal FF=idSimpleAdd(F,Q);
3837 res=kInterRedBba(FF,NULL,need_retry);
3838 idDelete(&FF);
3839 null=idInit(1,1);
3840 if (need_retry)
3841 res1=kNF(null,Q,res,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
3842 else
3843 res1=kNF(null,Q,res);
3844 idDelete(&res);
3845 res=res1;
3846 need_retry=1;
3847 }
3848 if (idElem(res)<=1) need_retry=0;
3849 while (need_retry && (counter>0))
3850 {
3851 #ifdef KDEBUG
3852 if (TEST_OPT_DEBUG) { Print("retry counter %d\n",counter); }
3853 #endif
3854 res1=kInterRedBba(res,Q,need_retry);
3855 int new_elems=idElem(res1);
3856 counter -= (new_elems >= elems);
3857 elems = new_elems;
3858 idDelete(&res);
3859 if (idElem(res1)<=1) need_retry=0;
3860 if ((Q!=NULL) && (TEST_OPT_REDSB))
3861 {
3862 if (need_retry)
3863 res=kNF(null,Q,res1,0,KSTD_NF_LAZY | KSTD_NF_NONORM);
3864 else
3865 res=kNF(null,Q,res1);
3866 idDelete(&res1);
3867 }
3868 else
3869 res = res1;
3870 if (idElem(res)<=1) need_retry=0;
3871 }
3872 if (null!=NULL) idDelete(&null);
3873 SI_RESTORE_OPT1(save1);
3875 return res;
3876}
#define BITSET
Definition auxiliary.h:85
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:3457
#define KSTD_NF_LAZY
Definition kstd1.h:18
#define KSTD_NF_NONORM
Definition kstd1.h:22
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:83
#define Sy_bit(x)
Definition options.h:31
#define TEST_OPT_REDSB
Definition options.h:106
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static BOOLEAN rField_is_numeric(const ring r)
Definition ring.h:526
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

◆ 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;
3557 // BOOLEAN withT = FALSE;
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 }
3667 else
3668 {
3669 strat->P.pNorm();
3670 }
3671
3672#ifdef KDEBUG
3673 if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
3674#endif
3675
3676 // enter into S, L, and T
3677 if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
3678 {
3679 enterT(&strat->P, strat);
3680 // posInS only depends on the leading term
3681 strat->enterS(&strat->P, pos, strat, strat->tl);
3682
3683 if (pos<strat->sl)
3684 {
3685 need_retry++;
3686 // move all "larger" elements fromS to L
3687 // remove them from T
3688 int ii=pos+1;
3689 for(;ii<=strat->sl;ii++)
3690 {
3691 LObject h;
3692 h.Clear();
3693 h.tailRing=strat->tailRing;
3694 h.p=strat->S[ii]; strat->S[ii]=NULL;
3695 strat->initEcart(&h);
3696 h.sev=strat->sevS[ii];
3697 int jj=strat->tl;
3698 while (jj>=0)
3699 {
3700 if (strat->T[jj].p==h.p)
3701 {
3702 strat->T[jj].p=NULL;
3703 if (jj<strat->tl)
3704 {
3705 memmove(&(strat->T[jj]),&(strat->T[jj+1]),
3706 (strat->tl-jj)*sizeof(strat->T[jj]));
3707 memmove(&(strat->sevT[jj]),&(strat->sevT[jj+1]),
3708 (strat->tl-jj)*sizeof(strat->sevT[jj]));
3709 }
3710 strat->tl--;
3711 break;
3712 }
3713 jj--;
3714 }
3715 int lpos=strat->posInL(strat->L,strat->Ll,&h,strat);
3716 enterL(&strat->L,&strat->Ll,&strat->Lmax,h,lpos);
3717 #ifdef KDEBUG
3718 if (TEST_OPT_DEBUG)
3719 {
3720 Print("move S[%d] -> L[%d]: ",ii,pos);
3721 p_wrp(h.p,currRing, strat->tailRing);
3722 PrintLn();
3723 }
3724 #endif
3725 }
3726 if (strat->fromQ!=NULL)
3727 {
3728 for(ii=pos+1;ii<=strat->sl;ii++) strat->fromQ[ii]=0;
3729 }
3730 strat->sl=pos;
3731 }
3732 }
3733 else
3734 {
3735 // clean P
3736 }
3737 kDeleteLcm(&strat->P);
3738 }
3739
3740#ifdef KDEBUG
3741 if (TEST_OPT_DEBUG)
3742 {
3743 messageSets(strat);
3744 }
3745 strat->P.Clear();
3746#endif
3747 //kTest_TS(strat);: i_r out of sync in kInterRedBba, but not used!
3748 }
3749#ifdef KDEBUG
3750 //if (TEST_OPT_DEBUG) messageSets(strat);
3751#endif
3752 /* complete reduction of the standard basis--------- */
3753
3754 if((need_retry<=0) && (TEST_OPT_REDSB))
3755 {
3756 completeReduce(strat);
3757 if (strat->completeReduce_retry)
3758 {
3759 // completeReduce needed larger exponents, retry
3760 // hopefully: kStratChangeTailRing already provided a larger tailRing
3761 // (otherwise: it will fail again)
3763 completeReduce(strat);
3764 if (strat->completeReduce_retry)
3765 {
3766#ifdef HAVE_TAIL_RING
3767 if(currRing->bitmask>strat->tailRing->bitmask)
3768 {
3769 // retry without T
3771 cleanT(strat);strat->tailRing=currRing;
3772 int i;
3773 for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
3774 completeReduce(strat);
3775 }
3776 if (strat->completeReduce_retry)
3777#endif
3778 Werror("exponent bound is %ld",currRing->bitmask);
3779 }
3780 }
3781 }
3782 else if (TEST_OPT_PROT) PrintLn();
3783
3784
3785 /* release temp data-------------------------------- */
3786 exitBuchMora(strat);
3787// if (TEST_OPT_WEIGHTM)
3788// {
3789// pRestoreDegProcs(currRing,strat->pOrigFDeg, strat->pOrigLDeg);
3790// if (ecartWeights)
3791// {
3792// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
3793// ecartWeights=NULL;
3794// }
3795// }
3796 //if (TEST_OPT_PROT) messageStat(0/*hilbcount*/,strat);
3797 if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
3798 ideal res=strat->Shdl;
3799 strat->Shdl=NULL;
3800 delete strat;
3801 return res;
3802}
intvec * kModW
Definition kutil.h:334
int * S_2_R
Definition kutil.h:341
omBin lmBin
Definition kutil.h:343
polyset S
Definition kutil.h:305
unsigned long * sevT
Definition kutil.h:324
intvec * kHomW
Definition kutil.h:335
ideal Shdl
Definition kutil.h:302
intset fromQ
Definition kutil.h:320
char interpt
Definition kutil.h:368
char completeReduce_retry
Definition kutil.h:400
LObject P
Definition kutil.h:301
int Lmax
Definition kutil.h:350
int sl
Definition kutil.h:347
unsigned long * sevS
Definition kutil.h:321
#define idTest(id)
Definition ideals.h:47
static BOOLEAN idHomIdeal(ideal id, ideal Q=NULL)
Definition ideals.h:91
void initBba(kStrategy strat)
Definition kstd1.cc:1690
VAR intvec * kHomW
Definition kstd1.cc:2409
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9749
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition kutil.cc:1269
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9580
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9837
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4663
void cleanT(kStrategy strat)
Definition kutil.cc:557
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10051
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11036
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9435
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10257
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9664
void messageSets(kStrategy strat)
Definition kutil.cc:7536
static void kDeleteLcm(LObject *P)
Definition kutil.h:876
#define TEST_OPT_NOT_BUCKETS
Definition options.h:107
#define pGetComp(p)
Component.
Definition polys.h:38
void Werror(const char *fmt,...)
Definition reporter.cc:189
static BOOLEAN rField_has_simple_inverse(const ring r)
Definition ring.h:559
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
tHomog
Definition structs.h:31
@ isHomog
Definition structs.h:33
@ isNotHomog
Definition structs.h:32
skStrategy * kStrategy
Definition structs.h:54

◆ kInterRedOld()

ideal kInterRedOld ( ideal F,
const ideal Q )

Definition at line 3457 of file kstd1.cc.

3458{
3459 int j;
3460 kStrategy strat = new skStrategy;
3461
3462 ideal tempF = F;
3463 ideal tempQ = Q;
3464
3465#ifdef HAVE_PLURAL
3466 if(rIsSCA(currRing))
3467 {
3468 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3469 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3470 tempF = id_KillSquares(F, m_iFirstAltVar, m_iLastAltVar, currRing);
3471
3472 // this should be done on the upper level!!! :
3473 // tempQ = SCAQuotient(currRing);
3474
3475 if(Q == currRing->qideal)
3476 tempQ = SCAQuotient(currRing);
3477 }
3478#endif
3479
3480// if (TEST_OPT_PROT)
3481// {
3482// writeTime("start InterRed:");
3483// mflush();
3484// }
3485 //strat->syzComp = 0;
3486 strat->kAllAxis = (currRing->ppNoether) != NULL;
3487 strat->kNoether=pCopy((currRing->ppNoether));
3488 strat->ak = 0;
3489 if (id_IsModule(tempF,currRing)) strat->ak = id_RankFreeModule(tempF,currRing);
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;
3535 idSkipZeroes(shdl);
3536 if (strat->fromQ)
3537 {
3538 omfree(strat->fromQ);
3539 strat->fromQ=NULL;
3540 ideal res=kInterRed(shdl,NULL);
3541 idDelete(&shdl);
3542 shdl=res;
3543 }
3544 delete(strat);
3545#ifdef HAVE_PLURAL
3546 if( tempF != F )
3547 id_Delete( &tempF, currRing);
3548#endif
3549 return shdl;
3550}
intset ecartS
Definition kutil.h:308
TObject ** R
Definition kutil.h:339
int tmax
Definition kutil.h:349
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:3803
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7586
void updateS(BOOLEAN toT, kStrategy strat)
Definition kutil.cc:8557
#define setmaxT
Definition kutil.h:34
class sTObject TObject
Definition kutil.h:58
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:187
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:71
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
BOOLEAN id_IsModule(ideal A, const ring src)

◆ kMin_std()

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

Definition at line 3222 of file kstd1.cc.

3224{
3225 bigintmat *hh=iv2biv(hilb,coeffs_BIGINT);
3226 ideal res=kMin_std2(F,Q,h,w,M,hh,syzComp,reduced);
3227 if (hh!=NULL) delete hh;
3228 return res;
3229}
Matrices of numbers.
Definition bigintmat.h:51
const CanonicalForm & w
Definition facAbsFact.cc:51
bigintmat * iv2biv(intvec *hilb, const coeffs cf)
Definition intvec.cc:851
ideal kMin_std2(ideal F, ideal Q, tHomog h, intvec **w, ideal &M, bigintmat *hilb, int syzComp, int reduced)
Definition kstd1.cc:3070
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
#define M
Definition sirandom.c:25

◆ kMin_std2()

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

Definition at line 3070 of file kstd1.cc.

3072{
3073 if(idIs0(F))
3074 {
3075 M=idInit(1,F->rank);
3076 return idInit(1,F->rank);
3077 }
3079 {
3080 ideal sb;
3081 sb = kStd2(F, Q, h, w, hilb);
3082 idSkipZeroes(sb);
3083 if(IDELEMS(sb) <= IDELEMS(F))
3084 {
3085 M = idCopy(sb);
3086 idSkipZeroes(M);
3087 return(sb);
3088 }
3089 else
3090 {
3091 M = idCopy(F);
3092 idSkipZeroes(M);
3093 return(sb);
3094 }
3095 }
3096 ideal r=NULL;
3097 int Kstd1_OldDeg = Kstd1_deg,i;
3098 intvec* temp_w=NULL;
3099 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
3100 BOOLEAN delete_w=(w==NULL);
3101 BOOLEAN oldDegBound=TEST_OPT_DEGBOUND;
3102 kStrategy strat=new skStrategy;
3103
3105 strat->syzComp = syzComp;
3107 strat->LazyPass=20;
3108 else
3109 strat->LazyPass=2;
3110 strat->LazyDegree = 1;
3111 strat->minim=(reduced % 2)+1;
3112 strat->ak = 0;
3113 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
3114 if (delete_w)
3115 {
3116 temp_w=new intvec((strat->ak)+1);
3117 w = &temp_w;
3118 }
3119 if (h==testHomog)
3120 {
3121 if (strat->ak == 0)
3122 {
3123 h = (tHomog)idHomIdeal(F,Q);
3124 w=NULL;
3125 }
3126 else
3127 {
3128 h = (tHomog)idHomModule(F,Q,w);
3129 }
3130 }
3131 if (h==isHomog)
3132 {
3133 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
3134 {
3135 kModW = *w;
3136 strat->kModW = *w;
3137 assume(currRing->pFDeg != NULL && currRing->pLDeg != NULL);
3138 strat->pOrigFDeg = currRing->pFDeg;
3139 strat->pOrigLDeg = currRing->pLDeg;
3141
3142 toReset = TRUE;
3143 if (reduced>1)
3144 {
3145 Kstd1_OldDeg=Kstd1_deg;
3146 Kstd1_deg = -1;
3147 for (i=IDELEMS(F)-1;i>=0;i--)
3148 {
3149 if ((F->m[i]!=NULL) && (currRing->pFDeg(F->m[i],currRing)>=Kstd1_deg))
3150 Kstd1_deg = currRing->pFDeg(F->m[i],currRing)+1;
3151 }
3152 }
3153 }
3154 currRing->pLexOrder = TRUE;
3155 strat->LazyPass*=2;
3156 }
3157 strat->homog=h;
3158 ideal SB=NULL;
3160 {
3161 r=idMinBase(F,&SB); // SB and M via minbase
3162 strat->M=r;
3163 r=SB;
3164 }
3165 else
3166 {
3167 if (w!=NULL)
3168 r=bba(F,Q,*w,hilb,strat);
3169 else
3170 r=bba(F,Q,NULL,hilb,strat);
3171 }
3172#ifdef KDEBUG
3173 {
3174 int i;
3175 for (i=IDELEMS(r)-1; i>=0; i--) pTest(r->m[i]);
3176 }
3177#endif
3178 idSkipZeroes(r);
3179 if (toReset)
3180 {
3182 kModW = NULL;
3183 }
3184 currRing->pLexOrder = b;
3185 if ((delete_w)&&(temp_w!=NULL)) delete temp_w;
3186 if ((IDELEMS(r)==1) && (r->m[0]!=NULL) && pIsConstant(r->m[0]) && (strat->ak==0))
3187 {
3188 M=idInit(1,F->rank);
3189 M->m[0]=pOne();
3190 //if (strat->ak!=0) { pSetComp(M->m[0],strat->ak); pSetmComp(M->m[0]); }
3191 if (strat->M!=NULL) idDelete(&strat->M);
3192 }
3193 else if (strat->M==NULL)
3194 {
3195 M=idInit(1,F->rank);
3196 WarnS("no minimal generating set computed");
3197 }
3198 else
3199 {
3200 idSkipZeroes(strat->M);
3201 M=strat->M;
3202 strat->M=NULL;
3203 }
3204 delete(strat);
3205 if (reduced>2)
3206 {
3207 Kstd1_deg=Kstd1_OldDeg;
3208 if (!oldDegBound)
3210 }
3211 else
3212 {
3213 if (IDELEMS(M)>IDELEMS(r))
3214 {
3215 idDelete(&M);
3216 M=idCopy(r);
3217 }
3218 }
3219 return r;
3220}
CanonicalForm b
Definition cfModGcd.cc:4111
int minim
Definition kutil.h:356
ideal M
Definition kutil.h:304
#define WarnS
Definition emacs.cc:78
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
ideal kStd2(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
generic interface to GB/SB computations, large hilbert vectors
Definition kstd1.cc:2607
ideal bba(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2614
#define TEST_OPT_RETURN_SB
Definition options.h:114
#define OPT_DEGBOUND
Definition options.h:91
#define pTest(p)
Definition polys.h:415
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239
#define pOne()
Definition polys.h:316
@ testHomog
Definition structs.h:34

◆ kModDeg()

long kModDeg ( poly p,
const ring r )

Definition at line 2411 of file kstd1.cc.

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

◆ kMoraUseBucket()

BOOLEAN kMoraUseBucket ( kStrategy strat)
static

Definition at line 3879 of file kstd1.cc.

3880{
3881#ifdef MORA_USE_BUCKETS
3883 return FALSE;
3884 if ((strat->red == redFirst)
3885 ||((strat->red == redEcart)&&(strat->kNoether!=NULL)))
3886 {
3887#ifdef NO_LDEG
3888 if (strat->syzComp==0)
3889 return TRUE;
3890#else
3891 if ((strat->homog || strat->honey) && (strat->syzComp==0))
3892 return TRUE;
3893#endif
3894 }
3895 else
3896 {
3897 assume(strat->red == redEcart || strat->red == redRiloc || strat->red == redRiloc_Z);
3898 if (strat->honey && (strat->syzComp==0))
3899 return TRUE;
3900 }
3901#endif
3902 return FALSE;
3903}

◆ kNF() [1/2]

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

Definition at line 3328 of file kstd1.cc.

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

◆ kNF() [2/2]

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

Definition at line 3230 of file kstd1.cc.

3231{
3232 if (p==NULL)
3233 return NULL;
3234
3235 poly pp = p;
3236
3237#ifdef HAVE_PLURAL
3238 if(rIsSCA(currRing))
3239 {
3240 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3241 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3242 pp = p_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing);
3243
3244 if(Q == currRing->qideal)
3246 }
3247#endif
3248 if(idIs0(Q)) Q=NULL;
3249
3250 if ((idIs0(F))&&(Q==NULL))
3251 {
3252#ifdef HAVE_PLURAL
3253 if(p != pp)
3254 return pp;
3255#endif
3256 return pCopy(p); /*F+Q=0*/
3257 }
3258
3259 kStrategy strat=new skStrategy;
3260 strat->syzComp = syzComp;
3262 poly res;
3263
3265 {
3266#ifdef HAVE_SHIFTBBA
3267 if (currRing->isLPring)
3268 {
3269 WerrorS("No local ordering possible for shift algebra");
3270 return(NULL);
3271 }
3272#endif
3273 res=kNF1(F,Q,pp,strat,lazyReduce);
3274 }
3275 else
3276 res=kNF2(F,Q,pp,strat,lazyReduce);
3277 delete(strat);
3278
3279#ifdef HAVE_PLURAL
3280 if(pp != p)
3281 p_Delete(&pp, currRing);
3282#endif
3283 return res;
3284}
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:903
#define pMaxComp(p)
Definition polys.h:300

◆ kNF1() [1/2]

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

Definition at line 2260 of file kstd1.cc.

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

◆ kNF1() [2/2]

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

Definition at line 2119 of file kstd1.cc.

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

◆ kNFBound() [1/2]

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

Definition at line 3393 of file kstd1.cc.

3394{
3395 ideal res;
3396 if (TEST_OPT_PROT)
3397 {
3398 Print("(S:%d)",IDELEMS(p));mflush();
3399 }
3400 if (idIs0(p))
3401 return idInit(IDELEMS(p),si_max(p->rank,F->rank));
3402
3403 ideal pp = p;
3404#ifdef HAVE_PLURAL
3405 if(rIsSCA(currRing))
3406 {
3407 const unsigned int m_iFirstAltVar = scaFirstAltVar(currRing);
3408 const unsigned int m_iLastAltVar = scaLastAltVar(currRing);
3409 pp = id_KillSquares(pp, m_iFirstAltVar, m_iLastAltVar, currRing, false);
3410
3411 if(Q == currRing->qideal)
3413 }
3414#endif
3415
3416 if ((idIs0(F))&&(Q==NULL))
3417 {
3418#ifdef HAVE_PLURAL
3419 if(p != pp)
3420 return pp;
3421#endif
3422 return idCopy(p); /*F+Q=0*/
3423 }
3424
3425 kStrategy strat=new skStrategy;
3426 strat->syzComp = syzComp;
3428 if (strat->ak>0) // only for module case, see Tst/Short/bug_reduce.tst
3429 {
3430 strat->ak = si_max(strat->ak,(int)F->rank);
3431 }
3432
3433 res=kNF2Bound(F,Q,pp,bound,strat,lazyReduce);
3434 delete(strat);
3435
3436#ifdef HAVE_PLURAL
3437 if(pp != p)
3439#endif
3440
3441 return res;
3442}
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 3286 of file kstd1.cc.

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

◆ kOptimizeLDeg()

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:382
char length_pLength
Definition kutil.h:384

◆ kSba()

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

Definition at line 2669 of file kstd1.cc.

2671{
2672 if(idIs0(F))
2673 return idInit(1,F->rank);
2675 {
2676 ideal r;
2677 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2678 BOOLEAN delete_w=(w==NULL);
2679 kStrategy strat=new skStrategy;
2680 strat->sbaOrder = sbaOrder;
2681 if (arri!=0)
2682 {
2683 strat->rewCrit1 = arriRewDummy;
2684 strat->rewCrit2 = arriRewCriterion;
2686 }
2687 else
2688 {
2692 }
2693
2695 strat->syzComp = syzComp;
2696 if (TEST_OPT_SB_1)
2697 //if(!rField_is_Ring(currRing)) // always true here
2698 strat->newIdeal = newIdeal;
2700 strat->LazyPass=20;
2701 else
2702 strat->LazyPass=2;
2703 strat->LazyDegree = 1;
2707 strat->ak = 0;
2708 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2709 strat->kModW=kModW=NULL;
2710 strat->kHomW=kHomW=NULL;
2711 if (vw != NULL)
2712 {
2713 currRing->pLexOrder=FALSE;
2714 strat->kHomW=kHomW=vw;
2715 strat->pOrigFDeg = currRing->pFDeg;
2716 strat->pOrigLDeg = currRing->pLDeg;
2718 toReset = TRUE;
2719 }
2720 if (h==testHomog)
2721 {
2722 if (strat->ak == 0)
2723 {
2724 h = (tHomog)idHomIdeal(F,Q);
2725 w=NULL;
2726 }
2727 else if (!TEST_OPT_DEGBOUND)
2728 {
2729 if (w!=NULL)
2730 h = (tHomog)idHomModule(F,Q,w);
2731 else
2732 h = (tHomog)idHomIdeal(F,Q);
2733 }
2734 }
2735 currRing->pLexOrder=b;
2736 if (h==isHomog)
2737 {
2738 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2739 {
2740 strat->kModW = kModW = *w;
2741 if (vw == NULL)
2742 {
2743 strat->pOrigFDeg = currRing->pFDeg;
2744 strat->pOrigLDeg = currRing->pLDeg;
2746 toReset = TRUE;
2747 }
2748 }
2749 currRing->pLexOrder = TRUE;
2750 if (hilb==NULL) strat->LazyPass*=2;
2751 }
2752 strat->homog=h;
2753 #ifdef KDEBUG
2754 idTest(F);
2755 if(Q != NULL)
2756 idTest(Q);
2757 #endif
2758 #ifdef HAVE_PLURAL
2760 {
2761 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2762 strat->no_prod_crit = ! bIsSCA;
2763 if (w!=NULL)
2764 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2765 else
2766 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2767 }
2768 else
2769 #endif
2770 {
2772 {
2773 if (w!=NULL)
2774 r=mora(F,Q,*w,hilb,strat);
2775 else
2776 r=mora(F,Q,NULL,hilb,strat);
2777 }
2778 else
2779 {
2780 strat->sigdrop = FALSE;
2781 if (w!=NULL)
2782 r=sba(F,Q,*w,hilb,strat);
2783 else
2784 r=sba(F,Q,NULL,hilb,strat);
2785 }
2786 }
2787 #ifdef KDEBUG
2788 idTest(r);
2789 #endif
2790 if (toReset)
2791 {
2792 kModW = NULL;
2794 }
2795 currRing->pLexOrder = b;
2796 //Print("%d reductions canceled \n",strat->cel);
2797 //delete(strat);
2798 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2799 return r;
2800 }
2801 else
2802 {
2803 //--------------------------RING CASE-------------------------
2804 assume(sbaOrder == 1);
2805 assume(arri == 0);
2806 ideal r;
2807 r = idCopy(F);
2808 int sbaEnterS = -1;
2809 bool sigdrop = TRUE;
2810 //This is how we set the SBA algorithm;
2811 int totalsbaruns = 1,blockedreductions = 20,blockred = 0,loops = 0;
2812 while(sigdrop && (loops < totalsbaruns || totalsbaruns == -1)
2813 && (blockred <= blockedreductions))
2814 {
2815 loops++;
2816 if(loops == 1)
2817 sigdrop = FALSE;
2818 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2819 BOOLEAN delete_w=(w==NULL);
2820 kStrategy strat=new skStrategy;
2821 strat->sbaEnterS = sbaEnterS;
2822 strat->sigdrop = sigdrop;
2823 #if 0
2824 strat->blockred = blockred;
2825 #else
2826 strat->blockred = 0;
2827 #endif
2828 strat->blockredmax = blockedreductions;
2829 //printf("\nsbaEnterS beginning = %i\n",strat->sbaEnterS);
2830 //printf("\nsigdrop beginning = %i\n",strat->sigdrop);
2831 strat->sbaOrder = sbaOrder;
2832 if (arri!=0)
2833 {
2834 strat->rewCrit1 = arriRewDummy;
2835 strat->rewCrit2 = arriRewCriterion;
2837 }
2838 else
2839 {
2843 }
2844
2846 strat->syzComp = syzComp;
2847 if (TEST_OPT_SB_1)
2849 strat->newIdeal = newIdeal;
2851 strat->LazyPass=20;
2852 else
2853 strat->LazyPass=2;
2854 strat->LazyDegree = 1;
2858 strat->ak = 0;
2859 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2860 strat->kModW=kModW=NULL;
2861 strat->kHomW=kHomW=NULL;
2862 if (vw != NULL)
2863 {
2864 currRing->pLexOrder=FALSE;
2865 strat->kHomW=kHomW=vw;
2866 strat->pOrigFDeg = currRing->pFDeg;
2867 strat->pOrigLDeg = currRing->pLDeg;
2869 toReset = TRUE;
2870 }
2871 if (h==testHomog)
2872 {
2873 if (strat->ak == 0)
2874 {
2875 h = (tHomog)idHomIdeal(F,Q);
2876 w=NULL;
2877 }
2878 else if (!TEST_OPT_DEGBOUND)
2879 {
2880 if (w!=NULL)
2881 h = (tHomog)idHomModule(F,Q,w);
2882 else
2883 h = (tHomog)idHomIdeal(F,Q);
2884 }
2885 }
2886 currRing->pLexOrder=b;
2887 if (h==isHomog)
2888 {
2889 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2890 {
2891 strat->kModW = kModW = *w;
2892 if (vw == NULL)
2893 {
2894 strat->pOrigFDeg = currRing->pFDeg;
2895 strat->pOrigLDeg = currRing->pLDeg;
2897 toReset = TRUE;
2898 }
2899 }
2900 currRing->pLexOrder = TRUE;
2901 if (hilb==NULL) strat->LazyPass*=2;
2902 }
2903 strat->homog=h;
2904 #ifdef KDEBUG
2905 idTest(F);
2906 if(Q != NULL)
2907 idTest(Q);
2908 #endif
2909 #ifdef HAVE_PLURAL
2911 {
2912 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2913 strat->no_prod_crit = ! bIsSCA;
2914 if (w!=NULL)
2915 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2916 else
2917 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2918 }
2919 else
2920 #endif
2921 {
2923 {
2924 if (w!=NULL)
2925 r=mora(F,Q,*w,hilb,strat);
2926 else
2927 r=mora(F,Q,NULL,hilb,strat);
2928 }
2929 else
2930 {
2931 if (w!=NULL)
2932 r=sba(r,Q,*w,hilb,strat);
2933 else
2934 {
2935 r=sba(r,Q,NULL,hilb,strat);
2936 }
2937 }
2938 }
2939 #ifdef KDEBUG
2940 idTest(r);
2941 #endif
2942 if (toReset)
2943 {
2944 kModW = NULL;
2946 }
2947 currRing->pLexOrder = b;
2948 //Print("%d reductions canceled \n",strat->cel);
2949 sigdrop = strat->sigdrop;
2950 sbaEnterS = strat->sbaEnterS;
2951 blockred = strat->blockred;
2952 delete(strat);
2953 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2954 }
2955 // Go to std
2956 if(sigdrop || blockred > blockedreductions)
2957 {
2958 r = kStd2(r, Q, h, w, hilb, syzComp, newIdeal, vw);
2959 }
2960 return r;
2961 }
2962}
bool sigdrop
Definition kutil.h:357
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:292
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
int blockred
Definition kutil.h:362
unsigned sbaOrder
Definition kutil.h:315
int blockredmax
Definition kutil.h:363
int newIdeal
Definition kutil.h:355
char z2homog
Definition kutil.h:371
char no_prod_crit
Definition kutil.h:391
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:289
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:293
int sbaEnterS
Definition kutil.h:360
KINLINE BOOLEAN arriRewDummy(poly, unsigned long, poly, kStrategy, int)
Definition kInline.h:1258
static ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const bigintmat *hilb, kStrategy strat, const ring r)
Definition nc.h:27
ideal mora(ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd1.cc:1887
ideal sba(ideal F0, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
Definition kstd2.cc:2971
BOOLEAN arriRewCriterionPre(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
Definition kutil.cc:6646
BOOLEAN arriRewCriterion(poly, unsigned long, poly, kStrategy strat, int start=0)
Definition kutil.cc:6621
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:1939
BOOLEAN faugereRewCriterion(poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
Definition kutil.cc:6562
#define TEST_OPT_SB_1
Definition options.h:121

◆ kStd()

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

generic interface to GB/SB computations

Definition at line 2660 of file kstd1.cc.

2662{
2663 bigintmat *hh=iv2biv(hilb,coeffs_BIGINT);
2664 ideal res=kStd2(F,Q,h,w,hh,syzComp,newIdeal,vw,sp);
2665 if (hh!=NULL) delete hh;
2666 return res;
2667}

◆ kStd2()

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

generic interface to GB/SB computations, large hilbert vectors

rIsLPRing already tested above

Definition at line 2607 of file kstd1.cc.

2609{
2610 if(idIs0(F))
2611 return idInit(1,F->rank);
2612
2613 if(idIs0(Q)) Q=NULL;
2614#ifdef HAVE_SHIFTBBA
2615 if(rIsLPRing(currRing)) return kStdShift(F, Q, h, w, hilb, syzComp, newIdeal, vw, FALSE);
2616#endif
2617
2618 if ((hilb==NULL)
2619 && (vw==NULL)
2620 && (newIdeal==0)
2621 && (sp==NULL)
2622 && (IDELEMS(F)>1)
2623 && (!TEST_OPT_SB_1)
2624 && (currRing->ppNoether==NULL)
2625 && !rIsPluralRing(currRing) /*!rIsLPRing already tested above*/
2626 && (!id_IsModule(F,currRing)))
2627 {
2628 /* test HC precomputation*/
2632 && (!idIsSimpleGB(F,Q)))
2633 {
2634 currRing->ppNoether=kTryHC(F,Q);
2635 ideal res=kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2636 if (currRing->ppNoether!=NULL) pLmDelete(currRing->ppNoether);
2637 currRing->ppNoether=NULL;
2638 return res;
2639 }
2640 /* test hilbstd */
2642 && (!TEST_OPT_RETURN_SB)
2643 && (!TEST_OPT_DEGBOUND)
2644 && (currRing->LexOrder
2646 && (!idIsSimpleGB(F,Q))
2648 {
2649 ideal result=kTryHilbstd(F,Q);
2650 //ideal result=kTryHilbstd_par(F,Q,h,w);
2651 if (result!=NULL)
2652 {
2653 return result;
2654 }
2655 }
2656 }
2657 return kStd_internal(F,Q,h,w,hilb,syzComp,newIdeal,vw,sp);
2658}
return result
ideal kStd_internal(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
pure GB/SB computations
Definition kstd1.cc:2434
ideal kStdShift(ideal F, ideal Q, tHomog h, intvec **w, bigintmat *hilb, int syzComp, int newIdeal, intvec *vw, BOOLEAN rightGB)
Definition kstd1.cc:2965
poly kTryHC(ideal F, ideal Q)
Definition kstdhelper.cc:38
ideal kTryHilbstd(ideal F, ideal Q)
BOOLEAN rHasBlockOrder(const ring r)
Definition ring.cc:1924
BOOLEAN rOrd_is_Ds(const ring r)
Definition ring.cc:2076
BOOLEAN rOrd_is_ds(const ring r)
Definition ring.cc:2066
static BOOLEAN rField_is_Zp(const ring r)
Definition ring.h:506
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
static BOOLEAN rField_is_Q(const ring r)
Definition ring.h:517
BOOLEAN idIsSimpleGB(ideal F, ideal Q)
returns true if F in R/Q has a "simple" GB

◆ kStd_internal()

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

pure GB/SB computations

Definition at line 2434 of file kstd1.cc.

2436{
2437 assume(!idIs0(F));
2438 assume((Q==NULL)||(!idIs0(Q)));
2439
2440 kStrategy strat=new skStrategy;
2441
2442 ideal r;
2443 BOOLEAN b=currRing->pLexOrder,toReset=FALSE;
2444 BOOLEAN delete_w=(w==NULL);
2445
2446 strat->s_poly=sp;
2448 strat->syzComp = syzComp;
2449 if (TEST_OPT_SB_1
2451 )
2452 strat->newIdeal = newIdeal;
2454 strat->LazyPass=20;
2455 else
2456 strat->LazyPass=2;
2457 strat->LazyDegree = 1;
2458 strat->ak = 0;
2459 if (id_IsModule(F,currRing)) strat->ak = id_RankFreeModule(F,currRing);
2460 strat->kModW=kModW=NULL;
2461 strat->kHomW=kHomW=NULL;
2462 if (vw != NULL)
2463 {
2464 currRing->pLexOrder=FALSE;
2465 strat->kHomW=kHomW=vw;
2466 strat->pOrigFDeg = currRing->pFDeg;
2467 strat->pOrigLDeg = currRing->pLDeg;
2469 toReset = TRUE;
2470 }
2471 if (h==testHomog)
2472 {
2473 if (strat->ak == 0)
2474 {
2475 h = (tHomog)idHomIdeal(F,Q);
2476 w=NULL;
2477 }
2478 else if (!TEST_OPT_DEGBOUND)
2479 {
2480 if (w!=NULL)
2481 h = (tHomog)idHomModule(F,Q,w);
2482 else
2483 h = (tHomog)idHomIdeal(F,Q);
2484 }
2485 }
2486 currRing->pLexOrder=b;
2487 if (h==isHomog)
2488 {
2489 if (strat->ak > 0 && (w!=NULL) && (*w!=NULL))
2490 {
2491 strat->kModW = kModW = *w;
2492 if (vw == NULL)
2493 {
2494 strat->pOrigFDeg = currRing->pFDeg;
2495 strat->pOrigLDeg = currRing->pLDeg;
2497 toReset = TRUE;
2498 }
2499 }
2500 currRing->pLexOrder = TRUE;
2501 if (hilb==NULL) strat->LazyPass*=2;
2502 }
2503 strat->homog=h;
2504#ifdef KDEBUG
2505 idTest(F);
2506 if (Q!=NULL) idTest(Q);
2507#endif
2508#ifdef HAVE_PLURAL
2510 {
2511 const BOOLEAN bIsSCA = rIsSCA(currRing) && strat->z2homog; // for Z_2 prod-crit
2512 strat->no_prod_crit = ! bIsSCA;
2513 if (w!=NULL)
2514 r = nc_GB(F, Q, *w, hilb, strat, currRing);
2515 else
2516 r = nc_GB(F, Q, NULL, hilb, strat, currRing);
2517 }
2518 else
2519#endif
2520 {
2521 #if PRE_INTEGER_CHECK
2522 //the preinteger check strategy is not for modules
2523 if(nCoeff_is_Z(currRing->cf) && strat->ak <= 0)
2524 {
2525 ideal FCopy = idCopy(F);
2526 poly pFmon = preIntegerCheck(FCopy, Q);
2527 if(pFmon != NULL)
2528 {
2529 idInsertPoly(FCopy, pFmon);
2530 strat->kModW=kModW=NULL;
2531 if (h==testHomog)
2532 {
2533 h = (tHomog)idHomIdeal(FCopy,Q);
2534 w=NULL;
2535 }
2536 currRing->pLexOrder=b;
2537 if (h==isHomog)
2538 {
2539 if ((w!=NULL) && (*w!=NULL))
2540 {
2541 strat->kModW = kModW = *w;
2542 if (vw == NULL)
2543 {
2544 strat->pOrigFDeg = currRing->pFDeg;
2545 strat->pOrigLDeg = currRing->pLDeg;
2547 toReset = TRUE;
2548 }
2549 }
2550 currRing->pLexOrder = TRUE;
2551 if (hilb==NULL) strat->LazyPass*=2;
2552 }
2553 strat->homog=h;
2554 }
2555 omTestMemory(1);
2556 if(w == NULL)
2557 {
2559 r=mora(FCopy,Q,NULL,hilb,strat);
2560 else
2561 r=bba(FCopy,Q,NULL,hilb,strat);
2562 }
2563 else
2564 {
2566 r=mora(FCopy,Q,*w,hilb,strat);
2567 else
2568 r=bba(FCopy,Q,*w,hilb,strat);
2569 }
2570 idDelete(&FCopy);
2571 }
2572 else
2573 #endif
2574 {
2575 if(w==NULL)
2576 {
2578 r=mora(F,Q,NULL,hilb,strat);
2579 else
2580 r=bba(F,Q,NULL,hilb,strat);
2581 }
2582 else
2583 {
2585 r=mora(F,Q,*w,hilb,strat);
2586 else
2587 r=bba(F,Q,*w,hilb,strat);
2588 }
2589 }
2590 }
2591 if(errorreported) return NULL;
2592#ifdef KDEBUG
2593 idTest(r);
2594#endif
2595 if (toReset)
2596 {
2597 kModW = NULL;
2599 }
2600 currRing->pLexOrder = b;
2601//Print("%d reductions canceled \n",strat->cel);
2602 delete(strat);
2603 if ((delete_w)&&(w!=NULL)&&(*w!=NULL)) delete *w;
2604 return r;
2605}
s_poly_proc_t s_poly
Definition kutil.h:299
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:814
VAR short errorreported
Definition feFopen.cc:23
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
poly preIntegerCheck(const ideal Forig, const ideal Q)
used for GB over ZZ: look for constant and monomial elements in the ideal background: any known const...
Definition kutil.cc:10518
omError_t omTestMemory(int check_level)
Definition omDebug.c:94

◆ kStdShift()

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

Definition at line 2965 of file kstd1.cc.

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

◆ missingAxis()

void missingAxis ( int * last,
kStrategy strat )
static

Definition at line 1279 of file kstd1.cc.

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

◆ mora()

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

Definition at line 1887 of file kstd1.cc.

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

◆ posInL10()

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

Definition at line 1360 of file kstd1.cc.

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

◆ redEcart()

int redEcart ( LObject * h,
kStrategy strat )

Definition at line 168 of file kstd1.cc.

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

◆ redFirst()

int redFirst ( LObject * h,
kStrategy strat )

Definition at line 794 of file kstd1.cc.

795{
796 if (strat->tl<0) return 1;
797 if (h->IsNull()) return 0;
798
799 int at;
800 long reddeg,d;
801 int pass = 0;
802 int cnt = RED_CANONICALIZE;
803 int j = 0;
804
805 reddeg = d = h->GetpFDeg();
806 if (! strat->homog)
807 {
808 d += 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:405
#define RED_CANONICALIZE
Definition kutil.h:37
#define TEST_OPT_OLDSTD
Definition options.h:125
void wrp(poly p)
Definition polys.h:311

◆ redMoraNF()

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;
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:147
#define pNormalize(p)
Definition polys.h:318

◆ redMoraNFRing()

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]) */
1120 mult = n_QuotRem(pGetCoeff(H.p), pGetCoeff(T0p),
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:684
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:747
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:142
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:356

◆ redRiloc()

int redRiloc ( LObject * h,
kStrategy strat )

Definition at line 385 of file kstd1.cc.

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

◆ redRiloc_Z()

int redRiloc_Z ( LObject * h,
kStrategy strat )

Definition at line 566 of file kstd1.cc.

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

◆ reorderL()

void reorderL ( kStrategy strat)
static

Definition at line 1222 of file kstd1.cc.

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

◆ reorderT()

void reorderT ( kStrategy strat)
static

Definition at line 1241 of file kstd1.cc.

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

◆ updateL()

void updateL ( BOOLEAN searchPP,
kStrategy strat )
static

Definition at line 1394 of file kstd1.cc.

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

◆ updateLHC()

void updateLHC ( kStrategy strat)
static

Definition at line 1474 of file kstd1.cc.

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

◆ updateT()

void updateT ( kStrategy strat)
static

Definition at line 1540 of file kstd1.cc.

1541{
1542 int i = 0;
1543 LObject p;
1544
1545 while (i <= strat->tl)
1546 {
1547 p = strat->T[i];
1548 deleteHC(&p,strat, TRUE);
1549 /*- tries to cancel a unit: -*/
1550 cancelunit(&p);
1551 if (TEST_OPT_INTSTRATEGY) /* deleteHC and/or cancelunit may have changed p*/
1552 p.pCleardenom();
1553 if (p.p != strat->T[i].p)
1554 {
1555 strat->sevT[i] = pGetShortExpVector(p.p);
1556 p.SetpFDeg();
1557 }
1558 strat->T[i] = p;
1559 i++;
1560 }
1561}

Variable Documentation

◆ kHomW

VAR intvec * kHomW

Definition at line 2409 of file kstd1.cc.

◆ kModW

VAR intvec* kModW

Definition at line 2409 of file kstd1.cc.

◆ kOptions

VAR BITSET kOptions
Initial value:
#define OPT_SUGARCRIT
Definition options.h:81
#define OPT_PROT
Definition options.h:76
#define OPT_INFREDTAIL
Definition options.h:95
#define OPT_WEIGHTM
Definition options.h:98
#define OPT_NOT_SUGAR
Definition options.h:79
#define OPT_NOTREGULARITY
Definition options.h:97
#define OPT_INTERRUPT
Definition options.h:80
#define OPT_FASTHC
Definition options.h:86
#define OPT_OLDSTD
Definition options.h:87

Definition at line 45 of file kstd1.cc.

◆ validOpts

VAR BITSET validOpts

Definition at line 60 of file kstd1.cc.