Loading...
Searching...
No Matches
kutil.h File Reference
`#include <string.h>`
`#include "omalloc/omalloc.h"`
`#include "omalloc/omallocClass.h"`
`#include "misc/mylimits.h"`
`#include "kernel/polys.h"`
`#include "polys/operations/pShallowCopyDelete.h"`
`#include "kernel/structs.h"`
`#include "kernel/GBEngine/kstd1.h"`
`#include "coeffs/bigintmat.h"`
`#include "kernel/GBEngine/kInline.h"`
`#include "kernel/GBEngine/shiftgb.h"`

Go to the source code of this file.

## Data Structures

struct | denominator_list_s
class | sTObject
class | sLObject
class | skStrategy

## Macros

#define | HAVE_TAIL_RING
#define | setmax 128
#define | setmaxL ((int)((4096-12)/sizeof(LObject)))
#define | setmaxLinc ((int)((4096)/sizeof(LObject)))
#define | setmaxT ((int)((4096-12)/sizeof(TObject)))
#define | setmaxTinc ((int)((4096)/sizeof(TObject)))
#define | RED_CANONICALIZE 200
#define | REDNF_CANONICALIZE 60
#define | REDTAIL_CANONICALIZE 100
#define | KINLINE
#define | NO_KINLINE 1
#define | ALLOW_PROD_CRIT(A)

## Typedefs

typedef int * | intset
typedef int64 | wlen_type
typedef wlen_type * | wlen_set
typedef class sTObject | TObject
typedef class sLObject | LObject
typedef TObject * | TSet
typedef LObject * | LSet
typedef denominator_list_s * | denominator_list

## Functions

void | deleteHC (poly *p, int *e, int *l, kStrategy strat)
void | deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext=FALSE)
void | deleteInS (int i, kStrategy strat)
void | cleanT (kStrategy strat)
static LSet | initL (int nr=setmaxL)
void | deleteInL (LSet set, int *length, int j, kStrategy strat)
void | enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
void | enterSBba (LObject *p, int atS, kStrategy strat, int atR=-1)
void | enterSBbaShift (LObject *p, int atS, kStrategy strat, int atR=-1)
void | enterSSba (LObject *p, int atS, kStrategy strat, int atR=-1)
void | initEcartPairBba (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
void | initEcartPairMora (LObject *Lp, poly f, poly g, int ecartF, int ecartG)
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=0, int end=-1)
int | posInT0 (const TSet set, const int length, LObject &p)
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 | posInTSig (const TSet set, const int length, LObject &p)
int | posInT110 (const TSet set, const int length, LObject &p)
int | posInT13 (const TSet set, const int length, LObject &p)
int | posInT15 (const TSet set, const int length, LObject &p)
int | posInT17 (const TSet set, const int length, LObject &p)
int | posInT17_c (const TSet set, const int length, LObject &p)
int | posInT19 (const TSet set, const int length, LObject &p)
int | posInT_EcartpLength (const TSet set, const int length, LObject &p)
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)
void | reorderS (int *suc, kStrategy strat)
int | posInLSig (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInLSigRing (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInSyz (const kStrategy strat, const poly sig)
int | posInL0 (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL11 (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL11Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInLF5CRing (const LSet set, int start, const int length, LObject *L, const kStrategy strat)
int | posInL11Ringls (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL13 (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL15 (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL15Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL17 (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL10 (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL10Ring (const LSet set, const int length, LObject *L, const kStrategy strat)
int | posInL110 (const LSet set, const int length, LObject *L, const kStrategy strat)
KINLINE poly | redtailBba (poly p, int end_pos, kStrategy strat, BOOLEAN normalize=FALSE)
KINLINE poly | redtailBbaBound (poly p, int end_pos, kStrategy strat, int bound, BOOLEAN normalize=FALSE)
KINLINE poly | redtailBba_Ring (poly p, int end_pos, kStrategy strat)
KINLINE poly | redtailBba_Z (poly p, int end_pos, kStrategy strat)
poly | redtailBba_NF (poly p, kStrategy strat)
poly | redtailBba_Ring (LObject *L, int end_pos, kStrategy strat)
poly | redtailBba_Z (LObject *L, int end_pos, kStrategy strat)
void | redtailBbaAlsoLC_Z (LObject *L, int end_pos, kStrategy strat)
poly | redtailBba (LObject *L, int end_pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
poly | redtailBbaBound (LObject *L, int end_pos, kStrategy strat, int bound, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
poly | redtailSba (LObject *L, int end_pos, kStrategy strat, BOOLEAN withT=FALSE, BOOLEAN normalize=FALSE)
poly | redtailBba (TObject *T, int end_pos, kStrategy strat)
poly | redtail (poly p, int end_pos, kStrategy strat)
poly | redtail (LObject *L, int end_pos, kStrategy strat)
poly | redNF (poly h, int &max_ind, int nonorm, kStrategy strat)
int | redNF0 (LObject *P, kStrategy strat)
poly | redNFTail (poly h, const int sl, kStrategy strat)
int | redHoney (LObject *h, kStrategy strat)
int | redHoneyM (LObject *h, kStrategy strat)
int | redLiftstd (LObject *h, kStrategy strat)
int | redRing (LObject *h, kStrategy strat)
int | redRing_Z (LObject *h, kStrategy strat)
int | redRiloc (LObject *h, kStrategy strat)
void | enterExtendedSpoly (poly h, kStrategy strat)
void | enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
void | superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
void | superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR=-1)
int | redLazy (LObject *h, kStrategy strat)
int | redHomog (LObject *h, kStrategy strat)
int | redSig (LObject *h, kStrategy strat)
int | redSigRing (LObject *h, kStrategy strat)
void | enterpairsSig (poly h, poly hSig, int from, int k, int ec, int pos, kStrategy strat, int atR=-1)
void | enterpairs (poly h, int k, int ec, int pos, kStrategy strat, int atR=-1)
void | entersets (LObject h)
void | pairs ()
BOOLEAN | sbaCheckGcdPair (LObject *h, 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 | initEcartNormal (TObject *h)
void | initEcartBBA (TObject *h)
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 | updateS (BOOLEAN toT, kStrategy strat)
void | enterSyz (LObject &p, kStrategy strat, int atT)
void | enterT (LObject *p, kStrategy strat, int atT=-1)
void | enterT_strong (LObject *p, kStrategy strat, int atT=-1)
void | cancelunit (LObject *p, BOOLEAN inNF=FALSE)
void | HEckeTest (poly pp, kStrategy strat)
void | initBuchMoraCrit (kStrategy strat)
void | initSbaCrit (kStrategy strat)
void | initHilbCrit (ideal F, ideal Q, bigintmat **hilb, kStrategy strat)
void | initBuchMoraPos (kStrategy strat)
void | initBuchMoraPosRing (kStrategy strat)
void | initSbaPos (kStrategy strat)
void | initBuchMora (ideal F, ideal Q, kStrategy strat)
void | initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
void | exitBuchMora (kStrategy strat)
void | exitSba (kStrategy strat)
void | updateResult (ideal r, ideal Q, kStrategy strat)
void | completeReduce (kStrategy strat, BOOLEAN withT=FALSE)
void | kFreeStrat (kStrategy strat)
void | enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
void | chainCritNormal (poly p, int ecart, kStrategy strat)
void | chainCritOpt_1 (poly, int, kStrategy strat)
void | chainCritSig (poly p, int ecart, kStrategy strat)
BOOLEAN | homogTest (polyset F, int Fmax)
BOOLEAN | newHEdge (kStrategy strat)
BOOLEAN | syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
BOOLEAN | syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
KINLINE BOOLEAN | arriRewDummy (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN | arriRewCriterion (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN | arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN | faugereRewCriterion (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
BOOLEAN | findMinLMPair (poly sig, unsigned long not_sevSig, kStrategy strat, int start)
int | kFindInT (poly p, TSet T, int tlength)
| returns index of p in TSet, or -1 if not found
int | kFindInTShift (poly p, TSet T, int tlength)
int | kFindDivisibleByInT (const kStrategy strat, const LObject *L, const int start=0)
| return -1 if no divisor is found number of first divisor in T, otherwise
int | kFindDivisibleByInT_ecart (const kStrategy strat, const LObject *L, const int ecart)
int | kFindDivisibleByInT_Z (const kStrategy strat, const LObject *L, const int start=0)
int | kFindSameLMInT_Z (const kStrategy strat, const LObject *L, const int start=0)
int | kTestDivisibleByT0_Z (const kStrategy strat, const LObject *L)
| tests if T[0] divides the leading monomial of L, returns -1 if not
int | kFindDivisibleByInS (const kStrategy strat, int *max_ind, LObject *L)
| return -1 if no divisor is found number of first divisor in S, otherwise
int | kFindNextDivisibleByInS (const kStrategy strat, int start, int max_ind, LObject *L)
TObject * | kFindDivisibleByInS_T (kStrategy strat, int end_pos, LObject *L, TObject *T, long ecart=LONG_MAX)
KINLINE TSet | initT ()
KINLINE TObject ** | initR ()
KINLINE unsigned long * | initsevT ()
KINLINE poly | k_LmInit_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
KINLINE poly | k_LmInit_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
KINLINE poly | k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing, omBin bin)
KINLINE poly | k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing, omBin bin)
KINLINE poly | k_LmInit_currRing_2_tailRing (poly p, ring tailRing)
KINLINE poly | k_LmInit_tailRing_2_currRing (poly p, ring tailRing)
KINLINE poly | k_LmShallowCopyDelete_currRing_2_tailRing (poly p, ring tailRing)
KINLINE poly | k_LmShallowCopyDelete_tailRing_2_currRing (poly p, ring tailRing)
KINLINE BOOLEAN | k_GetLeadTerms (const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
KINLINE void | k_GetStrongLeadTerms (const poly p1, const poly p2, const ring leadRing, poly &m1, poly &m2, poly &lcm, const ring taiRing)
BOOLEAN | kTest (kStrategy strat)
BOOLEAN | kTest_TS (kStrategy strat)
BOOLEAN | kTest_L (LObject *L, kStrategy strat, BOOLEAN testp=FALSE, int lpos=-1, TSet T=NULL, int tlength=-1)
BOOLEAN | kTest_T (TObject *T, kStrategy strat, int tpos=-1, char TN='?')
BOOLEAN | kTest_S (kStrategy strat)
int | redFirst (LObject *h, kStrategy strat)
int | redEcart (LObject *h, kStrategy strat)
void | enterSMora (LObject *p, int atS, kStrategy strat, int atR=-1)
void | enterSMoraNF (LObject *p, int atS, kStrategy strat, int atR=-1)
poly | kFindZeroPoly (poly input_p, ring leadRing, ring tailRing)
ideal | bba (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
ideal | sba (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
poly | kNF2 (ideal F, ideal Q, poly q, kStrategy strat, int lazyReduce)
ideal | kNF2 (ideal F, ideal Q, ideal q, kStrategy strat, int lazyReduce)
poly | kNF2Bound (ideal F, ideal Q, poly q, int bound, kStrategy strat, int lazyReduce)
ideal | kNF2Bound (ideal F, ideal Q, ideal q, int bound, kStrategy strat, int lazyReduce)
void | initBba (kStrategy strat)
void | initSba (ideal F, kStrategy strat)
void | f5c (kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, bigintmat *hilb)
int | ksReducePoly (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, poly *mon=NULL, kStrategy strat=NULL, BOOLEAN redtail=FALSE)
int | ksReducePolyZ (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int | ksReducePolyLC (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int | ksReducePolyGCD (LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int | ksReducePolyBound (LObject *PR, TObject *PW, int bound, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int | ksReducePolySig (LObject *PR, TObject *PW, long idx, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int | ksReducePolySigRing (LObject *PR, TObject *PW, long idx, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
int | ksReducePolyTail (LObject *PR, TObject *PW, poly Current, poly spNoether=NULL)
KINLINE int | ksReducePolyTail (LObject *PR, TObject *PW, LObject *Red)
void | ksCreateSpoly (LObject *Pair, poly spNoether=NULL, int use_buckets=0, ring tailRing=currRing, poly m1=NULL, poly m2=NULL, TObject **R=NULL)
poly | ksCreateShortSpoly (poly p1, poly p2, ring tailRing)
KINLINE poly | ksOldSpolyRed (poly p1, poly p2, poly spNoether=NULL)
KINLINE poly | ksOldSpolyRedNew (poly p1, poly p2, poly spNoether=NULL)
KINLINE poly | ksOldCreateSpoly (poly p1, poly p2, poly spNoether=NULL, ring r=currRing)
KINLINE void | ksOldSpolyTail (poly p1, poly q, poly q2, poly spNoether, ring r=currRing)
BOOLEAN | kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
BOOLEAN | kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
poly | preIntegerCheck (ideal F, 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=NULL, TObject *T=NULL, unsigned long new_expbound=0)
void | kStratInitChangeTailRing (kStrategy strat)
void | kDebugPrint (kStrategy strat)
| Output some debug info about a given strategy.
ring | sbaRing (kStrategy strat, const ring r=currRing, BOOLEAN complete=TRUE, int sgn=1)
KINLINE void | clearS (poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
static int | kFindInL1 (const poly p, const kStrategy strat)
void | enterTShift (LObject *p, kStrategy strat, int atT=-1)
BOOLEAN | enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS)
void | enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
void | superenterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
poly | redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
int | redFirstShift (LObject *h, kStrategy strat)
ideal | bbaShift (ideal F, ideal Q, intvec *w, bigintmat *hilb, kStrategy strat)
static void | kDeleteLcm (LObject *P)
void | initenterpairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)

## Variables

EXTERN_VAR denominator_list | DENOMINATOR_LIST
EXTERN_VAR int | strat_nr
EXTERN_VAR int | HCord

## Data Structure Documentation

## denominator_list_s

struct denominator_list_s

Definition at line 66 of file kutil.h.

Data Fields
number | n |
denominator_list | next |

## Macro Definition Documentation

## ALLOW_PROD_CRIT

#define ALLOW_PROD_CRIT | ( |  | A | ) |

Value:
(!(A)->no_prod_crit)
A
#define A
Definition sirandom.c:24

Definition at line 392 of file kutil.h.

## HAVE_TAIL_RING

#define HAVE_TAIL_RING

Definition at line 28 of file kutil.h.

## KINLINE

#define KINLINE

Definition at line 50 of file kutil.h.

## NO_KINLINE

#define NO_KINLINE 1

Definition at line 51 of file kutil.h.

## RED_CANONICALIZE

#define RED_CANONICALIZE 200

Definition at line 37 of file kutil.h.

## REDNF_CANONICALIZE

#define REDNF_CANONICALIZE 60

Definition at line 38 of file kutil.h.

## REDTAIL_CANONICALIZE

#define REDTAIL_CANONICALIZE 100

Definition at line 39 of file kutil.h.

## setmax

#define setmax 128

Definition at line 30 of file kutil.h.

## setmaxL

#define setmaxL ((int)((4096-12)/sizeof(LObject)))

Definition at line 31 of file kutil.h.

## setmaxLinc

#define setmaxLinc ((int)((4096)/sizeof(LObject)))

Definition at line 32 of file kutil.h.

## setmaxT

#define setmaxT ((int)((4096-12)/sizeof(TObject)))

Definition at line 34 of file kutil.h.

## setmaxTinc

#define setmaxTinc ((int)((4096)/sizeof(TObject)))

Definition at line 35 of file kutil.h.

## Typedef Documentation

## denominator_list

typedef denominator_list_s* denominator_list

Definition at line 64 of file kutil.h.

## intset

typedef int* intset

Definition at line 54 of file kutil.h.

## LObject

typedef class sLObject LObject

Definition at line 59 of file kutil.h.

## LSet

typedef LObject* LSet

Definition at line 61 of file kutil.h.

## TObject

typedef class sTObject TObject

Definition at line 58 of file kutil.h.

## TSet

typedef TObject* TSet

Definition at line 60 of file kutil.h.

## wlen_set

typedef wlen_type* wlen_set

Definition at line 56 of file kutil.h.

## wlen_type

typedef int64 wlen_type

Definition at line 55 of file kutil.h.

## Function Documentation

## arriRewCriterion()

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

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
FALSE
#define FALSE
Definition auxiliary.h:97
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

## arriRewDummy()

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

Definition at line 1258 of file kInline.h.

{
return FALSE;
}

## bba()

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

Definition at line 2614 of file kstd2.cc.

{
int red_result = 1;
int olddeg,reduc;
int hilbeledeg=1,hilbcount=0,minimcnt=0;
BOOLEAN withT = FALSE;
BITSET save;
SI_SAVE_OPT1(save);
initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
if(rField_is_Ring(currRing))
initBuchMoraPosRing(strat);
else
initBuchMoraPos(strat);
initHilbCrit(F,Q,&hilb,strat);
initBba(strat);
/*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
initBuchMora(F, Q,strat);
if(errorreported) return NULL;
if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
reduc = olddeg = 0;
#ifndef NO_BUCKETS
if (!TEST_OPT_NOT_BUCKETS)
strat->use_buckets = 1;
#endif
// redtailBBa against T for inhomogeneous input
if (!TEST_OPT_OLDSTD)
withT = ! strat->homog;
// strat->posInT = posInT_pLength;
#ifdef KDEBUG
kTest_TS(strat);
#endif
#ifdef HAVE_TAIL_RING
if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
kStratInitChangeTailRing(strat);
#endif
#ifdef KDEBUG
//kDebugPrint(strat);
#endif
/* compute------------------------------------------------------- */
while (strat->Ll >= 0)
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif
if (siCntrlc)
{
while (strat->Ll >= 0)
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
strat->noClearS=TRUE;
}
if (TEST_OPT_DEGBOUND
&& ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
{
/*
*stops computation if
* 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
*a predefined number Kstd1_deg
*/
while ((strat->Ll >= 0)
&& (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
&& ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
)
{
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
if(TEST_OPT_PROT) PrintS("D");
}
if (strat->Ll<0) break;
else strat->noClearS=TRUE;
}
if (strat->Ll== 0) strat->interpt=TRUE;
/* picks the last element from the lazyset L */
strat->P = strat->L[strat->Ll];
strat->Ll--;
if (pNext(strat->P.p) == strat->tail)
{
// deletes the short spoly
if (rField_is_Ring(currRing))
pLmDelete(strat->P.p);
else
pLmFree(strat->P.p);
strat->P.p = NULL;
poly m1 = NULL, m2 = NULL;
// check that spoly creation is ok
while (strat->tailRing != currRing &&
!kCheckSpolyCreation(&(strat->P), strat, m1, m2))
{
assume(m1 == NULL && m2 == NULL);
// if not, change to a ring where exponents are at least
// large enough
if (!kStratChangeTailRing(strat))
{
WerrorS("OVERFLOW...");
break;
}
}
// create the real one
ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
strat->tailRing, m1, m2, strat->R);
}
else if (strat->P.p1 == NULL)
{
if (strat->minim > 0)
strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
// for input polys, prepare reduction
strat->P.PrepareRed(strat->use_buckets);
}
if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
{
red_result = 0;
}
else
{
if (TEST_OPT_PROT)
message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
&olddeg,&reduc,strat, red_result);
/* reduction of the element chosen from L */
red_result = strat->red(&strat->P,strat);
if (errorreported) break;
}
if (strat->overflow)
{
if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
}
// reduction to non-zero new poly
if (red_result == 1)
{
// get the polynomial (canonicalize bucket, make sure P.p is set)
strat->P.GetP(strat->lmBin);
// in the homogeneous case FDeg >= pFDeg (sugar/honey)
// but now, for entering S, T, we reset it
// in the inhomogeneous case: FDeg == pFDeg
if (strat->homog) strat->initEcart(&(strat->P));
/* statistic */
if (TEST_OPT_PROT) PrintS("s");
int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
// reduce the tail and normalize poly
// in the ring case we cannot expect LC(f) = 1,
strat->redTailChange=FALSE;
/* if we are computing over Z we always want to try and cut down
* the coefficients in the tail terms */
if (rField_is_Z(currRing) && !rHasLocalOrMixedOrdering(currRing))
{
redtailBbaAlsoLC_Z(&(strat->P), strat->tl, strat);
}
if (TEST_OPT_INTSTRATEGY)
{
strat->P.pCleardenom();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
{
strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
strat->P.pCleardenom();
if (strat->redTailChange) { strat->P.t_p=NULL; }
}
}
else
{
strat->P.pNorm();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
{
strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
if (strat->redTailChange) { strat->P.t_p=NULL; }
}
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
#endif /* KDEBUG */
// min_std stuff
if ((strat->P.p1==NULL) && (strat->minim>0))
{
if (strat->minim==1)
{
strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
else
{
strat->M->m[minimcnt]=strat->P.p2;
strat->P.p2=NULL;
}
if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
pNext(strat->M->m[minimcnt])
= strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
strat->tailRing, currRing,
currRing->PolyBin);
minimcnt++;
}
// enter into S, L, and T
if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
{
strat->P.SetShortExpVector();
enterT(&strat->P, strat);
if (rField_is_Ring(currRing))
superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
else
enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
// posInS only depends on the leading term
strat->enterS(&strat->P, pos, strat, strat->tl);
#if 0
int pl=pLength(strat->P.p);
if (pl==1)
{
//if (TEST_OPT_PROT)
//PrintS("<1>");
}
else if (pl==2)
{
//if (TEST_OPT_PROT)
//PrintS("<2>");
}
#endif
}
if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
// Print("[%d]",hilbeledeg);
kDeleteLcm(&strat->P);
if (strat->s_poly!=NULL)
{
// the only valid entries are: strat->P.p,
// strat->tailRing (read-only, keep it)
// (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
if (strat->s_poly(strat))
{
// we are called AFTER enterS, i.e. if we change P
// we have to add it also to S/T
// and add pairs
int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
enterT(&strat->P, strat);
if (rField_is_Ring(currRing))
superenterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
else
enterpairs(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
strat->enterS(&strat->P, pos, strat, strat->tl);
}
}
}
else if (strat->P.p1 == NULL && strat->minim > 0)
{
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
#ifdef KDEBUG
strat->P.Init();
kTest_TS(strat);
#endif /* KDEBUG */
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif /* KDEBUG */
if (TEST_OPT_SB_1)
{
if(!rField_is_Ring(currRing))
{
int k=1;
int j;
while(k<=strat->sl)
{
j=0;
loop
{
if (j>=k) break;
clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
j++;
}
k++;
}
}
}
/* complete reduction of the standard basis--------- */
if (TEST_OPT_REDSB)
{
completeReduce(strat);
if (strat->completeReduce_retry)
{
// completeReduce needed larger exponents, retry
// to reduce with S (instead of T)
// and in currRing (instead of strat->tailRing)
#ifdef HAVE_TAIL_RING
if(currRing->bitmask>strat->tailRing->bitmask)
{
strat->completeReduce_retry=FALSE;
cleanT(strat);strat->tailRing=currRing;
int i;
for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
completeReduce(strat);
}
if (strat->completeReduce_retry)
#endif
Werror("exponent bound is %ld",currRing->bitmask);
}
}
else if (TEST_OPT_PROT) PrintLn();
/* release temp data-------------------------------- */
exitBuchMora(strat);
/* postprocessing for GB over ZZ --------------------*/
if (!errorreported)
{
if(rField_is_Z(currRing))
{
for(int i = 0;i<=strat->sl;i++)
{
if(!nGreaterZero(pGetCoeff(strat->S[i])))
{
strat->S[i] = pNeg(strat->S[i]);
}
}
finalReduceByMon(strat);
for(int i = 0;i<IDELEMS(strat->Shdl);i++)
{
if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
{
strat->S[i] = pNeg(strat->Shdl->m[i]);
}
}
}
//else if (rField_is_Ring(currRing))
// finalReduceByMon(strat);
}
// if (TEST_OPT_WEIGHTM)
// {
// pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
// if (ecartWeights)
// {
// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
// ecartWeights=NULL;
// }
// }
if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
SI_RESTORE_OPT1(save);
/* postprocessing for GB over Q-rings ------------------*/
if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
idTest(strat->Shdl);
return (strat->Shdl);
}
BITSET
#define BITSET
Definition auxiliary.h:85
BOOLEAN
int BOOLEAN
Definition auxiliary.h:88
k
int k
Definition cfEzgcd.cc:99
skStrategy::syzComp
int syzComp
Definition kutil.h:353
skStrategy::S_2_R
int * S_2_R
Definition kutil.h:341
skStrategy::tailRing
ring tailRing
Definition kutil.h:342
skStrategy::Ll
int Ll
Definition kutil.h:350
skStrategy::lmBin
omBin lmBin
Definition kutil.h:343
skStrategy::honey
char honey
Definition kutil.h:374
skStrategy::minim
int minim
Definition kutil.h:356
skStrategy::R
TObject ** R
Definition kutil.h:339
skStrategy::M
ideal M
Definition kutil.h:304
skStrategy::tl
int tl
Definition kutil.h:349
skStrategy::tail
poly tail
Definition kutil.h:333
skStrategy::Shdl
ideal Shdl
Definition kutil.h:302
skStrategy::enterS
void(* enterS)(LObject *h, int pos, kStrategy strat, int atR)
Definition kutil.h:285
skStrategy::p_shallow_copy_delete
pShallowCopyDeleteProc p_shallow_copy_delete
Definition kutil.h:337
skStrategy::use_buckets
char use_buckets
Definition kutil.h:380
skStrategy::interpt
char interpt
Definition kutil.h:368
skStrategy::redTailChange
char redTailChange
Definition kutil.h:396
skStrategy::completeReduce_retry
char completeReduce_retry
Definition kutil.h:400
skStrategy::initEcart
void(* initEcart)(TObject *L)
Definition kutil.h:281
skStrategy::noClearS
char noClearS
Definition kutil.h:399
skStrategy::overflow
char overflow
Definition kutil.h:401
skStrategy::L
LSet L
Definition kutil.h:326
skStrategy::red
int(* red)(LObject *L, kStrategy strat)
Definition kutil.h:279
skStrategy::sevS
unsigned long * sevS
Definition kutil.h:321
skStrategy::homog
char homog
Definition kutil.h:369
skStrategy::s_poly
s_poly_proc_t s_poly
Definition kutil.h:299
w
const CanonicalForm & w
Definition facAbsFact.cc:51
j
int j
Definition facHensel.cc:110
errorreported
VAR short errorreported
Definition feFopen.cc:23
WerrorS
void WerrorS(const char *s)
Definition feFopen.cc:24
idIs0
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
Definition simpleideals.cc:960
idTest
#define idTest(id)
Definition ideals.h:47
redtailBba
KINLINE poly redtailBba(poly p, int pos, kStrategy strat, BOOLEAN normalize)
Definition kInline.h:1212
clearS
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition kInline.h:1235
khCheck
void khCheck(ideal Q, intvec *w, bigintmat *hilb, int &eledeg, int &count, kStrategy strat)
Definition khstd.cc:28
ksCreateSpoly
void ksCreateSpoly(LObject *Pair, poly spNoether, int use_buckets, ring tailRing, poly m1, poly m2, TObject **R)
Definition kspoly.cc:1203
initBba
void initBba(kStrategy strat)
Definition kstd1.cc:1690
Kstd1_deg
EXTERN_VAR int Kstd1_deg
Definition kstd1.h:70
initBuchMora
void initBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9749
message
void message(int i, int *olddeg, int *reduc, kStrategy strat, int red_result)
Definition kutil.cc:7463
kTest_TS
BOOLEAN kTest_TS(kStrategy strat)
Definition kutil.cc:1067
enterpairs
void enterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4487
redtailBbaAlsoLC_Z
void redtailBbaAlsoLC_Z(LObject *L, int end_pos, kStrategy strat)
Definition kutil.cc:7140
initBuchMoraPos
void initBuchMoraPos(kStrategy strat)
Definition kutil.cc:9580
kStratChangeTailRing
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition kutil.cc:10939
exitBuchMora
void exitBuchMora(kStrategy strat)
Definition kutil.cc:9837
posInS
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition kutil.cc:4663
kCheckSpolyCreation
BOOLEAN kCheckSpolyCreation(LObject *L, kStrategy strat, poly &m1, poly &m2)
Definition kutil.cc:10459
enterT
void enterT(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:9143
cleanT
void cleanT(kStrategy strat)
Definition kutil.cc:557
updateResult
void updateResult(ideal r, ideal Q, kStrategy strat)
Definition kutil.cc:10051
superenterpairs
void superenterpairs(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4457
kStratInitChangeTailRing
void kStratInitChangeTailRing(kStrategy strat)
Definition kutil.cc:11036
initBuchMoraCrit
void initBuchMoraCrit(kStrategy strat)
Definition kutil.cc:9435
completeReduce
void completeReduce(kStrategy strat, BOOLEAN withT)
Definition kutil.cc:10257
initBuchMoraPosRing
void initBuchMoraPosRing(kStrategy strat)
Definition kutil.cc:9664
messageSets
void messageSets(kStrategy strat)
Definition kutil.cc:7536
messageStat
void messageStat(int hilbcount, kStrategy strat)
Definition kutil.cc:7504
finalReduceByMon
void finalReduceByMon(kStrategy strat)
used for GB over ZZ: final reduction by constant elements background: any known constant element of i...
Definition kutil.cc:10847
initHilbCrit
void initHilbCrit(ideal, ideal, bigintmat **hilb, kStrategy strat)
Definition kutil.cc:9417
kDeleteLcm
static void kDeleteLcm(LObject *P)
Definition kutil.h:876
assume
#define assume(x)
Definition mod2.h:389
pNext
#define pNext(p)
Definition monomials.h:36
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
nGreaterZero
#define nGreaterZero(n)
Definition numbers.h:27
NULL
#define NULL
Definition omList.c:12
siCntrlc
VAR BOOLEAN siCntrlc
Definition options.c:14
TEST_OPT_IDLIFT
#define TEST_OPT_IDLIFT
Definition options.h:131
TEST_OPT_INTSTRATEGY
#define TEST_OPT_INTSTRATEGY
Definition options.h:112
TEST_OPT_REDTAIL
#define TEST_OPT_REDTAIL
Definition options.h:118
SI_SAVE_OPT1
#define SI_SAVE_OPT1(A)
Definition options.h:21
SI_RESTORE_OPT1
#define SI_RESTORE_OPT1(A)
Definition options.h:24
TEST_OPT_OLDSTD
#define TEST_OPT_OLDSTD
Definition options.h:125
TEST_OPT_REDSB
#define TEST_OPT_REDSB
Definition options.h:106
TEST_OPT_DEGBOUND
#define TEST_OPT_DEGBOUND
Definition options.h:115
TEST_OPT_SB_1
#define TEST_OPT_SB_1
Definition options.h:121
TEST_OPT_PROT
#define TEST_OPT_PROT
Definition options.h:105
TEST_OPT_DEBUG
#define TEST_OPT_DEBUG
Definition options.h:110
TEST_OPT_CONTENTSB
#define TEST_OPT_CONTENTSB
Definition options.h:129
TEST_OPT_NOT_BUCKETS
#define TEST_OPT_NOT_BUCKETS
Definition options.h:107
pLength
static int pLength(poly a)
Definition p_polys.h:190
p_Delete
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
p_Copy
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848
pNeg
#define pNeg(p)
Definition polys.h:199
pGetComp
#define pGetComp(p)
Component.
Definition polys.h:38
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
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
PrintLn
void PrintLn()
Definition reporter.cc:314
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189
rField_is_Z
static BOOLEAN rField_is_Z(const ring r)
Definition ring.h:515
rHasLocalOrMixedOrdering
static BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition ring.h:769
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition simpleideals.cc:35
IDELEMS
#define IDELEMS(i)
Definition simpleideals.h:23
Q
#define Q
Definition sirandom.c:26
loop
#define loop
Definition structs.h:71

## bbaShift()

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

Definition at line 4577 of file kstd2.cc.

{
int red_result = 1;
int olddeg,reduc;
int hilbeledeg=1,hilbcount=0,minimcnt=0;
BOOLEAN withT = TRUE; // currently only T contains the shifts
BITSET save;
SI_SAVE_OPT1(save);
initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
if(rField_is_Ring(currRing))
initBuchMoraPosRing(strat);
else
initBuchMoraPos(strat);
initHilbCrit(F,Q,&hilb,strat);
initBba(strat);
/*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
/*Shdl=*/initBuchMora(F, Q,strat);
if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
reduc = olddeg = 0;
#ifndef NO_BUCKETS
if (!TEST_OPT_NOT_BUCKETS)
strat->use_buckets = 1;
#endif
// redtailBBa against T for inhomogeneous input
// if (!TEST_OPT_OLDSTD)
// withT = ! strat->homog;
// strat->posInT = posInT_pLength;
kTest_TS(strat);
#ifdef HAVE_TAIL_RING
// if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
// kStratInitChangeTailRing(strat);
strat->tailRing=currRing;
#endif
#ifdef KDEBUG
//kDebugPrint(strat);
#endif
/* compute------------------------------------------------------- */
while (strat->Ll >= 0)
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif
if (siCntrlc)
{
while (strat->Ll >= 0)
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
strat->noClearS=TRUE;
}
if (TEST_OPT_DEGBOUND
&& ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
{
/*
*stops computation if
* 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
*a predefined number Kstd1_deg
*/
while ((strat->Ll >= 0)
&& (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
&& ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
)
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
if (strat->Ll<0) break;
else strat->noClearS=TRUE;
}
if (strat->Ll== 0) strat->interpt=TRUE;
/* picks the last element from the lazyset L */
strat->P = strat->L[strat->Ll];
strat->Ll--;
if (pNext(strat->P.p) == strat->tail)
{
// deletes the short spoly
if (rField_is_Ring(currRing))
pLmDelete(strat->P.p);
else
pLmFree(strat->P.p);
strat->P.p = NULL;
poly m1 = NULL, m2 = NULL;
// check that spoly creation is ok
while (strat->tailRing != currRing &&
!kCheckSpolyCreation(&(strat->P), strat, m1, m2))
{
assume(m1 == NULL && m2 == NULL);
// if not, change to a ring where exponents are at least
// large enough
if (!kStratChangeTailRing(strat))
{
WerrorS("OVERFLOW...");
break;
}
}
// create the real one
ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
strat->tailRing, m1, m2, strat->R);
}
else if (strat->P.p1 == NULL)
{
if (strat->minim > 0)
strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
// for input polys, prepare reduction
strat->P.PrepareRed(strat->use_buckets);
}
if ((strat->P.p == NULL) && (strat->P.t_p == NULL))
{
red_result = 0;
}
else
{
if (TEST_OPT_PROT)
message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
&olddeg,&reduc,strat, red_result);
/* reduction of the element chosen from L */
red_result = strat->red(&strat->P,strat);
if (errorreported) break;
}
if (strat->overflow)
{
if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
}
// reduction to non-zero new poly
if (red_result == 1)
{
// get the polynomial (canonicalize bucket, make sure P.p is set)
strat->P.GetP(strat->lmBin);
// in the homogeneous case FDeg >= pFDeg (sugar/honey)
// but now, for entering S, T, we reset it
// in the inhomogeneous case: FDeg == pFDeg
if (strat->homog) strat->initEcart(&(strat->P));
/* statistic */
if (TEST_OPT_PROT) PrintS("s");
int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
// reduce the tail and normalize poly
// in the ring case we cannot expect LC(f) = 1,
strat->redTailChange=FALSE;
/* if we are computing over Z we always want to try and cut down
* the coefficients in the tail terms */
if (rField_is_Z(currRing) && !rHasLocalOrMixedOrdering(currRing))
{
redtailBbaAlsoLC_Z(&(strat->P), strat->tl, strat);
}
if (TEST_OPT_INTSTRATEGY)
{
strat->P.pCleardenom();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
{
strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT,!TEST_OPT_CONTENTSB);
strat->P.pCleardenom();
if (strat->redTailChange)
{
strat->P.t_p=NULL;
strat->initEcart(&(strat->P)); // somehow we need this here with letterplace
}
}
}
else
{
strat->P.pNorm();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
{
strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
if (strat->redTailChange)
{
strat->P.t_p=NULL;
strat->initEcart(&(strat->P)); // somehow we need this here with letterplace
}
}
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
#endif /* KDEBUG */
// min_std stuff
if ((strat->P.p1==NULL) && (strat->minim>0))
{
if (strat->minim==1)
{
strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
else
{
strat->M->m[minimcnt]=strat->P.p2;
strat->P.p2=NULL;
}
if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
pNext(strat->M->m[minimcnt])
= strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
strat->tailRing, currRing,
currRing->PolyBin);
minimcnt++;
}
// enter into S, L, and T
if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
{
enterT(&strat->P, strat);
enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
// posInS only depends on the leading term
strat->enterS(&strat->P, pos, strat, strat->tl);
if (!strat->rightGB)
enterTShift(&strat->P, strat);
}
if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
// Print("[%d]",hilbeledeg);
kDeleteLcm(&strat->P);
if (strat->s_poly!=NULL)
{
// the only valid entries are: strat->P.p,
// strat->tailRing (read-only, keep it)
// (and P->p1, P->p2 (read-only, must set to NULL if P.p is changed)
if (strat->s_poly(strat))
{
// we are called AFTER enterS, i.e. if we change P
// we have to add it also to S/T
// and add pairs
int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
enterT(&strat->P, strat);
enterpairsShift(strat->P.p,strat->sl,strat->P.ecart,pos,strat, strat->tl);
strat->enterS(&strat->P, pos, strat, strat->tl);
if (!strat->rightGB)
enterTShift(&strat->P,strat);
}
}
}
else if (strat->P.p1 == NULL && strat->minim > 0)
{
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
#ifdef KDEBUG
strat->P.Init();
#endif /* KDEBUG */
kTest_TS(strat);
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif /* KDEBUG */
/* shift case: look for elt's in S such that they are divisible by elt in T */
if ((TEST_OPT_SB_1 || TEST_OPT_REDSB) && !strat->noClearS) // when is OPT_SB_1 set?
{
if(!rField_is_Ring(currRing))
{
for (int k = 0; k <= strat->sl; ++k)
{
if ((strat->fromQ!=NULL) && (strat->fromQ[k])) continue; // do not reduce Q_k
for (int j = 0; j<=strat->tl; ++j)
{
if (strat->T[j].p!=NULL)
{
// this is like clearS in bba, but we reduce with elements from T, because it contains the shifts too
assume(strat->sevT[j] == pGetShortExpVector(strat->T[j].p));
assume(strat->sevS[k] == pGetShortExpVector(strat->S[k]));
if (pLmShortDivisibleBy(strat->T[j].p, strat->sevT[j], strat->S[k], ~strat->sevS[k]))
{
if (pLmCmp(strat->T[j].p, strat->S[k]) != 0)
{ // check whether LM is different
deleteInS(k, strat);
--k;
break;
}
}
}
}
}
}
}
/* complete reduction of the standard basis--------- */
if (TEST_OPT_REDSB)
{
completeReduce(strat, TRUE); //shift: withT = TRUE
if (strat->completeReduce_retry)
{
// completeReduce needed larger exponents, retry
// to reduce with S (instead of T)
// and in currRing (instead of strat->tailRing)
#ifdef HAVE_TAIL_RING
if(currRing->bitmask>strat->tailRing->bitmask)
{
strat->completeReduce_retry=FALSE;
cleanT(strat);strat->tailRing=currRing;
int i;
for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
WarnS("reduction with S is not yet supported by Letterplace"); // if this ever happens, we'll know
completeReduce(strat);
}
if (strat->completeReduce_retry)
#endif
Werror("exponent bound is %ld",currRing->bitmask);
}
}
else if (TEST_OPT_PROT) PrintLn();
/* release temp data-------------------------------- */
exitBuchMora(strat);
/* postprocessing for GB over ZZ --------------------*/
if (!errorreported)
{
if(rField_is_Z(currRing))
{
for(int i = 0;i<=strat->sl;i++)
{
if(!nGreaterZero(pGetCoeff(strat->S[i])))
{
strat->S[i] = pNeg(strat->S[i]);
}
}
finalReduceByMon(strat);
for(int i = 0;i<IDELEMS(strat->Shdl);i++)
{
if(!nGreaterZero(pGetCoeff(strat->Shdl->m[i])))
{
strat->S[i] = pNeg(strat->Shdl->m[i]);
}
}
}
//else if (rField_is_Ring(currRing))
// finalReduceByMon(strat);
}
// if (TEST_OPT_WEIGHTM)
// {
// pRestoreDegProcs(currRing,pFDegOld, pLDegOld);
// if (ecartWeights)
// {
// omFreeSize((ADDRESS)ecartWeights,((currRing->N)+1)*sizeof(short));
// ecartWeights=NULL;
// }
// }
if ((TEST_OPT_PROT) || (TEST_OPT_DEBUG)) messageStat(hilbcount,strat);
SI_RESTORE_OPT1(save);
/* postprocessing for GB over Q-rings ------------------*/
if ((Q!=NULL)&&(!errorreported)) updateResult(strat->Shdl,Q,strat);
idTest(strat->Shdl);
return (strat->Shdl);
}
skStrategy::T
TSet T
Definition kutil.h:325
skStrategy::rightGB
char rightGB
Definition kutil.h:366
skStrategy::sevT
unsigned long * sevT
Definition kutil.h:324
skStrategy::fromQ
intset fromQ
Definition kutil.h:320
WarnS
#define WarnS
Definition emacs.cc:78
enterpairsShift
void enterpairsShift(poly h, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:12927
enterTShift
void enterTShift(LObject *p, kStrategy strat, int atT)
Definition kutil.cc:12957
deleteInS
void deleteInS(int i, kStrategy strat)
Definition kutil.cc:1132
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
pGetShortExpVector
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl....
Definition polys.h:153

## cancelunit()

void cancelunit | ( | LObject * | p,
|  | BOOLEAN | inNF = FALSE )

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
pSetCoeff0
#define pSetCoeff0(p, n)
Definition monomials.h:59
nCopy
#define nCopy(n)
Definition numbers.h:15
nInit
#define nInit(i)
Definition numbers.h:24
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
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

## 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--;
}
}
}
l
int l
Definition cfEzgcd.cc:100
skStrategy::pairtest
BOOLEAN * pairtest
Definition kutil.h:332
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::c3
int c3
Definition kutil.h:346
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
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
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);
}

## 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;
}
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

## clearS()

KINLINE void clearS | ( | poly | p,
|  | unsigned long | p_sev,
|  | int * | at,
|  | int * | k,
|  | kStrategy | strat )

Definition at line 1235 of file kInline.h.

{
assume(p_sev == pGetShortExpVector(p));
if (strat->noClearS) return;
if(rField_is_Ring(currRing))
{
if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at]))
return;
if(!n_DivBy(pGetCoeff(strat->S[*at]), pGetCoeff(p), currRing->cf))
return;
}
else
{
if (!pLmShortDivisibleBy(p,p_sev, strat->S[*at], ~ strat->sevS[*at])) return;
}
deleteInS((*at),strat);
(*at)--;
(*k)--;
}

## completeReduce()

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

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
Print
#define Print
Definition emacs.cc:80
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
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
p_wrp
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition polys0.cc:373
mflush
#define mflush()
Definition reporter.h:58

## deleteHC() [1/2]

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

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

## 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
lcm
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:709

## 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::lenS
intset lenS
Definition kutil.h:318
skStrategy::ecartS
intset ecartS
Definition kutil.h:308
skStrategy::lenSw
wlen_set lenSw
Definition kutil.h:319
wlen_type
int64 wlen_type
Definition kutil.h:55

## 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::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
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

## enterOnePairNormal()

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

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);
}
}
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
pDivComp
static int pDivComp(poly p, poly q)
Definition kutil.cc:176
ALLOW_PROD_CRIT
#define ALLOW_PROD_CRIT(A)
Definition kutil.h:392
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
pNorm
void pNorm(poly p)
Definition polys.h:363
pCopy
#define pCopy(p)
return a copy of the poly
Definition polys.h:186
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
rIsPluralRing
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
rIsRatGRing
static BOOLEAN rIsRatGRing(const ring r)
Definition ring.h:433

## 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;
}
skStrategy::cv
int cv
Definition kutil.h:365
pLPDivComp
static int pLPDivComp(poly p, poly q)
Definition kutil.cc:225
p_Lcm
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition p_polys.cc:1659
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
wrp
void wrp(poly p)
Definition polys.h:311
pString
char * pString(poly p)
Definition polys.h:307
pmIsInV
#define pmIsInV(p)
Definition shiftop.h:51

## enterpairs()

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

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++;
}
}
}
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 | from,
|  | int | k,
|  | int | ec,
|  | int | pos,
|  | kStrategy | strat,
|  | int | atR = -1 )

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

## enterSBba()

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

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
setmaxTinc
#define setmaxTinc
Definition kutil.h:35
intset
int * intset
Definition kutil.h:54
omReallocSize
#define omReallocSize(addr, o_size, size)
Definition omAllocDecl.h:220
omRealloc0Size
#define omRealloc0Size(addr, o_size, size)
Definition omAllocDecl.h:221
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 = -1 )

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
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

## entersets()

void entersets | ( | LObject | h | ) |

## enterSMora()

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

Definition at line 1629 of file kstd1.cc.

{
enterSBba(p, atS, strat, atR);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
Print("new s%d:",atS);
p_wrp(p->p,currRing,strat->tailRing);
PrintLn();
}
#endif
HEckeTest(p->p,strat);
if (strat->kAllAxis)
{
if (newHEdge(strat))
{
firstUpdate(strat);
if (TEST_OPT_FINDET)
return;
/*- cuts elements in L above noether and reorders L -*/
updateLHC(strat);
/*- reorders L with respect to posInL -*/
reorderL(strat);
}
}
else if ((strat->kNoether==NULL)
&& (TEST_OPT_FASTHC))
{
if (strat->posInLOldFlag)
{
missingAxis(&strat->lastAxis,strat);
if (strat->lastAxis)
{
strat->posInLOld = strat->posInL;
strat->posInLOldFlag = FALSE;
strat->posInL = posInL10;
strat->posInLDependsOnLength = TRUE;
updateL(FALSE,strat);
reorderL(strat);
}
}
else if (strat->lastAxis)
updateL(TRUE,strat);
}
}
skStrategy::posInLOldFlag
char posInLOldFlag
Definition kutil.h:379
skStrategy::lastAxis
int lastAxis
Definition kutil.h:354
skStrategy::posInLOld
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition kutil.h:287
skStrategy::kAllAxis
char kAllAxis
Definition kutil.h:373
skStrategy::posInLDependsOnLength
char posInLDependsOnLength
Definition kutil.h:386
firstUpdate
static void firstUpdate(kStrategy strat)
Definition kstd1.cc:1566
updateL
static void updateL(BOOLEAN searchPP, kStrategy strat)
Definition kstd1.cc:1394
missingAxis
static void missingAxis(int *last, kStrategy strat)
Definition kstd1.cc:1279
updateLHC
static void updateLHC(kStrategy strat)
Definition kstd1.cc:1474
posInL10
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition kstd1.cc:1360
reorderL
static void reorderL(kStrategy strat)
Definition kstd1.cc:1222
HEckeTest
void HEckeTest(poly pp, kStrategy strat)
Definition kutil.cc:493
newHEdge
BOOLEAN newHEdge(kStrategy strat)
Definition kutil.cc:10379
TEST_OPT_FINDET
#define TEST_OPT_FINDET
Definition options.h:113
TEST_OPT_FASTHC
#define TEST_OPT_FASTHC
Definition options.h:111

## enterSMoraNF()

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

Definition at line 1682 of file kstd1.cc.

{
enterSBba(p, atS, strat, atR);
if ((!strat->kAllAxis) || (strat->kNoether!=NULL)) HEckeTest(p->p,strat);
if (strat->kAllAxis)
newHEdge(strat);
}

## enterSSba()

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

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
pWrite
void pWrite(poly p)
Definition polys.h:309

## 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
pLtCmp
#define pLtCmp(p, q)
Definition polys.h:124

## enterT()

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

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::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
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 = -1 )

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 = -1 )

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
pLPCopyAndShiftLM
#define pLPCopyAndShiftLM(p, sh)
Definition shiftgb.h:15

## 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

## 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

## f5c()

void f5c | ( | kStrategy | strat,
|  | int & | olddeg,
|  | int & | minimcnt,
|  | int & | hilbeledeg,
|  | int & | hilbcount,
|  | int & | srmax,
|  | int & | lrmax,
|  | int & | reduc,
|  | ideal | Q,
|  | intvec * | w,
|  | bigintmat * | hilb )

Definition at line 4265 of file kstd2.cc.

{
int Ll_old, red_result = 1;
int pos = 0;
hilbeledeg=1;
hilbcount=0;
minimcnt=0;
srmax = 0; // strat->sl is 0 at this point
reduc = olddeg = lrmax = 0;
// we cannot use strat->T anymore
//cleanT(strat);
//strat->tl = -1;
Ll_old = strat->Ll;
while (strat->tl >= 0)
{
if(!strat->T[strat->tl].is_redundant)
{
LObject h;
h.p = strat->T[strat->tl].p;
h.tailRing = strat->T[strat->tl].tailRing;
h.t_p = strat->T[strat->tl].t_p;
if (h.p!=NULL)
{
if (currRing->OrdSgn==-1)
{
cancelunit(&h);
deleteHC(&h, strat);
}
if (h.p!=NULL)
{
if (TEST_OPT_INTSTRATEGY)
{
h.pCleardenom(); // also does remove Content
}
else
{
h.pNorm();
}
strat->initEcart(&h);
if(rField_is_Ring(currRing))
pos = posInLF5CRing(strat->L, Ll_old+1,strat->Ll,&h,strat);
else
pos = strat->Ll+1;
h.sev = pGetShortExpVector(h.p);
enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
}
}
}
strat->tl--;
}
strat->sl = -1;
#if 0
//#ifdef HAVE_TAIL_RING
if(!rField_is_Ring()) // create strong gcd poly computes with tailring and S[i] ->to be fixed
kStratInitChangeTailRing(strat);
#endif
//enterpairs(pOne(),0,0,-1,strat,strat->tl);
//strat->sl = -1;
/* picks the last element from the lazyset L */
while (strat->Ll>Ll_old)
{
strat->P = strat->L[strat->Ll];
strat->Ll--;
//#if 1
#ifdef DEBUGF5
PrintS("NEXT PAIR TO HANDLE IN INTERRED ALGORITHM\n");
PrintS("-------------------------------------------------\n");
pWrite(pHead(strat->P.p));
pWrite(pHead(strat->P.p1));
pWrite(pHead(strat->P.p2));
printf("%d\n",strat->tl);
PrintS("-------------------------------------------------\n");
#endif
if (pNext(strat->P.p) == strat->tail)
{
// deletes the short spoly
if (rField_is_Ring(currRing))
pLmDelete(strat->P.p);
else
pLmFree(strat->P.p);
// TODO: needs some masking
// TODO: masking needs to vanish once the signature
// stuff is completely implemented
strat->P.p = NULL;
poly m1 = NULL, m2 = NULL;
// check that spoly creation is ok
while (strat->tailRing != currRing &&
!kCheckSpolyCreation(&(strat->P), strat, m1, m2))
{
assume(m1 == NULL && m2 == NULL);
// if not, change to a ring where exponents are at least
// large enough
if (!kStratChangeTailRing(strat))
{
WerrorS("OVERFLOW...");
break;
}
}
// create the real one
ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
strat->tailRing, m1, m2, strat->R);
}
else if (strat->P.p1 == NULL)
{
if (strat->minim > 0)
strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
// for input polys, prepare reduction
if(!rField_is_Ring(currRing))
strat->P.PrepareRed(strat->use_buckets);
}
if (strat->P.p == NULL && strat->P.t_p == NULL)
{
red_result = 0;
}
else
{
if (TEST_OPT_PROT)
message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
&olddeg,&reduc,strat, red_result);
#ifdef DEBUGF5
PrintS("Poly before red: ");
pWrite(strat->P.p);
#endif
/* complete reduction of the element chosen from L */
red_result = strat->red2(&strat->P,strat);
if (errorreported) break;
}
if (strat->overflow)
{
if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
}
// reduction to non-zero new poly
if (red_result == 1)
{
// get the polynomial (canonicalize bucket, make sure P.p is set)
strat->P.GetP(strat->lmBin);
// in the homogeneous case FDeg >= pFDeg (sugar/honey)
// but now, for entering S, T, we reset it
// in the inhomogeneous case: FDeg == pFDeg
if (strat->homog) strat->initEcart(&(strat->P));
/* statistic */
if (TEST_OPT_PROT) PrintS("s");
int pos;
#if 1
if(!rField_is_Ring(currRing))
pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
else
pos = posInSMonFirst(strat,strat->sl,strat->P.p);
#else
pos = posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
#endif
// reduce the tail and normalize poly
// in the ring case we cannot expect LC(f) = 1,
#if F5CTAILRED
BOOLEAN withT = TRUE;
if (TEST_OPT_INTSTRATEGY)
{
strat->P.pCleardenom();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
{
strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
strat->P.pCleardenom();
}
}
else
{
strat->P.pNorm();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
strat->P.p = redtailBba(&(strat->P),pos-1,strat, withT);
}
#endif
#ifdef KDEBUG
if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
#endif /* KDEBUG */
// min_std stuff
if ((strat->P.p1==NULL) && (strat->minim>0))
{
if (strat->minim==1)
{
strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
else
{
strat->M->m[minimcnt]=strat->P.p2;
strat->P.p2=NULL;
}
if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
pNext(strat->M->m[minimcnt])
= strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
strat->tailRing, currRing,
currRing->PolyBin);
minimcnt++;
}
// enter into S, L, and T
// here we need to recompute new signatures, but those are trivial ones
if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
{
enterT(&strat->P, strat);
// posInS only depends on the leading term
strat->enterS(&strat->P, pos, strat, strat->tl);
//#if 1
#ifdef DEBUGF5
PrintS("ELEMENT ADDED TO GCURR DURING INTERRED: ");
pWrite(pHead(strat->S[strat->sl]));
pWrite(strat->sig[strat->sl]);
#endif
if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
}
// Print("[%d]",hilbeledeg);
kDeleteLcm(&strat->P);
if (strat->sl>srmax) srmax = strat->sl;
}
else
{
// adds signature of the zero reduction to
// strat->syz. This is the leading term of
// syzygy and can be used in syzCriterion()
// the signature is added if and only if the
// pair was not detected by the rewritten criterion in strat->red = redSig
if (strat->P.p1 == NULL && strat->minim > 0)
{
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
}
#ifdef KDEBUG
strat->P.Init();
#endif /* KDEBUG */
}
int cc = 0;
while (cc<strat->tl+1)
{
strat->T[cc].sig = pOne();
p_SetComp(strat->T[cc].sig,cc+1,currRing);
strat->T[cc].sevSig = pGetShortExpVector(strat->T[cc].sig);
strat->sig[cc] = strat->T[cc].sig;
strat->sevSig[cc] = strat->T[cc].sevSig;
strat->T[cc].is_sigsafe = TRUE;
cc++;
}
strat->max_lower_index = strat->tl;
// set current signature index of upcoming iteration step
// NOTE: this needs to be set here, as otherwise initSyzRules cannot compute
// the corresponding syzygy rules correctly
strat->currIdx = cc+1;
for (int cd=strat->Ll; cd>=0; cd--)
{
p_SetComp(strat->L[cd].sig,cc+1,currRing);
cc++;
}
for (cc=strat->sl+1; cc<IDELEMS(strat->Shdl); ++cc)
strat->Shdl->m[cc] = NULL;
#if 0
printf("\nAfter f5c sorting\n");
for(int i=0;i<=strat->sl;i++)
pWrite(pHead(strat->S[i]));
getchar();
#endif
//#if 1
#if DEBUGF5
PrintS("------------------- STRAT S ---------------------\n");
cc = 0;
while (cc<strat->tl+1)
{
pWrite(pHead(strat->S[cc]));
pWrite(strat->sig[cc]);
printf("- - - - - -\n");
cc++;
}
PrintS("-------------------------------------------------\n");
PrintS("------------------- STRAT T ---------------------\n");
cc = 0;
while (cc<strat->tl+1)
{
pWrite(pHead(strat->T[cc].p));
pWrite(strat->T[cc].sig);
printf("- - - - - -\n");
cc++;
}
PrintS("-------------------------------------------------\n");
PrintS("------------------- STRAT L ---------------------\n");
cc = 0;
while (cc<strat->Ll+1)
{
pWrite(pHead(strat->L[cc].p));
pWrite(pHead(strat->L[cc].p1));
pWrite(pHead(strat->L[cc].p2));
pWrite(strat->L[cc].sig);
printf("- - - - - -\n");
cc++;
}
PrintS("-------------------------------------------------\n");
printf("F5C DONE\nSTRAT SL: %d -- %d\n",strat->sl, strat->currIdx);
#endif
}
cd
CanonicalForm cd(bCommonDen(FF))
Definition cfModGcd.cc:4097
skStrategy::currIdx
int currIdx
Definition kutil.h:316
skStrategy::red2
int(* red2)(LObject *L, kStrategy strat)
Definition kutil.h:280
skStrategy::max_lower_index
int max_lower_index
Definition kutil.h:317
posInSMonFirst
int posInSMonFirst(const kStrategy strat, const int length, const poly p)
Definition kutil.cc:4764
posInLF5CRing
int posInLF5CRing(const LSet set, int start, const int length, LObject *p, const kStrategy)
Definition kutil.cc:5878
cancelunit
void cancelunit(LObject *L, BOOLEAN inNF)
Definition kutil.cc:365

## faugereRewCriterion()

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

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

## findMinLMPair()

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

## 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
pIsPurePower
#define pIsPurePower(p)
Definition polys.h:249
rHasMixedOrdering
static BOOLEAN rHasMixedOrdering(const ring r)
Definition ring.h:770

## homogTest()

BOOLEAN homogTest | ( | polyset | F,
|  | int | Fmax )

## initBba()

void initBba | ( | kStrategy | strat | ) |

Definition at line 1690 of file kstd1.cc.

{
/* setting global variables ------------------- */
strat->enterS = enterSBba;
strat->red = redHoney;
if (strat->honey)
strat->red = redHoney;
else if (currRing->pLexOrder && !strat->homog)
strat->red = redLazy;
else
{
strat->LazyPass *=4;
strat->red = redHomog;
}
if (rField_is_Ring(currRing))
{
if (rField_is_Z(currRing))
strat->red = redRing_Z;
else
strat->red = redRing;
}
if (TEST_OPT_IDLIFT
&& (!rIsNCRing(currRing))
&& (!rField_is_Ring(currRing)))
strat->red=redLiftstd;
if (currRing->pLexOrder && strat->honey)
strat->initEcart = initEcartNormal;
else
strat->initEcart = initEcartBBA;
if (strat->honey)
strat->initEcartPair = initEcartPairMora;
else
strat->initEcartPair = initEcartPairBba;
// if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
// {
// //interred machen Aenderung
// strat->pOrigFDeg=pFDeg;
// strat->pOrigLDeg=pLDeg;
// //h=ggetid("ecart");
// //if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
// //{
// // ecartWeights=iv2array(IDINTVEC(h));
// //}
// //else
// {
// ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
// /*uses automatic computation of the ecartWeights to set them*/
// kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights);
// }
// pRestoreDegProcs(currRing,totaldegreeWecart, maxdegreeWecart);
// if (TEST_OPT_PROT)
// {
// for(i=1; i<=(currRing->N); i++)
// Print(" %d",ecartWeights[i]);
// PrintLn();
// mflush();
// }
// }
}
skStrategy::LazyPass
int LazyPass
Definition kutil.h:352
redLiftstd
int redLiftstd(LObject *h, kStrategy strat)
Definition kLiftstd.cc:167
redRing_Z
int redRing_Z(LObject *h, kStrategy strat)
Definition kstd2.cc:720
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
initEcartPairMora
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition kutil.cc:1315
initEcartNormal
void initEcartNormal(TObject *h)
Definition kutil.cc:1293
initEcartBBA
void initEcartBBA(TObject *h)
Definition kutil.cc:1301
initEcartPairBba
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition kutil.cc:1308
rIsNCRing
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:427

## 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::newIdeal
int newIdeal
Definition kutil.h:355
idDelete
#define idDelete(H)
delete an ideal
Definition ideals.h:29
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
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

## 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
enterOnePairRing
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition kutil.cc:1334
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_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);
}
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
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

## 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 = -1 )

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);
}
}

## 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

## initL()

LSet initL | ( | int | nr = setmaxL | ) |

inline static

Definition at line 417 of file kutil.h.

{ return (LSet)omAlloc(nr*sizeof(LObject)); }
LSet
LObject * LSet
Definition kutil.h:61

## initR()

KINLINE TObject ** initR | ( |  | ) |

Definition at line 95 of file kInline.h.

{
return (TObject**) omAlloc0(setmaxT*sizeof(TObject*));
}
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
initsevS
static unsigned long * initsevS(const int maxnr)
Definition kutil.cc:527
pIsConstant
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:239

## initSba()

void initSba | ( | ideal | F,
|  | kStrategy | strat )

Definition at line 1750 of file kstd1.cc.

{
int i;
//idhdl h;
/* setting global variables ------------------- */
strat->enterS = enterSSba;
strat->red2 = redHoney;
if (strat->honey)
strat->red2 = redHoney;
else if (currRing->pLexOrder && !strat->homog)
strat->red2 = redLazy;
else
{
strat->LazyPass *=4;
strat->red2 = redHomog;
}
if (rField_is_Ring(currRing))
{
if(rHasLocalOrMixedOrdering(currRing))
{strat->red2 = redRiloc;}
else
{strat->red2 = redRing;}
}
if (currRing->pLexOrder && strat->honey)
strat->initEcart = initEcartNormal;
else
strat->initEcart = initEcartBBA;
if (strat->honey)
strat->initEcartPair = initEcartPairMora;
else
strat->initEcartPair = initEcartPairBba;
//strat->kIdeal = NULL;
//if (strat->ak==0) strat->kIdeal->rtyp=IDEAL_CMD;
//else strat->kIdeal->rtyp=MODUL_CMD;
//strat->kIdeal->data=(void *)strat->Shdl;
if ((TEST_OPT_WEIGHTM)&&(F!=NULL))
{
//interred machen Aenderung
strat->pOrigFDeg = currRing->pFDeg;
strat->pOrigLDeg = currRing->pLDeg;
//h=ggetid("ecart");
//if ((h!=NULL) /*&& (IDTYP(h)==INTVEC_CMD)*/)
//{
// ecartWeights=iv2array(IDINTVEC(h));
//}
//else
{
ecartWeights=(short *)omAlloc(((currRing->N)+1)*sizeof(short));
/*uses automatic computation of the ecartWeights to set them*/
kEcartWeights(F->m,IDELEMS(F)-1,ecartWeights, currRing);
}
pRestoreDegProcs(currRing, totaldegreeWecart, maxdegreeWecart);
if (TEST_OPT_PROT)
{
for(i=1; i<=(currRing->N); i++)
Print(" %d",ecartWeights[i]);
PrintLn();
mflush();
}
}
// for sig-safe reductions in signature-based
// standard basis computations
if(rField_is_Ring(currRing))
strat->red = redSigRing;
else
strat->red = redSig;
//strat->sbaOrder = 1;
strat->currIdx = 1;
}
skStrategy::pOrigFDeg
pFDegProc pOrigFDeg
Definition kutil.h:295
skStrategy::pOrigLDeg
pLDegProc pOrigLDeg
Definition kutil.h:296
redRiloc
int redRiloc(LObject *h, kStrategy strat)
Definition kstd1.cc:385
redSigRing
int redSigRing(LObject *h, kStrategy strat)
Definition kstd2.cc:1536
redSig
int redSig(LObject *h, kStrategy strat)
Definition kstd2.cc:1369
enterSSba
void enterSSba(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8915
pRestoreDegProcs
void pRestoreDegProcs(ring r, pFDegProc old_FDeg, pLDegProc old_lDeg)
Definition p_polys.cc:3774
totaldegreeWecart
long totaldegreeWecart(poly p, ring r)
Definition weight.cc:217
maxdegreeWecart
long maxdegreeWecart(poly p, int *l, ring r)
Definition weight.cc:247
kEcartWeights
void kEcartWeights(poly *s, int sl, short *eweight, const ring R)
Definition weight.cc:182
ecartWeights
EXTERN_VAR short * ecartWeights
Definition weight.h:12

## 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
}
skStrategy::syzCrit
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition kutil.h:291
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

## initsevT()

KINLINE unsigned long * initsevT | ( |  | ) |

Definition at line 100 of file kInline.h.

{
return (unsigned long*) omAlloc0(setmaxT*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

## 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
}
}
comp
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
Definition facSparseHensel.h:25
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_GetCoeff
#define p_GetCoeff(p, r)
Definition monomials.h:50
diff
STATIC_VAR gmp_float * diff
Definition mpr_complex.cc:45
p_GetShortExpVector
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition p_polys.cc:4934
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_Add_q
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
p_ExpVectorCopy
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition p_polys.h:1334
p_SetCompP
static void p_SetCompP(poly p, int i, ring r)
Definition p_polys.h:256

## initT()

KINLINE TSet initT | ( |  | ) |

Definition at line 84 of file kInline.h.

{
TSet T = (TSet)omAlloc0(setmaxT*sizeof(TObject));
for (int i=setmaxT-1; i>=0; i--)
{
T[i].tailRing = currRing;
T[i].i_r = -1;
}
return T;
}
T
STATIC_VAR jList * T
Definition janet.cc:30
TSet
TObject * TSet
Definition kutil.h:60

## 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 at line 1018 of file kInline.h.

{
p_LmCheckPolyRing(p1, p_r);
p_LmCheckPolyRing(p2, p_r);
int i;
long x;
m1 = p_Init(m_r,m_r->PolyBin);
m2 = p_Init(m_r,m_r->PolyBin);
for (i = p_r->N; i; i--)
{
x = p_GetExpDiff(p1, p2, i, p_r);
if (x > 0)
{
if (x > (long) m_r->bitmask) goto false_return;
p_SetExp(m2,i,x, m_r);
p_SetExp(m1,i,0, m_r);
}
else
{
if (-x > (long) m_r->bitmask) goto false_return;
p_SetExp(m1,i,-x, m_r);
p_SetExp(m2,i,0, m_r);
}
}
p_Setm(m1, m_r);
p_Setm(m2, m_r);
return TRUE;
false_return:
p_LmFree(m1, m_r);
p_LmFree(m2, m_r);
m1 = m2 = NULL;
return FALSE;
}
x
Variable x
Definition cfModGcd.cc:4090
p_GetExpDiff
static long p_GetExpDiff(poly p1, poly p2, int i, ring r)
Definition p_polys.h:637
p_LmCheckPolyRing
BOOLEAN p_LmCheckPolyRing(poly p, ring r)
Definition pDebug.cc:123
p_SetExp
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:490
p_Init
static poly p_Init(const ring r, omBin bin)
Definition p_polys.h:1341

## k_GetStrongLeadTerms()

KINLINE void k_GetStrongLeadTerms | ( | const poly | p1,
|  | const poly | p2,
|  | const ring | leadRing,
|  | poly & | m1,
|  | poly & | m2,
|  | poly & | lcm,
|  | const ring | taiRing )

Definition at line 1060 of file kInline.h.

{
p_LmCheckPolyRing(p1, leadRing);
p_LmCheckPolyRing(p2, leadRing);
int i;
int x;
int e1;
int e2;
int s;
m1 = p_Init(tailRing,tailRing->PolyBin);
m2 = p_Init(tailRing,tailRing->PolyBin);
lcm = p_Init(leadRing,leadRing->PolyBin);
for (i = leadRing->N; i>=0; i--)
{
e1 = p_GetExp(p1,i,leadRing);
e2 = p_GetExp(p2,i,leadRing);
x = e1 - e2;
if (x > 0)
{
p_SetExp(m2,i,x, tailRing);
//p_SetExp(m1,i,0, tailRing); // done by p_Init
s = e1;
}
else if (x<0)
{
p_SetExp(m1,i,-x, tailRing);
//p_SetExp(m2,i,0, tailRing); // done by p_Init
s = e2;
}
else
s = e1; // e1==e2
p_SetExp(lcm,i,s, leadRing);
}
p_Setm(m1, tailRing);
p_Setm(m2, tailRing);
p_Setm(lcm, leadRing);
}
s
const CanonicalForm int s
Definition facAbsFact.cc:51

## k_LmInit_currRing_2_tailRing() [1/2]

KINLINE poly k_LmInit_currRing_2_tailRing | ( | poly | p,
|  | ring | tailRing )

Definition at line 991 of file kInline.h.

{
return k_LmInit_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
}

## k_LmInit_currRing_2_tailRing() [2/2]

KINLINE poly k_LmInit_currRing_2_tailRing | ( | poly | p,
|  | ring | tailRing,
|  | omBin | bin )

Definition at line 959 of file kInline.h.

{
poly t_p = p_LmInit(p, currRing, tailRing, tailBin);
pNext(t_p) = pNext(p);
pSetCoeff0(t_p, pGetCoeff(p));
return t_p;
}
p_LmInit
static poly p_LmInit(poly p, const ring r)
Definition p_polys.h:1356

## k_LmInit_tailRing_2_currRing() [1/2]

KINLINE poly k_LmInit_tailRing_2_currRing | ( | poly | p,
|  | ring | tailRing )

Definition at line 996 of file kInline.h.

{
return k_LmInit_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
}
k_LmInit_tailRing_2_currRing
KINLINE poly k_LmInit_tailRing_2_currRing(poly t_p, ring tailRing, omBin lmBin)
Definition kInline.h:968

## k_LmInit_tailRing_2_currRing() [2/2]

KINLINE poly k_LmInit_tailRing_2_currRing | ( | poly | p,
|  | ring | tailRing,
|  | omBin | bin )

Definition at line 968 of file kInline.h.

{
poly p = p_LmInit(t_p, tailRing, currRing, lmBin);
pNext(p) = pNext(t_p);
pSetCoeff0(p, pGetCoeff(t_p));
return p;
}

## k_LmShallowCopyDelete_currRing_2_tailRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing | ( | poly | p,
|  | ring | tailRing )

Definition at line 1001 of file kInline.h.

{
return k_LmShallowCopyDelete_currRing_2_tailRing(p, tailRing, tailRing->PolyBin);
}
k_LmShallowCopyDelete_currRing_2_tailRing
KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition kInline.h:977

## k_LmShallowCopyDelete_currRing_2_tailRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_currRing_2_tailRing | ( | poly | p,
|  | ring | tailRing,
|  | omBin | bin )

Definition at line 977 of file kInline.h.

{
poly np = k_LmInit_currRing_2_tailRing(p, tailRing, tailBin);
p_LmFree(p, currRing);
return np;
}

## k_LmShallowCopyDelete_tailRing_2_currRing() [1/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing | ( | poly | p,
|  | ring | tailRing )

Definition at line 1006 of file kInline.h.

{
return k_LmShallowCopyDelete_tailRing_2_currRing(p, tailRing, currRing->PolyBin);
}
k_LmShallowCopyDelete_tailRing_2_currRing
KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing(poly p, ring tailRing, omBin lmBin)
Definition kInline.h:984

## k_LmShallowCopyDelete_tailRing_2_currRing() [2/2]

KINLINE poly k_LmShallowCopyDelete_tailRing_2_currRing | ( | poly | p,
|  | ring | tailRing,
|  | omBin | bin )

Definition at line 984 of file kInline.h.

{
poly np = k_LmInit_tailRing_2_currRing(p, tailRing, lmBin);
p_LmFree(p, tailRing);
return np;
}

## 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;
}
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
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::LazyDegree
int LazyDegree
Definition kutil.h:352
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
enterSMoraNF
void enterSMoraNF(LObject *p, int atS, kStrategy strat, int atR)
Definition kstd1.cc:1682
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
posInT_EcartFDegpLength
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11358
posInT_FDegpLength
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition kutil.cc:11412
showOption
char * showOption()
Definition misc_ip.cc:711
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

## kDeleteLcm()

void kDeleteLcm | ( | LObject * | P | ) |

inline static

Definition at line 876 of file kutil.h.

{
if (P->lcm!=NULL)
{
if (rField_is_Ring(currRing))
pLmDelete(P->lcm);
else
pLmFree(P->lcm);
P->lcm=NULL;
}
}

## kFindDivisibleByInS()

int kFindDivisibleByInS | ( | const kStrategy | strat,
|  | int * | max_ind,
|  | LObject * | L )

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

Definition at line 464 of file kstd2.cc.

{
unsigned long not_sev = ~L->sev;
poly p = L->GetLmCurrRing();
int j = 0;
pAssume(~not_sev == p_GetShortExpVector(p, currRing));
BOOLEAN is_Ring=rField_is_Ring(currRing);
#if 1
int ende;
if (is_Ring
|| (strat->ak>0)
|| currRing->pLexOrder)
ende=strat->sl;
else
{
ende=posInS(strat,*max_ind,p,0)+1;
if (ende>(*max_ind)) ende=(*max_ind);
}
#else
int ende=strat->sl;
#endif
if(is_Ring)
{
loop
{
if (j > ende) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
p, not_sev, currRing))
#else
if ( !(strat->sevS[j] & not_sev) &&
p_LmDivisibleBy(strat->S[j], p, currRing))
#endif
{
if(n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), currRing->cf))
return j;
}
j++;
}
}
else
{
loop
{
if (j > ende) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
p, not_sev, currRing))
#else
if ( !(strat->sevS[j] & not_sev) &&
p_LmDivisibleBy(strat->S[j], p, currRing))
#endif
{
return j;
}
j++;
}
}
}
p_LmDivisibleBy
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1912

## kFindDivisibleByInS_T()

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

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

## kFindDivisibleByInT()

int kFindDivisibleByInT | ( | const kStrategy | strat,
|  | const LObject * | L,
|  | const int | start = 0 )

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

Definition at line 317 of file kstd2.cc.

{
unsigned long not_sev = ~L->sev;
int j = start;
const TSet T=strat->T;
const unsigned long* sevT=strat->sevT;
const ring r=currRing;
const BOOLEAN is_Ring=rField_is_Ring(r);
if (L->p!=NULL)
{
const poly p=L->p;
pAssume(~not_sev == p_GetShortExpVector(p, r));
if(is_Ring)
{
loop
{
if (j > strat->tl) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if ((T[j].p!=NULL)
&& p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
#else
if (!(sevT[j] & not_sev)
&& (T[j].p!=NULL)
&& p_LmDivisibleBy(T[j].p, p, r))
#endif
{
if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].p), r->cf))
return j;
}
j++;
}
}
else
{
loop
{
if (j > strat->tl) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if ((T[j].p!=NULL)
&& p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
#else
if (!(sevT[j] & not_sev)
&& (T[j].p!=NULL)
&& p_LmDivisibleBy(T[j].p, p, r))
#endif
{
return j;
}
j++;
}
}
}
else
{
const poly p=L->t_p;
const ring r=strat->tailRing;
if(is_Ring)
{
loop
{
if (j > strat->tl) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
p, not_sev, r))
#else
if (!(sevT[j] & not_sev) &&
p_LmDivisibleBy(T[j].t_p, p, r))
#endif
{
if(n_DivBy(pGetCoeff(p), pGetCoeff(T[j].t_p), r->cf))
return j;
}
j++;
}
}
else
{
loop
{
if (j > strat->tl) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
p, not_sev, r))
#else
if (!(sevT[j] & not_sev) &&
p_LmDivisibleBy(T[j].t_p, p, r))
#endif
{
return j;
}
j++;
}
}
}
}

## kFindDivisibleByInT_ecart()

int kFindDivisibleByInT_ecart | ( | const kStrategy | strat,
|  | const LObject * | L,
|  | const int | ecart )

Definition at line 416 of file kstd2.cc.

{
if (TEST_OPT_LENGTH)
{
int r=-1; // found, but bad ecart
int j=-2; // found, good ecart
int jj=-1; // current search
loop
{
jj=kFindDivisibleByInT(strat,L,jj+1);
if (jj== -1)
{
if (j<0) return r; // nothing with good ecart
else return j; // end of search, return best found
}
else if (r<0) r=jj; // save bad ecart found
if (strat->T[jj].ecart<=ecart) // good enough
{
if (strat->T[jj].pLength<=0)
strat->T[jj].pLength=strat->T[jj].GetpLength();
if (j== -2) j=jj; // first found
else if (strat->T[j].pLength > strat->T[jj].pLength) // jj better then j
j=jj;
if (strat->T[j].pLength<=2) return j; // length already minimal
}
}
}
else
{
int r=-1;
int jj=-1;
loop
{
jj=kFindDivisibleByInT(strat,L,jj+1);
if (jj== -1)
{
return r; // nothing found
}
else if (r== -1) r=jj;
if (strat->T[jj].ecart<=ecart) // good enough
{
return jj;
}
}
}
}
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
TEST_OPT_LENGTH
#define TEST_OPT_LENGTH
Definition options.h:132

## kFindDivisibleByInT_Z()

int kFindDivisibleByInT_Z | ( | const kStrategy | strat,
|  | const LObject * | L,
|  | const int | start = 0 )

Definition at line 209 of file kstd2.cc.

{
unsigned long not_sev = ~L->sev;
int j = start;
int o = -1;
const TSet T=strat->T;
const unsigned long* sevT=strat->sevT;
number rest, orest, mult;
if (L->p!=NULL)
{
const ring r=currRing;
const poly p=L->p;
orest = pGetCoeff(p);
pAssume(~not_sev == p_GetShortExpVector(p, r));
loop
{
if (j > strat->tl) return o;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(T[j].p, sevT[j],p, not_sev, r))
#else
if (!(sevT[j] & not_sev) && p_LmDivisibleBy(T[j].p, p, r))
#endif
{
mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].p), &rest, r->cf);
if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
{
o = j;
orest = rest;
}
}
j++;
}
}
else
{
const ring r=strat->tailRing;
const poly p=L->t_p;
orest = pGetCoeff(p);
loop
{
if (j > strat->tl) return o;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(T[j].t_p, sevT[j],
p, not_sev, r))
#else
if (!(sevT[j] & not_sev) && p_LmDivisibleBy(T[j].t_p, p, r))
#endif
{
mult = n_QuotRem(pGetCoeff(p), pGetCoeff(T[j].t_p), &rest, r->cf);
if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
{
o = j;
orest = rest;
}
}
j++;
}
}
}
n_EucNorm
static FORCE_INLINE number n_EucNorm(number a, const coeffs r)
Definition coeffs.h:678
n_QuotRem
static FORCE_INLINE number n_QuotRem(number a, number b, number *q, const coeffs r)
Definition coeffs.h:684
n_Greater
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
Definition coeffs.h:517
n_IsZero
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:470
mult
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition minpoly.cc:647

## kFindInL1()

int kFindInL1 | ( | const poly | p,
|  | const kStrategy | strat )

inline static

Definition at line 852 of file kutil.h.

{
for(int i=strat->Ll;i>=0;i--)
{
if (p==strat->L[i].p1) return i;
}
return -1;
}

## kFindInT()

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()

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

## kFindNextDivisibleByInS()

int kFindNextDivisibleByInS | ( | const kStrategy | strat,
|  | int | start,
|  | int | max_ind,
|  | LObject * | L )

Definition at line 567 of file kstd2.cc.

{
unsigned long not_sev = ~L->sev;
poly p = L->GetLmCurrRing();
int j = start;
pAssume(~not_sev == p_GetShortExpVector(p, currRing));
#if 1
int ende=max_ind;
#else
int ende=strat->sl;
#endif
loop
{
if (j > ende) return -1;
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(strat->S[j], strat->sevS[j],
p, not_sev, currRing))
#else
if ( !(strat->sevS[j] & not_sev) &&
p_LmDivisibleBy(strat->S[j], p, currRing))
#endif
{
return j;
}
j++;
}
}

## kFindSameLMInT_Z()

int kFindSameLMInT_Z | ( | const kStrategy | strat,
|  | const LObject * | L,
|  | const int | start = 0 )

## kFindZeroPoly()

poly kFindZeroPoly | ( | poly | input_p,
|  | ring | leadRing,
|  | ring | tailRing )

Definition at line 609 of file kstd2.cc.

{
// m = currRing->ch
if (input_p == NULL) return NULL;
poly p = input_p;
poly zeroPoly = NULL;
unsigned long a = (unsigned long) pGetCoeff(p);
int k_ind2 = 0;
int a_ind2 = SI_LOG2_LONG(a);
// unsigned long k = 1;
// of interest is only k_ind2, special routine for improvement ... TODO OLIVER
for (int i = 1; i <= leadRing->N; i++)
{
k_ind2 = k_ind2 + ind_fact_2(p_GetExp(p, i, leadRing));
}
a = (unsigned long) pGetCoeff(p);
number tmp1;
poly tmp2, tmp3;
poly lead_mult = p_ISet(1, tailRing);
if (n_GetChar(leadRing->cf) <= k_ind2 + a_ind2)
{
int too_much = k_ind2 + a_ind2 - n_GetChar(leadRing->cf);
int s_exp;
zeroPoly = p_ISet(a, tailRing);
for (int i = 1; i <= leadRing->N; i++)
{
s_exp = p_GetExp(p, i,leadRing);
if (s_exp % 2 != 0)
{
s_exp = s_exp - 1;
}
while ( (0 < SI_LOG2_LONG(s_exp)) && (SI_LOG2_LONG(s_exp) <= too_much) )
{
too_much = too_much - SI_LOG2_LONG(s_exp);
s_exp = s_exp - 2;
}
p_SetExp(lead_mult, i, p_GetExp(p, i,leadRing) - s_exp, tailRing);
for (int j = 1; j <= s_exp; j++)
{
tmp1 = nInit(j);
tmp2 = p_ISet(1, tailRing);
p_SetExp(tmp2, i, 1, tailRing);
p_Setm(tmp2, tailRing);
if (nIsZero(tmp1))
{ // should nowbe obsolet, test ! TODO OLIVER
zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
}
else
{
tmp3 = p_NSet(nCopy(tmp1), tailRing);
zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
}
}
}
p_Setm(lead_mult, tailRing);
zeroPoly = p_Mult_mm(zeroPoly, lead_mult, tailRing);
tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
for (int i = 1; i <= leadRing->N; i++)
{
pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
}
p_Setm(tmp2, leadRing);
zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
pNext(tmp2) = zeroPoly;
return tmp2;
}
/* unsigned long alpha_k = twoPow(leadRing->ch - k_ind2);
if (1 == 0 && alpha_k <= a)
{ // Temporarily disabled, reducing coefficients not compatible with std TODO Oliver
zeroPoly = p_ISet((a / alpha_k)*alpha_k, tailRing);
for (int i = 1; i <= leadRing->N; i++)
{
for (unsigned long j = 1; j <= p_GetExp(p, i, leadRing); j++)
{
tmp1 = nInit(j);
tmp2 = p_ISet(1, tailRing);
p_SetExp(tmp2, i, 1, tailRing);
p_Setm(tmp2, tailRing);
if (nIsZero(tmp1))
{
zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
}
else
{
tmp3 = p_ISet((unsigned long) tmp1, tailRing);
zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp2, tmp3, tailRing), tailRing);
}
}
}
tmp2 = p_ISet((unsigned long) pGetCoeff(zeroPoly), leadRing);
for (int i = 1; i <= leadRing->N; i++)
{
pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
}
p_Setm(tmp2, leadRing);
zeroPoly = p_LmDeleteAndNext(zeroPoly, tailRing);
pNext(tmp2) = zeroPoly;
return tmp2;
} */
return NULL;
}
n_GetChar
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
Definition coeffs.h:450
tmp1
CFList tmp1
Definition facFqBivar.cc:75
tmp2
CFList tmp2
Definition facFqBivar.cc:75
ind_fact_2
static long ind_fact_2(long arg)
Definition kstd2.cc:596
p_ISet
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
p_NSet
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition p_polys.cc:1474
p_Mult_q
static poly p_Mult_q(poly p, poly q, const ring r)
Definition p_polys.h:1125
p_Mult_mm
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1053
p_LmDeleteAndNext
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:757
SI_LOG2_LONG
static int SI_LOG2_LONG(long v)
Definition si_log2.h:22

## kFreeStrat()

void kFreeStrat | ( | kStrategy | strat | ) |

## kNF2() [1/2]

ideal kNF2 | ( | ideal | F,
|  | ideal | Q,
|  | ideal | q,
|  | kStrategy | strat,
|  | int | lazyReduce )

Definition at line 4090 of file kstd2.cc.

{
assume(!idIs0(q));
assume(!(idIs0(F)&&(Q==NULL)));
// lazy_reduce flags: can be combined by |
//#define KSTD_NF_LAZY 1
// do only a reduction of the leading term
//#define KSTD_NF_NONORM 4
// only global: avoid normalization, return a multiply of NF
poly p;
int i;
ideal res;
int max_ind;
//if (idIs0(q))
// return idInit(IDELEMS(q),si_max(q->rank,F->rank));
//if ((idIs0(F))&&(Q==NULL))
// return idCopy(q); /*F=0*/
//strat->ak = idRankFreeModule(F);
/*- creating temp data structures------------------- -*/
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDTAIL);
initBuchMoraCrit(strat);
strat->initEcart = initEcartBBA;
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
{
strat->enterS = enterSBbaShift;
}
else
#endif
{
strat->enterS = enterSBba;
}
/*- set S -*/
strat->sl = -1;
#ifndef NO_BUCKETS
strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing));
#endif
/*- init local data struct.---------------------------------------- -*/
/*Shdl=*/initS(F,Q,strat);
/*- compute------------------------------------------------------- -*/
res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
for (i=IDELEMS(q)-1; i>=0; i--)
{
if (q->m[i]!=NULL)
{
if (TEST_OPT_PROT) { PrintS("r");mflush(); }
p = redNF(pCopy(q->m[i]),max_ind,
(lazyReduce & KSTD_NF_NONORM)==KSTD_NF_NONORM,strat);
if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
{
if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
if (rField_is_Ring(currRing))
{
p = redtailBba_NF(p,strat);
}
else
{
si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
}
}
res->m[i]=p;
}
//else
// res->m[i]=NULL;
}
/*- release temp data------------------------------- -*/
assume(strat->L==NULL); /* strat->L unused */
assume(strat->B==NULL); /* strat->B unused */
omFree(strat->sevS);
omFree(strat->ecartS);
assume(strat->T==NULL);//omfree(strat->T);
assume(strat->sevT==NULL);//omfree(strat->sevT);
assume(strat->R==NULL);//omfree(strat->R);
omfree(strat->S_2_R);
omfree(strat->fromQ);
strat->fromQ=NULL;
idDelete(&strat->Shdl);
SI_RESTORE_OPT1(save1);
if (TEST_OPT_PROT) PrintLn();
return res;
}
res
CanonicalForm res
Definition facAbsFact.cc:60
KSTD_NF_LAZY
#define KSTD_NF_LAZY
Definition kstd1.h:18
KSTD_NF_NONORM
#define KSTD_NF_NONORM
Definition kstd1.h:22
redNF
poly redNF(poly h, int &max_ind, int nonorm, kStrategy strat)
Definition kstd2.cc:2307
enterSBbaShift
void enterSBbaShift(LObject *p, int atS, kStrategy strat, int atR)
Definition kutil.cc:8892
initS
void initS(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:7586
redtailBba_NF
poly redtailBba_NF(poly p, kStrategy strat)
Definition kutil.cc:7350
omfree
#define omfree(addr)
Definition omAllocDecl.h:237
omFree
#define omFree(addr)
Definition omAllocDecl.h:261
si_opt_1
VAR unsigned si_opt_1
Definition options.c:5
OPT_INTSTRATEGY
#define OPT_INTSTRATEGY
Definition options.h:93
OPT_REDTAIL
#define OPT_REDTAIL
Definition options.h:92
Sy_bit
#define Sy_bit(x)
Definition options.h:31

## kNF2() [2/2]

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

Definition at line 3927 of file kstd2.cc.

{
assume(q!=NULL);
assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
// lazy_reduce flags: can be combined by |
//#define KSTD_NF_LAZY 1
// do only a reduction of the leading term
//#define KSTD_NF_NONORM 4
// only global: avoid normalization, return a multiply of NF
//#define KSTD_NF_CANCELUNIT 8
// apply cancelunit to f inf NF(f,I)
//#define KSTD_NF_NOLF 4096
// avoid PrintLn with OPT_PROT
poly p;
//if ((idIs0(F))&&(Q==NULL))
// return pCopy(q); /*F=0*/
//strat->ak = idRankFreeModule(F);
/*- creating temp data structures------------------- -*/
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDTAIL);
initBuchMoraCrit(strat);
strat->initEcart = initEcartBBA;
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
{
strat->enterS = enterSBbaShift;
}
else
#endif
{
strat->enterS = enterSBba;
}
#ifndef NO_BUCKETS
strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing));
#endif
/*- set S -*/
strat->sl = -1;
/*- init local data struct.---------------------------------------- -*/
/*Shdl=*/initS(F,Q,strat);
/*- compute------------------------------------------------------- -*/
//if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
//{
// for (i=strat->sl;i>=0;i--)
// pNorm(strat->S[i]);
//}
kTest(strat);
if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
if (BVERBOSE(23)) kDebugPrint(strat);
int max_ind;
p = redNF(pCopy(q),max_ind,(lazyReduce & KSTD_NF_NONORM)==KSTD_NF_NONORM,strat);
if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
{
if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
if (rField_is_Z(currRing)||(rField_is_Zn(currRing)))
{
p = redtailBba_NF(p,strat);
}
else if (rField_is_Ring(currRing))
{
p = redtailBba_Ring(p,max_ind,strat);
}
else
{
si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
}
}
/*- release temp data------------------------------- -*/
assume(strat->L==NULL); /* strat->L unused */
assume(strat->B==NULL); /* strat->B unused */
omFree(strat->sevS);
omFree(strat->ecartS);
assume(strat->T==NULL);//omfree(strat->T);
assume(strat->sevT==NULL);//omfree(strat->sevT);
assume(strat->R==NULL);//omfree(strat->R);
omfree(strat->S_2_R);
omfree(strat->fromQ);
strat->fromQ=NULL;
idDelete(&strat->Shdl);
SI_RESTORE_OPT1(save1);
if (TEST_OPT_PROT && ((lazyReduce &KSTD_NF_NOLF)==0)) PrintLn();
return p;
}
redtailBba_Ring
KINLINE poly redtailBba_Ring(poly p, int pos, kStrategy strat)
Definition kInline.h:1224
KSTD_NF_NOLF
#define KSTD_NF_NOLF
Definition kstd1.h:26
kDebugPrint
void kDebugPrint(kStrategy strat)
Definition kutil.cc:11478
kTest
BOOLEAN kTest(kStrategy strat)
Definition kutil.cc:1004
BVERBOSE
#define BVERBOSE(a)
Definition options.h:35
rField_is_Zn
static BOOLEAN rField_is_Zn(const ring r)
Definition ring.h:518

## kNF2Bound() [1/2]

ideal kNF2Bound | ( | ideal | F,
|  | ideal | Q,
|  | ideal | q,
|  | int | bound,
|  | kStrategy | strat,
|  | int | lazyReduce )

Definition at line 4176 of file kstd2.cc.

{
assume(!idIs0(q));
assume(!(idIs0(F)&&(Q==NULL)));
// lazy_reduce flags: can be combined by |
//#define KSTD_NF_LAZY 1
// do only a reduction of the leading term
//#define KSTD_NF_NONORM 4
// only global: avoid normalization, return a multiply of NF
poly p;
int i;
ideal res;
int max_ind;
//if (idIs0(q))
// return idInit(IDELEMS(q),si_max(q->rank,F->rank));
//if ((idIs0(F))&&(Q==NULL))
// return idCopy(q); /*F=0*/
//strat->ak = idRankFreeModule(F);
/*- creating temp data structures------------------- -*/
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDTAIL);
initBuchMoraCrit(strat);
strat->initEcart = initEcartBBA;
strat->enterS = enterSBba;
/*- set S -*/
strat->sl = -1;
#ifndef NO_BUCKETS
strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing));
#endif
/*- init local data struct.---------------------------------------- -*/
/*Shdl=*/initS(F,Q,strat);
/*- compute------------------------------------------------------- -*/
res=idInit(IDELEMS(q),si_max(q->rank,F->rank));
for (i=IDELEMS(q)-1; i>=0; i--)
{
if (q->m[i]!=NULL)
{
if (TEST_OPT_PROT) { PrintS("r");mflush(); }
p = redNFBound(pCopy(q->m[i]),max_ind,
(lazyReduce & KSTD_NF_NONORM)==KSTD_NF_NONORM,strat,bound);
if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
{
if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
if (rField_is_Z(currRing)||(rField_is_Zn(currRing)))
{
p = redtailBba_Z(p,max_ind,strat);
}
else if (rField_is_Ring(currRing))
{
p = redtailBba_Ring(p,max_ind,strat);
}
else
{
si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
}
}
res->m[i]=p;
}
//else
// res->m[i]=NULL;
}
/*- release temp data------------------------------- -*/
assume(strat->L==NULL); /* strat->L unused */
assume(strat->B==NULL); /* strat->B unused */
omFree(strat->sevS);
omFree(strat->ecartS);
assume(strat->T==NULL);//omfree(strat->T);
assume(strat->sevT==NULL);//omfree(strat->sevT);
assume(strat->R==NULL);//omfree(strat->R);
omfree(strat->S_2_R);
omfree(strat->fromQ);
strat->fromQ=NULL;
idDelete(&strat->Shdl);
SI_RESTORE_OPT1(save1);
if (TEST_OPT_PROT) PrintLn();
return res;
}
bound
static CanonicalForm bound(const CFMatrix &M)
Definition cf_linsys.cc:460
redtailBbaBound
KINLINE poly redtailBbaBound(poly p, int pos, kStrategy strat, int bound, BOOLEAN normalize)
Definition kInline.h:1218
redtailBba_Z
KINLINE poly redtailBba_Z(poly p, int pos, kStrategy strat)
Definition kInline.h:1229
redNFBound
poly redNFBound(poly h, int &max_ind, int nonorm, kStrategy strat, int bound)
Definition kstd2.cc:2503

## kNF2Bound() [2/2]

poly kNF2Bound | ( | ideal | F,
|  | ideal | Q,
|  | poly | q,
|  | int | bound,
|  | kStrategy | strat,
|  | int | lazyReduce )

Definition at line 4015 of file kstd2.cc.

{
assume(q!=NULL);
assume(!(idIs0(F)&&(Q==NULL))); // NF(q, std(0) in polynomial ring?
// lazy_reduce flags: can be combined by |
//#define KSTD_NF_LAZY 1
// do only a reduction of the leading term
//#define KSTD_NF_NONORM 4
// only global: avoid normalization, return a multiply of NF
poly p;
//if ((idIs0(F))&&(Q==NULL))
// return pCopy(q); /*F=0*/
//strat->ak = idRankFreeModule(F);
/*- creating temp data structures------------------- -*/
BITSET save1;
SI_SAVE_OPT1(save1);
si_opt_1|=Sy_bit(OPT_REDTAIL);
initBuchMoraCrit(strat);
strat->initEcart = initEcartBBA;
strat->enterS = enterSBba;
#ifndef NO_BUCKETS
strat->use_buckets = (!TEST_OPT_NOT_BUCKETS) && (!rIsPluralRing(currRing));
#endif
/*- set S -*/
strat->sl = -1;
/*- init local data struct.---------------------------------------- -*/
/*Shdl=*/initS(F,Q,strat);
/*- compute------------------------------------------------------- -*/
//if ((TEST_OPT_INTSTRATEGY)&&(lazyReduce==0))
//{
// for (i=strat->sl;i>=0;i--)
// pNorm(strat->S[i]);
//}
kTest(strat);
if (TEST_OPT_PROT) { PrintS("r"); mflush(); }
if (BVERBOSE(23)) kDebugPrint(strat);
int max_ind;
p = redNFBound(pCopy(q),max_ind,lazyReduce & KSTD_NF_NONORM,strat,bound);
if ((p!=NULL)&&((lazyReduce & KSTD_NF_LAZY)==0))
{
if (TEST_OPT_PROT) { PrintS("t"); mflush(); }
if (rField_is_Z(currRing)||(rField_is_Zn(currRing)))
{
p = redtailBba_Z(p,max_ind,strat);
}
else if (rField_is_Ring(currRing))
{
p = redtailBba_Ring(p,max_ind,strat);
}
else
{
si_opt_1 &= ~Sy_bit(OPT_INTSTRATEGY);
p = redtailBbaBound(p,max_ind,strat,bound,(lazyReduce & KSTD_NF_NONORM)==0);
//p = redtailBba(p,max_ind,strat,(lazyReduce & KSTD_NF_NONORM)==0);
}
}
/*- release temp data------------------------------- -*/
assume(strat->L==NULL); /* strat->L unused */
assume(strat->B==NULL); /* strat->B unused */
omFree(strat->sevS);
omFree(strat->ecartS);
assume(strat->T==NULL);//omfree(strat->T);
assume(strat->sevT==NULL);//omfree(strat->sevT);
assume(strat->R==NULL);//omfree(strat->R);
omfree(strat->S_2_R);
omfree(strat->fromQ);
strat->fromQ=NULL;
idDelete(&strat->Shdl);
SI_RESTORE_OPT1(save1);
if (TEST_OPT_PROT) PrintLn();
return p;
}

## ksCreateShortSpoly()

poly ksCreateShortSpoly | ( | poly | p1,
|  | poly | p2,
|  | ring | tailRing )

Definition at line 1446 of file kspoly.cc.

{
poly a1 = pNext(p1), a2 = pNext(p2);
#ifdef HAVE_SHIFTBBA
int shift1, shift2;
if (tailRing->isLPring)
{
// assume: LM is shifted, tail unshifted
assume(p_FirstVblock(a1, tailRing) <= 1);
assume(p_FirstVblock(a2, tailRing) <= 1);
// save the shift of the LM so we can shift the other monomials on demand
shift1 = p_mFirstVblock(p1, tailRing) - 1;
shift2 = p_mFirstVblock(p2, tailRing) - 1;
}
#endif
long c1=p_GetComp(p1, currRing),c2=p_GetComp(p2, currRing);
long c;
poly m1,m2;
number t1 = NULL,t2 = NULL;
int cm,i;
BOOLEAN equal;
BOOLEAN is_Ring=rField_is_Ring(currRing);
number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
if (is_Ring)
{
ksCheckCoeff(&lc1, &lc2, currRing->cf); // gcd and zero divisors
if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
while (a1 != NULL && nIsZero(t2))
{
pIter(a1);
nDelete(&t2);
if (a1 != NULL) t2 = nMult(pGetCoeff(a1),lc2);
}
while (a2 != NULL && nIsZero(t1))
{
pIter(a2);
nDelete(&t1);
if (a2 != NULL) t1 = nMult(pGetCoeff(a2),lc1);
}
}
#ifdef HAVE_SHIFTBBA
// shift the next monomial on demand
if (tailRing->isLPring)
{
a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing);
a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing);
}
#endif
if (a1==NULL)
{
if(a2!=NULL)
{
m2=p_Init(currRing);
x2:
for (i = (currRing->N); i; i--)
{
c = p_GetExpDiff(p1, p2,i, currRing);
if (c>0)
{
p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)),currRing);
}
else
{
p_SetExp(m2,i,p_GetExp(a2,i,tailRing),currRing);
}
}
if ((c1==c2)||(c2!=0))
{
p_SetComp(m2,p_GetComp(a2,tailRing), currRing);
}
else
{
p_SetComp(m2,c1,currRing);
}
p_Setm(m2, currRing);
if (is_Ring)
{
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t2);
pSetCoeff0(m2, t1);
}
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring && (shift2!=0)) /*a1==NULL*/
{
p_LmDelete(a2, tailRing);
}
#endif
return m2;
}
else
{
if (is_Ring)
{
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t1);
nDelete(&t2);
}
return NULL;
}
}
if (a2==NULL)
{
m1=p_Init(currRing);
x1:
for (i = (currRing->N); i; i--)
{
c = p_GetExpDiff(p2, p1,i,currRing);
if (c>0)
{
p_SetExp(m1,i,(c+p_GetExp(a1,i, tailRing)),currRing);
}
else
{
p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
}
}
if ((c1==c2)||(c1!=0))
{
p_SetComp(m1,p_GetComp(a1,tailRing),currRing);
}
else
{
p_SetComp(m1,c2,currRing);
}
p_Setm(m1, currRing);
if (is_Ring)
{
pSetCoeff0(m1, t2);
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t1);
}
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring && (shift1!=0)) /*a2==NULL*/
{
p_LmDelete(a1, tailRing);
}
#endif
return m1;
}
m1 = p_Init(currRing);
m2 = p_Init(currRing);
loop
{
for (i = (currRing->N); i; i--)
{
c = p_GetExpDiff(p1, p2,i,currRing);
if (c > 0)
{
p_SetExp(m2,i,(c+p_GetExp(a2,i,tailRing)), currRing);
p_SetExp(m1,i,p_GetExp(a1,i, tailRing), currRing);
}
else
{
p_SetExp(m1,i,(p_GetExp(a1,i,tailRing)-c), currRing);
p_SetExp(m2,i,p_GetExp(a2,i, tailRing), currRing);
}
}
if(c1==c2)
{
p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
}
else
{
if(c1!=0)
{
p_SetComp(m1,p_GetComp(a1, tailRing), currRing);
p_SetComp(m2,c1, currRing);
}
else
{
p_SetComp(m2,p_GetComp(a2, tailRing), currRing);
p_SetComp(m1,c2, currRing);
}
}
p_Setm(m1,currRing);
p_Setm(m2,currRing);
cm = p_LmCmp(m1, m2,currRing);
if (cm!=0)
{
if(cm==1)
{
p_LmFree(m2,currRing);
if (is_Ring)
{
pSetCoeff0(m1, t2);
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t1);
}
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
if (shift1!=0) p_LmDelete(a1, tailRing);
if (shift2!=0) p_LmDelete(a2, tailRing);
}
#endif
return m1;
}
else
{
p_LmFree(m1,currRing);
if (is_Ring)
{
pSetCoeff0(m2, t1);
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t2);
}
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
if (shift1!=0) p_LmDelete(a1, tailRing);
if (shift2!=0) p_LmDelete(a2, tailRing);
}
#endif
return m2;
}
}
if (is_Ring)
{
equal = nEqual(t1,t2);
}
else
{
t1 = nMult(pGetCoeff(a2),pGetCoeff(p1));
t2 = nMult(pGetCoeff(a1),pGetCoeff(p2));
equal = nEqual(t1,t2);
nDelete(&t2);
nDelete(&t1);
}
if (!equal)
{
p_LmFree(m2,currRing);
if (is_Ring)
{
pSetCoeff0(m1, nSub(t1, t2));
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t1);
nDelete(&t2);
}
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
if (shift1!=0) p_LmDelete(a1, tailRing);
if (shift2!=0) p_LmDelete(a2, tailRing);
}
#endif
return m1;
}
pIter(a1);
pIter(a2);
if (is_Ring)
{
if (a2 != NULL)
{
nDelete(&t1);
t1 = nMult(pGetCoeff(a2),lc1);
}
if (a1 != NULL)
{
nDelete(&t2);
t2 = nMult(pGetCoeff(a1),lc2);
}
while ((a1 != NULL) && nIsZero(t2))
{
pIter(a1);
if (a1 != NULL)
{
nDelete(&t2);
t2 = nMult(pGetCoeff(a1),lc2);
}
}
while ((a2 != NULL) && nIsZero(t1))
{
pIter(a2);
if (a2 != NULL)
{
nDelete(&t1);
t1 = nMult(pGetCoeff(a2),lc1);
}
}
}
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
a1 = p_LPCopyAndShiftLM(a1, shift1, tailRing);
a2 = p_LPCopyAndShiftLM(a2, shift2, tailRing);
}
#endif
if (a2==NULL)
{
p_LmFree(m2,currRing);
if (a1==NULL)
{
if (is_Ring)
{
nDelete(&lc1);
nDelete(&lc2);
nDelete(&t1);
nDelete(&t2);
}
p_LmFree(m1,currRing);
return NULL;
}
goto x1;
}
if (a1==NULL)
{
p_LmFree(m1,currRing);
goto x2;
}
}
}
equal
bool equal
Definition cfModGcd.cc:4134
ksCheckCoeff
int ksCheckCoeff(number *a, number *b, const coeffs r)
Definition kbuckets.cc:1504
nSub
#define nSub(n1, n2)
Definition numbers.h:22
nMult
#define nMult(n1, n2)
Definition numbers.h:17
p_LmDelete
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:725
p_LPCopyAndShiftLM
poly p_LPCopyAndShiftLM(poly p, int sh, const ring r)
Definition shiftgb.cc:35
p_mFirstVblock
int p_mFirstVblock(poly p, const ring ri)
Definition shiftop.cc:478
p_FirstVblock
int p_FirstVblock(poly p, const ring r)
Definition shiftop.cc:456

## ksCreateSpoly()

void ksCreateSpoly | ( | LObject * | Pair,
|  | poly | spNoether = NULL,
|  | int | use_buckets = 0,
|  | ring | tailRing = currRing,
|  | poly | m1 = NULL,
|  | poly | m2 = NULL,
|  | TObject ** | R = NULL )

Definition at line 1203 of file kspoly.cc.

{
#ifdef KDEBUG
create_count++;
#endif
poly p1 = Pair->p1;
poly p2 = Pair->p2;
Pair->tailRing = tailRing;
assume(p1 != NULL);
assume(p2 != NULL);
assume(tailRing != NULL);
poly a1 = pNext(p1), a2 = pNext(p2);
number lc1 = pGetCoeff(p1), lc2 = pGetCoeff(p2);
int co=0/*, ct = ksCheckCoeff(&lc1, &lc2, currRing->cf)*/; // gcd and zero divisors
(void) ksCheckCoeff(&lc1, &lc2, currRing->cf);
int l1=0, l2=0;
if (currRing->pCompIndex >= 0)
{
if (__p_GetComp(p1, currRing)!=__p_GetComp(p2, currRing))
{
if (__p_GetComp(p1, currRing)==0)
{
co=1;
p_SetCompP(p1,__p_GetComp(p2, currRing), currRing, tailRing);
}
else
{
co=2;
p_SetCompP(p2, __p_GetComp(p1, currRing), currRing, tailRing);
}
}
}
// get m1 = LCM(LM(p1), LM(p2))/LM(p1)
// m2 = LCM(LM(p1), LM(p2))/LM(p2)
if (m1 == NULL)
k_GetLeadTerms(p1, p2, currRing, m1, m2, tailRing);
#ifdef HAVE_SHIFTBBA
poly m12, m22;
if (tailRing->isLPring)
{
assume(p_mFirstVblock(p1, tailRing) <= 1 || p_mFirstVblock(p2, tailRing) <= 1);
k_SplitFrame(m1, m12, si_max(p_mFirstVblock(p1, tailRing), 1), tailRing);
k_SplitFrame(m2, m22, si_max(p_mFirstVblock(p2, tailRing), 1), tailRing);
// coeffs of m1,m2 are NULL here
}
#endif
pSetCoeff0(m1, lc2);
pSetCoeff0(m2, lc1); // and now, m1 * LT(p1) == m2 * LT(p2)
if (R != NULL)
{
if (Pair->i_r1 == -1)
{
l1 = pLength(p1) - 1;
}
else
{
l1 = (R[Pair->i_r1])->GetpLength() - 1;
}
if ((Pair->i_r2 == -1)||(R[Pair->i_r2]==NULL))
{
l2 = pLength(p2) - 1;
}
else
{
l2 = (R[Pair->i_r2])->GetpLength() - 1;
}
}
// get m2 * a2
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
// m2*a2*m22
poly tmp= tailRing->p_Procs->pp_mm_Mult(a2, m2, tailRing);
a2 = tailRing->p_Procs->pp_Mult_mm(tmp, m22, tailRing);
p_Delete(&tmp,tailRing);
}
else
#endif
if (spNoether != NULL)
{
l2 = -1;
a2 = tailRing->p_Procs->pp_Mult_mm_Noether(a2, m2, spNoether, l2, tailRing);
assume(l2 == (int)pLength(a2));
}
else
{
a2 = tailRing->p_Procs->pp_Mult_mm(a2, m2, tailRing);
}
if (!(rField_is_Domain(currRing))) l2 = pLength(a2);
Pair->SetLmTail(m2, a2, l2, use_buckets, tailRing);
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
// get m2*a2*m22 - m1*a1*m12
poly tmp=tailRing->p_Procs->pp_Mult_mm(a1, m12, tailRing);
Pair->Tail_Minus_mm_Mult_qq(m1, tmp, l1, spNoether);
p_Delete(&tmp,tailRing);
}
else
#endif
{
// get m2*a2 - m1*a1
Pair->Tail_Minus_mm_Mult_qq(m1, a1, l1, spNoether);
}
// Clean-up time
Pair->LmDeleteAndIter();
p_LmDelete(m1, tailRing);
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
// just to be sure, check that the shift is correct
assume(Pair->shift == 0);
assume(si_max(p_mFirstVblock(Pair->p, tailRing) - 1, 0) == Pair->shift); // == 0
p_LmDelete(m12, tailRing);
p_LmDelete(m22, tailRing);
// m2 is already deleted
}
#endif
if (co != 0)
{
if (co==1)
{
p_SetCompP(p1,0, currRing, tailRing);
}
else
{
p_SetCompP(p2,0, currRing, tailRing);
}
}
}
create_count
VAR int create_count
Definition kspoly.cc:26
rField_is_Domain
static BOOLEAN rField_is_Domain(const ring r)
Definition ring.h:493
k_SplitFrame
void k_SplitFrame(poly &m1, poly &m2, int at, const ring r)
Definition shiftop.cc:600
R
#define R
Definition sirandom.c:27

## ksOldCreateSpoly()

KINLINE poly ksOldCreateSpoly | ( | poly | p1,
|  | poly | p2,
|  | poly | spNoether = NULL,
|  | ring | r = currRing )

Definition at line 1194 of file kInline.h.

{
LObject L(r);
L.p1 = p1;
L.p2 = p2;
ksCreateSpoly(&L, spNoether);
return L.GetLmCurrRing();
}

## ksOldSpolyRed()

KINLINE poly ksOldSpolyRed | ( | poly | p1,
|  | poly | p2,
|  | poly | spNoether = NULL )

Definition at line 1174 of file kInline.h.

{
LObject L(p2);
TObject T(p1);
ksReducePoly(&L, &T, spNoether);
return L.GetLmCurrRing();
}
ksReducePoly
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, poly *mon, kStrategy strat, BOOLEAN reduce)
Definition kspoly.cc:187

## ksOldSpolyRedNew()

KINLINE poly ksOldSpolyRedNew | ( | poly | p1,
|  | poly | p2,
|  | poly | spNoether = NULL )

Definition at line 1184 of file kInline.h.

{
LObject L(p_Copy(p2, currRing));
TObject T(p1);
ksReducePoly(&L, &T, spNoether);
return L.GetLmCurrRing();
}

## ksOldSpolyTail()

KINLINE void ksOldSpolyTail | ( | poly | p1,
|  | poly | q,
|  | poly | q2,
|  | poly | spNoether,
|  | ring | r = currRing )

Definition at line 1204 of file kInline.h.

{
LObject L(q, currRing, r);
TObject T(p1, currRing, r);
ksReducePolyTail(&L, &T, q2, spNoether);
}
ksReducePolyTail
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition kInline.h:1147

## ksReducePoly()

int ksReducePoly | ( | LObject * | PR,
|  | TObject * | PW,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | poly * | mon = NULL,
|  | kStrategy | strat = NULL,
|  | BOOLEAN | redtail = FALSE )

Definition at line 187 of file kspoly.cc.

{
#ifdef KDEBUG
red_count++;
#ifdef TEST_OPT_DEBUG_RED
// if (TEST_OPT_DEBUG)
// {
// Print("Red %d:", red_count); PR->wrp(); Print(" with:");
// PW->wrp();
// //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
// //pWrite(PR->p);
// }
#endif
#endif
int ret = 0;
ring tailRing = PR->tailRing;
if (strat!=NULL)
{
kTest_L(PR,strat);
kTest_T(PW,strat);
}
poly p1 = PR->GetLmTailRing(); // p2 | p1
poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
p_CheckPolyRing(p1, tailRing);
p_CheckPolyRing(p2, tailRing);
pAssume1(p2 != NULL && p1 != NULL &&
p_DivisibleBy(p2, p1, tailRing));
pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
(p_GetComp(p2, tailRing) == 0 &&
p_MaxComp(pNext(p2),tailRing) == 0));
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
// for the time being: we know currRing==strat->tailRing
// no exp-bound checking needed
// (only needed if exp-bound(tailring)<exp-b(currRing))
if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,reduce);
else
{
poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
assume(_p != NULL);
nc_PolyPolyRed(_p, p2,coef, currRing);
if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
PR->pLength=0; // usually not used, GetpLength re-computes it if needed
}
return 0;
}
#endif
if ((t2==NULL)&&(mon==NULL)) // Divisor is just one term, therefore it will
{ // just cancel the leading term
PR->LmDeleteAndIter();
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
return 0;
}
p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
if (tailRing != currRing)
{
// check that reduction does not violate exp bound
while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
{
// undo changes of lm
p_ExpVectorAdd(lm, p2, tailRing);
if (strat == NULL) return 2;
if (! kStratChangeTailRing(strat, PR, PW)) return -1;
tailRing = strat->tailRing;
p1 = PR->GetLmTailRing();
p2 = PW->GetLmTailRing();
t2 = pNext(p2);
lm = p1;
p_ExpVectorSub(lm, p2, tailRing);
ret = 1;
}
}
#ifdef HAVE_SHIFTBBA
poly lmRight=NULL;
if (tailRing->isLPring)
{
assume(PR->shift == 0);
assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
}
#endif
// take care of coef business
if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
{
number bn = pGetCoeff(lm);
number an = pGetCoeff(p2);
int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
if (reduce)
{
if(n_IsMOne(an, tailRing->cf))
{
an=n_InpNeg(an, tailRing->cf);
bn=n_InpNeg(bn, tailRing->cf);
ct+=1;
}
#ifdef KDEBUG
else if(!n_IsOne(an,tailRing->cf))
{
StringSetS("ksReducePoly: ");n_Write(an,tailRing->cf);
StringAppendS("\n");
PrintS(StringEndS());
}
#endif
}
// in case of reduce, do not multiply PR
p_SetCoeff(lm, bn, tailRing);
if ((ct == 0) || (ct == 2))
PR->Tail_Mult_nn(an);
if (coef != NULL) *coef = an;
else n_Delete(&an, tailRing->cf);
}
else
{
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
}
if(mon!=NULL) *mon=pHead(lm);
// and finally,
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
poly tmp=tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing);
PR->Tail_Minus_mm_Mult_qq(lm, tmp, pLength(t2), spNoether);
p_Delete(&tmp,tailRing);
p_Delete(&lm,tailRing);
p_Delete(&lmRight,tailRing);
}
else
#endif
{
PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
}
assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
PR->LmDeleteAndIter();
return ret;
}
reduce
CanonicalForm reduce(const CanonicalForm &f, const CanonicalForm &M)
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of...
Definition cf_ops.cc:660
n_IsMOne
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition coeffs.h:478
n_InpNeg
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition coeffs.h:560
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
n_Write
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:594
n_IsOne
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition coeffs.h:474
red_count
VAR int red_count
Definition kspoly.cc:25
nc_kBucketPolyRed_Z
static void nc_kBucketPolyRed_Z(kBucket_pt b, poly p, number *c, BOOLEAN reduce)
Definition nc.h:284
nc_PolyPolyRed
void nc_PolyPolyRed(poly &b, poly p, number *c, const ring r)
Definition old.gring.cc:2238
pAssume1
#define pAssume1(cond)
Definition monomials.h:171
p_ExpVectorSub
static void p_ExpVectorSub(poly p1, poly p2, const ring r)
Definition p_polys.h:1461
p_DivisibleBy
static BOOLEAN p_DivisibleBy(poly a, poly b, const ring r)
Definition p_polys.h:1921
p_MaxComp
static long p_MaxComp(poly p, ring lmRing, ring tailRing)
Definition p_polys.h:294
p_CheckPolyRing
BOOLEAN p_CheckPolyRing(poly p, ring r)
Definition pDebug.cc:115
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

## ksReducePolyBound()

int ksReducePolyBound | ( | LObject * | PR,
|  | TObject * | PW,
|  | int | bound,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | kStrategy | strat = NULL )

Definition at line 590 of file kspoly.cc.

{
#ifdef KDEBUG
red_count++;
#ifdef TEST_OPT_DEBUG_RED
if (TEST_OPT_DEBUG)
{
Print("Red %d:", red_count); PR->wrp(); Print(" with:");
PW->wrp();
//printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
//pWrite(PR->p);
}
#endif
#endif
int ret = 0;
ring tailRing = PR->tailRing;
if (strat!=NULL)
{
kTest_L(PR,strat);
kTest_T(PW,strat);
}
poly p1 = PR->GetLmTailRing(); // p2 | p1
poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
p_CheckPolyRing(p1, tailRing);
p_CheckPolyRing(p2, tailRing);
pAssume1(p2 != NULL && p1 != NULL &&
p_DivisibleBy(p2, p1, tailRing));
pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
(p_GetComp(p2, tailRing) == 0 &&
p_MaxComp(pNext(p2),tailRing) == 0));
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
// for the time being: we know currRing==strat->tailRing
// no exp-bound checking needed
// (only needed if exp-bound(tailring)<exp-b(currRing))
if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,FALSE);
else
{
poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
assume(_p != NULL);
nc_PolyPolyRed(_p, p2,coef, currRing);
if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
PR->pLength=0; // usually not used, GetpLength re-computes it if needed
}
return 0;
}
#endif
if (t2==NULL) // Divisor is just one term, therefore it will
{ // just cancel the leading term
PR->LmDeleteAndIter();
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
return 0;
}
p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
if (tailRing != currRing)
{
// check that reduction does not violate exp bound
while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
{
// undo changes of lm
p_ExpVectorAdd(lm, p2, tailRing);
if (strat == NULL) return 2;
if (! kStratChangeTailRing(strat, PR, PW)) return -1;
tailRing = strat->tailRing;
p1 = PR->GetLmTailRing();
p2 = PW->GetLmTailRing();
t2 = pNext(p2);
lm = p1;
p_ExpVectorSub(lm, p2, tailRing);
ret = 1;
}
}
#ifdef HAVE_SHIFTBBA
poly lmRight;
if (tailRing->isLPring)
{
assume(PR->shift == 0);
assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
}
#endif
// take care of coef business
if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
{
number bn = pGetCoeff(lm);
number an = pGetCoeff(p2);
int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
p_SetCoeff(lm, bn, tailRing);
if ((ct == 0) || (ct == 2))
PR->Tail_Mult_nn(an);
if (coef != NULL) *coef = an;
else n_Delete(&an, tailRing->cf);
}
else
{
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
}
// and finally,
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
}
else
#endif
{
PR->Tail_Minus_mm_Mult_qq(lm, t2, pLength(t2) /*PW->GetpLength() - 1*/, spNoether);
}
assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
PR->LmDeleteAndIter();
#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
if (TEST_OPT_DEBUG)
{
Print(" to: "); PR->wrp(); Print("\n");
//printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
}
#endif
return ret;
}

## ksReducePolyGCD()

int ksReducePolyGCD | ( | LObject * | PR,
|  | TObject * | PW,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | kStrategy | strat = NULL )

## ksReducePolyLC()

int ksReducePolyLC | ( | LObject * | PR,
|  | TObject * | PW,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | kStrategy | strat = NULL )

Definition at line 477 of file kspoly.cc.

{
#ifdef KDEBUG
red_count++;
#ifdef TEST_OPT_DEBUG_RED
// if (TEST_OPT_DEBUG)
// {
// Print("Red %d:", red_count); PR->wrp(); Print(" with:");
// PW->wrp();
// //printf("\necart(PR)-ecart(PW): %i\n",PR->ecart-PW->ecart);
// //pWrite(PR->p);
// }
#endif
#endif
/* printf("PR->P: ");
* p_Write(PR->p, currRing, PR->tailRing); */
int ret = 0;
ring tailRing = PR->tailRing;
if (strat!=NULL)
{
kTest_L(PR,strat);
kTest_T(PW,strat);
}
poly p1 = PR->GetLmTailRing(); // p2 | p1
poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
poly lm = p1; // really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
p_CheckPolyRing(p1, tailRing);
p_CheckPolyRing(p2, tailRing);
pAssume1(p2 != NULL && p1 != NULL &&
p_DivisibleBy(p2, p1, tailRing));
pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
(p_GetComp(p2, tailRing) == 0 &&
p_MaxComp(pNext(p2),tailRing) == 0));
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
// for the time being: we know currRing==strat->tailRing
// no exp-bound checking needed
// (only needed if exp-bound(tailring)<exp-b(currRing))
if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,FALSE);
else
{
poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
assume(_p != NULL);
nc_PolyPolyRed(_p, p2,coef, currRing);
if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
PR->pLength=0; // usually not used, GetpLength re-computes it if needed
}
return 0;
}
#endif
p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
p_SetCoeff(lm, n_Init(1, tailRing->cf), tailRing);
while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
{
// undo changes of lm
p_ExpVectorAdd(lm, p2, tailRing);
if (strat == NULL) return 2;
/* if (! kStratChangeTailRing(strat, PR, PW)) return -1; */
tailRing = strat->tailRing;
p1 = PR->GetLmTailRing();
p2 = PW->GetLmTailRing();
lm = p1;
p_ExpVectorSub(lm, p2, tailRing);
ret = 1;
}
#ifdef HAVE_SHIFTBBA
poly lmRight;
if (tailRing->isLPring)
{
assume(PR->shift == 0);
assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
}
#endif
// and finally,
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(p2, lmRight, tailRing), pLength(p2), spNoether);
}
else
#endif
{
PR->Tail_Minus_mm_Mult_qq(lm, p2, pLength(p2) /*PW->GetpLength() - 1*/, spNoether);
}
assume(PW->GetpLength() == pLength(PW->p != NULL ? PW->p : PW->t_p));
PR->LmDeleteAndIter();
p_SetCoeff(PR->p, *coef, currRing);
#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
if (TEST_OPT_DEBUG)
{
Print(" to: "); PR->wrp(); Print("\n");
//printf("\nt^%i ", PR->ecart);pWrite(pHead(PR->p));
}
#endif
return ret;
}

## ksReducePolySig()

int ksReducePolySig | ( | LObject * | PR,
|  | TObject * | PW,
|  | long | idx,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | kStrategy | strat = NULL )

Definition at line 737 of file kspoly.cc.

{
#ifdef KDEBUG
red_count++;
#ifdef TEST_OPT_DEBUG_RED
if (TEST_OPT_DEBUG)
{
Print("Red %d:", red_count); PR->wrp(); Print(" with:");
PW->wrp();
}
#endif
#endif
int ret = 0;
ring tailRing = PR->tailRing;
if (strat!=NULL)
{
kTest_L(PR,strat);
kTest_T(PW,strat);
}
// signature-based stuff:
// checking for sig-safeness first
// NOTE: This has to be done in the current ring
//
/**********************************************
*
* TODO:
* --------------------------------------------
* if strat->sbaOrder == 1
* Since we are subdividing lower index and
* current index reductions it is enough to
* look at the polynomial part of the signature
* for a check. This should speed-up checking
* a lot!
* if !strat->sbaOrder == 0
* We are not subdividing lower and current index
* due to the fact that we are using the induced
* Schreyer order
*
* nevertheless, this different behaviour is
* taken care of by is_sigsafe
* => one reduction procedure can be used for
* both, the incremental and the non-incremental
* attempt!
* --------------------------------------------
*
*********************************************/
//printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
if (!PW->is_sigsafe)
{
poly sigMult = pCopy(PW->sig); // copy signature of reducer
//#if 1
#ifdef DEBUGF5
printf("IN KSREDUCEPOLYSIG: \n");
pWrite(pHead(f1));
pWrite(pHead(f2));
pWrite(sigMult);
printf("--------------\n");
#endif
p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
//#if 1
#ifdef DEBUGF5
printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
pWrite(pHead(f1));
pWrite(pHead(f2));
pWrite(sigMult);
pWrite(PR->sig);
printf("--------------\n");
#endif
int sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
// now we can delete the copied polynomial data used for checking for
// sig-safeness of the reduction step
//#if 1
#ifdef DEBUGF5
printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
#endif
//pDelete(&f1);
pDelete(&sigMult);
// go on with the computations only if the signature of p2 is greater than the
// signature of fm*p1
if(sigSafe != 1)
{
PR->is_redundant = TRUE;
return 3;
}
//PW->is_sigsafe = TRUE;
}
PR->is_redundant = FALSE;
poly p1 = PR->GetLmTailRing(); // p2 | p1
poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
p_CheckPolyRing(p1, tailRing);
p_CheckPolyRing(p2, tailRing);
pAssume1(p2 != NULL && p1 != NULL &&
p_DivisibleBy(p2, p1, tailRing));
pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
(p_GetComp(p2, tailRing) == 0 &&
p_MaxComp(pNext(p2),tailRing) == 0));
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
// for the time being: we know currRing==strat->tailRing
// no exp-bound checking needed
// (only needed if exp-bound(tailring)<exp-b(currRing))
if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,FALSE);
else
{
poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
assume(_p != NULL);
nc_PolyPolyRed(_p, p2, coef, currRing);
if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
}
return 0;
}
#endif
if (t2==NULL) // Divisor is just one term, therefore it will
{ // just cancel the leading term
PR->LmDeleteAndIter();
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
return 0;
}
p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
if (tailRing != currRing)
{
// check that reduction does not violate exp bound
while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
{
// undo changes of lm
p_ExpVectorAdd(lm, p2, tailRing);
if (strat == NULL) return 2;
if (! kStratChangeTailRing(strat, PR, PW)) return -1;
tailRing = strat->tailRing;
p1 = PR->GetLmTailRing();
p2 = PW->GetLmTailRing();
t2 = pNext(p2);
lm = p1;
p_ExpVectorSub(lm, p2, tailRing);
ret = 1;
}
}
#ifdef HAVE_SHIFTBBA
poly lmRight;
if (tailRing->isLPring)
{
assume(PR->shift == 0);
assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
}
#endif
// take care of coef business
if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
{
number bn = pGetCoeff(lm);
number an = pGetCoeff(p2);
int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
p_SetCoeff(lm, bn, tailRing);
if ((ct == 0) || (ct == 2))
PR->Tail_Mult_nn(an);
if (coef != NULL) *coef = an;
else n_Delete(&an, tailRing->cf);
}
else
{
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
}
// and finally,
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
}
else
#endif
{
PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
}
assume(PW->GetpLength() == (int)pLength(PW->p != NULL ? PW->p : PW->t_p));
PR->LmDeleteAndIter();
#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
if (TEST_OPT_DEBUG)
{
Print(" to: "); PR->wrp(); Print("\n");
}
#endif
return ret;
}
p_ExpVectorAddSub
static void p_ExpVectorAddSub(poly p1, poly p2, poly p3, const ring r)
Definition p_polys.h:1477

## ksReducePolySigRing()

int ksReducePolySigRing | ( | LObject * | PR,
|  | TObject * | PW,
|  | long | idx,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | kStrategy | strat = NULL )

Definition at line 943 of file kspoly.cc.

{
#ifdef KDEBUG
red_count++;
#ifdef TEST_OPT_DEBUG_RED
if (TEST_OPT_DEBUG)
{
Print("Red %d:", red_count); PR->wrp(); Print(" with:");
PW->wrp();
}
#endif
#endif
int ret = 0;
ring tailRing = PR->tailRing;
if (strat!=NULL)
{
kTest_L(PR,strat);
kTest_T(PW,strat);
}
// signature-based stuff:
// checking for sig-safeness first
// NOTE: This has to be done in the current ring
//
/**********************************************
*
* TODO:
* --------------------------------------------
* if strat->sbaOrder == 1
* Since we are subdividing lower index and
* current index reductions it is enough to
* look at the polynomial part of the signature
* for a check. This should speed-up checking
* a lot!
* if !strat->sbaOrder == 0
* We are not subdividing lower and current index
* due to the fact that we are using the induced
* Schreyer order
*
* nevertheless, this different behaviour is
* taken care of by is_sigsafe
* => one reduction procedure can be used for
* both, the incremental and the non-incremental
* attempt!
* --------------------------------------------
*
*********************************************/
//printf("COMPARE IDX: %ld -- %ld\n",idx,strat->currIdx);
if (!PW->is_sigsafe)
{
poly sigMult = pCopy(PW->sig); // copy signature of reducer
//#if 1
#ifdef DEBUGF5
printf("IN KSREDUCEPOLYSIG: \n");
pWrite(pHead(f1));
pWrite(pHead(f2));
pWrite(sigMult);
printf("--------------\n");
#endif
p_ExpVectorAddSub(sigMult,PR->GetLmCurrRing(),PW->GetLmCurrRing(),currRing);
//I have also to set the leading coefficient for sigMult (in the case of rings)
if(rField_is_Ring(currRing))
{
pSetCoeff(sigMult,nMult(nDiv(pGetCoeff(PR->p),pGetCoeff(PW->p)), pGetCoeff(sigMult)));
if(nIsZero(pGetCoeff(sigMult)))
{
sigMult = NULL;
}
}
//#if 1
#ifdef DEBUGF5
printf("------------------- IN KSREDUCEPOLYSIG: --------------------\n");
pWrite(pHead(f1));
pWrite(pHead(f2));
pWrite(sigMult);
pWrite(PR->sig);
printf("--------------\n");
#endif
int sigSafe;
if(!rField_is_Ring(currRing))
sigSafe = p_LmCmp(PR->sig,sigMult,currRing);
// now we can delete the copied polynomial data used for checking for
// sig-safeness of the reduction step
//#if 1
#ifdef DEBUGF5
printf("%d -- %d sig\n",sigSafe,PW->is_sigsafe);
#endif
if(rField_is_Ring(currRing))
{
// Set the sig
poly origsig = pCopy(PR->sig);
if(sigMult != NULL)
PR->sig = pHead(pSub(PR->sig, sigMult));
//The sigs have the same lm, have to subtract
//It may happen that now the signature is 0 (drop)
if(PR->sig == NULL)
{
strat->sigdrop=TRUE;
}
else
{
if(pLtCmp(PR->sig,origsig) == 1)
{
// do not allow this reduction - it will increase it's signature
// and the partially standard basis is just till the old sig, not the new one
PR->is_redundant = TRUE;
pDelete(&PR->sig);
PR->sig = origsig;
strat->blockred++;
return 3;
}
if(pLtCmp(PR->sig,origsig) == -1)
{
strat->sigdrop=TRUE;
}
}
pDelete(&origsig);
}
//pDelete(&f1);
// go on with the computations only if the signature of p2 is greater than the
// signature of fm*p1
if(sigSafe != 1 && !rField_is_Ring(currRing))
{
PR->is_redundant = TRUE;
return 3;
}
//PW->is_sigsafe = TRUE;
}
PR->is_redundant = FALSE;
poly p1 = PR->GetLmTailRing(); // p2 | p1
poly p2 = PW->GetLmTailRing(); // i.e. will reduce p1 with p2; lm = LT(p1) / LM(p2)
poly t2 = pNext(p2), lm = p1; // t2 = p2 - LT(p2); really compute P = LC(p2)*p1 - LT(p1)/LM(p2)*p2
assume(p1 != NULL && p2 != NULL);// Attention, we have rings and there LC(p2) and LC(p1) are special
p_CheckPolyRing(p1, tailRing);
p_CheckPolyRing(p2, tailRing);
pAssume1(p2 != NULL && p1 != NULL &&
p_DivisibleBy(p2, p1, tailRing));
pAssume1(p_GetComp(p1, tailRing) == p_GetComp(p2, tailRing) ||
(p_GetComp(p2, tailRing) == 0 &&
p_MaxComp(pNext(p2),tailRing) == 0));
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
// for the time being: we know currRing==strat->tailRing
// no exp-bound checking needed
// (only needed if exp-bound(tailring)<exp-b(currRing))
if (PR->bucket!=NULL) nc_kBucketPolyRed_Z(PR->bucket, p2,coef,FALSE);
else
{
poly _p = (PR->t_p != NULL ? PR->t_p : PR->p);
assume(_p != NULL);
nc_PolyPolyRed(_p, p2, coef, currRing);
if (PR->t_p!=NULL) PR->t_p=_p; else PR->p=_p;
PR->pLength=0; // usaully not used, GetpLength re-comoutes it if needed
}
return 0;
}
#endif
if (t2==NULL) // Divisor is just one term, therefore it will
{ // just cancel the leading term
PR->LmDeleteAndIter();
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
return 0;
}
p_ExpVectorSub(lm, p2, tailRing); // Calculate the Monomial we must multiply to p2
if (tailRing != currRing)
{
// check that reduction does not violate exp bound
while (PW->max_exp != NULL && !p_LmExpVectorAddIsOk(lm, PW->max_exp, tailRing))
{
// undo changes of lm
p_ExpVectorAdd(lm, p2, tailRing);
if (strat == NULL) return 2;
if (! kStratChangeTailRing(strat, PR, PW)) return -1;
tailRing = strat->tailRing;
p1 = PR->GetLmTailRing();
p2 = PW->GetLmTailRing();
t2 = pNext(p2);
lm = p1;
p_ExpVectorSub(lm, p2, tailRing);
ret = 1;
}
}
#ifdef HAVE_SHIFTBBA
poly lmRight;
if (tailRing->isLPring)
{
assume(PR->shift == 0);
assume(PW->shift == si_max(p_mFirstVblock(PW->p, tailRing) - 1, 0));
k_SplitFrame(lm, lmRight, PW->shift + 1, tailRing);
}
#endif
// take care of coef business
if(rField_is_Ring(currRing))
{
p_SetCoeff(lm, nDiv(pGetCoeff(lm),pGetCoeff(p2)), tailRing);
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
}
else
{
if (! n_IsOne(pGetCoeff(p2), tailRing->cf))
{
number bn = pGetCoeff(lm);
number an = pGetCoeff(p2);
int ct = ksCheckCoeff(&an, &bn, tailRing->cf); // Calculate special LC
p_SetCoeff(lm, bn, tailRing);
if (((ct == 0) || (ct == 2)))
PR->Tail_Mult_nn(an);
if (coef != NULL) *coef = an;
else n_Delete(&an, tailRing->cf);
}
else
{
if (coef != NULL) *coef = n_Init(1, tailRing->cf);
}
}
// and finally,
#ifdef HAVE_SHIFTBBA
if (tailRing->isLPring)
{
PR->Tail_Minus_mm_Mult_qq(lm, tailRing->p_Procs->pp_Mult_mm(t2, lmRight, tailRing), pLength(t2), spNoether);
}
else
#endif
{
PR->Tail_Minus_mm_Mult_qq(lm, t2, PW->GetpLength() - 1, spNoether);
}
assume(PW->GetpLength() == (int)pLength(PW->p != NULL ? PW->p : PW->t_p));
PR->LmDeleteAndIter();
#if defined(KDEBUG) && defined(TEST_OPT_DEBUG_RED)
if (TEST_OPT_DEBUG)
{
Print(" to: "); PR->wrp(); Print("\n");
}
#endif
return ret;
}
skStrategy::blockred
int blockred
Definition kutil.h:362
nDiv
#define nDiv(a, b)
Definition numbers.h:32
pSub
#define pSub(a, b)
Definition polys.h:288

## ksReducePolyTail() [1/2]

KINLINE int ksReducePolyTail | ( | LObject * | PR,
|  | TObject * | PW,
|  | LObject * | Red )

Definition at line 1147 of file kInline.h.

{
BOOLEAN ret;
number coef;
assume(PR->GetLmCurrRing() != PW->GetLmCurrRing());
Red->HeadNormalize();
ret = ksReducePoly(Red, PW, NULL, &coef);
if (!ret)
{
if (! n_IsOne(coef, currRing->cf))
{
PR->Mult_nn(coef);
// HANNES: mark for Normalize
}
n_Delete(&coef, currRing->cf);
}
return ret;
}

## ksReducePolyTail() [2/2]

int ksReducePolyTail | ( | LObject * | PR,
|  | TObject * | PW,
|  | poly | Current,
|  | poly | spNoether = NULL )

Definition at line 1350 of file kspoly.cc.

{
BOOLEAN ret;
number coef;
poly Lp = PR->GetLmCurrRing();
poly Save = PW->GetLmCurrRing();
pAssume(pIsMonomOf(Lp, Current));
assume(Lp != NULL && Current != NULL && pNext(Current) != NULL);
assume(PR->bucket == NULL);
LObject Red(pNext(Current), PR->tailRing);
TObject With(PW, Lp == Save);
pAssume(!pHaveCommonMonoms(Red.p, With.p));
ret = ksReducePoly(&Red, &With, spNoether, &coef);
if (!ret)
{
if (! n_IsOne(coef, currRing->cf))
{
pNext(Current) = NULL;
if (Current == PR->p && PR->t_p != NULL)
pNext(PR->t_p) = NULL;
PR->Mult_nn(coef);
}
n_Delete(&coef, currRing->cf);
pNext(Current) = Red.GetLmTailRing();
if (Current == PR->p && PR->t_p != NULL)
pNext(PR->t_p) = pNext(Current);
}
if (Lp == Save)
With.Delete();
return ret;
}
pIsMonomOf
BOOLEAN pIsMonomOf(poly p, poly m)
Definition pDebug.cc:164
pHaveCommonMonoms
BOOLEAN pHaveCommonMonoms(poly p, poly q)
Definition pDebug.cc:174

## ksReducePolyZ()

int ksReducePolyZ | ( | LObject * | PR,
|  | TObject * | PW,
|  | poly | spNoether = NULL,
|  | number * | coef = NULL,
|  | kStrategy | strat = NULL )

## kStratChangeTailRing()

BOOLEAN kStratChangeTailRing | ( | kStrategy | strat,
|  | LObject * | L = NULL,
|  | TObject * | T = NULL,
|  | unsigned long | new_expbound = 0 )

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::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);
}
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 = FALSE,
|  | int | lpos = -1,
|  | TSet | T = NULL,
|  | int | tlength = -1 )

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
kFindInTShift
int kFindInTShift(poly p, TSet T, int tlength)
Definition kutil.cc:728
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_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 | tpos = -1,
|  | 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;
}
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

## 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;
}

## kTestDivisibleByT0_Z()

int kTestDivisibleByT0_Z | ( | const kStrategy | strat,
|  | const LObject * | L )

tests if T[0] divides the leading monomial of L, returns -1 if not

Definition at line 142 of file kstd2.cc.

{
if (strat->tl < 1)
return -1;
unsigned long not_sev = ~L->sev;
const unsigned long sevT0 = strat->sevT[0];
number orest,rest,mult;
if (L->p!=NULL)
{
const poly T0p = strat->T[0].p;
const ring r = currRing;
const poly p = L->p;
orest = pGetCoeff(p);
pAssume(~not_sev == p_GetShortExpVector(p, r));
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(T0p, sevT0, p, not_sev, r))
#else
if (!(sevT0 & not_sev) && p_LmDivisibleBy(T0p, p, r))
#endif
{
if (n_QuotRem!=ndQuotRem) /*euclidean ring*/
{
mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T0p), &rest, r->cf);
if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
{
n_Delete(&mult,r->cf);
n_Delete(&rest,r->cf);
return 0;
}
n_Delete(&mult,r->cf);
n_Delete(&rest,r->cf);
}
}
}
else
{
const poly T0p = strat->T[0].t_p;
const ring r = strat->tailRing;
const poly p = L->t_p;
orest = pGetCoeff(p);
#if defined(PDEBUG) || defined(PDIV_DEBUG)
if (p_LmShortDivisibleBy(T0p, sevT0,
p, not_sev, r))
#else
if (!(sevT0 & not_sev) && p_LmDivisibleBy(T0p, p, r))
#endif
{
if (n_QuotRem!=ndQuotRem) /*euclidean ring*/
{
mult= n_QuotRem(pGetCoeff(p), pGetCoeff(T0p), &rest, r->cf);
if (!n_IsZero(mult, r->cf) && n_Greater(n_EucNorm(orest, r->cf), n_EucNorm(rest, r->cf), r->cf))
{
n_Delete(&mult,r->cf);
n_Delete(&rest,r->cf);
return 0;
}
n_Delete(&mult,r->cf);
n_Delete(&rest,r->cf);
}
}
}
return -1;
}
ndQuotRem
number ndQuotRem(number a, number b, number *r, const coeffs R)
Definition numbers.cc:356

## 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
pGetExp
#define pGetExp(p, i)
Exponent.
Definition polys.h:42

## pairs()

void pairs | ( |  | ) |

## posInIdealMonFirst()

int posInIdealMonFirst | ( | const ideal | F,
|  | const poly | p,
|  | int | start = 0,
|  | int | end = -1 )

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 * | L,
|  | 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 */
}
}

## posInL10()

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

Definition at line 1360 of file kstd1.cc.

{
int j,dp,dL;
if (length<0) return 0;
if (hasPurePower(p,strat->lastAxis,&dp,strat))
{
int op= p->GetpFDeg() +p->ecart;
for (j=length; j>=0; j--)
{
if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat))
return j+1;
if (dp < dL)
return j+1;
if ((dp == dL)
&& (set[j].GetpFDeg()+set[j].ecart >= op))
return j+1;
}
}
j=length;
loop
{
if (j<0) break;
if (!hasPurePower(&(set[j]),strat->lastAxis,&dL,strat)) break;
j--;
}
return strat->posInLOld(set,j,p,strat);
}
hasPurePower
static BOOLEAN hasPurePower(const poly p, int last, int *length, kStrategy strat)
Definition kstd1.cc:1312

## posInL10Ring()

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

## posInL11()

int posInL11 | ( | const LSet | set,
|  | const int | length,
|  | LObject * | L,
|  | 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 * | L,
|  | 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;
}
}

## posInL11Ring()

int posInL11Ring | ( | const LSet | set,
|  | const int | length,
|  | LObject * | L,
|  | 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;
}
}
pLtCmpOrdSgnDiffM
#define pLtCmpOrdSgnDiffM(p, q)
Definition polys.h:126

## posInL11Ringls()

int posInL11Ringls | ( | const LSet | set,
|  | const int | length,
|  | LObject * | L,
|  | 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 * | L,
|  | 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 * | L,
|  | 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 * | L,
|  | 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 * | L,
|  | 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;
}
}

## posInLF5CRing()

int posInLF5CRing | ( | const LSet | set,
|  | int | start,
|  | const int | length,
|  | LObject * | L,
|  | 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 * | L,
|  | 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 * | L,
|  | 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;
}
}
}
}

## 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,
|  | const 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;
}
}

## 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;
}
}

## 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;
}
}

## 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;
}
}

## posInTSig()

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

## 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 | ( | ideal | F,
|  | 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
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

## redEcart()

int redEcart | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 168 of file kstd1.cc.

{
int i,at,ei,li,ii;
int j = 0;
int pass = 0;
long d,reddeg;
d = h->GetpFDeg()+ h->ecart;
reddeg = strat->LazyDegree+d;
h->SetShortExpVector();
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0)
{
if (strat->honey) h->SetLength(strat->length_pLength);
return 1;
}
ei = strat->T[j].ecart;
ii = j;
if (ei > h->ecart)
{
unsigned long not_sev=~h->sev;
poly h_t= h->GetLmTailRing();
li = strat->T[j].length;
if (li<=0) li=strat->T[j].GetpLength();
// the polynomial to reduce with (up to the moment) is;
// pi with ecart ei and length li
// look for one with smaller ecart
i = j;
loop
{
/*- takes the first possible with respect to ecart -*/
i++;
if (i > strat->tl) break;
#if 1
if (strat->T[i].length<=0) strat->T[i].GetpLength();
if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
strat->T[i].length < li))
&&
p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h_t, not_sev, strat->tailRing))
#else
j = kFindDivisibleByInT(strat, h, i);
if (j < 0) break;
i = j;
if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
strat->T[i].length < li))
#endif
{
// the polynomial to reduce with is now
ii = i;
ei = strat->T[i].ecart;
if (ei <= h->ecart) break;
li = strat->T[i].length;
}
}
}
// end of search: have to reduce with pi
if ((ei > h->ecart)&&(strat->kNoether==NULL))
{
// It is not possible to reduce h with smaller ecart;
// if possible h goes to the lazy-set L,i.e
// if its position in L would be not the last one
strat->fromT = TRUE;
if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
{
h->SetLmCurrRing();
if (strat->honey && strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
assume(h->FDeg == h->pFDeg());
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
/*- h will not become the next element to reduce -*/
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
#endif
h->Clear();
strat->fromT = FALSE;
return -1;
}
}
}
// now we finally can reduce
doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
strat->fromT=FALSE;
// are we done ???
if (h->IsNull())
{
assume(!rField_is_Ring(currRing));
kDeleteLcm(h);
h->Clear();
return 0;
}
if (TEST_OPT_IDLIFT)
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
}
#if 0
else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
return 1;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
return 1;
}
}
}
#endif
// done ? NO!
h->SetShortExpVector();
h->SetpFDeg();
if (strat->honey)
{
if (ei <= h->ecart)
h->ecart = d-h->GetpFDeg();
else
h->ecart = d-h->GetpFDeg()+ei-h->ecart;
}
else
// this has the side effect of setting h->length
h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
#if 0
if (strat->syzComp!=0)
{
if ((strat->syzComp>0) && (h->Comp() > strat->syzComp))
{
assume(h->MinComp() > strat->syzComp);
if (strat->honey) h->SetLength();
#ifdef KDEBUG
if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
#endif
return -2;
}
}
#endif
/*- try to reduce the s-polynomial -*/
pass++;
d = h->GetpFDeg()+h->ecart;
/*
*test whether the polynomial should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
&& ((d >= reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
if (strat->honey && strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
assume(h->FDeg == h->pFDeg());
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
{
if (strat->honey && !strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
return 1;
}
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
#endif
h->Clear();
return -1;
}
}
else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
{
Print(".%ld",d);mflush();
reddeg = d+1;
if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
}
}
skStrategy::length_pLength
char length_pLength
Definition kutil.h:384
doRed
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition kstd1.cc:118
kFindDivisibleByInS
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
Definition kstd2.cc:464
TEST_OPT_REDTHROUGH
#define TEST_OPT_REDTHROUGH
Definition options.h:124
TEST_OPT_REDTAIL_SYZ
#define TEST_OPT_REDTAIL_SYZ
Definition options.h:119

## redFirst()

int redFirst | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 794 of file kstd1.cc.

{
if (strat->tl<0) return 1;
if (h->IsNull()) return 0;
int at;
long reddeg,d;
int pass = 0;
int cnt = RED_CANONICALIZE;
int j = 0;
reddeg = d = h->GetpFDeg();
if (! strat->homog)
{
d += h->ecart;
reddeg = strat->LazyDegree+d;
}
h->SetShortExpVector();
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0)
{
h->SetDegStuffReturnLDeg(strat->LDegLast);
return 1;
}
if (!TEST_OPT_INTSTRATEGY)
strat->T[j].pNorm();
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("reduce ");
h->wrp();
PrintS(" with ");
strat->T[j].wrp();
}
#endif
ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, NULL, strat);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS(" to ");
wrp(h->p);
PrintLn();
}
#endif
if (h->IsNull())
{
assume(!rField_is_Ring(currRing));
kDeleteLcm(h);
h->Clear();
return 0;
}
if (TEST_OPT_IDLIFT)
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
}
#if 0
else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
return 1;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
return 1;
}
}
}
#endif
h->SetShortExpVector();
#if 0
if ((strat->syzComp!=0) && !strat->honey)
{
if ((strat->syzComp>0) &&
(h->Comp() > strat->syzComp))
{
assume(h->MinComp() > strat->syzComp);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
#endif
if (strat->homog)
h->SetDegStuffReturnLDeg(strat->LDegLast);
return -2;
}
}
#endif
if (!strat->homog)
{
if (!TEST_OPT_OLDSTD && strat->honey)
{
h->SetpFDeg();
if (strat->T[j].ecart <= h->ecart)
h->ecart = d - h->GetpFDeg();
else
h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
d = h->GetpFDeg() + h->ecart;
}
else
d = h->SetDegStuffReturnLDeg(strat->LDegLast);
/*- try to reduce the s-polynomial -*/
cnt--;
pass++;
/*
*test whether the polynomial should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
&& ((d >= reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
if (strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat,&dummy, h) < 0)
return 1;
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
#endif
h->Clear();
return -1;
}
}
if (UNLIKELY(cnt==0))
{
h->CanonicalizeP();
cnt=RED_CANONICALIZE;
//if (TEST_OPT_PROT) { PrintS("!");mflush(); }
}
if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
{
reddeg = d+1;
Print(".%ld",d);mflush();
if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
}
}
}
UNLIKELY
#define UNLIKELY(X)
Definition auxiliary.h:405
RED_CANONICALIZE
#define RED_CANONICALIZE
Definition kutil.h:37

## redFirstShift()

int redFirstShift | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 4951 of file kstd2.cc.

{
if (h->IsNull()) return 0;
int at, reddeg,d;
int pass = 0;
int j = 0;
if (! strat->homog)
{
d = h->GetpFDeg() + h->ecart;
reddeg = strat->LazyDegree+d;
}
h->SetShortExpVector();
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0)
{
h->SetDegStuffReturnLDeg(strat->LDegLast);
return 1;
}
if (!TEST_OPT_INTSTRATEGY)
strat->T[j].pNorm();
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("reduce ");
h->wrp();
PrintS(" with ");
strat->T[j].wrp();
}
#endif
ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, NULL, strat);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto ");
wrp(h->p);
PrintLn();
}
#endif
if (h->IsNull())
{
kDeleteLcm(h);
h->Clear();
return 0;
}
h->SetShortExpVector();
#if 0
if ((strat->syzComp!=0) && !strat->honey)
{
if ((strat->syzComp>0) &&
(h->Comp() > strat->syzComp))
{
assume(h->MinComp() > strat->syzComp);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
#endif
if (strat->homog)
h->SetDegStuffReturnLDeg(strat->LDegLast);
return -2;
}
}
#endif
if (!strat->homog)
{
if (!TEST_OPT_OLDSTD && strat->honey)
{
h->SetpFDeg();
if (strat->T[j].ecart <= h->ecart)
h->ecart = d - h->GetpFDeg();
else
h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
d = h->GetpFDeg() + h->ecart;
}
else
d = h->SetDegStuffReturnLDeg(strat->LDegLast);
/*- try to reduce the s-polynomial -*/
pass++;
/*
*test whether the polynomial should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
&& ((d >= reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
if (strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
//int dummy=strat->sl;
/* if (kFindDivisibleByInS(strat,&dummy, h) < 0) */
//if (kFindDivisibleByInT(strat->T,strat->sevT, dummy, h) < 0)
if (kFindDivisibleByInT(strat, h) < 0)
return 1;
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
#endif
h->Clear();
return -1;
}
}
if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
{
reddeg = d+1;
Print(".%d",d);mflush();
}
}
}
}

## redHomog()

int redHomog | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 1150 of file kstd2.cc.

{
if (strat->tl<0) return 1;
//if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
assume(h->FDeg == h->pFDeg());
poly h_p;
int i,j,at,pass,cnt,ii;
// long reddeg,d;
int li;
BOOLEAN test_opt_length=TEST_OPT_LENGTH;
pass = j = 0;
cnt = RED_CANONICALIZE;
h->SetShortExpVector();
h_p = h->GetLmTailRing();
h->PrepareRed(strat->use_buckets);
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0) return 1;
li = strat->T[j].pLength;
ii = j;
/*
* the polynomial to reduce with (up to the moment) is;
* pi with length li
*/
i = j;
#if 1
if (test_opt_length)
{
if (li<=0) li=strat->T[j].GetpLength();
if (li>2)
{
unsigned long not_sev = ~ h->sev;
loop
{
/*- search the shortest possible with respect to length -*/
i++;
if (i > strat->tl)
break;
if ((strat->T[i].pLength < li)
&&
p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
h_p, not_sev, strat->tailRing))
{
/*
* the polynomial to reduce with is now;
*/
li = strat->T[i].pLength;
if (li<=0) li=strat->T[i].GetpLength();
ii = i;
if (li<3) break;
}
}
}
}
#endif
/*
* end of search: have to reduce with pi
*/
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
h->wrp();
PrintS(" with ");
strat->T[ii].wrp();
}
#endif
assume(strat->fromT == FALSE);
ksReducePoly(h, &(strat->T[ii]), NULL, NULL, NULL, strat);
#if SBA_PRINT_REDUCTION_STEPS
sba_interreduction_steps++;
#endif
#if SBA_PRINT_OPERATIONS
sba_interreduction_operations += pLength(strat->T[ii].p);
#endif
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto ");
h->wrp();
PrintLn();
}
#endif
h_p = h->GetLmTailRing();
if (h_p == NULL)
{
kDeleteLcm(h);
return 0;
}
if (UNLIKELY(TEST_OPT_IDLIFT))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
else //if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
}
#if 0
else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
return 1;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
return 1;
}
}
}
#endif
h->SetShortExpVector();
/*
* try to reduce the s-polynomial h
*test first whether h should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
cnt--;
pass++;
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
{
h->SetLmCurrRing();
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
{
if (kFindDivisibleByInT(strat, h) < 0)
return 1;
}
else
#endif
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
return 1;
}
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
Print(" lazy: -> L%d\n",at);
#endif
h->Clear();
return -1;
}
}
else if (UNLIKELY(cnt==0))
{
h->CanonicalizeP();
cnt=RED_CANONICALIZE;
//if (TEST_OPT_PROT) { PrintS("!");mflush(); }
}
}
}

## redHoney()

int redHoney | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 2110 of file kstd2.cc.

{
if (strat->tl<0) return 1;
//if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
assume(h->FDeg == h->pFDeg());
int j,at,pass,ei, ii, h_d;
long reddeg,d;
pass = j = 0;
d = reddeg = h->GetpFDeg() + h->ecart;
h->SetShortExpVector();
h->PrepareRed(strat->use_buckets);
loop
{
j=kFindDivisibleByInT_ecart(strat, h, h->ecart);
if (j < 0) return 1;
ii = j;
ei = strat->T[ii].ecart;
/*
* the polynomial to reduce with (up to the moment) is;
* pi with ecart ei (T[ii])
*/
/*
* end of search: have to reduce with pi
*/
if (UNLIKELY(!TEST_OPT_REDTHROUGH && (pass!=0) && (ei > h->ecart)))
{
h->GetTP(); // clears bucket
h->SetLmCurrRing();
/*
* It is not possible to reduce h with smaller ecart;
* if possible h goes to the lazy-set L,i.e
* if its position in L would be not the last one
*/
if (strat->Ll >= 0) /* L is not empty */
{
at = strat->posInL(strat->L,strat->Ll,h,strat);
if(at <= strat->Ll)
/*- h will not become the next element to reduce -*/
{
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" ecart too big: -> L%d\n",at);
#endif
h->Clear();
return -1;
}
}
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
h->wrp();
Print("\nwith T[%d]:",ii);
strat->T[ii].wrp();
}
#endif
assume(strat->fromT == FALSE);
ksReducePoly(h,&(strat->T[ii]),strat->kNoetherTail(),NULL,NULL, strat);
#if SBA_PRINT_REDUCTION_STEPS
sba_interreduction_steps++;
#endif
#if SBA_PRINT_OPERATIONS
sba_interreduction_operations += strat->T[ii].pLength;
#endif
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto:");
h->wrp();
PrintLn();
}
#endif
if(h->IsNull())
{
kDeleteLcm(h);
h->Clear();
return 0;
}
if (UNLIKELY(TEST_OPT_IDLIFT))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
else //if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
}
else
if (UNLIKELY((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ)))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
return 1;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
return 1;
}
}
}
h->SetShortExpVector();
h_d = h->SetpFDeg();
/* compute the ecart */
if (ei <= h->ecart)
h->ecart = d-h_d;
else
h->ecart = d-h_d+ei-h->ecart;
/*
* try to reduce the s-polynomial h
*test first whether h should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
pass++;
d = h_d + h->ecart;
if (UNLIKELY(!TEST_OPT_REDTHROUGH
&& (strat->Ll >= 0)
&& ((d > reddeg) || (pass > strat->LazyPass))))
{
h->GetTP(); // clear bucket
h->SetLmCurrRing();
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
{
if (kFindDivisibleByInT(strat, h) < 0)
return 1;
}
else
#endif
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
return 1;
}
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
Print(" degree jumped: -> L%d\n",at);
#endif
h->Clear();
return -1;
}
}
else if (d > reddeg)
{
if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
{
if (h->pTotalDeg()+h->ecart >= (long)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redHoney d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
else if (UNLIKELY(TEST_OPT_PROT && (strat->Ll < 0) ))
{
//h->wrp(); Print("<%d>\n",h->GetpLength());
reddeg = d;
Print(".%ld",d); mflush();
}
}
}
}
kFindDivisibleByInT_ecart
int kFindDivisibleByInT_ecart(const kStrategy strat, const LObject *L, const int ecart)
Definition kstd2.cc:416

## redHoneyM()

int redHoneyM | ( | LObject * | h,
|  | kStrategy | strat )

## redLazy()

int redLazy | ( | LObject * | h,
|  | kStrategy | strat )

TEST_OPT_REDTHROUGH &&

Definition at line 1905 of file kstd2.cc.

{
if (strat->tl<0) return 1;
int at,i,ii,li;
int j = 0;
int pass = 0;
int cnt = RED_CANONICALIZE;
assume(h->pFDeg() == h->FDeg);
long reddeg = h->GetpFDeg();
long d;
BOOLEAN test_opt_length=TEST_OPT_LENGTH;
h->SetShortExpVector();
poly h_p = h->GetLmTailRing();
h->PrepareRed(strat->use_buckets);
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0) return 1;
li = strat->T[j].pLength;
ii = j;
/*
* the polynomial to reduce with (up to the moment) is;
* pi with length li
*/
i = j;
#if 1
if (test_opt_length)
{
if (li<=0) li=strat->T[j].GetpLength();
if(li>2)
{
unsigned long not_sev = ~ h->sev;
loop
{
/*- search the shortest possible with respect to length -*/
i++;
if (i > strat->tl)
break;
if ((strat->T[i].pLength < li)
&&
p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
h_p, not_sev, strat->tailRing))
{
/*
* the polynomial to reduce with is now;
*/
li = strat->T[i].pLength;
if (li<=0) li=strat->T[i].GetpLength();
ii = i;
if (li<3) break;
}
}
}
}
#endif
/*
* end of search: have to reduce with pi
*/
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
h->wrp();
PrintS(" with ");
strat->T[ii].wrp();
}
#endif
ksReducePoly(h, &(strat->T[ii]), NULL, NULL, NULL, strat);
#if SBA_PRINT_REDUCTION_STEPS
sba_interreduction_steps++;
#endif
#if SBA_PRINT_OPERATIONS
sba_interreduction_operations += pLength(strat->T[ii].p);
#endif
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto ");
h->wrp();
PrintLn();
}
#endif
h_p=h->GetLmTailRing();
if (h_p == NULL)
{
kDeleteLcm(h);
return 0;
}
if (UNLIKELY(TEST_OPT_IDLIFT))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
else //if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
h->Delete();
return 0;
}
}
}
#if 0
else if ((strat->syzComp > 0)&&(!TEST_OPT_REDTAIL_SYZ))
{
if (h->p!=NULL)
{
if(p_GetComp(h->p,currRing)>strat->syzComp)
{
return 1;
}
}
else // if (h->t_p!=NULL)
{
if(p_GetComp(h->t_p,strat->tailRing)>strat->syzComp)
{
return 1;
}
}
}
#endif
h->SetShortExpVector();
d = h->SetpFDeg();
/*- try to reduce the s-polynomial -*/
cnt--;
pass++;
if (//!TEST_OPT_REDTHROUGH &&
(strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
#if 1
#ifdef HAVE_SHIFTBBA
if (rIsLPRing(currRing))
{
if (kFindDivisibleByInT(strat, h) < 0)
return 1;
}
else
#endif
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
return 1;
}
#endif
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
#endif
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
else if (d != reddeg)
{
if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
{
if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redLazy d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
else if ((TEST_OPT_PROT) && (strat->Ll < 0))
{
Print(".%ld",d);mflush();
reddeg = d;
}
}
else if (UNLIKELY(cnt==0))
{
h->CanonicalizeP();
cnt=RED_CANONICALIZE;
//if (TEST_OPT_PROT) { PrintS("!");mflush(); }
}
}
}

## redLiftstd()

int redLiftstd | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 167 of file kLiftstd.cc.

{
if (strat->tl<0) return 1;
assume(h->FDeg == h->pFDeg());
assume(TEST_OPT_IDLIFT);
poly h_p;
int i,j,pass,ei, ii, h_d,ci;
unsigned long not_sev;
long reddeg,d;
#define START_REDUCE 512
int red_size=START_REDUCE;
number *A=(number*)omAlloc0(red_size*sizeof(number));
poly *C=(poly*)omAlloc0(red_size*sizeof(poly));
poly *T=(poly*)omAlloc0(red_size*sizeof(poly));
const ring tailRing=strat->tailRing;
pass = j = 0;
d = reddeg = h->GetpFDeg() + h->ecart;
h->SetShortExpVector();
int li;
h_p = h->GetLmTailRing();
not_sev = ~ h->sev;
// split h into main part (h) and tail (h_tail)
poly h_tail=kSplitAt(strat->syzComp,h,strat);
// fix h-pLength
h->pLength=0;
h->PrepareRed(strat->use_buckets);
loop
{
j=kFindDivisibleByInT(strat, h);
if (j < 0)
{
// lazy computation:
int l;
poly p=lazyComp(A,C,T,pass,h_tail,&l,strat->tailRing);
kBucket_Add_q(h->bucket,p,&l);
omFreeSize(A,red_size*sizeof(number));
omFreeSize(T,red_size*sizeof(poly));
omFreeSize(C,red_size*sizeof(poly));
return 1;
}
ei = strat->T[j].ecart;
li = strat->T[j].pLength;
ci = nSize(pGetCoeff(strat->T[j].p));
ii = j;
/*
* the polynomial to reduce with (up to the moment) is;
* pi with ecart ei (T[ii])
*/
i = j;
if (TEST_OPT_LENGTH)
{
if (li<=0) li=strat->T[j].GetpLength();
if (li>1)
loop
{
/*- possible with respect to ecart, minimal nSize -*/
i++;
if (i > strat->tl)
break;
//if (ei < h->ecart)
// break;
if ((((strat->T[i].ecart < ei) && (ei> h->ecart))
|| ((strat->T[i].ecart <= h->ecart)
&& (strat->T[i].pLength <= li)
&& (nSize(pGetCoeff(strat->T[i].p)) <ci)))
&&
p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
h_p, not_sev, tailRing))
{
/*
* the polynomial to reduce with is now;
*/
ei = strat->T[i].ecart;
li = strat->T[i].pLength;
if (li<=0) li=strat->T[i].GetpLength();
ii = i;
if (li==1) break;
}
}
}
/*
* end of search: have to reduce with pi
*/
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
h->wrp();
Print("\nwith T[%d]:",ii);
strat->T[ii].wrp();
}
#endif
assume(strat->fromT == FALSE);
//strat->T[ii].pCleardenom();
// split T[ii]:
// remember pLength of strat->T[ii]
int l_orig=strat->T[ii].pLength;
// split strat->T[ii]
poly T_tail=kSplitAt(strat->syzComp,&strat->T[ii],strat);
h->pLength=0; // force re-computation of length
ksReducePoly(h,&(strat->T[ii]),NULL,&A[pass],&C[pass], strat);
// restore T[ii]:
kAppend(T_tail,&strat->T[ii]);
strat->T[ii].pLength=l_orig;
// store T_tail
T[pass]=T_tail;
// delayed computation: A[pass]*tail-M[pass]*T[pass]
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto:");
h->wrp();
PrintLn();
}
#endif
if(h->IsNull())
{
// clean up A,C,h_tail:
for(int i=0;i<=pass;i++)
{
n_Delete(&A[i],tailRing->cf);
p_Delete(&C[i],tailRing);
}
p_Delete(&h_tail,tailRing);
kDeleteLcm(h);
h->Clear();
omFreeSize(A,red_size*sizeof(number));
omFreeSize(T,red_size*sizeof(poly));
omFreeSize(C,red_size*sizeof(poly));
return 0;
}
h->SetShortExpVector();
not_sev = ~ h->sev;
h_d = h->SetpFDeg();
/* compute the ecart */
if (ei <= h->ecart)
h->ecart = d-h_d;
else
h->ecart = d-h_d+ei-h->ecart;
/*
* try to reduce the s-polynomial h
*test first whether h should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
pass++;
d = h_d + h->ecart;
if (pass%RED_CANONICALIZE==0) kBucketCanonicalize(h->bucket);
// if cache is to small, double its size:
if (pass>=red_size-1)
{
A=(number*)omRealloc0Size(A,red_size*sizeof(number),2*red_size*sizeof(number));
C=(poly*)omRealloc0Size(C,red_size*sizeof(poly),2*red_size*sizeof(poly));
T=(poly*)omRealloc0Size(T,red_size*sizeof(poly),2*red_size*sizeof(poly));
if(TEST_OPT_PROT) {Print("+%d+",red_size);mflush();}
red_size*=2;
}
}
}
lazyComp
static poly lazyComp(number *A, poly *M, poly *T, int index, poly s, int *l, const ring tailR)
Definition kLiftstd.cc:132
kAppend
static void kAppend(poly t, TObject *h)
Definition kLiftstd.cc:121
START_REDUCE
#define START_REDUCE
kSplitAt
static poly kSplitAt(int k, TObject *h, kStrategy strat)
Definition kLiftstd.cc:28
kBucket_Add_q
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition kbuckets.cc:660
kBucketCanonicalize
int kBucketCanonicalize(kBucket_pt bucket)
Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in one bucket: Returns number of bu...
nSize
#define nSize(n)
Definition numbers.h:39

## redNF()

poly redNF | ( | poly | h,
|  | int & | max_ind,
|  | int | nonorm,
|  | kStrategy | strat )

Definition at line 2307 of file kstd2.cc.

{
if (h==NULL) return NULL;
int j,j_ring;
int cnt=REDNF_CANONICALIZE;
max_ind=strat->sl;
if (0 > strat->sl)
{
return h;
}
LObject P(h);
P.SetShortExpVector();
P.t_p=NULL;
BOOLEAN is_ring = rField_is_Ring(currRing);
if(is_ring) nonorm=TRUE;
#ifdef KDEBUG
// if (TEST_OPT_DEBUG)
// {
// PrintS("redNF: starting S:\n");
// for( j = 0; j <= max_ind; j++ )
// {
// Print("S[%d] (of size: %d): ", j, pSize(strat->S[j]));
// pWrite(strat->S[j]);
// }
// };
#endif
if (rField_is_Z(currRing))
{
redRing_Z_S(&P,strat);
if (P.bucket!=NULL)
{
P.p=kBucketClear(P.bucket);
kBucketDestroy(&P.bucket);
}
return P.p;
}
else if (rField_is_Ring(currRing))
{
redRing_S(&P,strat);
if (P.bucket!=NULL)
{
P.p=kBucketClear(P.bucket);
kBucketDestroy(&P.bucket);
}
return P.p;
}
P.bucket = kBucketCreate(currRing);
kBucketInit(P.bucket,P.p,pLength(P.p));
kbTest(P.bucket);
P.p=kBucketGetLm(P.bucket);
loop
{
j_ring=j=kFindDivisibleByInS_noCF(strat,&max_ind,&P);
while ((j>=0)
&& (nonorm)
&& (!n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[j]),currRing->cf)))
j=kFindNextDivisibleByInS(strat,j+1,max_ind,&P);
if (j>=0)
{
int sl=pSize(strat->S[j]);
int jj=j;
loop
{
int sll;
jj=kFindNextDivisibleByInS(strat,jj+1,max_ind,&P);
if (jj<0) break;
if ((!nonorm)
|| (n_DivBy(pGetCoeff(P.p),pGetCoeff(strat->S[jj]),currRing->cf)))
{
sll=pSize(strat->S[jj]);
if (sll<sl)
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print("better(S%d:%d -> S%d:%d)\n",j,sl,jj,sll);
#endif
//else if (TEST_OPT_PROT) { PrintS("b"); mflush(); }
j=jj;
sl=sll;
}
}
}
if ((nonorm==0) && (!nIsOne(pGetCoeff(strat->S[j]))))
{
pNorm(strat->S[j]);
//if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
}
nNormalize(pGetCoeff(P.p));
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
wrp(P.p);
PrintS(" with ");
wrp(strat->S[j]);
}
#endif
#ifdef HAVE_PLURAL
if (rIsPluralRing(currRing))
{
number coef;
nc_kBucketPolyRed_NF(P.bucket,strat->S[j],&coef,nonorm);
nDelete(&coef);
}
else
#endif
{
kBucketPolyRedNF(P.bucket,strat->S[j],pLength(strat->S[j]),
strat->kNoether);
}
cnt--;
if (cnt==0)
{
kBucketCanonicalize(P.bucket);
cnt=REDNF_CANONICALIZE;
}
P.p=kBucketGetLm(P.bucket);
//P.t_p=NULL;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto:");
wrp(P.p);
PrintLn();
}
#endif
if (P.p==NULL)
{
kBucketDestroy(&P.bucket);
return NULL;
}
kbTest(P.bucket);
P.SetShortExpVector();
}
else if (is_ring && (j_ring>=0) && (currRing->cf->cfQuotRem!=ndQuotRem))
{
number r;
number n=n_QuotRem(pGetCoeff(P.p),pGetCoeff(strat->S[j_ring]),&r,currRing->cf);
if(!n_IsZero(n,currRing->cf))
{
poly lm=kBucketGetLm(P.bucket);
poly m=p_Head(lm,currRing);
p_ExpVectorSub(m,strat->S[j_ring],currRing);
if (p_GetComp(strat->S[j_ring], currRing) != p_GetComp(lm, currRing))
{
p_SetComp(m,p_GetComp(lm, currRing),currRing);
}
p_SetCoeff(m,n,currRing);
p_Setm(m,currRing);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("redi (coeff):");
wrp(P.p);
PrintS(" with ");
wrp(strat->S[j]);
}
#endif
int l=-1;
kBucket_Minus_m_Mult_p(P.bucket,m,strat->S[j_ring],&l);
P.p=kBucketGetLm(P.bucket);
p_Delete(&m,currRing);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto:");
wrp(P.p);
PrintLn();
}
#endif
}
else
{
n_Delete(&n,currRing->cf);
}
n_Delete(&r,currRing->cf);
P.p=kBucketClear(P.bucket);
kBucketDestroy(&P.bucket);
pNormalize(P.p);
return P.p;
}
else
{
P.p=kBucketClear(P.bucket);
kBucketDestroy(&P.bucket);
pNormalize(P.p);
return P.p;
}
}
}
m
int m
Definition cfEzgcd.cc:128
kBucketClear
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition kbuckets.cc:521
kBucket_Minus_m_Mult_p
void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l, poly spNoether)
Bpoly == Bpoly - m*p; where m is a monom Does not destroy p and m assume (*l <= 0 || pLength(p) == *l...
Definition kbuckets.cc:722
kBucketInit
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition kbuckets.cc:493
kBucketCreate
kBucket_pt kBucketCreate(const ring bucket_ring)
Creation/Destruction of buckets.
Definition kbuckets.cc:209
kBucketPolyRedNF
void kBucketPolyRedNF(kBucket_pt bucket, poly p1, int l1, poly spNoether)
Definition kbuckets.cc:1188
kBucketGetLm
const poly kBucketGetLm(kBucket_pt bucket)
Definition kbuckets.cc:506
kFindNextDivisibleByInS
int kFindNextDivisibleByInS(const kStrategy strat, int start, int max_ind, LObject *L)
Definition kstd2.cc:567
kFindDivisibleByInS_noCF
int kFindDivisibleByInS_noCF(const kStrategy strat, int *max_ind, LObject *L)
Definition kstd2.cc:527
redRing_S
static int redRing_S(LObject *h, kStrategy strat)
Definition kstd2.cc:1090
redRing_Z_S
static int redRing_Z_S(LObject *h, kStrategy strat)
Definition kstd2.cc:878
REDNF_CANONICALIZE
#define REDNF_CANONICALIZE
Definition kutil.h:38
nc_kBucketPolyRed_NF
static void nc_kBucketPolyRed_NF(kBucket_pt b, poly p, number *c, BOOLEAN reduce)
Definition nc.h:275
nNormalize
#define nNormalize(n)
Definition numbers.h:30
p_Head
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
pNormalize
#define pNormalize(p)
Definition polys.h:318
pSize
#define pSize(p)
Definition polys.h:319

## redNF0()

int redNF0 | ( | LObject * | P,
|  | kStrategy | strat )

## redNFTail()

poly redNFTail | ( | poly | h,
|  | const int | sl,
|  | kStrategy | strat )

## redRiloc()

int redRiloc | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 385 of file kstd1.cc.

{
int i,at,ei,li,ii;
int j = 0;
int pass = 0;
long d,reddeg;
d = h->GetpFDeg()+ h->ecart;
reddeg = strat->LazyDegree+d;
h->SetShortExpVector();
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0)
{
// over ZZ: cleanup coefficients by complete reduction with monomials
postReduceByMon(h, strat);
if(h->p == NULL)
{
kDeleteLcm(h);
h->Clear();
return 0;
}
if (strat->honey) h->SetLength(strat->length_pLength);
if(strat->tl >= 0)
h->i_r1 = strat->tl;
else
h->i_r1 = -1;
if (h->GetLmTailRing() == NULL)
{
kDeleteLcm(h);
h->Clear();
return 0;
}
return 1;
}
ei = strat->T[j].ecart;
ii = j;
if (ei > h->ecart && ii < strat->tl)
{
li = strat->T[j].length;
// the polynomial to reduce with (up to the moment) is;
// pi with ecart ei and length li
// look for one with smaller ecart
i = j;
loop
{
/*- takes the first possible with respect to ecart -*/
i++;
#if 1
if (i > strat->tl) break;
if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
strat->T[i].length < li))
&&
p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing)
&&
n_DivBy(h->p->coef,strat->T[i].p->coef,strat->tailRing->cf))
#else
j = kFindDivisibleByInT(strat, h, i);
if (j < 0) break;
i = j;
if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
strat->T[i].length < li))
#endif
{
// the polynomial to reduce with is now
ii = i;
ei = strat->T[i].ecart;
if (ei <= h->ecart) break;
li = strat->T[i].length;
}
}
}
// end of search: have to reduce with pi
if (ei > h->ecart)
{
// It is not possible to reduce h with smaller ecart;
// if possible h goes to the lazy-set L,i.e
// if its position in L would be not the last one
strat->fromT = TRUE;
if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
{
h->SetLmCurrRing();
if (strat->honey && strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
assume(h->FDeg == h->pFDeg());
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll && pLmCmp(h->p, strat->L[strat->Ll].p) != 0 && !nEqual(h->p->coef, strat->L[strat->Ll].p->coef))
{
/*- h will not become the next element to reduce -*/
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
#endif
h->Clear();
strat->fromT = FALSE;
return -1;
}
}
doRed(h,&(strat->T[ii]),strat->fromT,strat,TRUE);
}
else
{
// now we finally can reduce
doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
}
strat->fromT=FALSE;
// are we done ???
if (h->IsNull())
{
kDeleteLcm(h);
h->Clear();
return 0;
}
// NO!
h->SetShortExpVector();
h->SetpFDeg();
if (strat->honey)
{
if (ei <= h->ecart)
h->ecart = d-h->GetpFDeg();
else
h->ecart = d-h->GetpFDeg()+ei-h->ecart;
}
else
// this has the side effect of setting h->length
h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
/*- try to reduce the s-polynomial -*/
pass++;
d = h->GetpFDeg()+h->ecart;
/*
*test whether the polynomial should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
&& ((d >= reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
if (strat->honey && strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
assume(h->FDeg == h->pFDeg());
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
{
if (strat->honey && !strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
return 1;
}
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
#endif
h->Clear();
return -1;
}
}
else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
{
Print(".%ld",d);mflush();
reddeg = d+1;
if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
}
}
postReduceByMon
void postReduceByMon(LObject *h, kStrategy strat)
used for GB over ZZ: intermediate reduction by monomial elements background: any known constant eleme...
Definition kutil.cc:10682

## redRing()

int redRing | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 988 of file kstd2.cc.

{
if (strat->tl<0) return 1;
if (h->IsNull()) return 0; // spoly is zero (can only occur with zero divisors)
int at/*,i*/;
long d;
int j = 0;
int pass = 0;
// poly zeroPoly = NULL;
// TODO warum SetpFDeg notwendig?
h->SetpFDeg();
assume(h->pFDeg() == h->FDeg);
long reddeg = h->GetpFDeg();
h->SetShortExpVector();
loop
{
j = kFindDivisibleByInT(strat, h);
if (j < 0)
{
// over ZZ: cleanup coefficients by complete reduction with monomials
postReduceByMon(h, strat);
if(h->p == NULL)
{
kDeleteLcm(h);
h->Clear();
return 0;
}
if(nIsZero(pGetCoeff(h->p))) return 2;
j = kFindDivisibleByInT(strat, h);
if(j < 0)
{
if(strat->tl >= 0)
h->i_r1 = strat->tl;
else
h->i_r1 = -1;
if (h->GetLmTailRing() == NULL)
{
kDeleteLcm(h);
h->Clear();
return 0;
}
return 1;
}
}
//printf("\nFound one: ");pWrite(strat->T[j].p);
//enterT(*h, strat);
ksReducePoly(h, &(strat->T[j]), NULL, NULL, NULL, strat); // with debug output
//printf("\nAfter small red: ");pWrite(h->p);
if (h->GetLmTailRing() == NULL)
{
kDeleteLcm(h);
h->Clear();
return 0;
}
h->SetShortExpVector();
d = h->SetpFDeg();
/*- try to reduce the s-polynomial -*/
pass++;
if (!TEST_OPT_REDTHROUGH &&
(strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
if (strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
#endif
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
h->Clear();
return -1;
}
}
if (d != reddeg)
{
if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
{
if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
else if ((TEST_OPT_PROT) && (strat->Ll < 0))
{
Print(".%ld",d);mflush();
reddeg = d;
}
}
}
}

## redRing_Z()

int redRing_Z | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 720 of file kstd2.cc.

{
if (h->IsNull()) return 0; // spoly is zero (can only occur with zero divisors)
if (strat->tl<0) return 1;
int at;
long d;
int j = 0;
int pass = 0;
// TODO warum SetpFDeg notwendig?
h->SetpFDeg();
assume(h->pFDeg() == h->FDeg);
long reddeg = h->GetpFDeg();
h->SetShortExpVector();
loop
{
/* check if a reducer of the lead term exists */
j = kFindDivisibleByInT(strat, h);
if (j < 0)
{
#if STDZ_EXCHANGE_DURING_REDUCTION
/* check if a reducer with the same lead monomial exists */
j = kFindSameLMInT_Z(strat, h);
if (j < 0)
{
#endif
/* check if a reducer of the lead monomial exists, by the above
* check this is a real divisor of the lead monomial */
j = kFindDivisibleByInT_Z(strat, h);
if (j < 0)
{
// over ZZ: cleanup coefficients by complete reduction with monomials
if (rHasLocalOrMixedOrdering(currRing))
postReduceByMon(h, strat);
if(h->p == NULL)
{
if (h->lcm!=NULL) pLmDelete(h->lcm);
h->Clear();
return 0;
}
if(nIsZero(pGetCoeff(h->p))) return 2;
j = kFindDivisibleByInT(strat, h);
if(j < 0)
{
if(strat->tl >= 0)
h->i_r1 = strat->tl;
else
h->i_r1 = -1;
if (h->GetLmTailRing() == NULL)
{
if (h->lcm!=NULL) pLmDelete(h->lcm);
h->Clear();
return 0;
}
return 1;
}
}
else
{
/* not(lc(reducer) | lc(poly)) && not(lc(poly) | lc(reducer))
* => we try to cut down the lead coefficient at least */
/* first copy T[j] in order to multiply it with a coefficient later on */
number mult, rest;
TObject tj = strat->T[j];
tj.Copy();
/* tj.max_exp = strat->T[j].max_exp; */
/* compute division with remainder of lc(h) and lc(T[j]) */
mult = n_QuotRem(pGetCoeff(h->p), pGetCoeff(strat->T[j].p),
&rest, currRing->cf);
/* set corresponding new lead coefficient already. we do not
* remove the lead term in ksReducePolyLC, but only apply
* a lead coefficient reduction */
tj.Mult_nn(mult);
ksReducePolyLC(h, &tj, NULL, &rest, strat);
tj.Delete();
tj.Clear();
}
#if STDZ_EXCHANGE_DURING_REDUCTION
}
else
{
/* same lead monomial but lead coefficients do not divide each other:
* change the polys to h <- spoly(h,tj) and h2 <- gpoly(h,tj). */
LObject h2 = *h;
h2.Copy();
ksReducePolyZ(h, &(strat->T[j]), NULL, NULL, strat);
ksReducePolyGCD(&h2, &(strat->T[j]), NULL, NULL, strat);
if (!rHasLocalOrMixedOrdering(currRing))
{
redtailBbaAlsoLC_Z(&h2, j, strat);
}
/* replace h2 for tj in L (already generated pairs with tj), S and T */
replaceInLAndSAndT(h2, j, strat);
}
#endif
}
else
{
ksReducePoly(h, &(strat->T[j]), NULL, NULL, NULL, strat);
}
/* printf("\nAfter small red: ");pWrite(h->p); */
if (h->GetLmTailRing() == NULL)
{
if (h->lcm!=NULL) pLmDelete(h->lcm);
#ifdef KDEBUG
h->lcm=NULL;
#endif
h->Clear();
return 0;
}
h->SetShortExpVector();
d = h->SetpFDeg();
/*- try to reduce the s-polynomial -*/
pass++;
if (!TEST_OPT_REDTHROUGH &&
(strat->Ll >= 0) && ((d > reddeg) || (pass > strat->LazyPass)))
{
h->SetLmCurrRing();
if (strat->posInLDependsOnLength)
h->SetLength(strat->length_pLength);
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
#ifdef KDEBUG
if (TEST_OPT_DEBUG) Print(" ->L[%d]\n",at);
#endif
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at); // NOT RING CHECKED OLIVER
h->Clear();
return -1;
}
}
if (d != reddeg)
{
if (UNLIKELY(d>=(long)strat->tailRing->bitmask))
{
if (h->pTotalDeg() >= (long)strat->tailRing->bitmask)
{
strat->overflow=TRUE;
//Print("OVERFLOW in redRing d=%ld, max=%ld\n",d,strat->tailRing->bitmask);
h->GetP();
at = strat->posInL(strat->L,strat->Ll,h,strat);
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
h->Clear();
return -1;
}
}
else if ((TEST_OPT_PROT) && (strat->Ll < 0))
{
Print(".%ld",d);mflush();
reddeg = d;
}
}
}
}
ksReducePolyLC
int ksReducePolyLC(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:477
kFindDivisibleByInT_Z
int kFindDivisibleByInT_Z(const kStrategy strat, const LObject *L, const int start)
Definition kstd2.cc:209
ksReducePolyGCD
int ksReducePolyGCD(LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)
kFindSameLMInT_Z
int kFindSameLMInT_Z(const kStrategy strat, const LObject *L, const int start=0)
ksReducePolyZ
int ksReducePolyZ(LObject *PR, TObject *PW, poly spNoether=NULL, number *coef=NULL, kStrategy strat=NULL)

## redSig()

int redSig | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 1369 of file kstd2.cc.

{
if (strat->tl<0) return 1;
//if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
//printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
assume(h->FDeg == h->pFDeg());
//#if 1
#ifdef DEBUGF5
PrintS("------- IN REDSIG -------\n");
Print("p: ");
pWrite(pHead(h->p));
PrintS("p1: ");
pWrite(pHead(h->p1));
PrintS("p2: ");
pWrite(pHead(h->p2));
PrintS("---------------------------\n");
#endif
poly h_p;
int i,j,at,pass, ii;
int start=0;
int sigSafe;
unsigned long not_sev;
// long reddeg,d;
BOOLEAN test_opt_length=TEST_OPT_LENGTH;
int li;
pass = j = 0;
h->SetShortExpVector();
h_p = h->GetLmTailRing();
not_sev = ~ h->sev;
loop
{
j = kFindDivisibleByInT(strat, h, start);
if (j < 0)
{
return 1;
}
li = strat->T[j].pLength;
if (li<=0) li=strat->T[j].GetpLength();
ii = j;
/*
* the polynomial to reduce with (up to the moment) is;
* pi with length li
*/
i = j;
#if 1
if (test_opt_length)
loop
{
/*- search the shortest possible with respect to length -*/
i++;
if (i > strat->tl)
break;
if (li==1)
break;
if ((strat->T[i].pLength < li)
&&
p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
h_p, not_sev, strat->tailRing))
{
/*
* the polynomial to reduce with is now;
*/
li = strat->T[i].pLength;
if (li<=0) li=strat->T[i].GetpLength();
ii = i;
}
}
start = ii+1;
#endif
/*
* end of search: have to reduce with pi
*/
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
h->wrp();
PrintS(" with ");
strat->T[ii].wrp();
}
#endif
assume(strat->fromT == FALSE);
//#if 1
#ifdef DEBUGF5
Print("BEFORE REDUCTION WITH %d:\n",ii);
PrintS("--------------------------------\n");
pWrite(h->sig);
pWrite(strat->T[ii].sig);
pWrite(h->GetLmCurrRing());
pWrite(pHead(h->p1));
pWrite(pHead(h->p2));
pWrite(pHead(strat->T[ii].p));
PrintS("--------------------------------\n");
printf("INDEX OF REDUCER T: %d\n",ii);
#endif
sigSafe = ksReducePolySig(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
#if SBA_PRINT_REDUCTION_STEPS
if (sigSafe != 3)
sba_reduction_steps++;
#endif
#if SBA_PRINT_OPERATIONS
if (sigSafe != 3)
sba_operations += pLength(strat->T[ii].p);
#endif
// if reduction has taken place, i.e. the reduction was sig-safe
// otherwise start is already at the next position and the loop
// searching reducers in T goes on from index start
//#if 1
#ifdef DEBUGF5
Print("SigSAFE: %d\n",sigSafe);
#endif
if (sigSafe != 3)
{
// start the next search for reducers in T from the beginning
start = 0;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto ");
h->wrp();
PrintLn();
}
#endif
h_p = h->GetLmTailRing();
if (h_p == NULL)
{
kDeleteLcm(h);
return 0;
}
h->SetShortExpVector();
not_sev = ~ h->sev;
/*
* try to reduce the s-polynomial h
*test first whether h should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
pass++;
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
{
h->SetLmCurrRing();
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
{
return 1;
}
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
Print(" lazy: -> L%d\n",at);
#endif
h->Clear();
return -1;
}
}
}
}
}
ksReducePolySig
int ksReducePolySig(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:737

## redSigRing()

int redSigRing | ( | LObject * | h,
|  | kStrategy | strat )

Definition at line 1536 of file kstd2.cc.

{
//Since reduce is really bad for SBA we use the following idea:
// We first check if we can build a gcd pair between h and S
//where the sig remains the same and replace h by this gcd poly
assume(rField_is_Ring(currRing));
#if GCD_SBA
while(sbaCheckGcdPair(h,strat))
{
h->sev = pGetShortExpVector(h->p);
}
#endif
poly beforeredsig;
beforeredsig = pCopy(h->sig);
if (strat->tl<0) return 1;
//if (h->GetLmTailRing()==NULL) return 0; // HS: SHOULD NOT BE NEEDED!
//printf("FDEGS: %ld -- %ld\n",h->FDeg, h->pFDeg());
assume(h->FDeg == h->pFDeg());
//#if 1
#ifdef DEBUGF5
Print("------- IN REDSIG -------\n");
Print("p: ");
pWrite(pHead(h->p));
Print("p1: ");
pWrite(pHead(h->p1));
Print("p2: ");
pWrite(pHead(h->p2));
Print("---------------------------\n");
#endif
poly h_p;
int i,j,at,pass, ii;
int start=0;
int sigSafe;
unsigned long not_sev;
// long reddeg,d;
int li;
BOOLEAN test_opt_length=TEST_OPT_LENGTH;
pass = j = 0;
h->SetShortExpVector();
h_p = h->GetLmTailRing();
not_sev = ~ h->sev;
loop
{
j = kFindDivisibleByInT(strat, h, start);
if (j < 0)
{
#if GCD_SBA
while(sbaCheckGcdPair(h,strat))
{
h->sev = pGetShortExpVector(h->p);
h->is_redundant = FALSE;
start = 0;
}
#endif
// over ZZ: cleanup coefficients by complete reduction with monomials
postReduceByMonSig(h, strat);
if(h->p == NULL || nIsZero(pGetCoeff(h->p))) return 2;
j = kFindDivisibleByInT(strat, h,start);
if(j < 0)
{
if(strat->tl >= 0)
h->i_r1 = strat->tl;
else
h->i_r1 = -1;
if (h->GetLmTailRing() == NULL)
{
kDeleteLcm(h);
h->Clear();
return 0;
}
//Check for sigdrop after reduction
if(pLtCmp(beforeredsig,h->sig) == 1)
{
strat->sigdrop = TRUE;
//Reduce it as much as you can
int red_result = redRing(h,strat);
if(red_result == 0)
{
//It reduced to 0, cancel the sigdrop
strat->sigdrop = FALSE;
p_Delete(&h->sig,currRing);h->sig = NULL;
return 0;
}
else
{
//strat->enterS(*h, strat->sl+1, strat, strat->tl);
return 0;
}
}
p_Delete(&beforeredsig,currRing);
return 1;
}
}
li = strat->T[j].pLength;
if (li<=0) li=strat->T[j].GetpLength();
ii = j;
/*
* the polynomial to reduce with (up to the moment) is;
* pi with length li
*/
i = j;
if (test_opt_length)
loop
{
/*- search the shortest possible with respect to length -*/
i++;
if (i > strat->tl)
break;
if (li==1)
break;
if ((strat->T[i].pLength < li)
&& n_DivBy(pGetCoeff(h_p),pGetCoeff(strat->T[i].p),currRing->cf)
&& p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i],
h_p, not_sev, strat->tailRing))
{
/*
* the polynomial to reduce with is now;
*/
li = strat->T[i].pLength;
if (li<=0) li=strat->T[i].GetpLength();
ii = i;
}
}
start = ii+1;
/*
* end of search: have to reduce with pi
*/
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("red:");
h->wrp();
PrintS(" with ");
strat->T[ii].wrp();
}
#endif
assume(strat->fromT == FALSE);
//#if 1
#ifdef DEBUGF5
Print("BEFORE REDUCTION WITH %d:\n",ii);
Print("--------------------------------\n");
pWrite(h->sig);
pWrite(strat->T[ii].sig);
pWrite(h->GetLmCurrRing());
pWrite(pHead(h->p1));
pWrite(pHead(h->p2));
pWrite(pHead(strat->T[ii].p));
Print("--------------------------------\n");
printf("INDEX OF REDUCER T: %d\n",ii);
#endif
sigSafe = ksReducePolySigRing(h, &(strat->T[ii]), strat->S_2_R[ii], NULL, NULL, strat);
if(h->p == NULL && h->sig == NULL)
{
//Trivial case catch
strat->sigdrop = FALSE;
}
#if 0
//If the reducer has the same lt (+ or -) as the other one, reduce it via redRing
//In some cases this proves to be very bad
if(rField_is_Ring(currRing) && h->p != NULL && pLmCmp(h->p,strat->T[ii].p)==0)
{
int red_result = redRing(h,strat);
if(red_result == 0)
{
pDelete(&h->sig);h->sig = NULL;
return 0;
}
else
{
strat->sigdrop = TRUE;
return 1;
}
}
#endif
if(strat->sigdrop)
return 1;
#if SBA_PRINT_REDUCTION_STEPS
if (sigSafe != 3)
sba_reduction_steps++;
#endif
#if SBA_PRINT_OPERATIONS
if (sigSafe != 3)
sba_operations += pLength(strat->T[ii].p);
#endif
// if reduction has taken place, i.e. the reduction was sig-safe
// otherwise start is already at the next position and the loop
// searching reducers in T goes on from index start
//#if 1
#ifdef DEBUGF5
Print("SigSAFE: %d\n",sigSafe);
#endif
if (sigSafe != 3)
{
// start the next search for reducers in T from the beginning
start = 0;
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
{
PrintS("\nto ");
h->wrp();
PrintLn();
}
#endif
h_p = h->GetLmTailRing();
if (h_p == NULL)
{
kDeleteLcm(h);
return 0;
}
h->SetShortExpVector();
not_sev = ~ h->sev;
/*
* try to reduce the s-polynomial h
*test first whether h should go to the lazyset L
*-if the degree jumps
*-if the number of pre-defined reductions jumps
*/
pass++;
if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0) && (pass > strat->LazyPass))
{
h->SetLmCurrRing();
at = strat->posInL(strat->L,strat->Ll,h,strat);
if (at <= strat->Ll)
{
int dummy=strat->sl;
if (kFindDivisibleByInS(strat, &dummy, h) < 0)
{
return 1;
}
enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
#ifdef KDEBUG
if (TEST_OPT_DEBUG)
Print(" lazy: -> L%d\n",at);
#endif
h->Clear();
return -1;
}
}
}
}
}
ksReducePolySigRing
int ksReducePolySigRing(LObject *PR, TObject *PW, long, poly spNoether, number *coef, kStrategy strat)
Definition kspoly.cc:943
postReduceByMonSig
void postReduceByMonSig(LObject *h, kStrategy strat)
Definition kutil.cc:10758
sbaCheckGcdPair
BOOLEAN sbaCheckGcdPair(LObject *h, kStrategy strat)
Definition kutil.cc:1688

## 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;
}
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() [1/3]

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

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();
}
REDTAIL_CANONICALIZE
#define REDTAIL_CANONICALIZE
Definition kutil.h:39
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() [2/3]

KINLINE poly redtailBba | ( | poly | p,
|  | int | end_pos,
|  | kStrategy | strat,
|  | BOOLEAN | normalize = FALSE )

Definition at line 1212 of file kInline.h.

{
LObject L(p);
return redtailBba(&L, pos, strat,FALSE, normalize);
}

## redtailBba() [3/3]

poly redtailBba | ( | TObject * | T,
|  | int | end_pos,
|  | kStrategy | strat )

## 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;
}

## redtailBba_Ring() [1/2]

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_Ring() [2/2]

KINLINE poly redtailBba_Ring | ( | poly | p,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 1224 of file kInline.h.

{
LObject L(p, currRing, strat->tailRing);
return redtailBba_Ring(&L, pos, strat);
}

## redtailBba_Z() [1/2]

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();
}

## redtailBba_Z() [2/2]

KINLINE poly redtailBba_Z | ( | poly | p,
|  | int | end_pos,
|  | kStrategy | strat )

Definition at line 1229 of file kInline.h.

{
LObject L(p, currRing, strat->tailRing);
return redtailBba_Z(&L, pos, strat);
}

## 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

## redtailBbaBound() [1/2]

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

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();
}
pJet
#define pJet(p, m)
Definition polys.h:368

## redtailBbaBound() [2/2]

KINLINE poly redtailBbaBound | ( | poly | p,
|  | int | end_pos,
|  | kStrategy | strat,
|  | int | bound,
|  | BOOLEAN | normalize = FALSE )

Definition at line 1218 of file kInline.h.

{
LObject L(p, currRing, strat->tailRing); // ? L(p); ??
return redtailBbaBound(&L, pos, strat,bound, FALSE, normalize);
}

## 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();
}

## redtailSba()

poly redtailSba | ( | LObject * | L,
|  | int | end_pos,
|  | kStrategy | strat,
|  | BOOLEAN | withT = FALSE,
|  | BOOLEAN | normalize = FALSE )

Definition at line 1785 of file kstd2.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.sig = L->sig;
Ln.sevSig = L->sevSig;
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(rField_is_Ring(currRing) && strat->sigdrop)
break;
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;
}
cnt--;
if (cnt==0)
{
cnt=REDTAIL_CANONICALIZE;
/*poly tmp=*/Ln.CanonicalizeP();
if (normalize && !rField_is_Ring(currRing))
{
Ln.Normalize();
//pNormalize(tmp);
//if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
}
}
if (normalize && (!TEST_OPT_INTSTRATEGY) && !rField_is_Ring(currRing) && (!nIsOne(pGetCoeff(With->p))))
{
With->pNorm();
}
strat->redTailChange=TRUE;
int ret = ksReducePolyTailSig(L, With, &Ln, strat);
if(rField_is_Ring(currRing))
L->sig = Ln.sig;
//Because Ln.sig is set to L->sig, but in ksReducePolyTailSig -> ksReducePolySig
// I delete it an then set Ln.sig. Hence L->sig is lost
#if SBA_PRINT_REDUCTION_STEPS
if (ret != 3)
sba_reduction_steps++;
#endif
#if SBA_PRINT_OPERATIONS
if (ret != 3)
sba_operations += pLength(With->p);
#endif
if (ret)
{
// 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);
if(rField_is_Ring(currRing) && strat->sigdrop)
{
//Cannot break the loop here so easily
break;
}
}
pNext(h) = Ln.LmExtractAndIter();
pIter(h);
if(!rField_is_Ring(currRing))
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();
}
ksReducePolyTailSig
KINLINE int ksReducePolyTailSig(LObject *PR, TObject *PW, LObject *Red, kStrategy strat)
Definition kstd2.cc:1331

## 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;
}

## sba()

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

Definition at line 2971 of file kstd2.cc.

{
// ring order stuff:
// in sba we have (until now) two possibilities:
// 1. an incremental computation w.r.t. (C,monomial order)
// 2. a (possibly non-incremental) computation w.r.t. the
// induced Schreyer order.
// The corresponding orders are computed in sbaRing(), depending
// on the flag strat->sbaOrder
#if SBA_PRINT_ZERO_REDUCTIONS
long zeroreductions = 0;
#endif
#if SBA_PRINT_PRODUCT_CRITERION
long product_criterion = 0;
#endif
#if SBA_PRINT_SIZE_G
int size_g = 0;
int size_g_non_red = 0;
#endif
#if SBA_PRINT_SIZE_SYZ
long size_syz = 0;
#endif
// global variable
#if SBA_PRINT_REDUCTION_STEPS
sba_reduction_steps = 0;
sba_interreduction_steps = 0;
#endif
#if SBA_PRINT_OPERATIONS
sba_operations = 0;
sba_interreduction_operations = 0;
#endif
ideal F1 = F0;
ring currRingOld = currRing;
ring sRing = currRing;
if (strat->sbaOrder == 1 || strat->sbaOrder == 3)
{
sRing = sbaRing(strat);
if (sRing!=currRingOld)
{
rChangeCurrRing (sRing);
F1 = idrMoveR (F0, currRingOld, currRing);
}
}
ideal F;
// sort ideal F
//Put the SigDrop element on the correct position (think of sbaEnterS)
//We also sort them
if(rField_is_Ring(currRing) && strat->sigdrop)
{
#if 1
F = idInit(IDELEMS(F1),F1->rank);
for (int i=0; i<IDELEMS(F1);++i)
F->m[i] = F1->m[i];
if(strat->sbaEnterS >= 0)
{
poly dummy;
dummy = pCopy(F->m[0]); //the sigdrop element
for(int i = 0;i<strat->sbaEnterS;i++)
F->m[i] = F->m[i+1];
F->m[strat->sbaEnterS] = dummy;
}
#else
F = idInit(1,F1->rank);
//printf("\nBefore the initial block sorting:\n");idPrint(F1);
F->m[0] = F1->m[0];
int pos;
if(strat->sbaEnterS >= 0)
{
for(int i=1;i<=strat->sbaEnterS;i++)
{
pos = posInIdealMonFirst(F,F1->m[i],1,strat->sbaEnterS);
idInsertPolyOnPos(F,F1->m[i],pos);
}
for(int i=strat->sbaEnterS+1;i<IDELEMS(F1);i++)
{
pos = posInIdealMonFirst(F,F1->m[i],strat->sbaEnterS+1,IDELEMS(F));
idInsertPolyOnPos(F,F1->m[i],pos);
}
poly dummy;
dummy = pCopy(F->m[0]); //the sigdrop element
for(int i = 0;i<strat->sbaEnterS;i++)
F->m[i] = F->m[i+1];
F->m[strat->sbaEnterS] = dummy;
}
else
{
for(int i=1;i<IDELEMS(F1);i++)
{
pos = posInIdealMonFirst(F,F1->m[i],1,IDELEMS(F));
idInsertPolyOnPos(F,F1->m[i],pos);
}
}
#endif
//printf("\nAfter the initial block sorting:\n");idPrint(F);getchar();
}
else
{
F = idInit(IDELEMS(F1),F1->rank);
intvec *sort = idSort(F1);
for (int i=0; i<sort->length();++i)
F->m[i] = F1->m[(*sort)[i]-1];
if(rField_is_Ring(currRing))
{
// put the monomials after the sbaEnterS polynomials
//printf("\nThis is the ideal before sorting (sbaEnterS = %i)\n",strat->sbaEnterS);idPrint(F);
int nrmon = 0;
for(int i = IDELEMS(F)-1,j;i>strat->sbaEnterS+nrmon+1 ;i--)
{
//pWrite(F->m[i]);
if(F->m[i] != NULL && pNext(F->m[i]) == NULL)
{
poly mon = F->m[i];
for(j = i;j>strat->sbaEnterS+nrmon+1;j--)
{
F->m[j] = F->m[j-1];
}
F->m[j] = mon;
nrmon++;
}
//idPrint(F);
}
}
}
//printf("\nThis is the ideal after sorting\n");idPrint(F);getchar();
if(rField_is_Ring(currRing))
strat->sigdrop = FALSE;
strat->nrsyzcrit = 0;
strat->nrrewcrit = 0;
#if SBA_INTERRED_START
F = kInterRed(F,NULL);
#endif
#if F5DEBUG
printf("SBA COMPUTATIONS DONE IN THE FOLLOWING RING:\n");
rWrite (currRing);
printf("ordSgn = %d\n",currRing->OrdSgn);
printf("\n");
#endif
int srmax,lrmax, red_result = 1;
int olddeg,reduc;
int hilbeledeg=1,hilbcount=0,minimcnt=0;
LObject L;
BOOLEAN withT = TRUE;
strat->max_lower_index = 0;
//initBuchMoraCrit(strat); /*set Gebauer, honey, sugarCrit*/
initSbaCrit(strat); /*set Gebauer, honey, sugarCrit*/
initSbaPos(strat);
initHilbCrit(F,Q,&hilb,strat);
initSba(F,strat);
/*set enterS, spSpolyShort, reduce, red, initEcart, initEcartPair*/
/*Shdl=*/initSbaBuchMora(F, Q,strat);
idTest(strat->Shdl);
if (strat->minim>0) strat->M=idInit(IDELEMS(F),F->rank);
srmax = strat->sl;
reduc = olddeg = lrmax = 0;
#ifndef NO_BUCKETS
if (!TEST_OPT_NOT_BUCKETS)
strat->use_buckets = 1;
#endif
// redtailBBa against T for inhomogeneous input
// if (!TEST_OPT_OLDSTD)
// withT = ! strat->homog;
// strat->posInT = posInT_pLength;
kTest_TS(strat);
#ifdef HAVE_TAIL_RING
if(!idIs0(F) &&(!rField_is_Ring(currRing))) // create strong gcd poly computes with tailring and S[i] ->to be fixed
kStratInitChangeTailRing(strat);
#endif
// We add the elements directly in S from the previous loop
if(rField_is_Ring(currRing) && strat->sbaEnterS >= 0)
{
for(int i = 0;i<strat->sbaEnterS;i++)
{
//Update: now the element is at the correct place
//i+1 because on the 0 position is the sigdrop element
enterT(&strat->L[strat->Ll-(i)],strat);
strat->enterS(&strat->L[strat->Ll-(i)], strat->sl+1, strat, strat->tl);
}
strat->Ll = strat->Ll - strat->sbaEnterS;
strat->sbaEnterS = -1;
}
kTest_TS(strat);
#ifdef KDEBUG
//kDebugPrint(strat);
#endif
/* compute------------------------------------------------------- */
while (strat->Ll >= 0)
{
if (strat->Ll > lrmax) lrmax =strat->Ll;/*stat.*/
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif
if (strat->Ll== 0) strat->interpt=TRUE;
/*
if (TEST_OPT_DEGBOUND
&& ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))))
{
//stops computation if
// 24 IN test and the degree +ecart of L[strat->Ll] is bigger then
//a predefined number Kstd1_deg
while ((strat->Ll >= 0)
&& (strat->L[strat->Ll].p1!=NULL) && (strat->L[strat->Ll].p2!=NULL)
&& ((strat->honey && (strat->L[strat->Ll].ecart+currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg))
|| ((!strat->honey) && (currRing->pFDeg(strat->L[strat->Ll].p,currRing)>Kstd1_deg)))
)
deleteInL(strat->L,&strat->Ll,strat->Ll,strat);
if (strat->Ll<0) break;
else strat->noClearS=TRUE;
}
*/
if (strat->sbaOrder == 1 && pGetComp(strat->L[strat->Ll].sig) != strat->currIdx)
{
strat->currIdx = pGetComp(strat->L[strat->Ll].sig);
#if F5C
// 1. interreduction of the current standard basis
// 2. generation of new principal syzygy rules for syzCriterion
f5c ( strat, olddeg, minimcnt, hilbeledeg, hilbcount, srmax,
lrmax, reduc, Q, w, hilb );
#endif
// initialize new syzygy rules for the next iteration step
initSyzRules(strat);
}
/*********************************************************************
* interrreduction step is done, we can go on with the next iteration
* step of the signature-based algorithm
********************************************************************/
/* picks the last element from the lazyset L */
strat->P = strat->L[strat->Ll];
strat->Ll--;
if(rField_is_Ring(currRing))
strat->sbaEnterS = pGetComp(strat->P.sig) - 1;
/* reduction of the element chosen from L */
if (!strat->rewCrit2(strat->P.sig, ~strat->P.sevSig, strat->P.GetLmCurrRing(), strat, strat->P.checked+1))
{
//#if 1
#ifdef DEBUGF5
PrintS("SIG OF NEXT PAIR TO HANDLE IN SIG-BASED ALGORITHM\n");
PrintS("-------------------------------------------------\n");
pWrite(strat->P.sig);
pWrite(pHead(strat->P.p));
pWrite(pHead(strat->P.p1));
pWrite(pHead(strat->P.p2));
PrintS("-------------------------------------------------\n");
#endif
if (pNext(strat->P.p) == strat->tail)
{
// deletes the short spoly
/*
if (rField_is_Ring(currRing))
pLmDelete(strat->P.p);
else
pLmFree(strat->P.p);
*/
// TODO: needs some masking
// TODO: masking needs to vanish once the signature
// stuff is completely implemented
strat->P.p = NULL;
poly m1 = NULL, m2 = NULL;
// check that spoly creation is ok
while (strat->tailRing != currRing &&
!kCheckSpolyCreation(&(strat->P), strat, m1, m2))
{
assume(m1 == NULL && m2 == NULL);
// if not, change to a ring where exponents are at least
// large enough
if (!kStratChangeTailRing(strat))
{
WerrorS("OVERFLOW...");
break;
}
}
// create the real one
ksCreateSpoly(&(strat->P), NULL, strat->use_buckets,
strat->tailRing, m1, m2, strat->R);
}
else if (strat->P.p1 == NULL)
{
if (strat->minim > 0)
strat->P.p2=p_Copy(strat->P.p, currRing, strat->tailRing);
// for input polys, prepare reduction
if(!rField_is_Ring(currRing))
strat->P.PrepareRed(strat->use_buckets);
}
if (strat->P.p == NULL && strat->P.t_p == NULL)
{
red_result = 0;
}
else
{
//#if 1
#ifdef DEBUGF5
PrintS("Poly before red: ");
pWrite(pHead(strat->P.p));
pWrite(strat->P.sig);
#endif
#if SBA_PRODUCT_CRITERION
if (strat->P.prod_crit)
{
#if SBA_PRINT_PRODUCT_CRITERION
product_criterion++;
#endif
int pos = posInSyz(strat, strat->P.sig);
enterSyz(strat->P, strat, pos);
kDeleteLcm(&strat->P);
red_result = 2;
}
else
{
red_result = strat->red(&strat->P,strat);
}
#else
red_result = strat->red(&strat->P,strat);
#endif
}
}
else
{
/*
if (strat->P.lcm != NULL)
pLmFree(strat->P.lcm);
*/
red_result = 2;
}
if(rField_is_Ring(currRing))
{
if(strat->P.sig!= NULL && !nGreaterZero(pGetCoeff(strat->P.sig)))
{
strat->P.p = pNeg(strat->P.p);
strat->P.sig = pNeg(strat->P.sig);
}
strat->P.pLength = pLength(strat->P.p);
if(strat->P.sig != NULL)
strat->P.sevSig = pGetShortExpVector(strat->P.sig);
if(strat->P.p != NULL)
strat->P.sev = pGetShortExpVector(strat->P.p);
}
//sigdrop case
if(rField_is_Ring(currRing) && strat->sigdrop)
{
//First reduce it as much as one can
red_result = redRing(&strat->P,strat);
if(red_result == 0)
{
strat->sigdrop = FALSE;
pDelete(&strat->P.sig);
strat->P.sig = NULL;
}
else
{
strat->enterS(&strat->P, 0, strat, strat->tl);
if (TEST_OPT_PROT)
PrintS("-");
break;
}
}
if(rField_is_Ring(currRing) && strat->blockred > strat->blockredmax)
{
strat->sigdrop = TRUE;
break;
}
if (errorreported) break;
//#if 1
#ifdef DEBUGF5
if (red_result != 0)
{
PrintS("Poly after red: ");
pWrite(pHead(strat->P.p));
pWrite(strat->P.GetLmCurrRing());
pWrite(strat->P.sig);
printf("%d\n",red_result);
}
#endif
if (TEST_OPT_PROT)
{
if(strat->P.p != NULL)
message((strat->honey ? strat->P.ecart : 0) + strat->P.pFDeg(),
&olddeg,&reduc,strat, red_result);
else
message((strat->honey ? strat->P.ecart : 0),
&olddeg,&reduc,strat, red_result);
}
if (strat->overflow)
{
if (!kStratChangeTailRing(strat)) { WerrorS("OVERFLOW.."); break;}
}
// reduction to non-zero new poly
if (red_result == 1)
{
// get the polynomial (canonicalize bucket, make sure P.p is set)
strat->P.GetP(strat->lmBin);
// sig-safe computations may lead to wrong FDeg computation, thus we need
// to recompute it to make sure everything is alright
(strat->P).FDeg = (strat->P).pFDeg();
// in the homogeneous case FDeg >= pFDeg (sugar/honey)
// but now, for entering S, T, we reset it
// in the inhomogeneous case: FDeg == pFDeg
if (strat->homog) strat->initEcart(&(strat->P));
/* statistic */
if (TEST_OPT_PROT) PrintS("s");
//int pos=posInS(strat,strat->sl,strat->P.p,strat->P.ecart);
// in F5E we know that the last reduced element is already the
// the one with highest signature
int pos = strat->sl+1;
// reduce the tail and normalize poly
// in the ring case we cannot expect LC(f) = 1,
poly beforetailred;
if(rField_is_Ring(currRing))
beforetailred = pCopy(strat->P.sig);
#if SBA_TAIL_RED
if(rField_is_Ring(currRing))
{
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
}
else
{
if (strat->sbaOrder != 2)
{
if (TEST_OPT_INTSTRATEGY)
{
strat->P.pCleardenom();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
{
strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
strat->P.pCleardenom();
}
}
else
{
strat->P.pNorm();
if ((TEST_OPT_REDSB)||(TEST_OPT_REDTAIL))
strat->P.p = redtailSba(&(strat->P),pos-1,strat, withT);
}
}
}
// It may happen that we have lost the sig in redtailsba
// It cannot reduce to 0 since here we are doing just tail reduction.
// Best case scenario: remains the leading term
if(rField_is_Ring(currRing) && strat->sigdrop)
{
strat->enterS(&strat->P, 0, strat, strat->tl);
break;
}
#endif
if(rField_is_Ring(currRing))
{
if(strat->P.sig == NULL || pLtCmp(beforetailred,strat->P.sig) == 1)
{
strat->sigdrop = TRUE;
//Reduce it as much as you can
red_result = redRing(&strat->P,strat);
if(red_result == 0)
{
//It reduced to 0, cancel the sigdrop
strat->sigdrop = FALSE;
p_Delete(&strat->P.sig,currRing);strat->P.sig = NULL;
}
else
{
strat->enterS(&strat->P, 0, strat, strat->tl);
break;
}
}
p_Delete(&beforetailred,currRing);
// strat->P.p = NULL may appear if we had a sigdrop above and reduced to 0 via redRing
if(strat->P.p == NULL)
goto case_when_red_result_changed;
}
// remove sigsafe label since it is no longer valid for the next element to
// be reduced
if (strat->sbaOrder == 1)
{
for (int jj = 0; jj<strat->tl+1; jj++)
{
if (pGetComp(strat->T[jj].sig) == strat->currIdx)
{
strat->T[jj].is_sigsafe = FALSE;
}
}
}
else
{
for (int jj = 0; jj<strat->tl+1; jj++)
{
strat->T[jj].is_sigsafe = FALSE;
}
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG){PrintS("new s:");strat->P.wrp();PrintLn();}
#endif /* KDEBUG */
// min_std stuff
if ((strat->P.p1==NULL) && (strat->minim>0))
{
if (strat->minim==1)
{
strat->M->m[minimcnt]=p_Copy(strat->P.p,currRing,strat->tailRing);
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
else
{
strat->M->m[minimcnt]=strat->P.p2;
strat->P.p2=NULL;
}
if (strat->tailRing!=currRing && pNext(strat->M->m[minimcnt])!=NULL)
pNext(strat->M->m[minimcnt])
= strat->p_shallow_copy_delete(pNext(strat->M->m[minimcnt]),
strat->tailRing, currRing,
currRing->PolyBin);
minimcnt++;
}
// enter into S, L, and T
//if ((!TEST_OPT_IDLIFT) || (pGetComp(strat->P.p) <= strat->syzComp))
enterT(&strat->P, strat);
strat->T[strat->tl].is_sigsafe = FALSE;
/*
printf("hier\n");
pWrite(strat->P.GetLmCurrRing());
pWrite(strat->P.sig);
*/
if (rField_is_Ring(currRing))
superenterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
else
enterpairsSig(strat->P.p,strat->P.sig,strat->sl+1,strat->sl,strat->P.ecart,pos,strat, strat->tl);
if(rField_is_Ring(currRing) && strat->sigdrop)
break;
if(rField_is_Ring(currRing))
strat->P.sevSig = p_GetShortExpVector(strat->P.sig,currRing);
strat->enterS(&strat->P, pos, strat, strat->tl);
if(strat->sbaOrder != 1)
{
BOOLEAN overwrite = FALSE;
for (int tk=0; tk<strat->sl+1; tk++)
{
if (pGetComp(strat->sig[tk]) == pGetComp(strat->P.sig))
{
//printf("TK %d / %d\n",tk,strat->sl);
overwrite = FALSE;
break;
}
}
//printf("OVERWRITE %d\n",overwrite);
if (overwrite)
{
int cmp = pGetComp(strat->P.sig);
int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
p_GetExpV (strat->P.p,vv,currRing);
p_SetExpV (strat->P.sig, vv,currRing);
p_SetComp (strat->P.sig,cmp,currRing);
strat->P.sevSig = pGetShortExpVector (strat->P.sig);
int i;
LObject Q;
for(int ps=0;ps<strat->sl+1;ps++)
{
strat->newt = TRUE;
if (strat->syzl == strat->syzmax)
{
pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
(strat->syzmax)*sizeof(unsigned long),
((strat->syzmax)+setmaxTinc)
*sizeof(unsigned long));
strat->syzmax += setmaxTinc;
}
Q.sig = pCopy(strat->P.sig);
// add LM(F->m[i]) to the signature to get a Schreyer order
// without changing the underlying polynomial ring at all
if (strat->sbaOrder == 0)
p_ExpVectorAdd (Q.sig,strat->S[ps],currRing);
// since p_Add_q() destroys all input
// data we need to recreate help
// each time
// ----------------------------------------------------------
// in the Schreyer order we always know that the multiplied
// module monomial strat->P.sig gives the leading monomial of
// the corresponding principal syzygy
// => we do not need to compute the "real" syzygy completely
poly help = p_Copy(strat->sig[ps],currRing);
p_ExpVectorAdd (help,strat->P.p,currRing);
Q.sig = p_Add_q(Q.sig,help,currRing);
//printf("%d. SYZ ",i+1);
//pWrite(strat->syz[i]);
Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
i = posInSyz(strat, Q.sig);
enterSyz(Q, strat, i);
}
}
}
// deg - idx - lp/rp
// => we need to add syzygies with indices > pGetComp(strat->P.sig)
if(strat->sbaOrder == 0 || strat->sbaOrder == 3)
{
int cmp = pGetComp(strat->P.sig);
unsigned max_cmp = IDELEMS(F);
int* vv = (int*)omAlloc((currRing->N+1)*sizeof(int));
p_GetExpV (strat->P.p,vv,currRing);
LObject Q;
int pos;
int idx = __p_GetComp(strat->P.sig,currRing);
//printf("++ -- adding syzygies -- ++\n");
// if new element is the first one in this index
if (strat->currIdx < idx)
{
for (int i=0; i<strat->sl; ++i)
{
Q.sig = p_Copy(strat->P.sig,currRing);
p_ExpVectorAdd(Q.sig,strat->S[i],currRing);
poly help = p_Copy(strat->sig[i],currRing);
p_ExpVectorAdd(help,strat->P.p,currRing);
Q.sig = p_Add_q(Q.sig,help,currRing);
//pWrite(Q.sig);
pos = posInSyz(strat, Q.sig);
enterSyz(Q, strat, pos);
}
strat->currIdx = idx;
}
else
{
// if the element is not the first one in the given index we build all
// possible syzygies with elements of higher index
for (unsigned i=cmp+1; i<=max_cmp; ++i)
{
pos = -1;
for (int j=0; j<strat->sl; ++j)
{
if (__p_GetComp(strat->sig[j],currRing) == i)
{
pos = j;
break;
}
}
if (pos != -1)
{
Q.sig = p_One(currRing);
p_SetExpV(Q.sig, vv, currRing);
// F->m[i-1] corresponds to index i
p_ExpVectorAdd(Q.sig,F->m[i-1],currRing);
p_SetComp(Q.sig, i, currRing);
poly help = p_Copy(strat->P.sig,currRing);
p_ExpVectorAdd(help,strat->S[pos],currRing);
Q.sig = p_Add_q(Q.sig,help,currRing);
if (strat->sbaOrder == 0)
{
if (p_LmCmp(Q.sig,strat->syz[strat->syzl-1],currRing) == -currRing->OrdSgn)
{
pos = posInSyz(strat, Q.sig);
enterSyz(Q, strat, pos);
}
}
else
{
pos = posInSyz(strat, Q.sig);
enterSyz(Q, strat, pos);
}
}
}
//printf("++ -- done adding syzygies -- ++\n");
}
}
//#if 1
#if DEBUGF50
printf("---------------------------\n");
Print(" %d. ELEMENT ADDED TO GCURR:\n",strat->sl+1);
PrintS("LEAD POLY: "); pWrite(pHead(strat->S[strat->sl]));
PrintS("SIGNATURE: "); pWrite(strat->sig[strat->sl]);
#endif
/*
if (newrules)
{
newrules = FALSE;
}
*/
#if 0
int pl=pLength(strat->P.p);
if (pl==1)
{
//if (TEST_OPT_PROT)
//PrintS("<1>");
}
else if (pl==2)
{
//if (TEST_OPT_PROT)
//PrintS("<2>");
}
#endif
if (hilb!=NULL) khCheck(Q,w,hilb,hilbeledeg,hilbcount,strat);
// Print("[%d]",hilbeledeg);
kDeleteLcm(&strat->P);
if (strat->sl>srmax) srmax = strat->sl;
}
else
{
case_when_red_result_changed:
// adds signature of the zero reduction to
// strat->syz. This is the leading term of
// syzygy and can be used in syzCriterion()
// the signature is added if and only if the
// pair was not detected by the rewritten criterion in strat->red = redSig
if (red_result!=2)
{
#if SBA_PRINT_ZERO_REDUCTIONS
zeroreductions++;
#endif
if(rField_is_Ring(currRing) && strat->P.p == NULL && strat->P.sig == NULL)
{
//Catch the case when p = 0, sig = 0
}
else
{
int pos = posInSyz(strat, strat->P.sig);
enterSyz(strat->P, strat, pos);
//#if 1
#ifdef DEBUGF5
Print("ADDING STUFF TO SYZ : ");
//pWrite(strat->P.p);
pWrite(strat->P.sig);
#endif
}
}
if (strat->P.p1 == NULL && strat->minim > 0)
{
p_Delete(&strat->P.p2, currRing, strat->tailRing);
}
}
#ifdef KDEBUG
strat->P.Init();
#endif /* KDEBUG */
kTest_TS(strat);
}
#if 0
if(strat->sigdrop)
printf("\nSigDrop!\n");
else
printf("\nEnded with no SigDrop\n");
#endif
// Clean strat->P for the next sba call
if(rField_is_Ring(currRing) && strat->sigdrop)
{
//This is used to know how many elements can we directly add to S in the next run
if(strat->P.sig != NULL)
strat->sbaEnterS = pGetComp(strat->P.sig)-1;
//else we already set it at the beginning of the loop
#ifdef KDEBUG
strat->P.Init();
#endif /* KDEBUG */
}
#ifdef KDEBUG
if (TEST_OPT_DEBUG) messageSets(strat);
#endif /* KDEBUG */
if (TEST_OPT_SB_1)
{
if(!rField_is_Ring(currRing))
{
int k=1;
int j;
while(k<=strat->sl)
{
j=0;
loop
{
if (j>=k) break;
clearS(strat->S[j],strat->sevS[j],&k,&j,strat);
j++;
}
k++;
}
}
}
/* complete reduction of the standard basis--------- */
if (TEST_OPT_REDSB)
{
completeReduce(strat);
if (strat->completeReduce_retry)
{
// completeReduce needed larger exponents, retry
// to reduce with S (instead of T)
// and in currRing (instead of strat->tailRing)
#ifdef HAVE_TAIL_RING
if(currRing->bitmask>strat->tailRing->bitmask)
{
strat->completeReduce_retry=FALSE;
cleanT(strat);strat->tailRing=currRing;
int i;
for(i=strat->sl;i>=0;i--) strat->S_2_R[i]=-1;
completeReduce(strat);
}
if (strat->completeReduce_retry)
#endif
Werror("exponent bound is %ld",currRing->bitmask);
}
}
else if (TEST_OPT_PROT) PrintLn();
#if SBA_PRINT_SIZE_SYZ
// that is correct, syzl is counting one too far
size_syz = strat->syzl;
#endif
// if (TEST_OPT_WEIGHTM)
// {
// pRestoreDegProcs(pFDegOld, pLDegOld);
// if (ecartWeights)
// {
// omFreeSize((ADDRESS)ecartWeights,(pVariables+1)*sizeof(short));
// ecartWeights=NULL;
// }
// }
if (TEST_OPT_PROT) messageStatSBA(hilbcount,strat);
if (Q!=NULL) updateResult(strat->Shdl,Q,strat);
#if SBA_PRINT_SIZE_G
size_g_non_red = IDELEMS(strat->Shdl);
#endif
if(!rField_is_Ring(currRing))
exitSba(strat);
// I have to add the initial input polynomials which where not used (p1 and p2 = NULL)
int k;
if(rField_is_Ring(currRing))
{
//for(k = strat->sl;k>=0;k--)
// {printf("\nS[%i] = %p\n",k,strat->Shdl->m[k]);pWrite(strat->Shdl->m[k]);}
k = strat->Ll;
#if 1
// 1 - adds just the unused ones, 0 - adds everything
for(;k>=0 && (strat->L[k].p1 != NULL || strat->L[k].p2 != NULL);k--)
{
//printf("\nDeleted k = %i, %p\n",k,strat->L[k].p);pWrite(strat->L[k].p);pWrite(strat->L[k].p1);pWrite(strat->L[k].p2);
deleteInL(strat->L,&strat->Ll,k,strat);
}
#endif
//for(int kk = strat->sl;kk>=0;kk--)
// {printf("\nS[%i] = %p\n",kk,strat->Shdl->m[kk]);pWrite(strat->Shdl->m[kk]);}
//idPrint(strat->Shdl);
//printf("\nk = %i\n",k);
for(;k>=0 && strat->L[k].p1 == NULL && strat->L[k].p2 == NULL;k--)
{
//printf("\nAdded k = %i\n",k);
strat->enterS(&strat->L[k], strat->sl+1, strat, strat->tl);
//printf("\nThis elements was added from L on pos %i\n",strat->sl);pWrite(strat->S[strat->sl]);pWrite(strat->sig[strat->sl]);
}
}
// Find the "sigdrop element" and put the same signature as the previous one - do we really need this?? - now i put it on the 0 position - no more comparing needed
#if 0
if(strat->sigdrop && rField_is_Ring(currRing))
{
for(k=strat->sl;k>=0;k--)
{
printf("\nsig[%i] = ",i);pWrite(strat->sig[k]);
if(strat->sig[k] == NULL)
strat->sig[k] = pCopy(strat->sig[k-1]);
}
}
#endif
//Never do this - you will damage S
//idSkipZeroes(strat->Shdl);
//idPrint(strat->Shdl);
if ((strat->sbaOrder == 1 || strat->sbaOrder == 3) && sRing!=currRingOld)
{
rChangeCurrRing (currRingOld);
F0 = idrMoveR (F1, sRing, currRing);
strat->Shdl = idrMoveR_NoSort (strat->Shdl, sRing, currRing);
rChangeCurrRing (sRing);
if(rField_is_Ring(currRing))
exitSba(strat);
rChangeCurrRing (currRingOld);
if(strat->tailRing == sRing)
strat->tailRing = currRing;
rDelete (sRing);
}
if(rField_is_Ring(currRing) && !strat->sigdrop)
id_DelDiv(strat->Shdl, currRing);
if(!rField_is_Ring(currRing))
id_DelDiv(strat->Shdl, currRing);
idSkipZeroes(strat->Shdl);
idTest(strat->Shdl);
#if SBA_PRINT_SIZE_G
size_g = IDELEMS(strat->Shdl);
#endif
#ifdef DEBUGF5
printf("SIZE OF SHDL: %d\n",IDELEMS(strat->Shdl));
int oo = 0;
while (oo<IDELEMS(strat->Shdl))
{
printf(" %d. ",oo+1);
pWrite(pHead(strat->Shdl->m[oo]));
oo++;
}
#endif
#if SBA_PRINT_ZERO_REDUCTIONS
printf("----------------------------------------------------------\n");
printf("ZERO REDUCTIONS: %ld\n",zeroreductions);
zeroreductions = 0;
#endif
#if SBA_PRINT_REDUCTION_STEPS
printf("----------------------------------------------------------\n");
printf("S-REDUCTIONS: %ld\n",sba_reduction_steps);
#endif
#if SBA_PRINT_OPERATIONS
printf("OPERATIONS: %ld\n",sba_operations);
#endif
#if SBA_PRINT_REDUCTION_STEPS
printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
printf("INTERREDUCTIONS: %ld\n",sba_interreduction_steps);
#endif
#if SBA_PRINT_OPERATIONS
printf("INTERREDUCTION OPERATIONS: %ld\n",sba_interreduction_operations);
#endif
#if SBA_PRINT_REDUCTION_STEPS
printf("- - - - - - - - - - - - - - - - - - - - - - - - - - - - - \n");
printf("ALL REDUCTIONS: %ld\n",sba_reduction_steps+sba_interreduction_steps);
sba_interreduction_steps = 0;
sba_reduction_steps = 0;
#endif
#if SBA_PRINT_OPERATIONS
printf("ALL OPERATIONS: %ld\n",sba_operations+sba_interreduction_operations);
sba_interreduction_operations = 0;
sba_operations = 0;
#endif
#if SBA_PRINT_SIZE_G
printf("----------------------------------------------------------\n");
printf("SIZE OF G: %d / %d\n",size_g,size_g_non_red);
size_g = 0;
size_g_non_red = 0;
#endif
#if SBA_PRINT_SIZE_SYZ
printf("SIZE OF SYZ: %ld\n",size_syz);
printf("----------------------------------------------------------\n");
size_syz = 0;
#endif
#if SBA_PRINT_PRODUCT_CRITERION
printf("PRODUCT CRITERIA: %ld\n",product_criterion);
product_criterion = 0;
#endif
return (strat->Shdl);
}
sort
static void sort(int **points, int sizePoints)
Definition cfNewtonPolygon.cc:100
intvec
Definition intvec.h:24
skStrategy::blockredmax
int blockredmax
Definition kutil.h:363
skStrategy::rewCrit2
BOOLEAN(* rewCrit2)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition kutil.h:293
skStrategy::sbaEnterS
int sbaEnterS
Definition kutil.h:360
idInsertPolyOnPos
BOOLEAN idInsertPolyOnPos(ideal I, poly p, int pos)
insert p into I on position pos
Definition simpleideals.cc:851
idSort
static intvec * idSort(ideal id, BOOLEAN nolex=TRUE)
Definition ideals.h:188
kInterRed
ideal kInterRed(ideal F, const ideal Q)
Definition kstd1.cc:3802
initSba
void initSba(ideal F, kStrategy strat)
Definition kstd1.cc:1750
redtailSba
poly redtailSba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition kstd2.cc:1785
f5c
void f5c(kStrategy strat, int &olddeg, int &minimcnt, int &hilbeledeg, int &hilbcount, int &srmax, int &lrmax, int &reduc, ideal Q, intvec *w, bigintmat *hilb)
Definition kstd2.cc:4265
initSbaPos
void initSbaPos(kStrategy strat)
Definition kutil.cc:9863
enterpairsSig
void enterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4513
superenterpairsSig
void superenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
Definition kutil.cc:4470
sbaRing
ring sbaRing(kStrategy strat, const ring r, BOOLEAN, int)
Definition kutil.cc:11064
messageStatSBA
void messageStatSBA(int hilbcount, kStrategy strat)
Definition kutil.cc:7517
initSyzRules
void initSyzRules(kStrategy strat)
Definition kutil.cc:7933
initSbaBuchMora
void initSbaBuchMora(ideal F, ideal Q, kStrategy strat)
Definition kutil.cc:9936
exitSba
void exitSba(kStrategy strat)
Definition kutil.cc:10011
posInIdealMonFirst
int posInIdealMonFirst(const ideal F, const poly p, int start, int end)
Definition kutil.cc:4841
initSbaCrit
void initSbaCrit(kStrategy strat)
Definition kutil.cc:9498
help
#define help
Definition libparse.cc:1230
p_SetExpV
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1565
p_GetExpV
static void p_GetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1541
idrMoveR
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:248
idrMoveR_NoSort
ideal idrMoveR_NoSort(ideal &id, ring src_r, ring dest_r)
Definition prCopy.cc:261
rWrite
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
id_DelDiv
void id_DelDiv(ideal id, const ring r)
delete id[j], if LT(j) == coeff*mon*LT(i) and vice versa, i.e., delete id[i], if LT(i) == coeff*mon*L...
Definition simpleideals.cc:463

## 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;
}
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
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
pp_Mult_mm
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1033

## sbaRing()

ring sbaRing | ( | kStrategy | strat,
|  | const ring | r = currRing,
|  | BOOLEAN | complete = TRUE,
|  | int | sgn = 1 )

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);
}
si_min
static int si_min(const int a, const int b)
Definition auxiliary.h:126
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

## superenterpairs()

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

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

## superenterpairsShift()

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

## superenterpairsSig()

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

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
}
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
cancelunit1
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition kutil.cc:8402
reorderS
void reorderS(int *suc, kStrategy strat)
Definition kutil.cc:4610

## Variable Documentation

## DENOMINATOR_LIST

EXTERN_VAR denominator_list DENOMINATOR_LIST

Definition at line 67 of file kutil.h.

## HCord

EXTERN_VAR int HCord

Definition at line 270 of file kutil.h.

## strat_nr

EXTERN_VAR int strat_nr

Definition at line 182 of file kutil.h.