Loading...
Searching...
No Matches
kutil.cc File Reference
`#include "kernel/mod2.h"`
`#include "misc/mylimits.h"`
`#include "misc/options.h"`
`#include "polys/nc/nc.h"`
`#include "polys/nc/sca.h"`
`#include "polys/weight.h"`
`#include <stdlib.h>`
`#include <string.h>`
`#include "kernel/GBEngine/kutil.h"`
`#include "polys/kbuckets.h"`
`#include "coeffs/numbers.h"`
`#include "kernel/polys.h"`
`#include "polys/monomials/ring.h"`
`#include "kernel/ideals.h"`
`#include "kernel/combinatorics/stairc.h"`
`#include "kernel/GBEngine/kstd1.h"`
`#include "polys/operations/pShallowCopyDelete.h"`
`#include "polys/shiftop.h"`
`#include "polys/prCopy.h"`
`#include "kernel/GBEngine/ratgring.h"`

Go to the source code of this file.

## Macros

#define | KUTIL_CC
#define | MYTEST 0
#define | ALL_VS_JUST 0
#define | EXT_POLY_NEW 0
#define | KDEBUG 2
#define | ENTER_USE_MEMMOVE
#define | pDivComp_EQUAL 2
#define | pDivComp_LESS 1
#define | pDivComp_GREATER -1
#define | pDivComp_INCOMP 0
#define | kFalseReturn(x)

## Functions

static poly | redMora (poly h, int maxIndex, kStrategy strat)
static poly | redBba (poly h, int maxIndex, kStrategy strat)
static int | pDivCompRing (poly p, poly q)
static int | pDivComp (poly p, poly q)
static int | pLPDivComp (poly p, poly q)
static void | deleteHCBucket (LObject *L, kStrategy strat)
void | deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext)
void | deleteHC (poly *p, int *e, int *l, kStrategy strat)
void | cancelunit (LObject *L, BOOLEAN inNF)
void | HEckeTest (poly pp, kStrategy strat)
static intset | initec (const int maxnr)
static unsigned long * | initsevS (const int maxnr)
static int * | initS_2_R (const int maxnr)
static void | enlargeT (TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
void | cleanT (kStrategy strat)
void | cleanTSbaRing (kStrategy strat)
static void | enlargeL (LSet *L, int *length, const int incr)
void | initPairtest (kStrategy strat)
BOOLEAN | isInPairsetL (int length, poly p1, poly p2, int *k, kStrategy strat)
int | kFindInT (poly p, TSet T, int tlength)
| returns index of p in TSet, or -1 if not found
int | kFindInT (poly p, kStrategy strat)
int | kFindInTShift (poly p, TSet T, int tlength)
int | kFindInTShift (poly p, kStrategy strat)
static const char * | kTest_LmEqual (poly p, poly t_p, ring tailRing)
BOOLEAN | kTest_T (TObject *T, kStrategy strat, int i, char TN)
BOOLEAN | kTest_L (LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
BOOLEAN | kTest (kStrategy strat)
BOOLEAN | kTest_S (kStrategy strat)
BOOLEAN | kTest_TS (kStrategy strat)
void | deleteInS (int i, kStrategy strat)
static BOOLEAN | is_shifted_p1 (const kStrategy strat)
void | deleteInL (LSet set, int *length, int j, kStrategy strat)
void | enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
void | initEcartNormal (TObject *h)
void | initEcartBBA (TObject *h)
void | initEcartPairBba (LObject *Lp, poly, poly, int, int)
void | initEcartPairMora (LObject *Lp, poly, poly, int ecartF, int ecartG)
static BOOLEAN | sugarDivisibleBy (int ecart1, int ecart2)
static void | enterOnePairRing (int i, poly p, int, int isFromQ, kStrategy strat, int atR)
static BOOLEAN | enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
BOOLEAN | sbaCheckGcdPair (LObject *h, kStrategy strat)
static BOOLEAN | enterOneStrongPolySig (int i, poly p, poly sig, int, int, kStrategy strat, int atR)
void | enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
static BOOLEAN | p_HasNotCF_Lift (poly p1, poly p2, const ring r)
| p_HasNotCF for the IDLIFT case and syzComp==1: ignore component
static void | enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
static void | enterOnePairSig (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
static void | enterOnePairSigRing (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void | enterOnePairSpecial (int i, poly p, int ecart, kStrategy strat, int atR=-1)
void | kMergeBintoL (kStrategy strat)
void | kMergeBintoLSba (kStrategy strat)
void | chainCritNormal (poly p, int ecart, kStrategy strat)
void | chainCritOpt_1 (poly, int, kStrategy strat)
void | chainCritSig (poly p, int, kStrategy strat)
void | chainCritPart (poly p, int ecart, kStrategy strat)
void | initenterpairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
void | initenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void | initenterpairsSigRing (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void | chainCritRing (poly p, int, kStrategy strat)
void | initenterstrongPairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
static void | initenterstrongPairsSig (poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
void | enterExtendedSpoly (poly h, kStrategy strat)
void | enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
void | clearSbatch (poly h, int k, int pos, kStrategy strat)
void | superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
void | superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
void | enterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
void | enterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
void | enterpairsSpecial (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
void | reorderS (int *suc, kStrategy strat)
int | posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
int | posInSMonFirst (const kStrategy strat, const int length, const poly p)
int | posInIdealMonFirst (const ideal F, const poly p, int start, int end)
int | posInT0 (const TSet, const int length, LObject &)
int | posInT1 (const TSet set, const int length, LObject &p)
int | posInT2 (const TSet set, const int length, LObject &p)
int | posInT11 (const TSet set, const int length, LObject &p)
int | posInT11Ring (const TSet set, const int length, LObject &p)
int | posInT110 (const TSet set, const int length, LObject &p)
int | posInT110Ring (const TSet set, const int length, LObject &p)
int | posInT13 (const TSet set, const int length, LObject &p)
int | posInT_EcartpLength (const TSet set, const int length, LObject &p)
int | posInT15 (const TSet set, const int length, LObject &p)
int | posInT15Ring (const TSet set, const int length, LObject &p)
int | posInT17 (const TSet set, const int length, LObject &p)
int | posInT17Ring (const TSet set, const int length, LObject &p)
int | posInT17_c (const TSet set, const int length, LObject &p)
int | posInT17_cRing (const TSet set, const int length, LObject &p)
int | posInT19 (const TSet set, const int length, LObject &p)
int | posInLSpecial (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL0 (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL0Ring (const LSet set, const int length, LObject *p, const kStrategy)
int | posInLSig (const LSet set, const int length, LObject *p, const kStrategy)
int | posInLSigRing (const LSet set, const int length, LObject *p, const kStrategy)
int | posInSyz (const kStrategy strat, poly sig)
int | posInL11 (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL11Ring (const LSet set, const int length, LObject *p, const kStrategy)
int | posInLF5CRing (const LSet set, int start, const int length, LObject *p, const kStrategy)
int | posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy)
int | getIndexRng (long coeff)
int | posInL110 (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL110Ring (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL13 (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL15 (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL15Ring (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL17 (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL17Ring (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL17_c (const LSet set, const int length, LObject *p, const kStrategy)
int | posInL17_cRing (const LSet set, const int length, LObject *p, const kStrategy)
BOOLEAN | syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
BOOLEAN | syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
BOOLEAN | faugereRewCriterion (poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
BOOLEAN | arriRewCriterion (poly, unsigned long, poly, kStrategy strat, int start=0)
BOOLEAN | arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
TObject * | kFindDivisibleByInS_T (kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
poly | redtail (LObject *L, int end_pos, kStrategy strat)
poly | redtail (poly p, int end_pos, kStrategy strat)
poly | redtailBba (LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
poly | redtailBbaBound (LObject *L, int end_pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize)
void | redtailBbaAlsoLC_Z (LObject *L, int end_pos, kStrategy strat)
poly | redtailBba_Z (LObject *L, int end_pos, kStrategy strat)
poly | redtailBba_NF (poly p, kStrategy strat)
poly | redtailBba_Ring (LObject *L, int end_pos, kStrategy strat)
void | message (int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
void | messageStat (int hilbcount, kStrategy strat)
void | messageStatSBA (int hilbcount, kStrategy strat)
void | messageSets (kStrategy strat)
void | initS (ideal F, ideal Q, kStrategy strat)
void | initSL (ideal F, ideal Q, kStrategy strat)
void | initSLSba (ideal F, ideal Q, kStrategy strat)
void | initSyzRules (kStrategy strat)
void | initSSpecial (ideal F, ideal Q, ideal P, kStrategy strat)
void | initSSpecialSba (ideal F, ideal Q, ideal P, kStrategy strat)
static poly | redBba1 (poly h, int maxIndex, kStrategy strat)
void | cancelunit1 (LObject *p, int *suc, int index, kStrategy strat)
void | updateS (BOOLEAN toT, kStrategy strat)
void | enterSBba (LObject *p, int atS, kStrategy strat, int atR)
void | enterSBbaShift (LObject *p, int atS, kStrategy strat, int atR)
void | enterSSba (LObject *p, int atS, kStrategy strat, int atR)
void | enterT (LObject *p, kStrategy strat, int atT)
void | enterT_strong (LObject *p, kStrategy strat, int atT)
void | enterSyz (LObject &p, kStrategy strat, int atT)
void | initHilbCrit (ideal, ideal, bigintmat **hilb, kStrategy strat)
void | initBuchMoraCrit (kStrategy strat)
void | initSbaCrit (kStrategy strat)
BOOLEAN | kPosInLDependsOnLength (int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
void | initBuchMoraPos (kStrategy strat)
void | initBuchMoraPosRing (kStrategy strat)
void | initBuchMora (ideal F, ideal Q, kStrategy strat)
void | exitBuchMora (kStrategy strat)
void | initSbaPos (kStrategy strat)
void | initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
void | exitSba (kStrategy strat)
void | updateResult (ideal r, ideal Q, kStrategy strat)
void | completeReduce (kStrategy strat, BOOLEAN withT)
BOOLEAN | newHEdge (kStrategy strat)
BOOLEAN | kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
BOOLEAN | kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
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 constant element of ideal suppresses intermediate coefficient swell
void | postReduceByMon (LObject *h, kStrategy strat)
| used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell
void | postReduceByMonSig (LObject *h, kStrategy strat)
void | finalReduceByMon (kStrategy strat)
| used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output
BOOLEAN | kStratChangeTailRing (kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
void | kStratInitChangeTailRing (kStrategy strat)
ring | sbaRing (kStrategy strat, const ring r, BOOLEAN, int)
int | posInT_EcartFDegpLength (const TSet set, const int length, LObject &p)
int | posInT_FDegpLength (const TSet set, const int length, LObject &p)
int | posInT_pLength (const TSet set, const int length, LObject &p)
char * | showOption ()
void | kDebugPrint (kStrategy strat)
| Output some debug info about a given strategy.
static BOOLEAN | enterOneStrongPolyShift (poly q, poly p, int, int, kStrategy strat, int atR, int, int, int shiftcount, int ifromS)
static void | enterOnePairRingShift (poly q, poly p, int, int isFromQ, kStrategy strat, int atR, int, int qisFromQ, int shiftcount, int ifromS)
static BOOLEAN | enterOneStrongPolyAndEnterOnePairRingShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
static BOOLEAN | enterOnePairWithShifts (int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int, int p_lastVblock, int q_lastVblock)
static BOOLEAN | enterOnePairWithoutShifts (int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int, int p_lastVblock, int q_shift)
BOOLEAN | enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
void | initenterpairsShift (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
void | initenterstrongPairsShift (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
void | enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
void | enterTShift (LObject *p, kStrategy strat, int atT)
poly | redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)

## Variables

VAR denominator_list | DENOMINATOR_LIST =NULL
VAR int | HCord
VAR int | Kstd1_deg
VAR int | Kstd1_mu =INT_MAX
STATIC_VAR BOOLEAN | sloppy_max = FALSE

## Macro Definition Documentation

## ALL_VS_JUST

#define ALL_VS_JUST 0

Definition at line 17 of file kutil.cc.

## ENTER_USE_MEMMOVE

#define ENTER_USE_MEMMOVE

Definition at line 47 of file kutil.cc.

## EXT_POLY_NEW

#define EXT_POLY_NEW 0

Definition at line 21 of file kutil.cc.

## KDEBUG

#define KDEBUG 2

Definition at line 36 of file kutil.cc.

## kFalseReturn

#define kFalseReturn | ( |  | x | ) |

Value:
do { if (!x) return FALSE;} while (0)
FALSE
#define FALSE
Definition auxiliary.h:97
x
Variable x
Definition cfModGcd.cc:4090

Definition at line 765 of file kutil.cc.

## KUTIL_CC

#define KUTIL_CC

Definition at line 10 of file kutil.cc.

## MYTEST

#define MYTEST 0

Definition at line 12 of file kutil.cc.

## pDivComp_EQUAL

#define pDivComp_EQUAL 2

Definition at line 129 of file kutil.cc.

## pDivComp_GREATER

#define pDivComp_GREATER -1

Definition at line 131 of file kutil.cc.

## pDivComp_INCOMP

#define pDivComp_INCOMP 0

Definition at line 132 of file kutil.cc.

## pDivComp_LESS

#define pDivComp_LESS 1

Definition at line 130 of file kutil.cc.

## Function Documentation

## arriRewCriterion()

BOOLEAN arriRewCriterion | ( | poly | sig,
|  | unsigned long | not_sevSig,
|  | poly | lm,
|  | kStrategy | strat,
|  | int | start = 0 )

Definition at line 6621 of file kutil.cc.

{
if(rField_is_Ring(currRing))
return FALSE;
poly p1 = pOne();
poly p2 = pOne();
for (int ii=strat->sl; ii>start; ii--)
{
if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
{
p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
if (!(pLmCmp(p1,p2) == 1))
{
pDelete(&p1);
pDelete(&p2);
return TRUE;
}
}
}
pDelete(&p1);
pDelete(&p2);
return FALSE;
}
TRUE
#define TRUE
Definition auxiliary.h:101
skStrategy::S
polyset S
Definition kutil.h:305
skStrategy::sevSig
unsigned long * sevSig
Definition kutil.h:323
skStrategy::sig
polyset sig
Definition kutil.h:307
skStrategy::P
LObject P
Definition kutil.h:301
skStrategy::sl
int sl
Definition kutil.h:347
p_ExpVectorSum
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition p_polys.h:1446
p_LmShortDivisibleBy
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
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
pDelete
#define pDelete(p_ptr)
Definition polys.h:187
pLmCmp
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition polys.h:106
pOne
#define pOne()
Definition polys.h:316
rField_is_Ring
#define rField_is_Ring(R)
Definition ring.h:491

## arriRewCriterionPre()

BOOLEAN arriRewCriterionPre | ( | poly | sig,
|  | unsigned long | not_sevSig,
|  | poly | lm,
|  | kStrategy | strat,
|  | int | start )

Definition at line 6646 of file kutil.cc.

{
//Over Rings, there are still some changes to do: considering coeffs
if(rField_is_Ring(currRing))
return FALSE;
int found = -1;
for (int i=strat->Bl; i>-1; i--)
{
if (pLmEqual(strat->B[i].sig,sig))
{
found = i;
break;
}
}
if (found != -1)
{
if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
{
deleteInL(strat->B,&strat->Bl,found,strat);
}
else
{
return TRUE;
}
}
poly p1 = pOne();
poly p2 = pOne();
for (int ii=strat->sl; ii>-1; ii--)
{
if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
{
p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
if (!(pLmCmp(p1,p2) == 1))
{
pDelete(&p1);
pDelete(&p2);
return TRUE;
}
}
}
pDelete(&p1);
pDelete(&p2);
return FALSE;
}
i
int i
Definition cfEzgcd.cc:132
skStrategy::Bl
int Bl
Definition kutil.h:351
skStrategy::B
LSet B
Definition kutil.h:327
found
bool found
Definition facFactorize.cc:55
deleteInL
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition kutil.cc:1208
pLmEqual
#define pLmEqual(p1, p2)
Definition polys.h:112

## cancelunit()

void cancelunit | ( | LObject * | L,
|  | BOOLEAN | inNF )

Definition at line 365 of file kutil.cc.

{
if(rHasGlobalOrdering (currRing)) return;
if(TEST_OPT_CANCELUNIT) return;
ring r = L->tailRing;
poly p = L->GetLmTailRing();
if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
number lc=NULL; /*dummy, is always set if rField_is_Ring(r) */
if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
lc = pGetCoeff(p);
// Leading coef have to be a unit
// example 2x+4x2 should be simplified to 2x*(1+2x)
// and 2 is not a unit in Z
//if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
poly h = pNext(p);
int i;
if(rField_is_Ring(currRing))
{
loop
{
if (h==NULL)
{
p_Delete(&pNext(p), r);
if (!inNF)
{
number eins= nCopy(lc);
if (L->p != NULL)
{
pSetCoeff(L->p,eins);
if (L->t_p != NULL)
pSetCoeff0(L->t_p,eins);
}
else
pSetCoeff(L->t_p,eins);
/* p and t_p share the same coeff, if both are !=NULL */
/* p==NULL==t_p cannot happen here */
}
L->ecart = 0;
L->length = 1;
//if (L->pLength > 0)
L->pLength = 1;
L->max_exp = NULL;
if (L->t_p != NULL && pNext(L->t_p) != NULL)
p_Delete(&pNext(L->t_p),r);
if (L->p != NULL && pNext(L->p) != NULL)
pNext(L->p) = NULL;
return;
}
i = rVar(r);
loop
{
if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
i--;
if (i == 0) break; // does divide, try next monom
}
//wrp(p); PrintS(" divide ");wrp(h); PrintLn();
// Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
// domains), no zerodivisor test needed CAUTION
if (!n_DivBy(pGetCoeff(h),lc,r->cf))
{
return;
}
pIter(h);
}
}
else
{
loop
{
if (h==NULL)
{
p_Delete(&pNext(p), r);
if (!inNF)
{
number eins=nInit(1);
if (L->p != NULL)
{
pSetCoeff(L->p,eins);
if (L->t_p != NULL)
pSetCoeff0(L->t_p,eins);
}
else
pSetCoeff(L->t_p,eins);
/* p and t_p share the same coeff, if both are !=NULL */
/* p==NULL==t_p cannot happen here */
}
L->ecart = 0;
L->length = 1;
//if (L->pLength > 0)
L->pLength = 1;
L->max_exp = NULL;
if (L->t_p != NULL && pNext(L->t_p) != NULL)
p_Delete(&pNext(L->t_p),r);
if (L->p != NULL && pNext(L->p) != NULL)
pNext(L->p) = NULL;
return;
}
i = rVar(r);
loop
{
if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
i--;
if (i == 0) break; // does divide, try next monom
}
//wrp(p); PrintS(" divide ");wrp(h); PrintLn();
pIter(h);
}
}
}
lc
CanonicalForm lc(const CanonicalForm &f)
Definition canonicalform.h:304
p
int p
Definition cfModGcd.cc:4086
n_DivBy
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:750
h
STATIC_VAR Poly * h
Definition janet.cc:971
p_GetComp
#define p_GetComp(p, r)
Definition monomials.h:64
pIter
#define pIter(p)
Definition monomials.h:37
pNext
#define pNext(p)
Definition monomials.h:36
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
pGetCoeff
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
nCopy
#define nCopy(n)
Definition numbers.h:15
nInit
#define nInit(i)
Definition numbers.h:24
NULL
#define NULL
Definition omList.c:12
TEST_OPT_CANCELUNIT
#define TEST_OPT_CANCELUNIT
Definition options.h:130
p_OneComp
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition p_polys.cc:1209
p_GetExp
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
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
pSetCoeff
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition polys.h:32
rHasGlobalOrdering
static BOOLEAN rHasGlobalOrdering(const ring r)
Definition ring.h:768
rVar
static short rVar(const ring r)
define rVar(r) (r->N)
Definition ring.h:598
loop
#define loop
Definition structs.h:71

## cancelunit1()

void cancelunit1 | ( | LObject * | p,
|  | int * | suc,
|  | int | index,
|  | kStrategy | strat )

Definition at line 8402 of file kutil.cc.

{
int k;
poly r,h,h1,q;
if (!pIsVector((*p).p) && ((*p).ecart != 0))
{
// Leading coef have to be a unit: no
// example 2x+4x2 should be simplified to 2x*(1+2x)
// and 2 is not a unit in Z
//if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
k = 0;
h1 = r = pCopy((*p).p);
h =pNext(r);
loop
{
if (h==NULL)
{
pDelete(&r);
pDelete(&(pNext((*p).p)));
(*p).ecart = 0;
(*p).length = 1;
(*p).pLength = 1;
(*suc)=0;
return;
}
if (!pDivisibleBy(r,h))
{
q=redBba1(h,index ,strat);
if (q != h)
{
k++;
pDelete(&h);
pNext(h1) = h = q;
}
else
{
pDelete(&r);
return;
}
}
else
{
h1 = h;
pIter(h);
}
if (k > 10)
{
pDelete(&r);
return;
}
}
}
}
k
int k
Definition cfEzgcd.cc:99
redBba1
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition kutil.cc:8385
index
static int index(p_Length length, p_Ord ord)
Definition p_Procs_Impl.h:592
pIsVector
#define pIsVector(p)
Definition polys.h:251
pDivisibleBy
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition polys.h:139
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186

## chainCritNormal()

void chainCritNormal | ( | poly | p,
|  | int | ecart,
|  | kStrategy | strat )

Definition at line 3204 of file kutil.cc.

{
int i,j,l;
/*
*pairtest[i] is TRUE if spoly(S[i],p) == 0.
*In this case all elements in B such
*that their lcm is divisible by the leading term of S[i] can be canceled
*/
if (strat->pairtest!=NULL)
{
#ifdef HAVE_SHIFTBBA
// only difference is pLPDivisibleBy instead of pDivisibleBy
if (rIsLPRing(currRing))
{
for (j=0; j<=strat->sl; j++)
{
if (strat->pairtest[j])
{
for (i=strat->Bl; i>=0; i--)
{
if (pLPDivisibleBy(strat->S[j],strat->B[i].lcm))
{
deleteInL(strat->B,&strat->Bl,i,strat);
strat->c3++;
}
}
}
}
}
else
#endif
{
/*- i.e. there is an i with pairtest[i]==TRUE -*/
for (j=0; j<=strat->sl; j++)
{
if (strat->pairtest[j])
{
for (i=strat->Bl; i>=0; i--)
{
if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
{
deleteInL(strat->B,&strat->Bl,i,strat);
strat->c3++;
}
}
}
}
}
omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
strat->pairtest=NULL;
}
if (strat->Gebauer || strat->fromT)
{
if (strat->sugarCrit)
{
/*
*suppose L[j] == (s,r) and p/lcm(s,r)
*and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
*and in case the sugar is o.k. then L[j] can be canceled
*/
for (j=strat->Ll; j>=0; j--)
{
if (sugarDivisibleBy(ecart,strat->L[j].ecart)
&& ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
&& pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
{
if (strat->L[j].p == strat->tail)
{
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
}
}
}
/*
*this is GEBAUER-MOELLER:
*in B all elements with the same lcm except the "best"
*(i.e. the last one in B with this property) will be canceled
*/
j = strat->Bl;
loop /*cannot be changed into a for !!! */
{
if (j <= 0) break;
i = j-1;
loop
{
if (i < 0) break;
if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
{
strat->c3++;
if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
{
deleteInL(strat->B,&strat->Bl,i,strat);
j--;
}
else
{
deleteInL(strat->B,&strat->Bl,j,strat);
break;
}
}
i--;
}
j--;
}
}
else /*sugarCrit*/
{
/*
*suppose L[j] == (s,r) and p/lcm(s,r)
*and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
*and in case the sugar is o.k. then L[j] can be canceled
*/
for (j=strat->Ll; j>=0; j--)
{
if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
{
if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
{
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
}
}
}
/*
*this is GEBAUER-MOELLER:
*in B all elements with the same lcm except the "best"
*(i.e. the last one in B with this property) will be canceled
*/
j = strat->Bl;
loop /*cannot be changed into a for !!! */
{
if (j <= 0) break;
for(i=j-1; i>=0; i--)
{
if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
{
strat->c3++;
deleteInL(strat->B,&strat->Bl,i,strat);
j--;
}
}
j--;
}
}
/*
*the elements of B enter L
*/
kMergeBintoL(strat);
}
else
{
for (j=strat->Ll; j>=0; j--)
{
#ifdef HAVE_SHIFTBBA
if ((strat->L[j].p1!=NULL) &&
pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
#else
if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
#endif
{
if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
{
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
}
}
}
/*
*this is our MODIFICATION of GEBAUER-MOELLER:
*First the elements of B enter L,
*then we fix a lcm and the "best" element in L
*(i.e the last in L with this lcm and of type (s,p))
*and cancel all the other elements of type (r,p) with this lcm
*except the case the element (s,r) has also the same lcm
*and is on the worst position with respect to (s,p) and (r,p)
*/
/*
*B enters to L/their order with respect to B is permutated for elements
*B[i].p with the same leading term
*/
kMergeBintoL(strat);
j = strat->Ll;
loop /*cannot be changed into a for !!! */
{
if (j <= 0)
{
/*now L[0] cannot be canceled any more and the tail can be removed*/
if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
break;
}
if (strat->L[j].p2 == p)
{
i = j-1;
loop
{
if (i < 0) break;
if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
{
/*L[i] could be canceled but we search for a better one to cancel*/
strat->c3++;
if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
&& (pNext(strat->L[l].p) == strat->tail)
&& (!pLmEqual(strat->L[i].p,strat->L[l].p))
&& pDivisibleBy(p,strat->L[l].lcm))
{
/*
*"NOT equal(...)" because in case of "equal" the element L[l]
*is "older" and has to be from theoretical point of view behind
*L[i], but we do not want to reorder L
*/
strat->L[i].p2 = strat->tail;
/*
*L[l] will be canceled, we cannot cancel L[i] later on,
*so we mark it with "tail"
*/
deleteInL(strat->L,&strat->Ll,l,strat);
i--;
}
else
{
deleteInL(strat->L,&strat->Ll,i,strat);
}
j--;
}
i--;
}
}
else if (strat->L[j].p2 == strat->tail)
{
/*now L[j] cannot be canceled any more and the tail can be removed*/
strat->L[j].p2 = p;
}
j--;
}
}
}
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
l
int l
Definition cfEzgcd.cc:100
skStrategy::Ll
int Ll
Definition kutil.h:350
skStrategy::pairtest
BOOLEAN * pairtest
Definition kutil.h:332
skStrategy::tail
poly tail
Definition kutil.h:333
skStrategy::sugarCrit
char sugarCrit
Definition kutil.h:374
skStrategy::Gebauer
char Gebauer
Definition kutil.h:375
skStrategy::fromT
char fromT
Definition kutil.h:376
skStrategy::L
LSet L
Definition kutil.h:326
skStrategy::c3
int c3
Definition kutil.h:346
j
int j
Definition facHensel.cc:110
pCompareChain
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition kpolys.cc:17
kMergeBintoL
void kMergeBintoL(kStrategy strat)
Definition kutil.cc:3161
sugarDivisibleBy
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition kutil.cc:1326
isInPairsetL
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition kutil.cc:687
omFreeSize
#define omFreeSize(addr, size)
Definition omAllocDecl.h:260
rIsLPRing
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417
pLPDivisibleBy
#define pLPDivisibleBy(a, b)
Definition shiftop.h:57

## chainCritOpt_1()

void chainCritOpt_1 | ( | poly | ,
|  | int | ,
|  | kStrategy | strat )

Definition at line 3445 of file kutil.cc.

{
if (strat->pairtest!=NULL)
{
omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
strat->pairtest=NULL;
}
/*
*the elements of B enter L
*/
kMergeBintoL(strat);
}

## chainCritPart()

void chainCritPart | ( | poly | p,
|  | int | ecart,
|  | kStrategy | strat )

Definition at line 3520 of file kutil.cc.

{
int i,j,l;
/*
*pairtest[i] is TRUE if spoly(S[i],p) == 0.
*In this case all elements in B such
*that their lcm is divisible by the leading term of S[i] can be canceled
*/
if (strat->pairtest!=NULL)
{
/*- i.e. there is an i with pairtest[i]==TRUE -*/
for (j=0; j<=strat->sl; j++)
{
if (strat->pairtest[j])
{
for (i=strat->Bl; i>=0; i--)
{
if (_p_LmDivisibleByPart(strat->S[j],currRing,
strat->B[i].lcm,currRing,
currRing->real_var_start,currRing->real_var_end))
{
if(TEST_OPT_DEBUG)
{
Print("chain-crit-part: S[%d]=",j);
p_wrp(strat->S[j],currRing);
Print(" divide B[%d].lcm=",i);
p_wrp(strat->B[i].lcm,currRing);
PrintLn();
}
deleteInL(strat->B,&strat->Bl,i,strat);
strat->c3++;
}
}
}
}
omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
strat->pairtest=NULL;
}
if (strat->Gebauer || strat->fromT)
{
if (strat->sugarCrit)
{
/*
*suppose L[j] == (s,r) and p/lcm(s,r)
*and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
*and in case the sugar is o.k. then L[j] can be canceled
*/
for (j=strat->Ll; j>=0; j--)
{
if (sugarDivisibleBy(ecart,strat->L[j].ecart)
&& ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
&& pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
{
if (strat->L[j].p == strat->tail)
{
if(TEST_OPT_DEBUG)
{
PrintS("chain-crit-part: pCompareChainPart p=");
p_wrp(p,currRing);
Print(" delete L[%d]",j);
p_wrp(strat->L[j].lcm,currRing);
PrintLn();
}
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
}
}
}
/*
*this is GEBAUER-MOELLER:
*in B all elements with the same lcm except the "best"
*(i.e. the last one in B with this property) will be canceled
*/
j = strat->Bl;
loop /*cannot be changed into a for !!! */
{
if (j <= 0) break;
i = j-1;
loop
{
if (i < 0) break;
if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
{
strat->c3++;
if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
{
if(TEST_OPT_DEBUG)
{
Print("chain-crit-part: sugar B[%d].lcm=",j);
p_wrp(strat->B[j].lcm,currRing);
Print(" delete B[%d]",i);
p_wrp(strat->B[i].lcm,currRing);
PrintLn();
}
deleteInL(strat->B,&strat->Bl,i,strat);
j--;
}
else
{
if(TEST_OPT_DEBUG)
{
Print("chain-crit-part: sugar B[%d].lcm=",i);
p_wrp(strat->B[i].lcm,currRing);
Print(" delete B[%d]",j);
p_wrp(strat->B[j].lcm,currRing);
PrintLn();
}
deleteInL(strat->B,&strat->Bl,j,strat);
break;
}
}
i--;
}
j--;
}
}
else /*sugarCrit*/
{
/*
*suppose L[j] == (s,r) and p/lcm(s,r)
*and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
*and in case the sugar is o.k. then L[j] can be canceled
*/
for (j=strat->Ll; j>=0; j--)
{
if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
{
if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
{
if(TEST_OPT_DEBUG)
{
PrintS("chain-crit-part: sugar:pCompareChainPart p=");
p_wrp(p,currRing);
Print(" delete L[%d]",j);
p_wrp(strat->L[j].lcm,currRing);
PrintLn();
}
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
}
}
}
/*
*this is GEBAUER-MOELLER:
*in B all elements with the same lcm except the "best"
*(i.e. the last one in B with this property) will be canceled
*/
j = strat->Bl;
loop /*cannot be changed into a for !!! */
{
if (j <= 0) break;
for(i=j-1; i>=0; i--)
{
if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
{
if(TEST_OPT_DEBUG)
{
Print("chain-crit-part: equal lcm B[%d].lcm=",j);
p_wrp(strat->B[j].lcm,currRing);
Print(" delete B[%d]\n",i);
}
strat->c3++;
deleteInL(strat->B,&strat->Bl,i,strat);
j--;
}
}
j--;
}
}
/*
*the elements of B enter L
*/
kMergeBintoL(strat);
}
else
{
for (j=strat->Ll; j>=0; j--)
{
if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
{
if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
{
if(TEST_OPT_DEBUG)
{
PrintS("chain-crit-part: pCompareChainPart p=");
p_wrp(p,currRing);
Print(" delete L[%d]",j);
p_wrp(strat->L[j].lcm,currRing);
PrintLn();
}
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
}
}
}
/*
*this is our MODIFICATION of GEBAUER-MOELLER:
*First the elements of B enter L,
*then we fix a lcm and the "best" element in L
*(i.e the last in L with this lcm and of type (s,p))
*and cancel all the other elements of type (r,p) with this lcm
*except the case the element (s,r) has also the same lcm
*and is on the worst position with respect to (s,p) and (r,p)
*/
/*
*B enters to L/their order with respect to B is permutated for elements
*B[i].p with the same leading term
*/
kMergeBintoL(strat);
j = strat->Ll;
loop /*cannot be changed into a for !!! */
{
if (j <= 0)
{
/*now L[0] cannot be canceled any more and the tail can be removed*/
if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
break;
}
if (strat->L[j].p2 == p)
{
i = j-1;
loop
{
if (i < 0) break;
if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
{
/*L[i] could be canceled but we search for a better one to cancel*/
strat->c3++;
if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
&& (pNext(strat->L[l].p) == strat->tail)
&& (!pLmEqual(strat->L[i].p,strat->L[l].p))
&& _p_LmDivisibleByPart(p,currRing,
strat->L[l].lcm,currRing,
currRing->real_var_start, currRing->real_var_end))
{
/*
*"NOT equal(...)" because in case of "equal" the element L[l]
*is "older" and has to be from theoretical point of view behind
*L[i], but we do not want to reorder L
*/
strat->L[i].p2 = strat->tail;
/*
*L[l] will be canceled, we cannot cancel L[i] later on,
*so we mark it with "tail"
*/
if(TEST_OPT_DEBUG)
{
PrintS("chain-crit-part: divisible_by p=");
p_wrp(p,currRing);
Print(" delete L[%d]",l);
p_wrp(strat->L[l].lcm,currRing);
PrintLn();
}
deleteInL(strat->L,&strat->Ll,l,strat);
i--;
}
else
{
if(TEST_OPT_DEBUG)
{
PrintS("chain-crit-part: divisible_by(2) p=");
p_wrp(p,currRing);
Print(" delete L[%d]",i);
p_wrp(strat->L[i].lcm,currRing);
PrintLn();
}
deleteInL(strat->L,&strat->Ll,i,strat);
}
j--;
}
i--;
}
}
else if (strat->L[j].p2 == strat->tail)
{
/*now L[j] cannot be canceled any more and the tail can be removed*/
strat->L[j].p2 = p;
}
j--;
}
}
}
Print
#define Print
Definition emacs.cc:80
pCompareChainPart
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)
Definition kpolys.cc:71
TEST_OPT_DEBUG
#define TEST_OPT_DEBUG
Definition options.h:110
_p_LmDivisibleByPart
static BOOLEAN _p_LmDivisibleByPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition p_polys.h:1877
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314

## chainCritRing()

void chainCritRing | ( | poly | p,
|  | int | ,
|  | kStrategy | strat )

Definition at line 3996 of file kutil.cc.

{
int i,j,l;
/*
*pairtest[i] is TRUE if spoly(S[i],p) == 0.
*In this case all elements in B such
*that their lcm is divisible by the leading term of S[i] can be canceled
*/
if (strat->pairtest!=NULL)
{
{
/*- i.e. there is an i with pairtest[i]==TRUE -*/
for (j=0; j<=strat->sl; j++)
{
if (strat->pairtest[j])
{
for (i=strat->Bl; i>=0; i--)
{
if (pDivisibleBy(strat->S[j],strat->B[i].lcm) && n_DivBy(pGetCoeff(strat->B[i].lcm), pGetCoeff(strat->S[j]),currRing->cf))
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("--- chain criterion func chainCritRing type 1\n");
PrintS("strat->S[j]:");
wrp(strat->S[j]);
PrintS(" strat->B[i].lcm:");
wrp(strat->B[i].lcm);PrintLn();
pWrite(strat->B[i].p);
pWrite(strat->B[i].p1);
pWrite(strat->B[i].p2);
wrp(strat->B[i].lcm);
PrintLn();
}
#endif
deleteInL(strat->B,&strat->Bl,i,strat);
strat->c3++;
}
}
}
}
}
omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
strat->pairtest=NULL;
}
assume(!(strat->Gebauer || strat->fromT));
for (j=strat->Ll; j>=0; j--)
{
if ((strat->L[j].lcm != NULL) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(p), currRing->cf))
{
if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
{
if ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
{
deleteInL(strat->L,&strat->Ll,j,strat);
strat->c3++;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("--- chain criterion func chainCritRing type 2\n");
PrintS("strat->L[j].p:");
wrp(strat->L[j].p);
PrintS(" p:");
wrp(p);
PrintLn();
}
#endif
}
}
}
}
/*
*this is our MODIFICATION of GEBAUER-MOELLER:
*First the elements of B enter L,
*then we fix a lcm and the "best" element in L
*(i.e the last in L with this lcm and of type (s,p))
*and cancel all the other elements of type (r,p) with this lcm
*except the case the element (s,r) has also the same lcm
*and is on the worst position with respect to (s,p) and (r,p)
*/
/*
*B enters to L/their order with respect to B is permutated for elements
*B[i].p with the same leading term
*/
kMergeBintoL(strat);
j = strat->Ll;
loop /*cannot be changed into a for !!! */
{
if (j <= 0)
{
/*now L[0] cannot be canceled any more and the tail can be removed*/
if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
break;
}
if (strat->L[j].p2 == p) // Was the element added from B?
{
i = j-1;
loop
{
if (i < 0) break;
// Element is from B and has the same lcm as L[j]
if ((strat->L[i].p2 == p) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(strat->L[i].lcm), currRing->cf)
&& pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
{
/*L[i] could be canceled but we search for a better one to cancel*/
strat->c3++;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("--- chain criterion func chainCritRing type 3\n");
PrintS("strat->L[j].lcm:");
wrp(strat->L[j].lcm);
PrintS(" strat->L[i].lcm:");
wrp(strat->L[i].lcm);
PrintLn();
}
#endif
if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
&& (pNext(strat->L[l].p) == strat->tail)
&& (!pLmEqual(strat->L[i].p,strat->L[l].p))
&& pDivisibleBy(p,strat->L[l].lcm))
{
/*
*"NOT equal(...)" because in case of "equal" the element L[l]
*is "older" and has to be from theoretical point of view behind
*L[i], but we do not want to reorder L
*/
strat->L[i].p2 = strat->tail;
/*
*L[l] will be canceled, we cannot cancel L[i] later on,
*so we mark it with "tail"
*/
deleteInL(strat->L,&strat->Ll,l,strat);
i--;
}
else
{
deleteInL(strat->L,&strat->Ll,i,strat);
}
j--;
}
i--;
}
}
else if (strat->L[j].p2 == strat->tail)
{
/*now L[j] cannot be canceled any more and the tail can be removed*/
strat->L[j].p2 = p;
}
j--;
}
}
assume
#define assume(x)
Definition mod2.h:389
wrp
void wrp(poly p)
Definition polys.h:311
pWrite
void pWrite(poly p)
Definition polys.h:309

## chainCritSig()

void chainCritSig | ( | poly | p,
|  | int | ecart,
|  | kStrategy | strat )

Definition at line 3461 of file kutil.cc.

{
int i,j,l;
kMergeBintoLSba(strat);
j = strat->Ll;
loop /*cannot be changed into a for !!! */
{
if (j <= 0)
{
/*now L[0] cannot be canceled any more and the tail can be removed*/
if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
break;
}
if (strat->L[j].p2 == p)
{
i = j-1;
loop
{
if (i < 0) break;
if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
{
/*L[i] could be canceled but we search for a better one to cancel*/
strat->c3++;
if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
&& (pNext(strat->L[l].p) == strat->tail)
&& (!pLmEqual(strat->L[i].p,strat->L[l].p))
&& pDivisibleBy(p,strat->L[l].lcm))
{
/*
*"NOT equal(...)" because in case of "equal" the element L[l]
*is "older" and has to be from theoretical point of view behind
*L[i], but we do not want to reorder L
*/
strat->L[i].p2 = strat->tail;
/*
*L[l] will be canceled, we cannot cancel L[i] later on,
*so we mark it with "tail"
*/
deleteInL(strat->L,&strat->Ll,l,strat);
i--;
}
else
{
deleteInL(strat->L,&strat->Ll,i,strat);
}
j--;
}
i--;
}
}
else if (strat->L[j].p2 == strat->tail)
{
/*now L[j] cannot be canceled any more and the tail can be removed*/
strat->L[j].p2 = p;
}
j--;
}
}
kMergeBintoLSba
void kMergeBintoLSba(kStrategy strat)
Definition kutil.cc:3182

## cleanT()

void cleanT | ( | kStrategy | strat | ) |

Definition at line 557 of file kutil.cc.

{
int i,j;
poly p;
assume(currRing == strat->tailRing || strat->tailRing != NULL);
pShallowCopyDeleteProc p_shallow_copy_delete =
(strat->tailRing != currRing ?
pGetShallowCopyDeleteProc(strat->tailRing, currRing) :
NULL);
for (j=0; j<=strat->tl; j++)
{
p = strat->T[j].p;
strat->T[j].p=NULL;
if (strat->T[j].max_exp != NULL)
{
p_LmFree(strat->T[j].max_exp, strat->tailRing);
}
i = -1;
loop
{
i++;
if (i>strat->sl)
{
if (strat->T[j].t_p != NULL)
{
p_Delete(&(strat->T[j].t_p), strat->tailRing);
p_LmFree(p, currRing);
}
else
{
#ifdef HAVE_SHIFTBBA
if (currRing->isLPring && strat->T[j].shift > 0)
{
pNext(p) = NULL; // pNext(p) points to the unshifted tail, don't try to delete it here
}
#endif
pDelete(&p);
}
break;
}
if (p == strat->S[i])
{
if (strat->T[j].t_p != NULL)
{
if (p_shallow_copy_delete!=NULL)
{
pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
currRing->PolyBin);
}
p_LmFree(strat->T[j].t_p, strat->tailRing);
}
break;
}
}
}
strat->tl=-1;
}
skStrategy::tailRing
ring tailRing
Definition kutil.h:342
skStrategy::T
TSet T
Definition kutil.h:325
skStrategy::tl
int tl
Definition kutil.h:349
pGetShallowCopyDeleteProc
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
Definition pShallowCopyDelete.cc:50
p_LmFree
static void p_LmFree(poly p, ring)
Definition p_polys.h:685
pShallowCopyDeleteProc
poly(* pShallowCopyDeleteProc)(poly s_p, ring source_r, ring dest_r, omBin dest_bin)
returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == de...
Definition ring.h:45

## cleanTSbaRing()

void cleanTSbaRing | ( | kStrategy | strat | ) |

Definition at line 616 of file kutil.cc.

{
int i,j;
poly p;
assume(currRing == strat->tailRing || strat->tailRing != NULL);
pShallowCopyDeleteProc p_shallow_copy_delete =
(strat->tailRing != currRing ?
pGetShallowCopyDeleteProc(strat->tailRing, currRing) :
NULL);
for (j=0; j<=strat->tl; j++)
{
p = strat->T[j].p;
strat->T[j].p=NULL;
if (strat->T[j].max_exp != NULL)
{
p_LmFree(strat->T[j].max_exp, strat->tailRing);
}
i = -1;
loop
{
i++;
if (i>strat->sl)
{
if (strat->T[j].t_p != NULL)
{
p_Delete(&(strat->T[j].t_p), strat->tailRing);
p_LmFree(p, currRing);
}
else
{
//pDelete(&p);
p = NULL;
}
break;
}
if (p == strat->S[i])
{
if (strat->T[j].t_p != NULL)
{
assume(p_shallow_copy_delete != NULL);
pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
currRing->PolyBin);
p_LmFree(strat->T[j].t_p, strat->tailRing);
}
break;
}
}
}
strat->tl=-1;
}

## clearSbatch()

void clearSbatch | ( | poly | h,
|  | int | k,
|  | int | pos,
|  | kStrategy | strat )

Definition at line 4433 of file kutil.cc.

{
int j = pos;
if ( (!strat->fromT)
&& ((strat->syzComp==0)
||(pGetComp(h)<=strat->syzComp)
))
{
// Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
unsigned long h_sev = pGetShortExpVector(h);
loop
{
if (j > k) break;
clearS(h,h_sev, &j,&k,strat);
j++;
}
// Print("end clearS sl=%d\n",strat->sl);
}
}
skStrategy::syzComp
int syzComp
Definition kutil.h:353
clearS
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition kInline.h:1235
pGetComp
#define pGetComp(p)
Component.
Definition polys.h:38
pGetShortExpVector
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:153

## completeReduce()

void completeReduce | ( | kStrategy | strat,
|  | BOOLEAN | withT )

Definition at line 10257 of file kutil.cc.

{
int i;
int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
LObject L;
#ifdef KDEBUG
// need to set this: during tailreductions of T[i], T[i].max is out of
// sync
sloppy_max = TRUE;
#endif
strat->noTailReduction = FALSE;
//if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
if (TEST_OPT_PROT)
{
PrintLn();
// if (timerv) writeTime("standard base computed:");
}
if (TEST_OPT_PROT)
{
Print("(S:%d)",strat->sl);mflush();
}
for (i=strat->sl; i>=low; i--)
{
int end_pos=strat->sl;
if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
if (strat->ak==0) end_pos=i-1;
TObject* T_j = strat->s_2_t(i);
if ((T_j != NULL)&&(T_j->p==strat->S[i]))
{
L = *T_j;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("test S[%d]:",i);
p_wrp(L.p,currRing,strat->tailRing);
PrintLn();
}
#endif
if (rHasGlobalOrdering(currRing))
strat->S[i] = redtailBba(&L, end_pos, strat, withT,FALSE /*no normalize*/);
else
strat->S[i] = redtail(&L, strat->sl, strat);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("to (tailR) S[%d]:",i);
p_wrp(strat->S[i],currRing,strat->tailRing);
PrintLn();
}
#endif
if (strat->redTailChange)
{
if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
if (pNext(T_j->p) != NULL)
T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
else
T_j->max_exp = NULL;
}
if (TEST_OPT_INTSTRATEGY)
T_j->pCleardenom();
}
else
{
assume(currRing == strat->tailRing);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("test S[%d]:",i);
p_wrp(strat->S[i],currRing,strat->tailRing);
PrintLn();
}
#endif
if (rHasGlobalOrdering(currRing))
strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
else
strat->S[i] = redtail(strat->S[i], strat->sl, strat);
if (TEST_OPT_INTSTRATEGY)
{
if (TEST_OPT_CONTENTSB)
{
number n;
p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
if (!nIsOne(n))
{
denominator_list denom=(denominator_list)omAlloc(sizeof(denominator_list_s));
denom->n=nInvers(n);
denom->next=DENOMINATOR_LIST;
DENOMINATOR_LIST=denom;
}
nDelete(&n);
}
else
{
strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
}
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("to (-tailR) S[%d]:",i);
p_wrp(strat->S[i],currRing,strat->tailRing);
PrintLn();
}
#endif
}
if (TEST_OPT_PROT)
PrintS("-");
}
if (TEST_OPT_PROT) PrintLn();
#ifdef KDEBUG
sloppy_max = FALSE;
#endif
}
skStrategy::noTailReduction
char noTailReduction
Definition kutil.h:375
skStrategy::ak
int ak
Definition kutil.h:352
skStrategy::s_2_t
KINLINE TObject * s_2_t(int i)
Definition kInline.h:47
skStrategy::fromQ
intset fromQ
Definition kutil.h:320
skStrategy::redTailChange
char redTailChange
Definition kutil.h:396
redtail
poly redtail(LObject *L, int end_pos, kStrategy strat)
Definition kutil.cc:6836
redtailBba
poly redtailBba(LObject *L, int end_pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition kutil.cc:6912
sloppy_max
STATIC_VAR BOOLEAN sloppy_max
Definition kutil.cc:788
DENOMINATOR_LIST
VAR denominator_list DENOMINATOR_LIST
Definition kutil.cc:79
denominator_list
denominator_list_s * denominator_list
Definition kutil.h:64
denominator_list_s::n
number n
Definition kutil.h:66
denominator_list_s::next
denominator_list next
Definition kutil.h:66
TObject
class sTObject TObject
Definition kutil.h:58
LObject
class sLObject LObject
Definition kutil.h:59
denominator_list_s
Definition kutil.h:66
nDelete
#define nDelete(n)
Definition numbers.h:16
nInvers
#define nInvers(a)
Definition numbers.h:33
nIsOne
#define nIsOne(n)
Definition numbers.h:25
omAlloc
#define omAlloc(size)
Definition omAllocDecl.h:210
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition options.h:105
TEST_OPT_CONTENTSB
#define TEST_OPT_CONTENTSB
Definition options.h:129
p_GetMaxExpP
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0,...
Definition p_polys.cc:1139
p_Cleardenom_n
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition p_polys.cc:3002
p_Cleardenom
poly p_Cleardenom(poly p, const ring r)
Definition p_polys.cc:2893
mflush
#define mflush()
Definition reporter.h:58

## deleteHC() [1/2]

void deleteHC | ( | LObject * | L,
|  | kStrategy | strat,
|  | BOOLEAN | fromNext )

Definition at line 286 of file kutil.cc.

{
if (strat->kNoether!=NULL)
{
kTest_L(L,strat);
poly p1;
poly p = L->GetLmTailRing();
int l = 1;
if (!fromNext && p_Cmp(p,strat->kNoetherTail(), L->tailRing) == -1)
{
if (L->bucket != NULL) kBucketDestroy(&L->bucket);
L->Delete();
L->Clear();
L->ecart = -1;
return;
}
if (L->bucket != NULL)
{
deleteHCBucket(L,strat);
return;
}
BOOLEAN cut=FALSE;
p1 = p;
while (pNext(p1)!=NULL)
{
if (p_LmCmp(pNext(p1), strat->kNoetherTail(), L->tailRing) == -1)
{
cut=(pNext(p1)!=NULL);
if (cut)
{
p_Delete(&pNext(p1), L->tailRing);
if (p1 == p)
{
if (L->t_p != NULL)
{
assume(L->p != NULL && p == L->t_p);
pNext(L->p) = NULL;
}
L->max_exp = NULL;
}
else if (fromNext)
L->max_exp = p_GetMaxExpP(pNext(L->p), L->tailRing ); // p1;
//if (L->pLength != 0)
L->pLength = l;
// Hmmm when called from updateT, then only
// reset ecart when cut
if (fromNext)
L->ecart = L->pLDeg() - L->GetpFDeg();
}
break;
}
l++;
pIter(p1);
}
if ((!fromNext) && cut)
{
L->SetpFDeg();
L->ecart = L->pLDeg(strat->LDegLast) - L->GetpFDeg();
}
kTest_L(L,strat);
}
}
skStrategy::kNoetherTail
KINLINE poly kNoetherTail()
Definition kInline.h:66
skStrategy::kNoether
poly kNoether
Definition kutil.h:328
skStrategy::LDegLast
char LDegLast
Definition kutil.h:382
kBucketDestroy
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition kbuckets.cc:216
deleteHCBucket
static void deleteHCBucket(LObject *L, kStrategy strat)
Definition kutil.cc:243
kTest_L
BOOLEAN kTest_L(LObject *L, kStrategy strat, BOOLEAN testp, int lpos, TSet T, int tlength)
Definition kutil.cc:916
p_Cmp
static int p_Cmp(poly p1, poly p2, ring r)
Definition p_polys.h:1748
p_LmCmp
static int p_LmCmp(poly p, poly q, const ring r)
Definition p_polys.h:1601

## deleteHC() [2/2]

void deleteHC | ( | poly * | p,
|  | int * | e,
|  | int * | l,
|  | kStrategy | strat )

Definition at line 351 of file kutil.cc.

{
LObject L(*p, currRing, strat->tailRing);
deleteHC(&L, strat);
*p = L.p;
*e = L.ecart;
*l = L.length;
if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
}
deleteHC
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition kutil.cc:286

## deleteHCBucket()

void deleteHCBucket | ( | LObject * | L,
|  | kStrategy | strat )

static

Definition at line 243 of file kutil.cc.

{
if ((strat->kNoether!=NULL)
&& (L->bucket != NULL))
{
for (int i=1; i<= (int) L->bucket->buckets_used; i++)
{
poly p=L->bucket->buckets[i];
if(p!=NULL)
{
if (p_Cmp(p,strat->kNoetherTail(), L->tailRing) == -1)
{
L->bucket->buckets[i]=NULL;
L->bucket->buckets_length[i]=0;
}
else
{
do
{
if (p_Cmp(pNext(p),strat->kNoetherTail(), L->tailRing) == -1)
{
p_Delete(&pNext(p), L->tailRing);
L->bucket->buckets_length[i]=pLength(L->bucket->buckets[i]);
break;
}
pIter(p);
} while(p!=NULL);
}
}
}
int i=L->bucket->buckets_used;
while ((i>0)&&(L->bucket->buckets[i]==NULL))
{
i--;
L->bucket->buckets_used=i;
}
}
}
pLength
static int pLength(poly a)
Definition p_polys.h:190

## deleteInL()

void deleteInL | ( | LSet | set,
|  | int * | length,
|  | int | j,
|  | kStrategy | strat )

Definition at line 1208 of file kutil.cc.

{
if (set[j].lcm!=NULL)
{
kDeleteLcm(&set[j]);
}
if (set[j].sig!=NULL)
{
if (pGetCoeff(set[j].sig) != NULL)
pLmDelete(set[j].sig);
else
pLmFree(set[j].sig);
}
if (set[j].p!=NULL)
{
if (pNext(set[j].p) == strat->tail)
{
if (pGetCoeff(set[j].p) != NULL)
pLmDelete(set[j].p);
else
pLmFree(set[j].p);
/*- tail belongs to several int spolys -*/
}
else
{
// search p in T, if it is there, do not delete it
if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
{
// assure that for global orderings kFindInT fails
//assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
set[j].Delete();
}
}
}
#ifdef HAVE_SHIFTBBA
if (is_shifted_p1(/*strat->P.p1,*/strat))
{
// clean up strat->P.p1: may be shifted
pLmDelete(strat->P.p1);
strat->P.p1=NULL;
}
#endif
if (*length > 0 && j < *length)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
#else
int i;
for (i=j; i < (*length); i++)
set[i] = set[i+1];
#endif
}
#ifdef KDEBUG
set[*length].Init();
#endif
(*length)--;
}
length
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
kFindInT
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition kutil.cc:703
is_shifted_p1
static BOOLEAN is_shifted_p1(const kStrategy strat)
Definition kutil.cc:1181
kDeleteLcm
static void kDeleteLcm(LObject *P)
Definition kutil.h:876
lcm
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709
pLmDelete
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition polys.h:77
pLmFree
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

## deleteInS()

void deleteInS | ( | int | i,
|  | kStrategy | strat )

Definition at line 1132 of file kutil.cc.

{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
#else
int j;
for (j=i; j<strat->sl; j++)
{
strat->S[j] = strat->S[j+1];
strat->ecartS[j] = strat->ecartS[j+1];
strat->sevS[j] = strat->sevS[j+1];
strat->S_2_R[j] = strat->S_2_R[j+1];
}
#endif
if (strat->lenS!=NULL)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
#else
for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
#endif
}
if (strat->lenSw!=NULL)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
#else
for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
#endif
}
if (strat->fromQ!=NULL)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
#else
for (j=i; j<strat->sl; j++)
{
strat->fromQ[j] = strat->fromQ[j+1];
}
#endif
}
strat->S[strat->sl] = NULL;
strat->sl--;
}
skStrategy::S_2_R
int * S_2_R
Definition kutil.h:341
skStrategy::lenS
intset lenS
Definition kutil.h:318
skStrategy::ecartS
intset ecartS
Definition kutil.h:308
skStrategy::lenSw
wlen_set lenSw
Definition kutil.h:319
skStrategy::sevS
unsigned long * sevS
Definition kutil.h:321
wlen_type
int64 wlen_type
Definition kutil.h:55

## enlargeL()

void enlargeL | ( | LSet * | L,
|  | int * | length,
|  | const int | incr )

inline static

Definition at line 668 of file kutil.cc.

{
assume((*L)!=NULL);
assume(((*length)+incr)>0);
*L = (LSet)omReallocSize((*L),(*length)*sizeof(LObject),
((*length)+incr)*sizeof(LObject));
(*length) += incr;
}
LSet
LObject * LSet
Definition kutil.h:61
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition omAllocDecl.h:220

## enlargeT()

void enlargeT | ( | TSet & | T,
|  | TObject **& | R,
|  | unsigned long *& | sevT,
|  | int & | length,
|  | const int | incr )

inline static

Definition at line 536 of file kutil.cc.

{
assume(T!=NULL);
assume(sevT!=NULL);
assume(R!=NULL);
assume((length+incr) > 0);
int i;
T = (TSet)omRealloc0Size(T, length*sizeof(TObject),
(length+incr)*sizeof(TObject));
sevT = (unsigned long*) omReallocSize(sevT, length*sizeof(long*),
(length+incr)*sizeof(long*));
R = (TObject**)omRealloc0Size(R,length*sizeof(TObject*),
(length+incr)*sizeof(TObject*));
for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
length += incr;
}
T
STATIC_VAR jList * T
Definition janet.cc:30
TSet
TObject * TSet
Definition kutil.h:60
omRealloc0Size
#define omRealloc0Size(addr, o_size, size)
Definition omAllocDecl.h:221
R
#define R
Definition sirandom.c:27

## enterExtendedSpoly()

void enterExtendedSpoly | ( | poly | h,
|  | kStrategy | strat )

Definition at line 4232 of file kutil.cc.

{
if (nIsOne(pGetCoeff(h))) return;
number gcd;
number zero=n_Init(0,currRing->cf);
bool go = false;
if (n_DivBy(zero, pGetCoeff(h), currRing->cf))
{
gcd = n_Ann(pGetCoeff(h),currRing->cf);
go = true;
}
else
gcd = n_Gcd(zero, pGetCoeff(h), strat->tailRing->cf);
if (go || !nIsOne(gcd))
{
poly p = h->next;
if (!go)
{
number tmp = gcd;
gcd = n_Ann(gcd,currRing->cf);
nDelete(&tmp);
}
p_Test(p,strat->tailRing);
p = __pp_Mult_nn(p, gcd, strat->tailRing);
if (p != NULL)
{
if (TEST_OPT_PROT)
{
PrintS("Z");
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("--- create zero spoly: ");
p_wrp(h,currRing,strat->tailRing);
PrintS(" ---> ");
}
#endif
poly tmp = pInit();
pSetCoeff0(tmp, pGetCoeff(p));
for (int i = 1; i <= rVar(currRing); i++)
{
pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
}
if (rRing_has_Comp(currRing) && rRing_has_Comp(strat->tailRing))
{
p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
}
p_Setm(tmp, currRing);
p = p_LmFreeAndNext(p, strat->tailRing);
pNext(tmp) = p;
LObject Lp;
Lp.Init();
Lp.p = tmp;
Lp.tailRing = strat->tailRing;
int posx;
if (Lp.p!=NULL)
{
strat->initEcart(&Lp);
if (strat->Ll==-1)
posx =0;
else
posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
Lp.sev = pGetShortExpVector(Lp.p);
if (strat->tailRing != currRing)
{
Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
p_wrp(tmp,currRing,strat->tailRing);
PrintLn();
}
#endif
enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
}
}
}
nDelete(&zero);
nDelete(&gcd);
}
skStrategy::posInL
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition kutil.h:283
skStrategy::initEcart
void(* initEcart)(TObject *L)
Definition kutil.h:281
skStrategy::Lmax
int Lmax
Definition kutil.h:350
n_Gcd
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition coeffs.h:667
n_Ann
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL
Definition coeffs.h:682
n_Init
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition coeffs.h:541
k_LmInit_currRing_2_tailRing
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition kInline.h:959
enterL
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition kutil.cc:1269
__p_GetComp
#define __p_GetComp(p, r)
Definition monomials.h:63
rRing_has_Comp
#define rRing_has_Comp(r)
Definition monomials.h:266
__pp_Mult_nn
#define __pp_Mult_nn(p, n, r)
Definition p_polys.h:1004
p_SetComp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
p_Setm
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
p_LmFreeAndNext
static poly p_LmFreeAndNext(poly p, ring)
Definition p_polys.h:713
p_Test
#define p_Test(p, r)
Definition p_polys.h:161
pInit
#define pInit()
allocates a new monomial and initializes everything to 0
Definition polys.h:62
pSetExp
#define pSetExp(p, i, v)
Definition polys.h:43
gcd
int gcd(int a, int b)
Definition walkSupport.cc:836

## enterExtendedSpolySig()

void enterExtendedSpolySig | ( | poly | h,
|  | poly | hSig,
|  | kStrategy | strat )

Definition at line 4316 of file kutil.cc.

{
if (nIsOne(pGetCoeff(h))) return;
number gcd;
number zero=n_Init(0,currRing->cf);
bool go = false;
if (n_DivBy(zero, pGetCoeff(h), currRing->cf))
{
gcd = n_Ann(pGetCoeff(h),currRing->cf);
go = true;
}
else
gcd = n_Gcd(zero, pGetCoeff(h), strat->tailRing->cf);
if (go || !nIsOne(gcd))
{
poly p = h->next;
if (!go)
{
number tmp = gcd;
gcd = n_Ann(gcd,currRing->cf);
nDelete(&tmp);
}
p_Test(p,strat->tailRing);
p = __pp_Mult_nn(p, gcd, strat->tailRing);
if (p != NULL)
{
if (TEST_OPT_PROT)
{
PrintS("Z");
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("--- create zero spoly: ");
p_wrp(h,currRing,strat->tailRing);
PrintS(" ---> ");
}
#endif
poly tmp = pInit();
pSetCoeff0(tmp, pGetCoeff(p));
for (int i = 1; i <= rVar(currRing); i++)
{
pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
}
if (rRing_has_Comp(currRing) && rRing_has_Comp(strat->tailRing))
{
p_SetComp(tmp, __p_GetComp(p, strat->tailRing), currRing);
}
p_Setm(tmp, currRing);
p = p_LmFreeAndNext(p, strat->tailRing);
pNext(tmp) = p;
LObject Lp;
Lp.Init();
Lp.p = tmp;
//printf("\nOld\n");pWrite(h);pWrite(hSig);
#if EXT_POLY_NEW
Lp.sig = __pp_Mult_nn(hSig, gcd, currRing);
if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
{
strat->sigdrop = TRUE;
//Try to reduce it as far as we can via redRing
int red_result = redRing(&Lp,strat);
if(red_result == 0)
{
// Cancel the sigdrop
p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
strat->sigdrop = FALSE;
}
else
{
strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
#if 1
strat->enterS(Lp,0,strat,strat->tl);
#endif
}
nDelete(&zero);
nDelete(&gcd);
return;
}
#else
Lp.sig = pOne();
if(strat->Ll >= 0)
p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
else
p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
#endif
Lp.tailRing = strat->tailRing;
int posx;
if (Lp.p!=NULL)
{
strat->initEcart(&Lp);
if (strat->Ll==-1)
posx =0;
else
posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
Lp.sev = pGetShortExpVector(Lp.p);
if (strat->tailRing != currRing)
{
Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
p_wrp(tmp,currRing,strat->tailRing);
PrintLn();
}
#endif
//pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
}
}
}
nDelete(&gcd);
nDelete(&zero);
}
skStrategy::sigdrop
bool sigdrop
Definition kutil.h:357
skStrategy::enterS
void(* enterS)(LObject *h, int pos, kStrategy strat, int atR)
Definition kutil.h:285
redRing
int redRing(LObject *h, kStrategy strat)
Definition kstd2.cc:988
nIsZero
#define nIsZero(n)
Definition numbers.h:19

## enterL()

void enterL | ( | LSet * | set,
|  | int * | length,
|  | int * | LSetmax,
|  | LObject | p,
|  | int | at )

Definition at line 1269 of file kutil.cc.

{
// this should be corrected
assume(p.FDeg == p.pFDeg());
if ((*length)>=0)
{
if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,*LSetmax);
if (at <= (*length))
#ifdef ENTER_USE_MEMMOVE
memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
#else
for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
#endif
}
else at = 0;
(*set)[at] = p;
(*length)++;
}
enlargeL
static void enlargeL(LSet *L, int *length, const int incr)
Definition kutil.cc:668

## enterOnePairLift()

void enterOnePairLift | ( | int | i,
|  | poly | p,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

static

Definition at line 2221 of file kutil.cc.

{
assume(ALLOW_PROD_CRIT(strat));
assume(!rIsPluralRing(currRing));
assume(i<=strat->sl);
assume(strat->syzComp==1);
if ((strat->S[i]==NULL) || (p==NULL))
return;
int l,j,compare;
LObject Lp;
Lp.i_r = -1;
#ifdef KDEBUG
Lp.ecart=0; Lp.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
Lp.lcm = p_Lcm(p,strat->S[i],currRing);
if (strat->sugarCrit)
{
if((!((strat->ecartS[i]>0)&&(ecart>0)))
&& p_HasNotCF_Lift(p,strat->S[i],currRing))
{
/*
*the product criterion has applied for (s,p),
*i.e. lcm(s,p)=product of the leading terms of s and p.
*Suppose (s,r) is in L and the leading term
*of p divides lcm(s,r)
*(==> the leading term of p divides the leading term of r)
*but the leading term of s does not divide the leading term of r
*(notice that tis condition is automatically satisfied if r is still
*in S), then (s,r) can be cancelled.
*This should be done here because the
*case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
*
*Moreover, skipping (s,r) holds also for the noncommutative case.
*/
strat->cp++;
pLmFree(Lp.lcm);
return;
}
else
Lp.ecart = si_max(ecart,strat->ecartS[i]);
if (strat->fromT && (strat->ecartS[i]>ecart))
{
pLmFree(Lp.lcm);
return;
/*the pair is (s[i],t[.]), discard it if the ecart is too big*/
}
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
{
j = strat->Bl;
loop
{
if (j < 0) break;
compare=pDivComp(strat->B[j].lcm,Lp.lcm);
if ((compare==1)
&&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
{
strat->c3++;
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
pLmFree(Lp.lcm);
return;
}
break;
}
else
if ((compare ==-1)
&& sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
j--;
}
}
}
else /*sugarcrit*/
{
if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
p_HasNotCF_Lift(p,strat->S[i],currRing))
{
/*
*the product criterion has applied for (s,p),
*i.e. lcm(s,p)=product of the leading terms of s and p.
*Suppose (s,r) is in L and the leading term
*of p divides lcm(s,r)
*(==> the leading term of p divides the leading term of r)
*but the leading term of s does not divide the leading term of r
*(notice that tis condition is automatically satisfied if r is still
*in S), then (s,r) can be canceled.
*This should be done here because the
*case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
*/
strat->cp++;
pLmFree(Lp.lcm);
return;
}
if (strat->fromT && (strat->ecartS[i]>ecart))
{
pLmFree(Lp.lcm);
return;
/*the pair is (s[i],t[.]), discard it if the ecart is too big*/
}
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
for(j = strat->Bl;j>=0;j--)
{
compare=pDivComp(strat->B[j].lcm,Lp.lcm);
if (compare==1)
{
strat->c3++;
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
pLmFree(Lp.lcm);
return;
}
break;
}
else
if (compare ==-1)
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
}
}
/*
*the pair (S[i],p) enters B if the spoly != 0
*/
/*- compute the short s-polynomial -*/
if (strat->fromT && !TEST_OPT_INTSTRATEGY)
pNorm(p);
if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
Lp.p=NULL;
else
{
assume(!rIsPluralRing(currRing));
Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
}
if (Lp.p == NULL)
{
/*- the case that the s-poly is 0 -*/
if (strat->pairtest==NULL) initPairtest(strat);
strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
strat->pairtest[strat->sl+1] = TRUE;
/*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
/*
*suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
*still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
*divide lcm(r,p)). In the last case (s,r) can be canceled if the leading
*term of p divides the lcm(s,r)
*(this canceling should be done here because
*the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
*the first case is handled in chainCrit
*/
if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
}
else
{
/*- the pair (S[i],p) enters B -*/
Lp.p1 = strat->S[i];
Lp.p2 = p;
pNext(Lp.p) = strat->tail; // !!!
if (atR >= 0)
{
Lp.i_r1 = strat->S_2_R[i];
Lp.i_r2 = atR;
}
else
{
Lp.i_r1 = -1;
Lp.i_r2 = -1;
}
strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
if (TEST_OPT_INTSTRATEGY)
{
if (!rIsPluralRing(currRing)
&& !rField_is_Ring(currRing)
&& (Lp.p->coef!=NULL))
nDelete(&(Lp.p->coef));
}
l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
}
}
si_max
static int si_max(const int a, const int b)
Definition auxiliary.h:125
skStrategy::cp
int cp
Definition kutil.h:346
skStrategy::initEcartPair
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition kutil.h:286
skStrategy::Bmax
int Bmax
Definition kutil.h:351
ksCreateShortSpoly
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition kspoly.cc:1446
initPairtest
void initPairtest(kStrategy strat)
Definition kutil.cc:678
p_HasNotCF_Lift
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case and syzComp==1: ignore component
Definition kutil.cc:2202
pDivComp
static int pDivComp(poly p, poly q)
Definition kutil.cc:176
ALLOW_PROD_CRIT
#define ALLOW_PROD_CRIT(A)
Definition kutil.h:392
p_Lcm
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition p_polys.cc:1659
pNorm
void pNorm(poly p)
Definition polys.h:363
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406

## enterOnePairNormal()

void enterOnePairNormal | ( | int | i,
|  | poly | p,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

Definition at line 1939 of file kutil.cc.

{
assume(i<=strat->sl);
int l,j,compare;
LObject Lp;
Lp.i_r = -1;
#ifdef KDEBUG
Lp.ecart=0; Lp.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
Lp.lcm = pInit();
#ifndef HAVE_RATGRING
pLcm(p,strat->S[i],Lp.lcm);
#elif defined(HAVE_RATGRING)
if (rIsRatGRing(currRing))
pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
else
pLcm(p,strat->S[i],Lp.lcm);
#endif
pSetm(Lp.lcm);
if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
{
if (strat->fromT && (strat->ecartS[i]>ecart))
{
pLmFree(Lp.lcm);
return;
/*the pair is (s[i],t[.]), discard it if the ecart is too big*/
}
if((!((strat->ecartS[i]>0)&&(ecart>0)))
&& pHasNotCF(p,strat->S[i]))
{
/*
*the product criterion has applied for (s,p),
*i.e. lcm(s,p)=product of the leading terms of s and p.
*Suppose (s,r) is in L and the leading term
*of p divides lcm(s,r)
*(==> the leading term of p divides the leading term of r)
*but the leading term of s does not divide the leading term of r
*(notice that tis condition is automatically satisfied if r is still
*in S), then (s,r) can be cancelled.
*This should be done here because the
*case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
*
*Moreover, skipping (s,r) holds also for the noncommutative case.
*/
strat->cp++;
pLmFree(Lp.lcm);
return;
}
Lp.ecart = si_max(ecart,strat->ecartS[i]);
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
{
j = strat->Bl;
loop
{
if (j < 0) break;
compare=pDivComp(strat->B[j].lcm,Lp.lcm);
if ((compare==1)
&&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
{
strat->c3++;
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
pLmFree(Lp.lcm);
return;
}
break;
}
else
if ((compare ==-1)
&& sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
j--;
}
}
}
else /*sugarcrit*/
{
if (ALLOW_PROD_CRIT(strat))
{
if (strat->fromT && (strat->ecartS[i]>ecart))
{
pLmFree(Lp.lcm);
return;
/*the pair is (s[i],t[.]), discard it if the ecart is too big*/
}
// if currRing->nc_type!=quasi (or skew)
// TODO: enable productCrit for super commutative algebras...
if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
pHasNotCF(p,strat->S[i]))
{
/*
*the product criterion has applied for (s,p),
*i.e. lcm(s,p)=product of the leading terms of s and p.
*Suppose (s,r) is in L and the leading term
*of p divides lcm(s,r)
*(==> the leading term of p divides the leading term of r)
*but the leading term of s does not divide the leading term of r
*(notice that tis condition is automatically satisfied if r is still
*in S), then (s,r) can be canceled.
*This should be done here because the
*case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
*/
strat->cp++;
pLmFree(Lp.lcm);
return;
}
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
for(j = strat->Bl;j>=0;j--)
{
compare=pDivComp(strat->B[j].lcm,Lp.lcm);
if (compare==1)
{
strat->c3++;
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
pLmFree(Lp.lcm);
return;
}
break;
}
else
if (compare ==-1)
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
}
}
}
/*
*the pair (S[i],p) enters B if the spoly != 0
*/
/*- compute the short s-polynomial -*/
if (strat->fromT && !TEST_OPT_INTSTRATEGY)
pNorm(p);
if ((strat->S[i]==NULL) || (p==NULL))
return;
if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
Lp.p=NULL;
else
{
#ifdef HAVE_PLURAL
if ( rIsPluralRing(currRing) )
{
if(pHasNotCF(p, strat->S[i]))
{
if(ncRingType(currRing) == nc_lie)
{
// generalized prod-crit for lie-type
strat->cp++;
Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
}
else
if( ALLOW_PROD_CRIT(strat) )
{
// product criterion for homogeneous case in SCA
strat->cp++;
Lp.p = NULL;
}
else
{
Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
nc_CreateShortSpoly(strat->S[i], p, currRing);
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
}
else
{
Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
nc_CreateShortSpoly(strat->S[i], p, currRing);
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
}
else
#endif
{
assume(!rIsPluralRing(currRing));
Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
}
}
if (Lp.p == NULL)
{
/*- the case that the s-poly is 0 -*/
if (strat->pairtest==NULL) initPairtest(strat);
strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
strat->pairtest[strat->sl+1] = TRUE;
/*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
/*
*suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
*still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
*divide lcm(r,p)). In the last case (s,r) can be canceled if the leading
*term of p divides the lcm(s,r)
*(this canceling should be done here because
*the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
*the first case is handled in chainCrit
*/
if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
}
else
{
/*- the pair (S[i],p) enters B -*/
Lp.p1 = strat->S[i];
Lp.p2 = p;
if (
(!rIsPluralRing(currRing))
// || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
)
{
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
if (atR >= 0)
{
Lp.i_r1 = strat->S_2_R[i];
Lp.i_r2 = atR;
}
else
{
Lp.i_r1 = -1;
Lp.i_r2 = -1;
}
strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
if (TEST_OPT_INTSTRATEGY)
{
if (!rIsPluralRing(currRing)
&& !rField_is_Ring(currRing)
&& (Lp.p->coef!=NULL))
nDelete(&(Lp.p->coef));
}
l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
}
}
nc_CreateShortSpoly
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition old.gring.cc:1879
nc_lie
@ nc_lie
Definition nc.h:18
ncRingType
static nc_type & ncRingType(nc_struct *p)
Definition nc.h:159
nc_p_Bracket_qq
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition old.gring.cc:2251
pSetm
#define pSetm(p)
Definition polys.h:272
pHasNotCF
#define pHasNotCF(p1, p2)
Definition polys.h:264
pLcm
#define pLcm(a, b, m)
Definition polys.h:296
pLcmRat
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition ratgring.cc:30
rIsRatGRing
static BOOLEAN rIsRatGRing(const ring r)
Definition ring.h:433

## enterOnePairRing()

void enterOnePairRing | ( | int | i,
|  | poly | p,
|  | int | ,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR )

static

Definition at line 1334 of file kutil.cc.

{
assume(atR >= 0);
assume(i<=strat->sl);
assume(p!=NULL);
assume(rField_is_Ring(currRing));
#if ALL_VS_JUST
//Over rings, if we construct the strong pair, do not add the spair
if(rField_is_Ring(currRing))
{
number s,t,d;
d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return;
}
nDelete(&d);
nDelete(&s);
nDelete(&t);
}
#endif
int j,compare,compareCoeff;
LObject h;
#ifdef KDEBUG
h.ecart=0; h.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
if(pHasNotCFRing(p,strat->S[i]))
{
strat->cp++;
return;
}
h.lcm = p_Lcm(p,strat->S[i],currRing);
pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
if (nIsZero(pGetCoeff(h.lcm)))
{
strat->cp++;
pLmDelete(h.lcm);
return;
}
// basic chain criterion
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
for(j = strat->Bl;j>=0;j--)
{
compare=pDivCompRing(strat->B[j].lcm,h.lcm);
compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
if(compare == pDivComp_EQUAL)
{
//They have the same LM
if(compareCoeff == pDivComp_LESS)
{
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
strat->c3++;
pLmDelete(h.lcm);
return;
}
break;
}
if(compareCoeff == pDivComp_GREATER)
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
if(compareCoeff == pDivComp_EQUAL)
{
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
strat->c3++;
pLmDelete(h.lcm);
return;
}
break;
}
}
if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
{
if(compare == pDivComp_LESS)
{
if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
{
strat->c3++;
pLmDelete(h.lcm);
return;
}
break;
}
if(compare == pDivComp_GREATER)
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
}
}
number s, t;
poly m1, m2, gcd = NULL;
s = pGetCoeff(strat->S[i]);
t = pGetCoeff(p);
k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
ksCheckCoeff(&s, &t, currRing->cf);
pSetCoeff0(m1, s);
pSetCoeff0(m2, t);
m2 = pNeg(m2);
p_Test(m1,strat->tailRing);
p_Test(m2,strat->tailRing);
poly si = pCopy(strat->S[i]);
poly pm1 = pp_Mult_mm(pNext(p), m1, strat->tailRing);
poly sim2 = pp_Mult_mm(pNext(si), m2, strat->tailRing);
pDelete(&si);
p_LmDelete(m1, currRing);
p_LmDelete(m2, currRing);
if(sim2 == NULL)
{
if(pm1 == NULL)
{
if(h.lcm != NULL)
{
pLmDelete(h.lcm);
h.lcm=NULL;
}
h.Clear();
if (strat->pairtest==NULL) initPairtest(strat);
strat->pairtest[i] = TRUE;
strat->pairtest[strat->sl+1] = TRUE;
return;
}
else
{
gcd = pm1;
pm1 = NULL;
}
}
else
{
if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
{
p_SetCompP(sim2, pGetComp(p), strat->tailRing);
pSetmComp(sim2);
}
//p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
gcd = p_Add_q(pm1, sim2, strat->tailRing);
}
p_Test(gcd, strat->tailRing);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
wrp(gcd);
PrintLn();
}
#endif
h.p = gcd;
h.i_r = -1;
if(h.p == NULL)
{
if (strat->pairtest==NULL) initPairtest(strat);
strat->pairtest[i] = TRUE;
strat->pairtest[strat->sl+1] = TRUE;
return;
}
h.tailRing = strat->tailRing;
int posx;
//h.pCleardenom();
//pSetm(h.p);
h.i_r1 = -1;h.i_r2 = -1;
strat->initEcart(&h);
#if 1
h.p2 = strat->S[i];
h.p1 = p;
#endif
#if 1
if (atR >= 0)
{
h.i_r1 = atR;
h.i_r2 = strat->S_2_R[i];
}
#endif
if (strat->Bl==-1)
posx =0;
else
posx = strat->posInL(strat->B,strat->Bl,&h,strat);
h.sev = pGetShortExpVector(h.p);
if (currRing!=strat->tailRing)
h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
if (strat->P.p!=NULL) strat->P.sev = pGetShortExpVector(strat->P.p);
else strat->P.sev=0L;
enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
kTest_TS(strat);
}
n_Lcm
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition coeffs.h:693
n_ExtGcd
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition coeffs.h:674
n_DivComp
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition coeffs.h:527
s
const CanonicalForm int s
Definition facAbsFact.cc:51
k_GetLeadTerms
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition kInline.h:1018
ksCheckCoeff
int ksCheckCoeff(number *a, number *b, const coeffs r)
Definition kbuckets.cc:1504
pDivComp_LESS
#define pDivComp_LESS
Definition kutil.cc:130
kTest_TS
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1067
pDivCompRing
static int pDivCompRing(poly p, poly q)
Definition kutil.cc:138
pDivComp_GREATER
#define pDivComp_GREATER
Definition kutil.cc:131
pDivComp_EQUAL
#define pDivComp_EQUAL
Definition kutil.cc:129
p_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
pp_Mult_mm
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1033
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition p_polys.h:256
pNeg
#define pNeg(p)
Definition polys.h:199
pSetmComp
#define pSetmComp(p)
TODO:
Definition polys.h:274
pHasNotCFRing
#define pHasNotCFRing(p1, p2)
Definition polys.h:263

## enterOnePairRingShift()

void enterOnePairRingShift | ( | poly | q,
|  | poly | p,
|  | int | ,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR,
|  | int | ,
|  | int | qisFromQ,
|  | int | shiftcount,
|  | int | ifromS )

static

Definition at line 11790 of file kutil.cc.

{
/* assume(atR >= 0); */
/* assume(i<=strat->sl); */
assume(p!=NULL);
assume(rField_is_Ring(currRing));
assume(pIsInV(p));
#if ALL_VS_JUST
//Over rings, if we construct the strong pair, do not add the spair
if(rField_is_Ring(currRing))
{
number s,t,d;
d = n_ExtGcd(pGetCoeff(p), pGetCoeff(q, &s, &t, currRing->cf);
if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return;
}
nDelete(&d);
nDelete(&s);
nDelete(&t);
}
#endif
int j,compare,compareCoeff;
LObject h;
#ifdef KDEBUG
h.ecart=0; h.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
if(pHasNotCFRing(p,q))
{
strat->cp++;
return;
}
h.lcm = p_Lcm(p,q,currRing);
pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(q), currRing->cf));
if (nIsZero(pGetCoeff(h.lcm)))
{
strat->cp++;
pLmDelete(h.lcm);
return;
}
/* the V criterion */
if (!pmIsInV(h.lcm))
{
strat->cv++;
pLmDelete(h.lcm);
return;
}
// basic chain criterion
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
for(j = strat->Bl;j>=0;j--)
{
compare=pDivCompRing(strat->B[j].lcm,h.lcm);
compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
if(compare == pDivComp_EQUAL)
{
//They have the same LM
if(compareCoeff == pDivComp_LESS)
{
if ((strat->fromQ==NULL) || (isFromQ==0) || (qisFromQ==0))
{
strat->c3++;
pLmDelete(h.lcm);
return;
}
break;
}
if(compareCoeff == pDivComp_GREATER)
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
if(compareCoeff == pDivComp_EQUAL)
{
if ((strat->fromQ==NULL) || (isFromQ==0) || (qisFromQ==0))
{
strat->c3++;
pLmDelete(h.lcm);
return;
}
break;
}
}
if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
{
if(compare == pDivComp_LESS)
{
if ((strat->fromQ==NULL) || (isFromQ==0) || (qisFromQ==0))
{
strat->c3++;
pLmDelete(h.lcm);
return;
}
break;
}
if(compare == pDivComp_GREATER)
{
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
}
}
number s, t;
poly m1, m2, gcd = NULL;
s = pGetCoeff(q);
t = pGetCoeff(p);
k_GetLeadTerms(p,q,currRing,m1,m2,currRing);
poly m12, m22;
assume(p_mFirstVblock(p, currRing) <= 1 || p_mFirstVblock(q, currRing) <= 1);
k_SplitFrame(m1, m12, si_max(p_mFirstVblock(p, currRing), 1), currRing);
k_SplitFrame(m2, m22, si_max(p_mFirstVblock(q, currRing), 1), currRing);
// manually free the coeffs, because pSetCoeff0 is used in the next step
n_Delete(&(m1->coef), currRing->cf);
n_Delete(&(m2->coef), currRing->cf);
ksCheckCoeff(&s, &t, currRing->cf);
pSetCoeff0(m1, s);
pSetCoeff0(m2, t);
m2 = pNeg(m2);
p_Test(m1,strat->tailRing);
p_Test(m2,strat->tailRing);
p_Test(m12,strat->tailRing);
p_Test(m22,strat->tailRing);
assume(pmIsInV(m1));
assume(pmIsInV(m2));
assume(pmIsInV(m12));
assume(pmIsInV(m22));
poly pm1 = pp_Mult_mm(pp_mm_Mult(pNext(p), m1, strat->tailRing), m12, strat->tailRing);
poly sim2 = pp_Mult_mm(pp_mm_Mult(pNext(q), m2, strat->tailRing), m22, strat->tailRing);
assume(pIsInV(pm1));
assume(pIsInV(sim2));
p_LmDelete(m1, currRing);
p_LmDelete(m2, currRing);
p_LmDelete(m12, currRing);
p_LmDelete(m22, currRing);
if(sim2 == NULL)
{
if(pm1 == NULL)
{
if(h.lcm != NULL)
{
pLmDelete(h.lcm);
h.lcm=NULL;
}
h.Clear();
/* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
/* if (strat->pairtest==NULL) initPairtest(strat); */
/* strat->pairtest[i] = TRUE; */
/* strat->pairtest[strat->sl+1] = TRUE; */
return;
}
else
{
gcd = pm1;
pm1 = NULL;
}
}
else
{
if((pGetComp(q) == 0) && (0 != pGetComp(p)))
{
p_SetCompP(sim2, pGetComp(p), strat->tailRing);
pSetmComp(sim2);
}
//p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
gcd = p_Add_q(pm1, sim2, strat->tailRing);
}
p_Test(gcd, strat->tailRing);
assume(pIsInV(gcd));
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
wrp(gcd);
PrintLn();
}
#endif
h.p = gcd;
h.i_r = -1;
if(h.p == NULL)
{
/* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
/* if (strat->pairtest==NULL) initPairtest(strat); */
/* strat->pairtest[i] = TRUE; */
/* strat->pairtest[strat->sl+1] = TRUE; */
return;
}
h.tailRing = strat->tailRing;
int posx;
//h.pCleardenom();
//pSetm(h.p);
h.i_r1 = -1;h.i_r2 = -1;
strat->initEcart(&h);
#if 1
h.p1 = p;
h.p2 = q;
#endif
#if 1
/* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
/* at the beginning we DO NOT set atR = -1 ANYMORE*/
if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
{
h.i_r2 = kFindInT(h.p1, strat); //strat->S_2_R[i];
h.i_r1 = atR;
}
else
{
/* END _ TEMPORARILY DISABLED FOR SHIFTS */
h.i_r1 = -1;
h.i_r2 = -1;
}
#endif
if (strat->Bl==-1)
posx =0;
else
posx = strat->posInL(strat->B,strat->Bl,&h,strat);
h.sev = pGetShortExpVector(h.p);
if (currRing!=strat->tailRing)
h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
assume(pIsInV(h.p));
assume(pIsInV(h.p1));
assume(h.lcm != NULL);
assume(pIsInV(h.lcm));
enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
kTest_TS(strat);
}
skStrategy::cv
int cv
Definition kutil.h:365
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
if
if(!FE_OPT_NO_SHELL_FLAG)
Definition fehelp.cc:1000
pp_mm_Mult
static poly pp_mm_Mult(poly p, poly m, const ring r)
Definition p_polys.h:1043
p_mFirstVblock
int p_mFirstVblock(poly p, const ring ri)
Definition shiftop.cc:478
k_SplitFrame
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition shiftop.cc:600
pIsInV
#define pIsInV(p)
Definition shiftop.h:50
pmIsInV
#define pmIsInV(p)
Definition shiftop.h:51

## enterOnePairShift()

BOOLEAN enterOnePairShift | ( | poly | q,
|  | poly | p,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR,
|  | int | ecartq,
|  | int | qisFromQ,
|  | int | shiftcount,
|  | int | ifromS )

Definition at line 12143 of file kutil.cc.

{
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG)
{
PrintS("Consider pair ("); wrp(q); PrintS(", "); wrp(p); PrintS(")"); PrintLn();
// also write the LMs in separate lines:
poly lmq = pHead(q);
poly lmp = pHead(p);
pSetCoeff(lmq, n_Init(1, currRing->cf));
pSetCoeff(lmp, n_Init(1, currRing->cf));
Print(" %s\n", pString(lmq));
Print(" %s\n", pString(lmp));
pLmDelete(lmq);
pLmDelete(lmp);
}
#endif
/* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
/* check this Formats: */
assume(p_LmCheckIsFromRing(q,currRing));
assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
assume(p_LmCheckIsFromRing(p,currRing));
assume(p_CheckIsFromRing(pNext(p),strat->tailRing));
/* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
int qfromQ = qisFromQ;
/* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
int l,j,compare;
LObject Lp;
Lp.i_r = -1;
#ifdef KDEBUG
Lp.ecart=0; Lp.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
Lp.lcm = p_Lcm(p,q, currRing); // q is what was strat->S[i], so a poly in LM/TR presentation
/* the V criterion */
if (!pmIsInV(Lp.lcm))
{
strat->cv++; // counter for applying the V criterion
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- V crit\n");
#endif
return TRUE;
}
if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
{
if((!((ecartq>0)&&(ecart>0)))
&& pHasNotCF(p,q))
{
/*
*the product criterion has applied for (s,p),
*i.e. lcm(s,p)=product of the leading terms of s and p.
*Suppose (s,r) is in L and the leading term
*of p divides lcm(s,r)
*(==> the leading term of p divides the leading term of r)
*but the leading term of s does not divide the leading term of r
*(notice that this condition is automatically satisfied if r is still
*in S), then (s,r) can be cancelled.
*This should be done here because the
*case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
*
*Moreover, skipping (s,r) holds also for the noncommutative case.
*/
strat->cp++;
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- prod crit\n");
#endif
return TRUE;
}
else
Lp.ecart = si_max(ecart,ecartq);
if (strat->fromT && (ecartq>ecart))
{
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- ecartq > ecart\n");
#endif
return TRUE;
/*the pair is (s[i],t[.]), discard it if the ecart is too big*/
}
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
{
j = strat->Bl;
loop
{
if (j < 0) break;
compare=pLPDivComp(strat->B[j].lcm,Lp.lcm);
if ((compare==1)
&&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
{
strat->c3++;
if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
{
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG)
{
Print("--- chain crit using B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
}
#endif
return TRUE;
}
break;
}
else
if ((compare ==-1)
&& sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
{
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG)
{
Print("--- chain crit using pair to remove B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
}
#endif
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
j--;
}
}
}
else /*sugarcrit*/
{
if (ALLOW_PROD_CRIT(strat))
{
// if currRing->nc_type!=quasi (or skew)
// TODO: enable productCrit for super commutative algebras...
if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
pHasNotCF(p,q))
{
/*
*the product criterion has applied for (s,p),
*i.e. lcm(s,p)=product of the leading terms of s and p.
*Suppose (s,r) is in L and the leading term
*of p divides lcm(s,r)
*(==> the leading term of p divides the leading term of r)
*but the leading term of s does not divide the leading term of r
*(notice that tis condition is automatically satisfied if r is still
*in S), then (s,r) can be canceled.
*This should be done here because the
*case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
*/
strat->cp++;
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- prod crit\n");
#endif
return TRUE;
}
if (strat->fromT && (ecartq>ecart))
{
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- ecartq > ecart\n");
#endif
return TRUE;
/*the pair is (s[i],t[.]), discard it if the ecart is too big*/
}
/*
*the set B collects the pairs of type (S[j],p)
*suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
*if the leading term of s divides lcm(r,p) then (r,p) will be canceled
*if the leading term of r divides lcm(s,p) then (s,p) will not enter B
*/
for(j = strat->Bl;j>=0;j--)
{
compare=pLPDivComp(strat->B[j].lcm,Lp.lcm);
if (compare==1)
{
strat->c3++;
if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
{
pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG)
{
Print("--- chain crit using B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
}
#endif
return TRUE;
}
break;
}
else
if (compare ==-1)
{
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG)
{
Print("--- chain crit using pair to remove B[%d].lcm=%s\n", j, pString(strat->B[j].lcm));
}
#endif
deleteInL(strat->B,&strat->Bl,j,strat);
strat->c3++;
}
}
}
}
/*
*the pair (S[i],p) enters B if the spoly != 0
*/
/*- compute the short s-polynomial -*/
if (strat->fromT && !TEST_OPT_INTSTRATEGY)
pNorm(p);
if ((q==NULL) || (p==NULL))
{
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- q == NULL || p == NULL\n");
#endif
return FALSE;
}
if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
{
Lp.p=NULL;
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- pair is from Q\n");
#endif
}
else
{
// if ( rIsPluralRing(currRing) )
// {
// if(pHasNotCF(p, q))
// {
// if(ncRingType(currRing) == nc_lie)
// {
// // generalized prod-crit for lie-type
// strat->cp++;
// Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
// }
// else
// if( ALLOW_PROD_CRIT(strat) )
// {
// // product criterion for homogeneous case in SCA
// strat->cp++;
// Lp.p = NULL;
// }
// else
// Lp.p = nc_CreateSpoly(q,p,currRing); // ?
// }
// else Lp.p = nc_CreateSpoly(q,p,currRing);
// }
// else
// {
/* ksCreateShortSpoly needs two Lobject-kind presentations */
/* p is already in this form, so convert q */
Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
// }
}
if (Lp.p == NULL)
{
/*- the case that the s-poly is 0 -*/
// TODO: currently ifromS is only > 0 if called from enterOnePairWithShifts
if (ifromS > 0)
{
if (strat->pairtest==NULL) initPairtest(strat);
strat->pairtest[ifromS] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
strat->pairtest[strat->sl+1] = TRUE;
}
//if (TEST_OPT_DEBUG){Print("!");} // option teach
/* END _ TEMPORARILY DISABLED FOR SHIFTS */
/*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
/*
*suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
*still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
*divide lcm(r,p)). In the last case (s,r) can be canceled if the leading
*term of p divides the lcm(s,r)
*(this canceling should be done here because
*the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
*the first case is handled in chainCrit
*/
if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("--- S-poly = 0\n");
#endif
return TRUE;
}
else
{
/*- the pair (S[i],p) enters B -*/
/* both of them should have their LM in currRing and TAIL in tailring */
Lp.p1 = q; // already in the needed form
Lp.p2 = p; // already in the needed form
if ( !rIsPluralRing(currRing) )
pNext(Lp.p) = strat->tail;
/* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
/* at the beginning we DO NOT set atR = -1 ANYMORE*/
if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
{
Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
Lp.i_r2 = atR;
}
else
{
/* END _ TEMPORARILY DISABLED FOR SHIFTS */
Lp.i_r1 = -1;
Lp.i_r2 = -1;
}
strat->initEcartPair(&Lp,q,p,ecartq,ecart);
if (TEST_OPT_INTSTRATEGY)
{
if (!rIsPluralRing(currRing)
&& !rField_is_Ring(currRing)
&& (Lp.p->coef!=NULL))
nDelete(&(Lp.p->coef));
}
l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
#ifdef CRITERION_DEBUG
if (TEST_OPT_DEBUG) PrintS("+++ Entered pair\n");
#endif
}
return FALSE;
}
pLPDivComp
static int pLPDivComp(poly p, poly q)
Definition kutil.cc:225
p_CheckIsFromRing
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition pDebug.cc:105
p_LmCheckIsFromRing
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition pDebug.cc:74
pHead
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL
Definition polys.h:68
pString
char * pString(poly p)
Definition polys.h:307

## enterOnePairSig()

void enterOnePairSig | ( | int | i,
|  | poly | p,
|  | poly | pSig,
|  | int | ,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

static

Definition at line 2433 of file kutil.cc.

{
assume(i<=strat->sl);
int l;
poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
// the corresponding signatures for criteria checks
LObject Lp;
poly pSigMult = p_Copy(pSig,currRing);
poly sSigMult = p_Copy(strat->sig[i],currRing);
unsigned long pSigMultNegSev,sSigMultNegSev;
Lp.i_r = -1;
#ifdef KDEBUG
Lp.ecart=0; Lp.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
Lp.lcm = pInit();
k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
#ifndef HAVE_RATGRING
pLcm(p,strat->S[i],Lp.lcm);
#elif defined(HAVE_RATGRING)
if (rIsRatGRing(currRing))
pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
else
pLcm(p,strat->S[i],Lp.lcm);
#endif
pSetm(Lp.lcm);
// set coeffs of multipliers m1 and m2
pSetCoeff0(m1, nInit(1));
pSetCoeff0(m2, nInit(1));
//#if 1
#ifdef DEBUGF5
PrintS("P1 ");
pWrite(pHead(p));
PrintS("P2 ");
pWrite(pHead(strat->S[i]));
PrintS("M1 ");
pWrite(m1);
PrintS("M2 ");
pWrite(m2);
#endif
// get multiplied signatures for testing
pSigMult = currRing->p_Procs->pp_Mult_mm(pSigMult,m1,currRing);
pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
sSigMult = currRing->p_Procs->pp_Mult_mm(sSigMult,m2,currRing);
sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
//#if 1
#ifdef DEBUGF5
PrintS("----------------\n");
pWrite(pSigMult);
pWrite(sSigMult);
PrintS("----------------\n");
Lp.checked = 0;
#endif
int sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
//#if 1
#if DEBUGF5
Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
pWrite(pSigMult);
pWrite(sSigMult);
#endif
if(sigCmp==0)
{
// printf("!!!! EQUAL SIGS !!!!\n");
// pSig = sSig, delete element due to Rewritten Criterion
pDelete(&pSigMult);
pDelete(&sSigMult);
if (rField_is_Ring(currRing))
pLmDelete(Lp.lcm);
else
pLmFree(Lp.lcm);
pDelete (&m1);
pDelete (&m2);
return;
}
// testing by syzCrit = F5 Criterion
// testing by rewCrit1 = Rewritten Criterion
// NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
strat->syzCrit(sSigMult,sSigMultNegSev,strat)
|| strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
)
{
pDelete(&pSigMult);
pDelete(&sSigMult);
if (rField_is_Ring(currRing))
pLmDelete(Lp.lcm);
else
pLmFree(Lp.lcm);
pDelete (&m1);
pDelete (&m2);
return;
}
/*
*the pair (S[i],p) enters B if the spoly != 0
*/
/*- compute the short s-polynomial -*/
if (strat->fromT && !TEST_OPT_INTSTRATEGY)
pNorm(p);
if ((strat->S[i]==NULL) || (p==NULL))
return;
if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
Lp.p=NULL;
else
{
#ifdef HAVE_PLURAL
if ( rIsPluralRing(currRing) )
{
if(pHasNotCF(p, strat->S[i]))
{
if(ncRingType(currRing) == nc_lie)
{
// generalized prod-crit for lie-type
strat->cp++;
Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
}
else
if( ALLOW_PROD_CRIT(strat) )
{
// product criterion for homogeneous case in SCA
strat->cp++;
Lp.p = NULL;
}
else
{
Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
nc_CreateShortSpoly(strat->S[i], p, currRing);
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
}
else
{
Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
nc_CreateShortSpoly(strat->S[i], p, currRing);
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
}
else
#endif
{
assume(!rIsPluralRing(currRing));
Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
}
}
// store from which element this pair comes from for further tests
//Lp.from = strat->sl+1;
if(sigCmp==currRing->OrdSgn)
{
// pSig > sSig
pDelete (&sSigMult);
Lp.sig = pSigMult;
Lp.sevSig = ~pSigMultNegSev;
}
else
{
// pSig < sSig
pDelete (&pSigMult);
Lp.sig = sSigMult;
Lp.sevSig = ~sSigMultNegSev;
}
if (Lp.p == NULL)
{
if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
int pos = posInSyz(strat, Lp.sig);
enterSyz(Lp, strat, pos);
}
else
{
// testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
{
pLmFree(Lp.lcm);
pDelete(&Lp.sig);
pDelete (&m1);
pDelete (&m2);
return;
}
// in any case Lp is checked up to the next strat->P which is added
// to S right after this critical pair creation.
// NOTE: this even holds if the 2nd generator gives the bigger signature
// moreover, this improves rewCriterion,
// i.e. strat->checked > strat->from if and only if the 2nd generator
// gives the bigger signature.
Lp.checked = strat->sl+1;
// at this point it is clear that the pair will be added to L, since it has
// passed all tests up to now
// adds buchberger's first criterion
if (pLmCmp(m2,pHead(p)) == 0)
{
Lp.prod_crit = TRUE; // Product Criterion
#if 0
int pos = posInSyz(strat, Lp.sig);
enterSyz(Lp, strat, pos);
pDelete (&m1);
pDelete (&m2);
return;
#endif
}
pDelete (&m1);
pDelete (&m2);
#if DEBUGF5
PrintS("SIGNATURE OF PAIR: ");
pWrite(Lp.sig);
#endif
/*- the pair (S[i],p) enters B -*/
Lp.p1 = strat->S[i];
Lp.p2 = p;
if (
(!rIsPluralRing(currRing))
// || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
)
{
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
if (atR >= 0)
{
Lp.i_r1 = strat->S_2_R[i];
Lp.i_r2 = atR;
}
else
{
Lp.i_r1 = -1;
Lp.i_r2 = -1;
}
strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
if (TEST_OPT_INTSTRATEGY)
{
if (!rIsPluralRing(currRing)
&& !rField_is_Ring(currRing)
&& (Lp.p->coef!=NULL))
nDelete(&(Lp.p->coef));
}
l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
}
}
skStrategy::rewCrit1
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:292
skStrategy::rewCrit3
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:294
skStrategy::syzCrit
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition kutil.h:291
enterSyz
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition kutil.cc:9343
posInSyz
int posInSyz(const kStrategy strat, poly sig)
Definition kutil.cc:5758
p_GetShortExpVector
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition p_polys.cc:4934
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

## enterOnePairSigRing()

void enterOnePairSigRing | ( | int | i,
|  | poly | p,
|  | poly | pSig,
|  | int | ,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

static

Definition at line 2690 of file kutil.cc.

{
#if ALL_VS_JUST
//Over rings, if we construct the strong pair, do not add the spair
if(rField_is_Ring(currRing))
{
number s,t,d;
d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return;
}
nDelete(&d);
nDelete(&s);
nDelete(&t);
}
#endif
assume(i<=strat->sl);
int l;
poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
// the corresponding signatures for criteria checks
LObject Lp;
poly pSigMult = p_Copy(pSig,currRing);
poly sSigMult = p_Copy(strat->sig[i],currRing);
unsigned long pSigMultNegSev,sSigMultNegSev;
Lp.i_r = -1;
#ifdef KDEBUG
Lp.ecart=0; Lp.length=0;
#endif
/*- computes the lcm(s[i],p) -*/
Lp.lcm = pInit();
k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
#ifndef HAVE_RATGRING
pLcm(p,strat->S[i],Lp.lcm);
#elif defined(HAVE_RATGRING)
if (rIsRatGRing(currRing))
pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
else
pLcm(p,strat->S[i],Lp.lcm);
#endif
pSetm(Lp.lcm);
// set coeffs of multipliers m1 and m2
if(rField_is_Ring(currRing))
{
number s = nCopy(pGetCoeff(strat->S[i]));
number t = nCopy(pGetCoeff(p));
pSetCoeff0(Lp.lcm, n_Lcm(s, t, currRing->cf));
ksCheckCoeff(&s, &t, currRing->cf);
pSetCoeff0(m1,s);
pSetCoeff0(m2,t);
}
else
{
pSetCoeff0(m1, nInit(1));
pSetCoeff0(m2, nInit(1));
}
#ifdef DEBUGF5
Print("P1 ");
pWrite(pHead(p));
Print("P2 ");
pWrite(pHead(strat->S[i]));
Print("M1 ");
pWrite(m1);
Print("M2 ");
pWrite(m2);
#endif
// get multiplied signatures for testing
pSigMult = pp_Mult_mm(pSigMult,m1,currRing);
if(pSigMult != NULL)
pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
sSigMult = pp_Mult_mm(sSigMult,m2,currRing);
if(sSigMult != NULL)
sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
//#if 1
#ifdef DEBUGF5
Print("----------------\n");
pWrite(pSigMult);
pWrite(sSigMult);
Print("----------------\n");
Lp.checked = 0;
#endif
int sigCmp;
if(pSigMult != NULL && sSigMult != NULL)
{
if(rField_is_Ring(currRing))
sigCmp = p_LtCmpNoAbs(pSigMult,sSigMult,currRing);
else
sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
}
else
{
if(pSigMult == NULL)
{
if(sSigMult == NULL)
sigCmp = 0;
else
sigCmp = -1;
}
else
sigCmp = 1;
}
//#if 1
#if DEBUGF5
Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
pWrite(pSigMult);
pWrite(sSigMult);
#endif
//In the ring case we already build the sig
if(rField_is_Ring(currRing))
{
if(sigCmp == 0)
{
//sigdrop since we loose the signature
strat->sigdrop = TRUE;
//Try to reduce it as far as we can via redRing
if(rField_is_Ring(currRing))
{
poly p1 = p_Copy(p,currRing);
poly p2 = p_Copy(strat->S[i],currRing);
p1 = p_Mult_mm(p1,m1,currRing);
p2 = p_Mult_mm(p2,m2,currRing);
Lp.p = p_Sub(p1,p2,currRing);
if(Lp.p != NULL)
Lp.sev = p_GetShortExpVector(Lp.p,currRing);
}
int red_result = redRing(&Lp,strat);
if(red_result == 0)
{
// Cancel the sigdrop
p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
strat->sigdrop = FALSE;
return;
}
else
{
strat->enterS(&strat->P,strat->sl+1,strat, strat->tl+1);
#if 1
strat->enterS(&Lp,0,strat,strat->tl);
#endif
return;
}
}
if(pSigMult != NULL && sSigMult != NULL && p_LmCmp(pSigMult,sSigMult,currRing) == 0)
{
//Same lm, have to subtract
Lp.sig = p_Sub(pCopy(pSigMult),pCopy(sSigMult),currRing);
}
else
{
if(sigCmp == 1)
{
Lp.sig = pCopy(pSigMult);
}
if(sigCmp == -1)
{
Lp.sig = pNeg(pCopy(sSigMult));
}
}
Lp.sevSig = p_GetShortExpVector(Lp.sig,currRing);
}
#if 0
if(sigCmp==0)
{
// printf("!!!! EQUAL SIGS !!!!\n");
// pSig = sSig, delete element due to Rewritten Criterion
pDelete(&pSigMult);
pDelete(&sSigMult);
if (rField_is_Ring(currRing))
pLmDelete(Lp.lcm);
else
pLmFree(Lp.lcm);
pDelete (&m1);
pDelete (&m2);
return;
}
#endif
// testing by syzCrit = F5 Criterion
// testing by rewCrit1 = Rewritten Criterion
// NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
strat->syzCrit(sSigMult,sSigMultNegSev,strat)
// With this rewCrit activated i get a wrong deletion in sba_int_56.tst
//|| strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
)
{
pDelete(&pSigMult);
pDelete(&sSigMult);
if (rField_is_Ring(currRing))
pLmDelete(Lp.lcm);
else
pLmFree(Lp.lcm);
pDelete (&m1);
pDelete (&m2);
return;
}
/*
*the pair (S[i],p) enters B if the spoly != 0
*/
/*- compute the short s-polynomial -*/
if (strat->fromT && !TEST_OPT_INTSTRATEGY)
pNorm(p);
if ((strat->S[i]==NULL) || (p==NULL))
return;
if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
Lp.p=NULL;
else
{
//Build p
if(rField_is_Ring(currRing))
{
poly p1 = p_Copy(p,currRing);
poly p2 = p_Copy(strat->S[i],currRing);
p1 = p_Mult_mm(p1,m1,currRing);
p2 = p_Mult_mm(p2,m2,currRing);
Lp.p = p_Sub(p1,p2,currRing);
if(Lp.p != NULL)
Lp.sev = p_GetShortExpVector(Lp.p,currRing);
}
else
{
#ifdef HAVE_PLURAL
if ( rIsPluralRing(currRing) )
{
if(ncRingType(currRing) == nc_lie)
{
// generalized prod-crit for lie-type
strat->cp++;
Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
}
else
if( ALLOW_PROD_CRIT(strat) )
{
// product criterion for homogeneous case in SCA
strat->cp++;
Lp.p = NULL;
}
else
{
Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
nc_CreateShortSpoly(strat->S[i], p, currRing);
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
}
else
#endif
{
assume(!rIsPluralRing(currRing));
Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
}
}
}
// store from which element this pair comes from for further tests
//Lp.from = strat->sl+1;
if(rField_is_Ring(currRing))
{
//Put the sig to be > 0
if(!nGreaterZero(pGetCoeff(Lp.sig)))
{
Lp.sig = pNeg(Lp.sig);
Lp.p = pNeg(Lp.p);
}
}
else
{
if(sigCmp==currRing->OrdSgn)
{
// pSig > sSig
pDelete (&sSigMult);
Lp.sig = pSigMult;
Lp.sevSig = ~pSigMultNegSev;
}
else
{
// pSig < sSig
pDelete (&pSigMult);
Lp.sig = sSigMult;
Lp.sevSig = ~sSigMultNegSev;
}
}
if (Lp.p == NULL)
{
if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
int pos = posInSyz(strat, Lp.sig);
enterSyz(Lp, strat, pos);
}
else
{
// testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
{
pLmFree(Lp.lcm);
pDelete(&Lp.sig);
pDelete (&m1);
pDelete (&m2);
return;
}
// in any case Lp is checked up to the next strat->P which is added
// to S right after this critical pair creation.
// NOTE: this even holds if the 2nd generator gives the bigger signature
// moreover, this improves rewCriterion,
// i.e. strat->checked > strat->from if and only if the 2nd generator
// gives the bigger signature.
Lp.checked = strat->sl+1;
// at this point it is clear that the pair will be added to L, since it has
// passed all tests up to now
// adds buchberger's first criterion
if (pLmCmp(m2,pHead(p)) == 0)
{
Lp.prod_crit = TRUE; // Product Criterion
#if 0
int pos = posInSyz(strat, Lp.sig);
enterSyz(Lp, strat, pos);
pDelete (&m1);
pDelete (&m2);
return;
#endif
}
pDelete (&m1);
pDelete (&m2);
#if DEBUGF5
PrintS("SIGNATURE OF PAIR: ");
pWrite(Lp.sig);
#endif
/*- the pair (S[i],p) enters B -*/
Lp.p1 = strat->S[i];
Lp.p2 = p;
if (
(!rIsPluralRing(currRing))
// || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
&& !rField_is_Ring(currRing)
)
{
assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
pNext(Lp.p) = strat->tail; // !!!
}
if (atR >= 0)
{
Lp.i_r1 = strat->S_2_R[i];
Lp.i_r2 = atR;
}
else
{
Lp.i_r1 = -1;
Lp.i_r2 = -1;
}
strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
if (TEST_OPT_INTSTRATEGY)
{
if (!rIsPluralRing(currRing)
&& !rField_is_Ring(currRing)
&& (Lp.p->coef!=NULL))
nDelete(&(Lp.p->coef));
}
// Check for sigdrop
if(rField_is_Ring(currRing) && pLtCmp(Lp.sig,pSig) == -1)
{
strat->sigdrop = TRUE;
// Completely reduce it
int red_result = redRing(&Lp,strat);
if(red_result == 0)
{
// Reduced to 0
strat->sigdrop = FALSE;
p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
return;
}
else
{
strat->enterS(&strat->P,strat->sl+1,strat, strat->tl+1);
// 0 - add just the original poly causing the sigdrop, 1 - add also this
#if 1
strat->enterS(&Lp,0,strat, strat->tl+1);
#endif
return;
}
}
l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
}
}
nGreaterZero
#define nGreaterZero(n)
Definition numbers.h:27
p_Sub
poly p_Sub(poly p1, poly p2, const ring r)
Definition p_polys.cc:1994
p_LtCmpNoAbs
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
Definition p_polys.h:1668
p_Mult_mm
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1053
pLtCmp
#define pLtCmp(p, q)
Definition polys.h:124

## enterOnePairSpecial()

void enterOnePairSpecial | ( | int | i,
|  | poly | p,
|  | int | ecart,
|  | kStrategy | strat,
|  | int | atR = -1 )

Definition at line 3092 of file kutil.cc.

{
//PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
if(pHasNotCF(p,strat->S[i]))
{
//PrintS("prod-crit\n");
if(ALLOW_PROD_CRIT(strat))
{
//PrintS("prod-crit\n");
strat->cp++;
return;
}
}
int l;
LObject Lp;
Lp.i_r = -1;
Lp.lcm = p_Lcm(p,strat->S[i],currRing);
/*- compute the short s-polynomial -*/
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
}
else
#endif
Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
if (Lp.p == NULL)
{
//PrintS("short spoly==NULL\n");
pLmFree(Lp.lcm);
}
else
{
/*- the pair (S[i],p) enters L -*/
Lp.p1 = strat->S[i];
Lp.p2 = p;
if (atR >= 0)
{
Lp.i_r1 = strat->S_2_R[i];
Lp.i_r2 = atR;
}
else
{
Lp.i_r1 = -1;
Lp.i_r2 = -1;
}
assume(pNext(Lp.p) == NULL);
pNext(Lp.p) = strat->tail;
strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
if (TEST_OPT_INTSTRATEGY)
{
if (!rIsPluralRing(currRing)
&& !rField_is_Ring(currRing)
&& (Lp.p->coef!=NULL))
nDelete(&(Lp.p->coef));
}
l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
//Print("-> L[%d]\n",l);
enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
}
}

## enterOnePairWithoutShifts()

BOOLEAN enterOnePairWithoutShifts | ( | int | p_inS,
|  | poly | q,
|  | poly | p,
|  | int | ecartq,
|  | int | q_isFromQ,
|  | kStrategy | strat,
|  | int | ,
|  | int | p_lastVblock,
|  | int | q_shift )

static

Definition at line 12105 of file kutil.cc.

{
// note: ecart and isFromQ is for p
assume(p_inS < 0 || strat->S[p_inS] == p); // if p is from S, p_inS should be the index of p in S
assume(pmFirstVblock(p) == 1);
assume(p_lastVblock == pmLastVblock(p));
assume(q_shift == pmFirstVblock(q) - 1);
// TODO: is ecartp = 0 still ok?
int ecartp = 0; //Hans says it's ok; we're in the homog e:, no ecart
int p_isFromQ = 0;
if (strat->fromQ != NULL && p_inS >= 0)
p_isFromQ = strat->fromQ[p_inS];
if (rField_is_Ring(currRing))
{
assume(q_shift <= p_lastVblock); // we allow the special case where there is no overlap
return enterOneStrongPolyAndEnterOnePairRingShift(q, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, q_shift, -1);
}
else
{
assume(q_shift <= p_lastVblock - ((pGetComp(q) > 0 || pGetComp(p) > 0) ? 0 : 1)); // there should be an overlap (in the module case epsilon overlap is also allowed)
return enterOnePairShift(q, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, q_shift, -1);
}
}
enterOneStrongPolyAndEnterOnePairRingShift
static BOOLEAN enterOneStrongPolyAndEnterOnePairRingShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
Definition kutil.cc:12034
enterOnePairShift
BOOLEAN enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
Definition kutil.cc:12143
pmFirstVblock
#define pmFirstVblock(p)
Definition shiftop.h:35
pmLastVblock
#define pmLastVblock(p)
Definition shiftop.h:33

## enterOnePairWithShifts()

BOOLEAN enterOnePairWithShifts | ( | int | q_inS,
|  | poly | q,
|  | poly | p,
|  | int | ecartp,
|  | int | p_isFromQ,
|  | kStrategy | strat,
|  | int | ,
|  | int | p_lastVblock,
|  | int | q_lastVblock )

static

Definition at line 12044 of file kutil.cc.

{
// note: ecart and isFromQ is for p
assume(q_inS < 0 || strat->S[q_inS] == q); // if q is from S, q_inS should be the index of q in S
assume(pmFirstVblock(p) == 1);
assume(pmFirstVblock(q) == 1);
assume(p_lastVblock == pmLastVblock(p));
assume(q_lastVblock == pmLastVblock(q));
// TODO: is ecartq = 0 still ok?
int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
int q_isFromQ = 0;
if (strat->fromQ != NULL && q_inS >= 0)
q_isFromQ = strat->fromQ[q_inS];
BOOLEAN (*enterPair)(poly, poly, int, int, kStrategy, int, int, int, int, int);
if (rField_is_Ring(currRing))
enterPair = enterOneStrongPolyAndEnterOnePairRingShift;
else
enterPair = enterOnePairShift;
int degbound = currRing->N/currRing->isLPring;
int neededShift = p_lastVblock - ((pGetComp(p) > 0 || pGetComp(q) > 0) ? 0 : 1); // in the module case, product criterion does not hold
int maxPossibleShift = degbound - q_lastVblock;
int maxShift = si_min(neededShift, maxPossibleShift);
int firstShift = (q == p ? 1 : 0); // do not add (q,p) if q=p
BOOLEAN delete_pair=TRUE;
for (int j = firstShift; j <= maxShift; j++)
{
poly qq = pLPCopyAndShiftLM(q, j);
if (enterPair(qq, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, j, q_inS))
{
if (j>0) pLmDelete(qq);
// delete qq, if not it does not enter the pair set
}
else
delete_pair=FALSE;
}
if (rField_is_Ring(currRing) && p_lastVblock >= firstShift && p_lastVblock <= maxPossibleShift)
{
// add pairs (m*shifts(q), p) where m is a monomial and the pair has no overlap
for (int j = p_lastVblock; j <= maxPossibleShift; j++)
{
ideal fillers = id_MaxIdeal(j - p_lastVblock, currRing);
for (int k = 0; k < IDELEMS(fillers); k++)
{
poly qq = pLPCopyAndShiftLM(pp_mm_Mult(q, fillers->m[k], currRing), p_lastVblock);
enterPair(qq, p, ecartp, p_isFromQ, strat, -1, ecartq, q_isFromQ, p_lastVblock, q_inS);
}
idDelete(&fillers);
}
}
return delete_pair;
}
si_min
static int si_min(const int a, const int b)
Definition auxiliary.h:126
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
pLPCopyAndShiftLM
#define pLPCopyAndShiftLM(p, sh)
Definition shiftgb.h:15
id_MaxIdeal
ideal id_MaxIdeal(const ring r)
initialise the maximal ideal (at 0)
Definition simpleideals.cc:98
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
kStrategy
skStrategy * kStrategy
Definition structs.h:54
degbound
#define degbound(p)
Definition tgb.cc:153

## enterOneStrongPoly()

BOOLEAN enterOneStrongPoly | ( | int | i,
|  | poly | p,
|  | int | ,
|  | int | ,
|  | kStrategy | strat,
|  | int | atR,
|  | bool | enterTstrong )

static

Definition at line 1538 of file kutil.cc.

{
number d, s, t;
assume(atR >= 0);
assume(rField_is_Ring(currRing));
poly m1, m2, gcd,si;
if(!enterTstrong)
{
assume(i<=strat->sl);
si = strat->S[i];
}
else
{
assume(i<=strat->tl);
si = strat->T[i].p;
}
//printf("\n--------------------------------\n");
//pWrite(p);pWrite(si);
d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return FALSE;
}
k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
if (!rHasLocalOrMixedOrdering(currRing))
{
unsigned long sev = pGetShortExpVector(gcd);
for (int j = 0; j < strat->sl; j++)
{
if (j == i)
continue;
if (n_DivBy(d, pGetCoeff(strat->S[j]), currRing->cf)
&& !(strat->sevS[j] & ~sev)
&& p_LmDivisibleBy(strat->S[j], gcd, currRing))
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return FALSE;
}
}
}
//p_Test(m1,strat->tailRing);
//p_Test(m2,strat->tailRing);
/*if(!enterTstrong)
{
while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
{
memset(&(strat->P), 0, sizeof(strat->P));
kStratChangeTailRing(strat);
strat->P = *(strat->R[atR]);
p_LmFree(m1, strat->tailRing);
p_LmFree(m2, strat->tailRing);
p_LmFree(gcd, currRing);
k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
}
}*/
pSetCoeff0(m1, s);
pSetCoeff0(m2, t);
pSetCoeff0(gcd, d);
p_Test(m1,strat->tailRing);
p_Test(m2,strat->tailRing);
//printf("\n===================================\n");
//pWrite(m1);pWrite(m2);pWrite(gcd);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
// Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
PrintS("m1 = ");
p_wrp(m1, strat->tailRing);
PrintS(" ; m2 = ");
p_wrp(m2, strat->tailRing);
PrintS(" ; gcd = ");
wrp(gcd);
PrintS("\n--- create strong gcd poly: ");
Print("\n p: %d", i);
wrp(p);
Print("\n strat->S[%d]: ", i);
wrp(si);
PrintS(" ---> ");
}
#endif
pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
p_LmDelete(m1, strat->tailRing);
p_LmDelete(m2, strat->tailRing);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
wrp(gcd);
PrintLn();
}
#endif
LObject h;
h.p = gcd;
h.tailRing = strat->tailRing;
int posx;
strat->initEcart(&h);
h.sev = pGetShortExpVector(h.p);
h.i_r1 = -1;h.i_r2 = -1;
if (currRing!=strat->tailRing)
h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
if(!enterTstrong)
{
#if 1
h.p1 = p;h.p2 = strat->S[i];
#endif
if (atR >= 0)
{
h.i_r2 = strat->S_2_R[i];
h.i_r1 = atR;
}
else
{
h.i_r1 = -1;
h.i_r2 = -1;
}
if (strat->Ll==-1)
posx =0;
else
posx = strat->posInL(strat->L,strat->Ll,&h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
}
else
{
if(h.IsNull()) return FALSE;
//int red_result;
//reduzieren ist teur!!!
//if(strat->L != NULL)
//red_result = strat->red(&h,strat);
if(!h.IsNull())
{
enterT(&h, strat,-1);
//int pos = posInS(strat,strat->sl,h.p,h.ecart);
//strat->enterS(h,pos,strat,-1);
}
}
return TRUE;
}
k_GetStrongLeadTerms
KINLINE void k_GetStrongLeadTerms(const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring tailRing)
Definition kInline.h:1060
enterT
void enterT(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9143
p_LmDivisibleBy
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1912
rHasLocalOrMixedOrdering
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769

## enterOneStrongPolyAndEnterOnePairRingShift()

BOOLEAN enterOneStrongPolyAndEnterOnePairRingShift | ( | poly | q,
|  | poly | p,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR,
|  | int | ecartq,
|  | int | qisFromQ,
|  | int | shiftcount,
|  | int | ifromS )

static

Definition at line 12034 of file kutil.cc.

{
enterOneStrongPolyShift(q, p, ecart, isFromQ, strat, atR, ecartq, qisFromQ, shiftcount, ifromS); // "gpoly"
enterOnePairRingShift(q, p, ecart, isFromQ, strat, atR, ecartq, qisFromQ, shiftcount, ifromS); // "spoly"
return FALSE; // TODO: delete q?
}
enterOnePairRingShift
static void enterOnePairRingShift(poly q, poly p, int, int isFromQ, kStrategy strat, int atR, int, int qisFromQ, int shiftcount, int ifromS)
Definition kutil.cc:11790
enterOneStrongPolyShift
static BOOLEAN enterOneStrongPolyShift(poly q, poly p, int, int, kStrategy strat, int atR, int, int, int shiftcount, int ifromS)
Definition kutil.cc:11621

## enterOneStrongPolyShift()

BOOLEAN enterOneStrongPolyShift | ( | poly | q,
|  | poly | p,
|  | int | ,
|  | int | ,
|  | kStrategy | strat,
|  | int | atR,
|  | int | ,
|  | int | ,
|  | int | shiftcount,
|  | int | ifromS )

static

Definition at line 11621 of file kutil.cc.

{
number d, s, t;
/* assume(atR >= 0); */
assume(ifromS <= strat->sl);
assume(rField_is_Ring(currRing));
poly m1, m2, gcd;
//printf("\n--------------------------------\n");
//pWrite(p);pWrite(si);
d = n_ExtGcd(pGetCoeff(p), pGetCoeff(q), &s, &t, currRing->cf);
if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return FALSE;
}
assume(pIsInV(p));
k_GetStrongLeadTerms(p, q, currRing, m1, m2, gcd, strat->tailRing);
/* the V criterion */
if (!pmIsInV(gcd))
{
strat->cv++;
nDelete(&d);
nDelete(&s);
nDelete(&t);
pLmFree(gcd);
return FALSE;
}
// disabled for Letterplace because it is not so easy to check
/* if (!rHasLocalOrMixedOrdering(currRing)) { */
/* unsigned long sev = pGetShortExpVector(gcd); */
/* for (int j = 0; j < strat->sl; j++) { */
/* if (j == i) */
/* continue; */
/* if (n_DivBy(d, pGetCoeff(strat->S[j]), currRing->cf) && */
/* !(strat->sevS[j] & ~sev) && */
/* p_LmDivisibleBy(strat->S[j], gcd, currRing)) { */
/* nDelete(&d); */
/* nDelete(&s); */
/* nDelete(&t); */
/* return FALSE; */
/* } */
/* } */
/* } */
poly m12, m22;
assume(p_mFirstVblock(p, currRing) <= 1 || p_mFirstVblock(q, currRing) <= 1);
k_SplitFrame(m1, m12, si_max(p_mFirstVblock(p, currRing), 1), currRing);
k_SplitFrame(m2, m22, si_max(p_mFirstVblock(q, currRing), 1), currRing);
// manually free the coeffs, because pSetCoeff0 is used in the next step
n_Delete(&(m1->coef), currRing->cf);
n_Delete(&(m2->coef), currRing->cf);
//p_Test(m1,strat->tailRing);
//p_Test(m2,strat->tailRing);
/*if(!enterTstrong)
{
while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
{
memset(&(strat->P), 0, sizeof(strat->P));
kStratChangeTailRing(strat);
strat->P = *(strat->R[atR]);
p_LmFree(m1, strat->tailRing);
p_LmFree(m2, strat->tailRing);
p_LmFree(gcd, currRing);
k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
}
}*/
pSetCoeff0(m1, s);
pSetCoeff0(m2, t);
pSetCoeff0(gcd, d);
p_Test(m1,strat->tailRing);
p_Test(m2,strat->tailRing);
p_Test(m12,strat->tailRing);
p_Test(m22,strat->tailRing);
assume(pmIsInV(m1));
assume(pmIsInV(m2));
assume(pmIsInV(m12));
assume(pmIsInV(m22));
//printf("\n===================================\n");
//pWrite(m1);pWrite(m2);pWrite(gcd);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
// Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
PrintS("m1 = ");
p_wrp(m1, strat->tailRing);
PrintS("m12 = ");
p_wrp(m12, strat->tailRing);
PrintS(" ; m2 = ");
p_wrp(m2, strat->tailRing);
PrintS(" ; m22 = ");
p_wrp(m22, strat->tailRing);
PrintS(" ; gcd = ");
wrp(gcd);
PrintS("\n--- create strong gcd poly: ");
PrintS("\n p: ");
wrp(p);
Print("\n q (strat->S[%d]): ", ifromS);
wrp(q);
PrintS(" ---> ");
}
#endif
pNext(gcd) = p_Add_q(pp_Mult_mm(pp_mm_Mult(pNext(p), m1, strat->tailRing), m12, strat->tailRing), pp_Mult_mm(pp_mm_Mult(pNext(q), m2, strat->tailRing), m22, strat->tailRing), strat->tailRing);
p_LmDelete(m1, strat->tailRing);
p_LmDelete(m2, strat->tailRing);
p_LmDelete(m12, strat->tailRing);
p_LmDelete(m22, strat->tailRing);
assume(pIsInV(gcd));
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
wrp(gcd);
PrintLn();
}
#endif
LObject h;
h.p = gcd;
h.tailRing = strat->tailRing;
int posx;
strat->initEcart(&h);
h.sev = pGetShortExpVector(h.p);
h.i_r1 = -1;h.i_r2 = -1;
if (currRing!=strat->tailRing)
h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
#if 1
h.p1 = p;
h.p2 = q;
#endif
if (atR >= 0 && shiftcount == 0 && ifromS >= 0)
{
h.i_r2 = kFindInT(h.p1, strat);
h.i_r1 = atR;
}
else
{
h.i_r1 = -1;
h.i_r2 = -1;
}
if (strat->Ll==-1)
posx =0;
else
posx = strat->posInL(strat->L,strat->Ll,&h,strat);
assume(pIsInV(h.p));
assume(pIsInV(h.p1));
enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
return TRUE;
}

## enterOneStrongPolySig()

BOOLEAN enterOneStrongPolySig | ( | int | i,
|  | poly | p,
|  | poly | sig,
|  | int | ,
|  | int | ,
|  | kStrategy | strat,
|  | int | atR )

static

Definition at line 1746 of file kutil.cc.

{
number d, s, t;
assume(atR >= 0);
poly m1, m2, gcd,si;
assume(i<=strat->sl);
si = strat->S[i];
//printf("\n--------------------------------\n");
//pWrite(p);pWrite(si);
d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
return FALSE;
}
k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
//p_Test(m1,strat->tailRing);
//p_Test(m2,strat->tailRing);
/*if(!enterTstrong)
{
while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
{
memset(&(strat->P), 0, sizeof(strat->P));
kStratChangeTailRing(strat);
strat->P = *(strat->R[atR]);
p_LmFree(m1, strat->tailRing);
p_LmFree(m2, strat->tailRing);
p_LmFree(gcd, currRing);
k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
}
}*/
pSetCoeff0(m1, s);
pSetCoeff0(m2, t);
pSetCoeff0(gcd, d);
p_Test(m1,strat->tailRing);
p_Test(m2,strat->tailRing);
//printf("\n===================================\n");
//pWrite(m1);pWrite(m2);pWrite(gcd);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
// Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
PrintS("m1 = ");
p_wrp(m1, strat->tailRing);
PrintS(" ; m2 = ");
p_wrp(m2, strat->tailRing);
PrintS(" ; gcd = ");
wrp(gcd);
PrintS("\n--- create strong gcd poly: ");
Print("\n p: %d", i);
wrp(p);
Print("\n strat->S[%d]: ", i);
wrp(si);
PrintS(" ---> ");
}
#endif
pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
wrp(gcd);
PrintLn();
}
#endif
//Check and set the signatures
poly pSigMult = p_Copy(sig,currRing);
poly sSigMult = p_Copy(strat->sig[i],currRing);
pSigMult = p_Mult_mm(pSigMult,m1,currRing);
sSigMult = p_Mult_mm(sSigMult,m2,currRing);
p_LmDelete(m1, strat->tailRing);
p_LmDelete(m2, strat->tailRing);
poly pairsig;
if(pLmCmp(pSigMult,sSigMult) == 0)
{
//Same lm, have to add them
pairsig = p_Add_q(pSigMult,sSigMult,currRing);
//This might be zero
}
else
{
//Set the sig to either pSigMult or sSigMult
if(pLtCmp(pSigMult,sSigMult)==1)
{
pairsig = pSigMult;
pDelete(&sSigMult);
}
else
{
pairsig = sSigMult;
pDelete(&pSigMult);
}
}
LObject h;
h.p = gcd;
h.tailRing = strat->tailRing;
h.sig = pairsig;
int posx;
strat->initEcart(&h);
h.sev = pGetShortExpVector(h.p);
h.i_r1 = -1;h.i_r2 = -1;
if (currRing!=strat->tailRing)
h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
if(h.sig == NULL)
{
//sigdrop since we loose the signature
strat->sigdrop = TRUE;
//Try to reduce it as far as we can via redRing
int red_result = redRing(&h,strat);
if(red_result == 0)
{
// Cancel the sigdrop
p_Delete(&h.sig,currRing);h.sig = NULL;
strat->sigdrop = FALSE;
return FALSE;
}
else
{
strat->enterS(&strat->P,strat->sl+1,strat, strat->tl+1);
#if 1
strat->enterS(&h,0,strat,strat->tl);
#endif
return FALSE;
}
}
if(!nGreaterZero(pGetCoeff(h.sig)))
{
h.sig = pNeg(h.sig);
h.p = pNeg(h.p);
}
if(rField_is_Ring(currRing) && pLtCmp(h.sig,sig) == -1)
{
strat->sigdrop = TRUE;
// Completely reduce it
int red_result = redRing(&h,strat);
if(red_result == 0)
{
// Reduced to 0
strat->sigdrop = FALSE;
p_Delete(&h.sig,currRing);h.sig = NULL;
return FALSE;
}
else
{
strat->enterS(&strat->P,strat->sl+1,strat, strat->tl+1);
// 0 - add just the original poly causing the sigdrop, 1 - add also this
#if 1
strat->enterS(&h,0,strat, strat->tl+1);
#endif
return FALSE;
}
}
//Check for sigdrop
if(gcd != NULL && pLtCmp(sig,pairsig) > 0 && pLtCmp(strat->sig[i],pairsig) > 0)
{
strat->sigdrop = TRUE;
//Enter this element to S
strat->enterS(&strat->P,strat->sl+1,strat, strat->tl+1);
strat->enterS(&h,strat->sl+1,strat,strat->tl+1);
}
#if 1
h.p1 = p;h.p2 = strat->S[i];
#endif
if (atR >= 0)
{
h.i_r2 = strat->S_2_R[i];
h.i_r1 = atR;
}
else
{
h.i_r1 = -1;
h.i_r2 = -1;
}
if (strat->Ll==-1)
posx =0;
else
posx = strat->posInL(strat->L,strat->Ll,&h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
return TRUE;
}

## enterpairs()

void enterpairs | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 4487 of file kutil.cc.

{
int j=pos;
assume (!rField_is_Ring(currRing));
initenterpairs(h,k,ecart,0,strat, atR);
if ( (!strat->fromT)
&& ((strat->syzComp==0)
||(pGetComp(h)<=strat->syzComp)))
{
unsigned long h_sev = pGetShortExpVector(h);
loop
{
if (j > k) break;
clearS(h,h_sev, &j,&k,strat);
j++;
}
}
}
initenterpairs
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.cc:3809

## enterpairsShift()

void enterpairsShift | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 12927 of file kutil.cc.

{
/* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
/* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
int j=pos;
/* if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat); */ // TODO: enterExtendedSpoly not for LP yet
initenterpairsShift(h,k,ecart,0,strat, atR);
if ( (!strat->fromT)
&& ((strat->syzComp==0)
||(pGetComp(h)<=strat->syzComp)))
{
unsigned long h_sev = pGetShortExpVector(h);
loop
{
if (j > k) break;
// TODO this currently doesn't clear all possible elements because of commutative division
if (!(strat->rightGB && strat->fromQ != NULL && strat->fromQ[j]))
clearS(h,h_sev, &j,&k,strat);
j++;
}
}
}
skStrategy::rightGB
char rightGB
Definition kutil.h:366
initenterpairsShift
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.cc:12485

## enterpairsSig()

void enterpairsSig | ( | poly | h,
|  | poly | hSig,
|  | int | hFrom,
|  | int | k,
|  | int | ecart,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 4513 of file kutil.cc.

{
int j=pos;
assume (!rField_is_Ring(currRing));
initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
if ( (!strat->fromT)
&& ((strat->syzComp==0)
||(pGetComp(h)<=strat->syzComp)))
{
unsigned long h_sev = pGetShortExpVector(h);
loop
{
if (j > k) break;
clearS(h,h_sev, &j,&k,strat);
j++;
}
}
}
initenterpairsSig
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:3874

## enterpairsSpecial()

void enterpairsSpecial | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR = -1 )

Definition at line 4536 of file kutil.cc.

{
int j;
const int iCompH = pGetComp(h);
if (rField_is_Ring(currRing))
{
for (j=0; j<=k; j++)
{
const int iCompSj = pGetComp(strat->S[j]);
if ((iCompH==iCompSj)
//|| (0==iCompH) // can only happen,if iCompSj==0
|| (0==iCompSj))
{
enterOnePairRing(j,h,ecart,FALSE,strat, atR);
}
}
kMergeBintoL(strat);
}
else
{
for (j=0; j<=k; j++)
{
const int iCompSj = pGetComp(strat->S[j]);
if ((iCompH==iCompSj)
//|| (0==iCompH) // can only happen,if iCompSj==0
|| (0==iCompSj))
{
enterOnePairSpecial(j,h,ecart,strat, atR);
}
}
}
if (strat->noClearS) return;
// #ifdef HAVE_PLURAL
/*
if (rIsPluralRing(currRing))
{
j=pos;
loop
{
if (j > k) break;
if (pLmDivisibleBy(h, strat->S[j]))
{
deleteInS(j, strat);
j--;
k--;
}
j++;
}
}
else
*/
// #endif // ??? Why was the following cancellation disabled for non-commutative rings?
{
j=pos;
loop
{
unsigned long h_sev = pGetShortExpVector(h);
if (j > k) break;
clearS(h,h_sev,&j,&k,strat);
j++;
}
}
}
skStrategy::noClearS
char noClearS
Definition kutil.h:399
enterOnePairRing
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition kutil.cc:1334
enterOnePairSpecial
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
Definition kutil.cc:3092

## enterSBba()

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

Definition at line 8792 of file kutil.cc.

{
strat->news = TRUE;
/*- puts p to the standardbasis s at position at -*/
if (strat->sl == IDELEMS(strat->Shdl)-1)
{
strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
IDELEMS(strat->Shdl)*sizeof(unsigned long),
(IDELEMS(strat->Shdl)+setmaxTinc)
*sizeof(unsigned long));
strat->ecartS = (intset)omReallocSize(strat->ecartS,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmaxTinc)
*sizeof(int));
strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmaxTinc)
*sizeof(int));
if (strat->lenS!=NULL)
strat->lenS=(int*)omRealloc0Size(strat->lenS,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmaxTinc)
*sizeof(int));
if (strat->lenSw!=NULL)
strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
IDELEMS(strat->Shdl)*sizeof(wlen_type),
(IDELEMS(strat->Shdl)+setmaxTinc)
*sizeof(wlen_type));
if (strat->fromQ!=NULL)
{
strat->fromQ = (intset)omReallocSize(strat->fromQ,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
}
pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
IDELEMS(strat->Shdl)+=setmaxTinc;
strat->Shdl->m=strat->S;
}
if (atS <= strat->sl)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->S[atS+1]), &(strat->S[atS]),
(strat->sl - atS + 1)*sizeof(poly));
memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
(strat->sl - atS + 1)*sizeof(int));
memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
(strat->sl - atS + 1)*sizeof(unsigned long));
memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
(strat->sl - atS + 1)*sizeof(int));
if (strat->lenS!=NULL)
memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
(strat->sl - atS + 1)*sizeof(int));
if (strat->lenSw!=NULL)
memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
(strat->sl - atS + 1)*sizeof(wlen_type));
#else
for (i=strat->sl+1; i>=atS+1; i--)
{
strat->S[i] = strat->S[i-1];
strat->ecartS[i] = strat->ecartS[i-1];
strat->sevS[i] = strat->sevS[i-1];
strat->S_2_R[i] = strat->S_2_R[i-1];
}
if (strat->lenS!=NULL)
for (i=strat->sl+1; i>=atS+1; i--)
strat->lenS[i] = strat->lenS[i-1];
if (strat->lenSw!=NULL)
for (i=strat->sl+1; i>=atS+1; i--)
strat->lenSw[i] = strat->lenSw[i-1];
#endif
}
if (strat->fromQ!=NULL)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
(strat->sl - atS + 1)*sizeof(int));
#else
for (i=strat->sl+1; i>=atS+1; i--)
{
strat->fromQ[i] = strat->fromQ[i-1];
}
#endif
strat->fromQ[atS]=0;
}
/*- save result -*/
poly pp=p->p;
strat->S[atS] = pp;
if (strat->honey) strat->ecartS[atS] = p->ecart;
if (p->sev == 0)
p->sev = pGetShortExpVector(pp);
else
assume(p->sev == pGetShortExpVector(pp));
strat->sevS[atS] = p->sev;
strat->ecartS[atS] = p->ecart;
strat->S_2_R[atS] = atR;
strat->sl++;
}
pp
CanonicalForm FACTORY_PUBLIC pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f ).
Definition cf_gcd.cc:676
skStrategy::news
char news
Definition kutil.h:397
skStrategy::honey
char honey
Definition kutil.h:374
skStrategy::Shdl
ideal Shdl
Definition kutil.h:302
setmaxTinc
#define setmaxTinc
Definition kutil.h:35
intset
int * intset
Definition kutil.h:54
pEnlargeSet
void pEnlargeSet(poly **p, int l, int increment)
Definition p_polys.cc:3821

## enterSBbaShift()

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

Definition at line 8892 of file kutil.cc.

{
enterSBba(p, atS, strat, atR);
int maxPossibleShift = p_mLPmaxPossibleShift(p->p, strat->tailRing);
for (int i = maxPossibleShift; i > 0; i--)
{
// NOTE: don't use "shared tails" here. In rare cases it can cause problems
// in `kNF2` because of lazy poly normalizations.
LObject qq(p_Copy(p->p, strat->tailRing));
p_mLPshift(qq.p, i, strat->tailRing);
qq.shift = i;
strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart
int atS = posInS(strat, strat->sl, qq.p, qq.ecart); // S needs to stay sorted because this is for example assumed when searching S later
enterSBba(&qq, atS, strat, -1);
}
}
enterSBba
void enterSBba(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8792
posInS
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4663
p_mLPmaxPossibleShift
int p_mLPmaxPossibleShift(poly p, const ring r)
Definition shiftgb.cc:45
p_mLPshift
void p_mLPshift(poly m, int sh, const ring ri)
Definition shiftop.cc:362

## enterSSba()

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

Definition at line 8915 of file kutil.cc.

{
strat->news = TRUE;
/*- puts p to the standardbasis s at position at -*/
if (strat->sl == IDELEMS(strat->Shdl)-1)
{
strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
IDELEMS(strat->Shdl)*sizeof(unsigned long),
(IDELEMS(strat->Shdl)+setmax)
*sizeof(unsigned long));
strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
IDELEMS(strat->Shdl)*sizeof(unsigned long),
(IDELEMS(strat->Shdl)+setmax)
*sizeof(unsigned long));
strat->ecartS = (intset)omReallocSize(strat->ecartS,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmax)
*sizeof(int));
strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmax)
*sizeof(int));
if (strat->lenS!=NULL)
strat->lenS=(int*)omRealloc0Size(strat->lenS,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmax)
*sizeof(int));
if (strat->lenSw!=NULL)
strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
IDELEMS(strat->Shdl)*sizeof(wlen_type),
(IDELEMS(strat->Shdl)+setmax)
*sizeof(wlen_type));
if (strat->fromQ!=NULL)
{
strat->fromQ = (intset)omReallocSize(strat->fromQ,
IDELEMS(strat->Shdl)*sizeof(int),
(IDELEMS(strat->Shdl)+setmax)*sizeof(int));
}
pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmax);
pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmax);
IDELEMS(strat->Shdl)+=setmax;
strat->Shdl->m=strat->S;
}
// in a signature-based algorithm the following situation will never
// appear due to the fact that the critical pairs are already sorted
// by increasing signature.
// True. However, in the case of integers we need to put the element
// that caused the signature drop on the first position
if (atS <= strat->sl)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->S[atS+1]), &(strat->S[atS]),
(strat->sl - atS + 1)*sizeof(poly));
memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
(strat->sl - atS + 1)*sizeof(poly));
memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
(strat->sl - atS + 1)*sizeof(unsigned long));
memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
(strat->sl - atS + 1)*sizeof(int));
memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
(strat->sl - atS + 1)*sizeof(unsigned long));
memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
(strat->sl - atS + 1)*sizeof(int));
if (strat->lenS!=NULL)
memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
(strat->sl - atS + 1)*sizeof(int));
if (strat->lenSw!=NULL)
memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
(strat->sl - atS + 1)*sizeof(wlen_type));
#else
for (i=strat->sl+1; i>=atS+1; i--)
{
strat->S[i] = strat->S[i-1];
strat->ecartS[i] = strat->ecartS[i-1];
strat->sevS[i] = strat->sevS[i-1];
strat->S_2_R[i] = strat->S_2_R[i-1];
strat->sig[i] = strat->sig[i-1];
strat->sevSig[i] = strat->sevSig[i-1];
}
if (strat->lenS!=NULL)
for (i=strat->sl+1; i>=atS+1; i--)
strat->lenS[i] = strat->lenS[i-1];
if (strat->lenSw!=NULL)
for (i=strat->sl+1; i>=atS+1; i--)
strat->lenSw[i] = strat->lenSw[i-1];
#endif
}
if (strat->fromQ!=NULL)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
(strat->sl - atS + 1)*sizeof(int));
#else
for (i=strat->sl+1; i>=atS+1; i--)
{
strat->fromQ[i] = strat->fromQ[i-1];
}
#endif
strat->fromQ[atS]=0;
}
/*- save result -*/
strat->S[atS] = p->p;
strat->sig[atS] = p->sig; // TODO: get the correct signature in here!
if (strat->honey) strat->ecartS[atS] = p->ecart;
if (p->sev == 0)
p->sev = pGetShortExpVector(p->p);
else
assume(p->sev == pGetShortExpVector(p->p));
strat->sevS[atS] = p->sev;
// during the interreduction process of a signature-based algorithm we do not
// compute the signature at this point, but when the whole interreduction
// process finishes, i.e. f5c terminates!
if (p->sig != NULL)
{
if (p->sevSig == 0)
p->sevSig = pGetShortExpVector(p->sig);
else
assume(p->sevSig == pGetShortExpVector(p->sig));
strat->sevSig[atS] = p->sevSig; // TODO: get the correct signature in here!
}
strat->ecartS[atS] = p->ecart;
strat->S_2_R[atS] = atR;
strat->sl++;
#ifdef DEBUGF5
int k;
Print("--- LIST S: %d ---\n",strat->sl);
for(k=0;k<=strat->sl;k++)
{
pWrite(strat->sig[k]);
}
PrintS("--- LIST S END ---\n");
#endif
}
setmax
#define setmax
Definition kutil.h:30

## enterSyz()

void enterSyz | ( | LObject & | p,
|  | kStrategy | strat,
|  | int | atT )

Definition at line 9343 of file kutil.cc.

{
int i;
strat->newt = TRUE;
if (strat->syzl == strat->syzmax-1)
{
pEnlargeSet(&strat->syz,strat->syzmax,setmax);
strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
(strat->syzmax)*sizeof(unsigned long),
((strat->syzmax)+setmax)
*sizeof(unsigned long));
strat->syzmax += setmax;
}
if (atT < strat->syzl)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
(strat->syzl-atT+1)*sizeof(poly));
memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
(strat->syzl-atT+1)*sizeof(unsigned long));
#endif
for (i=strat->syzl; i>=atT+1; i--)
{
#ifndef ENTER_USE_MEMMOVE
strat->syz[i] = strat->syz[i-1];
strat->sevSyz[i] = strat->sevSyz[i-1];
#endif
}
}
//i = strat->syzl;
i = atT;
//Makes sure the syz saves just the signature
if(rField_is_Ring(currRing))
pNext(p.sig) = NULL;
strat->syz[atT] = p.sig;
strat->sevSyz[atT] = p.sevSig;
strat->syzl++;
#if F5DEBUG
Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
pWrite(strat->syz[atT]);
#endif
// recheck pairs in strat->L with new rule and delete correspondingly
int cc = strat->Ll;
while (cc>-1)
{
//printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
//printf("\npLmShDivBy(syz,L) = %i\nn_DivBy(L,syz) = %i\n pLtCmp(L,syz) = %i",p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],strat->L[cc].sig, ~strat->L[cc].sevSig, currRing), n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing), pLtCmp(strat->L[cc].sig,strat->syz[atT])==1);
if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
&&((!rField_is_Ring(currRing))
|| (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
)
{
//printf("\nYES!\n");
deleteInL(strat->L,&strat->Ll,cc,strat);
}
cc--;
}
//#if 1
#ifdef DEBUGF5
PrintS("--- Syzygies ---\n");
Print("syzl %d\n",strat->syzl);
Print("syzmax %d\n",strat->syzmax);
PrintS("--------------------------------\n");
for(i=0;i<=strat->syzl-1;i++)
{
Print("%d - ",i);
pWrite(strat->syz[i]);
}
PrintS("--------------------------------\n");
#endif
}
skStrategy::sevSyz
unsigned long * sevSyz
Definition kutil.h:322
skStrategy::syzmax
int syzmax
Definition kutil.h:348
skStrategy::syzl
int syzl
Definition kutil.h:348
skStrategy::syz
polyset syz
Definition kutil.h:306
skStrategy::newt
char newt
Definition kutil.h:398

## enterT()

void enterT | ( | LObject * | p,
|  | kStrategy | strat,
|  | int | atT )

Definition at line 9143 of file kutil.cc.

{
int i;
#ifdef PDEBUG
#ifdef HAVE_SHIFTBBA
if (currRing->isLPring && p->shift > 0)
{
// in this case, the order is not correct. test LM and tail separately
p_LmTest(p->p, currRing);
p_Test(pNext(p->p), currRing);
}
else
#endif
{
pp_Test(p->p, currRing, p->tailRing);
}
#endif
assume(strat->tailRing == p->tailRing);
// redMoraNF complains about this -- but, we don't really
// need this so far
assume(p->pLength == 0 || pLength(p->p) == p->pLength || rIsSyzIndexRing(currRing)); // modulo syzring
assume(!strat->homog || (p->FDeg == p->pFDeg()));
assume(!p->is_normalized || nIsOne(pGetCoeff(p->p)));
#ifdef KDEBUG
// do not put an LObject twice into T:
for(i=strat->tl;i>=0;i--)
{
if (p->p==strat->T[i].p)
{
printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
return;
}
}
#endif
#ifdef HAVE_TAIL_RING
if (currRing!=strat->tailRing)
{
p->t_p=p->GetLmTailRing();
}
#endif
strat->newt = TRUE;
if (atT < 0)
atT = strat->posInT(strat->T, strat->tl, *p);
if (strat->tl == strat->tmax-1)
enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,strat->tmax);
if (atT <= strat->tl)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->T[atT+1]), &(strat->T[atT]),
(strat->tl-atT+1)*sizeof(TObject));
memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
(strat->tl-atT+1)*sizeof(unsigned long));
#endif
for (i=strat->tl+1; i>=atT+1; i--)
{
#ifndef ENTER_USE_MEMMOVE
strat->T[i] = strat->T[i-1];
strat->sevT[i] = strat->sevT[i-1];
#endif
strat->R[strat->T[i].i_r] = &(strat->T[i]);
}
}
if ((strat->tailBin != NULL) && (pNext(p->p) != NULL))
{
#ifdef HAVE_SHIFTBBA
// letterplace: if p.shift > 0 then pNext(p.p) is already in the tailBin
if (!(currRing->isLPring && p->shift > 0))
#endif
{
pNext(p->p)=p_ShallowCopyDelete(pNext(p->p),
(strat->tailRing != NULL ?
strat->tailRing : currRing),
strat->tailBin);
if (p->t_p != NULL) pNext(p->t_p) = pNext(p->p);
}
}
strat->T[atT] = (TObject) *p;
//printf("\nenterT: add new: length = %i, ecart = %i\n",p.length,p.ecart);
if ((pNext(p->p) != NULL) && (!rIsLPRing(currRing)))
strat->T[atT].max_exp = p_GetMaxExpP(pNext(p->p), strat->tailRing);
else
strat->T[atT].max_exp = NULL;
strat->tl++;
strat->R[strat->tl] = &(strat->T[atT]);
strat->T[atT].i_r = strat->tl;
assume((p->sev == 0) || (pGetShortExpVector(p->p) == p->sev));
strat->sevT[atT] = (p->sev == 0 ? pGetShortExpVector(p->p) : p->sev);
kTest_T(&(strat->T[atT]),strat);
}
skStrategy::R
TObject ** R
Definition kutil.h:339
skStrategy::sevT
unsigned long * sevT
Definition kutil.h:324
skStrategy::tmax
int tmax
Definition kutil.h:349
skStrategy::tailBin
omBin tailBin
Definition kutil.h:344
skStrategy::posInT
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition kutil.h:282
skStrategy::homog
char homog
Definition kutil.h:369
enlargeT
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition kutil.cc:536
kTest_T
BOOLEAN kTest_T(TObject *T, kStrategy strat, int i, char TN)
Definition kutil.cc:789
pp_Test
#define pp_Test(p, lmRing, tailRing)
Definition p_polys.h:163
p_ShallowCopyDelete
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition p_polys.h:930
p_LmTest
#define p_LmTest(p, r)
Definition p_polys.h:162
rIsSyzIndexRing
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition ring.h:726

## enterT_strong()

void enterT_strong | ( | LObject * | p,
|  | kStrategy | strat,
|  | int | atT )

Definition at line 9242 of file kutil.cc.

{
assume(rField_is_Ring(currRing));
int i;
pp_Test(p->p, currRing, p->tailRing);
assume(strat->tailRing == p->tailRing);
// redMoraNF complains about this -- but, we don't really
// need this so far
assume(p->pLength == 0 || (int)pLength(p->p) == p->pLength || rIsSyzIndexRing(currRing)); // modulo syzring
assume(p->FDeg == p->pFDeg());
assume(!p->is_normalized || nIsOne(pGetCoeff(p->p)));
#ifdef KDEBUG
// do not put an LObject twice into T:
for(i=strat->tl;i>=0;i--)
{
if (p->p==strat->T[i].p)
{
printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
return;
}
}
#endif
#ifdef HAVE_TAIL_RING
if (currRing!=strat->tailRing)
{
p->t_p=p->GetLmTailRing();
}
#endif
strat->newt = TRUE;
if (atT < 0)
atT = strat->posInT(strat->T, strat->tl, *p);
if (strat->tl == strat->tmax-1)
enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,strat->tmax);
if (atT <= strat->tl)
{
#ifdef ENTER_USE_MEMMOVE
memmove(&(strat->T[atT+1]), &(strat->T[atT]),
(strat->tl-atT+1)*sizeof(TObject));
memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
(strat->tl-atT+1)*sizeof(unsigned long));
#endif
for (i=strat->tl+1; i>=atT+1; i--)
{
#ifndef ENTER_USE_MEMMOVE
strat->T[i] = strat->T[i-1];
strat->sevT[i] = strat->sevT[i-1];
#endif
strat->R[strat->T[i].i_r] = &(strat->T[i]);
}
}
if ((strat->tailBin != NULL) && (pNext(p->p) != NULL))
{
pNext(p->p)=p_ShallowCopyDelete(pNext(p->p),
(strat->tailRing != NULL ?
strat->tailRing : currRing),
strat->tailBin);
if (p->t_p != NULL) pNext(p->t_p) = pNext(p->p);
}
strat->T[atT] = (TObject) *p;
//printf("\nenterT_strong: add new: length = %i, ecart = %i\n",p.length,p.ecart);
if (pNext(p->p) != NULL)
strat->T[atT].max_exp = p_GetMaxExpP(pNext(p->p), strat->tailRing);
else
strat->T[atT].max_exp = NULL;
strat->tl++;
strat->R[strat->tl] = &(strat->T[atT]);
strat->T[atT].i_r = strat->tl;
assume(p->sev == 0 || pGetShortExpVector(p->p) == p->sev);
strat->sevT[atT] = (p->sev == 0 ? pGetShortExpVector(p->p) : p->sev);
#if 1
if(rHasLocalOrMixedOrdering(currRing)
&& !n_IsUnit(p->p->coef, currRing->cf))
{
for(i=strat->tl;i>=0;i--)
{
if(strat->T[i].ecart <= p->ecart && pLmDivisibleBy(strat->T[i].p,p->p))
{
enterOneStrongPoly(i,p->p,p->ecart,0,strat,0 , TRUE);
}
}
}
/*
printf("\nThis is T:\n");
for(i=strat->tl;i>=0;i--)
{
pWrite(strat->T[i].p);
}
//getchar();*/
#endif
kTest_T(&(strat->T[atT]),strat);
}
n_IsUnit
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

## enterTShift()

void enterTShift | ( | LObject * | p,
|  | kStrategy | strat,
|  | int | atT )

Definition at line 12957 of file kutil.cc.

{
/* determine how many elements we have to insert */
/* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
/* hence, a total number of elt's to add is: */
/* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
pAssume(p->p != NULL);
int maxPossibleShift = p_mLPmaxPossibleShift(p->p, strat->tailRing);
for (int i = 1; i <= maxPossibleShift; i++)
{
LObject qq;
qq.p = pLPCopyAndShiftLM(p->p, i); // don't use Set() because it'll test the poly order
qq.shift = i;
strat->initEcart(&qq); // initEcartBBA sets length, pLength, FDeg and ecart
enterT(&qq, strat, atT); // enterT is modified, so it doesn't copy and delete the tail of shifted polys
}
}
pAssume
#define pAssume(cond)
Definition monomials.h:90

## exitBuchMora()

void exitBuchMora | ( | kStrategy | strat | ) |

Definition at line 9837 of file kutil.cc.

{
/*- release temp data -*/
cleanT(strat);
omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
/*- set L: should be empty -*/
omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
/*- set B: should be empty -*/
omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
pLmFree(&strat->tail);
strat->syzComp=0;
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing) && strat->rightGB)
{
if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
strat->fromQ=NULL;
}
#endif
}
ADDRESS
void * ADDRESS
Definition auxiliary.h:120
cleanT
void cleanT(kStrategy strat)
Definition kutil.cc:557

## exitSba()

void exitSba | ( | kStrategy | strat | ) |

Definition at line 10011 of file kutil.cc.

{
/*- release temp data -*/
if(rField_is_Ring(currRing))
cleanTSbaRing(strat);
else
cleanT(strat);
omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
if(strat->syzmax>0)
{
omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
if (strat->sbaOrder == 1)
{
omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
}
}
omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
/*- set L: should be empty -*/
omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
/*- set B: should be empty -*/
omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
/*- set sig: no need for the signatures anymore -*/
omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
pLmDelete(&strat->tail);
strat->syzComp=0;
}
skStrategy::syzidxmax
int syzidxmax
Definition kutil.h:348
skStrategy::syzIdx
intset syzIdx
Definition kutil.h:312
skStrategy::sbaOrder
unsigned sbaOrder
Definition kutil.h:315
cleanTSbaRing
void cleanTSbaRing(kStrategy strat)
Definition kutil.cc:616

## faugereRewCriterion()

BOOLEAN faugereRewCriterion | ( | poly | sig,
|  | unsigned long | not_sevSig,
|  | poly | lm,
|  | kStrategy | strat,
|  | int | start = 0 )

Definition at line 6562 of file kutil.cc.

{
//printf("Faugere Rewritten Criterion\n");
if(rField_is_Ring(currRing))
return FALSE;
//#if 1
#ifdef DEBUGF5
PrintS("rewritten criterion checks: ");
pWrite(sig);
#endif
for(int k = strat->sl; k>=start; k--)
{
//#if 1
#ifdef DEBUGF5
PrintS("checking with: ");
pWrite(strat->sig[k]);
pWrite(pHead(strat->S[k]));
#endif
if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
{
//#if 1
#ifdef DEBUGF5
PrintS("DELETE!\n");
#endif
strat->nrrewcrit++;
return TRUE;
}
//k--;
}
#ifdef DEBUGF5
PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
for(int kk = 0; kk<strat->sl+1; kk++)
{
pWrite(pHead(strat->S[kk]));
}
PrintS("------------------------------\n");
#endif
return FALSE;
}
skStrategy::nrrewcrit
int nrrewcrit
Definition kutil.h:359

## finalReduceByMon()

void finalReduceByMon | ( | kStrategy | strat | ) |

used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output

Definition at line 10847 of file kutil.cc.

{
assume(strat->tl<0); /* can only be called with no elements in T:
i.e. after exitBuchMora */
/* do not use strat->S, strat->sl as they may be out of sync*/
if(!nCoeff_is_Z(currRing->cf))
return;
poly p,pp;
for(int j = 0; j<IDELEMS(strat->Shdl); j++)
{
if((strat->Shdl->m[j]!=NULL)&&(pNext(strat->Shdl->m[j]) == NULL))
{
for(int i = 0; i<IDELEMS(strat->Shdl); i++)
{
if((i != j) && (strat->Shdl->m[i] != NULL))
{
p = strat->Shdl->m[i];
while((p!=NULL) && (pLmDivisibleBy(strat->Shdl->m[j], p)
#if HAVE_SHIFTBBA
|| (rIsLPRing(currRing) && pLPLmDivisibleBy(strat->Shdl->m[j], p))
#endif
))
{
number dummy = n_IntMod(p->coef, strat->Shdl->m[j]->coef, currRing->cf);
if (!nEqual(dummy,p->coef))
{
if (nIsZero(dummy))
{
nDelete(&dummy);
pLmDelete(&strat->Shdl->m[i]);
p=strat->Shdl->m[i];
}
else
{
p_SetCoeff(p,dummy,currRing);
break;
}
}
else
{
nDelete(&dummy);
break;
}
}
if (p!=NULL)
{
pp = pNext(p);
while(pp != NULL)
{
if(pLmDivisibleBy(strat->Shdl->m[j], pp)
#if HAVE_SHIFTBBA
|| (rIsLPRing(currRing) && pLPLmDivisibleBy(strat->Shdl->m[j], pp))
#endif
)
{
number dummy = n_IntMod(pp->coef, strat->Shdl->m[j]->coef, currRing->cf);
if (!nEqual(dummy,pp->coef))
{
p_SetCoeff(pp,dummy,currRing);
if(nIsZero(pp->coef))
{
pLmDelete(&pNext(p));
pp = pNext(p);
}
else
{
p = pp;
pp = pNext(p);
}
}
else
{
nDelete(&dummy);
p = pp;
pp = pNext(p);
}
}
else
{
p = pp;
pp = pNext(p);
}
}
}
}
}
//idPrint(strat->Shdl);
}
}
idSkipZeroes(strat->Shdl);
}
nCoeff_is_Z
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition coeffs.h:811
n_IntMod
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,...
Definition coeffs.h:631
nEqual
#define nEqual(n1, n2)
Definition numbers.h:20
p_SetCoeff
static number p_SetCoeff(poly p, number n, ring r)
Definition p_polys.h:414
pLmDivisibleBy
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition polys.h:141
pLPLmDivisibleBy
#define pLPLmDivisibleBy(a, b)
Definition shiftop.h:58
idSkipZeroes
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
Definition simpleideals.cc:201

## getIndexRng()

int getIndexRng | ( | long | coeff | ) |

inline

Definition at line 6000 of file kutil.cc.

{
if (coeff == 0) return -1;
long tmp = coeff;
int ind = 0;
while (tmp % 2 == 0)
{
tmp = tmp / 2;
ind++;
}
return ind;
}

## HEckeTest()

void HEckeTest | ( | poly | pp,
|  | kStrategy | strat )

Definition at line 493 of file kutil.cc.

{
int j,p;
if (currRing->pLexOrder
|| rHasMixedOrdering(currRing)
|| (strat->ak >1)
|| (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(pp),currRing->cf))))
{
return;
}
p=pIsPurePower(pp);
if (p!=0)
strat->NotUsedAxis[p] = FALSE;
/*- the leading term of pp is a power of the p-th variable -*/
for (j=(currRing->N);j>0; j--)
{
if (strat->NotUsedAxis[j])
{
strat->kAllAxis=FALSE;
return;
}
}
strat->kAllAxis=TRUE;
}
skStrategy::NotUsedAxis
BOOLEAN * NotUsedAxis
Definition kutil.h:331
skStrategy::kAllAxis
char kAllAxis
Definition kutil.h:373
pIsPurePower
#define pIsPurePower(p)
Definition polys.h:249
rHasMixedOrdering
static BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:770

## initBuchMora()

void initBuchMora | ( | ideal | F,
|  | ideal | Q,
|  | kStrategy | strat )

Definition at line 9749 of file kutil.cc.

{
strat->interpt = BTEST1(OPT_INTERRUPT);
/*- creating temp data structures------------------- -*/
//strat->cp = 0; // already by skStragy()
//strat->c3 = 0; // already by skStragy()
#ifdef HAVE_SHIFTBBA
strat->cv = 0; // already by skStragy()
#endif
strat->tail = pInit();
/*- set s -*/
strat->sl = -1;
/*- set L -*/
strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
strat->Ll = -1;
strat->L = initL(strat->Lmax);
/*- set B -*/
strat->Bmax = setmaxL;
strat->Bl = -1;
strat->B = initL();
/*- set T -*/
strat->tl = -1;
strat->tmax = setmaxT;
strat->T = initT();
strat->R = initR();
strat->sevT = initsevT();
/*- init local data struct.---------------------------------------- -*/
//strat->P.ecart=0; // already by skStragy()
//strat->P.length=0; // already by skStragy()
//strat->P.pLength=0; // already by skStragy()
if (rHasLocalOrMixedOrdering(currRing))
{
if (strat->kNoether!=NULL)
{
pSetComp(strat->kNoether, strat->ak);
pSetComp(strat->kNoetherTail(), strat->ak);
}
}
if(rField_is_Ring(currRing))
{
/*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
}
else
{
if(TEST_OPT_SB_1)
{
int i;
ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
for (i=strat->newIdeal;i<IDELEMS(F);i++)
{
P->m[i-strat->newIdeal] = F->m[i];
F->m[i] = NULL;
}
initSSpecial(F,Q,P,strat);
for (i=strat->newIdeal;i<IDELEMS(F);i++)
{
F->m[i] = P->m[i-strat->newIdeal];
P->m[i-strat->newIdeal] = NULL;
}
idDelete(&P);
}
else
{
/*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
// /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
}
if(errorreported) return;
}
strat->fromT = FALSE;
strat->noTailReduction = !TEST_OPT_REDTAIL;
if ((!TEST_OPT_SB_1)
|| (rField_is_Ring(currRing))
)
{
updateS(TRUE,strat);
}
#ifdef HAVE_SHIFTBBA
if (!(rIsLPRing(currRing) && strat->rightGB)) // for right GB, we need to check later whether a poly is from Q
#endif
{
if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
strat->fromQ=NULL;
}
#ifdef KDEBUG
assume(kTest_TS(strat));
#endif
}
skStrategy::interpt
char interpt
Definition kutil.h:368
skStrategy::newIdeal
int newIdeal
Definition kutil.h:355
errorreported
VAR short errorreported
Definition feFopen.cc:23
initT
KINLINE TSet initT()
Definition kInline.h:84
initR
KINLINE TObject ** initR()
Definition kInline.h:95
initsevT
KINLINE unsigned long * initsevT()
Definition kInline.h:100
initSSpecial
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition kutil.cc:8088
updateS
void updateS(BOOLEAN toT, kStrategy strat)
Definition kutil.cc:8557
initSL
void initSL(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7679
setmaxL
#define setmaxL
Definition kutil.h:31
initL
static LSet initL(int nr=setmaxL)
Definition kutil.h:417
setmaxT
#define setmaxT
Definition kutil.h:34
setmaxLinc
#define setmaxLinc
Definition kutil.h:32
TEST_OPT_REDTAIL
#define TEST_OPT_REDTAIL
Definition options.h:118
TEST_OPT_SB_1
#define TEST_OPT_SB_1
Definition options.h:121
OPT_INTERRUPT
#define OPT_INTERRUPT
Definition options.h:80
BTEST1
#define BTEST1(a)
Definition options.h:34
pSetComp
#define pSetComp(p, v)
Definition polys.h:39
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
Q
#define Q
Definition sirandom.c:26

## initBuchMoraCrit()

void initBuchMoraCrit | ( | kStrategy | strat | ) |

Definition at line 9435 of file kutil.cc.

{
strat->enterOnePair=enterOnePairNormal;
strat->chainCrit=chainCritNormal;
if (TEST_OPT_SB_1)
strat->chainCrit=chainCritOpt_1;
if (rField_is_Ring(currRing))
{
strat->enterOnePair=enterOnePairRing;
strat->chainCrit=chainCritRing;
}
#ifdef HAVE_RATGRING
if (rIsRatGRing(currRing))
{
strat->chainCrit=chainCritPart;
/* enterOnePairNormal get rational part in it */
}
#endif
if (TEST_OPT_IDLIFT
&& (strat->syzComp==1)
&& (!rIsPluralRing(currRing)))
strat->enterOnePair=enterOnePairLift;
strat->sugarCrit = TEST_OPT_SUGARCRIT;
strat->Gebauer = strat->homog || strat->sugarCrit;
strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
strat->pairtest = NULL;
/* always use tailreduction, except:
* - in local rings, - in lex order case, -in ring over extensions */
strat->noTailReduction = !TEST_OPT_REDTAIL;
//if(rHasMixedOrdering(currRing)==2)
//{
// strat->noTailReduction =TRUE;
//}
#ifdef HAVE_PLURAL
// and r is plural_ring
// hence this holds for r a rational_plural_ring
if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
{ //or it has non-quasi-comm type... later
strat->sugarCrit = FALSE;
strat->Gebauer = FALSE;
strat->honey = FALSE;
}
#endif
// Coefficient ring?
if (rField_is_Ring(currRing))
{
strat->sugarCrit = FALSE;
strat->Gebauer = FALSE;
strat->honey = FALSE;
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
if (strat->homog) PrintS("ideal/module is homogeneous\n");
else PrintS("ideal/module is not homogeneous\n");
}
#endif
}
skStrategy::chainCrit
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition kutil.h:290
skStrategy::z2homog
char z2homog
Definition kutil.h:371
skStrategy::enterOnePair
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition kutil.h:289
enterOnePairNormal
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:1939
chainCritOpt_1
void chainCritOpt_1(poly, int, kStrategy strat)
Definition kutil.cc:3445
enterOnePairLift
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:2221
chainCritPart
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3520
chainCritNormal
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition kutil.cc:3204
chainCritRing
void chainCritRing(poly p, int, kStrategy strat)
Definition kutil.cc:3996
rIsSCA
static bool rIsSCA(const ring r)
Definition nc.h:190
TEST_OPT_WEIGHTM
#define TEST_OPT_WEIGHTM
Definition options.h:123
TEST_OPT_IDLIFT
#define TEST_OPT_IDLIFT
Definition options.h:131
TEST_OPT_SUGARCRIT
#define TEST_OPT_SUGARCRIT
Definition options.h:109
TEST_OPT_NOT_SUGAR
#define TEST_OPT_NOT_SUGAR
Definition options.h:108

## initBuchMoraPos()

void initBuchMoraPos | ( | kStrategy | strat | ) |

Definition at line 9580 of file kutil.cc.

{
if (rHasGlobalOrdering(currRing))
{
if (strat->honey)
{
strat->posInL = posInL15;
// ok -- here is the deal: from my experiments for Singular-2-0
// I conclude that that posInT_EcartpLength is the best of
// posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
// see the table at the end of this file
if (TEST_OPT_OLDSTD)
strat->posInT = posInT15;
else
strat->posInT = posInT_EcartpLength;
}
else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
{
strat->posInL = posInL11;
strat->posInT = posInT11;
}
else if (TEST_OPT_INTSTRATEGY)
{
strat->posInL = posInL11;
strat->posInT = posInT11;
}
else
{
strat->posInL = posInL0;
strat->posInT = posInT0;
}
if (strat->homog)
{
strat->posInL = posInL110;
strat->posInT = posInT110;
}
}
else /* local/mixed ordering */
{
if (strat->homog)
{
strat->posInL = posInL11;
strat->posInT = posInT11;
}
else
{
if ((currRing->order[0]==ringorder_c)
||(currRing->order[0]==ringorder_C))
{
strat->posInL = posInL17_c;
strat->posInT = posInT17_c;
}
else
{
strat->posInL = posInL17;
strat->posInT = posInT17;
}
}
}
if (strat->minim>0) strat->posInL =posInLSpecial;
// for further tests only
if ((BTEST1(11)) || (BTEST1(12)))
strat->posInL = posInL11;
else if ((BTEST1(13)) || (BTEST1(14)))
strat->posInL = posInL13;
else if ((BTEST1(15)) || (BTEST1(16)))
strat->posInL = posInL15;
else if ((BTEST1(17)) || (BTEST1(18)))
strat->posInL = posInL17;
if (BTEST1(11))
strat->posInT = posInT11;
else if (BTEST1(13))
strat->posInT = posInT13;
else if (BTEST1(15))
strat->posInT = posInT15;
else if ((BTEST1(17)))
strat->posInT = posInT17;
else if ((BTEST1(19)))
strat->posInT = posInT19;
else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
strat->posInT = posInT1;
strat->posInLDependsOnLength = kPosInLDependsOnLength(strat->posInL);
}
skStrategy::minim
int minim
Definition kutil.h:356
skStrategy::posInLDependsOnLength
char posInLDependsOnLength
Definition kutil.h:386
posInL110
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6058
posInT17
int posInT17(const TSet set, const int length, LObject &p)
Definition kutil.cc:5278
posInT11
int posInT11(const TSet set, const int length, LObject &p)
Definition kutil.cc:4953
posInT1
int posInT1(const TSet set, const int length, LObject &p)
Definition kutil.cc:4896
posInT_EcartpLength
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:5146
posInT0
int posInT0(const TSet, const int length, LObject &)
Definition kutil.cc:4885
posInL13
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6145
kPosInLDependsOnLength
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition kutil.cc:9567
posInT13
int posInT13(const TSet set, const int length, LObject &p)
Definition kutil.cc:5117
posInL0
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5611
posInL15
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6180
posInT17_c
int posInT17_c(const TSet set, const int length, LObject &p)
Definition kutil.cc:5384
posInT15
int posInT15(const TSet set, const int length, LObject &p)
Definition kutil.cc:5184
posInLSpecial
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5567
posInL17
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6255
posInT110
int posInT110(const TSet set, const int length, LObject &p)
Definition kutil.cc:5029
posInT19
int posInT19(const TSet set, const int length, LObject &p)
Definition kutil.cc:5510
posInL17_c
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6348
posInL11
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5802
TEST_OPT_OLDSTD
#define TEST_OPT_OLDSTD
Definition options.h:125
ringorder_C
@ ringorder_C
Definition ring.h:74
ringorder_c
@ ringorder_c
Definition ring.h:73

## initBuchMoraPosRing()

void initBuchMoraPosRing | ( | kStrategy | strat | ) |

Definition at line 9664 of file kutil.cc.

{
if (rHasGlobalOrdering(currRing))
{
if (strat->honey)
{
strat->posInL = posInL15Ring;
// ok -- here is the deal: from my experiments for Singular-2-0
// I conclude that that posInT_EcartpLength is the best of
// posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
// see the table at the end of this file
if (TEST_OPT_OLDSTD)
strat->posInT = posInT15Ring;
else
strat->posInT = posInT_EcartpLength;
}
else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
{
strat->posInL = posInL11Ring;
strat->posInT = posInT11;
}
else if (TEST_OPT_INTSTRATEGY)
{
strat->posInL = posInL11Ring;
strat->posInT = posInT11;
}
else
{
strat->posInL = posInL0Ring;
strat->posInT = posInT0;
}
if (strat->homog)
{
strat->posInL = posInL110Ring;
strat->posInT = posInT110Ring;
}
}
else
{
if (strat->homog)
{
//printf("\nHere 3\n");
strat->posInL = posInL11Ring;
strat->posInT = posInT11Ring;
}
else
{
if ((currRing->order[0]==ringorder_c)
||(currRing->order[0]==ringorder_C))
{
strat->posInL = posInL17_cRing;
strat->posInT = posInT17_cRing;
}
else
{
strat->posInL = posInL11Ringls;
strat->posInT = posInT17Ring;
}
}
}
if (strat->minim>0) strat->posInL =posInLSpecial;
// for further tests only
if ((BTEST1(11)) || (BTEST1(12)))
strat->posInL = posInL11Ring;
else if ((BTEST1(13)) || (BTEST1(14)))
strat->posInL = posInL13;
else if ((BTEST1(15)) || (BTEST1(16)))
strat->posInL = posInL15Ring;
else if ((BTEST1(17)) || (BTEST1(18)))
strat->posInL = posInL17Ring;
if (BTEST1(11))
strat->posInT = posInT11Ring;
else if (BTEST1(13))
strat->posInT = posInT13;
else if (BTEST1(15))
strat->posInT = posInT15Ring;
else if ((BTEST1(17)))
strat->posInT = posInT17Ring;
else if ((BTEST1(19)))
strat->posInT = posInT19;
else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
strat->posInT = posInT1;
strat->posInLDependsOnLength = kPosInLDependsOnLength(strat->posInL);
}
posInL17Ring
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6299
posInL17_cRing
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6412
posInL11Ring
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5844
posInT110Ring
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5071
posInL110Ring
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6099
posInL0Ring
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5638
posInT11Ring
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:4989
posInL11Ringls
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5912
posInL15Ring
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:6215
posInT15Ring
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5238
posInT17Ring
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition kutil.cc:5339
posInT17_cRing
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition kutil.cc:5445

## initec()

intset initec | ( | const int | maxnr | ) |

inline static

Definition at line 522 of file kutil.cc.

{
return (intset)omAlloc(maxnr*sizeof(int));
}

## initEcartBBA()

void initEcartBBA | ( | TObject * | h | ) |

Definition at line 1301 of file kutil.cc.

{
h->FDeg = h->pFDeg();
(*h).ecart = 0;
h->length=h->pLength=pLength(h->p);
}

## initEcartNormal()

void initEcartNormal | ( | TObject * | h | ) |

Definition at line 1293 of file kutil.cc.

{
h->FDeg = h->pFDeg();
h->ecart = h->pLDeg() - h->FDeg;
// h->length is set by h->pLDeg
h->length=h->pLength=pLength(h->p);
}

## initEcartPairBba()

void initEcartPairBba | ( | LObject * | Lp,
|  | poly | f,
|  | poly | g,
|  | int | ecartF,
|  | int | ecartG )

Definition at line 1308 of file kutil.cc.

{
Lp->FDeg = Lp->pFDeg();
(*Lp).ecart = 0;
(*Lp).length = 0;
}

## initEcartPairMora()

void initEcartPairMora | ( | LObject * | Lp,
|  | poly | f,
|  | poly | g,
|  | int | ecartF,
|  | int | ecartG )

Definition at line 1315 of file kutil.cc.

{
Lp->FDeg = Lp->pFDeg();
(*Lp).ecart = si_max(ecartF,ecartG);
(*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
(*Lp).length = 0;
}
p_FDeg
static long p_FDeg(const poly p, const ring r)
Definition p_polys.h:382

## initenterpairs()

void initenterpairs | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 3809 of file kutil.cc.

{
if ((strat->syzComp==0)
|| (pGetComp(h)<=strat->syzComp))
{
int j;
BOOLEAN new_pair=FALSE;
if (pGetComp(h)==0)
{
/* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
if ((isFromQ)&&(strat->fromQ!=NULL))
{
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
new_pair=TRUE;
strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
else
{
new_pair=TRUE;
for (j=0; j<=k; j++)
{
strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
else
{
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
new_pair=TRUE;
strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
if (new_pair)
{
#ifdef HAVE_RATGRING
if (currRing->real_var_start>0)
chainCritPart(h,ecart,strat);
else
#endif
strat->chainCrit(h,ecart,strat);
}
kMergeBintoL(strat);
}
}

## initenterpairsShift()

void initenterpairsShift | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 12485 of file kutil.cc.

{
int h_lastVblock = pmLastVblock(h);
assume(h_lastVblock != 0 || pLmIsConstantComp(h));
// TODO: is it allowed to skip pairs with constants? also with constants from other components?
if (h_lastVblock == 0) return;
assume(pmFirstVblock(h) == 1);
/* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
// atR = -1;
if ((strat->syzComp==0)
|| (pGetComp(h)<=strat->syzComp))
{
int i,j;
BOOLEAN new_pair=FALSE;
int degbound = currRing->N/currRing->isLPring;
int maxShift = degbound - h_lastVblock;
if (pGetComp(h)==0)
{
if (strat->rightGB)
{
if (isFromQ)
{
// pairs (shifts(h),s[1..k]), (h, s[1..k])
for (i=0; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
BOOLEAN delete_hh=TRUE;
for (j=0; j<=k; j++)
{
if (strat->fromQ == NULL || !strat->fromQ[j])
{
new_pair=TRUE;
poly s = strat->S[j];
if (!enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i))
delete_hh=FALSE;
}
}
if (delete_hh) pLmDelete(hh);
}
}
else
{
new_pair=TRUE;
for (j=0; j<=k; j++)
{
poly s = strat->S[j];
if (strat->fromQ != NULL && strat->fromQ[j])
{
// pairs (shifts(s[j]),h), (s[j],h)
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
else
{
// pair (h, s[j])
enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0);
}
}
}
}
/* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
else if ((isFromQ)&&(strat->fromQ!=NULL))
{
// pairs (shifts(s[1..k]),h), (s[1..k],h)
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
new_pair=TRUE;
poly s = strat->S[j];
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
}
// pairs (shifts(h),s[1..k])
if (new_pair)
{
for (i=1; i<=maxShift; i++)
{
BOOLEAN delete_hh=TRUE;
poly hh = pLPCopyAndShiftLM(h, i);
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
poly s = strat->S[j];
int s_lastVblock = pmLastVblock(s);
if (i < s_lastVblock || (pGetComp(s) > 0 && i == s_lastVblock)) // in the module case, product criterion does not hold (note: comp h is always zero here)
{
if(!enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, s_lastVblock, i))
delete_hh=FALSE;
}
else if (rField_is_Ring(currRing))
{
assume(i >= s_lastVblock); // this is always the case, but just to be very sure
ideal fillers = id_MaxIdeal(i - s_lastVblock, currRing);
for (int k = 0; k < IDELEMS(fillers); k++)
{
poly hhh = pLPCopyAndShiftLM(pp_mm_Mult(h, fillers->m[k], currRing), s_lastVblock);
enterOnePairWithoutShifts(j, hhh, s, ecart, isFromQ, strat, atR, s_lastVblock, s_lastVblock);
}
idDelete(&fillers);
}
}
}
if (delete_hh) p_LmDelete(hh,currRing);
}
}
}
else
{
new_pair=TRUE;
// pairs (shifts(s[1..k]),h), (s[1..k],h)
for (j=0; j<=k; j++)
{
poly s = strat->S[j];
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
// pairs (shifts(h),s[1..k]), (shifts(h), h)
for (i=1; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
BOOLEAN delete_hh=TRUE;
for (j=0; j<=k; j++)
{
poly s = strat->S[j];
int s_lastVblock = pmLastVblock(s);
if (i < s_lastVblock || (pGetComp(s) > 0 && i == s_lastVblock)) // in the module case, product criterion does not hold (note: comp h is always zero here)
delete_hh=enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, s_lastVblock, i)
&& delete_hh;
else if (rField_is_Ring(currRing))
{
assume(i >= s_lastVblock); // this is always the case, but just to be very sure
ideal fillers = id_MaxIdeal(i - s_lastVblock, currRing);
for (int k = 0; k < IDELEMS(fillers); k++)
{
poly hhh = pLPCopyAndShiftLM(pp_mm_Mult(h, fillers->m[k], currRing), s_lastVblock);
enterOnePairWithoutShifts(j, hhh, s, ecart, isFromQ, strat, atR, s_lastVblock, s_lastVblock);
}
idDelete(&fillers);
}
}
if (i < h_lastVblock) // in the module case, product criterion does not hold (note: comp h is always zero here)
delete_hh=enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i)
&& delete_hh;
else if (rField_is_Ring(currRing))
{
assume(i >= h_lastVblock); // this is always the case, but just to be very sure
ideal fillers = id_MaxIdeal(i - h_lastVblock, currRing);
for (int k = 0; k < IDELEMS(fillers); k++)
{
poly hhh = pLPCopyAndShiftLM(pp_mm_Mult(h, fillers->m[k], currRing), h_lastVblock);
enterOnePairWithoutShifts(-1, hhh, h, ecart, isFromQ, strat, atR, h_lastVblock, h_lastVblock);
}
idDelete(&fillers);
}
if (delete_hh) pLmDelete(hh);
}
}
}
else
{
assume(isFromQ == 0); // an element from Q should always has 0 component
new_pair=TRUE;
if (strat->rightGB)
{
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
poly s = strat->S[j];
if (strat->fromQ != NULL && strat->fromQ[j])
{
// pairs (shifts(s[j]),h), (s[j],h)
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
else
{
// pair (h, s[j])
enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0);
}
}
}
}
else
{
// pairs (shifts(s[1..k]),h), (s[1..k],h)
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
poly s = strat->S[j];
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
}
// pairs (shifts(h),s[1..k]), (shifts(h), h)
for (i=1; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
poly s = strat->S[j];
int s_lastVblock = pmLastVblock(s);
if (i <= s_lastVblock) // in the module case, product criterion does not hold
enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, s_lastVblock, i);
else if (rField_is_Ring(currRing))
{
assume(i >= s_lastVblock); // this is always the case, but just to be very sure
ideal fillers = id_MaxIdeal(i - s_lastVblock, currRing);
for (int k = 0; k < IDELEMS(fillers); k++)
{
poly hhh = pLPCopyAndShiftLM(pp_mm_Mult(h, fillers->m[k], currRing), s_lastVblock);
enterOnePairWithoutShifts(j, hhh, s, ecart, isFromQ, strat, atR, s_lastVblock, s_lastVblock);
}
idDelete(&fillers);
}
}
}
if (i <= h_lastVblock) // in the module case, product criterion does not hold
enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i);
else if (rField_is_Ring(currRing))
{
assume(i >= h_lastVblock); // this is always the case, but just to be very sure
ideal fillers = id_MaxIdeal(i - h_lastVblock, currRing);
for (int k = 0; k < IDELEMS(fillers); k++)
{
BOOLEAN delete_hhh=TRUE;
poly hhh = pLPCopyAndShiftLM(pp_mm_Mult(h, fillers->m[k], currRing), h_lastVblock);
if(!enterOnePairWithoutShifts(-1, hhh, h, ecart, isFromQ, strat, atR, h_lastVblock, h_lastVblock))
delete_hhh=FALSE;
if (delete_hhh) p_LmDelete(hhh,currRing);
}
idDelete(&fillers);
}
}
}
}
if (new_pair)
{
strat->chainCrit(h,ecart,strat);
}
kMergeBintoL(strat);
}
}
enterOnePairWithShifts
static BOOLEAN enterOnePairWithShifts(int q_inS, poly q, poly p, int ecartp, int p_isFromQ, kStrategy strat, int, int p_lastVblock, int q_lastVblock)
Definition kutil.cc:12044
enterOnePairWithoutShifts
static BOOLEAN enterOnePairWithoutShifts(int p_inS, poly q, poly p, int ecartq, int q_isFromQ, kStrategy strat, int, int p_lastVblock, int q_shift)
Definition kutil.cc:12105
pLmIsConstantComp
#define pLmIsConstantComp(p)
like above, except that p must be != NULL
Definition polys.h:243

## initenterpairsSig()

void initenterpairsSig | ( | poly | h,
|  | poly | hSig,
|  | int | hFrom,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

Definition at line 3874 of file kutil.cc.

{
if ((strat->syzComp==0)
|| (pGetComp(h)<=strat->syzComp))
{
int j;
BOOLEAN new_pair=FALSE;
if (pGetComp(h)==0)
{
/* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
if ((isFromQ)&&(strat->fromQ!=NULL))
{
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
new_pair=TRUE;
enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
else
{
new_pair=TRUE;
for (j=0; j<=k; j++)
{
enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
else
{
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
new_pair=TRUE;
enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
if (new_pair)
{
#ifdef HAVE_RATGRING
if (currRing->real_var_start>0)
chainCritPart(h,ecart,strat);
else
#endif
strat->chainCrit(h,ecart,strat);
}
}
}
enterOnePairSig
static void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:2433

## initenterpairsSigRing()

void initenterpairsSigRing | ( | poly | h,
|  | poly | hSig,
|  | int | hFrom,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

Definition at line 3934 of file kutil.cc.

{
if ((strat->syzComp==0)
|| (pGetComp(h)<=strat->syzComp))
{
int j;
if (pGetComp(h)==0)
{
/* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
if ((isFromQ)&&(strat->fromQ!=NULL))
{
for (j=0; j<=k && !strat->sigdrop; j++)
{
if (!strat->fromQ[j])
{
enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
else
{
for (j=0; j<=k && !strat->sigdrop; j++)
{
enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
else
{
for (j=0; j<=k && !strat->sigdrop; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
//Print("j:%d, Ll:%d\n",j,strat->Ll);
}
}
}
#if 0
if (new_pair)
{
#ifdef HAVE_RATGRING
if (currRing->real_var_start>0)
chainCritPart(h,ecart,strat);
else
#endif
strat->chainCrit(h,ecart,strat);
}
#endif
}
}
enterOnePairSigRing
static void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:2690

## initenterstrongPairs()

void initenterstrongPairs | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

Definition at line 4152 of file kutil.cc.

{
if (!nIsOne(pGetCoeff(h)))
{
int j;
BOOLEAN new_pair=FALSE;
if (pGetComp(h)==0)
{
/* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
if ((isFromQ)&&(strat->fromQ!=NULL))
{
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
new_pair=TRUE;
enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
}
}
}
else
{
new_pair=TRUE;
for (j=0; j<=k; j++)
{
enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
}
}
}
else
{
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
new_pair=TRUE;
enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
}
}
}
if (new_pair)
{
#ifdef HAVE_RATGRING
if (currRing->real_var_start>0)
chainCritPart(h,ecart,strat);
else
#endif
strat->chainCrit(h,ecart,strat);
}
kMergeBintoL(strat);
}
}
enterOneStrongPoly
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition kutil.cc:1538

## initenterstrongPairsShift()

void initenterstrongPairsShift | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 12743 of file kutil.cc.

{
int h_lastVblock = pmLastVblock(h);
assume(h_lastVblock != 0 || pLmIsConstantComp(h));
// TODO: is it allowed to skip pairs with constants? also with constants from other components?
if (h_lastVblock == 0) return;
assume(pmFirstVblock(h) == 1);
/* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
// atR = -1;
if ((strat->syzComp==0)
|| (pGetComp(h)<=strat->syzComp))
{
int i,j;
BOOLEAN new_pair=FALSE;
int degbound = currRing->N/currRing->isLPring;
int maxShift = degbound - h_lastVblock;
if (pGetComp(h)==0)
{
if (strat->rightGB)
{
if (isFromQ)
{
// pairs (shifts(h),s[1..k]), (h, s[1..k])
for (i=0; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
for (j=0; j<=k; j++)
{
if (strat->fromQ == NULL || !strat->fromQ[j])
{
new_pair=TRUE;
poly s = strat->S[j];
enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
}
}
}
}
else
{
new_pair=TRUE;
for (j=0; j<=k; j++)
{
poly s = strat->S[j];
if (strat->fromQ != NULL && strat->fromQ[j])
{
// pairs (shifts(s[j]),h), (s[j],h)
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
else
{
// pair (h, s[j])
enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0);
}
}
}
}
/* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
else if ((isFromQ)&&(strat->fromQ!=NULL))
{
// pairs (shifts(s[1..k]),h), (s[1..k],h)
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
new_pair=TRUE;
poly s = strat->S[j];
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
}
// pairs (shifts(h),s[1..k])
if (new_pair)
{
for (i=1; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
for (j=0; j<=k; j++)
{
if (!strat->fromQ[j])
{
poly s = strat->S[j];
enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
}
}
}
}
}
else
{
new_pair=TRUE;
// pairs (shifts(s[1..k]),h), (s[1..k],h)
for (j=0; j<=k; j++)
{
poly s = strat->S[j];
// TODO: cache lastVblock of s[1..k] for later use
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
// pairs (shifts(h),s[1..k]), (shifts(h), h)
for (i=1; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
BOOLEAN delete_hh=TRUE;
for (j=0; j<=k; j++)
{
poly s = strat->S[j];
if(!enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i))
delete_hh=FALSE;
}
if(!enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i))
delete_hh=FALSE;
if (delete_hh) p_LmDelete(hh,currRing);
}
}
}
else
{
new_pair=TRUE;
if (strat->rightGB)
{
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
assume(isFromQ == 0); // this case is not handled here and should also never happen
poly s = strat->S[j];
if (strat->fromQ != NULL && strat->fromQ[j])
{
// pairs (shifts(s[j]),h), (s[j],h)
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
else
{
// pair (h, s[j])
enterOnePairWithoutShifts(j, h, s, ecart, isFromQ, strat, atR, pmLastVblock(s), 0);
}
}
}
}
else
{
// pairs (shifts(s[1..k]),h), (s[1..k],h)
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
poly s = strat->S[j];
enterOnePairWithShifts(j, s, h, ecart, isFromQ, strat, atR, h_lastVblock, pmLastVblock(s));
}
}
// pairs (shifts(h),s[1..k]), (shifts(h), h)
for (i=1; i<=maxShift; i++)
{
poly hh = pLPCopyAndShiftLM(h, i);
for (j=0; j<=k; j++)
{
if ((pGetComp(h)==pGetComp(strat->S[j]))
|| (pGetComp(strat->S[j])==0))
{
poly s = strat->S[j];
enterOnePairWithoutShifts(j, hh, s, ecart, isFromQ, strat, atR, pmLastVblock(s), i);
}
}
enterOnePairWithoutShifts(-1, hh, h, ecart, isFromQ, strat, atR, h_lastVblock, i);
}
}
}
if (new_pair)
{
strat->chainCrit(h,ecart,strat);
}
kMergeBintoL(strat);
}
}

## initenterstrongPairsSig()

void initenterstrongPairsSig | ( | poly | h,
|  | poly | hSig,
|  | int | k,
|  | int | ecart,
|  | int | isFromQ,
|  | kStrategy | strat,
|  | int | atR = -1 )

static

Definition at line 4207 of file kutil.cc.

{
const int iCompH = pGetComp(h);
if (!nIsOne(pGetCoeff(h)))
{
int j;
for (j=0; j<=k && !strat->sigdrop; j++)
{
// Print("j:%d, Ll:%d\n",j,strat->Ll);
// if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
// ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
if (((iCompH == pGetComp(strat->S[j]))
|| (0 == pGetComp(strat->S[j])))
&& ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
{
enterOneStrongPolySig(j,h,hSig,ecart,isFromQ,strat, atR);
}
}
}
}
enterOneStrongPolySig
static BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
Definition kutil.cc:1746

## initHilbCrit()

void initHilbCrit | ( | ideal | F,
|  | ideal | Q,
|  | bigintmat ** | hilb,
|  | kStrategy | strat )

Definition at line 9417 of file kutil.cc.

{
//if the ordering is local, then hilb criterion
//can be used also if the ideal is not homogeneous
if((rHasLocalOrMixedOrdering(currRing)) && (rHasMixedOrdering(currRing)==FALSE))
{
if(rField_is_Ring(currRing))
*hilb=NULL;
else
return;
}
if (strat->homog!=isHomog)
{
*hilb=NULL;
}
}
isHomog
@ isHomog
Definition structs.h:33

## initPairtest()

void initPairtest | ( | kStrategy | strat | ) |

Definition at line 678 of file kutil.cc.

{
strat->pairtest = (BOOLEAN *)omAlloc0((strat->sl+2)*sizeof(BOOLEAN));
}
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211

## initS()

void initS | ( | ideal | F,
|  | ideal | Q,
|  | kStrategy | strat )

Definition at line 7586 of file kutil.cc.

{
int i,pos;
if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
if (i<setmaxTinc) i=setmaxT;
strat->ecartS=initec(i);
strat->sevS=initsevS(i);
strat->S_2_R=initS_2_R(i);
strat->fromQ=NULL;
strat->Shdl=idInit(i,F->rank);
strat->S=strat->Shdl->m;
/*- put polys into S -*/
if (Q!=NULL)
{
strat->fromQ=initec(i);
memset(strat->fromQ,0,i*sizeof(int));
for (i=0; i<IDELEMS(Q); i++)
{
if (Q->m[i]!=NULL)
{
LObject h;
h.p = pCopy(Q->m[i]);
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h, strat);
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
{
pos = posInS(strat,strat->sl,h.p,h.ecart);
}
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat,-1);
strat->fromQ[pos]=1;
}
}
}
}
for (i=0; i<IDELEMS(F); i++)
{
if (F->m[i]!=NULL)
{
LObject h;
h.p = pCopy(F->m[i]);
if (rHasLocalOrMixedOrdering(currRing))
{
cancelunit(&h); /*- tries to cancel a unit -*/
deleteHC(&h, strat);
}
if (h.p!=NULL)
// do not rely on the input being a SB!
{
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
pos = posInS(strat,strat->sl,h.p,h.ecart);
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat,-1);
}
}
}
/*- test, if a unit is in F -*/
if ((strat->sl>=0)
&& n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
&& pIsConstant(strat->S[0]))
{
while (strat->sl>0) deleteInS(strat->sl,strat);
}
}
initec
static intset initec(const int maxnr)
Definition kutil.cc:522
initS_2_R
static int * initS_2_R(const int maxnr)
Definition kutil.cc:531
deleteInS
void deleteInS(int i, kStrategy strat)
Definition kutil.cc:1132
initsevS
static unsigned long * initsevS(const int maxnr)
Definition kutil.cc:527
cancelunit
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:365
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239

## initS_2_R()

int * initS_2_R | ( | const int | maxnr | ) |

inline static

Definition at line 531 of file kutil.cc.

{
return (int*)omAlloc0(maxnr*sizeof(int));
}

## initSbaBuchMora()

void initSbaBuchMora | ( | ideal | F,
|  | ideal | Q,
|  | kStrategy | strat )

Definition at line 9936 of file kutil.cc.

{
strat->interpt = BTEST1(OPT_INTERRUPT);
//strat->kNoether=NULL; // done by skStrategy
/*- creating temp data structures------------------- -*/
//strat->cp = 0; // done by skStrategy
//strat->c3 = 0; // done by skStrategy
strat->tail = pInit();
/*- set s -*/
strat->sl = -1;
/*- set ps -*/
strat->syzl = -1;
/*- set L -*/
strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
strat->Ll = -1;
strat->L = initL(strat->Lmax);
/*- set B -*/
strat->Bmax = setmaxL;
strat->Bl = -1;
strat->B = initL();
/*- set T -*/
strat->tl = -1;
strat->tmax = setmaxT;
strat->T = initT();
strat->R = initR();
strat->sevT = initsevT();
/*- init local data struct.---------------------------------------- -*/
//strat->P.ecart=0; // done by skStrategy
//strat->P.length=0; // done by skStrategy
if (rHasLocalOrMixedOrdering(currRing))
{
if (strat->kNoether!=NULL)
{
pSetComp(strat->kNoether, strat->ak);
pSetComp(strat->kNoetherTail(), strat->ak);
}
}
if(rField_is_Ring(currRing))
{
/*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
}
else
{
if(TEST_OPT_SB_1)
{
int i;
ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
for (i=strat->newIdeal;i<IDELEMS(F);i++)
{
P->m[i-strat->newIdeal] = F->m[i];
F->m[i] = NULL;
}
initSSpecialSba(F,Q,P,strat);
for (i=strat->newIdeal;i<IDELEMS(F);i++)
{
F->m[i] = P->m[i-strat->newIdeal];
P->m[i-strat->newIdeal] = NULL;
}
idDelete(&P);
}
else
{
initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
}
}
//strat->fromT = FALSE; // done by skStrategy
if (!TEST_OPT_SB_1)
{
if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
}
//if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
//strat->fromQ=NULL;
assume(kTest_TS(strat));
}
initSLSba
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7781
initSSpecialSba
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition kutil.cc:8236

## initSbaCrit()

void initSbaCrit | ( | kStrategy | strat | ) |

Definition at line 9498 of file kutil.cc.

{
//strat->enterOnePair=enterOnePairNormal;
strat->enterOnePair = enterOnePairNormal;
//strat->chainCrit=chainCritNormal;
strat->chainCrit = chainCritSig;
/******************************************
* rewCrit1 and rewCrit2 are already set in
* kSba() in kstd1.cc
*****************************************/
//strat->rewCrit1 = faugereRewCriterion;
if (strat->sbaOrder == 1)
{
strat->syzCrit = syzCriterionInc;
}
else
{
strat->syzCrit = syzCriterion;
}
if (rField_is_Ring(currRing))
{
strat->enterOnePair=enterOnePairRing;
strat->chainCrit=chainCritRing;
}
#ifdef HAVE_RATGRING
if (rIsRatGRing(currRing))
{
strat->chainCrit=chainCritPart;
/* enterOnePairNormal get rational part in it */
}
#endif
strat->sugarCrit = TEST_OPT_SUGARCRIT;
strat->Gebauer = strat->homog || strat->sugarCrit;
strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
strat->pairtest = NULL;
/* always use tailreduction, except:
* - in local rings, - in lex order case, -in ring over extensions */
strat->noTailReduction = !TEST_OPT_REDTAIL;
if(rHasMixedOrdering(currRing)) strat->noTailReduction =TRUE;
#ifdef HAVE_PLURAL
// and r is plural_ring
// hence this holds for r a rational_plural_ring
if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
{ //or it has non-quasi-comm type... later
strat->sugarCrit = FALSE;
strat->Gebauer = FALSE;
strat->honey = FALSE;
}
#endif
// Coefficient ring?
if (rField_is_Ring(currRing))
{
strat->sugarCrit = FALSE;
strat->Gebauer = FALSE ;
strat->honey = FALSE;
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
if (strat->homog) PrintS("ideal/module is homogeneous\n");
else PrintS("ideal/module is not homogeneous\n");
}
#endif
}
syzCriterionInc
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition kutil.cc:6513
chainCritSig
void chainCritSig(poly p, int, kStrategy strat)
Definition kutil.cc:3461
syzCriterion
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition kutil.cc:6478

## initSbaPos()

void initSbaPos | ( | kStrategy | strat | ) |

Definition at line 9863 of file kutil.cc.

{
if (rHasGlobalOrdering(currRing))
{
if (strat->honey)
{
if (TEST_OPT_OLDSTD)
strat->posInT = posInT15;
else
strat->posInT = posInT_EcartpLength;
}
else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
{
strat->posInT = posInT11;
}
else if (TEST_OPT_INTSTRATEGY)
{
strat->posInT = posInT11;
}
else
{
strat->posInT = posInT0;
}
if (strat->homog)
{
strat->posInT = posInT110;
}
}
else
{
if (strat->homog)
{
strat->posInT = posInT11;
}
else
{
if ((currRing->order[0]==ringorder_c)
||(currRing->order[0]==ringorder_C))
{
strat->posInT = posInT17_c;
}
else
{
strat->posInT = posInT17;
}
}
}
// for further tests only
if (BTEST1(11))
strat->posInT = posInT11;
else if (BTEST1(13))
strat->posInT = posInT13;
else if (BTEST1(15))
strat->posInT = posInT15;
else if ((BTEST1(17)))
strat->posInT = posInT17;
else if ((BTEST1(19)))
strat->posInT = posInT19;
else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
strat->posInT = posInT1;
if (rField_is_Ring(currRing))
{
strat->posInT = posInT11;
}
strat->posInLDependsOnLength = FALSE;
strat->posInL = posInLSig;
/*
if (rField_is_Ring(currRing))
{
strat->posInL = posInLSigRing;
}*/
}
posInLSig
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5669

## initsevS()

unsigned long * initsevS | ( | const int | maxnr | ) |

inline static

Definition at line 527 of file kutil.cc.

{
return (unsigned long*)omAlloc0(maxnr*sizeof(unsigned long));
}

## initSL()

void initSL | ( | ideal | F,
|  | ideal | Q,
|  | kStrategy | strat )

Definition at line 7679 of file kutil.cc.

{
int i,pos;
if (Q!=NULL)
{
i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
if (i<setmaxTinc) i=setmaxT;
}
else i=setmaxT;
strat->ecartS=initec(i);
strat->sevS=initsevS(i);
strat->S_2_R=initS_2_R(i);
strat->fromQ=NULL;
strat->Shdl=idInit(i,F->rank);
strat->S=strat->Shdl->m;
/*- put polys into S -*/
if (Q!=NULL)
{
strat->fromQ=initec(i);
memset(strat->fromQ,0,i*sizeof(int));
for (i=0; i<IDELEMS(Q); i++)
{
if (Q->m[i]!=NULL)
{
LObject h;
h.p = pCopy(Q->m[i]);
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h,strat);
cancelunit(&h); /*- tries to cancel a unit -*/
}
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
{
pos = posInS(strat,strat->sl,h.p,h.ecart);
}
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat,-1);
strat->fromQ[pos]=1;
}
if(errorreported) return;
}
}
}
for (i=0; i<IDELEMS(F); i++)
{
if (F->m[i]!=NULL)
{
LObject h;
h.p = pCopy(F->m[i]);
if (h.p!=NULL)
{
if (rHasLocalOrMixedOrdering(currRing))
{
cancelunit(&h); /*- tries to cancel a unit -*/
deleteHC(&h, strat);
}
if (h.p!=NULL)
{
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
if(errorreported) return;
strat->initEcart(&h);
if (strat->Ll==-1)
pos =0;
else
pos = strat->posInL(strat->L,strat->Ll,&h,strat);
h.sev = pGetShortExpVector(h.p);
enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
}
}
}
}
/*- test, if a unit is in F -*/
if ((strat->Ll>=0)
&& n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
&& pIsConstant(strat->L[strat->Ll].p))
{
while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
}
}

## initSLSba()

void initSLSba | ( | ideal | F,
|  | ideal | Q,
|  | kStrategy | strat )

Definition at line 7781 of file kutil.cc.

{
int i,pos;
if (Q!=NULL)
{
i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
if (i<setmaxTinc) i=setmaxT;
}
else i=setmaxT;
strat->ecartS = initec(i);
strat->sevS = initsevS(i);
strat->sevSig = initsevS(i);
strat->S_2_R = initS_2_R(i);
strat->fromQ = NULL;
strat->Shdl = idInit(i,F->rank);
strat->S = strat->Shdl->m;
strat->sig = (poly *)omAlloc0(i*sizeof(poly));
if (strat->sbaOrder != 1)
{
strat->syz = (poly *)omAlloc0(i*sizeof(poly));
strat->sevSyz = initsevS(i);
strat->syzmax = i;
strat->syzl = 0;
}
/*- put polys into S -*/
if (Q!=NULL)
{
strat->fromQ=initec(i);
memset(strat->fromQ,0,i*sizeof(int));
for (i=0; i<IDELEMS(Q); i++)
{
if (Q->m[i]!=NULL)
{
LObject h;
h.p = pCopy(Q->m[i]);
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h,strat);
}
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
{
pos = posInS(strat,strat->sl,h.p,h.ecart);
}
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat,-1);
strat->fromQ[pos]=1;
}
}
}
}
for (i=0; i<IDELEMS(F); i++)
{
if (F->m[i]!=NULL)
{
LObject h;
h.p = pCopy(F->m[i]);
h.sig = pOne();
//h.sig = pInit();
//p_SetCoeff(h.sig,nInit(1),currRing);
p_SetComp(h.sig,i+1,currRing);
// if we are working with the Schreyer order we generate it
// by multiplying the initial signatures with the leading monomial
// of the corresponding initial polynomials generating the ideal
// => we can keep the underlying monomial order and get a Schreyer
// order without any bigger overhead
if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
{
p_ExpVectorAdd (h.sig,F->m[i],currRing);
}
h.sevSig = pGetShortExpVector(h.sig);
#ifdef DEBUGF5
pWrite(h.p);
pWrite(h.sig);
#endif
if (h.p!=NULL)
{
if (rHasLocalOrMixedOrdering(currRing))
{
cancelunit(&h); /*- tries to cancel a unit -*/
deleteHC(&h, strat);
}
if (h.p!=NULL)
{
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
strat->initEcart(&h);
if (strat->Ll==-1)
pos =0;
else
pos = strat->posInL(strat->L,strat->Ll,&h,strat);
h.sev = pGetShortExpVector(h.p);
enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
}
}
/*
if (strat->sbaOrder != 1)
{
for(j=0;j<i;j++)
{
strat->syz[ctr] = pCopy(F->m[j]);
p_SetCompP(strat->syz[ctr],i+1,currRing);
// add LM(F->m[i]) to the signature to get a Schreyer order
// without changing the underlying polynomial ring at all
p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
// since p_Add_q() destroys all input
// data we need to recreate help
// each time
poly help = pCopy(F->m[i]);
p_SetCompP(help,j+1,currRing);
pWrite(strat->syz[ctr]);
pWrite(help);
printf("%d\n",pLmCmp(strat->syz[ctr],help));
strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
printf("%d. SYZ ",ctr);
pWrite(strat->syz[ctr]);
strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
ctr++;
}
strat->syzl = ps;
}
*/
}
}
/*- test, if a unit is in F -*/
if ((strat->Ll>=0)
&& n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
&& pIsConstant(strat->L[strat->Ll].p))
{
while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
}
}
p_ExpVectorAdd
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition p_polys.h:1432

## initSSpecial()

void initSSpecial | ( | ideal | F,
|  | ideal | Q,
|  | ideal | P,
|  | kStrategy | strat )

Definition at line 8088 of file kutil.cc.

{
int i,pos;
if (Q!=NULL)
{
i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
if (i<setmaxTinc) i=setmaxT;
}
else i=setmaxT;
i=((i+IDELEMS(F)+IDELEMS(P)+setmax-1)/setmax)*setmax;
strat->ecartS=initec(i);
strat->sevS=initsevS(i);
strat->S_2_R=initS_2_R(i);
strat->fromQ=NULL;
strat->Shdl=idInit(i,F->rank);
strat->S=strat->Shdl->m;
/*- put polys into S -*/
if (Q!=NULL)
{
strat->fromQ=initec(i);
memset(strat->fromQ,0,i*sizeof(int));
for (i=0; i<IDELEMS(Q); i++)
{
if (Q->m[i]!=NULL)
{
LObject h;
h.p = pCopy(Q->m[i]);
//if (TEST_OPT_INTSTRATEGY)
//{
// h.pCleardenom(); // also does remove Content
//}
//else
//{
// h.pNorm();
//}
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h,strat);
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
{
pos = posInS(strat,strat->sl,h.p,h.ecart);
}
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat, strat->tl+1);
enterT(&h, strat);
strat->fromQ[pos]=1;
}
}
}
}
/*- put polys into S -*/
for (i=0; i<IDELEMS(F); i++)
{
if (F->m[i]!=NULL)
{
LObject h;
h.p = pCopy(F->m[i]);
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h,strat);
}
else if (TEST_OPT_REDTAIL || TEST_OPT_REDSB)
{
h.p=redtailBba(h.p,strat->sl,strat);
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
pos = posInS(strat,strat->sl,h.p,h.ecart);
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat, strat->tl+1);
enterT(&h,strat);
}
}
}
for (i=0; i<IDELEMS(P); i++)
{
if (P->m[i]!=NULL)
{
LObject h;
h.p=pCopy(P->m[i]);
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom();
}
else
{
h.pNorm();
}
if(strat->sl>=0)
{
if (rHasGlobalOrdering(currRing))
{
h.p=redBba(h.p,strat->sl,strat);
if ((h.p!=NULL)&&(TEST_OPT_REDTAIL || TEST_OPT_REDSB))
{
h.p=redtailBba(h.p,strat->sl,strat);
}
}
else
{
h.p=redMora(h.p,strat->sl,strat);
}
if(h.p!=NULL)
{
strat->initEcart(&h);
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom();
}
else
{
h.is_normalized = 0;
h.pNorm();
}
h.sev = pGetShortExpVector(h.p);
h.SetpFDeg();
pos = posInS(strat,strat->sl,h.p,h.ecart);
enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
strat->enterS(&h,pos,strat, strat->tl+1);
enterT(&h,strat);
}
}
else
{
h.sev = pGetShortExpVector(h.p);
strat->initEcart(&h);
strat->enterS(&h,0,strat, strat->tl+1);
enterT(&h,strat);
}
}
}
}
redMora
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition kutil.cc:8512
redBba
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition kutil.cc:8488
enterpairsSpecial
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition kutil.cc:4536
TEST_OPT_REDSB
#define TEST_OPT_REDSB
Definition options.h:106

## initSSpecialSba()

void initSSpecialSba | ( | ideal | F,
|  | ideal | Q,
|  | ideal | P,
|  | kStrategy | strat )

Definition at line 8236 of file kutil.cc.

{
int i,pos;
if (Q!=NULL)
{
i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
if (i<setmaxTinc) i=setmaxT;
}
else i=setmaxT;
i=((i+IDELEMS(F)+IDELEMS(P)+setmax-1)/setmax)*setmax;
strat->sevS=initsevS(i);
strat->sevSig=initsevS(i);
strat->S_2_R=initS_2_R(i);
strat->fromQ=NULL;
strat->Shdl=idInit(i,F->rank);
strat->S=strat->Shdl->m;
strat->sig=(poly *)omAlloc0(i*sizeof(poly));
/*- put polys into S -*/
if (Q!=NULL)
{
strat->fromQ=initec(i);
memset(strat->fromQ,0,i*sizeof(int));
for (i=0; i<IDELEMS(Q); i++)
{
if (Q->m[i]!=NULL)
{
LObject h;
h.p = pCopy(Q->m[i]);
//if (TEST_OPT_INTSTRATEGY)
//{
// h.pCleardenom(); // also does remove Content
//}
//else
//{
// h.pNorm();
//}
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h,strat);
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
{
pos = posInS(strat,strat->sl,h.p,h.ecart);
}
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat, strat->tl+1);
enterT(&h, strat);
strat->fromQ[pos]=1;
}
}
}
}
/*- put polys into S -*/
for (i=0; i<IDELEMS(F); i++)
{
if (F->m[i]!=NULL)
{
LObject h;
h.p = pCopy(F->m[i]);
if (rHasLocalOrMixedOrdering(currRing))
{
deleteHC(&h,strat);
}
else if (TEST_OPT_REDTAIL || TEST_OPT_REDSB)
{
h.p=redtailBba(h.p,strat->sl,strat);
}
if (h.p!=NULL)
{
strat->initEcart(&h);
if (strat->sl==-1)
pos =0;
else
pos = posInS(strat,strat->sl,h.p,h.ecart);
h.sev = pGetShortExpVector(h.p);
strat->enterS(&h,pos,strat, strat->tl+1);
enterT(&h,strat);
}
}
}
for (i=0; i<IDELEMS(P); i++)
{
if (P->m[i]!=NULL)
{
LObject h;
h.p=pCopy(P->m[i]);
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom();
}
else
{
h.pNorm();
}
if(strat->sl>=0)
{
if (rHasGlobalOrdering(currRing))
{
h.p=redBba(h.p,strat->sl,strat);
if ((h.p!=NULL)&&(TEST_OPT_REDTAIL || TEST_OPT_REDSB))
{
h.p=redtailBba(h.p,strat->sl,strat);
}
}
else
{
h.p=redMora(h.p,strat->sl,strat);
}
if(h.p!=NULL)
{
strat->initEcart(&h);
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom();
}
else
{
h.is_normalized = 0;
h.pNorm();
}
h.sev = pGetShortExpVector(h.p);
h.SetpFDeg();
pos = posInS(strat,strat->sl,h.p,h.ecart);
enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
strat->enterS(&h,pos,strat, strat->tl+1);
enterT(&h,strat);
}
}
else
{
h.sev = pGetShortExpVector(h.p);
strat->initEcart(&h);
strat->enterS(&h,0,strat, strat->tl+1);
enterT(&h,strat);
}
}
}
}

## initSyzRules()

void initSyzRules | ( | kStrategy | strat | ) |

Definition at line 7933 of file kutil.cc.

{
if( strat->S[0] )
{
if( strat->S[1] && !rField_is_Ring(currRing))
{
omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
}
int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
/************************************************************
* computing the length of the syzygy array needed
***********************************************************/
for(i=1; i<=strat->sl; i++)
{
if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
{
ps += i;
}
}
ps += strat->sl+1;
//comp = pGetComp (strat->P.sig);
comp = strat->currIdx;
strat->syzIdx = initec(comp);
strat->sevSyz = initsevS(ps);
strat->syz = (poly *)omAlloc(ps*sizeof(poly));
strat->syzmax = ps;
strat->syzl = 0;
strat->syzidxmax = comp;
#if defined(DEBUGF5) || defined(DEBUGF51)
PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
#endif
i = 1;
j = 0;
/************************************************************
* generating the leading terms of the principal syzygies
***********************************************************/
while (i <= strat->sl)
{
/**********************************************************
* principal syzygies start with component index 2
* the array syzIdx starts with index 0
* => the rules for a signature with component comp start
* at strat->syz[strat->syzIdx[comp-2]] !
*********************************************************/
if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
{
comp = pGetComp(strat->sig[i]);
comp_old = pGetComp(strat->sig[i-1]);
diff = comp - comp_old - 1;
// diff should be zero, but sometimes also the initial generating
// elements of the input ideal reduce to zero. then there is an
// index-gap between the signatures. for these in-between signatures we
// can safely set syzIdx[j] = 0 as no such element will be ever computed
// in the following.
// doing this, we keep the relation "j = comp - 2" alive, which makes
// jumps way easier when checking criteria
while (diff>0)
{
strat->syzIdx[j] = 0;
diff--;
j++;
}
strat->syzIdx[j] = ctr;
j++;
LObject Q;
int pos;
for (k = 0; k<i; k++)
{
Q.sig = pOne();
if(rField_is_Ring(currRing))
p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
p_SetCompP (Q.sig, comp, currRing);
poly q = p_One(currRing);
if(rField_is_Ring(currRing))
p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
p_ExpVectorCopy(q,strat->S[i],currRing);
q = p_Neg (q, currRing);
p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
Q.sig = p_Add_q (Q.sig, q, currRing);
Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
pos = posInSyz(strat, Q.sig);
enterSyz(Q, strat, pos);
ctr++;
}
}
i++;
}
/**************************************************************
* add syzygies for upcoming first element of new iteration step
**************************************************************/
comp = strat->currIdx;
comp_old = pGetComp(strat->sig[i-1]);
diff = comp - comp_old - 1;
// diff should be zero, but sometimes also the initial generating
// elements of the input ideal reduce to zero. then there is an
// index-gap between the signatures. for these in-between signatures we
// can safely set syzIdx[j] = 0 as no such element will be ever computed
// in the following.
// doing this, we keep the relation "j = comp - 2" alive, which makes
// jumps way easier when checking criteria
while (diff>0)
{
strat->syzIdx[j] = 0;
diff--;
j++;
}
strat->syzIdx[j] = ctr;
LObject Q;
int pos;
for (k = 0; k<strat->sl+1; k++)
{
Q.sig = pOne();
if(rField_is_Ring(currRing))
p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
p_SetCompP (Q.sig, comp, currRing);
poly q = p_One(currRing);
if(rField_is_Ring(currRing))
p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
q = p_Neg (q, currRing);
p_SetCompP (q, __p_GetComp(strat->sig[k], currRing), currRing);
Q.sig = p_Add_q (Q.sig, q, currRing);
Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
pos = posInSyz(strat, Q.sig);
enterSyz(Q, strat, pos);
ctr++;
}
//#if 1
#ifdef DEBUGF5
PrintS("Principal syzygies:\n");
Print("syzl %d\n",strat->syzl);
Print("syzmax %d\n",strat->syzmax);
Print("ps %d\n",ps);
PrintS("--------------------------------\n");
for(i=0;i<=strat->syzl-1;i++)
{
Print("%d - ",i);
pWrite(strat->syz[i]);
}
for(i=0;i<strat->currIdx;i++)
{
Print("%d - %d\n",i,strat->syzIdx[i]);
}
PrintS("--------------------------------\n");
#endif
}
}
skStrategy::currIdx
int currIdx
Definition kutil.h:316
comp
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition facSparseHensel.h:25
p_GetCoeff
#define p_GetCoeff(p, r)
Definition monomials.h:50
diff
STATIC_VAR gmp_float * diff
Definition mpr_complex.cc:45
p_One
poly p_One(const ring r)
Definition p_polys.cc:1314
p_Neg
static poly p_Neg(poly p, const ring r)
Definition p_polys.h:1114
p_ExpVectorCopy
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition p_polys.h:1334

## is_shifted_p1()

BOOLEAN is_shifted_p1 | ( | const kStrategy | strat | ) |

static

Definition at line 1181 of file kutil.cc.

{
if (rIsLPRing(currRing)
&& (strat->P.p1!=NULL))
{
// clean up strat->P.p1: may be shifted
poly p=strat->P.p1;
int lv=currRing->isLPring;
BOOLEAN is_shifted=TRUE;
for (int i=lv;i>0;i--)
{
if (pGetExp(p,i)!=0) { is_shifted=FALSE; break;}
}
if (is_shifted
&& (kFindInL1(p, strat)<0)
&& (kFindInT(p, strat->T, strat->tl) < 0)
)
{
return TRUE;
}
}
return FALSE;
}
kFindInL1
static int kFindInL1(const poly p, const kStrategy strat)
Definition kutil.h:852
pGetExp
#define pGetExp(p, i)
Exponent.
Definition polys.h:42

## isInPairsetL()

BOOLEAN isInPairsetL | ( | int | length,
|  | poly | p1,
|  | poly | p2,
|  | int * | k,
|  | kStrategy | strat )

Definition at line 687 of file kutil.cc.

{
LObject *p=&(strat->L[length]);
*k = length;
loop
{
if ((*k) < 0) return FALSE;
if (((p1 == (*p).p1) && (p2 == (*p).p2))
|| ((p1 == (*p).p2) && (p2 == (*p).p1)))
return TRUE;
(*k)--;
p--;
}
}

## kCheckSpolyCreation()

BOOLEAN kCheckSpolyCreation | ( | LObject * | L,
|  | kStrategy | strat,
|  | poly & | m1,
|  | poly & | m2 )

Definition at line 10459 of file kutil.cc.

{
if (strat->overflow) return FALSE;
assume(L->p1 != NULL && L->p2 != NULL);
// shift changes: from 0 to -1
assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
return FALSE;
// shift changes: extra case inserted
if ((L->i_r1 == -1) || (L->i_r2 == -1) )
{
return TRUE;
}
poly p1_max=NULL;
if ((L->i_r1>=0)&&(strat->R[L->i_r1]!=NULL)) p1_max = (strat->R[L->i_r1])->max_exp;
poly p2_max=NULL;
if ((L->i_r2>=0)&&(strat->R[L->i_r2]!=NULL)) p2_max = (strat->R[L->i_r2])->max_exp;
if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
{
p_LmFree(m1, strat->tailRing);
p_LmFree(m2, strat->tailRing);
m1 = NULL;
m2 = NULL;
return FALSE;
}
return TRUE;
}
skStrategy::overflow
char overflow
Definition kutil.h:401
p_LmExpVectorAddIsOk
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition p_polys.h:2020

## kCheckStrongCreation()

BOOLEAN kCheckStrongCreation | ( | int | atR,
|  | poly | m1,
|  | int | atS,
|  | poly | m2,
|  | kStrategy | strat )

Definition at line 10497 of file kutil.cc.

{
assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
//assume(strat->tailRing != currRing);
poly p1_max = (strat->R[atR])->max_exp;
poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
{
return FALSE;
}
return TRUE;
}

## kDebugPrint()

void kDebugPrint | ( | kStrategy | strat | ) |

Output some debug info about a given strategy.

Definition at line 11478 of file kutil.cc.

{
printf("red: ");
if (strat->red==redFirst) printf("redFirst\n");
else if (strat->red==redHoney) printf("redHoney\n");
else if (strat->red==redEcart) printf("redEcart\n");
else if (strat->red==redHomog) printf("redHomog\n");
else if (strat->red==redLazy) printf("redLazy\n");
else if (strat->red==redLiftstd) printf("redLiftstd\n");
else printf("%p\n",(void*)strat->red);
printf("posInT: ");
if (strat->posInT==posInT0) printf("posInT0\n");
else if (strat->posInT==posInT1) printf("posInT1\n");
else if (strat->posInT==posInT11) printf("posInT11\n");
else if (strat->posInT==posInT110) printf("posInT110\n");
else if (strat->posInT==posInT13) printf("posInT13\n");
else if (strat->posInT==posInT15) printf("posInT15\n");
else if (strat->posInT==posInT17) printf("posInT17\n");
else if (strat->posInT==posInT17_c) printf("posInT17_c\n");
else if (strat->posInT==posInT19) printf("posInT19\n");
else if (strat->posInT==posInT2) printf("posInT2\n");
else if (strat->posInT==posInT11Ring) printf("posInT11Ring\n");
else if (strat->posInT==posInT110Ring) printf("posInT110Ring\n");
else if (strat->posInT==posInT15Ring) printf("posInT15Ring\n");
else if (strat->posInT==posInT17Ring) printf("posInT17Ring\n");
else if (strat->posInT==posInT17_cRing) printf("posInT17_cRing\n");
#ifdef HAVE_MORE_POS_IN_T
else if (strat->posInT==posInT_EcartFDegpLength) printf("posInT_EcartFDegpLength\n");
else if (strat->posInT==posInT_FDegpLength) printf("posInT_FDegpLength\n");
else if (strat->posInT==posInT_pLength) printf("posInT_pLength\n");
#endif
else if (strat->posInT==posInT_EcartpLength) printf("posInT_EcartpLength\n");
else printf("%p\n",(void*)strat->posInT);
printf("posInL: ");
if (strat->posInL==posInL0) printf("posInL0\n");
else if (strat->posInL==posInL10) printf("posInL10\n");
else if (strat->posInL==posInL11) printf("posInL11\n");
else if (strat->posInL==posInL110) printf("posInL110\n");
else if (strat->posInL==posInL13) printf("posInL13\n");
else if (strat->posInL==posInL15) printf("posInL15\n");
else if (strat->posInL==posInL17) printf("posInL17\n");
else if (strat->posInL==posInL17_c) printf("posInL17_c\n");
else if (strat->posInL==posInL0) printf("posInL0Ring\n");
else if (strat->posInL==posInL11Ring) printf("posInL11Ring\n");
else if (strat->posInL==posInL11Ringls) printf("posInL11Ringls\n");
else if (strat->posInL==posInL110Ring) printf("posInL110Ring\n");
else if (strat->posInL==posInL15Ring) printf("posInL15Ring\n");
else if (strat->posInL==posInL17Ring) printf("posInL17Ring\n");
else if (strat->posInL==posInL17_cRing) printf("posInL17_cRing\n");
else if (strat->posInL==posInLSpecial) printf("posInLSpecial\n");
else printf("%p\n",(void*)strat->posInL);
printf("enterS: ");
if (strat->enterS==enterSBba) printf("enterSBba\n");
else if (strat->enterS==enterSMora) printf("enterSMora\n");
else if (strat->enterS==enterSMoraNF) printf("enterSMoraNF\n");
else printf("%p\n",(void*)strat->enterS);
printf("initEcart: ");
if (strat->initEcart==initEcartBBA) printf("initEcartBBA\n");
else if (strat->initEcart==initEcartNormal) printf("initEcartNormal\n");
else printf("%p\n",(void*)strat->initEcart);
printf("initEcartPair: ");
if (strat->initEcartPair==initEcartPairBba) printf("initEcartPairBba\n");
else if (strat->initEcartPair==initEcartPairMora) printf("initEcartPairMora\n");
else printf("%p\n",(void*)strat->initEcartPair);
printf("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
printf("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
printf("chainCrit: ");
if (strat->chainCrit==chainCritNormal) printf("chainCritNormal\n");
else if (strat->chainCrit==chainCritOpt_1) printf("chainCritOpt_1\n");
else printf("%p\n",(void*)strat->chainCrit);
printf("posInLDependsOnLength=%d\n",
strat->posInLDependsOnLength);
printf("%s\n",showOption());
printf("LDeg: ");
if (currRing->pLDeg==pLDeg0) printf("pLDeg0");
else if (currRing->pLDeg==pLDeg0c) printf("pLDeg0c");
else if (currRing->pLDeg==pLDegb) printf("pLDegb");
else if (currRing->pLDeg==pLDeg1) printf("pLDeg1");
else if (currRing->pLDeg==pLDeg1c) printf("pLDeg1c");
else if (currRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
else if (currRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
else if (currRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
else if (currRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
else if (currRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
else printf("? (%lx)", (long)currRing->pLDeg);
printf(" / ");
if (strat->tailRing->pLDeg==pLDeg0) printf("pLDeg0");
else if (strat->tailRing->pLDeg==pLDeg0c) printf("pLDeg0c");
else if (strat->tailRing->pLDeg==pLDegb) printf("pLDegb");
else if (strat->tailRing->pLDeg==pLDeg1) printf("pLDeg1");
else if (strat->tailRing->pLDeg==pLDeg1c) printf("pLDeg1c");
else if (strat->tailRing->pLDeg==pLDeg1_Deg) printf("pLDeg1_Deg");
else if (strat->tailRing->pLDeg==pLDeg1c_Deg) printf("pLDeg1c_Deg");
else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) printf("pLDeg1_Totaldegree");
else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) printf("pLDeg1c_Totaldegree");
else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) printf("pLDeg1_WFirstTotalDegree");
else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) printf("pLDeg1c_WFirstTotalDegree");
else if (strat->tailRing->pLDeg==maxdegreeWecart) printf("maxdegreeWecart");
else printf("? (%lx)", (long)strat->tailRing->pLDeg);
printf("\n");
printf("currRing->pFDeg: ");
if (currRing->pFDeg==p_Totaldegree) printf("p_Totaldegree");
else if (currRing->pFDeg==p_WFirstTotalDegree) printf("pWFirstTotalDegree");
else if (currRing->pFDeg==p_Deg) printf("p_Deg");
else if (currRing->pFDeg==kHomModDeg) printf("kHomModDeg");
else if (currRing->pFDeg==kModDeg) printf("kModDeg");
else if (currRing->pFDeg==totaldegreeWecart) printf("totaldegreeWecart");
else if (currRing->pFDeg==p_WTotaldegree) printf("p_WTotaldegree");
else printf("? (%lx)", (long)currRing->pFDeg);
printf("\n");
printf(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
if(TEST_OPT_DEGBOUND)
printf(" degBound: %d\n", Kstd1_deg);
if( ecartWeights != NULL )
{
printf("ecartWeights: ");
for (int i = rVar(currRing); i > 0; i--)
printf("%hd ", ecartWeights[i]);
printf("\n");
assume( TEST_OPT_WEIGHTM );
}
#ifndef SING_NDEBUG
rDebugPrint(currRing);
#endif
}
skStrategy::use_buckets
char use_buckets
Definition kutil.h:380
skStrategy::LazyPass
int LazyPass
Definition kutil.h:352
skStrategy::red
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
skStrategy::LazyDegree
int LazyDegree
Definition kutil.h:352
redLiftstd
int redLiftstd(LObject *h, kStrategy strat)
Definition kLiftstd.cc:167
kHomModDeg
long kHomModDeg(poly p, const ring r)
Definition kstd1.cc:2421
redFirst
int redFirst(LObject *h, kStrategy strat)
Definition kstd1.cc:794
kModDeg
long kModDeg(poly p, const ring r)
Definition kstd1.cc:2411
redEcart
int redEcart(LObject *h, kStrategy strat)
Definition kstd1.cc:168
enterSMora
void enterSMora(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1629
posInL10
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1360
enterSMoraNF
void enterSMoraNF(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1682
Kstd1_deg
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
redHoney
int redHoney(LObject *h, kStrategy strat)
Definition kstd2.cc:2110
redHomog
int redHomog(LObject *h, kStrategy strat)
Definition kstd2.cc:1150
redLazy
int redLazy(LObject *h, kStrategy strat)
Definition kstd2.cc:1905
posInT2
int posInT2(const TSet set, const int length, LObject &p)
Definition kutil.cc:4925
posInT_pLength
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11449
initEcartPairMora
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1315
posInT_EcartFDegpLength
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11358
initEcartNormal
void initEcartNormal(TObject *h)
Definition kutil.cc:1293
posInT_FDegpLength
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11412
initEcartBBA
void initEcartBBA(TObject *h)
Definition kutil.cc:1301
showOption
char * showOption()
Definition misc_ip.cc:711
initEcartPairBba
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition kutil.cc:1308
TEST_OPT_DEGBOUND
#define TEST_OPT_DEGBOUND
Definition options.h:115
pLDegb
long pLDegb(poly p, int *l, const ring r)
Definition p_polys.cc:812
pLDeg1_Totaldegree
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition p_polys.cc:976
p_WFirstTotalDegree
long p_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:595
pLDeg1_WFirstTotalDegree
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition p_polys.cc:1039
pLDeg1c_WFirstTotalDegree
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition p_polys.cc:1069
pLDeg1c_Deg
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition p_polys.cc:942
pLDeg1
long pLDeg1(poly p, int *l, const ring r)
Definition p_polys.cc:842
pLDeg1_Deg
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition p_polys.cc:911
p_WTotaldegree
long p_WTotaldegree(poly p, const ring r)
Definition p_polys.cc:612
pLDeg1c
long pLDeg1c(poly p, int *l, const ring r)
Definition p_polys.cc:878
pLDeg1c_Totaldegree
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition p_polys.cc:1006
pLDeg0c
long pLDeg0c(poly p, int *l, const ring r)
Definition p_polys.cc:771
pLDeg0
long pLDeg0(poly p, int *l, const ring r)
Definition p_polys.cc:740
p_Deg
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
p_Totaldegree
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1528
rDebugPrint
void rDebugPrint(const ring r)
Definition ring.cc:4214
rGetCurrSyzLimit
static int rGetCurrSyzLimit(const ring r)
Definition ring.h:729
totaldegreeWecart
long totaldegreeWecart(poly p, ring r)
Definition weight.cc:217
maxdegreeWecart
long maxdegreeWecart(poly p, int *l, ring r)
Definition weight.cc:247
ecartWeights
EXTERN_VAR short * ecartWeights
Definition weight.h:12

## kFindDivisibleByInS_T()

TObject * kFindDivisibleByInS_T | ( | kStrategy | strat,
|  | int | end_pos,
|  | LObject * | L,
|  | TObject * | T,
|  | long | ecart )

Definition at line 6697 of file kutil.cc.

{
int j = 0;
const unsigned long not_sev = ~L->sev;
const unsigned long* sev = strat->sevS;
poly p;
ring r;
L->GetLm(p, r);
assume(~not_sev == p_GetShortExpVector(p, r));
if (r == currRing)
{
if(!rField_is_Ring(r))
{
loop
{
if (j > end_pos) return NULL;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
(ecart== LONG_MAX || ecart>= strat->ecartS[j]))
#else
if (!(sev[j] & not_sev) &&
(ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
p_LmDivisibleBy(strat->S[j], p, r))
#endif
{
break;
}
j++;
}
}
else
{
loop
{
if (j > end_pos) return NULL;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (strat->S[j]!= NULL
&& p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r)
&& (ecart== LONG_MAX || ecart>= strat->ecartS[j])
&& n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
#else
if (!(sev[j] & not_sev)
&& (ecart== LONG_MAX || ecart>= strat->ecartS[j])
&& p_LmDivisibleBy(strat->S[j], p, r)
&& n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
#endif
{
break; // found
}
j++;
}
}
// if called from NF, T objects do not exist:
if (strat->tl < 0 || strat->S_2_R[j] == -1)
{
T->Set(strat->S[j], r, strat->tailRing);
assume(T->GetpLength()==pLength(T->p != __null ? T->p : T->t_p));
return T;
}
else
{
///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
// assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
return strat->S_2_T(j);
}
}
else
{
TObject* t;
if(!rField_is_Ring(r))
{
loop
{
if (j > end_pos) return NULL;
assume(strat->S_2_R[j] != -1);
#if defined(PDEBUG) || defined(PDIV_DEBUG)
t = strat->S_2_T(j);
assume(t != NULL && t->t_p != NULL && t->tailRing == r);
if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r)
&& (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
{
t->pLength=pLength(t->t_p);
return t;
}
#else
if (! (sev[j] & not_sev)
&& (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
{
t = strat->S_2_T(j);
assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
if (p_LmDivisibleBy(t->t_p, p, r))
{
t->pLength=pLength(t->t_p);
return t;
}
}
#endif
j++;
}
}
else
{
loop
{
if (j > end_pos) return NULL;
assume(strat->S_2_R[j] != -1);
#if defined(PDEBUG) || defined(PDIV_DEBUG)
t = strat->S_2_T(j);
assume(t != NULL && t->t_p != NULL && t->tailRing == r);
if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r)
&& (ecart== LONG_MAX || ecart>= strat->ecartS[j])
&& n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
{
t->pLength=pLength(t->t_p);
return t;
}
#else
if (! (sev[j] & not_sev)
&& (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
{
t = strat->S_2_T(j);
assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
if (p_LmDivisibleBy(t->t_p, p, r)
&& n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
{
t->pLength=pLength(t->t_p);
return t;
}
}
#endif
j++;
}
}
}
}
skStrategy::S_2_T
KINLINE TObject * S_2_T(int i)
Definition kInline.h:38

## kFindInT() [1/2]

int kFindInT | ( | poly | p,
|  | kStrategy | strat )

Definition at line 714 of file kutil.cc.

{
int i;
do
{
i = kFindInT(p, strat->T, strat->tl);
if (i >= 0) return i;
strat = strat->next;
}
while (strat != NULL);
return -1;
}
skStrategy::next
kStrategy next
Definition kutil.h:278

## kFindInT() [2/2]

int kFindInT | ( | poly | p,
|  | TSet | T,
|  | int | tlength )

returns index of p in TSet, or -1 if not found

Definition at line 703 of file kutil.cc.

{
int i;
for (i=0; i<=tlength; i++)
{
if (T[i].p == p) return i;
}
return -1;
}

## kFindInTShift() [1/2]

int kFindInTShift | ( | poly | p,
|  | kStrategy | strat )

Definition at line 742 of file kutil.cc.

{
int i;
do
{
i = kFindInTShift(p, strat->T, strat->tl);
if (i >= 0) return i;
strat = strat->next;
}
while (strat != NULL);
return -1;
}
kFindInTShift
int kFindInTShift(poly p, TSet T, int tlength)
Definition kutil.cc:728

## kFindInTShift() [2/2]

int kFindInTShift | ( | poly | p,
|  | TSet | T,
|  | int | tlength )

Definition at line 728 of file kutil.cc.

{
int i;
for (i=0; i<=tlength; i++)
{
// in the Letterplace ring the LMs in T and L are copies thus we have to use pEqualPolys() instead of ==
if (pEqualPolys(T[i].p, p)) return i;
}
return -1;
}
pEqualPolys
#define pEqualPolys(p1, p2)
Definition polys.h:400

## kMergeBintoL()

void kMergeBintoL | ( | kStrategy | strat | ) |

Definition at line 3161 of file kutil.cc.

{
int j=strat->Ll+strat->Bl+1;
if (j>strat->Lmax)
{
j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc-strat->Lmax;
enlargeL(&(strat->L),&(strat->Lmax),j);
}
j = strat->Ll;
int i;
for (i=strat->Bl; i>=0; i--)
{
j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
}
strat->Bl = -1;
}

## kMergeBintoLSba()

void kMergeBintoLSba | ( | kStrategy | strat | ) |

Definition at line 3182 of file kutil.cc.

{
int j=strat->Ll+strat->Bl+1;
if (j>strat->Lmax)
{
j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc-strat->Lmax;
enlargeL(&(strat->L),&(strat->Lmax),j);
}
j = strat->Ll;
int i;
for (i=strat->Bl; i>=0; i--)
{
j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
}
strat->Bl = -1;
}

## kPosInLDependsOnLength()

BOOLEAN kPosInLDependsOnLength | ( | int(* | pos_in_l )(const LSet set, const int length, LObject *L, const kStrategy strat) | ) |

Definition at line 9567 of file kutil.cc.

{
if (pos_in_l == posInL110
|| pos_in_l == posInL10
|| pos_in_l == posInL110Ring
)
return TRUE;
return FALSE;
}

## kStratChangeTailRing()

BOOLEAN kStratChangeTailRing | ( | kStrategy | strat,
|  | LObject * | L,
|  | TObject * | T,
|  | unsigned long | expbound )

Definition at line 10939 of file kutil.cc.

{
assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
/* initial setup or extending */
if (rIsLPRing(currRing)) return TRUE;
if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
if (expbound >= currRing->bitmask) return FALSE;
strat->overflow=FALSE;
ring new_tailRing = rModifyRing(currRing,
// Hmmm .. the condition pFDeg == p_Deg
// might be too strong
(strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
(strat->ak==0), // omit_comp if the input is an ideal
expbound); // exp_limit
if (new_tailRing == currRing) return TRUE;
strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
if (currRing->pFDeg != currRing->pFDegOrig)
{
new_tailRing->pFDeg = currRing->pFDeg;
new_tailRing->pLDeg = currRing->pLDeg;
}
if (TEST_OPT_PROT)
Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
#ifdef KDEBUG
kTest_TS(strat);
assume(new_tailRing != strat->tailRing);
#endif
pShallowCopyDeleteProc p_shallow_copy_delete
= pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
int i;
for (i=0; i<=strat->tl; i++)
{
strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
p_shallow_copy_delete);
}
for (i=0; i<=strat->Ll; i++)
{
assume(strat->L[i].p != NULL);
if (pNext(strat->L[i].p) != strat->tail)
strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
}
if ((strat->P.t_p != NULL) ||
((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
if ((L != NULL) && (L->tailRing != new_tailRing))
{
if (L->i_r < 0)
L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
else
{
assume(L->i_r <= strat->tl);
TObject* t_l = strat->R[L->i_r];
assume(t_l != NULL);
L->tailRing = new_tailRing;
L->p = t_l->p;
L->t_p = t_l->t_p;
L->max_exp = t_l->max_exp;
}
}
if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
if (strat->tailRing != currRing)
rKillModifiedRing(strat->tailRing);
strat->tailRing = new_tailRing;
strat->tailBin = new_tailBin;
strat->p_shallow_copy_delete
= pGetShallowCopyDeleteProc(currRing, new_tailRing);
if (strat->kNoether != NULL)
{
if (strat->t_kNoether != NULL)
p_LmFree(strat->t_kNoether, strat->tailRing);
strat->t_kNoether=k_LmInit_currRing_2_tailRing(strat->kNoether, new_tailRing);
}
#ifdef KDEBUG
kTest_TS(strat);
#endif
if (TEST_OPT_PROT)
PrintS("]");
return TRUE;
}
skStrategy::t_kNoether
poly t_kNoether
Definition kutil.h:329
skStrategy::pOrigFDeg_TailRing
pFDegProc pOrigFDeg_TailRing
Definition kutil.h:297
skStrategy::p_shallow_copy_delete
pShallowCopyDeleteProc p_shallow_copy_delete
Definition kutil.h:337
skStrategy::pOrigLDeg_TailRing
pLDegProc pOrigLDeg_TailRing
Definition kutil.h:298
omBin
omBin_t * omBin
Definition omStructs.h:12
rKillModifiedRing
void rKillModifiedRing(ring r)
Definition ring.cc:3119
rModifyRing
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition ring.cc:2758
omGetStickyBinOfBin
#define omGetStickyBinOfBin(B)
Definition xalloc.h:247
omMergeStickyBinIntoBin
#define omMergeStickyBinIntoBin(A, B)
Definition xalloc.h:275

## kStratInitChangeTailRing()

void kStratInitChangeTailRing | ( | kStrategy | strat | ) |

Definition at line 11036 of file kutil.cc.

{
unsigned long l = 0;
int i;
long e;
assume(strat->tailRing == currRing);
for (i=0; i<= strat->Ll; i++)
{
l = p_GetMaxExpL(strat->L[i].p, currRing, l);
}
for (i=0; i<=strat->tl; i++)
{
// Hmm ... this we could do in one Step
l = p_GetMaxExpL(strat->T[i].p, currRing, l);
}
if (rField_is_Ring(currRing))
{
l *= 2;
}
e = p_GetMaxExp(l, currRing);
if (e <= 1) e = 2;
if (rIsLPRing(currRing)) e = 1;
kStratChangeTailRing(strat, NULL, NULL, e);
}
kStratChangeTailRing
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10939
p_GetMaxExpL
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
Definition p_polys.cc:1176
p_GetMaxExp
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition p_polys.h:783

## kTest()

BOOLEAN kTest | ( | kStrategy | strat | ) |

Definition at line 1004 of file kutil.cc.

{
int i;
// test P
kFalseReturn(kTest_L(&(strat->P), strat,
(strat->P.p != NULL && pNext(strat->P.p)!=strat->tail),
-1, strat->T, strat->tl));
// test T
if (strat->T != NULL)
{
for (i=0; i<=strat->tl; i++)
{
kFalseReturn(kTest_T(&(strat->T[i]), strat, i, 'T'));
if (strat->sevT[i] != pGetShortExpVector(strat->T[i].p))
return dReportError("strat->sevT[%d] out of sync", i);
}
}
// test L
if (strat->L != NULL)
{
for (i=0; i<=strat->Ll; i++)
{
kFalseReturn(kTest_L(&(strat->L[i]), strat,
strat->L[i].Next() != strat->tail, i,
strat->T, strat->tl));
// may be unused
//if (strat->use_buckets && strat->L[i].Next() != strat->tail &&
// strat->L[i].Next() != NULL && strat->L[i].p1 != NULL)
//{
// assume(strat->L[i].bucket != NULL);
//}
}
}
// test S
if (strat->S != NULL)
kFalseReturn(kTest_S(strat));
return TRUE;
}
kFalseReturn
#define kFalseReturn(x)
Definition kutil.cc:765
kTest_S
BOOLEAN kTest_S(kStrategy strat)
Definition kutil.cc:1049
dReportError
int dReportError(const char *fmt,...)
Definition dError.cc:44

## kTest_L()

BOOLEAN kTest_L | ( | LObject * | L,
|  | kStrategy | strat,
|  | BOOLEAN | testp,
|  | int | lpos,
|  | TSet | T,
|  | int | tlength )

Definition at line 916 of file kutil.cc.

{
ring strat_tailRing=strat->tailRing;
if (L->p!=NULL)
{
if ((L->t_p==NULL)
&&(pNext(L->p)!=NULL)
&&(pGetCoeff(pNext(L->p))!=NULL)) /* !=strat->tail*/
{
p_Test(pNext(L->p),currRing);
nTest(pGetCoeff(L->p));
}
}
if (L->t_p!=NULL)
{
if ((pNext(L->t_p)!=NULL)
&&(pGetCoeff(pNext(L->t_p))!=NULL)) /* !=strat->tail*/
{
p_Test(pNext(L->t_p),strat_tailRing);
nTest(pGetCoeff(L->t_p));
}
}
if ((L->p!=NULL)&&(L->t_p!=NULL)) assume(pGetCoeff(L->p)==pGetCoeff(L->t_p));
if (testp)
{
poly pn = NULL;
if (L->bucket != NULL)
{
kFalseReturn(kbTest(L->bucket));
r_assume(L->bucket->bucket_ring == L->tailRing);
if (L->p != NULL && pNext(L->p) != NULL)
{
pn = pNext(L->p);
pNext(L->p) = NULL;
}
}
kFalseReturn(kTest_T(L, strat, lpos, 'L'));
if (pn != NULL)
pNext(L->p) = pn;
ring r;
poly p;
L->GetLm(p, r);
if (L->sev != 0L)
{
if (p_GetShortExpVector(p, r) != L->sev)
{
return dReportError("L[%d] wrong sev: has %lo, specified to have %lo",
lpos, p_GetShortExpVector(p, r), L->sev);
}
}
}
if (L->p1 == NULL)
{
// L->p2 either NULL or "normal" poly
pFalseReturn(pp_Test(L->p2, currRing, L->tailRing));
}
else if (tlength > 0 && T != NULL && (lpos >=0))
{
// now p1 and p2 must be != NULL and must be contained in T
int i;
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
i = kFindInTShift(L->p1, T, tlength);
else
#endif
i = kFindInT(L->p1, T, tlength);
if (i < 0)
return dReportError("L[%d].p1 not in T",lpos);
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
{
if (rField_is_Ring(currRing)) return TRUE; // m*shift(q) is not in T
i = kFindInTShift(L->p2, T, tlength);
}
else
#endif
i = kFindInT(L->p2, T, tlength);
if (i < 0)
return dReportError("L[%d].p2 not in T",lpos);
}
return TRUE;
}
kbTest
BOOLEAN kbTest(kBucket_pt bucket)
Tests.
Definition kbuckets.cc:197
r_assume
#define r_assume(x)
Definition mod2.h:390
pFalseReturn
#define pFalseReturn(cond)
Definition monomials.h:139
nTest
#define nTest(a)
Definition numbers.h:35

## kTest_LmEqual()

const char * kTest_LmEqual | ( | poly | p,
|  | poly | t_p,
|  | ring | tailRing )

static

Definition at line 769 of file kutil.cc.

{
int i;
for (i=1; i<=tailRing->N; i++)
{
if (p_GetExp(p, i, currRing) != p_GetExp(t_p, i, tailRing))
return "Lm[i] different";
}
if (p_GetComp(p, currRing) != p_GetComp(t_p, tailRing))
return "Lm[0] different";
if (pNext(p) != pNext(t_p))
return "Lm.next different";
if (pGetCoeff(p) != pGetCoeff(t_p))
return "Lm.coeff different";
return NULL;
}

## kTest_S()

BOOLEAN kTest_S | ( | kStrategy | strat | ) |

Definition at line 1049 of file kutil.cc.

{
int i;
BOOLEAN ret = TRUE;
for (i=0; i<=strat->sl; i++)
{
if (strat->S[i] != NULL &&
strat->sevS[i] != pGetShortExpVector(strat->S[i]))
{
return dReportError("S[%d] wrong sev: has %o, specified to have %o",
i , pGetShortExpVector(strat->S[i]), strat->sevS[i]);
}
}
return ret;
}

## kTest_T()

BOOLEAN kTest_T | ( | TObject * | T,
|  | kStrategy | strat,
|  | int | i,
|  | char | TN )

Definition at line 789 of file kutil.cc.

{
ring tailRing = T->tailRing;
ring strat_tailRing = strat->tailRing;
if (strat_tailRing == NULL) strat_tailRing = tailRing;
r_assume(strat_tailRing == tailRing);
poly p = T->p;
// ring r = currRing;
if (T->p == NULL && T->t_p == NULL && i >= 0)
return dReportError("%c[%d].poly is NULL", TN, i);
if (T->p!=NULL)
{
nTest(pGetCoeff(T->p));
if ((T->t_p==NULL)&&(pNext(T->p)!=NULL)) p_Test(pNext(T->p),currRing);
}
if (T->t_p!=NULL)
{
nTest(pGetCoeff(T->t_p));
if (pNext(T->t_p)!=NULL) p_Test(pNext(T->t_p),strat_tailRing);
}
if ((T->p!=NULL)&&(T->t_p!=NULL)) assume(pGetCoeff(T->p)==pGetCoeff(T->t_p));
if (T->tailRing != currRing)
{
if (T->t_p == NULL && i > 0)
return dReportError("%c[%d].t_p is NULL", TN, i);
pFalseReturn(p_Test(T->t_p, T->tailRing));
if (T->p != NULL) pFalseReturn(p_LmTest(T->p, currRing));
if ((T->p != NULL) && (T->t_p != NULL))
{
const char* msg = kTest_LmEqual(T->p, T->t_p, T->tailRing);
if (msg != NULL)
return dReportError("%c[%d] %s", TN, i, msg);
// r = T->tailRing;
p = T->t_p;
}
if (T->p == NULL)
{
p = T->t_p;
// r = T->tailRing;
}
if (T->t_p != NULL && i >= 0 && TN == 'T')
{
if (pNext(T->t_p) == NULL)
{
if (T->max_exp != NULL)
return dReportError("%c[%d].max_exp is not NULL as it should be", TN, i);
}
else
{
if (T->max_exp == NULL)
return dReportError("%c[%d].max_exp is NULL", TN, i);
if (pNext(T->max_exp) != NULL)
return dReportError("pNext(%c[%d].max_exp) != NULL", TN, i);
pFalseReturn(p_CheckPolyRing(T->max_exp, tailRing));
omCheckBinAddrSize(T->max_exp, (omSizeWOfBin(tailRing->PolyBin))*SIZEOF_LONG);
#if KDEBUG > 0
if (! sloppy_max)
{
poly test_max = p_GetMaxExpP(pNext(T->t_p), tailRing);
p_Setm(T->max_exp, tailRing);
p_Setm(test_max, tailRing);
BOOLEAN equal = p_ExpVectorEqual(T->max_exp, test_max, tailRing);
if (! equal)
return dReportError("%c[%d].max out of sync", TN, i);
p_LmFree(test_max, tailRing);
}
#endif
}
}
}
else
{
if (T->p == NULL && i > 0)
return dReportError("%c[%d].p is NULL", TN, i);
#ifdef HAVE_SHIFTBBA
if (currRing->isLPring && T->shift > 0)
{
// in this case, the order is not correct. test LM and tail separately
pFalseReturn(p_LmTest(T->p, currRing));
pFalseReturn(p_Test(pNext(T->p), currRing));
}
else
#endif
{
pFalseReturn(p_Test(T->p, currRing));
}
}
if ((i >= 0) && (T->pLength != 0)
&& (! rIsSyzIndexRing(currRing)) && (T->pLength != pLength(p)))
{
int l=T->pLength;
T->pLength=pLength(p);
return dReportError("%c[%d] pLength error: has %d, specified to have %d",
TN, i , pLength(p), l);
}
// check FDeg, for elements in L and T
if (i >= 0 && (TN == 'T' || TN == 'L'))
{
// FDeg has ir element from T of L set
if (strat->homog && (T->FDeg != T->pFDeg()))
{
int d=T->FDeg;
T->FDeg=T->pFDeg();
return dReportError("%c[%d] FDeg error: has %d, specified to have %d",
TN, i , T->pFDeg(), d);
}
}
// check is_normalized for elements in T
if (i >= 0 && TN == 'T')
{
if (T->is_normalized && ! nIsOne(pGetCoeff(p)))
return dReportError("T[%d] is_normalized error", i);
}
return TRUE;
}
equal
bool equal
Definition cfModGcd.cc:4134
kTest_LmEqual
static const char * kTest_LmEqual(poly p, poly t_p, ring tailRing)
Definition kutil.cc:769
omCheckBinAddrSize
#define omCheckBinAddrSize(addr, size)
Definition omAllocDecl.h:326
omSizeWOfBin
#define omSizeWOfBin(bin_ptr)
Definition omAllocPrivate.h:100
p_ExpVectorEqual
static BOOLEAN p_ExpVectorEqual(poly p1, poly p2, const ring r1, const ring r2)
Definition p_polys.cc:4680
p_CheckPolyRing
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition pDebug.cc:115

## kTest_TS()

BOOLEAN kTest_TS | ( | kStrategy | strat | ) |

Definition at line 1067 of file kutil.cc.

{
int i, j;
// BOOLEAN ret = TRUE;
kFalseReturn(kTest(strat));
// test strat->R, strat->T[i].i_r
for (i=0; i<=strat->tl; i++)
{
if (strat->T[i].i_r < 0 || strat->T[i].i_r > strat->tl)
return dReportError("strat->T[%d].i_r == %d out of bounds", i,
strat->T[i].i_r);
if (strat->R[strat->T[i].i_r] != &(strat->T[i]))
return dReportError("T[%d].i_r with R out of sync", i);
}
// test containment of S inT
if ((strat->S != NULL)&&(strat->tl>=0))
{
for (i=0; i<=strat->sl; i++)
{
j = kFindInT(strat->S[i], strat->T, strat->tl);
if (j < 0)
return dReportError("S[%d] not in T", i);
if (strat->S_2_R[i] != strat->T[j].i_r)
return dReportError("S_2_R[%d]=%d != T[%d].i_r=%d\n",
i, strat->S_2_R[i], j, strat->T[j].i_r);
}
}
// test strat->L[i].i_r1
#ifdef HAVE_SHIFTBBA
if (!rIsLPRing(currRing)) // in the Letterplace ring we currently don't set/use i_r1 and i_r2
#endif
if (strat->L!=NULL)
{
for (i=0; i<=strat->Ll; i++)
{
if (strat->L[i].p1 != NULL && strat->L[i].p2)
{
if (strat->L[i].i_r1 < 0 ||
strat->L[i].i_r1 > strat->tl ||
strat->L[i].T_1(strat)->p != strat->L[i].p1)
return dReportError("L[%d].i_r1 out of sync", i);
if (strat->L[i].i_r2 < 0 ||
strat->L[i].i_r2 > strat->tl ||
strat->L[i].T_2(strat)->p != strat->L[i].p2)
return dReportError("L[%d].i_r2 out of sync", i);
}
else
{
if (strat->L[i].i_r1 != -1)
return dReportError("L[%d].i_r1 out of sync", i);
if (strat->L[i].i_r2 != -1)
return dReportError("L[%d].i_r2 out of sync", i);
}
if (strat->L[i].i_r != -1)
return dReportError("L[%d].i_r out of sync", i);
}
}
return TRUE;
}
kTest
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1004

## message()

void message | ( | int | i,
|  | int * | olddeg,
|  | int * | reduc,
|  | kStrategy | strat,
|  | int | red_result )

Definition at line 7463 of file kutil.cc.

{
if (i != *olddeg)
{
Print("%d",i);
*olddeg = i;
}
if (TEST_OPT_OLDSTD)
{
if (strat->Ll != *reduc)
{
if (strat->Ll != *reduc-1)
Print("(%d)",strat->Ll+1);
else
PrintS("-");
*reduc = strat->Ll;
}
else
PrintS(".");
mflush();
}
else
{
if (red_result == 0)
PrintS("-");
else if (red_result < 0)
PrintS(".");
if ((red_result > 0) || ((strat->Ll % 100)==99))
{
if (strat->Ll != *reduc && strat->Ll > 0)
{
Print("(%d)",strat->Ll+1);
*reduc = strat->Ll;
}
}
}
}

## messageSets()

void messageSets | ( | kStrategy | strat | ) |

Definition at line 7536 of file kutil.cc.

{
int i;
if (strat->news)
{
PrintS("set S");
for (i=0; i<=strat->sl; i++)
{
Print("\n %d:",i);
p_wrp(strat->S[i], currRing, strat->tailRing);
if (strat->fromQ!=NULL && strat->fromQ[i])
Print(" (from Q)");
}
strat->news = FALSE;
}
if (strat->newt)
{
PrintS("\nset T");
for (i=0; i<=strat->tl; i++)
{
Print("\n %d:",i);
strat->T[i].wrp();
if (strat->T[i].length==0) strat->T[i].length=pLength(strat->T[i].p);
Print(" o:%ld e:%d l:%d",
strat->T[i].pFDeg(),strat->T[i].ecart,strat->T[i].length);
}
strat->newt = FALSE;
}
PrintS("\nset L");
for (i=strat->Ll; i>=0; i--)
{
Print("\n%d:",i);
p_wrp(strat->L[i].p1, currRing, strat->tailRing);
PrintS(" ");
p_wrp(strat->L[i].p2, currRing, strat->tailRing);
PrintS(" lcm: ");p_wrp(strat->L[i].lcm, currRing);
PrintS("\n p : ");
strat->L[i].wrp();
Print(" o:%ld e:%d l:%d",
strat->L[i].pFDeg(),strat->L[i].ecart,strat->L[i].length);
}
PrintLn();
}

## messageStat()

void messageStat | ( | int | hilbcount,
|  | kStrategy | strat )

Definition at line 7504 of file kutil.cc.

{
//PrintS("\nUsage/Allocation of temporary storage:\n");
//Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
//Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
#ifdef HAVE_SHIFTBBA
/* in usual case strat->cv is 0, it gets changed only in shift routines */
if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
#endif
}

## messageStatSBA()

void messageStatSBA | ( | int | hilbcount,
|  | kStrategy | strat )

Definition at line 7517 of file kutil.cc.

{
//PrintS("\nUsage/Allocation of temporary storage:\n");
//Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
//Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
//Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
#ifdef HAVE_SHIFTBBA
/* in usual case strat->cv is 0, it gets changed only in shift routines */
if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
#endif
}
skStrategy::nrsyzcrit
int nrsyzcrit
Definition kutil.h:358

## newHEdge()

BOOLEAN newHEdge | ( | kStrategy | strat | ) |

Definition at line 10379 of file kutil.cc.

{
if (currRing->pLexOrder || rHasMixedOrdering(currRing))
return FALSE;
int i,j;
poly newNoether;
#if 0
if (currRing->weight_all_1)
scComputeHC(strat->Shdl,NULL,strat->ak,strat->kNoether);
else
scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kNoether);
#else
scComputeHC(strat->Shdl,NULL,strat->ak,strat->kNoether);
#endif
if (strat->kNoether==NULL) return FALSE;
if (strat->t_kNoether != NULL)
{
p_LmFree(strat->t_kNoether, strat->tailRing);
strat->t_kNoether=NULL;
}
if (strat->tailRing != currRing)
strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
/* compare old and new noether*/
newNoether = pLmInit(strat->kNoether);
pSetCoeff0(newNoether,nInit(1));
j = p_FDeg(newNoether,currRing);
// newNoether is now the new highest edge (on the boundary)
// now find the next monomial after highest monomial in R/I
// (the smallest monomial not in R/I)
for (i=currRing->N-1;i>0; i--)
{
int e;
if ((e=pGetExp(newNoether, i)) > 0)
{
e--;
pSetExp(newNoether,i,e);
}
}
pSetm(newNoether);
if (j < HCord) /*- statistics -*/
{
if (TEST_OPT_PROT)
{
Print("H(%d)",j);
mflush();
}
HCord=j;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("H(%d):",j);
wrp(strat->kNoether);
PrintLn();
}
#endif
}
if (pCmp(strat->kNoether,newNoether)!=1)
{
if (strat->kNoether!=NULL) p_LmDelete0(strat->kNoether,currRing);
strat->kNoether=newNoether;
if (strat->t_kNoether != NULL)
{
p_LmFree(strat->t_kNoether, strat->tailRing);
strat->t_kNoether=NULL;
}
if (strat->tailRing != currRing)
strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
return TRUE;
}
pLmDelete(newNoether);
return FALSE;
}
scComputeHC
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge)
Definition hdegree.cc:1074
HCord
VAR int HCord
Definition kutil.cc:239
p_LmDelete0
static void p_LmDelete0(poly p, const ring r)
Definition p_polys.h:735
pCmp
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2)))
Definition polys.h:116
pLmInit
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition polys.h:65

## p_HasNotCF_Lift()

BOOLEAN p_HasNotCF_Lift | ( | poly | p1,
|  | poly | p2,
|  | const ring | r )

inline static

p_HasNotCF for the IDLIFT case and syzComp==1: ignore component

Definition at line 2202 of file kutil.cc.

{
int i = rVar(r);
loop
{
if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
return FALSE;
i--;
if (i == 0)
return TRUE;
}
}

## pDivComp()

int pDivComp | ( | poly | p,
|  | poly | q )

inline static

Definition at line 176 of file kutil.cc.

{
if ((currRing->pCompIndex < 0)
|| (__p_GetComp(p,currRing) == __p_GetComp(q,currRing)))
{
#ifdef HAVE_RATGRING
if (rIsRatGRing(currRing))
{
if (_p_LmDivisibleByPart(p,currRing,
q,currRing,
currRing->real_var_start, currRing->real_var_end))
return 0;
return pLmCmp(q,p); // ONLY FOR GLOBAL ORDER!
}
#endif
BOOLEAN a=FALSE, b=FALSE;
int i;
unsigned long la, lb;
unsigned long divmask = currRing->divmask;
for (i=0; i<currRing->VarL_Size; i++)
{
la = p->exp[currRing->VarL_Offset[i]];
lb = q->exp[currRing->VarL_Offset[i]];
if (la != lb)
{
if (la < lb)
{
if (b) return 0;
if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
return 0;
a = TRUE;
}
else
{
if (a) return 0;
if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
return 0;
b = TRUE;
}
}
}
if (a) { /*assume(pLmCmp(q,p)==1);*/ return 1; }
if (b) { /*assume(pLmCmp(q,p)==-1);*/return -1; }
/*assume(pLmCmp(q,p)==0);*/
}
return 0;
}
b
CanonicalForm b
Definition cfModGcd.cc:4111

## pDivCompRing()

int pDivCompRing | ( | poly | p,
|  | poly | q )

inline static

Definition at line 138 of file kutil.cc.

{
if ((currRing->pCompIndex < 0)
|| (__p_GetComp(p,currRing) == __p_GetComp(q,currRing)))
{
BOOLEAN a=FALSE, b=FALSE;
int i;
unsigned long la, lb;
unsigned long divmask = currRing->divmask;
for (i=0; i<currRing->VarL_Size; i++)
{
la = p->exp[currRing->VarL_Offset[i]];
lb = q->exp[currRing->VarL_Offset[i]];
if (la != lb)
{
if (la < lb)
{
if (b) return pDivComp_INCOMP;
if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
return pDivComp_INCOMP;
a = TRUE;
}
else
{
if (a) return pDivComp_INCOMP;
if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
return pDivComp_INCOMP;
b = TRUE;
}
}
}
if (a) return pDivComp_LESS;
if (b) return pDivComp_GREATER;
if (!a & !b) return pDivComp_EQUAL;
}
return pDivComp_INCOMP;
}
pDivComp_INCOMP
#define pDivComp_INCOMP
Definition kutil.cc:132

## pLPDivComp()

int pLPDivComp | ( | poly | p,
|  | poly | q )

inline static

Definition at line 225 of file kutil.cc.

{
if ((currRing->pCompIndex < 0) || (__p_GetComp(p,currRing) == __p_GetComp(q,currRing)))
{
// maybe there is a more performant way to do this? This will get called quite often in bba.
if (_p_LPLmDivisibleByNoComp(p, q, currRing)) return 1;
if (_p_LPLmDivisibleByNoComp(q, p, currRing)) return -1;
}
return 0;
}
_p_LPLmDivisibleByNoComp
BOOLEAN _p_LPLmDivisibleByNoComp(poly a, poly b, const ring r)
Definition shiftop.cc:796

## posInIdealMonFirst()

int posInIdealMonFirst | ( | const ideal | F,
|  | const poly | p,
|  | int | start,
|  | int | end )

Definition at line 4841 of file kutil.cc.

{
if(end < 0 || end >= IDELEMS(F))
end = IDELEMS(F);
if (end<0) return 0;
if(pNext(p) == NULL) return start;
polyset set=F->m;
int o = p_Deg(p,currRing);
int op;
int i;
int an = start;
for(i=start;i<end;i++)
if(set[i] != NULL && pNext(set[i]) == NULL)
an++;
if(an == end-1)
return end;
int en= end;
loop
{
if(an>=en)
return en;
if (an == en-1)
{
op = p_Deg(set[an],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[an],p) == -1)))
return en;
return an;
}
i=(an+en) / 2;
op = p_Deg(set[i],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[i],p) == -1)))
an=i;
else
en=i;
}
}
polyset
poly * polyset
Definition polys.h:260

## posInL0()

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

Definition at line 5611 of file kutil.cc.

{
if (length<0) return 0;
int cmp_int=currRing->OrdSgn;
if (pLmCmp(set[length].p,p->p)== cmp_int)
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pLmCmp(set[an].p,p->p) == cmp_int) return en;
return an;
}
i=(an+en) / 2;
if (pLmCmp(set[i].p,p->p) == cmp_int) an=i;
else en=i;
/*aend. fuer lazy == in !=- machen */
}
}

## posInL0Ring()

int posInL0Ring | ( | const LSet | set,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | )

Definition at line 5638 of file kutil.cc.

{
if (length<0) return 0;
if (pLtCmpOrdSgnEqP(set[length].p,p->p))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pLtCmpOrdSgnEqP(set[an].p,p->p)) return en;
return an;
}
i=(an+en) / 2;
if (pLtCmpOrdSgnEqP(set[i].p,p->p)) an=i;
else en=i;
/*aend. fuer lazy == in !=- machen */
}
}
pLtCmpOrdSgnEqP
#define pLtCmpOrdSgnEqP(p, q)
Definition polys.h:129

## posInL11()

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

Definition at line 5802 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg();
int op = set[length].GetpFDeg();
int cmp_int= -currRing->OrdSgn;
if ((op > o)
|| ((op == o) && (pLmCmp(set[length].p,p->p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLmCmp(set[an].p,p->p) != cmp_int)))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLmCmp(set[i].p,p->p) != cmp_int)))
an=i;
else
en=i;
}
}

## posInL110()

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

Definition at line 6058 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg();
int op = set[length].GetpFDeg();
int cmp_int= -currRing->OrdSgn;
if ((op > o)
|| ((op == o) && (set[length].length >p->length))
|| ((op == o) && (set[length].length == p->length)
&& (pLmCmp(set[length].p,p->p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if ((op > o)
|| ((op == o) && (set[an].length >p->length))
|| ((op == o) && (set[an].length == p->length)
&& (pLmCmp(set[an].p,p->p) != cmp_int)))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if ((op > o)
|| ((op == o) && (set[i].length > p->length))
|| ((op == o) && (set[i].length == p->length)
&& (pLmCmp(set[i].p,p->p) != cmp_int)))
an=i;
else
en=i;
}
}

## posInL110Ring()

int posInL110Ring | ( | const LSet | set,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | )

Definition at line 6099 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg();
int op = set[length].GetpFDeg();
if ((op > o)
|| ((op == o) && (set[length].length >p->length))
|| ((op == o) && (set[length].length == p->length)
&& (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if ((op > o)
|| ((op == o) && (set[an].length >p->length))
|| ((op == o) && (set[an].length == p->length)
&& (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if ((op > o)
|| ((op == o) && (set[i].length > p->length))
|| ((op == o) && (set[i].length == p->length)
&& (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
an=i;
else
en=i;
}
}
pLtCmpOrdSgnDiffM
#define pLtCmpOrdSgnDiffM(p, q)
Definition polys.h:126

## posInL11Ring()

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

Definition at line 5844 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg();
int op = set[length].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
an=i;
else
en=i;
}
}

## posInL11Ringls()

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

Definition at line 5912 of file kutil.cc.

{
if (length < 0) return 0;
int an,en,i;
an = 0;
en = length+1;
loop
{
if (an >= en-1)
{
if(an == en)
return en;
if (set[an].FDeg > p->FDeg)
return en;
if (set[an].FDeg < p->FDeg)
return an;
if (set[an].FDeg == p->FDeg)
{
number lcset,lcp;
lcset = pGetCoeff(set[an].p);
lcp = pGetCoeff(p->p);
if(!nGreaterZero(lcset))
{
set[an].p=p_Neg(set[an].p,currRing);
if (set[an].t_p!=NULL)
pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
lcset=pGetCoeff(set[an].p);
}
if(!nGreaterZero(lcp))
{
p->p=p_Neg(p->p,currRing);
if (p->t_p!=NULL)
pSetCoeff0(p->t_p,pGetCoeff(p->p));
lcp=pGetCoeff(p->p);
}
if(nGreater(lcset, lcp))
{
return en;
}
else
{
return an;
}
}
}
i=(an+en) / 2;
if (set[i].FDeg > p->FDeg)
an=i;
if (set[i].FDeg < p->FDeg)
en=i;
if (set[i].FDeg == p->FDeg)
{
number lcset,lcp;
lcset = pGetCoeff(set[i].p);
lcp = pGetCoeff(p->p);
if(!nGreaterZero(lcset))
{
set[i].p=p_Neg(set[i].p,currRing);
if (set[i].t_p!=NULL)
pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
lcset=pGetCoeff(set[i].p);
}
if(!nGreaterZero(lcp))
{
p->p=p_Neg(p->p,currRing);
if (p->t_p!=NULL)
pSetCoeff0(p->t_p,pGetCoeff(p->p));
lcp=pGetCoeff(p->p);
}
if(nGreater(lcset, lcp))
{
an = i;
}
else
{
en = i;
}
}
}
}
nGreater
#define nGreater(a, b)
Definition numbers.h:28

## posInL13()

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

Definition at line 6145 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg();
if (set[length].GetpFDeg() > o)
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (set[an].GetpFDeg() >= o)
return en;
return an;
}
i=(an+en) / 2;
if (set[i].GetpFDeg() >= o)
an=i;
else
en=i;
}
}

## posInL15()

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

Definition at line 6180 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg() + p->ecart;
int op = set[length].GetpFDeg() + set[length].ecart;
int cmp_int= -currRing->OrdSgn;
if ((op > o)
|| ((op == o) && (pLmCmp(set[length].p,p->p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg() + set[an].ecart;
if ((op > o)
|| ((op == o) && (pLmCmp(set[an].p,p->p) != cmp_int)))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg() + set[i].ecart;
if ((op > o)
|| ((op == o) && (pLmCmp(set[i].p,p->p) != cmp_int)))
an=i;
else
en=i;
}
}

## posInL15Ring()

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

Definition at line 6215 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg() + p->ecart;
int op = set[length].GetpFDeg() + set[length].ecart;
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg() + set[an].ecart;
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg() + set[i].ecart;
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
an=i;
else
en=i;
}
}

## posInL17()

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

Definition at line 6255 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg() + p->ecart;
int cmp_int= -currRing->OrdSgn;
if ((set[length].GetpFDeg() + set[length].ecart > o)
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart > p->ecart))
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart == p->ecart)
&& (pLmCmp(set[length].p,p->p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if ((set[an].GetpFDeg() + set[an].ecart > o)
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart > p->ecart))
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart == p->ecart)
&& (pLmCmp(set[an].p,p->p) != cmp_int)))
return en;
return an;
}
i=(an+en) / 2;
if ((set[i].GetpFDeg() + set[i].ecart > o)
|| ((set[i].GetpFDeg() + set[i].ecart == o)
&& (set[i].ecart > p->ecart))
|| ((set[i].GetpFDeg() +set[i].ecart == o)
&& (set[i].ecart == p->ecart)
&& (pLmCmp(set[i].p,p->p) != cmp_int)))
an=i;
else
en=i;
}
}

## posInL17_c()

int posInL17_c | ( | const LSet | set,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | )

Definition at line 6348 of file kutil.cc.

{
if (length<0) return 0;
int cc = (-1+2*currRing->order[0]==ringorder_c);
/* cc==1 for (c,..), cc==-1 for (C,..) */
long c = pGetComp(p->p)*cc;
int o = p->GetpFDeg() + p->ecart;
int cmp_int= -currRing->OrdSgn;
if (pGetComp(set[length].p)*cc > c)
return length+1;
if (pGetComp(set[length].p)*cc == c)
{
if ((set[length].GetpFDeg() + set[length].ecart > o)
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart > p->ecart))
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart == p->ecart)
&& (pLmCmp(set[length].p,p->p) != cmp_int)))
return length+1;
}
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pGetComp(set[an].p)*cc > c)
return en;
if (pGetComp(set[an].p)*cc == c)
{
if ((set[an].GetpFDeg() + set[an].ecart > o)
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart > p->ecart))
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart == p->ecart)
&& (pLmCmp(set[an].p,p->p) != cmp_int)))
return en;
}
return an;
}
i=(an+en) / 2;
if (pGetComp(set[i].p)*cc > c)
an=i;
else if (pGetComp(set[i].p)*cc == c)
{
if ((set[i].GetpFDeg() + set[i].ecart > o)
|| ((set[i].GetpFDeg() + set[i].ecart == o)
&& (set[i].ecart > p->ecart))
|| ((set[i].GetpFDeg() +set[i].ecart == o)
&& (set[i].ecart == p->ecart)
&& (pLmCmp(set[i].p,p->p) != cmp_int)))
an=i;
else
en=i;
}
else
en=i;
}
}

## posInL17_cRing()

int posInL17_cRing | ( | const LSet | set,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | )

Definition at line 6412 of file kutil.cc.

{
if (length<0) return 0;
int cc = (-1+2*currRing->order[0]==ringorder_c);
/* cc==1 for (c,..), cc==-1 for (C,..) */
long c = pGetComp(p->p)*cc;
int o = p->GetpFDeg() + p->ecart;
if (pGetComp(set[length].p)*cc > c)
return length+1;
if (pGetComp(set[length].p)*cc == c)
{
if ((set[length].GetpFDeg() + set[length].ecart > o)
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart > p->ecart))
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart == p->ecart)
&& (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
return length+1;
}
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pGetComp(set[an].p)*cc > c)
return en;
if (pGetComp(set[an].p)*cc == c)
{
if ((set[an].GetpFDeg() + set[an].ecart > o)
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart > p->ecart))
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart == p->ecart)
&& (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
return en;
}
return an;
}
i=(an+en) / 2;
if (pGetComp(set[i].p)*cc > c)
an=i;
else if (pGetComp(set[i].p)*cc == c)
{
if ((set[i].GetpFDeg() + set[i].ecart > o)
|| ((set[i].GetpFDeg() + set[i].ecart == o)
&& (set[i].ecart > p->ecart))
|| ((set[i].GetpFDeg() +set[i].ecart == o)
&& (set[i].ecart == p->ecart)
&& (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
an=i;
else
en=i;
}
else
en=i;
}
}

## posInL17Ring()

int posInL17Ring | ( | const LSet | set,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | )

Definition at line 6299 of file kutil.cc.

{
if (length<0) return 0;
int o = p->GetpFDeg() + p->ecart;
if ((set[length].GetpFDeg() + set[length].ecart > o)
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart > p->ecart))
|| ((set[length].GetpFDeg() + set[length].ecart == o)
&& (set[length].ecart == p->ecart)
&& (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if ((set[an].GetpFDeg() + set[an].ecart > o)
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart > p->ecart))
|| ((set[an].GetpFDeg() + set[an].ecart == o)
&& (set[an].ecart == p->ecart)
&& (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
return en;
return an;
}
i=(an+en) / 2;
if ((set[i].GetpFDeg() + set[i].ecart > o)
|| ((set[i].GetpFDeg() + set[i].ecart == o)
&& (set[i].ecart > p->ecart))
|| ((set[i].GetpFDeg() +set[i].ecart == o)
&& (set[i].ecart == p->ecart)
&& (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
an=i;
else
en=i;
}
}

## posInLF5CRing()

int posInLF5CRing | ( | const LSet | set,
|  | int | start,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | strat )

Definition at line 5878 of file kutil.cc.

{
if (length<0) return 0;
if(start == (length +1)) return (length+1);
int o = p->GetpFDeg();
int op = set[length].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
return length+1;
int i;
int an = start;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
return en;
return an;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if ((op > o)
|| ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
an=i;
else
en=i;
}
}

## posInLSig()

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

Definition at line 5669 of file kutil.cc.

{
if (length<0) return 0;
int cmp_int=currRing->OrdSgn;
if (pLtCmp(set[length].sig,p->sig)==cmp_int)
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pLtCmp(set[an].sig,p->sig) == cmp_int) return en;
return an;
}
i=(an+en) / 2;
if (pLtCmp(set[i].sig,p->sig) == cmp_int) an=i;
else en=i;
/*aend. fuer lazy == in !=- machen */
}
}

## posInLSigRing()

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

Definition at line 5694 of file kutil.cc.

{
assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
if (length<0) return 0;
if (pLtCmp(set[length].sig,p->sig)== 1)
return length+1;
int an,en,i;
an = 0;
en = length+1;
int cmp;
loop
{
if (an >= en-1)
{
if(an == en)
return en;
cmp = pLtCmp(set[an].sig,p->sig);
if (cmp == 1)
return en;
if (cmp == -1)
return an;
if (cmp == 0)
{
if (set[an].FDeg > p->FDeg)
return en;
if (set[an].FDeg < p->FDeg)
return an;
if (set[an].FDeg == p->FDeg)
{
cmp = pLtCmp(set[an].p,p->p);
if(cmp == 1)
return en;
else
return an;
}
}
}
i=(an+en) / 2;
cmp = pLtCmp(set[i].sig,p->sig);
if (cmp == 1)
an = i;
if (cmp == -1)
en = i;
if (cmp == 0)
{
if (set[i].FDeg > p->FDeg)
an = i;
if (set[i].FDeg < p->FDeg)
en = i;
if (set[i].FDeg == p->FDeg)
{
cmp = pLtCmp(set[i].p,p->p);
if(cmp == 1)
an = i;
else
en = i;
}
}
}
}

## posInLSpecial()

int posInLSpecial | ( | const LSet | set,
|  | const int | length,
|  | LObject * | p,
|  | const kStrategy | )

Definition at line 5567 of file kutil.cc.

{
if (length<0) return 0;
int d=p->GetpFDeg();
int op=set[length].GetpFDeg();
int cmp_int=currRing->OrdSgn;
if ((op > d)
|| ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
|| ((op == d) && ((p->p1==NULL) == (set[length].p1==NULL)) && (pLmCmp(set[length].p,p->p) == cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op=set[an].GetpFDeg();
if ((op > d)
|| ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
|| ((op == d) && ((p->p1==NULL) == (set[an].p1==NULL)) && (pLmCmp(set[an].p,p->p) == cmp_int)))
return en;
return an;
}
i=(an+en) / 2;
op=set[i].GetpFDeg();
if ((op>d)
|| ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
|| ((op==d) && ((p->p1==NULL) == (set[i].p1==NULL)) && (pLmCmp(set[i].p,p->p) == cmp_int)))
an=i;
else
en=i;
}
}

## posInS()

int posInS | ( | const kStrategy | strat,
|  | const int | length,
|  | const poly | p,
|  | const int | ecart_p )

Definition at line 4663 of file kutil.cc.

{
if(length==-1) return 0;
polyset set=strat->S;
int i;
int an = 0;
int en = length;
int cmp_int = currRing->OrdSgn;
if ((rHasMixedOrdering(currRing))
#ifdef HAVE_PLURAL
&& (currRing->real_var_start==0)
#endif
#if 0
|| ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
#endif
)
{
int o=p_Deg(p,currRing);
int oo=p_Deg(set[length],currRing);
if ((oo<o)
|| ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
return length+1;
loop
{
if (an >= en-1)
{
if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
{
return an;
}
return en;
}
i=(an+en) / 2;
if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
else an=i;
}
}
else
{
if (rField_is_Ring(currRing))
{
if (pLmCmp(set[length],p)== -cmp_int)
return length+1;
int cmp;
loop
{
if (an >= en-1)
{
cmp = pLmCmp(set[an],p);
if (cmp == cmp_int) return an;
if (cmp == -cmp_int) return en;
if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
return an;
}
i = (an+en) / 2;
cmp = pLmCmp(set[i],p);
if (cmp == cmp_int) en = i;
else if (cmp == -cmp_int) an = i;
else
{
if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
else en = i;
}
}
}
else
if (pLmCmp(set[length],p)== -cmp_int)
return length+1;
loop
{
if (an >= en-1)
{
if (pLmCmp(set[an],p) == cmp_int) return an;
if (pLmCmp(set[an],p) == -cmp_int) return en;
if ((cmp_int!=1)
&& ((strat->ecartS[an])>ecart_p))
return an;
return en;
}
i=(an+en) / 2;
if (pLmCmp(set[i],p) == cmp_int) en=i;
else if (pLmCmp(set[i],p) == -cmp_int) an=i;
else
{
if ((cmp_int!=1)
&&((strat->ecartS[i])<ecart_p))
en=i;
else
an=i;
}
}
}
}

## posInSMonFirst()

int posInSMonFirst | ( | const kStrategy | strat,
|  | const int | length,
|  | const poly | p )

Definition at line 4764 of file kutil.cc.

{
if (length<0) return 0;
polyset set=strat->S;
if(pNext(p) == NULL)
{
int mon = 0;
for(int i = 0;i<=length;i++)
{
if(set[i] != NULL && pNext(set[i]) == NULL)
mon++;
}
int o = p_Deg(p,currRing);
int op = p_Deg(set[mon],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[mon],p) == -1)))
return length+1;
int i;
int an = 0;
int en= mon;
loop
{
if (an >= en-1)
{
op = p_Deg(set[an],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[an],p) == -1)))
return en;
return an;
}
i=(an+en) / 2;
op = p_Deg(set[i],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[i],p) == -1)))
an=i;
else
en=i;
}
}
else /*if(pNext(p) != NULL)*/
{
int o = p_Deg(p,currRing);
int op = p_Deg(set[length],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[length],p) == -1)))
return length+1;
int i;
int an = 0;
for(i=0;i<=length;i++)
if(set[i] != NULL && pNext(set[i]) == NULL)
an++;
int en= length;
loop
{
if (an >= en-1)
{
op = p_Deg(set[an],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[an],p) == -1)))
return en;
return an;
}
i=(an+en) / 2;
op = p_Deg(set[i],currRing);
if ((op < o)
|| ((op == o) && (pLtCmp(set[i],p) == -1)))
an=i;
else
en=i;
}
}
}

## posInSyz()

int posInSyz | ( | const kStrategy | strat,
|  | poly | sig )

Definition at line 5758 of file kutil.cc.

{
if (strat->syzl==0) return 0;
int cmp_int=currRing->OrdSgn;
if (pLtCmp(strat->syz[strat->syzl-1],sig) != cmp_int)
return strat->syzl;
int i;
int an = 0;
int en= strat->syzl-1;
loop
{
if (an >= en-1)
{
if (pLtCmp(strat->syz[an],sig) != cmp_int) return en;
return an;
}
i=(an+en) / 2;
if (pLtCmp(strat->syz[i],sig) != cmp_int) an=i;
else en=i;
/*aend. fuer lazy == in !=- machen */
}
}

## posInT0()

int posInT0 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 4885 of file kutil.cc.

{
return (length+1);
}

## posInT1()

int posInT1 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 4896 of file kutil.cc.

{
if (length==-1) return 0;
if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
int i;
int an = 0;
int en= length;
int cmp_int=currRing->OrdSgn;
loop
{
if (an >= en-1)
{
if (pLmCmp(set[an].p,p.p) == cmp_int) return an;
return en;
}
i=(an+en) / 2;
if (pLmCmp(set[i].p,p.p) == cmp_int) en=i;
else an=i;
}
}

## posInT11()

int posInT11 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 4953 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg();
int op = set[length].GetpFDeg();
int cmp_int=currRing->OrdSgn;
if ((op < o)
|| ((op == o) && (pLmCmp(set[length].p,p.p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op= set[an].GetpFDeg();
if ((op > o)
|| (( op == o) && (pLmCmp(set[an].p,p.p) == cmp_int)))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if (( op > o)
|| (( op == o) && (pLmCmp(set[i].p,p.p) == cmp_int)))
en=i;
else
an=i;
}
}

## posInT110()

int posInT110 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5029 of file kutil.cc.

{
if (length==-1) return 0;
p.GetpLength();
int o = p.GetpFDeg();
int op = set[length].GetpFDeg();
int cmp_int=currRing->OrdSgn;
if (( op < o)
|| (( op == o) && (set[length].length<p.length))
|| (( op == o) && (set[length].length == p.length)
&& (pLmCmp(set[length].p,p.p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if (( op > o)
|| (( op == o) && (set[an].length > p.length))
|| (( op == o) && (set[an].length == p.length)
&& (pLmCmp(set[an].p,p.p) == cmp_int)))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if (( op > o)
|| (( op == o) && (set[i].length > p.length))
|| (( op == o) && (set[i].length == p.length)
&& (pLmCmp(set[i].p,p.p) == cmp_int)))
en=i;
else
an=i;
}
}

## posInT110Ring()

int posInT110Ring | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5071 of file kutil.cc.

{
if (length==-1) return 0;
p.GetpLength();
int o = p.GetpFDeg();
int op = set[length].GetpFDeg();
if (( op < o)
|| (( op == o) && (set[length].length<p.length))
|| (( op == o) && (set[length].length == p.length)
&& (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg();
if (( op > o)
|| (( op == o) && (set[an].length > p.length))
|| (( op == o) && (set[an].length == p.length)
&& (pLtCmpOrdSgnEqP(set[an].p,p.p))))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if (( op > o)
|| (( op == o) && (set[i].length > p.length))
|| (( op == o) && (set[i].length == p.length)
&& (pLtCmpOrdSgnEqP(set[i].p,p.p))))
en=i;
else
an=i;
}
}
pLtCmpOrdSgnDiffP
#define pLtCmpOrdSgnDiffP(p, q)
Definition polys.h:127

## posInT11Ring()

int posInT11Ring | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 4989 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg();
int op = set[length].GetpFDeg();
if ((op < o)
|| ((op == o) && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op= set[an].GetpFDeg();
if ((op > o)
|| (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg();
if (( op > o)
|| (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
en=i;
else
an=i;
}
}

## posInT13()

int posInT13 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5117 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg();
if (set[length].GetpFDeg() <= o)
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (set[an].GetpFDeg() > o)
return an;
return en;
}
i=(an+en) / 2;
if (set[i].GetpFDeg() > o)
en=i;
else
an=i;
}
}

## posInT15()

int posInT15 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5184 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg() + p.ecart;
int op = set[length].GetpFDeg()+set[length].ecart;
int cmp_int=currRing->OrdSgn;
if ((op < o)
|| ((op == o)
&& (pLmCmp(set[length].p,p.p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg()+set[an].ecart;
if (( op > o)
|| (( op == o) && (pLmCmp(set[an].p,p.p) == cmp_int)))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg()+set[i].ecart;
if (( op > o)
|| (( op == o) && (pLmCmp(set[i].p,p.p) == cmp_int)))
en=i;
else
an=i;
}
}

## posInT15Ring()

int posInT15Ring | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5238 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg() + p.ecart;
int op = set[length].GetpFDeg()+set[length].ecart;
if ((op < o)
|| ((op == o)
&& (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg()+set[an].ecart;
if (( op > o)
|| (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg()+set[i].ecart;
if (( op > o)
|| (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
en=i;
else
an=i;
}
}

## posInT17()

int posInT17 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5278 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg() + p.ecart;
int op = set[length].GetpFDeg()+set[length].ecart;
int cmp_int=currRing->OrdSgn;
if ((op < o)
|| (( op == o) && (set[length].ecart > p.ecart))
|| (( op == o) && (set[length].ecart==p.ecart)
&& (pLmCmp(set[length].p,p.p) != cmp_int)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg()+set[an].ecart;
if (( op > o)
|| (( op == o) && (set[an].ecart < p.ecart))
|| (( op == o) && (set[an].ecart==p.ecart)
&& (pLmCmp(set[an].p,p.p) == cmp_int)))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg()+set[i].ecart;
if ((op > o)
|| (( op == o) && (set[i].ecart < p.ecart))
|| (( op == o) && (set[i].ecart == p.ecart)
&& (pLmCmp(set[i].p,p.p) == cmp_int)))
en=i;
else
an=i;
}
}

## posInT17_c()

int posInT17_c | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5384 of file kutil.cc.

{
if (length==-1) return 0;
int cc = (-1+2*currRing->order[0]==ringorder_c);
/* cc==1 for (c,..), cc==-1 for (C,..) */
int o = p.GetpFDeg() + p.ecart;
int c = pGetComp(p.p)*cc;
int cmp_int=currRing->OrdSgn;
if (pGetComp(set[length].p)*cc < c)
return length+1;
if (pGetComp(set[length].p)*cc == c)
{
int op = set[length].GetpFDeg()+set[length].ecart;
if ((op < o)
|| ((op == o) && (set[length].ecart > p.ecart))
|| ((op == o) && (set[length].ecart==p.ecart)
&& (pLmCmp(set[length].p,p.p) != cmp_int)))
return length+1;
}
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pGetComp(set[an].p)*cc < c)
return en;
if (pGetComp(set[an].p)*cc == c)
{
int op = set[an].GetpFDeg()+set[an].ecart;
if ((op > o)
|| ((op == o) && (set[an].ecart < p.ecart))
|| ((op == o) && (set[an].ecart==p.ecart)
&& (pLmCmp(set[an].p,p.p) == cmp_int)))
return an;
}
return en;
}
i=(an+en) / 2;
if (pGetComp(set[i].p)*cc > c)
en=i;
else if (pGetComp(set[i].p)*cc == c)
{
int op = set[i].GetpFDeg()+set[i].ecart;
if ((op > o)
|| ((op == o) && (set[i].ecart < p.ecart))
|| ((op == o) && (set[i].ecart == p.ecart)
&& (pLmCmp(set[i].p,p.p) == cmp_int)))
en=i;
else
an=i;
}
else
an=i;
}
}

## posInT17_cRing()

int posInT17_cRing | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5445 of file kutil.cc.

{
if (length==-1) return 0;
int cc = (-1+2*currRing->order[0]==ringorder_c);
/* cc==1 for (c,..), cc==-1 for (C,..) */
int o = p.GetpFDeg() + p.ecart;
int c = pGetComp(p.p)*cc;
if (pGetComp(set[length].p)*cc < c)
return length+1;
if (pGetComp(set[length].p)*cc == c)
{
int op = set[length].GetpFDeg()+set[length].ecart;
if ((op < o)
|| ((op == o) && (set[length].ecart > p.ecart))
|| ((op == o) && (set[length].ecart==p.ecart)
&& (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
return length+1;
}
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (pGetComp(set[an].p)*cc < c)
return en;
if (pGetComp(set[an].p)*cc == c)
{
int op = set[an].GetpFDeg()+set[an].ecart;
if ((op > o)
|| ((op == o) && (set[an].ecart < p.ecart))
|| ((op == o) && (set[an].ecart==p.ecart)
&& (pLtCmpOrdSgnEqP(set[an].p,p.p))))
return an;
}
return en;
}
i=(an+en) / 2;
if (pGetComp(set[i].p)*cc > c)
en=i;
else if (pGetComp(set[i].p)*cc == c)
{
int op = set[i].GetpFDeg()+set[i].ecart;
if ((op > o)
|| ((op == o) && (set[i].ecart < p.ecart))
|| ((op == o) && (set[i].ecart == p.ecart)
&& (pLtCmpOrdSgnEqP(set[i].p,p.p))))
en=i;
else
an=i;
}
else
an=i;
}
}

## posInT17Ring()

int posInT17Ring | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5339 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.GetpFDeg() + p.ecart;
int op = set[length].GetpFDeg()+set[length].ecart;
if ((op < o)
|| (( op == o) && (set[length].ecart > p.ecart))
|| (( op == o) && (set[length].ecart==p.ecart)
&& (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
op = set[an].GetpFDeg()+set[an].ecart;
if (( op > o)
|| (( op == o) && (set[an].ecart < p.ecart))
|| (( op == o) && (set[an].ecart==p.ecart)
&& (pLtCmpOrdSgnEqP(set[an].p,p.p))))
return an;
return en;
}
i=(an+en) / 2;
op = set[i].GetpFDeg()+set[i].ecart;
if ((op > o)
|| (( op == o) && (set[i].ecart < p.ecart))
|| (( op == o) && (set[i].ecart == p.ecart)
&& (pLtCmpOrdSgnEqP(set[i].p,p.p))))
en=i;
else
an=i;
}
}

## posInT19()

int posInT19 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5510 of file kutil.cc.

{
p.GetpLength();
if (length==-1) return 0;
int o = p.ecart;
int op=p.GetpFDeg();
if (set[length].ecart < o)
return length+1;
if (set[length].ecart == o)
{
int oo=set[length].GetpFDeg();
if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
return length+1;
}
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (set[an].ecart > o)
return an;
if (set[an].ecart == o)
{
int oo=set[an].GetpFDeg();
if((oo > op)
|| ((oo==op) && (set[an].length > p.length)))
return an;
}
return en;
}
i=(an+en) / 2;
if (set[i].ecart > o)
en=i;
else if (set[i].ecart == o)
{
int oo=set[i].GetpFDeg();
if ((oo > op)
|| ((oo == op) && (set[i].length > p.length)))
en=i;
else
an=i;
}
else
an=i;
}
}

## posInT2()

int posInT2 | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 4925 of file kutil.cc.

{
if (length==-1) return 0;
p.GetpLength();
if (set[length].length<p.length) return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (set[an].length>p.length) return an;
return en;
}
i=(an+en) / 2;
if (set[i].length>p.length) en=i;
else an=i;
}
}

## posInT_EcartFDegpLength()

int posInT_EcartFDegpLength | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 11358 of file kutil.cc.

{
if (length==-1) return 0;
int o = p.ecart;
int op=p.GetpFDeg();
int ol = p.GetpLength();
if (set[length].ecart < o)
return length+1;
if (set[length].ecart == o)
{
int oo=set[length].GetpFDeg();
if ((oo < op) || ((oo==op) && (set[length].length < ol)))
return length+1;
}
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (set[an].ecart > o)
return an;
if (set[an].ecart == o)
{
int oo=set[an].GetpFDeg();
if((oo > op)
|| ((oo==op) && (set[an].pLength > ol)))
return an;
}
return en;
}
i=(an+en) / 2;
if (set[i].ecart > o)
en=i;
else if (set[i].ecart == o)
{
int oo=set[i].GetpFDeg();
if ((oo > op)
|| ((oo == op) && (set[i].pLength > ol)))
en=i;
else
an=i;
}
else
an=i;
}
}

## posInT_EcartpLength()

int posInT_EcartpLength | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 5146 of file kutil.cc.

{
if (length==-1) return 0;
int ol = p.GetpLength();
int op=p.ecart;
int oo=set[length].ecart;
if ((oo < op) || ((oo==op) && (set[length].length <= ol)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
int oo=set[an].ecart;
if((oo > op)
|| ((oo==op) && (set[an].pLength > ol)))
return an;
return en;
}
i=(an+en) / 2;
int oo=set[i].ecart;
if ((oo > op)
|| ((oo == op) && (set[i].pLength > ol)))
en=i;
else
an=i;
}
}

## posInT_FDegpLength()

int posInT_FDegpLength | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 11412 of file kutil.cc.

{
if (length==-1) return 0;
int op=p.GetpFDeg();
int ol = p.GetpLength();
int oo=set[length].GetpFDeg();
if ((oo < op) || ((oo==op) && (set[length].length < ol)))
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
int oo=set[an].GetpFDeg();
if((oo > op)
|| ((oo==op) && (set[an].pLength > ol)))
return an;
return en;
}
i=(an+en) / 2;
int oo=set[i].GetpFDeg();
if ((oo > op)
|| ((oo == op) && (set[i].pLength > ol)))
en=i;
else
an=i;
}
}

## posInT_pLength()

int posInT_pLength | ( | const TSet | set,
|  | const int | length,
|  | LObject & | p )

Definition at line 11449 of file kutil.cc.

{
int ol = p.GetpLength();
if (length==-1)
return 0;
if (set[length].length<p.length)
return length+1;
int i;
int an = 0;
int en= length;
loop
{
if (an >= en-1)
{
if (set[an].pLength>ol) return an;
return en;
}
i=(an+en) / 2;
if (set[i].pLength>ol) en=i;
else an=i;
}
}

## postReduceByMon()

void postReduceByMon | ( | LObject * | h,
|  | kStrategy | strat )

used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell

Definition at line 10682 of file kutil.cc.

{
if(!nCoeff_is_Z(currRing->cf))
return;
poly pH = h->GetP();
poly p,pp;
p = pH;
bool deleted = FALSE, ok = FALSE;
for(int i = 0; i<=strat->sl; i++)
{
p = pH;
if(pNext(strat->S[i]) == NULL)
{
//pWrite(p);
//pWrite(strat->S[i]);
while(ok == FALSE && p != NULL)
{
if(pLmDivisibleBy(strat->S[i], p)
#ifdef HAVE_SHIFTBBA
|| (rIsLPRing(currRing) && pLPLmDivisibleBy(strat->S[i], p))
#endif
)
{
number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
p_SetCoeff(p,dummy,currRing);
}
if(nIsZero(p->coef))
{
pLmDelete(&p);
h->p = p;
deleted = TRUE;
}
else
{
ok = TRUE;
}
}
if (p!=NULL)
{
pp = pNext(p);
while(pp != NULL)
{
if(pLmDivisibleBy(strat->S[i], pp)
#ifdef HAVE_SHIFTBBA
|| (rIsLPRing(currRing) && pLPLmDivisibleBy(strat->S[i], pp))
#endif
)
{
number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
p_SetCoeff(pp,dummy,currRing);
if(nIsZero(pp->coef))
{
pLmDelete(&pNext(p));
pp = pNext(p);
deleted = TRUE;
}
else
{
p = pp;
pp = pNext(p);
}
}
else
{
p = pp;
pp = pNext(p);
}
}
}
}
}
h->SetLmCurrRing();
if((deleted)&&(h->p!=NULL))
strat->initEcart(h);
}

## postReduceByMonSig()

void postReduceByMonSig | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 10758 of file kutil.cc.

{
if(!nCoeff_is_Z(currRing->cf))
return;
poly hSig = h->sig;
poly pH = h->GetP();
poly p,pp;
p = pH;
bool deleted = FALSE, ok = FALSE;
for(int i = 0; i<=strat->sl; i++)
{
p = pH;
if(pNext(strat->S[i]) == NULL)
{
while(ok == FALSE && p!=NULL)
{
if(pLmDivisibleBy(strat->S[i], p))
{
poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
{
number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
p_SetCoeff(p,dummy,currRing);
}
pDelete(&sigMult);
}
if(nIsZero(p->coef))
{
pLmDelete(&p);
h->p = p;
deleted = TRUE;
}
else
{
ok = TRUE;
}
}
if(p == NULL)
return;
pp = pNext(p);
while(pp != NULL)
{
if(pLmDivisibleBy(strat->S[i], pp))
{
poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
{
number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
p_SetCoeff(pp,dummy,currRing);
if(nIsZero(pp->coef))
{
pLmDelete(&pNext(p));
pp = pNext(p);
deleted = TRUE;
}
else
{
p = pp;
pp = pNext(p);
}
}
else
{
p = pp;
pp = pNext(p);
}
pDelete(&sigMult);
}
else
{
p = pp;
pp = pNext(p);
}
}
}
}
h->SetLmCurrRing();
if(deleted)
strat->initEcart(h);
}
ppMult_mm
#define ppMult_mm(p, m)
Definition polys.h:202
pDivideM
#define pDivideM(a, b)
Definition polys.h:295

## preIntegerCheck()

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 constant element of ideal suppresses intermediate coefficient swell

Definition at line 10518 of file kutil.cc.

{
assume(nCoeff_is_Z(currRing->cf));
ideal F = idCopy(Forig);
idSkipZeroes(F);
poly pmon;
ring origR = currRing;
ideal monred = idInit(1,1);
for(int i=0; i<idElem(F); i++)
{
if(pNext(F->m[i]) == NULL)
idInsertPoly(monred, pCopy(F->m[i]));
}
int posconst = idPosConstant(F);
if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
{
idDelete(&F);
idDelete(&monred);
return NULL;
}
int idelemQ = 0;
if(Q!=NULL)
{
idelemQ = IDELEMS(Q);
for(int i=0; i<idelemQ; i++)
{
if(pNext(Q->m[i]) == NULL)
idInsertPoly(monred, pCopy(Q->m[i]));
}
idSkipZeroes(monred);
posconst = idPosConstant(monred);
//the constant, if found, will be from Q
if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
{
pmon = pCopy(monred->m[posconst]);
idDelete(&F);
idDelete(&monred);
return pmon;
}
}
ring QQ_ring = rCopy0(currRing,FALSE);
nKillChar(QQ_ring->cf);
QQ_ring->cf = nInitChar(n_Q, NULL);
rComplete(QQ_ring,1);
QQ_ring = rAssure_c_dp(QQ_ring);
rChangeCurrRing(QQ_ring);
nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
for(int i = 0, j = 0; i<IDELEMS(F); i++)
II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
ideal one = kStd2(II, NULL, isNotHomog, NULL,(bigintmat*)NULL);
idSkipZeroes(one);
if(idIsConstant(one))
{
//one should be <1>
for(int i = IDELEMS(II)-1; i>=0; i--)
if(II->m[i] != NULL)
II->m[i+1] = II->m[i];
II->m[0] = pOne();
ideal syz = idSyzygies(II, isNotHomog, NULL);
poly integer = NULL;
for(int i = IDELEMS(syz)-1;i>=0; i--)
{
if(pGetComp(syz->m[i]) == 1)
{
pSetComp(syz->m[i],0);
if(pIsConstant(pHead(syz->m[i])))
{
integer = pHead(syz->m[i]);
break;
}
}
}
rChangeCurrRing(origR);
nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
pmon = prMapR(integer, nMap2, QQ_ring, origR);
idDelete(&monred);
idDelete(&F);
id_Delete(&II,QQ_ring);
id_Delete(&one,QQ_ring);
id_Delete(&syz,QQ_ring);
p_Delete(&integer,QQ_ring);
rDelete(QQ_ring);
return pmon;
}
else
{
if(idIs0(monred))
{
poly mindegmon = NULL;
for(int i = 0; i<IDELEMS(one); i++)
{
if(pNext(one->m[i]) == NULL)
{
if(mindegmon == NULL)
mindegmon = pCopy(one->m[i]);
else
{
if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
mindegmon = pCopy(one->m[i]);
}
}
}
if(mindegmon != NULL)
{
for(int i = IDELEMS(II)-1; i>=0; i--)
if(II->m[i] != NULL)
II->m[i+1] = II->m[i];
II->m[0] = pCopy(mindegmon);
ideal syz = idSyzygies(II, isNotHomog, NULL);
bool found = FALSE;
for(int i = IDELEMS(syz)-1;i>=0; i--)
{
if(pGetComp(syz->m[i]) == 1)
{
pSetComp(syz->m[i],0);
if(pIsConstant(pHead(syz->m[i])))
{
pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
found = TRUE;
break;
}
}
}
id_Delete(&syz,QQ_ring);
if (found == FALSE)
{
rChangeCurrRing(origR);
idDelete(&monred);
idDelete(&F);
id_Delete(&II,QQ_ring);
id_Delete(&one,QQ_ring);
rDelete(QQ_ring);
return NULL;
}
rChangeCurrRing(origR);
nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
idDelete(&monred);
idDelete(&F);
id_Delete(&II,QQ_ring);
id_Delete(&one,QQ_ring);
id_Delete(&syz,QQ_ring);
rDelete(QQ_ring);
return pmon;
}
}
}
rChangeCurrRing(origR);
idDelete(&monred);
idDelete(&F);
id_Delete(&II,QQ_ring);
id_Delete(&one,QQ_ring);
rDelete(QQ_ring);
return NULL;
}
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
n_Q
@ n_Q
rational (GMP) numbers
Definition coeffs.h:30
n_SetMap
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:703
nInitChar
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition numbers.cc:412
nMapFunc
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
nKillChar
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:563
idSyzygies
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg, GbVariant alg)
Definition ideals.cc:836
idIsConstant
#define idIsConstant(I)
Definition ideals.h:40
idInsertPoly
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted
Definition simpleideals.cc:832
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition simpleideals.cc:960
idCopy
ideal idCopy(ideal A)
Definition ideals.h:60
idPosConstant
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition ideals.h:37
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
Definition kstd1.cc:2607
rChangeCurrRing
void rChangeCurrRing(ring r)
Definition polys.cc:16
prMapR
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition prCopy.cc:45
rComplete
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition ring.cc:3527
rAssure_c_dp
ring rAssure_c_dp(const ring r)
Definition ring.cc:5134
rCopy0
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1427
rDelete
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
id_Delete
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition simpleideals.cc:123
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition simpleideals.cc:992
idElem
static int idElem(const ideal F)
number of non-zero polys in F
Definition simpleideals.h:69
isNotHomog
@ isNotHomog
Definition structs.h:32

## redBba()

poly redBba | ( | poly | h,
|  | int | maxIndex,
|  | kStrategy | strat )

static

Definition at line 8488 of file kutil.cc.

{
int j = 0;
unsigned long not_sev = ~ pGetShortExpVector(h);
while (j <= maxIndex)
{
if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
{
h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
if (h==NULL) return NULL;
j = 0;
not_sev = ~ pGetShortExpVector(h);
}
else j++;
}
return h;
}
ksOldSpolyRed
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition kInline.h:1174
pLmShortDivisibleBy
#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

## redBba1()

poly redBba1 | ( | poly | h,
|  | int | maxIndex,
|  | kStrategy | strat )

static

Definition at line 8385 of file kutil.cc.

{
int j = 0;
unsigned long not_sev = ~ pGetShortExpVector(h);
while (j <= maxIndex)
{
if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
else j++;
}
return h;
}
ksOldSpolyRedNew
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition kInline.h:1184

## redMora()

poly redMora | ( | poly | h,
|  | int | maxIndex,
|  | kStrategy | strat )

static

Definition at line 8512 of file kutil.cc.

{
int j=0;
int e,l;
unsigned long not_sev = ~ pGetShortExpVector(h);
if (maxIndex >= 0)
{
e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
do
{
if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
&& ((e >= strat->ecartS[j]) || (strat->kNoether!=NULL)))
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);
}
#endif
h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
#ifdef KDEBUG
if(TEST_OPT_DEBUG)
{
PrintS(")\nto "); wrp(h); PrintLn();
}
#endif
// pDelete(&h);
if (h == NULL) return NULL;
e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
j = 0;
not_sev = ~ pGetShortExpVector(h);
}
else j++;
}
while (j <= maxIndex);
}
return h;
}

## redtail() [1/2]

poly redtail | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 6836 of file kutil.cc.

{
poly h, hn;
strat->redTailChange=FALSE;
L->GetP();
poly p = L->p;
if (strat->noTailReduction || pNext(p) == NULL)
return p;
LObject Ln(strat->tailRing);
TObject* With;
// placeholder in case strat->tl < 0
TObject With_s(strat->tailRing);
h = p;
hn = pNext(h);
long op = strat->tailRing->pFDeg(hn, strat->tailRing);
long e;
int l;
BOOLEAN save_HE=strat->kAllAxis;
strat->kAllAxis |=
((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
while(hn != NULL)
{
op = strat->tailRing->pFDeg(hn, strat->tailRing);
if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
loop
{
Ln.Set(hn, strat->tailRing);
Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
if (strat->kAllAxis)
With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
else
With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s, e);
if (With == NULL) break;
With->length=0;
With->pLength=0;
strat->redTailChange=TRUE;
if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
{
// reducing the tail would violate the exp bound
if (kStratChangeTailRing(strat, L))
{
strat->kAllAxis = save_HE;
return redtail(L, end_pos, strat);
}
else
return NULL;
}
hn = pNext(h);
if (hn == NULL) goto all_done;
op = strat->tailRing->pFDeg(hn, strat->tailRing);
if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
}
h = hn;
hn = pNext(h);
}
all_done:
if (strat->redTailChange)
{
L->pLength = 0;
}
strat->kAllAxis = save_HE;
return p;
}
ksReducePolyTail
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition kInline.h:1147
kFindDivisibleByInS_T
TObject * kFindDivisibleByInS_T(kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart)
Definition kutil.cc:6697
TEST_OPT_INFREDTAIL
#define TEST_OPT_INFREDTAIL
Definition options.h:120

## redtail() [2/2]

poly redtail | ( | poly | p,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 6906 of file kutil.cc.

{
LObject L(p, currRing);
return redtail(&L, end_pos, strat);
}

## redtailBba()

poly redtailBba | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat,
|  | BOOLEAN | withT,
|  | BOOLEAN | normalize )

Definition at line 6912 of file kutil.cc.

{
strat->redTailChange=FALSE;
if (strat->noTailReduction) return L->GetLmCurrRing();
poly h, p;
p = h = L->GetLmTailRing();
if ((h==NULL) || (pNext(h)==NULL))
return L->GetLmCurrRing();
TObject* With;
// placeholder in case strat->tl < 0
TObject With_s(strat->tailRing);
LObject Ln(pNext(h), strat->tailRing);
Ln.GetpLength();
pNext(h) = NULL;
if (L->p != NULL)
{
pNext(L->p) = NULL;
if (L->t_p != NULL) pNext(L->t_p) = NULL;
}
L->pLength = 1;
Ln.PrepareRed(strat->use_buckets);
int cnt=REDTAIL_CANONICALIZE;
while(!Ln.IsNull())
{
loop
{
if (TEST_OPT_IDLIFT)
{
if (Ln.p!=NULL)
{
if ((int)__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
}
else
{
if ((int)__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
}
}
Ln.SetShortExpVector();
if (withT)
{
int j;
j = kFindDivisibleByInT(strat, &Ln);
if (j < 0) break;
With = &(strat->T[j]);
assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
}
else
{
With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
if (With == NULL) break;
assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
}
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
if (normalize)
{
Ln.Normalize();
//pNormalize(tmp);
//if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
}
}
if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
{
With->pNorm();
}
strat->redTailChange=TRUE;
if (ksReducePolyTail(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
if (Ln.IsNull()) goto all_done;
if (! withT) With_s.Init(currRing);
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
pNormalize(h);
L->pLength++;
}
all_done:
Ln.Delete();
if (L->p != NULL) pNext(L->p) = pNext(p);
if (strat->redTailChange)
{
L->length = 0;
L->pLength = 0;
}
//if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
//L->Normalize(); // HANNES: should have a test
kTest_L(L,strat);
return L->GetLmCurrRing();
}
skStrategy::completeReduce_retry
char completeReduce_retry
Definition kutil.h:400
kFindDivisibleByInT
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
REDTAIL_CANONICALIZE
#define REDTAIL_CANONICALIZE
Definition kutil.h:39
pNormalize
#define pNormalize(p)
Definition polys.h:318
normalize
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition syz3.cc:1027

## redtailBba_NF()

poly redtailBba_NF | ( | poly | p,
|  | kStrategy | strat )

Definition at line 7350 of file kutil.cc.

{
strat->redTailChange=FALSE;
if (strat->noTailReduction) return p;
if ((p==NULL) || (pNext(p)==NULL))
return p;
int max_ind;
poly h=p;
p=pNext(p);
pNext(h)=NULL;
while(p!=NULL)
{
p=redNF(p,max_ind,1,strat);
if (p!=NULL)
{
poly hh=p;
p=pNext(p);
pNext(hh)=NULL;
h=p_Add_q(h,hh,currRing);
}
}
return h;
}
redNF
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition kstd2.cc:2307

## redtailBba_Ring()

poly redtailBba_Ring | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 7375 of file kutil.cc.

{
strat->redTailChange=FALSE;
if (strat->noTailReduction) return L->GetLmCurrRing();
poly h, p;
p = h = L->GetLmTailRing();
if ((h==NULL) || (pNext(h)==NULL))
return L->GetLmCurrRing();
TObject* With;
// placeholder in case strat->tl < 0
TObject With_s(strat->tailRing);
LObject Ln(pNext(h), strat->tailRing);
Ln.pLength = L->GetpLength() - 1;
pNext(h) = NULL;
if (L->p != NULL) pNext(L->p) = NULL;
L->pLength = 1;
Ln.PrepareRed(strat->use_buckets);
int cnt=REDTAIL_CANONICALIZE;
while(!Ln.IsNull())
{
loop
{
Ln.SetShortExpVector();
With_s.Init(currRing);
With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
if (With == NULL) break;
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
}
// we are in a ring, do not call pNorm
// test divisibility of coefs:
poly p_Ln=Ln.GetLmCurrRing();
poly p_With=With->GetLmCurrRing();
if (n_DivBy(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf))
{
strat->redTailChange=TRUE;
if (ksReducePolyTail_Z(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
}
else break; /*proceed to next monomial*/
if (Ln.IsNull()) goto all_done;
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
pNormalize(h);
L->pLength++;
}
all_done:
Ln.Delete();
if (L->p != NULL) pNext(L->p) = pNext(p);
if (strat->redTailChange)
{
L->length = 0;
}
//if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
//L->Normalize(); // HANNES: should have a test
kTest_L(L,strat);
return L->GetLmCurrRing();
}
ksReducePolyTail_Z
KINLINE int ksReducePolyTail_Z(LObject *PR, TObject *PW, LObject *Red)
Definition kInline.h:1125

## redtailBba_Z()

poly redtailBba_Z | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 7269 of file kutil.cc.

{
strat->redTailChange=FALSE;
if (strat->noTailReduction) return L->GetLmCurrRing();
poly h, p;
p = h = L->GetLmTailRing();
if ((h==NULL) || (pNext(h)==NULL))
return L->GetLmCurrRing();
TObject* With;
// placeholder in case strat->tl < 0
TObject With_s(strat->tailRing);
LObject Ln(pNext(h), strat->tailRing);
Ln.pLength = L->GetpLength() - 1;
pNext(h) = NULL;
if (L->p != NULL) pNext(L->p) = NULL;
L->pLength = 1;
Ln.PrepareRed(strat->use_buckets);
int cnt=REDTAIL_CANONICALIZE;
while(!Ln.IsNull())
{
loop
{
Ln.SetShortExpVector();
With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
if (With == NULL) break;
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
}
// we are in Z, do not call pNorm
strat->redTailChange=TRUE;
// test divisibility of coefs:
Ln.GetLmCurrRing();
With->GetLmCurrRing();
if (ksReducePolyTail_Z(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
if (Ln.IsNull()) goto all_done;
With_s.Init(currRing);
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
pNormalize(h);
L->pLength++;
}
all_done:
Ln.Delete();
if (L->p != NULL) pNext(L->p) = pNext(p);
if (strat->redTailChange)
{
L->length = 0;
}
//if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
//L->Normalize(); // HANNES: should have a test
kTest_L(L,strat);
return L->GetLmCurrRing();
}

## redtailBbaAlsoLC_Z()

void redtailBbaAlsoLC_Z | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 7140 of file kutil.cc.

{
strat->redTailChange=FALSE;
poly h, p;
p = h = L->GetLmTailRing();
if ((h==NULL) || (pNext(h)==NULL))
return;
TObject* With;
LObject Ln(pNext(h), strat->tailRing);
Ln.GetpLength();
pNext(h) = NULL;
if (L->p != NULL)
{
pNext(L->p) = NULL;
if (L->t_p != NULL) pNext(L->t_p) = NULL;
}
L->pLength = 1;
Ln.PrepareRed(strat->use_buckets);
int cnt=REDTAIL_CANONICALIZE;
while(!Ln.IsNull())
{
loop
{
if (TEST_OPT_IDLIFT)
{
if (Ln.p!=NULL)
{
if ((int)__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
}
else
{
if ((int)__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
}
}
Ln.SetShortExpVector();
int j;
j = kFindDivisibleByInT(strat, &Ln);
if (j < 0)
{
j = kFindDivisibleByInT_Z(strat, &Ln);
if (j < 0)
{
break;
}
else
{
/* reduction not cancelling a tail term, but reducing its coefficient */
With = &(strat->T[j]);
assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
}
strat->redTailChange=TRUE;
/* reduction cancelling a tail term */
if (ksReducePolyTailLC_Z(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
/* we have to break since we did not cancel the term, but only decreased
* its coefficient. */
break;
}
} else {
With = &(strat->T[j]);
assume(With->GetpLength()==pLength(With->p != __null ? With->p : With->t_p));
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
}
strat->redTailChange=TRUE;
/* reduction cancelling a tail term */
if (ksReducePolyTail_Z(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
}
if (Ln.IsNull()) goto all_done;
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
}
all_done:
Ln.Delete();
if (L->p != NULL) pNext(L->p) = pNext(p);
if (strat->redTailChange)
{
L->length = 0;
L->pLength = 0;
}
kTest_L(L, strat);
return;
}
ksReducePolyTailLC_Z
KINLINE int ksReducePolyTailLC_Z(LObject *PR, TObject *PW, LObject *Red)
Definition kInline.h:1107
kFindDivisibleByInT_Z
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition kstd2.cc:209

## redtailBbaBound()

poly redtailBbaBound | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat,
|  | int | bound,
|  | BOOLEAN | withT,
|  | BOOLEAN | normalize )

Definition at line 7025 of file kutil.cc.

{
strat->redTailChange=FALSE;
if (strat->noTailReduction) return L->GetLmCurrRing();
poly h, p;
p = h = L->GetLmTailRing();
if ((h==NULL) || (pNext(h)==NULL))
return L->GetLmCurrRing();
TObject* With;
// placeholder in case strat->tl < 0
TObject With_s(strat->tailRing);
LObject Ln(pNext(h), strat->tailRing);
Ln.pLength = L->GetpLength() - 1;
pNext(h) = NULL;
if (L->p != NULL) pNext(L->p) = NULL;
L->pLength = 1;
Ln.PrepareRed(strat->use_buckets);
int cnt=REDTAIL_CANONICALIZE;
while(!Ln.IsNull())
{
loop
{
if (TEST_OPT_IDLIFT)
{
if (Ln.p!=NULL)
{
if ((int)__p_GetComp(Ln.p,currRing)> strat->syzComp) break;
}
else
{
if ((int)__p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
}
}
Ln.SetShortExpVector();
if (withT)
{
int j;
j = kFindDivisibleByInT(strat, &Ln);
if (j < 0) break;
With = &(strat->T[j]);
}
else
{
With = kFindDivisibleByInS_T(strat, end_pos, &Ln, &With_s);
if (With == NULL) break;
}
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
if (normalize)
{
Ln.Normalize();
//pNormalize(tmp);
//if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
}
}
if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
{
With->pNorm();
}
strat->redTailChange=TRUE;
if (ksReducePolyTail(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
if(!Ln.IsNull())
{
Ln.GetP();
Ln.p = pJet(Ln.p,bound);
}
if (Ln.IsNull())
{
goto all_done;
}
if (! withT) With_s.Init(currRing);
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
pNormalize(h);
L->pLength++;
}
all_done:
Ln.Delete();
if (L->p != NULL) pNext(L->p) = pNext(p);
if (strat->redTailChange)
{
L->length = 0;
L->pLength = 0;
}
//if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
//L->Normalize(); // HANNES: should have a test
kTest_L(L,strat);
return L->GetLmCurrRing();
}
bound
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
pJet
#define pJet(p, m)
Definition polys.h:368

## redtailBbaShift()

poly redtailBbaShift | ( | LObject * | L,
|  | int | pos,
|  | kStrategy | strat,
|  | BOOLEAN | withT,
|  | BOOLEAN | normalize )

Definition at line 12980 of file kutil.cc.

{
/* for the shift case need to run it with withT = TRUE */
strat->redTailChange=FALSE;
if (strat->noTailReduction) return L->GetLmCurrRing();
poly h, p;
p = h = L->GetLmTailRing();
if ((h==NULL) || (pNext(h)==NULL))
return L->GetLmCurrRing();
TObject* With;
// placeholder in case strat->tl < 0
TObject With_s(strat->tailRing);
LObject Ln(pNext(h), strat->tailRing);
Ln.pLength = L->GetpLength() - 1;
pNext(h) = NULL;
if (L->p != NULL) pNext(L->p) = NULL;
L->pLength = 1;
Ln.PrepareRed(strat->use_buckets);
while(!Ln.IsNull())
{
loop
{
Ln.SetShortExpVector();
if (withT)
{
int j;
j = kFindDivisibleByInT(strat, &Ln);
if (j < 0) break;
With = &(strat->T[j]);
}
else
{
With = kFindDivisibleByInS_T(strat, pos, &Ln, &With_s);
if (With == NULL) break;
}
if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
{
With->pNorm();
//if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
}
strat->redTailChange=TRUE;
if (ksReducePolyTail(L, With, &Ln))
{
// reducing the tail would violate the exp bound
// set a flag and hope for a retry (in bba)
strat->completeReduce_retry=TRUE;
if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
do
{
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
} while (!Ln.IsNull());
goto all_done;
}
if (Ln.IsNull()) goto all_done;
if (! withT) With_s.Init(currRing);
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
L->pLength++;
}
all_done:
Ln.Delete();
if (L->p != NULL) pNext(L->p) = pNext(p);
if (strat->redTailChange)
{
L->length = 0;
}
L->Normalize(); // HANNES: should have a test
kTest_L(L,strat);
return L->GetLmCurrRing();
}

## reorderS()

void reorderS | ( | int * | suc,
|  | kStrategy | strat )

Definition at line 4610 of file kutil.cc.

{
int i,j,at,ecart, s2r;
int fq=0;
unsigned long sev;
poly p;
int new_suc=strat->sl+1;
i= *suc;
if (i<0) i=0;
for (; i<=strat->sl; i++)
{
at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
if (at != i)
{
if (new_suc > at) new_suc = at;
p = strat->S[i];
ecart = strat->ecartS[i];
sev = strat->sevS[i];
s2r = strat->S_2_R[i];
if (strat->fromQ!=NULL) fq=strat->fromQ[i];
for (j=i; j>=at+1; j--)
{
strat->S[j] = strat->S[j-1];
strat->ecartS[j] = strat->ecartS[j-1];
strat->sevS[j] = strat->sevS[j-1];
strat->S_2_R[j] = strat->S_2_R[j-1];
}
strat->S[at] = p;
strat->ecartS[at] = ecart;
strat->sevS[at] = sev;
strat->S_2_R[at] = s2r;
if (strat->fromQ!=NULL)
{
for (j=i; j>=at+1; j--)
{
strat->fromQ[j] = strat->fromQ[j-1];
}
strat->fromQ[at]=fq;
}
}
}
if (new_suc <= strat->sl) *suc=new_suc;
else *suc=-1;
}

## sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 1688 of file kutil.cc.

{
if(strat->sl < 0) return FALSE;
int i;
for(i=0;i<strat->sl;i++)
{
//Construct the gcd pair between h and S[i]
number d, s, t;
poly m1, m2, gcd;
d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
{
nDelete(&d);
nDelete(&s);
nDelete(&t);
}
else
{
k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
pSetCoeff0(m1, s);
pSetCoeff0(m2, t);
pSetCoeff0(gcd, d);
pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(h->p), m1, strat->tailRing), pp_Mult_mm(pNext(strat->S[i]), m2, strat->tailRing), strat->tailRing);
poly pSigMult = p_Copy(h->sig,currRing);
poly sSigMult = p_Copy(strat->sig[i],currRing);
pSigMult = p_Mult_mm(pSigMult,m1,currRing);
sSigMult = p_Mult_mm(sSigMult,m2,currRing);
p_LmDelete(m1, strat->tailRing);
p_LmDelete(m2, strat->tailRing);
poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
{
pDelete(&h->p);
h->p = gcd;
pDelete(&h->sig);
h->sig = pairsig;
pNext(h->sig) = NULL;
strat->initEcart(h);
h->sev = pGetShortExpVector(h->p);
h->sevSig = pGetShortExpVector(h->sig);
h->i_r1 = -1;h->i_r2 = -1;
if(h->lcm != NULL)
{
pLmDelete(h->lcm);
h->lcm = NULL;
}
if (currRing!=strat->tailRing)
h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
return TRUE;
}
//Delete what you didn't use
pDelete(&gcd);
pDelete(&pairsig);
}
}
return FALSE;
}

## sbaRing()

ring sbaRing | ( | kStrategy | strat,
|  | const ring | r,
|  | BOOLEAN | complete,
|  | int | sgn )

Definition at line 11064 of file kutil.cc.

{
int n = rBlocks(r); // Including trailing zero!
// if sbaOrder == 1 => use (C,monomial order from r)
if (strat->sbaOrder == 1)
{
if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
{
return r;
}
ring res = rCopy0(r, TRUE, FALSE);
res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
res->wvhdl = wvhdl;
for (int i=1; i<n; i++)
{
res->order[i] = r->order[i-1];
res->block0[i] = r->block0[i-1];
res->block1[i] = r->block1[i-1];
res->wvhdl[i] = r->wvhdl[i-1];
}
// new 1st block
res->order[0] = ringorder_C; // Prefix
// removes useless secondary component order if defined in old ring
for (int i=rBlocks(res); i>0; --i)
{
if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
{
res->order[i] = (rRingOrder_t)0;
}
}
rComplete(res, 1);
#ifdef HAVE_PLURAL
if (rIsPluralRing(r))
{
if ( nc_rComplete(r, res, false) ) // no qideal!
{
#ifndef SING_NDEBUG
WarnS("error in nc_rComplete");
#endif
// cleanup?
// rDelete(res);
// return r;
// just go on..
}
}
#endif
strat->tailRing = res;
return (res);
}
// if sbaOrder == 3 => degree - position - ring order
if (strat->sbaOrder == 3)
{
ring res = rCopy0(r, TRUE, FALSE);
res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
res->wvhdl = wvhdl;
for (int i=2; i<n+2; i++)
{
res->order[i] = r->order[i-2];
res->block0[i] = r->block0[i-2];
res->block1[i] = r->block1[i-2];
res->wvhdl[i] = r->wvhdl[i-2];
}
// new 1st block
res->order[0] = ringorder_a; // Prefix
res->block0[0] = 1;
res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
for (int i=0; i<res->N; ++i)
res->wvhdl[0][i] = 1;
res->block1[0] = si_min(res->N, rVar(res));
// new 2nd block
res->order[1] = ringorder_C; // Prefix
res->wvhdl[1] = NULL;
// removes useless secondary component order if defined in old ring
for (int i=rBlocks(res); i>1; --i)
{
if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
{
res->order[i] = (rRingOrder_t)0;
}
}
rComplete(res, 1);
#ifdef HAVE_PLURAL
if (rIsPluralRing(r))
{
if ( nc_rComplete(r, res, false) ) // no qideal!
{
#ifndef SING_NDEBUG
WarnS("error in nc_rComplete");
#endif
// cleanup?
// rDelete(res);
// return r;
// just go on..
}
}
#endif
strat->tailRing = res;
return (res);
}
// not sbaOrder == 1 => use Schreyer order
// this is done by a trick when initializing the signatures
// in initSLSba():
// Instead of using the signature 1e_i for F->m[i], we start
// with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
// Schreyer order w.r.t. the underlying monomial order.
// => we do not need to change the underlying polynomial ring at all!
// UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
/*
else
{
ring res = rCopy0(r, FALSE, FALSE);
// Create 2 more blocks for prefix/suffix:
res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
res->block0=(int *)omAlloc0((n+2)*sizeof(int));
res->block1=(int *)omAlloc0((n+2)*sizeof(int));
int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
// Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
// Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
// new 1st block
int j = 0;
res->order[j] = ringorder_IS; // Prefix
res->block0[j] = res->block1[j] = 0;
// wvhdl[j] = NULL;
j++;
for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
{
res->order [j] = r->order [i];
res->block0[j] = r->block0[i];
res->block1[j] = r->block1[i];
if (r->wvhdl[i] != NULL)
{
wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
} // else wvhdl[j] = NULL;
}
// new last block
res->order [j] = ringorder_IS; // Suffix
res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
// wvhdl[j] = NULL;
j++;
// res->order [j] = 0; // The End!
res->wvhdl = wvhdl;
// j == the last zero block now!
assume(j == (n+1));
assume(res->order[0]==ringorder_IS);
assume(res->order[j-1]==ringorder_IS);
assume(res->order[j]==0);
if (complete)
{
rComplete(res, 1);
#ifdef HAVE_PLURAL
if (rIsPluralRing(r))
{
if ( nc_rComplete(r, res, false) ) // no qideal!
{
}
}
assume(rIsPluralRing(r) == rIsPluralRing(res));
#endif
#ifdef HAVE_PLURAL
ring old_ring = r;
#endif
if (r->qideal!=NULL)
{
res->qideal= idrCopyR_NoSort(r->qideal, r, res);
assume(idRankFreeModule(res->qideal, res) == 0);
#ifdef HAVE_PLURAL
if( rIsPluralRing(res) )
if( nc_SetupQuotient(res, r, true) )
{
// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
}
#endif
assume(idRankFreeModule(res->qideal, res) == 0);
}
#ifdef HAVE_PLURAL
assume((res->qideal==NULL) == (old_ring->qideal==NULL));
assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
assume(rIsSCA(res) == rIsSCA(old_ring));
assume(ncRingType(res) == ncRingType(old_ring));
#endif
}
strat->tailRing = res;
return res;
}
*/
assume(FALSE);
return(NULL);
}
WarnS
#define WarnS
Definition emacs.cc:78
res
CanonicalForm res
Definition facAbsFact.cc:60
nc_rComplete
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition ring.cc:5833
rBlocks
static int rBlocks(const ring r)
Definition ring.h:574
rRingOrder_t
rRingOrder_t
order stuff
Definition ring.h:69
ringorder_a
@ ringorder_a
Definition ring.h:71

## showOption()

char * showOption | ( |  | ) |

extern

Definition at line 711 of file misc_ip.cc.

{
int i;
BITSET tmp;
StringSetS("//options:");
if ((si_opt_1!=0)||(si_opt_2!=0))
{
tmp=si_opt_1;
if(tmp)
{
for (i=0; optionStruct[i].setval!=0; i++)
{
if (optionStruct[i].setval & tmp)
{
StringAppend(" %s",optionStruct[i].name);
tmp &=optionStruct[i].resetval;
}
}
for (i=0; i<32; i++)
{
if (tmp & Sy_bit(i)) StringAppend(" %d",i);
}
}
tmp=si_opt_2;
if (tmp)
{
for (i=0; verboseStruct[i].setval!=0; i++)
{
if (verboseStruct[i].setval & tmp)
{
StringAppend(" %s",verboseStruct[i].name);
tmp &=verboseStruct[i].resetval;
}
}
for (i=1; i<32; i++)
{
if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
}
}
return StringEndS();
}
StringAppendS(" none");
return StringEndS();
}
BITSET
#define BITSET
Definition auxiliary.h:85
StringAppend
#define StringAppend
Definition emacs.cc:79
name
char name(const Variable &v)
Definition factory.h:189
verboseStruct
const struct soptionStruct verboseStruct[]
Definition misc_ip.cc:539
optionStruct
const struct soptionStruct optionStruct[]
Definition misc_ip.cc:508
si_opt_2
VAR unsigned si_opt_2
Definition options.c:6
si_opt_1
VAR unsigned si_opt_1
Definition options.c:5
Sy_bit
#define Sy_bit(x)
Definition options.h:31
StringSetS
void StringSetS(const char *st)
Definition reporter.cc:128
StringAppendS
void StringAppendS(const char *st)
Definition reporter.cc:107
StringEndS
char * StringEndS()
Definition reporter.cc:151

## sugarDivisibleBy()

BOOLEAN sugarDivisibleBy | ( | int | ecart1,
|  | int | ecart2 )

inline static

Definition at line 1326 of file kutil.cc.

{
return (ecart1 <= ecart2);
}

## superenterpairs()

void superenterpairs | ( | poly | h,
|  | int | k,
|  | int | ecart,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 4457 of file kutil.cc.

{
assume (rField_is_Ring(currRing));
#if HAVE_SHIFTBBA
assume(!rIsLPRing(currRing)); /* LP should use enterpairsShift */
#endif
// enter also zero divisor * poly, if this is non zero and of smaller degree
if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
initenterstrongPairs(h, k, ecart, 0, strat, atR);
initenterpairs(h, k, ecart, 0, strat, atR);
clearSbatch(h, k, pos, strat);
}
clearSbatch
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition kutil.cc:4433
initenterstrongPairs
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:4152
enterExtendedSpoly
void enterExtendedSpoly(poly h, kStrategy strat)
Definition kutil.cc:4232
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493

## superenterpairsSig()

void superenterpairsSig | ( | poly | h,
|  | poly | hSig,
|  | int | hFrom,
|  | int | k,
|  | int | ecart,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR )

Definition at line 4470 of file kutil.cc.

{
assume (rField_is_Ring(currRing));
// enter also zero divisor * poly, if this is non zero and of smaller degree
if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
if(strat->sigdrop) return;
initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
if(strat->sigdrop) return;
initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
if(strat->sigdrop) return;
clearSbatch(h, k, pos, strat);
}
initenterpairsSigRing
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:3934
initenterstrongPairsSig
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition kutil.cc:4207
enterExtendedSpolySig
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition kutil.cc:4316

## syzCriterion()

BOOLEAN syzCriterion | ( | poly | sig,
|  | unsigned long | not_sevSig,
|  | kStrategy | strat )

Definition at line 6478 of file kutil.cc.

{
//#if 1
#ifdef DEBUGF5
PrintS("syzygy criterion checks: ");
pWrite(sig);
#endif
for (int k=0; k<strat->syzl; k++)
{
//printf("-%d",k);
//#if 1
#ifdef DEBUGF5
Print("checking with: %d / %d -- \n",k,strat->syzl);
pWrite(pHead(strat->syz[k]));
#endif
if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
&& (!rField_is_Ring(currRing) ||
(n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
{
//#if 1
#ifdef DEBUGF5
PrintS("DELETE!\n");
#endif
strat->nrsyzcrit++;
//printf("- T -\n\n");
return TRUE;
}
}
//printf("- F -\n\n");
return FALSE;
}

## syzCriterionInc()

BOOLEAN syzCriterionInc | ( | poly | sig,
|  | unsigned long | not_sevSig,
|  | kStrategy | strat )

Definition at line 6513 of file kutil.cc.

{
//#if 1
if(sig == NULL)
return FALSE;
#ifdef DEBUGF5
PrintS("--- syzygy criterion checks: ");
pWrite(sig);
#endif
int comp = (int)__p_GetComp(sig, currRing);
int min, max;
if (comp<=1)
return FALSE;
else
{
min = strat->syzIdx[comp-2];
//printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
//printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
//printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
if (comp == strat->currIdx)
{
max = strat->syzl;
}
else
{
max = strat->syzIdx[comp-1];
}
for (int k=min; k<max; k++)
{
#ifdef F5DEBUG
Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
Print("checking with: %d -- ",k);
pWrite(pHead(strat->syz[k]));
#endif
if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
&& (!rField_is_Ring(currRing) ||
(n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
{
strat->nrsyzcrit++;
return TRUE;
}
}
return FALSE;
}
}
min
static int min(int a, int b)
Definition fast_mult.cc:268
max
static int max(int a, int b)
Definition fast_mult.cc:264

## updateResult()

void updateResult | ( | ideal | r,
|  | ideal | Q,
|  | kStrategy | strat )

Definition at line 10051 of file kutil.cc.

{
int l;
if (strat->ak>0)
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
{
pDelete(&r->m[l]); // and set it to NULL
}
}
int q;
poly p;
if(!rField_is_Ring(currRing))
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if ((r->m[l]!=NULL)
//&& (strat->syzComp>0)
//&& (pGetComp(r->m[l])<=strat->syzComp)
)
{
for(q=IDELEMS(Q)-1; q>=0;q--)
{
if ((Q->m[q]!=NULL)
&&(pLmDivisibleBy(Q->m[q],r->m[l])))
{
if (TEST_OPT_REDSB)
{
p=r->m[l];
r->m[l]=kNF(Q,NULL,p);
pDelete(&p);
}
else
{
pDelete(&r->m[l]); // and set it to NULL
}
break;
}
}
}
}
}
else
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if ((r->m[l]!=NULL)
//&& (strat->syzComp>0)
//&& (pGetComp(r->m[l])<=strat->syzComp)
)
{
for(q=IDELEMS(Q)-1; q>=0;q--)
{
if ((Q->m[q]!=NULL)
&&(pLmDivisibleBy(Q->m[q],r->m[l])))
{
if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
{
if (TEST_OPT_REDSB)
{
p=r->m[l];
r->m[l]=kNF(Q,NULL,p);
pDelete(&p);
}
else
{
pDelete(&r->m[l]); // and set it to NULL
}
break;
}
}
}
}
}
}
}
else
{
int q;
poly p;
BOOLEAN reduction_found=FALSE;
if (!rField_is_Ring(currRing))
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if (r->m[l]!=NULL)
{
for(q=IDELEMS(Q)-1; q>=0;q--)
{
if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
{
if (TEST_OPT_REDSB)
{
p=r->m[l];
r->m[l]=kNF(Q,NULL,p);
pDelete(&p);
reduction_found=TRUE;
}
else
{
pDelete(&r->m[l]); // and set it to NULL
}
break;
}
}
}
}
}
//Also need divisibility of the leading coefficients
else
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if (r->m[l]!=NULL)
{
for(q=IDELEMS(Q)-1; q>=0;q--)
{
if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
{
if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
{
if (TEST_OPT_REDSB)
{
p=r->m[l];
r->m[l]=kNF(Q,NULL,p);
pDelete(&p);
reduction_found=TRUE;
}
else
{
pDelete(&r->m[l]); // and set it to NULL
}
break;
}
}
}
}
}
}
if (/*TEST_OPT_REDSB &&*/ reduction_found)
{
if(rField_is_Ring(currRing))
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if (r->m[l]!=NULL)
{
for(q=IDELEMS(r)-1;q>=0;q--)
{
if ((l!=q)
&& (r->m[q]!=NULL)
&&(pLmDivisibleBy(r->m[l],r->m[q]))
&&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
)
{
//If they are equal then take the one with the smallest length
if(pLmDivisibleBy(r->m[q],r->m[l])
&& n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
&& (pLength(r->m[q]) < pLength(r->m[l]) ||
(pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
{
pDelete(&r->m[l]);
break;
}
else
pDelete(&r->m[q]);
}
}
}
}
}
else
{
for (l=IDELEMS(r)-1;l>=0;l--)
{
if (r->m[l]!=NULL)
{
for(q=IDELEMS(r)-1;q>=0;q--)
{
if ((l!=q)
&& (r->m[q]!=NULL)
&&(pLmDivisibleBy(r->m[l],r->m[q]))
)
{
//If they are equal then take the one with the smallest length
if(pLmDivisibleBy(r->m[q],r->m[l])
&&(pLength(r->m[q]) < pLength(r->m[l]) ||
(pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
{
pDelete(&r->m[l]);
break;
}
else
pDelete(&r->m[q]);
}
}
}
}
}
}
}
idSkipZeroes(r);
}
kNF
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition kstd1.cc:3229

## updateS()

void updateS | ( | BOOLEAN | toT,
|  | kStrategy | strat )

Definition at line 8557 of file kutil.cc.

{
LObject h;
int i, suc=0;
poly redSi=NULL;
BOOLEAN change,any_change;
// Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
// for (i=0; i<=(strat->sl); i++)
// {
// Print("s%d:",i);
// if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
// pWrite(strat->S[i]);
// }
// Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
any_change=FALSE;
if (rHasGlobalOrdering(currRing))
{
while (suc != -1)
{
i=suc+1;
while (i<=strat->sl)
{
change=FALSE;
if(rField_is_Ring(currRing))
any_change = FALSE;
if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
{
redSi = pHead(strat->S[i]);
strat->S[i] = redBba(strat->S[i],i-1,strat);
//if ((strat->ak!=0)&&(strat->S[i]!=NULL))
// strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
if (pCmp(redSi,strat->S[i])!=0)
{
change=TRUE;
any_change=TRUE;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("reduce:");
wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
}
#endif
if (TEST_OPT_PROT)
{
if (strat->S[i]==NULL)
PrintS("V");
else
PrintS("v");
mflush();
}
}
pLmDelete(&redSi);
if (strat->S[i]==NULL)
{
deleteInS(i,strat);
i--;
}
else if (change)
{
if (TEST_OPT_INTSTRATEGY)
{
if (TEST_OPT_CONTENTSB)
{
number n;
p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
if (!nIsOne(n))
{
denominator_list denom=(denominator_list)omAlloc(sizeof(denominator_list_s));
denom->n=nInvers(n);
denom->next=DENOMINATOR_LIST;
DENOMINATOR_LIST=denom;
}
nDelete(&n);
}
else
{
strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
}
}
else
{
pNorm(strat->S[i]);
}
strat->sevS[i] = pGetShortExpVector(strat->S[i]);
}
}
i++;
}
if (any_change) reorderS(&suc,strat);
else break;
}
if (toT)
{
for (i=0; i<=strat->sl; i++)
{
if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
{
h.p = redtailBba(strat->S[i],i-1,strat);
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom();// also does remove Content
}
}
else
{
h.p = strat->S[i];
}
strat->initEcart(&h);
if (strat->honey)
{
strat->ecartS[i] = h.ecart;
}
if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
else assume(strat->sevS[i] == pGetShortExpVector(h.p));
h.sev = strat->sevS[i];
/*puts the elements of S also to T*/
strat->initEcart(&h);
/*if (toT) - already checked*/ enterT(&h,strat);
strat->S_2_R[i] = strat->tl;
#ifdef HAVE_SHIFTBBA
if (/*(toT) && */(currRing->isLPring))
enterTShift(&h, strat);
#endif
}
}
}
else
{
while (suc != -1)
{
i=suc;
while (i<=strat->sl)
{
change=FALSE;
if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
{
redSi=pHead((strat->S)[i]);
(strat->S)[i] = redMora((strat->S)[i],i-1,strat);
if ((strat->S)[i]==NULL)
{
deleteInS(i,strat);
i--;
}
else if (pCmp((strat->S)[i],redSi)!=0)
{
any_change=TRUE;
h.p = strat->S[i];
strat->initEcart(&h);
strat->ecartS[i] = h.ecart;
if (TEST_OPT_INTSTRATEGY)
{
if (TEST_OPT_CONTENTSB)
{
number n;
p_Cleardenom_n(strat->S[i], currRing, n);// also does remove Content
if (!nIsOne(n))
{
denominator_list denom=(denominator_list)omAlloc(sizeof(denominator_list_s));
denom->n=nInvers(n);
denom->next=DENOMINATOR_LIST;
DENOMINATOR_LIST=denom;
}
nDelete(&n);
}
else
{
strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does remove Content
}
}
else
{
pNorm(strat->S[i]); // == h.p
}
h.sev = pGetShortExpVector(h.p);
strat->sevS[i] = h.sev;
}
pLmDelete(&redSi);
kTest(strat);
}
i++;
}
#ifdef KDEBUG
kTest(strat);
#endif
if (any_change) reorderS(&suc,strat);
else { suc=-1; break; }
if (h.p!=NULL)
{
if (!strat->kAllAxis)
{
/*strat->kAllAxis =*/ HEckeTest(h.p,strat);
}
if (strat->kAllAxis)
newHEdge(strat);
}
}
for (i=0; i<=strat->sl; i++)
{
if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
{
strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
strat->initEcart(&h);
strat->ecartS[i] = h.ecart;
h.sev = pGetShortExpVector(h.p);
strat->sevS[i] = h.sev;
}
else
{
h.p = strat->S[i];
h.ecart=strat->ecartS[i];
h.sev = strat->sevS[i];
h.length = h.pLength = pLength(h.p);
}
if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
cancelunit1(&h,&suc,strat->sl,strat);
h.SetpFDeg();
/*puts the elements of S also to T*/
enterT(&h,strat);
strat->S_2_R[i] = strat->tl;
#ifdef HAVE_SHIFTBBA
if (currRing->isLPring)
enterTShift(&h, strat);
#endif
}
if (suc!= -1) updateS(toT,strat);
}
#ifdef KDEBUG
kTest(strat);
#endif
}
cancelunit1
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition kutil.cc:8402
HEckeTest
void HEckeTest(poly pp, kStrategy strat)
Definition kutil.cc:493
reorderS
void reorderS(int *suc, kStrategy strat)
Definition kutil.cc:4610
enterTShift
void enterTShift(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:12957
newHEdge
BOOLEAN newHEdge(kStrategy strat)
Definition kutil.cc:10379

## Variable Documentation

## DENOMINATOR_LIST

VAR denominator_list DENOMINATOR_LIST =NULL

Definition at line 79 of file kutil.cc.

## HCord

VAR int HCord

Definition at line 239 of file kutil.cc.

## Kstd1_deg

VAR int Kstd1_deg

Definition at line 240 of file kutil.cc.

## Kstd1_mu

VAR int Kstd1_mu =INT_MAX

Definition at line 241 of file kutil.cc.

## sloppy_max

STATIC_VAR BOOLEAN sloppy_max = FALSE

Definition at line 788 of file kutil.cc.