Macros | Functions | Variables
kutil.cc File Reference
#include <kernel/mod2.h>
#include <misc/mylimits.h>
#include <misc/options.h>
#include <polys/nc/nc.h>
#include <polys/nc/sca.h>
#include <polys/weight.h>
#include <stdlib.h>
#include <string.h>
#include <kernel/ideals.h>
#include <kernel/GBEngine/kutil.h>
#include <polys/kbuckets.h>
#include <omalloc/omalloc.h>
#include <coeffs/numbers.h>
#include <kernel/polys.h>
#include <polys/monomials/ring.h>
#include <kernel/combinatorics/stairc.h>
#include <kernel/GBEngine/kstd1.h>
#include <polys/operations/pShallowCopyDelete.h>
#include <kernel/GBEngine/shiftgb.h>
#include <polys/prCopy.h>
#include <kernel/GBEngine/ratgring.h>

Go to the source code of this file.

Macros

#define KUTIL_CC
 
#define MYTEST   0
 
#define ALL_VS_JUST   0
 
#define EXT_POLY_NEW   0
 
#define KDEBUG   2
 
#define ENTER_USE_MEMMOVE
 
#define pDivComp_EQUAL   2
 
#define pDivComp_LESS   1
 
#define pDivComp_GREATER   -1
 
#define pDivComp_INCOMP   0
 
#define REDTAIL_CANONICALIZE   100
 
#define REDTAIL_CANONICALIZE   100
 

Functions

static poly redMora (poly h, int maxIndex, kStrategy strat)
 
static poly redBba (poly h, int maxIndex, kStrategy strat)
 
static int pDivCompRing (poly p, poly q)
 
static int pDivComp (poly p, poly q)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext)
 
void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void cancelunit (LObject *L, BOOLEAN inNF)
 
void HEckeTest (poly pp, kStrategy strat)
 
static intset initec (const int maxnr)
 
static unsigned long * initsevS (const int maxnr)
 
static int * initS_2_R (const int maxnr)
 
static void enlargeT (TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
 
void cleanT (kStrategy strat)
 
void cleanTSbaRing (kStrategy strat)
 
static void enlargeL (LSet *L, int *length, const int incr)
 
void initPairtest (kStrategy strat)
 
BOOLEAN isInPairsetL (int length, poly p1, poly p2, int *k, kStrategy strat)
 
BOOLEAN isInPairsetB (poly q, int *k, kStrategy strat)
 
int kFindInT (poly p, TSet T, int tlength)
 returns index of p in TSet, or -1 if not found More...
 
int kFindInT (poly p, kStrategy strat)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
void initEcartPairBba (LObject *Lp, poly, poly, int, int)
 
void initEcartPairMora (LObject *Lp, poly, poly, int ecartF, int ecartG)
 
static BOOLEAN sugarDivisibleBy (int ecart1, int ecart2)
 
static void enterOnePairRing (int i, poly p, int, int isFromQ, kStrategy strat, int atR)
 
static BOOLEAN enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
 
BOOLEAN sbaCheckGcdPair (LObject *h, kStrategy strat)
 
static BOOLEAN enterOneStrongPolySig (int i, poly p, poly sig, int, int, kStrategy strat, int atR)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static BOOLEAN p_HasNotCF_Lift (poly p1, poly p2, const ring r)
 p_HasNotCF for the IDLIFT case: ignore component More...
 
static void enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static void enterOnePairSig (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static void enterOnePairSigRing (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSpecial (int i, poly p, int ecart, kStrategy strat, int atR=-1)
 
void kMergeBintoL (kStrategy strat)
 
void kMergeBintoLSba (kStrategy strat)
 
void chainCritNormal (poly p, int ecart, kStrategy strat)
 
void chainCritOpt_1 (poly, int, kStrategy strat)
 
void chainCritSig (poly p, int, kStrategy strat)
 
void chainCritPart (poly p, int ecart, kStrategy strat)
 
void initenterpairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSigRing (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void chainCritRing (poly p, int, kStrategy strat)
 
long ind2 (long arg)
 
long ind_fact_2 (long arg)
 
long twoPow (long arg)
 
void enterOneZeroPairRing (poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
 
int nextZeroSimplexExponent (long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
 
poly kCreateZeroPoly (long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
 
void initenterzeropairsRing (poly p, int ecart, kStrategy strat, int atR)
 
ideal createG0 ()
 
void initenterstrongPairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static void initenterstrongPairsSig (poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
 
void clearSbatch (poly h, int k, int pos, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSpecial (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
void reorderS (int *suc, kStrategy strat)
 
int posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInSMonFirst (const kStrategy strat, const int length, const poly p)
 
int posInIdealMonFirst (const ideal F, const poly p, int start, int end)
 
int posInT0 (const TSet, const int length, LObject &)
 
int posInT1 (const TSet set, const int length, LObject &p)
 
int posInT2 (const TSet set, const int length, LObject &p)
 
int posInT11 (const TSet set, const int length, LObject &p)
 
int posInT11Ring (const TSet set, const int length, LObject &p)
 
int posInTrg0 (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT110Ring (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT15Ring (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17Ring (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT17_cRing (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInLSpecial (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSig (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSigRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInSyz (const kStrategy strat, poly sig)
 
int posInLF5C (const LSet, const int, LObject *, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL11Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *p, const kStrategy)
 
int posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy)
 
int getIndexRng (long coeff)
 
int posInLrg0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL13 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_c (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_cRing (const LSet set, const int length, LObject *p, const kStrategy)
 
BOOLEAN syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN faugereRewCriterion (poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterion (poly, unsigned long, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
 
TObjectkFindDivisibleByInS (kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
 
poly redtail (LObject *L, int pos, kStrategy strat)
 
poly redtail (poly p, int pos, kStrategy strat)
 
poly redtailBba (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
poly redtailBbaBound (LObject *L, int pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize)
 
poly redtailBba_Z (LObject *L, int pos, kStrategy strat)
 
void message (int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
 
void messageStat (int hilbcount, kStrategy strat)
 
void messageStatSBA (int hilbcount, kStrategy strat)
 
void initS (ideal F, ideal Q, kStrategy strat)
 
void initSL (ideal F, ideal Q, kStrategy strat)
 
void initSLSba (ideal F, ideal Q, kStrategy strat)
 
void initSyzRules (kStrategy strat)
 
void initSSpecial (ideal F, ideal Q, ideal P, kStrategy strat)
 
void initSSpecialSba (ideal F, ideal Q, ideal P, kStrategy strat)
 
static poly redBba1 (poly h, int maxIndex, kStrategy strat)
 
void cancelunit1 (LObject *p, int *suc, int index, kStrategy strat)
 
void updateS (BOOLEAN toT, kStrategy strat)
 
void enterSBba (LObject &p, int atS, kStrategy strat, int atR)
 
void enterSSba (LObject &p, int atS, kStrategy strat, int atR)
 
void enterT (LObject &p, kStrategy strat, int atT)
 
void enterT_strong (LObject &p, kStrategy strat, int atT)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void initHilbCrit (ideal, ideal, intvec **hilb, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
BOOLEAN kPosInLDependsOnLength (int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
 
void initBuchMoraPos (kStrategy strat)
 
void initBuchMoraPosRing (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT)
 
BOOLEAN newHEdge (kStrategy strat)
 
BOOLEAN kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
 
BOOLEAN kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
 
poly preIntegerCheck (const ideal Forig, const ideal Q)
 used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
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 More...
 
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 More...
 
BOOLEAN kStratChangeTailRing (kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
 
void kStratInitChangeTailRing (kStrategy strat)
 
ring sbaRing (kStrategy strat, const ring r, BOOLEAN, int)
 
int posInT_EcartFDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_FDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_pLength (const TSet set, const int length, LObject &p)
 
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)
 
char * showOption ()
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject H, kStrategy strat)
 
void updateSShift (kStrategy strat, int uptodeg, int lV)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
static void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
 
void enterOnePairShift (poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int, int lV)
 
void initenterpairsShift (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
 
void enterTShift (LObject p, kStrategy strat, int atT, int uptodeg, int lV)
 
poly redtailBbaShift (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 

Variables

denominator_list DENOMINATOR_LIST =NULL
 
int HCord
 
int Kstd1_deg
 
int Kstd1_mu =32000
 

Macro Definition Documentation

◆ ALL_VS_JUST

#define ALL_VS_JUST   0

Definition at line 18 of file kutil.cc.

◆ ENTER_USE_MEMMOVE

#define ENTER_USE_MEMMOVE

Definition at line 52 of file kutil.cc.

◆ EXT_POLY_NEW

#define EXT_POLY_NEW   0

Definition at line 22 of file kutil.cc.

◆ KDEBUG

#define KDEBUG   2

Definition at line 37 of file kutil.cc.

◆ KUTIL_CC

#define KUTIL_CC

Definition at line 10 of file kutil.cc.

◆ MYTEST

#define MYTEST   0

Definition at line 12 of file kutil.cc.

◆ pDivComp_EQUAL

#define pDivComp_EQUAL   2

Definition at line 140 of file kutil.cc.

◆ pDivComp_GREATER

#define pDivComp_GREATER   -1

Definition at line 142 of file kutil.cc.

◆ pDivComp_INCOMP

#define pDivComp_INCOMP   0

Definition at line 143 of file kutil.cc.

◆ pDivComp_LESS

#define pDivComp_LESS   1

Definition at line 141 of file kutil.cc.

◆ REDTAIL_CANONICALIZE [1/2]

#define REDTAIL_CANONICALIZE   100

◆ REDTAIL_CANONICALIZE [2/2]

#define REDTAIL_CANONICALIZE   100

Function Documentation

◆ arriRewCriterion()

BOOLEAN arriRewCriterion ( poly  ,
unsigned long  ,
poly  ,
kStrategy  strat,
int  start = 0 
)

Definition at line 7290 of file kutil.cc.

7291 {
7292  #ifdef ADIDEBUG
7293  printf("\narriRewCrit\n");
7294  #endif
7296  return FALSE;
7297  poly p1 = pOne();
7298  poly p2 = pOne();
7299  for (int ii=strat->sl; ii>start; ii--)
7300  {
7301  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7302  {
7303  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7304  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7305  if (!(pLmCmp(p1,p2) == 1))
7306  {
7307  #ifdef ADIDEBUG
7308  printf("\narriRewCrit deleted: sig, P.sig\n");
7309  #endif
7310  pDelete(&p1);
7311  pDelete(&p2);
7312  return TRUE;
7313  }
7314  }
7315  }
7316  pDelete(&p1);
7317  pDelete(&p2);
7318  return FALSE;
7319 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:98
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
LObject P
Definition: kutil.h:296
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:344
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10

◆ arriRewCriterionPre()

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

Definition at line 7321 of file kutil.cc.

7322 {
7323  #ifdef ADIDEBUG
7324  printf("\narriRewCritPre\n");
7325  #endif
7326  //Over Rings, there are still some changes to do: considering coeffs
7328  return FALSE;
7329  int found = -1;
7330  for (int i=strat->Bl; i>-1; i--) {
7331  if (pLmEqual(strat->B[i].sig,sig))
7332  {
7333  found = i;
7334  break;
7335  }
7336  }
7337  if (found != -1)
7338  {
7339  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7340  {
7341  deleteInL(strat->B,&strat->Bl,found,strat);
7342  #ifdef ADIDEBUG
7343  printf("\nDelete!\n");
7344  #endif
7345  }
7346  else
7347  {
7348  #ifdef ADIDEBUG
7349  printf("\nDelete this one!\n");
7350  #endif
7351  return TRUE;
7352  }
7353  }
7354  poly p1 = pOne();
7355  poly p2 = pOne();
7356  for (int ii=strat->sl; ii>-1; ii--)
7357  {
7358  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7359  {
7360  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7361  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7362  if (!(pLmCmp(p1,p2) == 1))
7363  {
7364  pDelete(&p1);
7365  pDelete(&p2);
7366  #ifdef ADIDEBUG
7367  printf("\nDelete this one!\n");
7368  #endif
7369  return TRUE;
7370  }
7371  }
7372  }
7373  pDelete(&p1);
7374  pDelete(&p2);
7375  return FALSE;
7376 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int Bl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
LSet B
Definition: kutil.h:322
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:344
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10
#define pLmEqual(p1, p2)
Definition: polys.h:111

◆ cancelunit()

void cancelunit ( LObject L,
BOOLEAN  inNF 
)

Definition at line 332 of file kutil.cc.

333 {
334  int i;
335  poly h;
336  number lc;
337 
338  if(rHasGlobalOrdering (currRing)) return;
339  if(TEST_OPT_CANCELUNIT) return;
340 
341  ring r = L->tailRing;
342  poly p = L->GetLmTailRing();
343 
344  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
345  lc = pGetCoeff(p);
346  #ifdef ADIDEBUG
347  printf("\n cancelunit\n");
348  pWrite(p);
349  #endif
350 #ifdef HAVE_RINGS
351  // Leading coef have to be a unit
352  // example 2x+4x2 should be simplified to 2x*(1+2x)
353  // and 2 is not a unit in Z
354  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
355 #endif
356 
357  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
358 
359 // for(i=r->N;i>0;i--)
360 // {
361 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
362 // }
363  h = pNext(p);
364 
366  {
367  loop
368  {
369  if (h==NULL)
370  {
371  p_Delete(&pNext(p), r);
372  if (!inNF)
373  {
374  number eins= nCopy(lc);
375  if (L->p != NULL)
376  {
377  pSetCoeff(L->p,eins);
378  if (L->t_p != NULL)
379  pSetCoeff0(L->t_p,eins);
380  }
381  else
382  pSetCoeff(L->t_p,eins);
383  /* p and t_p share the same coeff, if both are !=NULL */
384  /* p==NULL==t_p cannot happen here */
385  }
386  L->ecart = 0;
387  L->length = 1;
388  //if (L->pLength > 0)
389  L->pLength = 1;
390  L->max_exp = NULL;
391 
392  if (L->t_p != NULL && pNext(L->t_p) != NULL)
393  p_Delete(&pNext(L->t_p),r);
394  if (L->p != NULL && pNext(L->p) != NULL)
395  pNext(L->p) = NULL;
396 
397  return;
398  }
399  i = rVar(r);
400  loop
401  {
402  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
403  i--;
404  if (i == 0) break; // does divide, try next monom
405  }
406  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
407  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
408  // domains), no zerodivisor test needed CAUTION
409  #ifdef ADIDEBUG
410  pWrite(h);
411  #endif
412  if (!n_DivBy(pGetCoeff(h),lc,r->cf))
413  {
414  #ifdef ADIDEBUG
415  printf("\nDoes not divide\n");
416  #endif
417  return;
418  }
419  #ifdef ADIDEBUG
420  printf("\nDivides. Go On\n");
421  #endif
422  pIter(h);
423  }
424  }
425  else
426  {
427  loop
428  {
429  if (h==NULL)
430  {
431  p_Delete(&pNext(p), r);
432  if (!inNF)
433  {
434  number eins=nInit(1);
435  if (L->p != NULL)
436  {
437  pSetCoeff(L->p,eins);
438  if (L->t_p != NULL)
439  pSetCoeff0(L->t_p,eins);
440  }
441  else
442  pSetCoeff(L->t_p,eins);
443  /* p and t_p share the same coeff, if both are !=NULL */
444  /* p==NULL==t_p cannot happen here */
445  }
446  L->ecart = 0;
447  L->length = 1;
448  //if (L->pLength > 0)
449  L->pLength = 1;
450  L->max_exp = NULL;
451 
452  if (L->t_p != NULL && pNext(L->t_p) != NULL)
453  p_Delete(&pNext(L->t_p),r);
454  if (L->p != NULL && pNext(L->p) != NULL)
455  pNext(L->p) = NULL;
456 
457  return;
458  }
459  i = rVar(r);
460  loop
461  {
462  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return; // does not divide
463  i--;
464  if (i == 0) break; // does divide, try next monom
465  }
466  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
467  pIter(h);
468  }
469  }
470 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
CanonicalForm lc(const CanonicalForm &f)
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_CANCELUNIT
Definition: options.h:122
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1207

◆ cancelunit1()

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

Definition at line 8869 of file kutil.cc.

8870 {
8871  int k;
8872  poly r,h,h1,q;
8873 
8874  if (!pIsVector((*p).p) && ((*p).ecart != 0))
8875  {
8876 #ifdef HAVE_RINGS
8877  // Leading coef have to be a unit: no
8878  // example 2x+4x2 should be simplified to 2x*(1+2x)
8879  // and 2 is not a unit in Z
8880  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
8881 #endif
8882  k = 0;
8883  h1 = r = pCopy((*p).p);
8884  h =pNext(r);
8885  loop
8886  {
8887  if (h==NULL)
8888  {
8889  pDelete(&r);
8890  pDelete(&(pNext((*p).p)));
8891  (*p).ecart = 0;
8892  (*p).length = 1;
8893  (*p).pLength = 1;
8894  (*suc)=0;
8895  return;
8896  }
8897  if (!pDivisibleBy(r,h))
8898  {
8899  q=redBba1(h,index ,strat);
8900  if (q != h)
8901  {
8902  k++;
8903  pDelete(&h);
8904  pNext(h1) = h = q;
8905  }
8906  else
8907  {
8908  pDelete(&r);
8909  return;
8910  }
8911  }
8912  else
8913  {
8914  h1 = h;
8915  pIter(h);
8916  }
8917  if (k > 10)
8918  {
8919  pDelete(&r);
8920  return;
8921  }
8922  }
8923  }
8924 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8852
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
#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:138
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define pIsVector(p)
Definition: polys.h:233

◆ chainCritNormal()

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

Definition at line 3270 of file kutil.cc.

3271 {
3272  int i,j,l;
3273 
3274  /*
3275  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3276  *In this case all elements in B such
3277  *that their lcm is divisible by the leading term of S[i] can be canceled
3278  */
3279  if (strat->pairtest!=NULL)
3280  {
3281  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3282  for (j=0; j<=strat->sl; j++)
3283  {
3284  if (strat->pairtest[j])
3285  {
3286  for (i=strat->Bl; i>=0; i--)
3287  {
3288  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3289  {
3290  deleteInL(strat->B,&strat->Bl,i,strat);
3291  strat->c3++;
3292  }
3293  }
3294  }
3295  }
3296  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3297  strat->pairtest=NULL;
3298  }
3299  if (strat->Gebauer || strat->fromT)
3300  {
3301  if (strat->sugarCrit)
3302  {
3303  /*
3304  *suppose L[j] == (s,r) and p/lcm(s,r)
3305  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3306  *and in case the sugar is o.k. then L[j] can be canceled
3307  */
3308  for (j=strat->Ll; j>=0; j--)
3309  {
3310  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3311  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3312  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3313  {
3314  if (strat->L[j].p == strat->tail)
3315  {
3316  deleteInL(strat->L,&strat->Ll,j,strat);
3317  strat->c3++;
3318  }
3319  }
3320  }
3321  /*
3322  *this is GEBAUER-MOELLER:
3323  *in B all elements with the same lcm except the "best"
3324  *(i.e. the last one in B with this property) will be canceled
3325  */
3326  j = strat->Bl;
3327  loop /*cannot be changed into a for !!! */
3328  {
3329  if (j <= 0) break;
3330  i = j-1;
3331  loop
3332  {
3333  if (i < 0) break;
3334  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3335  {
3336  strat->c3++;
3337  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3338  {
3339  deleteInL(strat->B,&strat->Bl,i,strat);
3340  j--;
3341  }
3342  else
3343  {
3344  deleteInL(strat->B,&strat->Bl,j,strat);
3345  break;
3346  }
3347  }
3348  i--;
3349  }
3350  j--;
3351  }
3352  }
3353  else /*sugarCrit*/
3354  {
3355  /*
3356  *suppose L[j] == (s,r) and p/lcm(s,r)
3357  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3358  *and in case the sugar is o.k. then L[j] can be canceled
3359  */
3360  for (j=strat->Ll; j>=0; j--)
3361  {
3362  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3363  {
3364  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3365  {
3366  deleteInL(strat->L,&strat->Ll,j,strat);
3367  strat->c3++;
3368  }
3369  }
3370  }
3371  /*
3372  *this is GEBAUER-MOELLER:
3373  *in B all elements with the same lcm except the "best"
3374  *(i.e. the last one in B with this property) will be canceled
3375  */
3376  j = strat->Bl;
3377  loop /*cannot be changed into a for !!! */
3378  {
3379  if (j <= 0) break;
3380  for(i=j-1; i>=0; i--)
3381  {
3382  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3383  {
3384  strat->c3++;
3385  deleteInL(strat->B,&strat->Bl,i,strat);
3386  j--;
3387  }
3388  }
3389  j--;
3390  }
3391  }
3392  /*
3393  *the elements of B enter L
3394  */
3395  kMergeBintoL(strat);
3396  }
3397  else
3398  {
3399  for (j=strat->Ll; j>=0; j--)
3400  {
3401  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3402  {
3403  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3404  {
3405  deleteInL(strat->L,&strat->Ll,j,strat);
3406  strat->c3++;
3407  }
3408  }
3409  }
3410  /*
3411  *this is our MODIFICATION of GEBAUER-MOELLER:
3412  *First the elements of B enter L,
3413  *then we fix a lcm and the "best" element in L
3414  *(i.e the last in L with this lcm and of type (s,p))
3415  *and cancel all the other elements of type (r,p) with this lcm
3416  *except the case the element (s,r) has also the same lcm
3417  *and is on the worst position with respect to (s,p) and (r,p)
3418  */
3419  /*
3420  *B enters to L/their order with respect to B is permutated for elements
3421  *B[i].p with the same leading term
3422  */
3423  kMergeBintoL(strat);
3424  j = strat->Ll;
3425  loop /*cannot be changed into a for !!! */
3426  {
3427  if (j <= 0)
3428  {
3429  /*now L[0] cannot be canceled any more and the tail can be removed*/
3430  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3431  break;
3432  }
3433  if (strat->L[j].p2 == p)
3434  {
3435  i = j-1;
3436  loop
3437  {
3438  if (i < 0) break;
3439  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3440  {
3441  /*L[i] could be canceled but we search for a better one to cancel*/
3442  strat->c3++;
3443  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3444  && (pNext(strat->L[l].p) == strat->tail)
3445  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3446  && pDivisibleBy(p,strat->L[l].lcm))
3447  {
3448  /*
3449  *"NOT equal(...)" because in case of "equal" the element L[l]
3450  *is "older" and has to be from theoretical point of view behind
3451  *L[i], but we do not want to reorder L
3452  */
3453  strat->L[i].p2 = strat->tail;
3454  /*
3455  *L[l] will be canceled, we cannot cancel L[i] later on,
3456  *so we mark it with "tail"
3457  */
3458  deleteInL(strat->L,&strat->Ll,l,strat);
3459  i--;
3460  }
3461  else
3462  {
3463  deleteInL(strat->L,&strat->Ll,i,strat);
3464  }
3465  j--;
3466  }
3467  i--;
3468  }
3469  }
3470  else if (strat->L[j].p2 == strat->tail)
3471  {
3472  /*now L[j] cannot be canceled any more and the tail can be removed*/
3473  strat->L[j].p2 = p;
3474  }
3475  j--;
3476  }
3477  }
3478 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:681
BOOLEAN Gebauer
Definition: kutil.h:375
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:20
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
BOOLEAN sugarCrit
Definition: kutil.h:374
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
#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:138
LSet B
Definition: kutil.h:322
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ chainCritOpt_1()

void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 3483 of file kutil.cc.

3484 {
3485  if (strat->pairtest!=NULL)
3486  {
3487  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3488  strat->pairtest=NULL;
3489  }
3490  /*
3491  *the elements of B enter L
3492  */
3493  kMergeBintoL(strat);
3494 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:329
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
int BOOLEAN
Definition: auxiliary.h:85

◆ chainCritPart()

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

Definition at line 3558 of file kutil.cc.

3559 {
3560  int i,j,l;
3561 
3562  /*
3563  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3564  *In this case all elements in B such
3565  *that their lcm is divisible by the leading term of S[i] can be canceled
3566  */
3567  if (strat->pairtest!=NULL)
3568  {
3569  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3570  for (j=0; j<=strat->sl; j++)
3571  {
3572  if (strat->pairtest[j])
3573  {
3574  for (i=strat->Bl; i>=0; i--)
3575  {
3576  if (_p_LmDivisibleByPart(strat->S[j],currRing,
3577  strat->B[i].lcm,currRing,
3578  currRing->real_var_start,currRing->real_var_end))
3579  {
3580  if(TEST_OPT_DEBUG)
3581  {
3582  Print("chain-crit-part: S[%d]=",j);
3583  p_wrp(strat->S[j],currRing);
3584  Print(" divide B[%d].lcm=",i);
3585  p_wrp(strat->B[i].lcm,currRing);
3586  PrintLn();
3587  }
3588  deleteInL(strat->B,&strat->Bl,i,strat);
3589  strat->c3++;
3590  }
3591  }
3592  }
3593  }
3594  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3595  strat->pairtest=NULL;
3596  }
3597  if (strat->Gebauer || strat->fromT)
3598  {
3599  if (strat->sugarCrit)
3600  {
3601  /*
3602  *suppose L[j] == (s,r) and p/lcm(s,r)
3603  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3604  *and in case the sugar is o.k. then L[j] can be canceled
3605  */
3606  for (j=strat->Ll; j>=0; j--)
3607  {
3608  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3609  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3610  && pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3611  {
3612  if (strat->L[j].p == strat->tail)
3613  {
3614  if(TEST_OPT_DEBUG)
3615  {
3616  PrintS("chain-crit-part: pCompareChainPart p=");
3617  p_wrp(p,currRing);
3618  Print(" delete L[%d]",j);
3619  p_wrp(strat->L[j].lcm,currRing);
3620  PrintLn();
3621  }
3622  deleteInL(strat->L,&strat->Ll,j,strat);
3623  strat->c3++;
3624  }
3625  }
3626  }
3627  /*
3628  *this is GEBAUER-MOELLER:
3629  *in B all elements with the same lcm except the "best"
3630  *(i.e. the last one in B with this property) will be canceled
3631  */
3632  j = strat->Bl;
3633  loop /*cannot be changed into a for !!! */
3634  {
3635  if (j <= 0) break;
3636  i = j-1;
3637  loop
3638  {
3639  if (i < 0) break;
3640  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3641  {
3642  strat->c3++;
3643  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3644  {
3645  if(TEST_OPT_DEBUG)
3646  {
3647  Print("chain-crit-part: sugar B[%d].lcm=",j);
3648  p_wrp(strat->B[j].lcm,currRing);
3649  Print(" delete B[%d]",i);
3650  p_wrp(strat->B[i].lcm,currRing);
3651  PrintLn();
3652  }
3653  deleteInL(strat->B,&strat->Bl,i,strat);
3654  j--;
3655  }
3656  else
3657  {
3658  if(TEST_OPT_DEBUG)
3659  {
3660  Print("chain-crit-part: sugar B[%d].lcm=",i);
3661  p_wrp(strat->B[i].lcm,currRing);
3662  Print(" delete B[%d]",j);
3663  p_wrp(strat->B[j].lcm,currRing);
3664  PrintLn();
3665  }
3666  deleteInL(strat->B,&strat->Bl,j,strat);
3667  break;
3668  }
3669  }
3670  i--;
3671  }
3672  j--;
3673  }
3674  }
3675  else /*sugarCrit*/
3676  {
3677  /*
3678  *suppose L[j] == (s,r) and p/lcm(s,r)
3679  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3680  *and in case the sugar is o.k. then L[j] can be canceled
3681  */
3682  for (j=strat->Ll; j>=0; j--)
3683  {
3684  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3685  {
3686  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3687  {
3688  if(TEST_OPT_DEBUG)
3689  {
3690  PrintS("chain-crit-part: sugar:pCompareChainPart p=");
3691  p_wrp(p,currRing);
3692  Print(" delete L[%d]",j);
3693  p_wrp(strat->L[j].lcm,currRing);
3694  PrintLn();
3695  }
3696  deleteInL(strat->L,&strat->Ll,j,strat);
3697  strat->c3++;
3698  }
3699  }
3700  }
3701  /*
3702  *this is GEBAUER-MOELLER:
3703  *in B all elements with the same lcm except the "best"
3704  *(i.e. the last one in B with this property) will be canceled
3705  */
3706  j = strat->Bl;
3707  loop /*cannot be changed into a for !!! */
3708  {
3709  if (j <= 0) break;
3710  for(i=j-1; i>=0; i--)
3711  {
3712  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3713  {
3714  if(TEST_OPT_DEBUG)
3715  {
3716  Print("chain-crit-part: equal lcm B[%d].lcm=",j);
3717  p_wrp(strat->B[j].lcm,currRing);
3718  Print(" delete B[%d]\n",i);
3719  }
3720  strat->c3++;
3721  deleteInL(strat->B,&strat->Bl,i,strat);
3722  j--;
3723  }
3724  }
3725  j--;
3726  }
3727  }
3728  /*
3729  *the elements of B enter L
3730  */
3731  kMergeBintoL(strat);
3732  }
3733  else
3734  {
3735  for (j=strat->Ll; j>=0; j--)
3736  {
3737  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3738  {
3739  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3740  {
3741  if(TEST_OPT_DEBUG)
3742  {
3743  PrintS("chain-crit-part: pCompareChainPart p=");
3744  p_wrp(p,currRing);
3745  Print(" delete L[%d]",j);
3746  p_wrp(strat->L[j].lcm,currRing);
3747  PrintLn();
3748  }
3749  deleteInL(strat->L,&strat->Ll,j,strat);
3750  strat->c3++;
3751  }
3752  }
3753  }
3754  /*
3755  *this is our MODIFICATION of GEBAUER-MOELLER:
3756  *First the elements of B enter L,
3757  *then we fix a lcm and the "best" element in L
3758  *(i.e the last in L with this lcm and of type (s,p))
3759  *and cancel all the other elements of type (r,p) with this lcm
3760  *except the case the element (s,r) has also the same lcm
3761  *and is on the worst position with respect to (s,p) and (r,p)
3762  */
3763  /*
3764  *B enters to L/their order with respect to B is permutated for elements
3765  *B[i].p with the same leading term
3766  */
3767  kMergeBintoL(strat);
3768  j = strat->Ll;
3769  loop /*cannot be changed into a for !!! */
3770  {
3771  if (j <= 0)
3772  {
3773  /*now L[0] cannot be canceled any more and the tail can be removed*/
3774  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3775  break;
3776  }
3777  if (strat->L[j].p2 == p)
3778  {
3779  i = j-1;
3780  loop
3781  {
3782  if (i < 0) break;
3783  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3784  {
3785  /*L[i] could be canceled but we search for a better one to cancel*/
3786  strat->c3++;
3787  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3788  && (pNext(strat->L[l].p) == strat->tail)
3789  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3791  strat->L[l].lcm,currRing,
3792  currRing->real_var_start, currRing->real_var_end))
3793 
3794  {
3795  /*
3796  *"NOT equal(...)" because in case of "equal" the element L[l]
3797  *is "older" and has to be from theoretical point of view behind
3798  *L[i], but we do not want to reorder L
3799  */
3800  strat->L[i].p2 = strat->tail;
3801  /*
3802  *L[l] will be canceled, we cannot cancel L[i] later on,
3803  *so we mark it with "tail"
3804  */
3805  if(TEST_OPT_DEBUG)
3806  {
3807  PrintS("chain-crit-part: divisible_by p=");
3808  p_wrp(p,currRing);
3809  Print(" delete L[%d]",l);
3810  p_wrp(strat->L[l].lcm,currRing);
3811  PrintLn();
3812  }
3813  deleteInL(strat->L,&strat->Ll,l,strat);
3814  i--;
3815  }
3816  else
3817  {
3818  if(TEST_OPT_DEBUG)
3819  {
3820  PrintS("chain-crit-part: divisible_by(2) p=");
3821  p_wrp(p,currRing);
3822  Print(" delete L[%d]",i);
3823  p_wrp(strat->L[i].lcm,currRing);
3824  PrintLn();
3825  }
3826  deleteInL(strat->L,&strat->Ll,i,strat);
3827  }
3828  j--;
3829  }
3830  i--;
3831  }
3832  }
3833  else if (strat->L[j].p2 == strat->tail)
3834  {
3835  /*now L[j] cannot be canceled any more and the tail can be removed*/
3836  strat->L[j].p2 = p;
3837  }
3838  j--;
3839  }
3840  }
3841 }
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
#define TEST_OPT_DEBUG
Definition: options.h:103
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:681
BOOLEAN Gebauer
Definition: kutil.h:375
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
BOOLEAN sugarCrit
Definition: kutil.h:374
static BOOLEAN _p_LmDivisibleByPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition: p_polys.h:1727
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
int BOOLEAN
Definition: auxiliary.h:85
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
BOOLEAN pCompareChainPart(poly p, poly p1, poly p2, poly lcm, const ring R)
Definition: kpolys.cc:74

◆ chainCritRing()

void chainCritRing ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 4040 of file kutil.cc.

4041 {
4042  int i,j,l;
4043  /*
4044  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
4045  *In this case all elements in B such
4046  *that their lcm is divisible by the leading term of S[i] can be canceled
4047  */
4048  if (strat->pairtest!=NULL)
4049  {
4050  {
4051  /*- i.e. there is an i with pairtest[i]==TRUE -*/
4052  for (j=0; j<=strat->sl; j++)
4053  {
4054  if (strat->pairtest[j])
4055  {
4056  for (i=strat->Bl; i>=0; i--)
4057  {
4058  if (pDivisibleBy(strat->S[j],strat->B[i].lcm) && n_DivBy(pGetCoeff(strat->B[i].lcm), pGetCoeff(strat->S[j]),currRing->cf))
4059  {
4060 #ifdef KDEBUG
4061  if (TEST_OPT_DEBUG)
4062  {
4063  PrintS("--- chain criterion func chainCritRing type 1\n");
4064  PrintS("strat->S[j]:");
4065  wrp(strat->S[j]);
4066  PrintS(" strat->B[i].lcm:");
4067  wrp(strat->B[i].lcm);PrintLn();
4068  pWrite(strat->B[i].p);
4069  pWrite(strat->B[i].p1);
4070  pWrite(strat->B[i].p2);
4071  wrp(strat->B[i].lcm);
4072  PrintLn();
4073  }
4074 #endif
4075  #ifdef ADIDEBUG
4076  printf("\nChainCrit1\n");
4077  pWrite(strat->B[i].p);
4078  pWrite(strat->B[i].p1);
4079  pWrite(strat->B[i].p2);
4080  #endif
4081  deleteInL(strat->B,&strat->Bl,i,strat);
4082  strat->c3++;
4083  }
4084  }
4085  }
4086  }
4087  }
4088  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
4089  strat->pairtest=NULL;
4090  }
4091  assume(!(strat->Gebauer || strat->fromT));
4092  for (j=strat->Ll; j>=0; j--)
4093  {
4094  if ((strat->L[j].lcm != NULL) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(p), currRing->cf))
4095  {
4096  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
4097  {
4098  if ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
4099  {
4100  #ifdef ADIDEBUG
4101  printf("\nChainCrit2\n");
4102  pWrite(strat->L[j].p);
4103  pWrite(strat->L[j].p1);
4104  pWrite(strat->L[j].p2);
4105  #endif
4106  deleteInL(strat->L,&strat->Ll,j,strat);
4107  strat->c3++;
4108 #ifdef KDEBUG
4109  if (TEST_OPT_DEBUG)
4110  {
4111  PrintS("--- chain criterion func chainCritRing type 2\n");
4112  PrintS("strat->L[j].p:");
4113  wrp(strat->L[j].p);
4114  PrintS(" p:");
4115  wrp(p);
4116  PrintLn();
4117  }
4118 #endif
4119  }
4120  }
4121  }
4122  }
4123  /*
4124  *this is our MODIFICATION of GEBAUER-MOELLER:
4125  *First the elements of B enter L,
4126  *then we fix a lcm and the "best" element in L
4127  *(i.e the last in L with this lcm and of type (s,p))
4128  *and cancel all the other elements of type (r,p) with this lcm
4129  *except the case the element (s,r) has also the same lcm
4130  *and is on the worst position with respect to (s,p) and (r,p)
4131  */
4132  /*
4133  *B enters to L/their order with respect to B is permutated for elements
4134  *B[i].p with the same leading term
4135  */
4136  kMergeBintoL(strat);
4137  j = strat->Ll;
4138  loop /*cannot be changed into a for !!! */
4139  {
4140  if (j <= 0)
4141  {
4142  /*now L[0] cannot be canceled any more and the tail can be removed*/
4143  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
4144  break;
4145  }
4146  if (strat->L[j].p2 == p) // Was the element added from B?
4147  {
4148  i = j-1;
4149  loop
4150  {
4151  if (i < 0) break;
4152  // Element is from B and has the same lcm as L[j]
4153  if ((strat->L[i].p2 == p) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(strat->L[i].lcm), currRing->cf)
4154  && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
4155  {
4156  /*L[i] could be canceled but we search for a better one to cancel*/
4157  strat->c3++;
4158 #ifdef KDEBUG
4159  if (TEST_OPT_DEBUG)
4160  {
4161  PrintS("--- chain criterion func chainCritRing type 3\n");
4162  PrintS("strat->L[j].lcm:");
4163  wrp(strat->L[j].lcm);
4164  PrintS(" strat->L[i].lcm:");
4165  wrp(strat->L[i].lcm);
4166  PrintLn();
4167  }
4168 #endif
4169  #ifdef ADIDEBUG
4170  printf("\nChainCrit3\n");
4171  pWrite(strat->L[j].p);
4172  pWrite(strat->L[j].p1);
4173  pWrite(strat->L[j].p2);
4174  #endif
4175  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
4176  && (pNext(strat->L[l].p) == strat->tail)
4177  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
4178  && pDivisibleBy(p,strat->L[l].lcm))
4179  {
4180  /*
4181  *"NOT equal(...)" because in case of "equal" the element L[l]
4182  *is "older" and has to be from theoretical point of view behind
4183  *L[i], but we do not want to reorder L
4184  */
4185  strat->L[i].p2 = strat->tail;
4186  /*
4187  *L[l] will be canceled, we cannot cancel L[i] later on,
4188  *so we mark it with "tail"
4189  */
4190  deleteInL(strat->L,&strat->Ll,l,strat);
4191  i--;
4192  }
4193  else
4194  {
4195  deleteInL(strat->L,&strat->Ll,i,strat);
4196  }
4197  j--;
4198  }
4199  i--;
4200  }
4201  }
4202  else if (strat->L[j].p2 == strat->tail)
4203  {
4204  /*now L[j] cannot be canceled any more and the tail can be removed*/
4205  strat->L[j].p2 = p;
4206  }
4207  j--;
4208  }
4209 }
void PrintLn()
Definition: reporter.cc:310
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:681
BOOLEAN Gebauer
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:394
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:20
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
#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:138
LSet B
Definition: kutil.h:322
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
void wrp(poly p)
Definition: polys.h:292
int BOOLEAN
Definition: auxiliary.h:85
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ chainCritSig()

void chainCritSig ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3499 of file kutil.cc.

3500 {
3501  int i,j,l;
3502  kMergeBintoLSba(strat);
3503  j = strat->Ll;
3504  loop /*cannot be changed into a for !!! */
3505  {
3506  if (j <= 0)
3507  {
3508  /*now L[0] cannot be canceled any more and the tail can be removed*/
3509  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3510  break;
3511  }
3512  if (strat->L[j].p2 == p)
3513  {
3514  i = j-1;
3515  loop
3516  {
3517  if (i < 0) break;
3518  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3519  {
3520  /*L[i] could be canceled but we search for a better one to cancel*/
3521  strat->c3++;
3522  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3523  && (pNext(strat->L[l].p) == strat->tail)
3524  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3525  && pDivisibleBy(p,strat->L[l].lcm))
3526  {
3527  /*
3528  *"NOT equal(...)" because in case of "equal" the element L[l]
3529  *is "older" and has to be from theoretical point of view behind
3530  *L[i], but we do not want to reorder L
3531  */
3532  strat->L[i].p2 = strat->tail;
3533  /*
3534  *L[l] will be canceled, we cannot cancel L[i] later on,
3535  *so we mark it with "tail"
3536  */
3537  deleteInL(strat->L,&strat->Ll,l,strat);
3538  i--;
3539  }
3540  else
3541  {
3542  deleteInL(strat->L,&strat->Ll,i,strat);
3543  }
3544  j--;
3545  }
3546  i--;
3547  }
3548  }
3549  else if (strat->L[j].p2 == strat->tail)
3550  {
3551  /*now L[j] cannot be canceled any more and the tail can be removed*/
3552  strat->L[j].p2 = p;
3553  }
3554  j--;
3555  }
3556 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:681
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3247
LSet L
Definition: kutil.h:321
#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:138
#define pNext(p)
Definition: monomials.h:43
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ cleanT()

void cleanT ( kStrategy  strat)

Definition at line 552 of file kutil.cc.

553 {
554  int i,j;
555  poly p;
556  assume(currRing == strat->tailRing || strat->tailRing != NULL);
557 
558  pShallowCopyDeleteProc p_shallow_copy_delete =
559  (strat->tailRing != currRing ?
561  NULL);
562  for (j=0; j<=strat->tl; j++)
563  {
564  p = strat->T[j].p;
565  strat->T[j].p=NULL;
566  if (strat->T[j].max_exp != NULL)
567  {
568  p_LmFree(strat->T[j].max_exp, strat->tailRing);
569  }
570  i = -1;
571  loop
572  {
573  i++;
574  if (i>strat->sl)
575  {
576  if (strat->T[j].t_p != NULL)
577  {
578  p_Delete(&(strat->T[j].t_p), strat->tailRing);
579  p_LmFree(p, currRing);
580  }
581  else
582  {
583  pDelete(&p);
584  }
585  break;
586  }
587  if (p == strat->S[i])
588  {
589  if (strat->T[j].t_p != NULL)
590  {
591  assume(p_shallow_copy_delete != NULL);
592  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
593  currRing->PolyBin);
594  p_LmFree(strat->T[j].t_p, strat->tailRing);
595  }
596  break;
597  }
598  }
599  }
600  strat->tl=-1;
601 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:346
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:52
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
polyrec * poly
Definition: hilb.h:10

◆ cleanTSbaRing()

void cleanTSbaRing ( kStrategy  strat)

Definition at line 603 of file kutil.cc.

604 {
605  int i,j;
606  poly p;
607  assume(currRing == strat->tailRing || strat->tailRing != NULL);
608 
609  pShallowCopyDeleteProc p_shallow_copy_delete =
610  (strat->tailRing != currRing ?
612  NULL);
613  for (j=0; j<=strat->tl; j++)
614  {
615  p = strat->T[j].p;
616  strat->T[j].p=NULL;
617  if (strat->T[j].max_exp != NULL)
618  {
619  p_LmFree(strat->T[j].max_exp, strat->tailRing);
620  }
621  i = -1;
622  loop
623  {
624  i++;
625  if (i>strat->sl)
626  {
627  if (strat->T[j].t_p != NULL)
628  {
629  p_Delete(&(strat->T[j].t_p), strat->tailRing);
630  p_LmFree(p, currRing);
631  }
632  else
633  {
634  //pDelete(&p);
635  p = NULL;
636  }
637  break;
638  }
639  if (p == strat->S[i])
640  {
641  if (strat->T[j].t_p != NULL)
642  {
643  assume(p_shallow_copy_delete != NULL);
644  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
645  currRing->PolyBin);
646  p_LmFree(strat->T[j].t_p, strat->tailRing);
647  }
648  break;
649  }
650  }
651  }
652  strat->tl=-1;
653 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:346
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:52
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
polyrec * poly
Definition: hilb.h:10

◆ clearSbatch()

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

Definition at line 4889 of file kutil.cc.

4890 {
4891  int j = pos;
4892  if ( (!strat->fromT)
4893  && ((strat->syzComp==0)
4894  ||(pGetComp(h)<=strat->syzComp)
4895  ))
4896  {
4897  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4898  unsigned long h_sev = pGetShortExpVector(h);
4899  loop
4900  {
4901  if (j > k) break;
4902  clearS(h,h_sev, &j,&k,strat);
4903  j++;
4904  }
4905  // Print("end clearS sl=%d\n",strat->sl);
4906  }
4907 }
int syzComp
Definition: kutil.h:350
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 10639 of file kutil.cc.

10640 {
10641  int i;
10642  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10643  LObject L;
10644 
10645 #ifdef KDEBUG
10646  // need to set this: during tailreductions of T[i], T[i].max is out of
10647  // sync
10648  sloppy_max = TRUE;
10649 #endif
10650 
10651  strat->noTailReduction = FALSE;
10652  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10653  if (TEST_OPT_PROT)
10654  {
10655  PrintLn();
10656 // if (timerv) writeTime("standard base computed:");
10657  }
10658  if (TEST_OPT_PROT)
10659  {
10660  Print("(S:%d)",strat->sl);mflush();
10661  }
10662  for (i=strat->sl; i>=low; i--)
10663  {
10664  int end_pos=strat->sl;
10665  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10666  if (strat->ak==0) end_pos=i-1;
10667  TObject* T_j = strat->s_2_t(i);
10668  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10669  {
10670  L = *T_j;
10671  #ifdef KDEBUG
10672  if (TEST_OPT_DEBUG)
10673  {
10674  Print("test S[%d]:",i);
10675  p_wrp(L.p,currRing,strat->tailRing);
10676  PrintLn();
10677  }
10678  #endif
10680  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10681  else
10682  strat->S[i] = redtail(&L, strat->sl, strat);
10683  #ifdef KDEBUG
10684  if (TEST_OPT_DEBUG)
10685  {
10686  Print("to (tailR) S[%d]:",i);
10687  p_wrp(strat->S[i],currRing,strat->tailRing);
10688  PrintLn();
10689  }
10690  #endif
10691 
10692  if (strat->redTailChange)
10693  {
10694  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10695  if (pNext(T_j->p) != NULL)
10696  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10697  else
10698  T_j->max_exp = NULL;
10699  }
10701  T_j->pCleardenom();
10702  }
10703  else
10704  {
10705  assume(currRing == strat->tailRing);
10706  #ifdef KDEBUG
10707  if (TEST_OPT_DEBUG)
10708  {
10709  Print("test S[%d]:",i);
10710  p_wrp(strat->S[i],currRing,strat->tailRing);
10711  PrintLn();
10712  }
10713  #endif
10715  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10716  else
10717  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10719  {
10720  if (TEST_OPT_CONTENTSB)
10721  {
10722  number n;
10723  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10724  if (!nIsOne(n))
10725  {
10727  denom->n=nInvers(n);
10728  denom->next=DENOMINATOR_LIST;
10729  DENOMINATOR_LIST=denom;
10730  }
10731  nDelete(&n);
10732  }
10733  else
10734  {
10735  //pContent(strat->S[i]);
10736  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10737  }
10738  }
10739  #ifdef KDEBUG
10740  if (TEST_OPT_DEBUG)
10741  {
10742  Print("to (-tailR) S[%d]:",i);
10743  p_wrp(strat->S[i],currRing,strat->tailRing);
10744  PrintLn();
10745  }
10746  #endif
10747  }
10748  if (TEST_OPT_PROT)
10749  PrintS("-");
10750  }
10751  if (TEST_OPT_PROT) PrintLn();
10752 #ifdef KDEBUG
10753  sloppy_max = FALSE;
10754 #endif
10755 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
int ak
Definition: kutil.h:349
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7598
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2875
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
ring tailRing
Definition: kutil.h:339
denominator_list next
Definition: kutil.h:67
#define pNext(p)
Definition: monomials.h:43
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:344
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2747
char redTailChange
Definition: kutil.h:396
class sTObject TObject
Definition: kutil.h:59
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:1137

◆ createG0()

ideal createG0 ( )

Definition at line 4561 of file kutil.cc.

4562 {
4563  // Initialize
4564  long exp[50]; // The exponent of \hat{X} (basepoint)
4565  long cexp[50]; // The current exponent for iterating over all
4566  long ind[50]; // The power of 2 in the i-th component of exp
4567  long cind[50]; // analog for cexp
4568  long mult[50]; // How to multiply the elements of G
4569  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4570  long habsind = 0; // The abs. index of the coefficient of h
4571  long step[50]; // The last increases
4572  for (int i = 1; i <= currRing->N; i++)
4573  {
4574  exp[i] = 0;
4575  cexp[i] = exp[i];
4576  ind[i] = 0;
4577  step[i] = 500000;
4578  cind[i] = ind[i];
4579  }
4580  long bound = currRing->ch;
4581  step[1] = 500000;
4582 #ifdef OLI_DEBUG
4583  PrintS("-------------\npoly :");
4584 // wrp(p);
4585  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4586  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4587  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4588  Print("bound : %d\n", bound);
4589  Print("cind : %d\n", cabsind);
4590 #endif
4591  if (cabsind == 0)
4592  {
4593  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4594  {
4595  return idInit(1, 1);
4596  }
4597  }
4598  ideal G0 = idInit(1, 1);
4599  // Now the whole simplex
4600  do
4601  {
4602  // Build s-polynomial
4603  // 2**ind-def * mult * g - exp-def * h
4604  poly t_p;
4605  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4606 #ifdef OLI_DEBUG
4607  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4608  PrintS("zPoly : ");
4609  wrp(zeroPoly);
4610  PrintLn();
4611 #endif
4612  // Add to ideal
4613  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4614  IDELEMS(G0) += 1;
4615  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4616  }
4617  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4618  idSkipZeroes(G0);
4619  return G0;
4620 }
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4432
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4366
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:649
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10

◆ deleteHC() [1/2]

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

Definition at line 243 of file kutil.cc.

244 {
245  if (strat->kHEdgeFound)
246  {
247  kTest_L(L);
248  poly p1;
249  poly p = L->GetLmTailRing();
250  int l = 1;
252  if (L->bucket != NULL)
253  {
254  kBucketClear(L->bucket, &pNext(p), &L->pLength);
255  L->pLength++;
256  bucket = L->bucket;
257  L->bucket = NULL;
258  }
259 
260  if (!fromNext && p_Cmp(p,strat->kNoetherTail(), L->tailRing) == -1)
261  {
262  L->Delete();
263  L->Clear();
264  L->ecart = -1;
265  if (bucket != NULL) kBucketDestroy(&bucket);
266  return;
267  }
268  p1 = p;
269  while (pNext(p1)!=NULL)
270  {
271  if (p_LmCmp(pNext(p1), strat->kNoetherTail(), L->tailRing) == -1)
272  {
273  p_Delete(&pNext(p1), L->tailRing);
274  if (p1 == p)
275  {
276  if (L->t_p != NULL)
277  {
278  assume(L->p != NULL && p == L->t_p);
279  pNext(L->p) = NULL;
280  }
281  L->max_exp = NULL;
282  }
283  else if (fromNext)
284  L->max_exp = p_GetMaxExpP(pNext(L->p), L->tailRing ); // p1;
285  //if (L->pLength != 0)
286  L->pLength = l;
287  // Hmmm when called from updateT, then only
288  // reset ecart when cut
289  if (fromNext)
290  L->ecart = L->pLDeg() - L->GetpFDeg();
291  break;
292  }
293  l++;
294  pIter(p1);
295  }
296  if (! fromNext)
297  {
298  L->SetpFDeg();
299  L->ecart = L->pLDeg(strat->LDegLast) - L->GetpFDeg();
300  }
301  if (bucket != NULL)
302  {
303  if (L->pLength > 1)
304  {
305  kBucketInit(bucket, pNext(p), L->pLength - 1);
306  pNext(p) = NULL;
307  if (L->t_p != NULL) pNext(L->t_p) = NULL;
308  L->pLength = 0;
309  L->bucket = bucket;
310  }
311  else
312  kBucketDestroy(&bucket);
313  }
314  kTest_L(L);
315  }
316 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:495
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:467
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1615
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:200
#define assume(x)
Definition: mod2.h:394
#define kTest_L(T)
Definition: kutil.h:652
P bucket
Definition: myNF.cc:79
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
BOOLEAN kHEdgeFound
Definition: kutil.h:373
BOOLEAN LDegLast
Definition: kutil.h:382
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94
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:1137

◆ deleteHC() [2/2]

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

Definition at line 318 of file kutil.cc.

319 {
320  LObject L(*p, currRing, strat->tailRing);
321 
322  deleteHC(&L, strat);
323  *p = L.p;
324  *e = L.ecart;
325  *l = L.length;
326  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
327 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
int l
Definition: cfEzgcd.cc:94

◆ deleteInL()

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

Definition at line 1165 of file kutil.cc.

1166 {
1167  if (set[j].lcm!=NULL)
1168  {
1169 #ifdef HAVE_RINGS
1170  if (pGetCoeff(set[j].lcm) != NULL)
1171  pLmDelete(set[j].lcm);
1172  else
1173 #endif
1174  pLmFree(set[j].lcm);
1175  }
1176  if (set[j].sig!=NULL)
1177  {
1178 #ifdef HAVE_RINGS
1179  if (pGetCoeff(set[j].sig) != NULL)
1180  pLmDelete(set[j].sig);
1181  else
1182 #endif
1183  pLmFree(set[j].sig);
1184  }
1185  if (set[j].p!=NULL)
1186  {
1187  if (pNext(set[j].p) == strat->tail)
1188  {
1189 #ifdef HAVE_RINGS
1190  if (pGetCoeff(set[j].p) != NULL)
1191  pLmDelete(set[j].p);
1192  else
1193 #endif
1194  pLmFree(set[j].p);
1195  /*- tail belongs to several int spolys -*/
1196  }
1197  else
1198  {
1199  // search p in T, if it is there, do not delete it
1200  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1201  {
1202  // assure that for global orderings kFindInT fails
1203  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1204  set[j].Delete();
1205  }
1206  }
1207  }
1208  if (*length > 0 && j < *length)
1209  {
1210 #ifdef ENTER_USE_MEMMOVE
1211  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1212 #else
1213  int i;
1214  for (i=j; i < (*length); i++)
1215  set[i] = set[i+1];
1216 #endif
1217  }
1218 #ifdef KDEBUG
1219  memset(&(set[*length]),0,sizeof(LObject));
1220 #endif
1221  (*length)--;
1222 }
int lcm(unsigned long *l, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:711
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:717
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70

◆ deleteInS()

void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 1058 of file kutil.cc.

1059 {
1060 #ifdef ENTER_USE_MEMMOVE
1061  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1062  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1063  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1064  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1065 #else
1066  int j;
1067  for (j=i; j<strat->sl; j++)
1068  {
1069  strat->S[j] = strat->S[j+1];
1070  strat->ecartS[j] = strat->ecartS[j+1];
1071  strat->sevS[j] = strat->sevS[j+1];
1072  strat->S_2_R[j] = strat->S_2_R[j+1];
1073  }
1074 #endif
1075  if (strat->lenS!=NULL)
1076  {
1077 #ifdef ENTER_USE_MEMMOVE
1078  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1079 #else
1080  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1081 #endif
1082  }
1083  if (strat->lenSw!=NULL)
1084  {
1085 #ifdef ENTER_USE_MEMMOVE
1086  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1087 #else
1088  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1089 #endif
1090  }
1091  if (strat->fromQ!=NULL)
1092  {
1093 #ifdef ENTER_USE_MEMMOVE
1094  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1095 #else
1096  for (j=i; j<strat->sl; j++)
1097  {
1098  strat->fromQ[j] = strat->fromQ[j+1];
1099  }
1100 #endif
1101  }
1102  strat->S[strat->sl] = NULL;
1103  strat->sl--;
1104 }
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10

◆ deleteInSSba()

void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 1110 of file kutil.cc.

1111 {
1112 #ifdef ENTER_USE_MEMMOVE
1113  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1114  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1115  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1116  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1117  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1118  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1119 #else
1120  int j;
1121  for (j=i; j<strat->sl; j++)
1122  {
1123  strat->S[j] = strat->S[j+1];
1124  strat->sig[j] = strat->sig[j+1];
1125  strat->ecartS[j] = strat->ecartS[j+1];
1126  strat->sevS[j] = strat->sevS[j+1];
1127  strat->sevSig[j] = strat->sevSig[j+1];
1128  strat->S_2_R[j] = strat->S_2_R[j+1];
1129  }
1130 #endif
1131  if (strat->lenS!=NULL)
1132  {
1133 #ifdef ENTER_USE_MEMMOVE
1134  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1135 #else
1136  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1137 #endif
1138  }
1139  if (strat->lenSw!=NULL)
1140  {
1141 #ifdef ENTER_USE_MEMMOVE
1142  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1143 #else
1144  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1145 #endif
1146  }
1147  if (strat->fromQ!=NULL)
1148  {
1149 #ifdef ENTER_USE_MEMMOVE
1150  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1151 #else
1152  for (j=i; j<strat->sl; j++)
1153  {
1154  strat->fromQ[j] = strat->fromQ[j+1];
1155  }
1156 #endif
1157  }
1158  strat->S[strat->sl] = NULL;
1159  strat->sl--;
1160 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10

◆ enlargeL()

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

Definition at line 662 of file kutil.cc.

663 {
664  assume((*L)!=NULL);
665  assume(((*length)+incr)>0);
666 
667  *L = (LSet)omReallocSize((*L),(*length)*sizeof(LObject),
668  ((*length)+incr)*sizeof(LObject));
669  (*length) += incr;
670 }
class sLObject LObject
Definition: kutil.h:60
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
LObject * LSet
Definition: kutil.h:62
#define NULL
Definition: omList.c:10

◆ enlargeT()

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

Definition at line 531 of file kutil.cc.

533 {
534  assume(T!=NULL);
535  assume(sevT!=NULL);
536  assume(R!=NULL);
537  assume((length+incr) > 0);
538 
539  int i;
540  T = (TSet)omRealloc0Size(T, length*sizeof(TObject),
541  (length+incr)*sizeof(TObject));
542 
543  sevT = (unsigned long*) omReallocSize(sevT, length*sizeof(long*),
544  (length+incr)*sizeof(long*));
545 
546  R = (TObject**)omRealloc0Size(R,length*sizeof(TObject*),
547  (length+incr)*sizeof(TObject*));
548  for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
549  length += incr;
550 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
TObject * TSet
Definition: kutil.h:61
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
const ring R
Definition: DebugPrint.cc:36
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:59

◆ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4676 of file kutil.cc.

4677 {
4678  if (nIsOne(pGetCoeff(h))) return;
4679  number gcd;
4680  bool go = false;
4681  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4682  {
4683  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4684  go = true;
4685  }
4686  else
4687  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4688  if (go || !nIsOne(gcd))
4689  {
4690  poly p = h->next;
4691  if (!go)
4692  {
4693  number tmp = gcd;
4694  gcd = n_Ann(gcd,currRing->cf);
4695  nDelete(&tmp);
4696  }
4697  p_Test(p,strat->tailRing);
4698  p = pp_Mult_nn(p, gcd, strat->tailRing);
4699  nDelete(&gcd);
4700 
4701  if (p != NULL)
4702  {
4703  if (TEST_OPT_PROT)
4704  {
4705  PrintS("Z");
4706  }
4707 #ifdef KDEBUG
4708  if (TEST_OPT_DEBUG)
4709  {
4710  PrintS("--- create zero spoly: ");
4711  p_wrp(h,currRing,strat->tailRing);
4712  PrintS(" ---> ");
4713  }
4714 #endif
4715  poly tmp = pInit();
4716  pSetCoeff0(tmp, pGetCoeff(p));
4717  for (int i = 1; i <= rVar(currRing); i++)
4718  {
4719  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4720  }
4722  {
4723  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4724  }
4725  p_Setm(tmp, currRing);
4726  p = p_LmFreeAndNext(p, strat->tailRing);
4727  pNext(tmp) = p;
4728  LObject Lp;
4729  Lp.Init();
4730  Lp.p = tmp;
4731  Lp.tailRing = strat->tailRing;
4732  int posx;
4733  if (Lp.p!=NULL)
4734  {
4735  strat->initEcart(&Lp);
4736  if (strat->Ll==-1)
4737  posx =0;
4738  else
4739  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4740  Lp.sev = pGetShortExpVector(Lp.p);
4741  if (strat->tailRing != currRing)
4742  {
4743  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4744  }
4745 #ifdef KDEBUG
4746  if (TEST_OPT_DEBUG)
4747  {
4748  p_wrp(tmp,currRing,strat->tailRing);
4749  PrintLn();
4750  }
4751 #endif
4752  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4753  }
4754  }
4755  }
4756  nDelete(&gcd);
4757 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:690
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static 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:705
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:698
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ enterExtendedSpolySig()

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

Definition at line 4759 of file kutil.cc.

4760 {
4761  if (nIsOne(pGetCoeff(h))) return;
4762  number gcd;
4763  bool go = false;
4764  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4765  {
4766  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4767  go = true;
4768  }
4769  else
4770  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4771  if (go || !nIsOne(gcd))
4772  {
4773  poly p = h->next;
4774  if (!go)
4775  {
4776  number tmp = gcd;
4777  gcd = n_Ann(gcd,currRing->cf);
4778  nDelete(&tmp);
4779  }
4780  p_Test(p,strat->tailRing);
4781  p = pp_Mult_nn(p, gcd, strat->tailRing);
4782 
4783  if (p != NULL)
4784  {
4785  if (TEST_OPT_PROT)
4786  {
4787  PrintS("Z");
4788  }
4789 #ifdef KDEBUG
4790  if (TEST_OPT_DEBUG)
4791  {
4792  PrintS("--- create zero spoly: ");
4793  p_wrp(h,currRing,strat->tailRing);
4794  PrintS(" ---> ");
4795  }
4796 #endif
4797  poly tmp = pInit();
4798  pSetCoeff0(tmp, pGetCoeff(p));
4799  for (int i = 1; i <= rVar(currRing); i++)
4800  {
4801  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4802  }
4804  {
4805  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4806  }
4807  p_Setm(tmp, currRing);
4808  p = p_LmFreeAndNext(p, strat->tailRing);
4809  pNext(tmp) = p;
4810  LObject Lp;
4811  Lp.Init();
4812  Lp.p = tmp;
4813  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4814  #if EXT_POLY_NEW
4815  Lp.sig = pp_Mult_nn(hSig, gcd, currRing);
4816  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4817  {
4818  #ifdef ADIDEBUG
4819  printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig);
4820  #endif
4821  strat->sigdrop = TRUE;
4822  //Try to reduce it as far as we can via redRing
4823  int red_result = redRing(&Lp,strat);
4824  #ifdef ADIDEBUG
4825  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
4826  #endif
4827  if(red_result == 0)
4828  {
4829  // Cancel the sigdrop
4830  #ifdef ADIDEBUG
4831  printf("\nCancel the sigdrop. It reduced to 0\n");
4832  #endif
4833  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4834  strat->sigdrop = FALSE;
4835  return;
4836  }
4837  else
4838  {
4839  #ifdef ADIDEBUG
4840  printf("\nSigdrop. end\n");
4841  #endif
4842  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4843  #if 1
4844  strat->enterS(Lp,0,strat,strat->tl);
4845  #endif
4846  return;
4847  }
4848 
4849  }
4850  #else
4851  Lp.sig = pOne();
4852  if(strat->Ll >= 0)
4853  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4854  else
4855  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4856  #endif
4857  Lp.tailRing = strat->tailRing;
4858  int posx;
4859  if (Lp.p!=NULL)
4860  {
4861  strat->initEcart(&Lp);
4862  if (strat->Ll==-1)
4863  posx =0;
4864  else
4865  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4866  Lp.sev = pGetShortExpVector(Lp.p);
4867  if (strat->tailRing != currRing)
4868  {
4869  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4870  }
4871 #ifdef KDEBUG
4872  if (TEST_OPT_DEBUG)
4873  {
4874  p_wrp(tmp,currRing,strat->tailRing);
4875  PrintLn();
4876  }
4877 #endif
4878  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4879  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4880  }
4881  }
4882  nDelete(&gcd);
4883  }
4884  nDelete(&gcd);
4885 }
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:690
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:60
bool sigdrop
Definition: kutil.h:356
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
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:705
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:297
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:698
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
LSet L
Definition: kutil.h:321
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
int sl
Definition: kutil.h:344
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ enterL()

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

Definition at line 1227 of file kutil.cc.

1228 {
1229  // this should be corrected
1230  assume(p.FDeg == p.pFDeg());
1231 
1232  if ((*length)>=0)
1233  {
1234  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1235  if (at <= (*length))
1236 #ifdef ENTER_USE_MEMMOVE
1237  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1238 #else
1239  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1240 #endif
1241  }
1242  else at = 0;
1243  (*set)[at] = p;
1244  (*length)++;
1245 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:30
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:662
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:52

◆ enterOnePairLift()

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

Definition at line 2237 of file kutil.cc.

2238 {
2239  assume(ALLOW_PROD_CRIT(strat));
2241  assume(strat->syzComp==1);
2242  assume(i<=strat->sl);
2243 
2244  int l,j,compare;
2245  LObject Lp;
2246  Lp.i_r = -1;
2247 
2248 #ifdef KDEBUG
2249  Lp.ecart=0; Lp.length=0;
2250 #endif
2251  /*- computes the lcm(s[i],p) -*/
2252  Lp.lcm = pInit();
2253 
2254  pLcm(p,strat->S[i],Lp.lcm);
2255  pSetm(Lp.lcm);
2256 
2257  if (strat->sugarCrit)
2258  {
2259  if((!((strat->ecartS[i]>0)&&(ecart>0)))
2260  && p_HasNotCF_Lift(p,strat->S[i],currRing))
2261  {
2262  /*
2263  *the product criterion has applied for (s,p),
2264  *i.e. lcm(s,p)=product of the leading terms of s and p.
2265  *Suppose (s,r) is in L and the leading term
2266  *of p divides lcm(s,r)
2267  *(==> the leading term of p divides the leading term of r)
2268  *but the leading term of s does not divide the leading term of r
2269  *(notice that tis condition is automatically satisfied if r is still
2270  *in S), then (s,r) can be cancelled.
2271  *This should be done here because the
2272  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2273  *
2274  *Moreover, skipping (s,r) holds also for the noncommutative case.
2275  */
2276  strat->cp++;
2277  pLmFree(Lp.lcm);
2278  Lp.lcm=NULL;
2279  return;
2280  }
2281  else
2282  Lp.ecart = si_max(ecart,strat->ecartS[i]);
2283  if (strat->fromT && (strat->ecartS[i]>ecart))
2284  {
2285  pLmFree(Lp.lcm);
2286  Lp.lcm=NULL;
2287  return;
2288  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2289  }
2290  /*
2291  *the set B collects the pairs of type (S[j],p)
2292  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2293  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2294  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2295  */
2296  {
2297  j = strat->Bl;
2298  loop
2299  {
2300  if (j < 0) break;
2301  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2302  if ((compare==1)
2303  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2304  {
2305  strat->c3++;
2306  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2307  {
2308  pLmFree(Lp.lcm);
2309  return;
2310  }
2311  break;
2312  }
2313  else
2314  if ((compare ==-1)
2315  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2316  {
2317  deleteInL(strat->B,&strat->Bl,j,strat);
2318  strat->c3++;
2319  }
2320  j--;
2321  }
2322  }
2323  }
2324  else /*sugarcrit*/
2325  {
2326  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2327  p_HasNotCF_Lift(p,strat->S[i],currRing))
2328  {
2329  /*
2330  *the product criterion has applied for (s,p),
2331  *i.e. lcm(s,p)=product of the leading terms of s and p.
2332  *Suppose (s,r) is in L and the leading term
2333  *of p devides lcm(s,r)
2334  *(==> the leading term of p devides the leading term of r)
2335  *but the leading term of s does not devide the leading term of r
2336  *(notice that tis condition is automatically satisfied if r is still
2337  *in S), then (s,r) can be canceled.
2338  *This should be done here because the
2339  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2340  */
2341  strat->cp++;
2342  pLmFree(Lp.lcm);
2343  Lp.lcm=NULL;
2344  return;
2345  }
2346  if (strat->fromT && (strat->ecartS[i]>ecart))
2347  {
2348  pLmFree(Lp.lcm);
2349  Lp.lcm=NULL;
2350  return;
2351  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2352  }
2353  /*
2354  *the set B collects the pairs of type (S[j],p)
2355  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2356  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2357  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2358  */
2359  for(j = strat->Bl;j>=0;j--)
2360  {
2361  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2362  if (compare==1)
2363  {
2364  strat->c3++;
2365  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2366  {
2367  pLmFree(Lp.lcm);
2368  return;
2369  }
2370  break;
2371  }
2372  else
2373  if (compare ==-1)
2374  {
2375  deleteInL(strat->B,&strat->Bl,j,strat);
2376  strat->c3++;
2377  }
2378  }
2379  }
2380  /*
2381  *the pair (S[i],p) enters B if the spoly != 0
2382  */
2383  /*- compute the short s-polynomial -*/
2384  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2385  pNorm(p);
2386 
2387  if ((strat->S[i]==NULL) || (p==NULL))
2388  return;
2389 
2390  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2391  Lp.p=NULL;
2392  else
2393  {
2395  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2396  }
2397  if (Lp.p == NULL)
2398  {
2399  /*- the case that the s-poly is 0 -*/
2400  if (strat->pairtest==NULL) initPairtest(strat);
2401  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2402  strat->pairtest[strat->sl+1] = TRUE;
2403  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2404  /*
2405  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2406  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2407  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2408  *term of p devides the lcm(s,r)
2409  *(this canceling should be done here because
2410  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2411  *the first case is handeled in chainCrit
2412  */
2413  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2414  }
2415  else
2416  {
2417  /*- the pair (S[i],p) enters B -*/
2418  Lp.p1 = strat->S[i];
2419  Lp.p2 = p;
2420 
2421  pNext(Lp.p) = strat->tail; // !!!
2422 
2423  if (atR >= 0)
2424  {
2425  Lp.i_r1 = strat->S_2_R[i];
2426  Lp.i_r2 = atR;
2427  }
2428  else
2429  {
2430  Lp.i_r1 = -1;
2431  Lp.i_r2 = -1;
2432  }
2433  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2434 
2436  {
2437  nDelete(&(Lp.p->coef));
2438  }
2439 
2440  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2441  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2442  }
2443 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define pSetm(p)
Definition: polys.h:253
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
static BOOLEAN p_HasNotCF_Lift(poly p1, poly p2, const ring r)
p_HasNotCF for the IDLIFT case: ignore component
Definition: kutil.cc:2220
#define TRUE
Definition: auxiliary.h:98
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:348
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
BOOLEAN sugarCrit
Definition: kutil.h:374
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
intset ecartS
Definition: kutil.h:303
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:344
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
int l
Definition: cfEzgcd.cc:94

◆ enterOnePairManyShifts()

static void enterOnePairManyShifts ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)
static

Definition at line 12193 of file kutil.cc.

12194 {
12195  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12196 
12199 
12200  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12201  /* that is create the pairs (f, s \dot g) */
12202 
12203  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
12204 
12205  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12206  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12207 
12208  /* determine how many elements we have to insert for a given s[i] */
12209  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12210  /* hence, a total number of elt's to add is: */
12211  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12212  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12213 
12214 #ifdef KDEBUG
12215  if (TEST_OPT_DEBUG)
12216  {
12217  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
12218  }
12219 #endif
12220 
12221  assume(i<=strat->sl); // from OnePair
12222 
12223  /* these vars hold for all shifts of s[i] */
12224  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12225 
12226  int qfromQ;
12227  if (strat->fromQ != NULL)
12228  {
12229  qfromQ = strat->fromQ[i];
12230  }
12231  else
12232  {
12233  qfromQ = -1;
12234  }
12235 
12236  int j;
12237 
12238  poly q/*, s*/;
12239 
12240  // for the 0th shift: insert the orig. pair
12241  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12242 
12243  for (j=1; j<= toInsert; j++)
12244  {
12245  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12246  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12247  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12248  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12249  // pNext(q) = s; // in tailRing
12250  /* here we need to call enterOnePair with two polys ... */
12251 
12252 #ifdef KDEBUG
12253  //if (TEST_OPT_DEBUG)
12254  //{
12255  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
12256  //}
12257 #endif
12258  //kFindInTShift(q,atR,strat);
12259  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12260  }
12261 }
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int, int lV)
Definition: kutil.cc:12332
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
#define TEST_OPT_DEBUG
Definition: options.h:103
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ enterOnePairNormal()

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

Definition at line 1954 of file kutil.cc.

1955 {
1956  assume(i<=strat->sl);
1957 
1958  int l,j,compare;
1959  LObject Lp;
1960  Lp.i_r = -1;
1961 
1962 #ifdef KDEBUG
1963  Lp.ecart=0; Lp.length=0;
1964 #endif
1965  /*- computes the lcm(s[i],p) -*/
1966  Lp.lcm = pInit();
1967 
1968 #ifndef HAVE_RATGRING
1969  pLcm(p,strat->S[i],Lp.lcm);
1970 #elif defined(HAVE_RATGRING)
1971  if (rIsRatGRing(currRing))
1972  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1973  else
1974  pLcm(p,strat->S[i],Lp.lcm);
1975 #endif
1976  pSetm(Lp.lcm);
1977 
1978 
1979  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1980  {
1981  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1982  && pHasNotCF(p,strat->S[i]))
1983  {
1984  /*
1985  *the product criterion has applied for (s,p),
1986  *i.e. lcm(s,p)=product of the leading terms of s and p.
1987  *Suppose (s,r) is in L and the leading term
1988  *of p divides lcm(s,r)
1989  *(==> the leading term of p divides the leading term of r)
1990  *but the leading term of s does not divide the leading term of r
1991  *(notice that tis condition is automatically satisfied if r is still
1992  *in S), then (s,r) can be cancelled.
1993  *This should be done here because the
1994  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1995  *
1996  *Moreover, skipping (s,r) holds also for the noncommutative case.
1997  */
1998  strat->cp++;
1999  pLmFree(Lp.lcm);
2000  Lp.lcm=NULL;
2001  return;
2002  }
2003  else
2004  Lp.ecart = si_max(ecart,strat->ecartS[i]);
2005  if (strat->fromT && (strat->ecartS[i]>ecart))
2006  {
2007  pLmFree(Lp.lcm);
2008  Lp.lcm=NULL;
2009  return;
2010  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2011  }
2012  /*
2013  *the set B collects the pairs of type (S[j],p)
2014  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2015  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2016  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2017  */
2018  {
2019  j = strat->Bl;
2020  loop
2021  {
2022  if (j < 0) break;
2023  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2024  if ((compare==1)
2025  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2026  {
2027  strat->c3++;
2028  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2029  {
2030  pLmFree(Lp.lcm);
2031  return;
2032  }
2033  break;
2034  }
2035  else
2036  if ((compare ==-1)
2037  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2038  {
2039  deleteInL(strat->B,&strat->Bl,j,strat);
2040  strat->c3++;
2041  }
2042  j--;
2043  }
2044  }
2045  }
2046  else /*sugarcrit*/
2047  {
2048  if (ALLOW_PROD_CRIT(strat))
2049  {
2050  // if currRing->nc_type!=quasi (or skew)
2051  // TODO: enable productCrit for super commutative algebras...
2052  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2053  pHasNotCF(p,strat->S[i]))
2054  {
2055  /*
2056  *the product criterion has applied for (s,p),
2057  *i.e. lcm(s,p)=product of the leading terms of s and p.
2058  *Suppose (s,r) is in L and the leading term
2059  *of p devides lcm(s,r)
2060  *(==> the leading term of p devides the leading term of r)
2061  *but the leading term of s does not devide the leading term of r
2062  *(notice that tis condition is automatically satisfied if r is still
2063  *in S), then (s,r) can be canceled.
2064  *This should be done here because the
2065  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2066  */
2067  strat->cp++;
2068  pLmFree(Lp.lcm);
2069  Lp.lcm=NULL;
2070  return;
2071  }
2072  if (strat->fromT && (strat->ecartS[i]>ecart))
2073  {
2074  pLmFree(Lp.lcm);
2075  Lp.lcm=NULL;
2076  return;
2077  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2078  }
2079  /*
2080  *the set B collects the pairs of type (S[j],p)
2081  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2082  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2083  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2084  */
2085  for(j = strat->Bl;j>=0;j--)
2086  {
2087  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2088  if (compare==1)
2089  {
2090  strat->c3++;
2091  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2092  {
2093  pLmFree(Lp.lcm);
2094  return;
2095  }
2096  break;
2097  }
2098  else
2099  if (compare ==-1)
2100  {
2101  deleteInL(strat->B,&strat->Bl,j,strat);
2102  strat->c3++;
2103  }
2104  }
2105  }
2106  }
2107  /*
2108  *the pair (S[i],p) enters B if the spoly != 0
2109  */
2110  /*- compute the short s-polynomial -*/
2111  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2112  pNorm(p);
2113 
2114  if ((strat->S[i]==NULL) || (p==NULL))
2115  return;
2116 
2117  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2118  Lp.p=NULL;
2119  else
2120  {
2121  #ifdef HAVE_PLURAL
2122  if ( rIsPluralRing(currRing) )
2123  {
2124  if(pHasNotCF(p, strat->S[i]))
2125  {
2126  if(ncRingType(currRing) == nc_lie)
2127  {
2128  // generalized prod-crit for lie-type
2129  strat->cp++;
2130  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2131  }
2132  else
2133  if( ALLOW_PROD_CRIT(strat) )
2134  {
2135  // product criterion for homogeneous case in SCA
2136  strat->cp++;
2137  Lp.p = NULL;
2138  }
2139  else
2140  {
2141  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2142  nc_CreateShortSpoly(strat->S[i], p, currRing);
2143  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2144  pNext(Lp.p) = strat->tail; // !!!
2145  }
2146  }
2147  else
2148  {
2149  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2150  nc_CreateShortSpoly(strat->S[i], p, currRing);
2151 
2152  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2153  pNext(Lp.p) = strat->tail; // !!!
2154  }
2155  }
2156  else
2157  #endif
2158  {
2160  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2161  }
2162  }
2163  if (Lp.p == NULL)
2164  {
2165  /*- the case that the s-poly is 0 -*/
2166  if (strat->pairtest==NULL) initPairtest(strat);
2167  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2168  strat->pairtest[strat->sl+1] = TRUE;
2169  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2170  /*
2171  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2172  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2173  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2174  *term of p devides the lcm(s,r)
2175  *(this canceling should be done here because
2176  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2177  *the first case is handeled in chainCrit
2178  */
2179  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2180  }
2181  else
2182  {
2183  /*- the pair (S[i],p) enters B -*/
2184  Lp.p1 = strat->S[i];
2185  Lp.p2 = p;
2186 
2187  if (
2189 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2190  )
2191  {
2192  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2193  pNext(Lp.p) = strat->tail; // !!!
2194  }
2195 
2196  if (atR >= 0)
2197  {
2198  Lp.i_r1 = strat->S_2_R[i];
2199  Lp.i_r2 = atR;
2200  }
2201  else
2202  {
2203  Lp.i_r1 = -1;
2204  Lp.i_r2 = -1;
2205  }
2206  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2207 
2209  {
2210  if (!rIsPluralRing(currRing))
2211  nDelete(&(Lp.p->coef));
2212  }
2213 
2214  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2215  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2216  }
2217 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2307
#define pSetm(p)
Definition: polys.h:253
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1938
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:348
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
BOOLEAN sugarCrit
Definition: kutil.h:374
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
intset ecartS
Definition: kutil.h:303
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
int sl
Definition: kutil.h:344
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ enterOnePairRing()

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

Definition at line 1293 of file kutil.cc.

1294 {
1295  assume(atR >= 0);
1296  assume(i<=strat->sl);
1297  assume(p!=NULL);
1298  #if ALL_VS_JUST
1299  //Over rings, if we construct the strong pair, do not add the spair
1301  {
1302  number s,t,d;
1303  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1304 
1305  if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
1306  {
1307  nDelete(&d);
1308  nDelete(&s);
1309  nDelete(&t);
1310  return;
1311  }
1312  nDelete(&d);
1313  nDelete(&s);
1314  nDelete(&t);
1315  }
1316  #endif
1317  int j,compare,compareCoeff;
1318  LObject h;
1319 
1320 #ifdef KDEBUG
1321  h.ecart=0; h.length=0;
1322 #endif
1323  /*- computes the lcm(s[i],p) -*/
1324  h.lcm = pInit();
1325  pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
1326  if (nIsZero(pGetCoeff(h.lcm)))
1327  {
1328  strat->cp++;
1329  pLmDelete(h.lcm);
1330  return;
1331  }
1332  // basic chain criterion
1333  pLcm(p,strat->S[i],h.lcm);
1334  pSetm(h.lcm);
1335  /*
1336  *the set B collects the pairs of type (S[j],p)
1337  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
1338  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1339  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1340  */
1341 
1342  for(j = strat->Bl;j>=0;j--)
1343  {
1344  compare=pDivCompRing(strat->B[j].lcm,h.lcm);
1345  compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
1346  #ifdef ADIDEBUG
1347  printf("\nChainCrit in enteronepairring\n");
1348  printf("\nB[j]\n");
1349  pWrite(strat->B[j].p);
1350  pWrite(strat->B[j].p1);
1351  pWrite(strat->B[j].p2);
1352  pWrite(strat->B[j].lcm);
1353  printf("\nh - neue Paar\n");
1354  pWrite(h.p);
1355  pWrite(p);
1356  pWrite(strat->S[i]);
1357  pWrite(h.lcm);
1358  printf("\ncompare = %i\ncompareCoeff = %i\n",compare,compareCoeff);
1359  #endif
1360  if(compare == pDivComp_EQUAL)
1361  {
1362  //They have the same LM
1363  if(compareCoeff == pDivComp_LESS)
1364  {
1365  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1366  {
1367  #ifdef ADIDEBUG
1368  printf("\nGelöscht h\n");
1369  #endif
1370  strat->c3++;
1371  pLmDelete(h.lcm);
1372  return;
1373  }
1374  break;
1375  }
1376  if(compareCoeff == pDivComp_GREATER)
1377  {
1378  #ifdef ADIDEBUG
1379  printf("\nGelöscht: B[j]\n");
1380  #endif
1381  deleteInL(strat->B,&strat->Bl,j,strat);
1382  strat->c3++;
1383  }
1384  if(compareCoeff == pDivComp_EQUAL)
1385  {
1386  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1387  {
1388  #ifdef ADIDEBUG
1389  printf("\nGelöscht h\n");
1390  #endif
1391  strat->c3++;
1392  pLmDelete(h.lcm);
1393  return;
1394  }
1395  break;
1396  }
1397  }
1398  if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
1399  {
1400  if(compare == pDivComp_LESS)
1401  {
1402  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1403  {
1404  #ifdef ADIDEBUG
1405  printf("\nGelöscht h\n");
1406  #endif
1407  strat->c3++;
1408  pLmDelete(h.lcm);
1409  return;
1410  }
1411  break;
1412  }
1413  if(compare == pDivComp_GREATER)
1414  {
1415  #ifdef ADIDEBUG
1416  printf("\nGelöscht: B[j]\n");
1417  #endif
1418  deleteInL(strat->B,&strat->Bl,j,strat);
1419  strat->c3++;
1420  }
1421  }
1422  }
1423  number s, t;
1424  poly m1, m2, gcd = NULL;
1425  #ifdef ADIDEBUG
1426  printf("\nTrying to add spair S[%i] und p\n",i);pWrite(strat->S[i]);pWrite(p);
1427  #endif
1428  s = pGetCoeff(strat->S[i]);
1429  t = pGetCoeff(p);
1430  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
1431  ksCheckCoeff(&s, &t, currRing->cf);
1432  pSetCoeff0(m1, s);
1433  pSetCoeff0(m2, t);
1434  m2 = pNeg(m2);
1435  p_Test(m1,strat->tailRing);
1436  p_Test(m2,strat->tailRing);
1437  poly si = pCopy(strat->S[i]);
1438  poly pm1 = pp_Mult_mm(pNext(p), m1, strat->tailRing);
1439  poly sim2 = pp_Mult_mm(pNext(si), m2, strat->tailRing);
1440  pDelete(&si);
1441  if(sim2 == NULL)
1442  {
1443  pDelete(&m1);
1444  pDelete(&m2);
1445  if(pm1 == NULL)
1446  {
1447  if(h.lcm != NULL)
1448  {
1449  pLmDelete(h.lcm);
1450  h.lcm=NULL;
1451  }
1452  h.Clear();
1453  if (strat->pairtest==NULL) initPairtest(strat);
1454  strat->pairtest[i] = TRUE;
1455  strat->pairtest[strat->sl+1] = TRUE;
1456  return;
1457  }
1458  else
1459  {
1460  gcd = pm1;
1461  pm1 = NULL;
1462  }
1463  }
1464  else
1465  {
1466  if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
1467  {
1468  p_SetCompP(sim2, pGetComp(p), strat->tailRing);
1469  pSetmComp(sim2);
1470  }
1471  //p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
1472  gcd = p_Add_q(pm1, sim2, strat->tailRing);
1473  }
1474  p_Test(gcd, strat->tailRing);
1475  //p_LmDelete(m1, strat->tailRing);
1476  //p_LmDelete(m2, strat->tailRing);
1477 #ifdef KDEBUG
1478  if (TEST_OPT_DEBUG)
1479  {
1480  wrp(gcd);
1481  PrintLn();
1482  }
1483 #endif
1484  h.p = gcd;
1485  h.i_r = -1;
1486  if(h.p == NULL)
1487  {
1488  if (strat->pairtest==NULL) initPairtest(strat);
1489  strat->pairtest[i] = TRUE;
1490  strat->pairtest[strat->sl+1] = TRUE;
1491  return;
1492  }
1493  h.tailRing = strat->tailRing;
1494  int posx;
1495  //h.pCleardenom();
1496  //pSetm(h.p);
1497  #ifdef ADIDEBUG
1498  printf("\nThis is afterwards:\n");
1499  pWrite(h.p);
1500  #endif
1501  h.i_r1 = -1;h.i_r2 = -1;
1502  strat->initEcart(&h);
1503  #if 1
1504  h.p2 = strat->S[i];
1505  h.p1 = p;
1506  #endif
1507  #if 1
1508  if (atR >= 0)
1509  {
1510  h.i_r1 = atR;
1511  h.i_r2 = strat->S_2_R[i];
1512  }
1513  #endif
1514  if (strat->Bl==-1)
1515  posx =0;
1516  else
1517  posx = strat->posInL(strat->B,strat->Bl,&h,strat);
1518  h.sev = pGetShortExpVector(h.p);
1519  if (currRing!=strat->tailRing)
1520  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1521  #ifdef ADIDEBUG
1522  printf("\nThis s-poly was added to B:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);printf("\ni_r1 = %i, i_r2 = %i\n",h.i_r1, h.i_r2);pWrite(strat->T[h.i_r1].p);pWrite(strat->T[h.i_r2].p);
1523  #endif
1524  enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
1525  kTest_TS(strat);
1526 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
const CanonicalForm int s
Definition: facAbsFact.cc:55
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:935
#define pSetm(p)
Definition: polys.h:253
#define pDivComp_LESS
Definition: kutil.cc:141
void PrintLn()
Definition: reporter.cc:310
#define pDivComp_EQUAL
Definition: kutil.cc:140
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
int ksCheckCoeff(number *a, number *b)
#define pNeg(p)
Definition: polys.h:181
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:98
#define pLcm(a, b, m)
Definition: polys.h:277
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int Bmax
Definition: kutil.h:348
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
#define kTest_TS(A)
Definition: kutil.h:649
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition: coeffs.h:526
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:716
int cp
Definition: kutil.h:343
#define p_Test(p, r)
Definition: p_polys.h:160
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:697
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:149
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
void wrp(poly p)
Definition: polys.h:292
#define pDivComp_GREATER
Definition: kutil.cc:142
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ enterOnePairSelfShifts()

void enterOnePairSelfShifts ( poly  qq,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  ,
int  uptodeg,
int  lV 
)

Definition at line 12269 of file kutil.cc.

12270 {
12271 
12272  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12273  /* for true self pairs qq ==p */
12274  /* we test both qq and p */
12276  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12279 
12280  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12281 
12282  // int j = 0;
12283  int j = 1;
12284 
12285  /* for such self pairs start with 1, not with 0 */
12286  if (qq == p) j=1;
12287 
12288  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12289  /* that is create the pairs (f, s \dot g) */
12290 
12291  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12292 
12293 #ifdef KDEBUG
12294  //if (TEST_OPT_DEBUG)
12295  //{
12296  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12297  //}
12298 #endif
12299 
12300  poly q;
12301 
12302  /* these vars hold for all shifts of s[i] */
12303  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12304  int qfromQ = 0; // strat->fromQ[i];
12305 
12306  for (; j<= toInsert; j++)
12307  {
12308  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12309  /* we increase shifts by one; must delete q there*/
12310  // q = qq; q = pMoveCurrTail2poly(q,strat);
12311  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12312  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12313  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12314  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12315  // pNext(q) = s; // in tailRing
12316  /* here we need to call enterOnePair with two polys ... */
12317 #ifdef KDEBUG
12318  //if (TEST_OPT_DEBUG)
12319  //{
12320  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12321  //}
12322 #endif
12323  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12324  }
12325 }
void enterOnePairShift(poly q, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int ecartq, int qisFromQ, int shiftcount, int ifromS, int, int lV)
Definition: kutil.cc:12332
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

◆ enterOnePairShift()

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

Definition at line 12332 of file kutil.cc.

12333 {
12334 
12335  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12336 
12337  /* check this Formats: */
12339  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12342 
12343 #ifdef KDEBUG
12344 // if (TEST_OPT_DEBUG)
12345 // {
12346 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12347 // wrp(q); // wrp(pHead(q));
12348 // PrintS(", p = ");
12349 // wrp(p); //wrp(pHead(p));
12350 // PrintLn();
12351 // }
12352 #endif
12353 
12354  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12355 
12356  int qfromQ = qisFromQ;
12357 
12358  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12359 
12360  int l,j,compare;
12361  LObject Lp;
12362  Lp.i_r = -1;
12363 
12364 #ifdef KDEBUG
12365  Lp.ecart=0; Lp.length=0;
12366 #endif
12367  /*- computes the lcm(s[i],p) -*/
12368  Lp.lcm = pInit();
12369 
12370  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
12371  pSetm(Lp.lcm);
12372 
12373  /* apply the V criterion */
12374  if (!isInV(Lp.lcm, lV))
12375  {
12376 #ifdef KDEBUG
12377  if (TEST_OPT_DEBUG)
12378  {
12379  PrintS("V crit applied to q = ");
12380  wrp(q); // wrp(pHead(q));
12381  PrintS(", p = ");
12382  wrp(p); //wrp(pHead(p));
12383  PrintLn();
12384  }
12385 #endif
12386  pLmFree(Lp.lcm);
12387  Lp.lcm=NULL;
12388  /* + counter for applying the V criterion */
12389  strat->cv++;
12390  return;
12391  }
12392 
12393  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12394  {
12395  if((!((ecartq>0)&&(ecart>0)))
12396  && pHasNotCF(p,q))
12397  {
12398  /*
12399  *the product criterion has applied for (s,p),
12400  *i.e. lcm(s,p)=product of the leading terms of s and p.
12401  *Suppose (s,r) is in L and the leading term
12402  *of p divides lcm(s,r)
12403  *(==> the leading term of p divides the leading term of r)
12404  *but the leading term of s does not divide the leading term of r
12405  *(notice that this condition is automatically satisfied if r is still
12406  *in S), then (s,r) can be cancelled.
12407  *This should be done here because the
12408  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12409  *
12410  *Moreover, skipping (s,r) holds also for the noncommutative case.
12411  */
12412  strat->cp++;
12413  pLmFree(Lp.lcm);
12414  Lp.lcm=NULL;
12415  return;
12416  }
12417  else
12418  Lp.ecart = si_max(ecart,ecartq);
12419  if (strat->fromT && (ecartq>ecart))
12420  {
12421  pLmFree(Lp.lcm);
12422  Lp.lcm=NULL;
12423  return;
12424  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12425  }
12426  /*
12427  *the set B collects the pairs of type (S[j],p)
12428  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12429  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12430  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12431  */
12432  {
12433  j = strat->Bl;
12434  loop
12435  {
12436  if (j < 0) break;
12437  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12438  if ((compare==1)
12439  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12440  {
12441  strat->c3++;
12442  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12443  {
12444  pLmFree(Lp.lcm);
12445  return;
12446  }
12447  break;
12448  }
12449  else
12450  if ((compare ==-1)
12451  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12452  {
12453  deleteInL(strat->B,&strat->Bl,j,strat);
12454  strat->c3++;
12455  }
12456  j--;
12457  }
12458  }
12459  }
12460  else /*sugarcrit*/
12461  {
12462  if (ALLOW_PROD_CRIT(strat))
12463  {
12464  // if currRing->nc_type!=quasi (or skew)
12465  // TODO: enable productCrit for super commutative algebras...
12466  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12467  pHasNotCF(p,q))
12468  {
12469  /*
12470  *the product criterion has applied for (s,p),
12471  *i.e. lcm(s,p)=product of the leading terms of s and p.
12472  *Suppose (s,r) is in L and the leading term
12473  *of p devides lcm(s,r)
12474  *(==> the leading term of p devides the leading term of r)
12475  *but the leading term of s does not devide the leading term of r
12476  *(notice that tis condition is automatically satisfied if r is still
12477  *in S), then (s,r) can be canceled.
12478  *This should be done here because the
12479  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12480  */
12481  strat->cp++;
12482  pLmFree(Lp.lcm);
12483  Lp.lcm=NULL;
12484  return;
12485  }
12486  if (strat->fromT && (ecartq>ecart))
12487  {
12488  pLmFree(Lp.lcm);
12489  Lp.lcm=NULL;
12490  return;
12491  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12492  }
12493  /*
12494  *the set B collects the pairs of type (S[j],p)
12495  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12496  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12497  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12498  */
12499  for(j = strat->Bl;j>=0;j--)
12500  {
12501  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12502  if (compare==1)
12503  {
12504  strat->c3++;
12505  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12506  {
12507  pLmFree(Lp.lcm);
12508  return;
12509  }
12510  break;
12511  }
12512  else
12513  if (compare ==-1)
12514  {
12515  deleteInL(strat->B,&strat->Bl,j,strat);
12516  strat->c3++;
12517  }
12518  }
12519  }
12520  }
12521  /*
12522  *the pair (S[i],p) enters B if the spoly != 0
12523  */
12524  /*- compute the short s-polynomial -*/
12525  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12526  pNorm(p);
12527  if ((q==NULL) || (p==NULL))
12528  return;
12529  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12530  Lp.p=NULL;
12531  else
12532  {
12533 // if ( rIsPluralRing(currRing) )
12534 // {
12535 // if(pHasNotCF(p, q))
12536 // {
12537 // if(ncRingType(currRing) == nc_lie)
12538 // {
12539 // // generalized prod-crit for lie-type
12540 // strat->cp++;
12541 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12542 // }
12543 // else
12544 // if( ALLOW_PROD_CRIT(strat) )
12545 // {
12546 // // product criterion for homogeneous case in SCA
12547 // strat->cp++;
12548 // Lp.p = NULL;
12549 // }
12550 // else
12551 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12552 // }
12553 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12554 // }
12555 // else
12556 // {
12557 
12558  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12559  /* p is already in this form, so convert q */
12560  // q = pMove2CurrTail(q, strat);
12561  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12562  // }
12563  }
12564  if (Lp.p == NULL)
12565  {
12566  /*- the case that the s-poly is 0 -*/
12567  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12568 // if (strat->pairtest==NULL) initPairtest(strat);
12569 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12570 // strat->pairtest[strat->sl+1] = TRUE;
12571  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12572  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12573  /*
12574  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12575  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12576  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12577  *term of p devides the lcm(s,r)
12578  *(this canceling should be done here because
12579  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12580  *the first case is handeled in chainCrit
12581  */
12582  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12583  }
12584  else
12585  {
12586  /*- the pair (S[i],p) enters B -*/
12587  /* both of them should have their LM in currRing and TAIL in tailring */
12588  Lp.p1 = q; // already in the needed form
12589  Lp.p2 = p; // already in the needed form
12590 
12591  if ( !rIsPluralRing(currRing) )
12592  pNext(Lp.p) = strat->tail;
12593 
12594  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12595  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12596  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12597  {
12598  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12599  Lp.i_r2 = atR;
12600  }
12601  else
12602  {
12603  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12604  Lp.i_r1 = -1;
12605  Lp.i_r2 = -1;
12606  }
12607  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12608 
12610  {
12611  if (!rIsPluralRing(currRing))
12612  nDelete(&(Lp.p->coef));
12613  }
12614 
12615  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12616  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12617  }
12618 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define pSetm(p)
Definition: polys.h:253
void PrintLn()
Definition: reporter.cc:310
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:717
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
int cv
Definition: kutil.h:366
int Bl
Definition: kutil.h:348
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:348
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
void PrintS(const char *s)
Definition: reporter.cc:284
int isInV(poly p, int lV)
Definition: shiftgb.cc:241
poly tail
Definition: kutil.h:330
BOOLEAN sugarCrit
Definition: kutil.h:374
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
void wrp(poly p)
Definition: polys.h:292
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1284
int l
Definition: cfEzgcd.cc:94

◆ enterOnePairSig()

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

Definition at line 2453 of file kutil.cc.

2455 {
2456  assume(i<=strat->sl);
2457 
2458  int l;
2459  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2460  // the corresponding signatures for criteria checks
2461  LObject Lp;
2462  poly pSigMult = p_Copy(pSig,currRing);
2463  poly sSigMult = p_Copy(strat->sig[i],currRing);
2464  unsigned long pSigMultNegSev,sSigMultNegSev;
2465  Lp.i_r = -1;
2466 
2467 #ifdef KDEBUG
2468  Lp.ecart=0; Lp.length=0;
2469 #endif
2470  /*- computes the lcm(s[i],p) -*/
2471  Lp.lcm = pInit();
2472  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2473 #ifndef HAVE_RATGRING
2474  pLcm(p,strat->S[i],Lp.lcm);
2475 #elif defined(HAVE_RATGRING)
2476  // if (rIsRatGRing(currRing))
2477  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2478 #endif
2479  pSetm(Lp.lcm);
2480 
2481  // set coeffs of multipliers m1 and m2
2482  pSetCoeff0(m1, nInit(1));
2483  pSetCoeff0(m2, nInit(1));
2484 //#if 1
2485 #ifdef DEBUGF5
2486  PrintS("P1 ");
2487  pWrite(pHead(p));
2488  PrintS("P2 ");
2489  pWrite(pHead(strat->S[i]));
2490  PrintS("M1 ");
2491  pWrite(m1);
2492  PrintS("M2 ");
2493  pWrite(m2);
2494 #endif
2495  // get multiplied signatures for testing
2496  pSigMult = currRing->p_Procs->pp_Mult_mm(pSigMult,m1,currRing);
2497  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2498  sSigMult = currRing->p_Procs->pp_Mult_mm(sSigMult,m2,currRing);
2499  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2500 
2501 //#if 1
2502 #ifdef DEBUGF5
2503  PrintS("----------------\n");
2504  pWrite(pSigMult);
2505  pWrite(sSigMult);
2506  PrintS("----------------\n");
2507  Lp.checked = 0;
2508 #endif
2509  int sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2510 //#if 1
2511 #if DEBUGF5
2512  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2513  pWrite(pSigMult);
2514  pWrite(sSigMult);
2515 #endif
2516  if(sigCmp==0)
2517  {
2518  // printf("!!!! EQUAL SIGS !!!!\n");
2519  // pSig = sSig, delete element due to Rewritten Criterion
2520  pDelete(&pSigMult);
2521  pDelete(&sSigMult);
2522  if (rField_is_Ring(currRing))
2523  pLmDelete(Lp.lcm);
2524  else
2525  pLmFree(Lp.lcm);
2526  Lp.lcm=NULL;
2527  pDelete (&m1);
2528  pDelete (&m2);
2529  return;
2530  }
2531  // testing by syzCrit = F5 Criterion
2532  // testing by rewCrit1 = Rewritten Criterion
2533  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2534  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2535  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2536  || strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2537  )
2538  {
2539  pDelete(&pSigMult);
2540  pDelete(&sSigMult);
2541  if (rField_is_Ring(currRing))
2542  pLmDelete(Lp.lcm);
2543  else
2544  pLmFree(Lp.lcm);
2545  Lp.lcm=NULL;
2546  pDelete (&m1);
2547  pDelete (&m2);
2548  return;
2549  }
2550  /*
2551  *the pair (S[i],p) enters B if the spoly != 0
2552  */
2553  /*- compute the short s-polynomial -*/
2554  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2555  pNorm(p);
2556 
2557  if ((strat->S[i]==NULL) || (p==NULL))
2558  return;
2559 
2560  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2561  Lp.p=NULL;
2562  else
2563  {
2564  #ifdef HAVE_PLURAL
2565  if ( rIsPluralRing(currRing) )
2566  {
2567  if(pHasNotCF(p, strat->S[i]))
2568  {
2569  if(ncRingType(currRing) == nc_lie)
2570  {
2571  // generalized prod-crit for lie-type
2572  strat->cp++;
2573  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2574  }
2575  else
2576  if( ALLOW_PROD_CRIT(strat) )
2577  {
2578  // product criterion for homogeneous case in SCA
2579  strat->cp++;
2580  Lp.p = NULL;
2581  }
2582  else
2583  {
2584  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2585  nc_CreateShortSpoly(strat->S[i], p, currRing);
2586 
2587  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2588  pNext(Lp.p) = strat->tail; // !!!
2589  }
2590  }
2591  else
2592  {
2593  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2594  nc_CreateShortSpoly(strat->S[i], p, currRing);
2595 
2596  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2597  pNext(Lp.p) = strat->tail; // !!!
2598  }
2599  }
2600  else
2601  #endif
2602  {
2604  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2605  }
2606  }
2607  // store from which element this pair comes from for further tests
2608  //Lp.from = strat->sl+1;
2609  if(sigCmp==currRing->OrdSgn)
2610  {
2611  // pSig > sSig
2612  pDelete (&sSigMult);
2613  Lp.sig = pSigMult;
2614  Lp.sevSig = ~pSigMultNegSev;
2615  }
2616  else
2617  {
2618  // pSig < sSig
2619  pDelete (&pSigMult);
2620  Lp.sig = sSigMult;
2621  Lp.sevSig = ~sSigMultNegSev;
2622  }
2623  if (Lp.p == NULL)
2624  {
2625  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2626  int pos = posInSyz(strat, Lp.sig);
2627  enterSyz(Lp, strat, pos);
2628  }
2629  else
2630  {
2631  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
2632  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
2633  {
2634  pLmFree(Lp.lcm);
2635  pDelete(&Lp.sig);
2636  Lp.lcm=NULL;
2637  pDelete (&m1);
2638  pDelete (&m2);
2639  return;
2640  }
2641  // in any case Lp is checked up to the next strat->P which is added
2642  // to S right after this critical pair creation.
2643  // NOTE: this even holds if the 2nd generator gives the bigger signature
2644  // moreover, this improves rewCriterion,
2645  // i.e. strat->checked > strat->from if and only if the 2nd generator
2646  // gives the bigger signature.
2647  Lp.checked = strat->sl+1;
2648  // at this point it is clear that the pair will be added to L, since it has
2649  // passed all tests up to now
2650 
2651  // adds buchberger's first criterion
2652  if (pLmCmp(m2,pHead(p)) == 0)
2653  {
2654  Lp.prod_crit = TRUE; // Product Criterion
2655 #if 0
2656  int pos = posInSyz(strat, Lp.sig);
2657  enterSyz(Lp, strat, pos);
2658  Lp.lcm=NULL;
2659  pDelete (&m1);
2660  pDelete (&m2);
2661  return;
2662 #endif
2663  }
2664  pDelete (&m1);
2665  pDelete (&m2);
2666 #if DEBUGF5
2667  PrintS("SIGNATURE OF PAIR: ");
2668  pWrite(Lp.sig);
2669 #endif
2670  /*- the pair (S[i],p) enters B -*/
2671  Lp.p1 = strat->S[i];
2672  Lp.p2 = p;
2673 
2674  if (
2676 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2677  )
2678  {
2679  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2680  pNext(Lp.p) = strat->tail; // !!!
2681  }
2682 
2683  if (atR >= 0)
2684  {
2685  Lp.i_r1 = strat->S_2_R[i];
2686  Lp.i_r2 = atR;
2687  }
2688  else
2689  {
2690  Lp.i_r1 = -1;
2691  Lp.i_r2 = -1;
2692  }
2693  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2694 
2696  {
2697  if (!rIsPluralRing(currRing))
2698  nDelete(&(Lp.p->coef));
2699  }
2700 
2701  l = strat->posInLSba(strat->B,strat->Bl,&Lp,strat);
2702  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2703  }
2704 }
polyset sig
Definition: kutil.h:302
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2307
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:935
#define pSetm(p)
Definition: polys.h:253
#define Print
Definition: emacs.cc:83
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
BOOLEAN(* rewCrit1)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:287
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
int Bl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:277
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:289
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
void pWrite(poly p)
Definition: polys.h:290
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1938
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:348
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:286
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
intset ecartS
Definition: kutil.h:303
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6376
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
int sl
Definition: kutil.h:344
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9692
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ enterOnePairSigRing()

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

Definition at line 2710 of file kutil.cc.

2712 {
2713  #ifdef ADIDEBUG
2714  printf("\nTrying to add p and S[%i]\n",i);
2715  pWrite(p);pWrite(pSig);
2716  pWrite(strat->S[i]);pWrite(strat->sig[i]);
2717  #endif
2718  #if ALL_VS_JUST
2719  //Over rings, if we construct the strong pair, do not add the spair
2721  {
2722  number s,t,d;
2723  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
2724 
2725  if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
2726  {
2727  nDelete(&d);
2728  nDelete(&s);
2729  nDelete(&t);
2730  return;
2731  }
2732  nDelete(&d);
2733  nDelete(&s);
2734  nDelete(&t);
2735  }
2736  #endif
2737  assume(i<=strat->sl);
2738  int l;
2739  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2740  // the corresponding signatures for criteria checks
2741  LObject Lp;
2742  poly pSigMult = p_Copy(pSig,currRing);
2743  poly sSigMult = p_Copy(strat->sig[i],currRing);
2744  unsigned long pSigMultNegSev,sSigMultNegSev;
2745  Lp.i_r = -1;
2746 
2747 #ifdef KDEBUG
2748  Lp.ecart=0; Lp.length=0;
2749 #endif
2750  /*- computes the lcm(s[i],p) -*/
2751  Lp.lcm = pInit();
2752  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2753 #ifndef HAVE_RATGRING
2754  pLcm(p,strat->S[i],Lp.lcm);
2755 #elif defined(HAVE_RATGRING)
2756  // if (rIsRatGRing(currRing))
2757  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2758 #endif
2759  pSetm(Lp.lcm);
2760 
2761  // set coeffs of multipliers m1 and m2
2763  {
2764  number s = nCopy(pGetCoeff(strat->S[i]));
2765  number t = nCopy(pGetCoeff(p));
2766  pSetCoeff0(Lp.lcm, n_Lcm(s, t, currRing->cf));
2767  ksCheckCoeff(&s, &t, currRing->cf);
2768  pSetCoeff0(m1,s);
2769  pSetCoeff0(m2,t);
2770  #ifdef ADIDEBUG
2771  printf("\nIn Spoly: m1, m2 :\n");pWrite(m1);pWrite(m2);
2772  #endif
2773  }
2774  else
2775  {
2776  pSetCoeff0(m1, nInit(1));
2777  pSetCoeff0(m2, nInit(1));
2778  }
2779 #ifdef DEBUGF5
2780  Print("P1 ");
2781  pWrite(pHead(p));
2782  Print("P2 ");
2783  pWrite(pHead(strat->S[i]));
2784  Print("M1 ");
2785  pWrite(m1);
2786  Print("M2 ");
2787  pWrite(m2);
2788 #endif
2789 
2790  // get multiplied signatures for testing
2791  pSigMult = pp_Mult_mm(pSigMult,m1,currRing);
2792  if(pSigMult != NULL)
2793  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2794  sSigMult = pp_Mult_mm(sSigMult,m2,currRing);
2795  if(sSigMult != NULL)
2796  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2797 //#if 1
2798 #ifdef DEBUGF5
2799  Print("----------------\n");
2800  pWrite(pSigMult);
2801  pWrite(sSigMult);
2802  Print("----------------\n");
2803  Lp.checked = 0;
2804 #endif
2805  int sigCmp;
2806  if(pSigMult != NULL && sSigMult != NULL)
2807  {
2809  sigCmp = p_LtCmpNoAbs(pSigMult,sSigMult,currRing);
2810  else
2811  sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2812  }
2813  else
2814  {
2815  if(pSigMult == NULL)
2816  {
2817  if(sSigMult == NULL)
2818  sigCmp = 0;
2819  else
2820  sigCmp = -1;
2821  }
2822  else
2823  sigCmp = 1;
2824  }
2825 //#if 1
2826 #if DEBUGF5
2827  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2828  pWrite(pSigMult);
2829  pWrite(sSigMult);
2830 #endif
2831  //In the ring case we already build the sig
2833  {
2834  if(sigCmp == 0)
2835  {
2836  #ifdef ADIDEBUG
2837  printf("\nPossible sigdrop in enterpairSig (due to lost of sig)\n");
2838  #endif
2839  //sigdrop since we loose the signature
2840  strat->sigdrop = TRUE;
2841  //Try to reduce it as far as we can via redRing
2843  {
2844  poly p1 = p_Copy(p,currRing);
2845  poly p2 = p_Copy(strat->S[i],currRing);
2846  p1 = p_Mult_mm(p1,m1,currRing);
2847  p2 = p_Mult_mm(p2,m2,currRing);
2848  Lp.p = p_Sub(p1,p2,currRing);
2849  if(Lp.p != NULL)
2850  Lp.sev = p_GetShortExpVector(Lp.p,currRing);
2851  }
2852  int red_result = redRing(&Lp,strat);
2853  #ifdef ADIDEBUG
2854  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
2855  #endif
2856  if(red_result == 0)
2857  {
2858  // Cancel the sigdrop
2859  #ifdef ADIDEBUG
2860  printf("\nCancel the sigdrop. It reduced to 0\n");
2861  #endif
2862  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
2863  strat->sigdrop = FALSE;
2864  return;
2865  }
2866  else
2867  {
2868  #ifdef ADIDEBUG
2869  printf("\nSigdrop. end\n");
2870  #endif
2871  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
2872  #if 1
2873  strat->enterS(Lp,0,strat,strat->tl);
2874  #endif
2875  return;
2876  }
2877  }
2878  if(pSigMult != NULL && sSigMult != NULL && p_LmCmp(pSigMult,sSigMult,currRing) == 0)
2879  {
2880  //Same lm, have to substract
2881  Lp.sig = p_Sub(pCopy(pSigMult),pCopy(sSigMult),currRing);
2882  }
2883  else
2884  {
2885  if(sigCmp == 1)
2886  {
2887  Lp.sig = pCopy(pSigMult);
2888  }
2889  if(sigCmp == -1)
2890  {
2891  Lp.sig = pNeg(pCopy(sSigMult));
2892  }
2893  }
2894  Lp.sevSig = p_GetShortExpVector(Lp.sig,currRing);
2895  }
2896 
2897  #if 0
2898  if(sigCmp==0)
2899  {
2900  // printf("!!!! EQUAL SIGS !!!!\n");
2901  // pSig = sSig, delete element due to Rewritten Criterion
2902  pDelete(&pSigMult);
2903  pDelete(&sSigMult);
2904  if (rField_is_Ring(currRing))
2905  pLmDelete(Lp.lcm);
2906  else
2907  pLmFree(Lp.lcm);
2908  Lp.lcm=NULL;
2909  pDelete (&m1);
2910  pDelete (&m2);
2911  return;
2912  }
2913  #endif
2914  // testing by syzCrit = F5 Criterion
2915  // testing by rewCrit1 = Rewritten Criterion
2916  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2917  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2918  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2919  // With this rewCrit activated i get a wrong deletion in sba_int_56.tst
2920  //|| strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2921  )
2922  {
2923  #ifdef ADIDEBUG
2924  printf("\nDELETED!\n");
2925  #endif
2926  pDelete(&pSigMult);
2927  pDelete(&sSigMult);
2928  if (rField_is_Ring(currRing))
2929  pLmDelete(Lp.lcm);
2930  else
2931  pLmFree(Lp.lcm);
2932  Lp.lcm=NULL;
2933  pDelete (&m1);
2934  pDelete (&m2);
2935  return;
2936  }
2937  /*
2938  *the pair (S[i],p) enters B if the spoly != 0
2939  */
2940  /*- compute the short s-polynomial -*/
2941  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2942  pNorm(p);
2943 
2944  if ((strat->S[i]==NULL) || (p==NULL))
2945  return;
2946 
2947  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2948  Lp.p=NULL;
2949  else
2950  {
2951  //Build p
2953  {
2954  poly p1 = p_Copy(p,currRing);
2955  poly p2 = p_Copy(strat->S[i],currRing);
2956  p1 = p_Mult_mm(p1,m1,currRing);
2957  p2 = p_Mult_mm(p2,m2,currRing);
2958  Lp.p = p_Sub(p1,p2,currRing);
2959  if(Lp.p != NULL)
2960  Lp.sev = p_GetShortExpVector(Lp.p,currRing);
2961  }
2962  else
2963  {
2964  #ifdef HAVE_PLURAL
2965  if ( rIsPluralRing(currRing) )
2966  {
2967  if(ncRingType(currRing) == nc_lie)
2968  {
2969  // generalized prod-crit for lie-type
2970  strat->cp++;
2971  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2972  }
2973  else
2974  if( ALLOW_PROD_CRIT(strat) )
2975  {
2976  // product criterion for homogeneous case in SCA
2977  strat->cp++;
2978  Lp.p = NULL;
2979  }
2980  else
2981  {
2982  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2983  nc_CreateShortSpoly(strat->S[i], p, currRing);
2984 
2985  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2986  pNext(Lp.p) = strat->tail; // !!!
2987  }
2988  }
2989  else
2990  #endif
2991  {
2993  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2994  }
2995  }
2996  }
2997  // store from which element this pair comes from for further tests
2998  //Lp.from = strat->sl+1;
3000  {
3001  //Put the sig to be > 0
3002  if(!nGreaterZero(pGetCoeff(Lp.sig)))
3003  {
3004  Lp.sig = pNeg(Lp.sig);
3005  Lp.p = pNeg(Lp.p);
3006  }
3007  }
3008  else
3009  {
3010  if(sigCmp==currRing->OrdSgn)
3011  {
3012  // pSig > sSig
3013  pDelete (&sSigMult);
3014  Lp.sig = pSigMult;
3015  Lp.sevSig = ~pSigMultNegSev;
3016  }
3017  else
3018  {
3019  // pSig < sSig
3020  pDelete (&pSigMult);
3021  Lp.sig = sSigMult;
3022  Lp.sevSig = ~sSigMultNegSev;
3023  }
3024  }
3025  if (Lp.p == NULL)
3026  {
3027  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
3028  int pos = posInSyz(strat, Lp.sig);
3029  enterSyz(Lp, strat, pos);
3030  }
3031  else
3032  {
3033  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
3034  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
3035  {
3036  pLmFree(Lp.lcm);
3037  #ifdef ADIDEBUG
3038  printf("\nrewCrit3 deletes it!\n");
3039  #endif
3040  pDelete(&Lp.sig);
3041  Lp.lcm=NULL;
3042  pDelete (&m1);
3043  pDelete (&m2);
3044  return;
3045  }
3046  // in any case Lp is checked up to the next strat->P which is added
3047  // to S right after this critical pair creation.
3048  // NOTE: this even holds if the 2nd generator gives the bigger signature
3049  // moreover, this improves rewCriterion,
3050  // i.e. strat->checked > strat->from if and only if the 2nd generator
3051  // gives the bigger signature.
3052  Lp.checked = strat->sl+1;
3053  // at this point it is clear that the pair will be added to L, since it has
3054  // passed all tests up to now
3055 
3056  // adds buchberger's first criterion
3057  if (pLmCmp(m2,pHead(p)) == 0)
3058  {
3059  Lp.prod_crit = TRUE; // Product Criterion
3060 #if 0
3061  int pos = posInSyz(strat, Lp.sig);
3062  enterSyz(Lp, strat, pos);
3063  Lp.lcm=NULL;
3064  pDelete (&m1);
3065  pDelete (&m2);
3066  return;
3067 #endif
3068  }
3069  pDelete (&m1);
3070  pDelete (&m2);
3071 #if DEBUGF5
3072  PrintS("SIGNATURE OF PAIR: ");
3073  pWrite(Lp.sig);
3074 #endif
3075  /*- the pair (S[i],p) enters B -*/
3076  Lp.p1 = strat->S[i];
3077  Lp.p2 = p;
3078 
3079  if (
3081 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
3083  )
3084  {
3085  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
3086  pNext(Lp.p) = strat->tail; // !!!
3087  }
3088 
3089  if (atR >= 0)
3090  {
3091  Lp.i_r1 = strat->S_2_R[i];
3092  Lp.i_r2 = atR;
3093  }
3094  else
3095  {
3096  Lp.i_r1 = -1;
3097  Lp.i_r2 = -1;
3098  }
3099  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3100 
3102  {
3104  nDelete(&(Lp.p->coef));
3105  }
3106  // Check for sigdrop
3107  if(rField_is_Ring(currRing) && pLtCmp(Lp.sig,pSig) == -1)
3108  {
3109  #ifdef ADIDEBUG
3110  printf("\nSigDrop in enteronepairSig\n");pWrite(Lp.sig);
3111  pWrite(p);pWrite(pSig);
3112  pWrite(strat->S[i]);pWrite(strat->sig[i]);
3113  #endif
3114  strat->sigdrop = TRUE;
3115  // Completely reduce it
3116  int red_result = redRing(&Lp,strat);
3117  if(red_result == 0)
3118  {
3119  // Reduced to 0
3120  #ifdef ADIDEBUG
3121  printf("\nCancel the sigdrop after redRing (=0)\n");
3122  #endif
3123  strat->sigdrop = FALSE;
3124  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
3125  return;
3126  }
3127  else
3128  {
3129  #ifdef ADIDEBUG
3130  printf("\nAfter redRing still sigdrop:\n");pWrite(Lp.p);
3131  #endif
3132  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
3133  // 0 - add just the original poly causing the sigdrop, 1 - add also this
3134  #if 1
3135  strat->enterS(Lp,0,strat, strat->tl+1);
3136  #endif
3137  return;
3138  }
3139  }
3140  #ifdef ADIDEBUG
3141  printf("\nThis spair was added to B:\n");
3142  pWrite(Lp.p);
3143  pWrite(Lp.p1);
3144  pWrite(Lp.p2);
3145  pWrite(Lp.sig);
3146  #endif
3147  l = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
3148  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3149  }
3150 }
polyset sig
Definition: kutil.h:302
const CanonicalForm int s
Definition: facAbsFact.cc:55
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2307
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:935
#define pSetm(p)
Definition: polys.h:253
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
#define Print
Definition: emacs.cc:83
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:60
bool sigdrop
Definition: kutil.h:356
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
int ksCheckCoeff(number *a, number *b)
#define pNeg(p)
Definition: polys.h:181
int tl
Definition: kutil.h:346
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:98
#define pLcm(a, b, m)
Definition: polys.h:277
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:289
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
void pWrite(poly p)
Definition: polys.h:290
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1938
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
poly p_Sub(poly p1, poly p2, const ring r)
Definition: p_polys.cc:1943
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:286
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define nGreaterZero(n)
Definition: numbers.h:27
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1467
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:716
int cp
Definition: kutil.h:343
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:697
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6376
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:169
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
int sl
Definition: kutil.h:344
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
int l
Definition: cfEzgcd.cc:94
static int p_LtCmpNoAbs(poly p, poly q, const ring r)
Definition: p_polys.h:1527
Definition: nc.h:26
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9692
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ enterOnePairSpecial()

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

Definition at line 3156 of file kutil.cc.

3157 {
3158  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
3159  if(pHasNotCF(p,strat->S[i]))
3160  {
3161  //PrintS("prod-crit\n");
3162  if(ALLOW_PROD_CRIT(strat))
3163  {
3164  //PrintS("prod-crit\n");
3165  strat->cp++;
3166  return;
3167  }
3168  }
3169 
3170  int l;
3171  LObject Lp;
3172  Lp.i_r = -1;
3173 
3174  Lp.lcm = pInit();
3175  pLcm(p,strat->S[i],Lp.lcm);
3176  pSetm(Lp.lcm);
3177  /*- compute the short s-polynomial -*/
3178 
3179  #ifdef HAVE_PLURAL
3180  if (rIsPluralRing(currRing))
3181  {
3182  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
3183  }
3184  else
3185  #endif
3186  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
3187 
3188  if (Lp.p == NULL)
3189  {
3190  //PrintS("short spoly==NULL\n");
3191  pLmFree(Lp.lcm);
3192  }
3193  else
3194  {
3195  /*- the pair (S[i],p) enters L -*/
3196  Lp.p1 = strat->S[i];
3197  Lp.p2 = p;
3198  if (atR >= 0)
3199  {
3200  Lp.i_r1 = strat->S_2_R[i];
3201  Lp.i_r2 = atR;
3202  }
3203  else
3204  {
3205  Lp.i_r1 = -1;
3206  Lp.i_r2 = -1;
3207  }
3208  assume(pNext(Lp.p) == NULL);
3209  pNext(Lp.p) = strat->tail;
3210  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3212  {
3213  nDelete(&(Lp.p->coef));
3214  }
3215  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
3216  //Print("-> L[%d]\n",l);
3217  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3218  }
3219 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define pSetm(p)
Definition: polys.h:253
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1938
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
int l
Definition: cfEzgcd.cc:94

◆ enterOneStrongPoly()

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

Definition at line 1533 of file kutil.cc.

1534 {
1535  number d, s, t;
1536  assume(atR >= 0);
1537  poly m1, m2, gcd,si;
1538  if(!enterTstrong)
1539  {
1540  assume(i<=strat->sl);
1541  si = strat->S[i];
1542  }
1543  else
1544  {
1545  assume(i<=strat->tl);
1546  si = strat->T[i].p;
1547  }
1548  //printf("\n--------------------------------\n");
1549  //pWrite(p);pWrite(si);
1550  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1551 
1552  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1553  {
1554  nDelete(&d);
1555  nDelete(&s);
1556  nDelete(&t);
1557  return FALSE;
1558  }
1559 
1560  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1561  //p_Test(m1,strat->tailRing);
1562  //p_Test(m2,strat->tailRing);
1563  /*if(!enterTstrong)
1564  {
1565  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1566  {
1567  memset(&(strat->P), 0, sizeof(strat->P));
1568  kStratChangeTailRing(strat);
1569  strat->P = *(strat->R[atR]);
1570  p_LmFree(m1, strat->tailRing);
1571  p_LmFree(m2, strat->tailRing);
1572  p_LmFree(gcd, currRing);
1573  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1574  }
1575  }*/
1576  pSetCoeff0(m1, s);
1577  pSetCoeff0(m2, t);
1578  pSetCoeff0(gcd, d);
1579  p_Test(m1,strat->tailRing);
1580  p_Test(m2,strat->tailRing);
1581  //printf("\n===================================\n");
1582  //pWrite(m1);pWrite(m2);pWrite(gcd);
1583 #ifdef KDEBUG
1584  if (TEST_OPT_DEBUG)
1585  {
1586  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1587  PrintS("m1 = ");
1588  p_wrp(m1, strat->tailRing);
1589  PrintS(" ; m2 = ");
1590  p_wrp(m2, strat->tailRing);
1591  PrintS(" ; gcd = ");
1592  wrp(gcd);
1593  PrintS("\n--- create strong gcd poly: ");
1594  Print("\n p: %d", i);
1595  wrp(p);
1596  Print("\n strat->S[%d]: ", i);
1597  wrp(si);
1598  PrintS(" ---> ");
1599  }
1600 #endif
1601 
1602  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1603  p_LmDelete(m1, strat->tailRing);
1604  p_LmDelete(m2, strat->tailRing);
1605 #ifdef KDEBUG
1606  if (TEST_OPT_DEBUG)
1607  {
1608  wrp(gcd);
1609  PrintLn();
1610  }
1611 #endif
1612 
1613  LObject h;
1614  h.p = gcd;
1615  h.tailRing = strat->tailRing;
1616  int posx;
1617  h.pCleardenom();
1618  strat->initEcart(&h);
1619  h.sev = pGetShortExpVector(h.p);
1620  h.i_r1 = -1;h.i_r2 = -1;
1621  if (currRing!=strat->tailRing)
1622  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1623  if(!enterTstrong)
1624  {
1625  #if 1
1626  h.p1 = p;h.p2 = strat->S[i];
1627  #endif
1628  if (atR >= 0)
1629  {
1630  h.i_r2 = strat->S_2_R[i];
1631  h.i_r1 = atR;
1632  }
1633  else
1634  {
1635  h.i_r1 = -1;
1636  h.i_r2 = -1;
1637  }
1638  if (strat->Ll==-1)
1639  posx =0;
1640  else
1641  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1642  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1643  }
1644  else
1645  {
1646  if(h.IsNull()) return FALSE;
1647  //int red_result;
1648  //reduzieren ist teur!!!
1649  //if(strat->L != NULL)
1650  //red_result = strat->red(&h,strat);
1651  if(!h.IsNull())
1652  {
1653  enterT(h, strat,-1);
1654  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1655  //strat->enterS(h,pos,strat,-1);
1656  }
1657  }
1658  //#if 1
1659  #ifdef ADIDEBUG
1660  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1661  #endif
1662  return TRUE;
1663 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
const CanonicalForm int s
Definition: facAbsFact.cc:55
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
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:697
LSet L
Definition: kutil.h:321
#define nIsZero(n)
Definition: numbers.h:19
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
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:978
TSet T
Definition: kutil.h:320
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

◆ enterOneStrongPolySig()

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

Definition at line 1728 of file kutil.cc.

1729 {
1730  number d, s, t;
1731  assume(atR >= 0);
1732  poly m1, m2, gcd,si;
1733  assume(i<=strat->sl);
1734  si = strat->S[i];
1735  //printf("\n--------------------------------\n");
1736  //pWrite(p);pWrite(si);
1737  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1738 
1739  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1740  {
1741  nDelete(&d);
1742  nDelete(&s);
1743  nDelete(&t);
1744  return FALSE;
1745  }
1746 
1747  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1748  //p_Test(m1,strat->tailRing);
1749  //p_Test(m2,strat->tailRing);
1750  /*if(!enterTstrong)
1751  {
1752  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1753  {
1754  memset(&(strat->P), 0, sizeof(strat->P));
1755  kStratChangeTailRing(strat);
1756  strat->P = *(strat->R[atR]);
1757  p_LmFree(m1, strat->tailRing);
1758  p_LmFree(m2, strat->tailRing);
1759  p_LmFree(gcd, currRing);
1760  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1761  }
1762  }*/
1763  pSetCoeff0(m1, s);
1764  pSetCoeff0(m2, t);
1765  pSetCoeff0(gcd, d);
1766  p_Test(m1,strat->tailRing);
1767  p_Test(m2,strat->tailRing);
1768  //printf("\n===================================\n");
1769  //pWrite(m1);pWrite(m2);pWrite(gcd);
1770 #ifdef KDEBUG
1771  if (TEST_OPT_DEBUG)
1772  {
1773  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1774  PrintS("m1 = ");
1775  p_wrp(m1, strat->tailRing);
1776  PrintS(" ; m2 = ");
1777  p_wrp(m2, strat->tailRing);
1778  PrintS(" ; gcd = ");
1779  wrp(gcd);
1780  PrintS("\n--- create strong gcd poly: ");
1781  Print("\n p: %d", i);
1782  wrp(p);
1783  Print("\n strat->S[%d]: ", i);
1784  wrp(si);
1785  PrintS(" ---> ");
1786  }
1787 #endif
1788 
1789  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1790 
1791 #ifdef KDEBUG
1792  if (TEST_OPT_DEBUG)
1793  {
1794  wrp(gcd);
1795  PrintLn();
1796  }
1797 #endif
1798 
1799  //Check and set the signatures
1800  poly pSigMult = p_Copy(sig,currRing);
1801  poly sSigMult = p_Copy(strat->sig[i],currRing);
1802  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1803  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1804  p_LmDelete(m1, strat->tailRing);
1805  p_LmDelete(m2, strat->tailRing);
1806  poly pairsig;
1807  if(pLmCmp(pSigMult,sSigMult) == 0)
1808  {
1809  //Same lm, have to add them
1810  pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1811  //This might be zero
1812  }
1813  else
1814  {
1815  //Set the sig to either pSigMult or sSigMult
1816  if(pLtCmp(pSigMult,sSigMult)==1)
1817  {
1818  pairsig = pSigMult;
1819  pDelete(&sSigMult);
1820  }
1821  else
1822  {
1823  pairsig = sSigMult;
1824  pDelete(&pSigMult);
1825  }
1826  }
1827 
1828  LObject h;
1829  h.p = gcd;
1830  h.tailRing = strat->tailRing;
1831  h.sig = pairsig;
1832  int posx;
1833  h.pCleardenom();
1834  strat->initEcart(&h);
1835  h.sev = pGetShortExpVector(h.p);
1836  h.i_r1 = -1;h.i_r2 = -1;
1837  if (currRing!=strat->tailRing)
1838  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1839  if(h.sig == NULL)
1840  {
1841  #ifdef ADIDEBUG
1842  printf("\nPossible sigdrop in enterpairstrongSig (due to lost of sig)\n");
1843  #endif
1844  //sigdrop since we loose the signature
1845  strat->sigdrop = TRUE;
1846  //Try to reduce it as far as we can via redRing
1847  int red_result = redRing(&h,strat);
1848  #ifdef ADIDEBUG
1849  printf("\nAfter redRing reduce:\n");pWrite(h.p);
1850  #endif
1851  if(red_result == 0)
1852  {
1853  // Cancel the sigdrop
1854  #ifdef ADIDEBUG
1855  printf("\nCancel the sigdrop. It reduced to 0\n");
1856  #endif
1857  p_Delete(&h.sig,currRing);h.sig = NULL;
1858  strat->sigdrop = FALSE;
1859  return FALSE;
1860  }
1861  else
1862  {
1863  #ifdef ADIDEBUG
1864  printf("\nSigdrop. end\n");
1865  #endif
1866  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1867  #if 1
1868  strat->enterS(h,0,strat,strat->tl);
1869  #endif
1870  return FALSE;
1871  }
1872  }
1873  if(!nGreaterZero(pGetCoeff(h.sig)))
1874  {
1875  h.sig = pNeg(h.sig);
1876  h.p = pNeg(h.p);
1877  }
1878 
1879  if(rField_is_Ring(currRing) && pLtCmp(h.sig,sig) == -1)
1880  {
1881  #ifdef ADIDEBUG
1882  printf("\nSigDrop in enteronestrongpolySig\n");
1883  pWrite(h.sig);
1884  pWrite(p);pWrite(sig);
1885  pWrite(strat->S[i]);pWrite(strat->sig[i]);
1886  #endif
1887  strat->sigdrop = TRUE;
1888  // Completely reduce it
1889  int red_result = redRing(&h,strat);
1890  if(red_result == 0)
1891  {
1892  // Reduced to 0
1893  #ifdef ADIDEBUG
1894  printf("\nCancel the sigdrop after redRing (=0)\n");
1895  #endif
1896  strat->sigdrop = FALSE;
1897  p_Delete(&h.sig,currRing);h.sig = NULL;
1898  return FALSE;
1899  }
1900  else
1901  {
1902  #ifdef ADIDEBUG
1903  printf("\nAfter redRing still sigdrop:\n");pWrite(h.p);
1904  #endif
1905  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1906  // 0 - add just the original poly causing the sigdrop, 1 - add also this
1907  #if 1
1908  strat->enterS(h,0,strat, strat->tl+1);
1909  #endif
1910  return FALSE;
1911  }
1912  }
1913  #ifdef ADIDEBUG
1914  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);pWrite(h.sig);
1915  #endif
1916  //Check for sigdrop
1917  if(gcd != NULL && pLtCmp(sig,pairsig) > 0 && pLtCmp(strat->sig[i],pairsig) > 0)
1918  {
1919  #ifdef ADIDEBUG
1920  printf("\nSigDrop in strongpair\noriginals: ");pWrite(sig);pWrite(strat->sig[i]);
1921  printf("\nnow: ");pWrite(pairsig);
1922  #endif
1923  strat->sigdrop = TRUE;
1924  //Enter this element to S
1925  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1926  strat->enterS(h,strat->sl+1,strat,strat->tl+1);
1927  }
1928  #if 1
1929  h.p1 = p;h.p2 = strat->S[i];
1930  #endif
1931  if (atR >= 0)
1932  {
1933  h.i_r2 = strat->S_2_R[i];
1934  h.i_r1 = atR;
1935  }
1936  else
1937  {
1938  h.i_r1 = -1;
1939  h.i_r2 = -1;
1940  }
1941  if (strat->Ll==-1)
1942  posx =0;
1943  else
1944  posx = strat->posInLSba(strat->L,strat->Ll,&h,strat);
1945  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1946  return TRUE;
1947 }
polyset sig
Definition: kutil.h:302
const CanonicalForm int s
Definition: facAbsFact.cc:55
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
bool sigdrop
Definition: kutil.h:356
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
#define pNeg(p)
Definition: polys.h:181
int tl
Definition: kutil.h:346
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
#define nGreaterZero(n)
Definition: numbers.h:27
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:697
LSet L
Definition: kutil.h:321
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
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:978
int sl
Definition: kutil.h:344
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

◆ enterOneZeroPairRing()

void enterOneZeroPairRing ( poly  f,
poly  t_p,
poly  p,
int  ecart,
kStrategy  strat,
int  atR = -1 
)

Definition at line 4248 of file kutil.cc.

4249 {
4250  int l,j,compare,compareCoeff;
4251  LObject Lp;
4252 
4253 #ifdef KDEBUG
4254  Lp.ecart=0; Lp.length=0;
4255 #endif
4256  /*- computes the lcm(s[i],p) -*/
4257  Lp.lcm = pInit();
4258 
4259  pLcm(p,f,Lp.lcm);
4260  pSetm(Lp.lcm);
4261  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
4262  assume(!strat->sugarCrit);
4263  assume(!strat->fromT);
4264  /*
4265  *the set B collects the pairs of type (S[j],p)
4266  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
4267  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
4268  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
4269  */
4270  for(j = strat->Bl;j>=0;j--)
4271  {
4272  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
4273  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
4274  if (compareCoeff == 0 || compare == compareCoeff)
4275  {
4276  if (compare == 1)
4277  {
4278  strat->c3++;
4279  pLmDelete(Lp.lcm);
4280  return;
4281  }
4282  else
4283  if (compare == -1)
4284  {
4285  deleteInL(strat->B,&strat->Bl,j,strat);
4286  strat->c3++;
4287  }
4288  }
4289  if (compare == pDivComp_EQUAL)
4290  {
4291  // Add hint for same LM and direction of LC (later) (TODO Oliver)
4292  if (compareCoeff == 1)
4293  {
4294  strat->c3++;
4295  pLmDelete(Lp.lcm);
4296  return;
4297  }
4298  else
4299  if (compareCoeff == -1)
4300  {
4301  deleteInL(strat->B,&strat->Bl,j,strat);
4302  strat->c3++;
4303  }
4304  }
4305  }
4306  /*
4307  *the pair (S[i],p) enters B if the spoly != 0
4308  */
4309  /*- compute the short s-polynomial -*/
4310  if ((f==NULL) || (p==NULL)) return;
4311  pNorm(p);
4312  {
4313  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
4314  }
4315  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
4316  {
4317  /*- the case that the s-poly is 0 -*/
4318 // if (strat->pairtest==NULL) initPairtest(strat);
4319 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
4320 // strat->pairtest[strat->sl+1] = TRUE;
4321  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
4322  /*
4323  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
4324  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
4325  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
4326  *term of p devides the lcm(s,r)
4327  *(this canceling should be done here because
4328  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
4329  *the first case is handeled in chainCrit
4330  */
4331  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
4332  }
4333  else
4334  {
4335  /*- the pair (S[i],p) enters B -*/
4336  Lp.p1 = f;
4337  Lp.p2 = p;
4338 
4339  pNext(Lp.p) = strat->tail;
4340 
4341  LObject tmp_h(f, currRing, strat->tailRing);
4342  tmp_h.SetShortExpVector();
4343  strat->initEcart(&tmp_h);
4344  tmp_h.sev = pGetShortExpVector(tmp_h.p);
4345  tmp_h.t_p = t_p;
4346 
4347  enterT(tmp_h, strat, strat->tl + 1);
4348 
4349  if (atR >= 0)
4350  {
4351  Lp.i_r2 = atR;
4352  Lp.i_r1 = strat->tl;
4353  }
4354 
4355  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
4356  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
4357  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
4358  }
4359 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define pSetm(p)
Definition: polys.h:253
#define pDivComp_EQUAL
Definition: kutil.cc:140
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:1017
int Bmax
Definition: kutil.h:348
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
FILE * f
Definition: checklibs.c:9
poly tail
Definition: kutil.h:330
BOOLEAN sugarCrit
Definition: kutil.h:374
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:149
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
int l
Definition: cfEzgcd.cc:94

◆ enterpairs()

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

Definition at line 4952 of file kutil.cc.

4953 {
4954  int j=pos;
4955 
4957  initenterpairs(h,k,ecart,0,strat, atR);
4958  if ( (!strat->fromT)
4959  && ((strat->syzComp==0)
4960  ||(pGetComp(h)<=strat->syzComp)))
4961  {
4962  unsigned long h_sev = pGetShortExpVector(h);
4963  loop
4964  {
4965  if (j > k) break;
4966  clearS(h,h_sev, &j,&k,strat);
4967  j++;
4968  }
4969  }
4970 }
int syzComp
Definition: kutil.h:350
loop
Definition: myNF.cc:98
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3847
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ enterpairsShift()

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

Definition at line 12700 of file kutil.cc.

12701 {
12702  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12703  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12704  int j=pos;
12705 
12707  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12708  if ( (!strat->fromT)
12709  && ((strat->syzComp==0)
12710  ||(pGetComp(h)<=strat->syzComp)))
12711  {
12712  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12713  unsigned long h_sev = pGetShortExpVector(h);
12714  loop
12715  {
12716  if (j > k) break;
12717  clearS(h,h_sev, &j,&k,strat);
12718  j++;
12719  }
12720  //Print("end clearS sl=%d\n",strat->sl);
12721  }
12722  // PrintS("end enterpairs\n");
12723 }
int syzComp
Definition: kutil.h:350
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
void initenterpairsShift(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
Definition: kutil.cc:12627
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ enterpairsSig()

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

Definition at line 4978 of file kutil.cc.

4979 {
4980  int j=pos;
4982  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4983  if ( (!strat->fromT)
4984  && ((strat->syzComp==0)
4985  ||(pGetComp(h)<=strat->syzComp)))
4986  {
4987  unsigned long h_sev = pGetShortExpVector(h);
4988  loop
4989  {
4990  if (j > k) break;
4991  clearS(h,h_sev, &j,&k,strat);
4992  j++;
4993  }
4994  }
4995 }
int syzComp
Definition: kutil.h:350
loop
Definition: myNF.cc:98
void initenterpairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3917
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

◆ enterpairsSpecial()

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

Definition at line 5001 of file kutil.cc.

5002 {
5003  int j;
5004  const int iCompH = pGetComp(h);
5005 
5006  if (rField_is_Ring(currRing))
5007  {
5008  for (j=0; j<=k; j++)
5009  {
5010  const int iCompSj = pGetComp(strat->S[j]);
5011  if ((iCompH==iCompSj)
5012  //|| (0==iCompH) // can only happen,if iCompSj==0
5013  || (0==iCompSj))
5014  {
5015  enterOnePairRing(j,h,ecart,FALSE,strat, atR);
5016  }
5017  }
5018  kMergeBintoL(strat);
5019  }
5020  else
5021  {
5022  for (j=0; j<=k; j++)
5023  {
5024  const int iCompSj = pGetComp(strat->S[j]);
5025  if ((iCompH==iCompSj)
5026  //|| (0==iCompH) // can only happen,if iCompSj==0
5027  || (0==iCompSj))
5028  {
5029  enterOnePairSpecial(j,h,ecart,strat, atR);
5030  }
5031  }
5032  }
5033 
5034  if (strat->noClearS) return;
5035 
5036 // #ifdef HAVE_PLURAL
5037 /*
5038  if (rIsPluralRing(currRing))
5039  {
5040  j=pos;
5041  loop
5042  {
5043  if (j > k) break;
5044 
5045  if (pLmDivisibleBy(h, strat->S[j]))
5046  {
5047  deleteInS(j, strat);
5048  j--;
5049  k--;
5050  }
5051 
5052  j++;
5053  }
5054  }
5055  else
5056 */
5057 // #endif // ??? Why was the following cancelation disabled for non-commutative rings?
5058  {
5059  j=pos;
5060  loop
5061  {
5062  unsigned long h_sev = pGetShortExpVector(h);
5063  if (j > k) break;
5064  clearS(h,h_sev,&j,&k,strat);
5065  j++;
5066  }
5067  }
5068 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
char noClearS
Definition: kutil.h:399
int k
Definition: cfEzgcd.cc:93
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1293
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:3156
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
polyset S
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
static Poly * h
Definition: janet.cc:978

◆ enterSBba()

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

Definition at line 9255 of file kutil.cc.

9256 {
9257  strat->news = TRUE;
9258  /*- puts p to the standardbasis s at position at -*/
9259  if (strat->sl == IDELEMS(strat->Shdl)-1)
9260  {
9261  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9262  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9263  (IDELEMS(strat->Shdl)+setmaxTinc)
9264  *sizeof(unsigned long));
9265  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9266  IDELEMS(strat->Shdl)*sizeof(int),
9267  (IDELEMS(strat->Shdl)+setmaxTinc)
9268  *sizeof(int));
9269  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9270  IDELEMS(strat->Shdl)*sizeof(int),
9271  (IDELEMS(strat->Shdl)+setmaxTinc)
9272  *sizeof(int));
9273  if (strat->lenS!=NULL)
9274  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9275  IDELEMS(strat->Shdl)*sizeof(int),
9276  (IDELEMS(strat->Shdl)+setmaxTinc)
9277  *sizeof(int));
9278  if (strat->lenSw!=NULL)
9279  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9280  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9281  (IDELEMS(strat->Shdl)+setmaxTinc)
9282  *sizeof(wlen_type));
9283  if (strat->fromQ!=NULL)
9284  {
9285  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9286  IDELEMS(strat->Shdl)*sizeof(int),
9287  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9288  }
9289  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9290  IDELEMS(strat->Shdl)+=setmaxTinc;
9291  strat->Shdl->m=strat->S;
9292  }
9293  if (atS <= strat->sl)
9294  {
9295 #ifdef ENTER_USE_MEMMOVE
9296  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9297  (strat->sl - atS + 1)*sizeof(poly));
9298  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9299  (strat->sl - atS + 1)*sizeof(int));
9300  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9301  (strat->sl - atS + 1)*sizeof(unsigned long));
9302  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9303  (strat->sl - atS + 1)*sizeof(int));
9304  if (strat->lenS!=NULL)
9305  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9306  (strat->sl - atS + 1)*sizeof(int));
9307  if (strat->lenSw!=NULL)
9308  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9309  (strat->sl - atS + 1)*sizeof(wlen_type));
9310 #else
9311  for (i=strat->sl+1; i>=atS+1; i--)
9312  {
9313  strat->S[i] = strat->S[i-1];
9314  strat->ecartS[i] = strat->ecartS[i-1];
9315  strat->sevS[i] = strat->sevS[i-1];
9316  strat->S_2_R[i] = strat->S_2_R[i-1];
9317  }
9318  if (strat->lenS!=NULL)
9319  for (i=strat->sl+1; i>=atS+1; i--)
9320  strat->lenS[i] = strat->lenS[i-1];
9321  if (strat->lenSw!=NULL)
9322  for (i=strat->sl+1; i>=atS+1; i--)
9323  strat->lenSw[i] = strat->lenSw[i-1];
9324 #endif
9325  }
9326  if (strat->fromQ!=NULL)
9327  {
9328 #ifdef ENTER_USE_MEMMOVE
9329  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9330  (strat->sl - atS + 1)*sizeof(int));
9331 #else
9332  for (i=strat->sl+1; i>=atS+1; i--)
9333  {
9334  strat->fromQ[i] = strat->fromQ[i-1];
9335  }
9336 #endif
9337  strat->fromQ[atS]=0;
9338  }
9339 
9340  /*- save result -*/
9341  strat->S[atS] = p.p;
9342  if (strat->honey) strat->ecartS[atS] = p.ecart;
9343  if (p.sev == 0)
9344  p.sev = pGetShortExpVector(p.p);
9345  else
9346  assume(p.sev == pGetShortExpVector(p.p));
9347  strat->sevS[atS] = p.sev;
9348  strat->ecartS[atS] = p.ecart;
9349  strat->S_2_R[atS] = atR;
9350  strat->sl++;
9351 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:374
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:98
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297

◆ enterSMora()

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

Definition at line 1362 of file kstd1.cc.

1363 {
1364  enterSBba(p, atS, strat, atR);
1365  #ifdef KDEBUG
1366  if (TEST_OPT_DEBUG)
1367  {
1368  Print("new s%d:",atS);
1369  p_wrp(p.p,currRing,strat->tailRing);
1370  PrintLn();
1371  }
1372  #endif
1373  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1374  if (strat->kHEdgeFound)
1375  {
1376  if (newHEdge(strat))
1377  {
1378  firstUpdate(strat);
1379  if (TEST_OPT_FINDET)
1380  return;
1381 
1382  /*- cuts elements in L above noether and reorders L -*/
1383  updateLHC(strat);
1384  /*- reorders L with respect to posInL -*/
1385  reorderL(strat);
1386  }
1387  }
1388  else if (strat->kNoether!=NULL)
1389  strat->kHEdgeFound = TRUE;
1390  else if (TEST_OPT_FASTHC)
1391  {
1392  if (strat->posInLOldFlag)
1393  {
1394  missingAxis(&strat->lastAxis,strat);
1395  if (strat->lastAxis)
1396  {
1397  strat->posInLOld = strat->posInL;
1398  strat->posInLOldFlag = FALSE;
1399  strat->posInL = posInL10;
1400  strat->posInLDependsOnLength = TRUE;
1401  updateL(strat);
1402  reorderL(strat);
1403  }
1404  }
1405  else if (strat->lastAxis)
1406  updateL(strat);
1407  }
1408 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
poly kNoether
Definition: kutil.h:324
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:103
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
void updateL(kStrategy strat)
Definition: kstd1.cc:1131
int lastAxis
Definition: kutil.h:352
#define TEST_OPT_FINDET
Definition: options.h:106
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:1015
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1202
void reorderL(kStrategy strat)
Definition: kstd1.cc:957
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:282
BOOLEAN kHEdgeFound
Definition: kutil.h:373
#define NULL
Definition: omList.c:10
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1295
ring tailRing
Definition: kutil.h:339
BOOLEAN posInLOldFlag
Definition: kutil.h:379
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10762
#define TEST_OPT_FASTHC
Definition: options.h:104
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9255

◆ enterSMoraNF()

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

Definition at line 1416 of file kstd1.cc.

1417 {
1418  enterSBba(p, atS, strat, atR);
1419  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1420  if (strat->kHEdgeFound)
1421  newHEdge(strat);
1422  else if (strat->kNoether!=NULL)
1423  strat->kHEdgeFound = TRUE;
1424 }
return P p
Definition: myNF.cc:203
poly kNoether
Definition: kutil.h:324
#define TRUE
Definition: auxiliary.h:98
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
BOOLEAN kHEdgeFound
Definition: kutil.h:373
#define NULL
Definition: omList.c:10
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10762
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9255

◆ enterSSba()

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

Definition at line 9357 of file kutil.cc.

9358 {
9359  strat->news = TRUE;
9360  /*- puts p to the standardbasis s at position at -*/
9361  if (strat->sl == IDELEMS(strat->Shdl)-1)
9362  {
9363  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9364  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9365  (IDELEMS(strat->Shdl)+setmaxTinc)
9366  *sizeof(unsigned long));
9367  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9368  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9369  (IDELEMS(strat->Shdl)+setmaxTinc)
9370  *sizeof(unsigned long));
9371  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9372  IDELEMS(strat->Shdl)*sizeof(int),
9373  (IDELEMS(strat->Shdl)+setmaxTinc)
9374  *sizeof(int));
9375  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9376  IDELEMS(strat->Shdl)*sizeof(int),
9377  (IDELEMS(strat->Shdl)+setmaxTinc)
9378  *sizeof(int));
9379  if (strat->lenS!=NULL)
9380  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9381  IDELEMS(strat->Shdl)*sizeof(int),
9382  (IDELEMS(strat->Shdl)+setmaxTinc)
9383  *sizeof(int));
9384  if (strat->lenSw!=NULL)
9385  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9386  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9387  (IDELEMS(strat->Shdl)+setmaxTinc)
9388  *sizeof(wlen_type));
9389  if (strat->fromQ!=NULL)
9390  {
9391  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9392  IDELEMS(strat->Shdl)*sizeof(int),
9393  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9394  }
9395  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9396  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
9397  IDELEMS(strat->Shdl)+=setmaxTinc;
9398  strat->Shdl->m=strat->S;
9399  }
9400  // in a signature-based algorithm the following situation will never
9401  // appear due to the fact that the critical pairs are already sorted
9402  // by increasing signature.
9403  // True. However, in the case of integers we need to put the element
9404  // that caused the signature drop on the first position
9405  if (atS <= strat->sl)
9406  {
9407 #ifdef ENTER_USE_MEMMOVE
9408  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9409  (strat->sl - atS + 1)*sizeof(poly));
9410  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9411  (strat->sl - atS + 1)*sizeof(poly));
9412  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9413  (strat->sl - atS + 1)*sizeof(unsigned long));
9414  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9415  (strat->sl - atS + 1)*sizeof(int));
9416  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9417  (strat->sl - atS + 1)*sizeof(unsigned long));
9418  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9419  (strat->sl - atS + 1)*sizeof(int));
9420  if (strat->lenS!=NULL)
9421  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9422  (strat->sl - atS + 1)*sizeof(int));
9423  if (strat->lenSw!=NULL)
9424  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9425  (strat->sl - atS + 1)*sizeof(wlen_type));
9426 #else
9427  for (i=strat->sl+1; i>=atS+1; i--)
9428  {
9429  strat->S[i] = strat->S[i-1];
9430  strat->ecartS[i] = strat->ecartS[i-1];
9431  strat->sevS[i] = strat->sevS[i-1];
9432  strat->S_2_R[i] = strat->S_2_R[i-1];
9433  strat->sig[i] = strat->sig[i-1];
9434  strat->sevSig[i] = strat->sevSig[i-1];
9435  }
9436  if (strat->lenS!=NULL)
9437  for (i=strat->sl+1; i>=atS+1; i--)
9438  strat->lenS[i] = strat->lenS[i-1];
9439  if (strat->lenSw!=NULL)
9440  for (i=strat->sl+1; i>=atS+1; i--)
9441  strat->lenSw[i] = strat->lenSw[i-1];
9442 #endif
9443  }
9444  if (strat->fromQ!=NULL)
9445  {
9446 #ifdef ENTER_USE_MEMMOVE
9447  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9448  (strat->sl - atS + 1)*sizeof(int));
9449 #else
9450  for (i=strat->sl+1; i>=atS+1; i--)
9451  {
9452  strat->fromQ[i] = strat->fromQ[i-1];
9453  }
9454 #endif
9455  strat->fromQ[atS]=0;
9456  }
9457 
9458  /*- save result -*/
9459  strat->S[atS] = p.p;
9460  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9461  if (strat->honey) strat->ecartS[atS] = p.ecart;
9462  if (p.sev == 0)
9463  p.sev = pGetShortExpVector(p.p);
9464  else
9465  assume(p.sev == pGetShortExpVector(p.p));
9466  strat->sevS[atS] = p.sev;
9467  // during the interreduction process of a signature-based algorithm we do not
9468  // compute the signature at this point, but when the whole interreduction
9469  // process finishes, i.e. f5c terminates!
9470  if (p.sig != NULL)
9471  {
9472  if (p.sevSig == 0)
9473  p.sevSig = pGetShortExpVector(p.sig);
9474  else
9475  assume(p.sevSig == pGetShortExpVector(p.sig));
9476  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9477  }
9478  strat->ecartS[atS] = p.ecart;
9479  strat->S_2_R[atS] = atR;
9480  strat->sl++;
9481 #ifdef DEBUGF5
9482  int k;
9483  Print("--- LIST S: %d ---\n",strat->sl);
9484  for(k=0;k<=strat->sl;k++)
9485  {
9486  pWrite(strat->sig[k]);
9487  }
9488  PrintS("--- LIST S END ---\n");
9489 #endif
9490 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:374
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297

◆ enterSyz()

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

Definition at line 9692 of file kutil.cc.

9693 {
9694  #ifdef ADIDEBUG
9695  printf("\n Entersyz:\n");pWrite(p.sig);
9696  #endif
9697  int i;
9698  strat->newt = TRUE;
9699  if (strat->syzl == strat->syzmax-1)
9700  {
9701  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9702  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9703  (strat->syzmax)*sizeof(unsigned long),
9704  ((strat->syzmax)+setmaxTinc)
9705  *sizeof(unsigned long));
9706  strat->syzmax += setmaxTinc;
9707  }
9708  if (atT < strat->syzl)
9709  {
9710 #ifdef ENTER_USE_MEMMOVE
9711  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9712  (strat->syzl-atT+1)*sizeof(poly));
9713  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9714  (strat->syzl-atT+1)*sizeof(unsigned long));
9715 #endif
9716  for (i=strat->syzl; i>=atT+1; i--)
9717  {
9718 #ifndef ENTER_USE_MEMMOVE
9719  strat->syz[i] = strat->syz[i-1];
9720  strat->sevSyz[i] = strat->sevSyz[i-1];
9721 #endif
9722  }
9723  }
9724  //i = strat->syzl;
9725  i = atT;
9726  //Makes sure the syz saves just the signature
9727  #ifdef HAVE_RINGS
9729  pNext(p.sig) = NULL;
9730  #endif
9731  strat->syz[atT] = p.sig;
9732  strat->sevSyz[atT] = p.sevSig;
9733  strat->syzl++;
9734 #if F5DEBUG
9735  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9736  pWrite(strat->syz[atT]);
9737 #endif
9738  // recheck pairs in strat->L with new rule and delete correspondingly
9739  int cc = strat->Ll;
9740  while (cc>-1)
9741  {
9742  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9743  //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);
9744  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9745  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9746  #ifdef HAVE_RINGS
9747  &&((!rField_is_Ring(currRing))
9748  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9749  #endif
9750  )
9751  {
9752  //printf("\nYES!\n");
9753  #ifdef ADIDEBUG
9754  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9755  #endif
9756  deleteInL(strat->L,&strat->Ll,cc,strat);
9757  }
9758  cc--;
9759  }
9760 //#if 1
9761 #ifdef DEBUGF5
9762  PrintS("--- Syzygies ---\n");
9763  Print("syzl %d\n",strat->syzl);
9764  Print("syzmax %d\n",strat->syzmax);
9765  PrintS("--------------------------------\n");
9766  for(i=0;i<=strat->syzl-1;i++)
9767  {
9768  Print("%d - ",i);
9769  pWrite(strat->syz[i]);
9770  }
9771  PrintS("--------------------------------\n");
9772 #endif
9773 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:345
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:398
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3594
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:317
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:301
polyrec * poly
Definition: hilb.h:10
int syzl
Definition: kutil.h:345

◆ enterT()

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

Definition at line 9495 of file kutil.cc.

9496 {
9497  int i;
9498 
9499  pp_Test(p.p, currRing, p.tailRing);
9500  assume(strat->tailRing == p.tailRing);
9501  // redMoraNF complains about this -- but, we don't really
9502  // neeed this so far
9503  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9504  assume(p.FDeg == p.pFDeg());
9505  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9506 
9507 #ifdef KDEBUG
9508  // do not put an LObject twice into T:
9509  for(i=strat->tl;i>=0;i--)
9510  {
9511  if (p.p==strat->T[i].p)
9512  {
9513  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9514  return;
9515  }
9516  }
9517 #endif
9518 
9519 #ifdef HAVE_TAIL_RING
9520  if (currRing!=strat->tailRing)
9521  {
9522  p.t_p=p.GetLmTailRing();
9523  }
9524 #endif
9525  strat->newt = TRUE;
9526  if (atT < 0)
9527  atT = strat->posInT(strat->T, strat->tl, p);
9528  if (strat->tl == strat->tmax-1)
9529  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9530  if (atT <= strat->tl)
9531  {
9532 #ifdef ENTER_USE_MEMMOVE
9533  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9534  (strat->tl-atT+1)*sizeof(TObject));
9535  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9536  (strat->tl-atT+1)*sizeof(unsigned long));
9537 #endif
9538  for (i=strat->tl+1; i>=atT+1; i--)
9539  {
9540 #ifndef ENTER_USE_MEMMOVE
9541  strat->T[i] = strat->T[i-1];
9542  strat->sevT[i] = strat->sevT[i-1];
9543 #endif
9544  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9545  }
9546  }
9547 
9548  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9549  {
9551  (strat->tailRing != NULL ?
9552  strat->tailRing : currRing),
9553  strat->tailBin);
9554  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9555  }
9556  strat->T[atT] = (TObject) p;
9557  #ifdef ADIDEBUG
9558  printf("\nenterT: add in position %i\n",atT);
9559  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9560  #endif
9561  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9562 
9563  if (pNext(p.p) != NULL)
9564  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9565  else
9566  strat->T[atT].max_exp = NULL;
9567 
9568  strat->tl++;
9569  strat->R[strat->tl] = &(strat->T[atT]);
9570  strat->T[atT].i_r = strat->tl;
9571  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9572  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9573  kTest_T(&(strat->T[atT]));
9574 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:398
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:319
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:531
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:162
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:869
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:336
static unsigned pLength(poly a)
Definition: p_polys.h:189
int tmax
Definition: kutil.h:346
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
omBin tailBin
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:320
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
#define kTest_T(T)
Definition: kutil.h:650
class sTObject TObject
Definition: kutil.h:59
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:1137

◆ enterT_strong()

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

Definition at line 9580 of file kutil.cc.

9581 {
9583  int i;
9584 
9585  pp_Test(p.p, currRing, p.tailRing);
9586  assume(strat->tailRing == p.tailRing);
9587  // redMoraNF complains about this -- but, we don't really
9588  // neeed this so far
9589  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9590  assume(p.FDeg == p.pFDeg());
9591  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9592 
9593 #ifdef KDEBUG
9594  // do not put an LObject twice into T:
9595  for(i=strat->tl;i>=0;i--)
9596  {
9597  if (p.p==strat->T[i].p)
9598  {
9599  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9600  return;
9601  }
9602  }
9603 #endif
9604 
9605 #ifdef HAVE_TAIL_RING
9606  if (currRing!=strat->tailRing)
9607  {
9608  p.t_p=p.GetLmTailRing();
9609  }
9610 #endif
9611  strat->newt = TRUE;
9612  if (atT < 0)
9613  atT = strat->posInT(strat->T, strat->tl, p);
9614  if (strat->tl == strat->tmax-1)
9615  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9616  if (atT <= strat->tl)
9617  {
9618 #ifdef ENTER_USE_MEMMOVE
9619  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9620  (strat->tl-atT+1)*sizeof(TObject));
9621  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9622  (strat->tl-atT+1)*sizeof(unsigned long));
9623 #endif
9624  for (i=strat->tl+1; i>=atT+1; i--)
9625  {
9626 #ifndef ENTER_USE_MEMMOVE
9627  strat->T[i] = strat->T[i-1];
9628  strat->sevT[i] = strat->sevT[i-1];
9629 #endif
9630  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9631  }
9632  }
9633 
9634  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9635  {
9637  (strat->tailRing != NULL ?
9638  strat->tailRing : currRing),
9639  strat->tailBin);
9640  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9641  }
9642  strat->T[atT] = (TObject) p;
9643  #ifdef ADIDEBUG
9644  printf("\nenterT_strong: add in position %i\n",atT);
9645  pWrite(p.p);
9646  #endif
9647  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9648 
9649  if (pNext(p.p) != NULL)
9650  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9651  else
9652  strat->T[atT].max_exp = NULL;
9653 
9654  strat->tl++;
9655  strat->R[strat->tl] = &(strat->T[atT]);
9656  strat->T[atT].i_r = strat->tl;
9657  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9658  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9659  #if 1
9661  && !n_IsUnit(p.p->coef, currRing->cf))
9662  {
9663  #ifdef ADIDEBUG
9664  printf("\nDas ist p:\n");pWrite(p.p);
9665  #endif
9666  for(i=strat->tl;i>=0;i--)
9667  {
9668  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9669  {
9670  #ifdef ADIDEBUG
9671  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9672  #endif
9673  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9674  }
9675  }
9676  }
9677  /*
9678  printf("\nThis is T:\n");
9679  for(i=strat->tl;i>=0;i--)
9680  {
9681  pWrite(strat->T[i].p);
9682  }
9683  //getchar();*/
9684  #endif
9685  kTest_T(&(strat->T[atT]));
9686 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
char newt
Definition: kutil.h:398
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:319
void pWrite(poly p)
Definition: polys.h:290
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:531
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:162
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:869
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:336
static unsigned pLength(poly a)
Definition: p_polys.h:189
int tmax
Definition: kutil.h:346
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1533
ring tailRing
Definition: kutil.h:339
omBin tailBin
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:320
#define kTest_T(T)
Definition: kutil.h:650
class sTObject TObject
Definition: kutil.h:59
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:1137

◆ enterTShift()

void enterTShift ( LObject  p,
kStrategy  strat,
int  atT,
int  uptodeg,
int  lV 
)

Definition at line 12731 of file kutil.cc.

12732 {
12733  /* determine how many elements we have to insert */
12734  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12735  /* hence, a total number of elt's to add is: */
12736  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12737 
12738  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12739 
12740 #ifdef PDEBUG
12741  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12742 #endif
12743  int i;
12744 
12745  if (atT < 0)
12746  atT = strat->posInT(strat->T, strat->tl, p);
12747 
12748  /* can call enterT in a sequence, e.g. */
12749 
12750  /* shift0 = it's our model for further shifts */
12751  enterT(p,strat,atT);
12752  LObject qq;
12753  for (i=1; i<=toInsert; i++) // toIns - 1?
12754  {
12755  qq = p; //qq.Copy();
12756  qq.p = NULL;
12757  qq.max_exp = NULL;
12758  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12759  qq.GetP();
12760  // update q.sev
12761  qq.sev = pGetShortExpVector(qq.p);
12762  /* enter it into T, first el't is with the shift 0 */
12763  // compute the position for qq
12764  atT = strat->posInT(strat->T, strat->tl, qq);
12765  enterT(qq,strat,atT);
12766  }
12767 /* Q: what to do with this one in the orig enterT ? */
12768 /* strat->R[strat->tl] = &(strat->T[atT]); */
12769 /* Solution: it is done by enterT each time separately */
12770 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:346
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:77
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
TSet T
Definition: kutil.h:320

◆ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10194 of file kutil.cc.

10195 {
10196  /*- release temp data -*/
10197  cleanT(strat);
10198  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10199  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10200  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10201  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10202  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10203  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10204  /*- set L: should be empty -*/
10205  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10206  /*- set B: should be empty -*/
10207  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10208  pLmDelete(&strat->tail);
10209  strat->syzComp=0;
10210 }
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:319
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:348
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:316
TSet T
Definition: kutil.h:320
ideal Shdl
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:59

◆ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10387 of file kutil.cc.

10388 {
10389  /*- release temp data -*/
10391  cleanTSbaRing(strat);
10392  else
10393  cleanT(strat);
10394  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10395  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10396  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10397  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10398  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10399  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10400  if(strat->syzmax>0)
10401  {
10402  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10403  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10404  if (strat->sbaOrder == 1)
10405  {
10406  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10407  }
10408  }
10409  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10410  /*- set L: should be empty -*/
10411  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10412  /*- set B: should be empty -*/
10413  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10414  /*- set sig: no need for the signatures anymore -*/
10415  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10416  pLmDelete(&strat->tail);
10417  strat->syzComp=0;
10418 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
int syzComp
Definition: kutil.h:350
int syzmax
Definition: kutil.h:345
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void cleanTSbaRing(kStrategy strat)
Definition: kutil.cc:603
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:319
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:348
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
unsigned sbaOrder
Definition: kutil.h:310
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
int syzidxmax
Definition: kutil.h:345
unsigned long * sevS
Definition: kutil.h:316
unsigned long * sevSyz
Definition: kutil.h:317
polyset syz
Definition: kutil.h:301
TSet T
Definition: kutil.h:320
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:59
intset syzIdx
Definition: kutil.h:307

◆ faugereRewCriterion()

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

Definition at line 7228 of file kutil.cc.

7229 {
7230  //printf("Faugere Rewritten Criterion\n");
7232  return FALSE;
7233 //#if 1
7234 #ifdef DEBUGF5
7235  PrintS("rewritten criterion checks: ");
7236  pWrite(sig);
7237 #endif
7238  for(int k = strat->sl; k>=start; k--)
7239  {
7240 //#if 1
7241 #ifdef DEBUGF5
7242  PrintS("checking with: ");
7243  pWrite(strat->sig[k]);
7244  pWrite(pHead(strat->S[k]));
7245 #endif
7246  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7247  {
7248 //#if 1
7249 #ifdef DEBUGF5
7250  PrintS("DELETE!\n");
7251 #endif
7252  #ifdef ADIDEBUG
7253  printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
7254  #endif
7255  strat->nrrewcrit++;
7256  return TRUE;
7257  }
7258  //k--;
7259  }
7260 #ifdef DEBUGF5
7261  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7262  for(int kk = 0; kk<strat->sl+1; kk++)
7263  {
7264  pWrite(pHead(strat->S[kk]));
7265  }
7266  PrintS("------------------------------\n");
7267 #endif
7268  return FALSE;
7269 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrrewcrit
Definition: kutil.h:358
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int sl
Definition: kutil.h:344

◆ 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 11214 of file kutil.cc.

11215 {
11216  if(!nCoeff_is_Ring_Z(currRing->cf))
11217  return;
11218  poly p,pp;
11219  for(int j = 0; j<=strat->sl; j++)
11220  {
11221  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11222  {
11223  for(int i = 0; i<=strat->sl; i++)
11224  {
11225  if((i != j) && (strat->S[i] != NULL))
11226  {
11227  p = strat->S[i];
11228  if(pLmDivisibleBy(strat->S[j], p))
11229  {
11230  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11231  p_SetCoeff(p,dummy,currRing);
11232  }
11233  pp = pNext(p);
11234  if((pp == NULL) && (nIsZero(p->coef)))
11235  {
11236  deleteInS(i, strat);
11237  }
11238  else
11239  {
11240  while(pp != NULL)
11241  {
11242  if(pLmDivisibleBy(strat->S[j], pp))
11243  {
11244  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11245  p_SetCoeff(pp,dummy,currRing);
11246  if(nIsZero(pp->coef))
11247  {
11248  pLmDelete(&pNext(p));
11249  pp = pNext(p);
11250  }
11251  else
11252  {
11253  p = pp;
11254  pp = pNext(p);
11255  }
11256  }
11257  else
11258  {
11259  p = pp;
11260  pp = pNext(p);
11261  }
11262  }
11263  }
11264  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11265  {
11266  if(pNext(strat->S[i]) == NULL)
11267  strat->S[i]=NULL;
11268  else
11269  strat->S[i]=pNext(strat->S[i]);
11270  }
11271  }
11272  }
11273  //idPrint(strat->Shdl);
11274  }
11275  }
11276  //idSkipZeroes(strat->Shdl);
11277 }
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,b,r) >=0
Definition: coeffs.h:632
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10

◆ getIndexRng()

int getIndexRng ( long  coeff)
inline

Definition at line 6617 of file kutil.cc.

6618 {
6619  if (coeff == 0) return -1;
6620  long tmp = coeff;
6621  int ind = 0;
6622  while (tmp % 2 == 0)
6623  {
6624  tmp = tmp / 2;
6625  ind++;
6626  }
6627  return ind;
6628 }

◆ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 482 of file kutil.cc.

483 {
484  int j,/*k,*/p;
485 
486  strat->kHEdgeFound=FALSE;
487  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
488  {
489  return;
490  }
491  if (strat->ak > 1) /*we are in the module case*/
492  {
493  return; // until ....
494  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
495  // return FALSE;
496  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
497  // return FALSE;
498  }
499  // k = 0;
500  p=pIsPurePower(pp);
501  if (rField_is_Ring(currRing) && (!n_IsUnit(pGetCoeff(pp),currRing->cf))) return;
502  if (p!=0) strat->NotUsedAxis[p] = FALSE;
503  /*- the leading term of pp is a power of the p-th variable -*/
504  for (j=(currRing->N);j>0; j--)
505  {
506  if (strat->NotUsedAxis[j])
507  {
508  return;
509  }
510  }
511  strat->kHEdgeFound=TRUE;
512 }
#define pIsPurePower(p)
Definition: polys.h:231
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:328
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:349
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
poly pp
Definition: myNF.cc:296
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
BOOLEAN kHEdgeFound
Definition: kutil.h:373
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477

◆ ind2()

long ind2 ( long  arg)

Definition at line 4213 of file kutil.cc.

4214 {
4215  long ind = 0;
4216  if (arg <= 0) return 0;
4217  while (arg%2 == 0)
4218  {
4219  arg = arg / 2;
4220  ind++;
4221  }
4222  return ind;
4223 }

◆ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4225 of file kutil.cc.

4226 {
4227  long ind = 0;
4228  if (arg <= 0) return 0;
4229  if (arg%2 == 1) { arg--; }
4230  while (arg > 0)
4231  {
4232  ind += ind2(arg);
4233  arg = arg - 2;
4234  }
4235  return ind;
4236 }
long ind2(long arg)
Definition: kutil.cc:4213

◆ initBuchMora()

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

Definition at line 10118 of file kutil.cc.

10119 {
10120  strat->interpt = BTEST1(OPT_INTERRUPT);
10121  strat->kHEdge=NULL;
10123  /*- creating temp data structures------------------- -*/
10124  strat->cp = 0;
10125  strat->c3 = 0;
10126  strat->tail = pInit();
10127  /*- set s -*/
10128  strat->sl = -1;
10129  /*- set L -*/
10130  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10131  strat->Ll = -1;
10132  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10133  /*- set B -*/
10134  strat->Bmax = setmaxL;
10135  strat->Bl = -1;
10136  strat->B = initL();
10137  /*- set T -*/
10138  strat->tl = -1;
10139  strat->tmax = setmaxT;
10140  strat->T = initT();
10141  strat->R = initR();
10142  strat->sevT = initsevT();
10143  /*- init local data struct.---------------------------------------- -*/
10144  strat->P.ecart=0;
10145  strat->P.length=0;
10146  strat->P.pLength=0;
10148  {
10149  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10150  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10151  }
10153  {
10154  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10155  }
10156  else
10157  {
10158  if(TEST_OPT_SB_1)
10159  {
10160  int i;
10161  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10162  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10163  {
10164  P->m[i-strat->newIdeal] = F->m[i];
10165  F->m[i] = NULL;
10166  }
10167  initSSpecial(F,Q,P,strat);
10168  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10169  {
10170  F->m[i] = P->m[i-strat->newIdeal];
10171  P->m[i-strat->newIdeal] = NULL;
10172  }
10173  idDelete(&P);
10174  }
10175  else
10176  {
10177  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10178  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10179  }
10180  }
10181  strat->fromT = FALSE;
10183  if ((!TEST_OPT_SB_1)
10184  || (rField_is_Ring(currRing))
10185  )
10186  {
10187  updateS(TRUE,strat);
10188  }
10189  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10190  strat->fromQ=NULL;
10191  assume(kTest_TS(strat));
10192 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8155
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8561
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:649
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9026
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:418
int newIdeal
Definition: kutil.h:353
ideal Shdl
Definition: kutil.h:297
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9794 of file kutil.cc.

9795 {
9797  strat->chainCrit=chainCritNormal;
9798  if (TEST_OPT_SB_1)
9799  strat->chainCrit=chainCritOpt_1;
9800 #ifdef HAVE_RINGS
9801  if (rField_is_Ring(currRing))
9802  {
9804  strat->chainCrit=chainCritRing;
9805  }
9806 #endif
9807 #ifdef HAVE_RATGRING
9808  if (rIsRatGRing(currRing))
9809  {
9810  strat->chainCrit=chainCritPart;
9811  /* enterOnePairNormal get rational part in it */
9812  }
9813 #endif
9814  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9815  && (!rIsPluralRing(currRing)))
9817 
9818  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9819  strat->Gebauer = strat->homog || strat->sugarCrit;
9820  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9821  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9822  strat->pairtest = NULL;
9823  /* alway use tailreduction, except:
9824  * - in local rings, - in lex order case, -in ring over extensions */
9826  //if(rHasMixedOrdering(currRing)==2)
9827  //{
9828  // strat->noTailReduction =TRUE;
9829  //}
9830 
9831 #ifdef HAVE_PLURAL
9832  // and r is plural_ring
9833  // hence this holds for r a rational_plural_ring
9834  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9835  { //or it has non-quasi-comm type... later
9836  strat->sugarCrit = FALSE;
9837  strat->Gebauer = FALSE;
9838  strat->honey = FALSE;
9839  }
9840 #endif
9841 
9842  // Coefficient ring?
9843  if (rField_is_Ring(currRing))
9844  {
9845  strat->sugarCrit = FALSE;
9846  strat->Gebauer = FALSE ;
9847  strat->honey = FALSE;
9848  }
9849  #ifdef KDEBUG
9850  if (TEST_OPT_DEBUG)
9851  {
9852  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9853  else PrintS("ideal/module is not homogeneous\n");
9854  }
9855  #endif
9856 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3270
static void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2237
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:329
BOOLEAN z2homog
Definition: kutil.h:371
#define TEST_OPT_DEBUG
Definition: options.h:103
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1293
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1954
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:284
BOOLEAN homog
Definition: kutil.h:369
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4040
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:375
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:374
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
#define TEST_OPT_SB_1
Definition: options.h:113
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3483
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3558

◆ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9945 of file kutil.cc.

9946 {
9948  {
9949  if (strat->honey)
9950  {
9951  strat->posInL = posInL15;
9952  // ok -- here is the deal: from my experiments for Singular-2-0
9953  // I conclude that that posInT_EcartpLength is the best of
9954  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9955  // see the table at the end of this file
9956  if (TEST_OPT_OLDSTD)
9957  strat->posInT = posInT15;
9958  else
9959  strat->posInT = posInT_EcartpLength;
9960  }
9961  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9962  {
9963  strat->posInL = posInL11;
9964  strat->posInT = posInT11;
9965  }
9966  else if (TEST_OPT_INTSTRATEGY)
9967  {
9968  strat->posInL = posInL11;
9969  strat->posInT = posInT11;
9970  }
9971  else
9972  {
9973  strat->posInL = posInL0;
9974  strat->posInT = posInT0;
9975  }
9976  //if (strat->minim>0) strat->posInL =posInLSpecial;
9977  if (strat->homog)
9978  {
9979  strat->posInL = posInL110;
9980  strat->posInT = posInT110;
9981  }
9982  }
9983  else
9984  {
9985  if (strat->homog)
9986  {
9987  strat->posInL = posInL11;
9988  strat->posInT = posInT11;
9989  }
9990  else
9991  {
9992  if ((currRing->order[0]==ringorder_c)
9993  ||(currRing->order[0]==ringorder_C))
9994  {
9995  strat->posInL = posInL17_c;
9996  strat->posInT = posInT17_c;
9997  }
9998  else
9999  {
10000  strat->posInL = posInL17;
10001  strat->posInT = posInT17;
10002  }
10003  }
10004  }
10005  if (strat->minim>0) strat->posInL =posInLSpecial;
10006  // for further tests only
10007  if ((BTEST1(11)) || (BTEST1(12)))
10008  strat->posInL = posInL11;
10009  else if ((BTEST1(13)) || (BTEST1(14)))
10010  strat->posInL = posInL13;
10011  else if ((BTEST1(15)) || (BTEST1(16)))
10012  strat->posInL = posInL15;
10013  else if ((BTEST1(17)) || (BTEST1(18)))
10014  strat->posInL = posInL17;
10015  if (BTEST1(11))
10016  strat->posInT = posInT11;
10017  else if (BTEST1(13))
10018  strat->posInT = posInT13;
10019  else if (BTEST1(15))
10020  strat->posInT = posInT15;
10021  else if ((BTEST1(17)))
10022  strat->posInT = posInT17;
10023  else if ((BTEST1(19)))
10024  strat->posInT = posInT19;
10025  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10026  strat->posInT = posInT1;
10028 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6416
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6837
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
#define BTEST1(a)
Definition: options.h:32
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5729
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9929
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5419
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5931
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6158
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7007
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5824
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5572
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661

◆ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10031 of file kutil.cc.

10032 {
10034  {
10035  if (strat->honey)
10036  {
10037  strat->posInL = posInL15Ring;
10038  // ok -- here is the deal: from my experiments for Singular-2-0
10039  // I conclude that that posInT_EcartpLength is the best of
10040  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10041  // see the table at the end of this file
10042  if (TEST_OPT_OLDSTD)
10043  strat->posInT = posInT15Ring;
10044  else
10045  strat->posInT = posInT_EcartpLength;
10046  }
10047  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10048  {
10049  strat->posInL = posInL11Ring;
10050  strat->posInT = posInT11;
10051  }
10052  else if (TEST_OPT_INTSTRATEGY)
10053  {
10054  strat->posInL = posInL11Ring;
10055  strat->posInT = posInT11;
10056  }
10057  else
10058  {
10059  strat->posInL = posInL0Ring;
10060  strat->posInT = posInT0;
10061  }
10062  //if (strat->minim>0) strat->posInL =posInLSpecial;
10063  if (strat->homog)
10064  {
10065  strat->posInL = posInL110Ring;
10066  strat->posInT = posInT110Ring;
10067  }
10068  }
10069  else
10070  {
10071  if (strat->homog)
10072  {
10073  //printf("\nHere 3\n");
10074  strat->posInL = posInL11Ring;
10075  strat->posInT = posInT11Ring;
10076  }
10077  else
10078  {
10079  if ((currRing->order[0]==ringorder_c)
10080  ||(currRing->order[0]==ringorder_C))
10081  {
10082  strat->posInL = posInL17_cRing;
10083  strat->posInT = posInT17_cRing;
10084  }
10085  else
10086  {
10087  strat->posInL = posInL11Ringls;
10088  strat->posInT = posInT17Ring;
10089  }
10090  }
10091  }
10092  if (strat->minim>0) strat->posInL =posInLSpecial;
10093  // for further tests only
10094  if ((BTEST1(11)) || (BTEST1(12)))
10095  strat->posInL = posInL11Ring;
10096  else if ((BTEST1(13)) || (BTEST1(14)))
10097  strat->posInL = posInL13;
10098  else if ((BTEST1(15)) || (BTEST1(16)))
10099  strat->posInL = posInL15Ring;
10100  else if ((BTEST1(17)) || (BTEST1(18)))
10101  strat->posInL = posInL17Ring;
10102  if (BTEST1(11))
10103  strat->posInT = posInT11Ring;
10104  else if (BTEST1(13))
10105  strat->posInT = posInT13;
10106  else if (BTEST1(15))
10107  strat->posInT = posInT15Ring;
10108  else if ((BTEST1(17)))
10109  strat->posInT = posInT17Ring;
10110  else if ((BTEST1(19)))
10111  strat->posInT = posInT19;
10112  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10113  strat->posInT = posInT1;
10115 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6458
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6528
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6872
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6957
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6755
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5783
#define BTEST1(a)
Definition: options.h:32
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7071
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9929
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5419
BOOLEAN homog
Definition: kutil.h:369
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5455
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5885
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5614
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6184
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5992
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661

◆ initBuchMoraShift()

void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 12114 of file kutil.cc.

12115 {
12116  strat->interpt = BTEST1(OPT_INTERRUPT);
12117  strat->kHEdge=NULL;
12119  /*- creating temp data structures------------------- -*/
12120  strat->cp = 0;
12121  strat->c3 = 0;
12122  strat->cv = 0;
12123  strat->tail = pInit();
12124  /*- set s -*/
12125  strat->sl = -1;
12126  /*- set L -*/
12127  strat->Lmax = setmaxL;
12128  strat->Ll = -1;
12129  strat->L = initL();
12130  /*- set B -*/
12131  strat->Bmax = setmaxL;
12132  strat->Bl = -1;
12133  strat->B = initL();
12134  /*- set T -*/
12135  strat->tl = -1;
12136  strat->tmax = setmaxT;
12137  strat->T = initT();
12138  strat->R = initR();
12139  strat->sevT = initsevT();
12140  /*- init local data struct.---------------------------------------- -*/
12141  strat->P.ecart=0;
12142  strat->P.length=0;
12144  {
12145  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12146  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12147  }
12149  {
12150  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12151  }
12152  {
12153  if(TEST_OPT_SB_1)
12154  {
12155  int i;
12156  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12157  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12158  {
12159  P->m[i-strat->newIdeal] = F->m[i];
12160  F->m[i] = NULL;
12161  }
12162  initSSpecial(F,Q,P,strat);
12163  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12164  {
12165  F->m[i] = P->m[i-strat->newIdeal];
12166  P->m[i-strat->newIdeal] = NULL;
12167  }
12168  idDelete(&P);
12169  }
12170  else
12171  {
12172  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12173  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12174  }
12175  }
12176  strat->fromT = FALSE;
12177  if (!TEST_OPT_SB_1)
12178  {
12179  /* the only change: we do not fill the set T*/
12180  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12181  }
12182  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12183  strat->fromQ=NULL;
12184  /* more changes: fill the set T with all the shifts of elts of S*/
12185  /* is done by other procedure */
12186 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:366
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8155
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8561
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:315
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9026
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:418
int newIdeal
Definition: kutil.h:353
ideal Shdl
Definition: kutil.h:297
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ initec()

static intset initec ( const int  maxnr)
inlinestatic

Definition at line 517 of file kutil.cc.

518 {
519  return (intset)omAlloc(maxnr*sizeof(int));
520 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * intset
Definition: kutil.h:55

◆ initEcartBBA()

void initEcartBBA ( TObject h)

Definition at line 1259 of file kutil.cc.

1260 {
1261  h->FDeg = h->pFDeg();
1262  (*h).ecart = 0;
1263  h->length=h->pLength=pLength(h->p);
1264 }
static unsigned pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978

◆ initEcartNormal()

void initEcartNormal ( TObject h)

Definition at line 1251 of file kutil.cc.

1252 {
1253  h->FDeg = h->pFDeg();
1254  h->ecart = h->pLDeg() - h->FDeg;
1255  // h->length is set by h->pLDeg
1256  h->length=h->pLength=pLength(h->p);
1257 }
static unsigned pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978

◆ initEcartPairBba()

void initEcartPairBba ( LObject Lp,
poly  ,
poly  ,
int  ,
int   
)

Definition at line 1266 of file kutil.cc.

1267 {
1268  Lp->FDeg = Lp->pFDeg();
1269  (*Lp).ecart = 0;
1270  (*Lp).length = 0;
1271 }

◆ initEcartPairMora()

void initEcartPairMora ( LObject Lp,
poly  ,
poly  ,
int  ecartF,
int  ecartG 
)

Definition at line 1273 of file kutil.cc.

1274 {
1275  Lp->FDeg = Lp->pFDeg();
1276  (*Lp).ecart = si_max(ecartF,ecartG);
1277  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1278  (*Lp).length = 0;
1279 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
static int si_max(const int a, const int b)
Definition: auxiliary.h:120

◆ initenterpairs()

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

Definition at line 3847 of file kutil.cc.

3848 {
3849 
3850  if ((strat->syzComp==0)
3851  || (pGetComp(h)<=strat->syzComp))
3852  {
3853  int j;
3854  BOOLEAN new_pair=FALSE;
3855 
3856  if (pGetComp(h)==0)
3857  {
3858  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3859  if ((isFromQ)&&(strat->fromQ!=NULL))
3860  {
3861  for (j=0; j<=k; j++)
3862  {
3863  if (!strat->fromQ[j])
3864  {
3865  new_pair=TRUE;
3866  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3867  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3868  }
3869  }
3870  }
3871  else
3872  {
3873  new_pair=TRUE;
3874  for (j=0; j<=k; j++)
3875  {
3876  #ifdef ADIDEBUG
3877  PrintS("\n Trying to add spoly : \n");
3878  PrintS(" ");p_Write(h, strat->tailRing);
3879  PrintS(" ");p_Write(strat->S[j],strat->tailRing);
3880  #endif
3881  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3882  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3883  }
3884  }
3885  }
3886  else
3887  {
3888  for (j=0; j<=k; j++)
3889  {
3890  if ((pGetComp(h)==pGetComp(strat->S[j]))
3891  || (pGetComp(strat->S[j])==0))
3892  {
3893  new_pair=TRUE;
3894  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3895  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3896  }
3897  }
3898  }
3899  if (new_pair)
3900  {
3901  #ifdef HAVE_RATGRING
3902  if (currRing->real_var_start>0)
3903  chainCritPart(h,ecart,strat);
3904  else
3905  #endif
3906  strat->chainCrit(h,ecart,strat);
3907  }
3908  kMergeBintoL(strat);
3909  }
3910 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:284
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3224
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3558

◆ initenterpairsShift()

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

Definition at line 12627 of file kutil.cc.

12628 {
12629  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12630  // atR = -1;
12631  if ((strat->syzComp==0)
12632  || (pGetComp(h)<=strat->syzComp))
12633  {
12634  int j;
12635  BOOLEAN new_pair=FALSE;
12636 
12637  if (pGetComp(h)==0)
12638  {
12639  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12640  if ((isFromQ)&&(strat->fromQ!=NULL))
12641  {
12642  for (j=0; j<=k; j++)
12643  {
12644  if (!strat->fromQ[j])
12645  {
12646  new_pair=TRUE;
12647  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12648  // other side pairs:
12649  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12650  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12651  }
12652  }
12653  }
12654  else
12655  {
12656  new_pair=TRUE;
12657  for (j=0; j<=k; j++)
12658  {
12659  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12660  // other side pairs
12661  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12662  }
12663  /* HERE we put (h, s*h) pairs */
12664  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
12665  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12666  }
12667  }
12668  else
12669  {
12670  for (j=0; j<=k; j++)
12671  {
12672  if ((pGetComp(h)==pGetComp(strat->S[j]))
12673  || (pGetComp(strat->S[j])==0))
12674  {
12675  new_pair=TRUE;
12676  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
12677  // other side pairs
12678  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12679  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12680  }
12681  }
12682  /* HERE we put (h, s*h) pairs */
12683  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12684  }
12685 
12686  if (new_pair)
12687  {
12688  strat->chainCrit(h,ecart,strat);
12689  }
12690 
12691  }
12692 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:94
static void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV)
Definition: kutil.cc:12193
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
polyset S
Definition: kutil.h:300
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12269

◆ initenterpairsSig()

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

Definition at line 3917 of file kutil.cc.

3918 {
3919 
3920  if ((strat->syzComp==0)
3921  || (pGetComp(h)<=strat->syzComp))
3922  {
3923  int j;
3924  BOOLEAN new_pair=FALSE;
3925 
3926  if (pGetComp(h)==0)
3927  {
3928  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3929  if ((isFromQ)&&(strat->fromQ!=NULL))
3930  {
3931  for (j=0; j<=k; j++)
3932  {
3933  if (!strat->fromQ[j])
3934  {
3935  new_pair=TRUE;
3936  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3937  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3938  }
3939  }
3940  }
3941  else
3942  {
3943  new_pair=TRUE;
3944  for (j=0; j<=k; j++)
3945  {
3946  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3947  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3948  }
3949  }
3950  }
3951  else
3952  {
3953  for (j=0; j<=k; j++)
3954  {
3955  if ((pGetComp(h)==pGetComp(strat->S[j]))
3956  || (pGetComp(strat->S[j])==0))
3957  {
3958  new_pair=TRUE;
3959  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3960  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3961  }
3962  }
3963  }
3964 
3965  if (new_pair)
3966  {
3967 #ifdef HAVE_RATGRING
3968  if (currRing->real_var_start>0)
3969  chainCritPart(h,ecart,strat);
3970  else
3971 #endif
3972  strat->chainCrit(h,ecart,strat);
3973  }
3974  }
3975 }
static void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2453
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:94
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
polyset S
Definition: kutil.h:300
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3558

◆ initenterpairsSigRing()

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

Definition at line 3977 of file kutil.cc.

3978 {
3979 
3980  if ((strat->syzComp==0)
3981  || (pGetComp(h)<=strat->syzComp))
3982  {
3983  int j;
3984 
3985  if (pGetComp(h)==0)
3986  {
3987  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3988  if ((isFromQ)&&(strat->fromQ!=NULL))
3989  {
3990  for (j=0; j<=k && !strat->sigdrop; j++)
3991  {
3992  if (!strat->fromQ[j])
3993  {
3994  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3995  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3996  }
3997  }
3998  }
3999  else
4000  {
4001  for (j=0; j<=k && !strat->sigdrop; j++)
4002  {
4003  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
4004  //Print("j:%d, Ll:%d\n",j,strat->Ll);
4005  }
4006  }
4007  }
4008  else
4009  {
4010  for (j=0; j<=k && !strat->sigdrop; j++)
4011  {
4012  if ((pGetComp(h)==pGetComp(strat->S[j]))
4013  || (pGetComp(strat->S[j])==0))
4014  {
4015  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
4016  //Print("j:%d, Ll:%d\n",j,strat->Ll);
4017  }
4018  }
4019  }
4020 
4021 #if 0
4022  if (new_pair)
4023  {
4024 #ifdef HAVE_RATGRING
4025  if (currRing->real_var_start>0)
4026  chainCritPart(h,ecart,strat);
4027  else
4028 #endif
4029  strat->chainCrit(h,ecart,strat);
4030  }
4031 #endif
4032  }
4033 }
int syzComp
Definition: kutil.h:350
bool sigdrop
Definition: kutil.h:356
int k
Definition: cfEzgcd.cc:93
static void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2710
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
polyset S
Definition: kutil.h:300
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3558

◆ initenterstrongPairs()

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

Definition at line 4627 of file kutil.cc.

4628 {
4629  const int iCompH = pGetComp(h);
4630  if (!nIsOne(pGetCoeff(h)))
4631  {
4632  int j;
4633 
4634  for (j=0; j<=k; j++)
4635  {
4636  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4637 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4638 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4639  if (((iCompH == pGetComp(strat->S[j]))
4640  || (0 == pGetComp(strat->S[j])))
4641  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4642  {
4643  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
4644  }
4645  }
4646  }
4647 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:94
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
polyset S
Definition: kutil.h:300
static BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1533
static Poly * h
Definition: janet.cc:978

◆ initenterstrongPairsSig()

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

Definition at line 4649 of file kutil.cc.

4650 {
4651  const int iCompH = pGetComp(h);
4652  if (!nIsOne(pGetCoeff(h)))
4653  {
4654  int j;
4655 
4656  for (j=0; j<=k && !strat->sigdrop; j++)
4657  {
4658  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4659 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4660 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4661  if (((iCompH == pGetComp(strat->S[j]))
4662  || (0 == pGetComp(strat->S[j])))
4663  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4664  {
4665  enterOneStrongPolySig(j,h,hSig,ecart,isFromQ,strat, atR);
4666  }
4667  }
4668  }
4669 }
int syzComp
Definition: kutil.h:350
bool sigdrop
Definition: kutil.h:356
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
static BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
Definition: kutil.cc:1728
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
polyset S
Definition: kutil.h:300
static Poly * h
Definition: janet.cc:978

◆ initenterzeropairsRing()

void initenterzeropairsRing ( poly  p,
int  ecart,
kStrategy  strat,
int  atR 
)

Definition at line 4495 of file kutil.cc.

4496 {
4497  // Initialize
4498  long exp[50]; // The exponent of \hat{X} (basepoint)
4499  long cexp[50]; // The current exponent for iterating over all
4500  long ind[50]; // The power of 2 in the i-th component of exp
4501  long cind[50]; // analog for cexp
4502  long mult[50]; // How to multiply the elements of G
4503  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4504  long habsind = 0; // The abs. index of the coefficient of h
4505  long step[50]; // The last increases
4506  for (int i = 1; i <= currRing->N; i++)
4507  {
4508  exp[i] = p_GetExp(p, i, currRing);
4509  if (exp[i] & 1 != 0)
4510  {
4511  exp[i] = exp[i] - 1;
4512  mult[i] = 1;
4513  }
4514  cexp[i] = exp[i];
4515  ind[i] = ind_fact_2(exp[i]);
4516  cabsind += ind[i];
4517  cind[i] = ind[i];
4518  step[i] = 500000;
4519  }
4520  step[1] = 500000;
4521  habsind = ind2(n_Int(pGetCoeff(p), currRing->cf);
4522  long bound = currRing->ch - habsind;
4523 #ifdef OLI_DEBUG
4524  PrintS("-------------\npoly :");
4525  wrp(p);
4526  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4527  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4528  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4529  Print("bound : %d\n", bound);
4530  Print("cind : %d\n", cabsind);
4531 #endif
4532  if (cabsind == 0)
4533  {
4534  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4535  {
4536  return;
4537  }
4538  }
4539  // Now the whole simplex
4540  do
4541  {
4542  // Build s-polynomial
4543  // 2**ind-def * mult * g - exp-def * h
4544  poly t_p;
4545  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, strat->tailRing);
4546 #ifdef OLI_DEBUG
4547  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4548  PrintS("zPoly : ");
4549  wrp(zeroPoly);
4550  PrintLn();
4551 #endif
4552  enterOneZeroPairRing(zeroPoly, t_p, p, ecart, strat, atR);
4553  }
4554  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4555 }
void PrintLn()
Definition: reporter.cc:310
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:4432
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4366
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static FORCE_INLINE long n_Int(number &n, const coeffs r)
conversion of n to an int; 0 if not possible in Z/pZ: the representing int lying in (-p/2 ...
Definition: coeffs.h:551
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
void enterOneZeroPairRing(poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:4248
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
Definition: minpoly.cc:649
long ind_fact_2(long arg)
Definition: kutil.cc:4225
ring tailRing
Definition: kutil.h:339
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:4213
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10

◆ initHilbCrit()

void initHilbCrit ( ideal  ,
ideal  ,
intvec **  hilb,
kStrategy  strat 
)

Definition at line 9776 of file kutil.cc.

9777 {
9778 
9779  //if the ordering is local, then hilb criterion
9780  //can be used also if the ideal is not homogenous
9782  {
9784  *hilb=NULL;
9785  else
9786  return;
9787  }
9788  if (strat->homog!=isHomog)
9789  {
9790  *hilb=NULL;
9791  }
9792 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
#define FALSE
Definition: auxiliary.h:94
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:369
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10

◆ initPairtest()

void initPairtest ( kStrategy  strat)

Definition at line 672 of file kutil.cc.

673 {
674  strat->pairtest = (BOOLEAN *)omAlloc0((strat->sl+2)*sizeof(BOOLEAN));
675 }
BOOLEAN * pairtest
Definition: kutil.h:329
int sl
Definition: kutil.h:344
int BOOLEAN
Definition: auxiliary.h:85
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initS()

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

Definition at line 8059 of file kutil.cc.

8060 {
8061  int i,pos;
8062 
8063  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8064  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8065  strat->ecartS=initec(i);
8066  strat->sevS=initsevS(i);
8067  strat->S_2_R=initS_2_R(i);
8068  strat->fromQ=NULL;
8069  strat->Shdl=idInit(i,F->rank);
8070  strat->S=strat->Shdl->m;
8071  /*- put polys into S -*/
8072  if (Q!=NULL)
8073  {
8074  strat->fromQ=initec(i);
8075  memset(strat->fromQ,0,i*sizeof(int));
8076  for (i=0; i<IDELEMS(Q); i++)
8077  {
8078  if (Q->m[i]!=NULL)
8079  {
8080  LObject h;
8081  h.p = pCopy(Q->m[i]);
8083  {
8084  //pContent(h.p);
8085  h.pCleardenom(); // also does a pContent
8086  }
8087  else
8088  {
8089  h.pNorm();
8090  }
8092  {
8093  deleteHC(&h, strat);
8094  }
8095  if (h.p!=NULL)
8096  {
8097  strat->initEcart(&h);
8098  if (strat->sl==-1)
8099  pos =0;
8100  else
8101  {
8102  pos = posInS(strat,strat->sl,h.p,h.ecart);
8103  }
8104  h.sev = pGetShortExpVector(h.p);
8105  strat->enterS(h,pos,strat,-1);
8106  strat->fromQ[pos]=1;
8107  }
8108  }
8109  }
8110  }
8111  for (i=0; i<IDELEMS(F); i++)
8112  {
8113  if (F->m[i]!=NULL)
8114  {
8115  LObject h;
8116  h.p = pCopy(F->m[i]);
8118  {
8119  cancelunit(&h); /*- tries to cancel a unit -*/
8120  deleteHC(&h, strat);
8121  }
8122  if (h.p!=NULL)
8123  // do not rely on the input being a SB!
8124  {
8126  {
8127  //pContent(h.p);
8128  h.pCleardenom(); // also does a pContent
8129  }
8130  else
8131  {
8132  h.pNorm();
8133  }
8134  strat->initEcart(&h);
8135  if (strat->sl==-1)
8136  pos =0;
8137  else
8138  pos = posInS(strat,strat->sl,h.p,h.ecart);
8139  h.sev = pGetShortExpVector(h.p);
8140  strat->enterS(h,pos,strat,-1);
8141  }
8142  }
8143  }
8144  /*- test, if a unit is in F -*/
8145  if ((strat->sl>=0)
8146 #ifdef HAVE_RINGS
8147  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8148 #endif
8149  && pIsConstant(strat->S[0]))
8150  {
8151  while (strat->sl>0) deleteInS(strat->sl,strat);
8152  }
8153 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
ideal Shdl
Definition: kutil.h:297
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initS_2_R()

static int* initS_2_R ( const int  maxnr)
inlinestatic

Definition at line 526 of file kutil.cc.

527 {
528  return (int*)omAlloc0(maxnr*sizeof(int));
529 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSbaBuchMora()

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

Definition at line 10314 of file kutil.cc.

10315 {
10316  strat->interpt = BTEST1(OPT_INTERRUPT);
10317  strat->kHEdge=NULL;
10319  /*- creating temp data structures------------------- -*/
10320  strat->cp = 0;
10321  strat->c3 = 0;
10322  strat->tail = pInit();
10323  /*- set s -*/
10324  strat->sl = -1;
10325  /*- set ps -*/
10326  strat->syzl = -1;
10327  /*- set L -*/
10328  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10329  strat->Ll = -1;
10330  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10331  /*- set B -*/
10332  strat->Bmax = setmaxL;
10333  strat->Bl = -1;
10334  strat->B = initL();
10335  /*- set T -*/
10336  strat->tl = -1;
10337  strat->tmax = setmaxT;
10338  strat->T = initT();
10339  strat->R = initR();
10340  strat->sevT = initsevT();
10341  /*- init local data struct.---------------------------------------- -*/
10342  strat->P.ecart=0;
10343  strat->P.length=0;
10345  {
10346  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10347  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10348  }
10350  {
10351  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10352  }
10353  else
10354  {
10355  if(TEST_OPT_SB_1)
10356  {
10357  int i;
10358  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10359  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10360  {
10361  P->m[i-strat->newIdeal] = F->m[i];
10362  F->m[i] = NULL;
10363  }
10364  initSSpecialSba(F,Q,P,strat);
10365  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10366  {
10367  F->m[i] = P->m[i-strat->newIdeal];
10368  P->m[i-strat->newIdeal] = NULL;
10369  }
10370  idDelete(&P);
10371  }
10372  else
10373  {
10374  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10375  }
10376  }
10377  strat->fromT = FALSE;
10378  if (!TEST_OPT_SB_1)
10379  {
10380  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10381  }
10382  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10383  //strat->fromQ=NULL;
10384  assume(kTest_TS(strat));
10385 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:343
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8706
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define setmaxLinc
Definition: kutil.h:30
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8254
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:649
#define assume(x)
Definition: mod2.h:394
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9026
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:418
int newIdeal
Definition: kutil.h:353
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:345

◆ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9858 of file kutil.cc.

9859 {
9860  //strat->enterOnePair=enterOnePairNormal;
9862  //strat->chainCrit=chainCritNormal;
9863  strat->chainCrit = chainCritSig;
9864  /******************************************
9865  * rewCrit1 and rewCrit2 are already set in
9866  * kSba() in kstd1.cc
9867  *****************************************/
9868  //strat->rewCrit1 = faugereRewCriterion;
9869  if (strat->sbaOrder == 1)
9870  {
9871  strat->syzCrit = syzCriterionInc;
9872  }
9873  else
9874  {
9875  strat->syzCrit = syzCriterion;
9876  }
9877 #ifdef HAVE_RINGS
9878  if (rField_is_Ring(currRing))
9879  {
9881  strat->chainCrit=chainCritRing;
9882  }
9883 #endif
9884 #ifdef HAVE_RATGRING
9885  if (rIsRatGRing(currRing))
9886  {
9887  strat->chainCrit=chainCritPart;
9888  /* enterOnePairNormal get rational part in it */
9889  }
9890 #endif
9891 
9892  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9893  strat->Gebauer = strat->homog || strat->sugarCrit;
9894  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9895  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9896  strat->pairtest = NULL;
9897  /* alway use tailreduction, except:
9898  * - in local rings, - in lex order case, -in ring over extensions */
9901 
9902 #ifdef HAVE_PLURAL
9903  // and r is plural_ring
9904  // hence this holds for r a rational_plural_ring
9905  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9906  { //or it has non-quasi-comm type... later
9907  strat->sugarCrit = FALSE;
9908  strat->Gebauer = FALSE;
9909  strat->honey = FALSE;
9910  }
9911 #endif
9912 
9913  // Coefficient ring?
9914  if (rField_is_Ring(currRing))
9915  {
9916  strat->sugarCrit = FALSE;
9917  strat->Gebauer = FALSE ;
9918  strat->honey = FALSE;
9919  }
9920  #ifdef KDEBUG
9921  if (TEST_OPT_DEBUG)
9922  {
9923  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9924  else PrintS("ideal/module is not homogeneous\n");
9925  }
9926  #endif
9927 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:329
BOOLEAN z2homog
Definition: kutil.h:371
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:103
static void enterOnePairRing(int i, poly p, int, int isFromQ, kStrategy strat, int atR)
Definition: kutil.cc:1293
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3499
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1954
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:286
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:284
BOOLEAN homog
Definition: kutil.h:369
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4040
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:375
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
unsigned sbaOrder
Definition: kutil.h:310
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:374
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7138
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7176
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3558

◆ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10212 of file kutil.cc.

10213 {
10215  {
10216  if (strat->honey)
10217  {
10218  strat->posInL = posInL15;
10219  // ok -- here is the deal: from my experiments for Singular-2-0
10220  // I conclude that that posInT_EcartpLength is the best of
10221  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10222  // see the table at the end of this file
10223  if (TEST_OPT_OLDSTD)
10224  strat->posInT = posInT15;
10225  else
10226  strat->posInT = posInT_EcartpLength;
10227  }
10228  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10229  {
10230  strat->posInL = posInL11;
10231  strat->posInT = posInT11;
10232  }
10233  else if (TEST_OPT_INTSTRATEGY)
10234  {
10235  strat->posInL = posInL11;
10236  strat->posInT = posInT11;
10237  }
10238  else
10239  {
10240  strat->posInL = posInL0;
10241  strat->posInT = posInT0;
10242  }
10243  //if (strat->minim>0) strat->posInL =posInLSpecial;
10244  if (strat->homog)
10245  {
10246  strat->posInL = posInL110;
10247  strat->posInT = posInT110;
10248  }
10249  }
10250  else
10251  {
10252  if (strat->homog)
10253  {
10254  strat->posInL = posInL11;
10255  strat->posInT = posInT11;
10256  }
10257  else
10258  {
10259  if ((currRing->order[0]==ringorder_c)
10260  ||(currRing->order[0]==ringorder_C))
10261  {
10262  strat->posInL = posInL17_c;
10263  strat->posInT = posInT17_c;
10264  }
10265  else
10266  {
10267  strat->posInL = posInL17;
10268  strat->posInT = posInT17;
10269  }
10270  }
10271  }
10272  if (strat->minim>0) strat->posInL =posInLSpecial;
10273  // for further tests only
10274  if ((BTEST1(11)) || (BTEST1(12)))
10275  strat->posInL = posInL11;
10276  else if ((BTEST1(13)) || (BTEST1(14)))
10277  strat->posInL = posInL13;
10278  else if ((BTEST1(15)) || (BTEST1(16)))
10279  strat->posInL = posInL15;
10280  else if ((BTEST1(17)) || (BTEST1(18)))
10281  strat->posInL = posInL17;
10282  if (BTEST1(11))
10283  strat->posInT = posInT11;
10284  else if (BTEST1(13))
10285  strat->posInT = posInT13;
10286  else if (BTEST1(15))
10287  strat->posInT = posInT15;
10288  else if ((BTEST1(17)))
10289  strat->posInT = posInT17;
10290  else if ((BTEST1(19)))
10291  strat->posInT = posInT19;
10292  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10293  strat->posInT = posInT1;
10294  if (rField_is_Ring(currRing))
10295  {
10296  strat->posInL = posInL11Ring;
10297  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10298  strat->posInL = posInL11Ringls;
10299  strat->posInT = posInT11;
10300  }
10301  strat->posInLDependsOnLength = FALSE;
10302  strat->posInLSba = posInLSig;
10303  //strat->posInL = posInLSig;
10304  strat->posInL = posInLF5C;
10305  /*
10306  if (rField_is_Ring(currRing))
10307  {
10308  strat->posInLSba = posInLSigRing;
10309  strat->posInL = posInL11Ring;
10310  }*/
10311  //strat->posInT = posInTSig;
10312 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6416
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6458
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6528
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6837
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6404
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5729
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6216
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5419
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5931
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6158
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7007
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5824
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5572
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661

◆ initsevS()

static unsigned long* initsevS ( const int  maxnr)
inlinestatic

Definition at line 522 of file kutil.cc.

523 {
524  return (unsigned long*)omAlloc0(maxnr*sizeof(unsigned long));
525 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ initSL()

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

Definition at line 8155 of file kutil.cc.

8156 {
8157  int i,pos;
8158 
8159  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8160  else i=setmaxT;
8161  strat->ecartS=initec(i);
8162  strat->sevS=initsevS(i);
8163  strat->S_2_R=initS_2_R(i);
8164  strat->fromQ=NULL;
8165  strat->Shdl=idInit(i,F->rank);
8166  strat->S=strat->Shdl->m;
8167  /*- put polys into S -*/
8168  if (Q!=NULL)
8169  {
8170  strat->fromQ=initec(i);
8171  memset(strat->fromQ,0,i*sizeof(int));
8172  for (i=0; i<IDELEMS(Q); i++)
8173  {
8174  if (Q->m[i]!=NULL)
8175  {
8176  LObject h;
8177  h.p = pCopy(Q->m[i]);
8179  {
8180  deleteHC(&h,strat);
8181  }
8183  {
8184  //pContent(h.p);
8185  h.pCleardenom(); // also does a pContent
8186  }
8187  else
8188  {
8189  h.pNorm();
8190  }
8191  if (h.p!=NULL)
8192  {
8193  strat->initEcart(&h);
8194  if (strat->sl==-1)
8195  pos =0;
8196  else
8197  {
8198  pos = posInS(strat,strat->sl,h.p,h.ecart);
8199  }
8200  h.sev = pGetShortExpVector(h.p);
8201  strat->enterS(h,pos,strat,-1);
8202  strat->fromQ[pos]=1;
8203  }
8204  }
8205  }
8206  }
8207  for (i=0; i<IDELEMS(F); i++)
8208  {
8209  if (F->m[i]!=NULL)
8210  {
8211  LObject h;
8212  h.p = pCopy(F->m[i]);
8213  if (h.p!=NULL)
8214  {
8216  {
8217  cancelunit(&h); /*- tries to cancel a unit -*/
8218  deleteHC(&h, strat);
8219  }
8220  if (h.p!=NULL)
8221  {
8223  {
8224  //pContent(h.p);
8225  h.pCleardenom(); // also does a pContent
8226  }
8227  else
8228  {
8229  h.pNorm();
8230  }
8231  strat->initEcart(&h);
8232  if (strat->Ll==-1)
8233  pos =0;
8234  else
8235  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8236  h.sev = pGetShortExpVector(h.p);
8237  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8238  }
8239  }
8240  }
8241  }
8242  /*- test, if a unit is in F -*/
8243 
8244  if ((strat->Ll>=0)
8245 #ifdef HAVE_RINGS
8246  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8247 #endif
8248  && pIsConstant(strat->L[strat->Ll].p))
8249  {
8250  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8251  }
8252 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
int * S_2_R
Definition: kutil.h:338
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
ideal Shdl
Definition: kutil.h:297
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSLSba()

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

Definition at line 8254 of file kutil.cc.

8255 {
8256  int i,pos;
8257  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8258  else i=setmaxT;
8259  strat->ecartS = initec(i);
8260  strat->sevS = initsevS(i);
8261  strat->sevSig = initsevS(i);
8262  strat->S_2_R = initS_2_R(i);
8263  strat->fromQ = NULL;
8264  strat->Shdl = idInit(i,F->rank);
8265  strat->S = strat->Shdl->m;
8266  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8267  if (strat->sbaOrder != 1)
8268  {
8269  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8270  strat->sevSyz = initsevS(i);
8271  strat->syzmax = i;
8272  strat->syzl = 0;
8273  }
8274  /*- put polys into S -*/
8275  if (Q!=NULL)
8276  {
8277  strat->fromQ=initec(i);
8278  memset(strat->fromQ,0,i*sizeof(int));
8279  for (i=0; i<IDELEMS(Q); i++)
8280  {
8281  if (Q->m[i]!=NULL)
8282  {
8283  LObject h;
8284  h.p = pCopy(Q->m[i]);
8286  {
8287  deleteHC(&h,strat);
8288  }
8290  {
8291  //pContent(h.p);
8292  h.pCleardenom(); // also does a pContent
8293  }
8294  else
8295  {
8296  h.pNorm();
8297  }
8298  if (h.p!=NULL)
8299  {
8300  strat->initEcart(&h);
8301  if (strat->sl==-1)
8302  pos =0;
8303  else
8304  {
8305  pos = posInS(strat,strat->sl,h.p,h.ecart);
8306  }
8307  h.sev = pGetShortExpVector(h.p);
8308  strat->enterS(h,pos,strat,-1);
8309  strat->fromQ[pos]=1;
8310  }
8311  }
8312  }
8313  }
8314  for (i=0; i<IDELEMS(F); i++)
8315  {
8316  if (F->m[i]!=NULL)
8317  {
8318  LObject h;
8319  h.p = pCopy(F->m[i]);
8320  h.sig = pOne();
8321  //h.sig = pInit();
8322  //p_SetCoeff(h.sig,nInit(1),currRing);
8323  p_SetComp(h.sig,i+1,currRing);
8324  // if we are working with the Schreyer order we generate it
8325  // by multiplying the initial signatures with the leading monomial
8326  // of the corresponding initial polynomials generating the ideal
8327  // => we can keep the underlying monomial order and get a Schreyer
8328  // order without any bigger overhead
8329  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8330  {
8331  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8332  }
8333  h.sevSig = pGetShortExpVector(h.sig);
8334 #ifdef DEBUGF5
8335  pWrite(h.p);
8336  pWrite(h.sig);
8337 #endif
8338  if (h.p!=NULL)
8339  {
8341  {
8342  cancelunit(&h); /*- tries to cancel a unit -*/
8343  deleteHC(&h, strat);
8344  }
8345  if (h.p!=NULL)
8346  {
8348  {
8349  //pContent(h.p);
8350  h.pCleardenom(); // also does a pContent
8351  }
8352  else
8353  {
8354  h.pNorm();
8355  }
8356  strat->initEcart(&h);
8357  if (strat->Ll==-1)
8358  pos =0;
8359  else
8360  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8361  h.sev = pGetShortExpVector(h.p);
8362  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8363  }
8364  }
8365  /*
8366  if (strat->sbaOrder != 1)
8367  {
8368  for(j=0;j<i;j++)
8369  {
8370  strat->syz[ctr] = pCopy(F->m[j]);
8371  p_SetCompP(strat->syz[ctr],i+1,currRing);
8372  // add LM(F->m[i]) to the signature to get a Schreyer order
8373  // without changing the underlying polynomial ring at all
8374  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8375  // since p_Add_q() destroys all input
8376  // data we need to recreate help
8377  // each time
8378  poly help = pCopy(F->m[i]);
8379  p_SetCompP(help,j+1,currRing);
8380  pWrite(strat->syz[ctr]);
8381  pWrite(help);
8382  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8383  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8384  printf("%d. SYZ ",ctr);
8385  pWrite(strat->syz[ctr]);
8386  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8387  ctr++;
8388  }
8389  strat->syzl = ps;
8390  }
8391  */
8392  }
8393  }
8394  /*- test, if a unit is in F -*/
8395 
8396  if ((strat->Ll>=0)
8397 #ifdef HAVE_RINGS
8398  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8399 #endif
8400  && pIsConstant(strat->L[strat->Ll].p))
8401  {
8402  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8403  }
8404 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
int syzmax
Definition: kutil.h:345
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
int * S_2_R
Definition: kutil.h:338
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
void pWrite(poly p)
Definition: polys.h:290
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1165
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
unsigned sbaOrder
Definition: kutil.h:310
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
unsigned long * sevSyz
Definition: kutil.h:317
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:301
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:345
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSSpecial()

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

Definition at line 8561 of file kutil.cc.

8562 {
8563  int i,pos;
8564 
8565  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8566  else i=setmaxT;
8567  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
8568  strat->ecartS=initec(i);
8569  strat->sevS=initsevS(i);
8570  strat->S_2_R=initS_2_R(i);
8571  strat->fromQ=NULL;
8572  strat->Shdl=idInit(i,F->rank);
8573  strat->S=strat->Shdl->m;
8574 
8575  /*- put polys into S -*/
8576  if (Q!=NULL)
8577  {
8578  strat->fromQ=initec(i);
8579  memset(strat->fromQ,0,i*sizeof(int));
8580  for (i=0; i<IDELEMS(Q); i++)
8581  {
8582  if (Q->m[i]!=NULL)
8583  {
8584  LObject h;
8585  h.p = pCopy(Q->m[i]);
8586  //if (TEST_OPT_INTSTRATEGY)
8587  //{
8588  // //pContent(h.p);
8589  // h.pCleardenom(); // also does a pContent
8590  //}
8591  //else
8592  //{
8593  // h.pNorm();
8594  //}
8596  {
8597  deleteHC(&h,strat);
8598  }
8599  if (h.p!=NULL)
8600  {
8601  strat->initEcart(&h);
8602  if (strat->sl==-1)
8603  pos =0;
8604  else
8605  {
8606  pos = posInS(strat,strat->sl,h.p,h.ecart);
8607  }
8608  h.sev = pGetShortExpVector(h.p);
8609  strat->enterS(h,pos,strat, strat->tl+1);
8610  enterT(h, strat);
8611  strat->fromQ[pos]=1;
8612  }
8613  }
8614  }
8615  }
8616  /*- put polys into S -*/
8617  for (i=0; i<IDELEMS(F); i++)
8618  {
8619  if (F->m[i]!=NULL)
8620  {
8621  LObject h;
8622  h.p = pCopy(F->m[i]);
8624  {
8625  deleteHC(&h,strat);
8626  }
8627  else
8628  {
8629  h.p=redtailBba(h.p,strat->sl,strat);
8630  }
8631  if (h.p!=NULL)
8632  {
8633  strat->initEcart(&h);
8634  if (strat->sl==-1)
8635  pos =0;
8636  else
8637  pos = posInS(strat,strat->sl,h.p,h.ecart);
8638  h.sev = pGetShortExpVector(h.p);
8639  strat->enterS(h,pos,strat, strat->tl+1);
8640  enterT(h,strat);
8641  }
8642  }
8643  }
8644  for (i=0; i<IDELEMS(P); i++)
8645  {
8646  if (P->m[i]!=NULL)
8647  {
8648  LObject h;
8649  h.p=pCopy(P->m[i]);
8651  {
8652  h.pCleardenom();
8653  }
8654  else
8655  {
8656  h.pNorm();
8657  }
8658  if(strat->sl>=0)
8659  {
8661  {
8662  h.p=redBba(h.p,strat->sl,strat);
8663  if (h.p!=NULL)
8664  {
8665  h.p=redtailBba(h.p,strat->sl,strat);
8666  }
8667  }
8668  else
8669  {
8670  h.p=redMora(h.p,strat->sl,strat);
8671  }
8672  if(h.p!=NULL)
8673  {
8674  strat->initEcart(&h);
8676  {
8677  h.pCleardenom();
8678  }
8679  else
8680  {
8681  h.is_normalized = 0;
8682  h.pNorm();
8683  }
8684  h.sev = pGetShortExpVector(h.p);
8685  h.SetpFDeg();
8686  pos = posInS(strat,strat->sl,h.p,h.ecart);
8687  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8688  strat->enterS(h,pos,strat, strat->tl+1);
8689  enterT(h,strat);
8690  }
8691  }
8692  else
8693  {
8694  h.sev = pGetShortExpVector(h.p);
8695  strat->initEcart(&h);
8696  strat->enterS(h,0,strat, strat->tl+1);
8697  enterT(h,strat);
8698  }
8699  }
8700  }
8701 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
int tl
Definition: kutil.h:346
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:5001
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7598
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8957
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:303
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8981
kBucketDestroy & P
Definition: myNF.cc:191
ideal Shdl
Definition: kutil.h:297
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSSpecialSba()

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

Definition at line 8706 of file kutil.cc.

8707 {
8708  int i,pos;
8709 
8710  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8711  else i=setmaxT;
8712  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
8713  strat->sevS=initsevS(i);
8714  strat->sevSig=initsevS(i);
8715  strat->S_2_R=initS_2_R(i);
8716  strat->fromQ=NULL;
8717  strat->Shdl=idInit(i,F->rank);
8718  strat->S=strat->Shdl->m;
8719  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
8720  /*- put polys into S -*/
8721  if (Q!=NULL)
8722  {
8723  strat->fromQ=initec(i);
8724  memset(strat->fromQ,0,i*sizeof(int));
8725  for (i=0; i<IDELEMS(Q); i++)
8726  {
8727  if (Q->m[i]!=NULL)
8728  {
8729  LObject h;
8730  h.p = pCopy(Q->m[i]);
8731  //if (TEST_OPT_INTSTRATEGY)
8732  //{
8733  // //pContent(h.p);
8734  // h.pCleardenom(); // also does a pContent
8735  //}
8736  //else
8737  //{
8738  // h.pNorm();
8739  //}
8741  {
8742  deleteHC(&h,strat);
8743  }
8744  if (h.p!=NULL)
8745  {
8746  strat->initEcart(&h);
8747  if (strat->sl==-1)
8748  pos =0;
8749  else
8750  {
8751  pos = posInS(strat,strat->sl,h.p,h.ecart);
8752  }
8753  h.sev = pGetShortExpVector(h.p);
8754  strat->enterS(h,pos,strat, strat->tl+1);
8755  enterT(h, strat);
8756  strat->fromQ[pos]=1;
8757  }
8758  }
8759  }
8760  }
8761  /*- put polys into S -*/
8762  for (i=0; i<IDELEMS(F); i++)
8763  {
8764  if (F->m[i]!=NULL)
8765  {
8766  LObject h;
8767  h.p = pCopy(F->m[i]);
8769  {
8770  deleteHC(&h,strat);
8771  }
8772  else
8773  {
8774  h.p=redtailBba(h.p,strat->sl,strat);
8775  }
8776  if (h.p!=NULL)
8777  {
8778  strat->initEcart(&h);
8779  if (strat->sl==-1)
8780  pos =0;
8781  else
8782  pos = posInS(strat,strat->sl,h.p,h.ecart);
8783  h.sev = pGetShortExpVector(h.p);
8784  strat->enterS(h,pos,strat, strat->tl+1);
8785  enterT(h,strat);
8786  }
8787  }
8788  }
8789  for (i=0; i<IDELEMS(P); i++)
8790  {
8791  if (P->m[i]!=NULL)
8792  {
8793  LObject h;
8794  h.p=pCopy(P->m[i]);
8796  {
8797  h.pCleardenom();
8798  }
8799  else
8800  {
8801  h.pNorm();
8802  }
8803  if(strat->sl>=0)
8804  {
8806  {
8807  h.p=redBba(h.p,strat->sl,strat);
8808  if (h.p!=NULL)
8809  {
8810  h.p=redtailBba(h.p,strat->sl,strat);
8811  }
8812  }
8813  else
8814  {
8815  h.p=redMora(h.p,strat->sl,strat);
8816  }
8817  if(h.p!=NULL)
8818  {
8819  strat->initEcart(&h);
8821  {
8822  h.pCleardenom();
8823  }
8824  else
8825  {
8826  h.is_normalized = 0;
8827  h.pNorm();
8828  }
8829  h.sev = pGetShortExpVector(h.p);
8830  h.SetpFDeg();
8831  pos = posInS(strat,strat->sl,h.p,h.ecart);
8832  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8833  strat->enterS(h,pos,strat, strat->tl+1);
8834  enterT(h,strat);
8835  }
8836  }
8837  else
8838  {
8839  h.sev = pGetShortExpVector(h.p);
8840  strat->initEcart(&h);
8841  strat->enterS(h,0,strat, strat->tl+1);
8842  enterT(h,strat);
8843  }
8844  }
8845  }
8846 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:751
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
int tl
Definition: kutil.h:346
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:5001
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7598
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8957
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8981
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297
static Poly * h
Definition: janet.cc:978
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ initSyzRules()

void initSyzRules ( kStrategy  strat)

Definition at line 8406 of file kutil.cc.

8407 {
8408  if( strat->S[0] )
8409  {
8410  if( strat->S[1] && !rField_is_Ring(currRing))
8411  {
8412  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8413  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8414  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8415  }
8416  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8417  /************************************************************
8418  * computing the length of the syzygy array needed
8419  ***********************************************************/
8420  for(i=1; i<=strat->sl; i++)
8421  {
8422  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8423  {
8424  ps += i;
8425  }
8426  }
8427  ps += strat->sl+1;
8428  //comp = pGetComp (strat->P.sig);
8429  comp = strat->currIdx;
8430  strat->syzIdx = initec(comp);
8431  strat->sevSyz = initsevS(ps);
8432  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8433  strat->syzmax = ps;
8434  strat->syzl = 0;
8435  strat->syzidxmax = comp;
8436 #if defined(DEBUGF5) || defined(DEBUGF51)
8437  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8438 #endif
8439  i = 1;
8440  j = 0;
8441  /************************************************************
8442  * generating the leading terms of the principal syzygies
8443  ***********************************************************/
8444  while (i <= strat->sl)
8445  {
8446  /**********************************************************
8447  * principal syzygies start with component index 2
8448  * the array syzIdx starts with index 0
8449  * => the rules for a signature with component comp start
8450  * at strat->syz[strat->syzIdx[comp-2]] !
8451  *********************************************************/
8452  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8453  {
8454  comp = pGetComp(strat->sig[i]);
8455  comp_old = pGetComp(strat->sig[i-1]);
8456  diff = comp - comp_old - 1;
8457  // diff should be zero, but sometimes also the initial generating
8458  // elements of the input ideal reduce to zero. then there is an
8459  // index-gap between the signatures. for these inbetween signatures we
8460  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8461  // in the following.
8462  // doing this, we keep the relation "j = comp - 2" alive, which makes
8463  // jumps way easier when checking criteria
8464  while (diff>0)
8465  {
8466  strat->syzIdx[j] = 0;
8467  diff--;
8468  j++;
8469  }
8470  strat->syzIdx[j] = ctr;
8471  j++;
8472  LObject Q;
8473  int pos;
8474  for (k = 0; k<i; k++)
8475  {
8476  Q.sig = pOne();
8478  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8479  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8480  p_SetCompP (Q.sig, comp, currRing);
8481  poly q = p_One(currRing);
8483  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8484  p_ExpVectorCopy(q,strat->S[i],currRing);
8485  q = p_Neg (q, currRing);
8486  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8487  Q.sig = p_Add_q (Q.sig, q, currRing);
8488  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8489  pos = posInSyz(strat, Q.sig);
8490  enterSyz(Q, strat, pos);
8491  ctr++;
8492  }
8493  }
8494  i++;
8495  }
8496  /**************************************************************
8497  * add syzygies for upcoming first element of new iteration step
8498  **************************************************************/
8499  comp = strat->currIdx;
8500  comp_old = pGetComp(strat->sig[i-1]);
8501  diff = comp - comp_old - 1;
8502  // diff should be zero, but sometimes also the initial generating
8503  // elements of the input ideal reduce to zero. then there is an
8504  // index-gap between the signatures. for these inbetween signatures we
8505  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8506  // in the following.
8507  // doing this, we keep the relation "j = comp - 2" alive, which makes
8508  // jumps way easier when checking criteria
8509  while (diff>0)
8510  {
8511  strat->syzIdx[j] = 0;
8512  diff--;
8513  j++;
8514  }
8515  strat->syzIdx[j] = ctr;
8516  LObject Q;
8517  int pos;
8518  for (k = 0; k<strat->sl+1; k++)
8519  {
8520  Q.sig = pOne();
8522  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8523  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8524  p_SetCompP (Q.sig, comp, currRing);
8525  poly q = p_One(currRing);
8527  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8528  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8529  q = p_Neg (q, currRing);
8530  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8531  Q.sig = p_Add_q (Q.sig, q, currRing);
8532  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8533  pos = posInSyz(strat, Q.sig);
8534  enterSyz(Q, strat, pos);
8535  ctr++;
8536  }
8537 //#if 1
8538 #ifdef DEBUGF5
8539  PrintS("Principal syzygies:\n");
8540  Print("syzl %d\n",strat->syzl);
8541  Print("syzmax %d\n",strat->syzmax);
8542  Print("ps %d\n",ps);
8543  PrintS("--------------------------------\n");
8544  for(i=0;i<=strat->syzl-1;i++)
8545  {
8546  Print("%d - ",i);
8547  pWrite(strat->syz[i]);
8548  }
8549  for(i=0;i<strat->currIdx;i++)
8550  {
8551  Print("%d - %d\n",i,strat->syzIdx[i]);
8552  }
8553  PrintS("--------------------------------\n");
8554 #endif
8555  }
8556 }
polyset sig
Definition: kutil.h:302
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:345
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
#define p_GetComp(p, r)
Definition: monomials.h:72
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
int currIdx
Definition: kutil.h:311
#define pGetComp(p)
Component.
Definition: polys.h:37
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:249
poly p_One(const ring r)
Definition: p_polys.cc:1312
int j
Definition: myNF.cc:70
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1236
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:300
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6376
int syzidxmax
Definition: kutil.h:345
#define nCopy(n)
Definition: numbers.h:15
unsigned long * sevSyz
Definition: kutil.h:317
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyset syz
Definition: kutil.h:301
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:344
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
int syzl
Definition: kutil.h:345
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9692
intset syzIdx
Definition: kutil.h:307

◆ isInPairsetB()

BOOLEAN isInPairsetB ( poly  q,
int *  k,
kStrategy  strat 
)

Definition at line 702 of file kutil.cc.

703 {
704  LObject *p=&(strat->B[strat->Bl]);
705 
706  *k = strat->Bl;
707  loop
708  {
709  if ((*k) < 0) return FALSE;
710  if (q == (*p).p1)
711  return TRUE;
712  (*k)--;
713  p--;
714  }
715 }
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
int Bl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
LSet B
Definition: kutil.h:322

◆ isInPairsetL()

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

Definition at line 681 of file kutil.cc.

682 {
683  LObject *p=&(strat->L[length]);
684 
685  *k = length;
686  loop
687  {
688  if ((*k) < 0) return FALSE;
689  if (((p1 == (*p).p1) && (p2 == (*p).p2))
690  || ((p1 == (*p).p2) && (p2 == (*p).p1)))
691  return TRUE;
692  (*k)--;
693  p--;
694  }
695 }
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
int k
Definition: cfEzgcd.cc:93
LSet L
Definition: kutil.h:321
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ kCheckSpolyCreation()

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

Definition at line 10828 of file kutil.cc.

10829 {
10830  if (strat->overflow) return FALSE;
10831  assume(L->p1 != NULL && L->p2 != NULL);
10832  // shift changes: from 0 to -1
10833  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10834  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10835  assume(strat->tailRing != currRing);
10836 
10837  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10838  return FALSE;
10839  // shift changes: extra case inserted
10840  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10841  {
10842  return TRUE;
10843  }
10844  poly p1_max = (strat->R[L->i_r1])->max_exp;
10845  poly p2_max = (strat->R[L->i_r2])->max_exp;
10846 
10847  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10848  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10849  {
10850  p_LmFree(m1, strat->tailRing);
10851  p_LmFree(m2, strat->tailRing);
10852  m1 = NULL;
10853  m2 = NULL;
10854  return FALSE;
10855  }
10856  return TRUE;
10857 }
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:935
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:336
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
polyrec * poly
Definition: hilb.h:10

◆ kCheckStrongCreation()

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

Definition at line 10866 of file kutil.cc.

10867 {
10868  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10869  //assume(strat->tailRing != currRing);
10870 
10871  poly p1_max = (strat->R[atR])->max_exp;
10872  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10873 
10874  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10875  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10876  {
10877  return FALSE;
10878  }
10879  return TRUE;
10880 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:336
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
polyrec * poly
Definition: hilb.h:10

◆ kCreateZeroPoly()

poly kCreateZeroPoly ( long  exp[],
long  cabsind,
poly t_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 4432 of file kutil.cc.

4433 {
4434 
4435  poly zeroPoly = NULL;
4436 
4437  number tmp1;
4438  poly tmp2, tmp3;
4439 
4440  if (cabsind == -1)
4441  {
4442  cabsind = 0;
4443  for (int i = 1; i <= leadRing->N; i++)
4444  {
4445  cabsind += ind_fact_2(exp[i]);
4446  }
4447 // Print("cabsind: %d\n", cabsind);
4448  }
4449  if (cabsind < leadRing->ch)
4450  {
4451  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4452  }
4453  else
4454  {
4455  zeroPoly = p_ISet(1, tailRing);
4456  }
4457  for (int i = 1; i <= leadRing->N; i++)
4458  {
4459  for (long j = 1; j <= exp[i]; j++)
4460  {
4461  tmp1 = nInit(j);
4462  tmp2 = p_ISet(1, tailRing);
4463  p_SetExp(tmp2, i, 1, tailRing);
4464  p_Setm(tmp2, tailRing);
4465  if (nIsZero(tmp1))
4466  { // should nowbe obsolet, test ! TODO OLIVER
4467  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4468  }
4469  else
4470  {
4471  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4472  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4473  }
4474  }
4475  }
4476  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4477  for (int i = 1; i <= leadRing->N; i++)
4478  {
4479  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4480  }
4481  p_Setm(tmp2, leadRing);
4482  *t_p = zeroPoly;
4483  zeroPoly = pNext(zeroPoly);
4484  pNext(*t_p) = NULL;
4485  pNext(tmp2) = zeroPoly;
4486  return tmp2;
4487 }
#define pSetExp(p, i, v)
Definition: polys.h:42
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1442
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
long twoPow(long arg)
Definition: kutil.cc:4240
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:4225
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
p exp[i]
Definition: DebugPrint.cc:39
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1296
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1020

◆ kDebugPrint()

void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 11826 of file kutil.cc.

11827 {
11828  PrintS("red: ");
11829  if (strat->red==redFirst) PrintS("redFirst\n");
11830  else if (strat->red==redHoney) PrintS("redHoney\n");
11831  else if (strat->red==redEcart) PrintS("redEcart\n");
11832  else if (strat->red==redHomog) PrintS("redHomog\n");
11833  else Print("%p\n",(void*)strat->red);
11834  PrintS("posInT: ");
11835  if (strat->posInT==posInT0) PrintS("posInT0\n");
11836  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11837  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11838  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11839  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11840  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11841  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11842  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11843  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11844  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11845  #ifdef HAVE_RINGS
11846  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11847  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11848  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11849  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11850  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11851  #endif
11852 #ifdef HAVE_MORE_POS_IN_T
11853  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11854  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11855  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11856 #endif
11857  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11858  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11859  else Print("%p\n",(void*)strat->posInT);
11860  PrintS("posInL: ");
11861  if (strat->posInL==posInL0) PrintS("posInL0\n");
11862  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11863  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11864  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11865  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11866  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11867  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11868  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11869  #ifdef HAVE_RINGS
11870  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11871  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11872  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11873  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11874  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11875  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11876  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11877  #endif
11878  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11879  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11880  else Print("%p\n",(void*)strat->posInL);
11881  PrintS("enterS: ");
11882  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11883  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11884  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11885  else Print("%p\n",(void*)strat->enterS);
11886  PrintS("initEcart: ");
11887  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11888  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11889  else Print("%p\n",(void*)strat->initEcart);
11890  PrintS("initEcartPair: ");
11891  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11892  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11893  else Print("%p\n",(void*)strat->initEcartPair);
11894  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11895  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11896  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11897  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11898  PrintS("chainCrit: ");
11899  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11900  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11901  else Print("%p\n",(void*)strat->chainCrit);
11902  Print("posInLDependsOnLength=%d\n",
11903  strat->posInLDependsOnLength);
11904  PrintS(showOption());PrintLn();
11905  PrintS("LDeg: ");
11906  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11907  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11908  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11909  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11910  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11911  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11912  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11913  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11914  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11915  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11916  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11917  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11918  else Print("? (%lx)", (long)currRing->pLDeg);
11919  PrintS(" / ");
11920  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11921  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11922  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11923  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11924  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11925  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11926  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11927  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11928  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11929  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11930  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11931  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11932  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11933  PrintLn();
11934  PrintS("currRing->pFDeg: ");
11935  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11936  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11937  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11938  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11939  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11940  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11941  else Print("? (%lx)", (long)currRing->pFDeg);
11942  PrintLn();
11943  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11944  if(TEST_OPT_DEGBOUND)
11945  Print(" degBound: %d\n", Kstd1_deg);
11946 
11947  if( ecartWeights != NULL )
11948  {
11949  PrintS("ecartWeights: ");
11950  for (int i = rVar(currRing); i > 0; i--)
11951  Print("%hd ", ecartWeights[i]);
11952  PrintLn();
11954  }
11955 
11956 #ifndef SING_NDEBUG
11958 #endif
11959 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1266
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6416
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11792
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5496
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6913
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1362
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5389
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6458
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6528
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6872
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
BOOLEAN noTailReduction
Definition: kutil.h:375
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5361
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3270
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6630
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6957
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6837
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6802
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6755
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5783
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1430
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
int ak
Definition: kutil.h:349
char * showOption()
Definition: misc_ip.cc:717
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7071
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5729
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:542
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:275
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5350
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1456
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5419
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5931
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:369
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5455
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1273
BOOLEAN Gebauer
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:394
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1259
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5885
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:280
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6158
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7007
void rDebugPrint(const ring r)
Definition: ring.cc:4003
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5824
BOOLEAN sugarCrit
Definition: kutil.h:374
int Kstd1_deg
Definition: kutil.cc:236
void enterSMoraNF(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1416
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11701
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:285
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:810
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
ring tailRing
Definition: kutil.h:339
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5572
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5614
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3483
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1037
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6115
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
BOOLEAN use_buckets
Definition: kutil.h:380
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6058
void initEcartNormal(TObject *h)
Definition: kutil.cc:1251
int LazyPass
Definition: kutil.h:349
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11755
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5690
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
int LazyDegree
Definition: kutil.h:349
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5992
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5661
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9255

◆ kFindDivisibleByInS()

TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart 
)

Definition at line 7384 of file kutil.cc.

7386 {
7387  int j = 0;
7388  const unsigned long not_sev = ~L->sev;
7389  const unsigned long* sev = strat->sevS;
7390  poly p;
7391  ring r;
7392  L->GetLm(p, r);
7393 
7394  assume(~not_sev == p_GetShortExpVector(p, r));
7395 
7396  if (r == currRing)
7397  {
7398  if(!rField_is_Ring(r))
7399  {
7400  loop
7401  {
7402  if (j > pos) return NULL;
7403  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7404  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7405  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7406  {
7407  break;
7408  }
7409  #else
7410  if (!(sev[j] & not_sev) &&
7411  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7412  p_LmDivisibleBy(strat->S[j], p, r))
7413  {
7414  break;
7415  }
7416  #endif
7417  j++;
7418  }
7419  }
7420  #ifdef HAVE_RINGS
7421  else
7422  {
7423  loop
7424  {
7425  if (j > pos) return NULL;
7426  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7427  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7428  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7429  {
7430  break;
7431  }
7432  #else
7433  if (!(sev[j] & not_sev) &&
7434  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7435  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7436  {
7437  break;
7438  }
7439  #endif
7440  j++;
7441  }
7442  }
7443  #endif
7444  // if called from NF, T objects do not exist:
7445  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7446  {
7447  T->Set(strat->S[j], r, strat->tailRing);
7448  return T;
7449  }
7450  else
7451  {
7452 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7453 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7454 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7455  return strat->S_2_T(j);
7456  }
7457  }
7458  else
7459  {
7460  TObject* t;
7461  if(!rField_is_Ring(r))
7462  {
7463  loop
7464  {
7465  if (j > pos) return NULL;
7466  assume(strat->S_2_R[j] != -1);
7467  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7468  t = strat->S_2_T(j);
7469  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7470  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7471  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7472  {
7473  return t;
7474  }
7475  #else
7476  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7477  {
7478  t = strat->S_2_T(j);
7479  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7480  if (p_LmDivisibleBy(t->t_p, p, r))
7481  {
7482  return t;
7483  }
7484  }
7485  #endif
7486  j++;
7487  }
7488  }
7489  #ifdef HAVE_RINGS
7490  else
7491  {
7492  loop
7493  {
7494  if (j > pos) return NULL;
7495  assume(strat->S_2_R[j] != -1);
7496  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7497  t = strat->S_2_T(j);
7498  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7499  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7500  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7501  {
7502  return t;
7503  }
7504  #else
7505  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7506  {
7507  t = strat->S_2_T(j);
7508  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7509  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7510  {
7511  return t;
7512  }
7513  }
7514  #endif
7515  j++;
7516  }
7517  }
7518  #endif
7519  }
7520 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:346
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:35
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
polyset S
Definition: kutil.h:300
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1768
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
intset ecartS
Definition: kutil.h:303
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
unsigned long * sevS
Definition: kutil.h:316
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
class sTObject TObject
Definition: kutil.h:59

◆ kFindInT() [1/2]

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

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

Definition at line 717 of file kutil.cc.

718 {
719  int i;
720 
721  for (i=0; i<=tlength; i++)
722  {
723  if (T[i].p == p) return i;
724  }
725  return -1;
726 }
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static jList * T
Definition: janet.cc:37

◆ kFindInT() [2/2]

int kFindInT ( poly  p,
kStrategy  strat 
)

Definition at line 728 of file kutil.cc.

729 {
730  int i;
731  do
732  {
733  i = kFindInT(p, strat->T, strat->tl);
734  if (i >= 0) return i;
735  strat = strat->next;
736  }
737  while (strat != NULL);
738  return -1;
739 }
return P p
Definition: myNF.cc:203
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:717
int tl
Definition: kutil.h:346
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
TSet T
Definition: kutil.h:320
kStrategy next
Definition: kutil.h:271

◆ kMergeBintoL()

void kMergeBintoL ( kStrategy  strat)

Definition at line 3224 of file kutil.cc.

3225 {
3226  int j=strat->Ll+strat->Bl+1;
3227  if (j>strat->Lmax)
3228  {
3229  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
3230  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
3231  j*sizeof(LObject));
3232  strat->Lmax=j;
3233  }
3234  j = strat->Ll;
3235  int i;
3236  for (i=strat->Bl; i>=0; i--)
3237  {
3238  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
3239  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3240  }
3241  strat->Bl = -1;
3242 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
int Bl
Definition: kutil.h:348
#define setmaxLinc
Definition: kutil.h:30
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
int j
Definition: myNF.cc:70
LObject * LSet
Definition: kutil.h:62
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:321
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347

◆ kMergeBintoLSba()

void kMergeBintoLSba ( kStrategy  strat)

Definition at line 3247 of file kutil.cc.

3248 {
3249  int j=strat->Ll+strat->Bl+1;
3250  if (j>strat->Lmax)
3251  {
3252  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
3253  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
3254  j*sizeof(LObject));
3255  strat->Lmax=j;
3256  }
3257  j = strat->Ll;
3258  int i;
3259  for (i=strat->Bl; i>=0; i--)
3260  {
3261  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
3262  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3263  }
3264  strat->Bl = -1;
3265 }
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:347
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
int Bl
Definition: kutil.h:348
#define setmaxLinc
Definition: kutil.h:30
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
int j
Definition: myNF.cc:70
LObject * LSet
Definition: kutil.h:62
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:321
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347

◆ kPosInLDependsOnLength()

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

Definition at line 9929 of file kutil.cc.

9932 {
9933  if (pos_in_l == posInL110
9934  || pos_in_l == posInL10
9935  #ifdef HAVE_RINGS
9936  || pos_in_l == posInL110Ring
9937  || pos_in_l == posInLRing
9938  #endif
9939  )
9940  return TRUE;
9941 
9942  return FALSE;
9943 }
#define FALSE
Definition: auxiliary.h:94
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6755
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6303
#define TRUE
Definition: auxiliary.h:98
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6714
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098

◆ kStratChangeTailRing()

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

Definition at line 11280 of file kutil.cc.

11281 {
11282  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11283  /* initial setup or extending */
11284 
11285  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11286  if (expbound >= currRing->bitmask) return FALSE;
11287  strat->overflow=FALSE;
11288  ring new_tailRing = rModifyRing(currRing,
11289  // Hmmm .. the condition pFDeg == p_Deg
11290  // might be too strong
11291  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11292  (strat->ak==0), // omit_comp if the input is an ideal
11293  expbound); // exp_limit
11294 
11295  if (new_tailRing == currRing) return TRUE;
11296 
11297  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11298  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11299 
11300  if (currRing->pFDeg != currRing->pFDegOrig)
11301  {
11302  new_tailRing->pFDeg = currRing->pFDeg;
11303  new_tailRing->pLDeg = currRing->pLDeg;
11304  }
11305 
11306  if (TEST_OPT_PROT)
11307  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11308  kTest_TS(strat);
11309  assume(new_tailRing != strat->tailRing);
11310  pShallowCopyDeleteProc p_shallow_copy_delete
11311  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11312 
11313  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11314 
11315  int i;
11316  for (i=0; i<=strat->tl; i++)
11317  {
11318  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11319  p_shallow_copy_delete);
11320  }
11321  for (i=0; i<=strat->Ll; i++)
11322  {
11323  assume(strat->L[i].p != NULL);
11324  if (pNext(strat->L[i].p) != strat->tail)
11325  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11326  }
11327  if ((strat->P.t_p != NULL) ||
11328  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11329  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11330 
11331  if ((L != NULL) && (L->tailRing != new_tailRing))
11332  {
11333  if (L->i_r < 0)
11334  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11335  else
11336  {
11337  assume(L->i_r <= strat->tl);
11338  TObject* t_l = strat->R[L->i_r];
11339  assume(t_l != NULL);
11340  L->tailRing = new_tailRing;
11341  L->p = t_l->p;
11342  L->t_p = t_l->t_p;
11343  L->max_exp = t_l->max_exp;
11344  }
11345  }
11346 
11347  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11348  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11349 
11350  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11351  if (strat->tailRing != currRing)
11352  rKillModifiedRing(strat->tailRing);
11353 
11354  strat->tailRing = new_tailRing;
11355  strat->tailBin = new_tailBin;
11356  strat->p_shallow_copy_delete
11357  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11358 
11359  if (strat->kHEdge != NULL)
11360  {
11361  if (strat->t_kHEdge != NULL)
11362  p_LmFree(strat->t_kHEdge, strat->tailRing);
11363  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11364  }
11365 
11366  if (strat->kNoether != NULL)
11367  {
11368  if (strat->t_kNoether != NULL)
11369  p_LmFree(strat->t_kNoether, strat->tailRing);
11371  new_tailRing);
11372  }
11373  kTest_TS(strat);
11374  if (TEST_OPT_PROT)
11375  PrintS("]");
11376  return TRUE;
11377 }
void omMergeStickyBinIntoBin(omBin sticky_bin, omBin into_bin)
Definition: omBin.c:396
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:323
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:293
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2601
#define TRUE
Definition: auxiliary.h:98
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:334
int ak
Definition: kutil.h:349
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
BOOLEAN homog
Definition: kutil.h:369
#define kTest_TS(A)
Definition: kutil.h:649
#define assume(x)
Definition: mod2.h:394
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:325
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:52
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
poly t_kNoether
Definition: kutil.h:327
omBin tailBin
Definition: kutil.h:341
char overflow
Definition: kutil.h:401
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2967
TSet T
Definition: kutil.h:320
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:292
class sTObject TObject
Definition: kutil.h:59

◆ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11379 of file kutil.cc.

11380 {
11381  unsigned long l = 0;
11382  int i;
11383  long e;
11384 
11385  assume(strat->tailRing == currRing);
11386 
11387  for (i=0; i<= strat->Ll; i++)
11388  {
11389  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11390  }
11391  for (i=0; i<=strat->tl; i++)
11392  {
11393  // Hmm ... this we could do in one Step
11394  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11395  }
11396  if (rField_is_Ring(currRing))
11397  {
11398  l *= 2;
11399  }
11400  e = p_GetMaxExp(l, currRing);
11401  if (e <= 1) e = 2;
11402 
11403  kStratChangeTailRing(strat, NULL, NULL, e);
11404 }
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:1174
int Ll
Definition: kutil.h:347
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:346
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11280
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
TSet T
Definition: kutil.h:320
int l
Definition: cfEzgcd.cc:94

◆ message()

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

Definition at line 7941 of file kutil.cc.

7942 {
7943  if (i != *olddeg)
7944  {
7945  Print("%d",i);
7946  *olddeg = i;
7947  }
7948  if (TEST_OPT_OLDSTD)
7949  {
7950  if (strat->Ll != *reduc)
7951  {
7952  if (strat->Ll != *reduc-1)
7953  Print("(%d)",strat->Ll+1);
7954  else
7955  PrintS("-");
7956  *reduc = strat->Ll;
7957  }
7958  else
7959  PrintS(".");
7960  mflush();
7961  }
7962  else
7963  {
7964  if (red_result == 0)
7965  PrintS("-");
7966  else if (red_result < 0)
7967  PrintS(".");
7968  if ((red_result > 0) || ((strat->Ll % 100)==99))
7969  {
7970  if (strat->Ll != *reduc && strat->Ll > 0)
7971  {
7972  Print("(%d)",strat->Ll+1);
7973  *reduc = strat->Ll;
7974  }
7975  }
7976  }
7977 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:347
#define mflush()
Definition: reporter.h:57
#define TEST_OPT_OLDSTD
Definition: options.h:117
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284

◆ messageStat()

void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7982 of file kutil.cc.

7983 {
7984  //PrintS("\nUsage/Allocation of temporary storage:\n");
7985  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7986  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7987  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7988  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7989  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7990  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7991  /*mflush();*/
7992 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:343
int cv
Definition: kutil.h:366
int cp
Definition: kutil.h:343

◆ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7994 of file kutil.cc.

7995 {
7996  //PrintS("\nUsage/Allocation of temporary storage:\n");
7997  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7998  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7999  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
8000  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
8001  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
8002  /* in usual case strat->cv is 0, it gets changed only in shift routines */
8003  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
8004  /*mflush();*/
8005 }
#define Print
Definition: emacs.cc:83
int cv
Definition: kutil.h:366
int nrsyzcrit
Definition: kutil.h:357
int nrrewcrit
Definition: kutil.h:358

◆ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10762 of file kutil.cc.

10763 {
10764  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10765  return FALSE;
10766  int i,j;
10767  poly newNoether;
10768 
10769 #if 0
10770  if (currRing->weight_all_1)
10771  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10772  else
10773  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10774 #else
10775  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10776 #endif
10777  if (strat->kHEdge==NULL) return FALSE;
10778  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10779  if (strat->tailRing != currRing)
10780  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10781  /* compare old and new noether*/
10782  newNoether = pLmInit(strat->kHEdge);
10783  j = p_FDeg(newNoether,currRing);
10784  for (i=1; i<=(currRing->N); i++)
10785  {
10786  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10787  }
10788  pSetm(newNoether);
10789  if (j < strat->HCord) /*- statistics -*/
10790  {
10791  if (TEST_OPT_PROT)
10792  {
10793  Print("H(%d)",j);
10794  mflush();
10795  }
10796  strat->HCord=j;
10797  #ifdef KDEBUG
10798  if (TEST_OPT_DEBUG)
10799  {
10800  Print("H(%d):",j);
10801  wrp(strat->kHEdge);
10802  PrintLn();
10803  }
10804  #endif
10805  }
10806  if (pCmp(strat->kNoether,newNoether)!=1)
10807  {
10808  pDelete(&strat->kNoether);
10809  strat->kNoether=newNoether;
10810  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10811  if (strat->tailRing != currRing)
10812  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10813 
10814  return TRUE;
10815  }
10816  if (rField_is_Ring(currRing))
10817  pLmDelete(newNoether);
10818  else
10819  pLmFree(newNoether);
10820  return FALSE;
10821 }
#define pSetm(p)
Definition: polys.h:253
int HCord
Definition: kutil.cc:235
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:323
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:324
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:1005
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
int ak
Definition: kutil.h:349
#define TEST_OPT_DEBUG
Definition: options.h:103
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
int HCord
Definition: kutil.h:351
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pGetExp(p, i)
Exponent.
Definition: polys.h:41
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
int j
Definition: myNF.cc:70
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
poly t_kHEdge
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
poly t_kNoether
Definition: kutil.h:327
#define pDelete(p_ptr)
Definition: polys.h:169
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:297

◆ nextZeroSimplexExponent()

int nextZeroSimplexExponent ( long  exp[],
long  ind[],
long  cexp[],
long  cind[],
long *  cabsind,
long  step[],
long  bound,
long  N 
)

Definition at line 4366 of file kutil.cc.

4368 {
4369  long add = ind2(cexp[1] + 2);
4370  if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
4371  {
4372  cexp[1] += 2;
4373  cind[1] += add;
4374  *cabsind += add;
4375  }
4376  else
4377  {
4378  // cabsind >= habsind
4379  if (N == 1) return 0;
4380  int i = 1;
4381  while (exp[i] == cexp[i] && i <= N) i++;
4382  cexp[i] = exp[i];
4383  *cabsind -= cind[i];
4384  cind[i] = ind[i];
4385  step[i] = 500000;
4386  *cabsind += cind[i];
4387  // Print("in: %d\n", *cabsind);
4388  i += 1;
4389  if (i > N) return 0;
4390  do
4391  {
4392  step[1] = 500000;
4393  for (int j = i + 1; j <= N; j++)
4394  {
4395  if (step[1] > step[j]) step[1] = step[j];
4396  }
4397  add = ind2(cexp[i] + 2);
4398  if (*cabsind - step[1] + add >= bound)
4399  {
4400  cexp[i] = exp[i];
4401  *cabsind -= cind[i];
4402  cind[i] = ind[i];
4403  *cabsind += cind[i];
4404  step[i] = 500000;
4405  i += 1;
4406  if (i > N) return 0;
4407  }
4408  else step[1] = -1;
4409  } while (step[1] != -1);
4410  step[1] = 500000;
4411  cexp[i] += 2;
4412  cind[i] += add;
4413  *cabsind += add;
4414  if (add < step[i]) step[i] = add;
4415  for (i = 2; i <= N; i++)
4416  {
4417  if (step[1] > step[i]) step[1] = step[i];
4418  }
4419  }
4420  return 1;
4421 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
static unsigned add[]
Definition: misc_ip.cc:83
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:4213

◆ p_HasNotCF_Lift()

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

p_HasNotCF for the IDLIFT case: ignore component

Definition at line 2220 of file kutil.cc.

2221 {
2222  int i = rVar(r);
2223  loop
2224  {
2225  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
2226  return FALSE;
2227  i--;
2228  if (i == 0)
2229  return TRUE;
2230  }
2231 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

◆ pCopyL2p()

poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 11993 of file kutil.cc.

11994 {
11995  /* restores a poly in currRing from LObject */
11996  LObject h = H;
11997  h.Copy();
11998  poly p;
11999  if (h.p == NULL)
12000  {
12001  if (h.t_p != NULL)
12002  {
12003  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
12004  return(p);
12005  }
12006  else
12007  {
12008  /* h.tp == NULL -> the object is NULL */
12009  return(NULL);
12010  }
12011  }
12012  /* we're here if h.p != NULL */
12013  if (h.t_p == NULL)
12014  {
12015  /* then h.p is the whole poly in currRing */
12016  p = h.p;
12017  return(p);
12018  }
12019  /* we're here if h.p != NULL and h.t_p != NULL */
12020  // clean h.p, get poly from t_p
12021  pNext(h.p)=NULL;
12022  pLmDelete(&h.p);
12023  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12024  /* dest. ring: */ currRing);
12025  // no need to clean h: we re-used the polys
12026  return(p);
12027 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ pDivComp()

static int pDivComp ( poly  p,
poly  q 
)
inlinestatic

Definition at line 187 of file kutil.cc.

188 {
189  if (pGetComp(p) == pGetComp(q))
190  {
191 #ifdef HAVE_RATGRING
192  if (rIsRatGRing(currRing))
193  {
195  q,currRing,
196  currRing->real_var_start, currRing->real_var_end))
197  return 0;
198  return pLmCmp(q,p); // ONLY FOR GLOBAL ORDER!
199  }
200 #endif
201  BOOLEAN a=FALSE, b=FALSE;
202  int i;
203  unsigned long la, lb;
204  unsigned long divmask = currRing->divmask;
205  for (i=0; i<currRing->VarL_Size; i++)
206  {
207  la = p->exp[currRing->VarL_Offset[i]];
208  lb = q->exp[currRing->VarL_Offset[i]];
209  if (la != lb)
210  {
211  if (la < lb)
212  {
213  if (b) return 0;
214  if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
215  return 0;
216  a = TRUE;
217  }
218  else
219  {
220  if (a) return 0;
221  if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
222  return 0;
223  b = TRUE;
224  }
225  }
226  }
227  if (a) { /*assume(pLmCmp(q,p)==1);*/ return 1; }
228  if (b) { /*assume(pLmCmp(q,p)==-1);*/return -1; }
229  /*assume(pLmCmp(q,p)==0);*/
230  }
231  return 0;
232 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
#define TRUE
Definition: auxiliary.h:98
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
static BOOLEAN _p_LmDivisibleByPart(poly a, const ring r_a, poly b, const ring r_b, const int start, const int end)
Definition: p_polys.h:1727
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213

◆ pDivCompRing()

static int pDivCompRing ( poly  p,
poly  q 
)
inlinestatic

Definition at line 149 of file kutil.cc.

150 {
151  if (pGetComp(p) == pGetComp(q))
152  {
153  BOOLEAN a=FALSE, b=FALSE;
154  int i;
155  unsigned long la, lb;
156  unsigned long divmask = currRing->divmask;
157  for (i=0; i<currRing->VarL_Size; i++)
158  {
159  la = p->exp[currRing->VarL_Offset[i]];
160  lb = q->exp[currRing->VarL_Offset[i]];
161  if (la != lb)
162  {
163  if (la < lb)
164  {
165  if (b) return pDivComp_INCOMP;
166  if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
167  return pDivComp_INCOMP;
168  a = TRUE;
169  }
170  else
171  {
172  if (a) return pDivComp_INCOMP;
173  if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
174  return pDivComp_INCOMP;
175  b = TRUE;
176  }
177  }
178  }
179  if (a) return pDivComp_LESS;
180  if (b) return pDivComp_GREATER;
181  if (!a & !b) return pDivComp_EQUAL;
182  }
183  return pDivComp_INCOMP;
184 }
#define pDivComp_LESS
Definition: kutil.cc:141
const poly a
Definition: syzextra.cc:212
#define pDivComp_EQUAL
Definition: kutil.cc:140
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define pDivComp_GREATER
Definition: kutil.cc:142
#define pDivComp_INCOMP
Definition: kutil.cc:143
int BOOLEAN
Definition: auxiliary.h:85
const poly b
Definition: syzextra.cc:213

◆ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 11962 of file kutil.cc.

11963 {
11964  /* assume: p is completely in currRing */
11965  /* produces an object with LM in curring
11966  and TAIL in tailring */
11967  if (pNext(p)!=NULL)
11968  {
11969  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11970  }
11971  return(p);
11972 }
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43

◆ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 11976 of file kutil.cc.

11977 {
11978  /* assume: p has LM in curring and TAIL in tailring */
11979  /* convert it to complete currRing */
11980 
11981  /* check that LM is in currRing */
11983 
11984  if (pNext(p)!=NULL)
11985  {
11986  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11987  }
11988  return(p);
11989 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43

◆ posInIdealMonFirst()

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

Definition at line 5306 of file kutil.cc.

5307 {
5308  if(end < 0 || end >= IDELEMS(F))
5309  end = IDELEMS(F);
5310  if (end<0) return 0;
5311  if(pNext(p) == NULL) return start;
5312  polyset set=F->m;
5313  int o = p_Deg(p,currRing);
5314  int op;
5315  int i;
5316  int an = start;
5317  for(i=start;i<end;i++)
5318  if(set[i] != NULL && pNext(set[i]) == NULL)
5319  an++;
5320  if(an == end-1)
5321  return end;
5322  int en= end;
5323  loop
5324  {
5325  if(an>=en)
5326  return en;
5327  if (an == en-1)
5328  {
5329  op = p_Deg(set[an],currRing);
5330  if ((op < o)
5331  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5332  return en;
5333  return an;
5334  }
5335  i=(an+en) / 2;
5336  op = p_Deg(set[i],currRing);
5337  if ((op < o)
5338  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5339  an=i;
5340  else
5341  en=i;
5342  }
5343 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
#define pNext(p)
Definition: monomials.h:43

◆ posInL0()

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

Definition at line 6158 of file kutil.cc.

6160 {
6161  if (length<0) return 0;
6162 
6163  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6164  return length+1;
6165 
6166  int i;
6167  int an = 0;
6168  int en= length;
6169  loop
6170  {
6171  if (an >= en-1)
6172  {
6173  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6174  return an;
6175  }
6176  i=(an+en) / 2;
6177  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6178  else en=i;
6179  /*aend. fuer lazy == in !=- machen */
6180  }
6181 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL0Ring()

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

Definition at line 6184 of file kutil.cc.

6186 {
6187  if (length<0) return 0;
6188 
6189  if (pLtCmpOrdSgnEqP(set[length].p,p->p))
6190  return length+1;
6191 
6192  int i;
6193  int an = 0;
6194  int en= length;
6195  loop
6196  {
6197  if (an >= en-1)
6198  {
6199  if (pLtCmpOrdSgnEqP(set[an].p,p->p)) return en;
6200  return an;
6201  }
6202  i=(an+en) / 2;
6203  if (pLtCmpOrdSgnEqP(set[i].p,p->p)) an=i;
6204  else en=i;
6205  /*aend. fuer lazy == in !=- machen */
6206  }
6207 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

◆ posInL11()

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

Definition at line 6416 of file kutil.cc.

6418 {
6419  if (length<0) return 0;
6420 
6421  int o = p->GetpFDeg();
6422  int op = set[length].GetpFDeg();
6423 
6424  if ((op > o)
6425  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6426  return length+1;
6427  int i;
6428  int an = 0;
6429  int en= length;
6430  loop
6431  {
6432  if (an >= en-1)
6433  {
6434  op = set[an].GetpFDeg();
6435  if ((op > o)
6436  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6437  return en;
6438  return an;
6439  }
6440  i=(an+en) / 2;
6441  op = set[i].GetpFDeg();
6442  if ((op > o)
6443  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6444  an=i;
6445  else
6446  en=i;
6447  }
6448 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL110()

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

Definition at line 6714 of file kutil.cc.

6716 {
6717  if (length<0) return 0;
6718 
6719  int o = p->GetpFDeg();
6720  int op = set[length].GetpFDeg();
6721 
6722  if ((op > o)
6723  || ((op == o) && (set[length].length >p->length))
6724  || ((op == o) && (set[length].length <= p->length)
6725  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6726  return length+1;
6727  int i;
6728  int an = 0;
6729  int en= length;
6730  loop
6731  {
6732  if (an >= en-1)
6733  {
6734  op = set[an].GetpFDeg();
6735  if ((op > o)
6736  || ((op == o) && (set[an].length >p->length))
6737  || ((op == o) && (set[an].length <=p->length)
6738  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6739  return en;
6740  return an;
6741  }
6742  i=(an+en) / 2;
6743  op = set[i].GetpFDeg();
6744  if ((op > o)
6745  || ((op == o) && (set[i].length > p->length))
6746  || ((op == o) && (set[i].length <= p->length)
6747  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6748  an=i;
6749  else
6750  en=i;
6751  }
6752 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL110Ring()

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

Definition at line 6755 of file kutil.cc.

6757 {
6758  if (length<0) return 0;
6759 
6760  int o = p->GetpFDeg();
6761  int op = set[length].GetpFDeg();
6762 
6763  if ((op > o)
6764  || ((op == o) && (set[length].length >p->length))
6765  || ((op == o) && (set[length].length <= p->length)
6766  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6767  return length+1;
6768  int i;
6769  int an = 0;
6770  int en= length;
6771  loop
6772  {
6773  if (an >= en-1)
6774  {
6775  op = set[an].GetpFDeg();
6776  if ((op > o)
6777  || ((op == o) && (set[an].length >p->length))
6778  || ((op == o) && (set[an].length <=p->length)
6779  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6780  return en;
6781  return an;
6782  }
6783  i=(an+en) / 2;
6784  op = set[i].GetpFDeg();
6785  if ((op > o)
6786  || ((op == o) && (set[i].length > p->length))
6787  || ((op == o) && (set[i].length <= p->length)
6788  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6789  an=i;
6790  else
6791  en=i;
6792  }
6793 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL11Ring()

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

Definition at line 6458 of file kutil.cc.

6460 {
6461  if (length<0) return 0;
6462 
6463  int o = p->GetpFDeg();
6464  int op = set[length].GetpFDeg();
6465 
6466  if ((op > o)
6467  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6468  return length+1;
6469  int i;
6470  int an = 0;
6471  int en= length;
6472  loop
6473  {
6474  if (an >= en-1)
6475  {
6476  op = set[an].GetpFDeg();
6477  if ((op > o)
6478  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6479  return en;
6480  return an;
6481  }
6482  i=(an+en) / 2;
6483  op = set[i].GetpFDeg();
6484  if ((op > o)
6485  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6486  an=i;
6487  else
6488  en=i;
6489  }
6490 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL11Ringls()

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

Definition at line 6528 of file kutil.cc.

6530 {
6531  if (length < 0) return 0;
6532  int an,en,i;
6533  an = 0;
6534  en = length+1;
6535  loop
6536  {
6537  if (an >= en-1)
6538  {
6539  if(an == en)
6540  return en;
6541  if (set[an].FDeg > p->FDeg)
6542  return en;
6543  if (set[an].FDeg < p->FDeg)
6544  return an;
6545  if (set[an].FDeg == p->FDeg)
6546  {
6547  number lcset,lcp;
6548  lcset = pGetCoeff(set[an].p);
6549  lcp = pGetCoeff(p->p);
6550  if(!nGreaterZero(lcset))
6551  {
6552  set[an].p=p_Neg(set[an].p,currRing);
6553  if (set[an].t_p!=NULL)
6554  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6555  lcset=pGetCoeff(set[an].p);
6556  }
6557  if(!nGreaterZero(lcp))
6558  {
6559  p->p=p_Neg(p->p,currRing);
6560  if (p->t_p!=NULL)
6561  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6562  lcp=pGetCoeff(p->p);
6563  }
6564  if(nGreater(lcset, lcp))
6565  {
6566  return en;
6567  }
6568  else
6569  {
6570  return an;
6571  }
6572  }
6573  }
6574  i=(an+en) / 2;
6575  if (set[i].FDeg > p->FDeg)
6576  an=i;
6577  if (set[i].FDeg < p->FDeg)
6578  en=i;
6579  if (set[i].FDeg == p->FDeg)
6580  {
6581  number lcset,lcp;
6582  lcset = pGetCoeff(set[i].p);
6583  lcp = pGetCoeff(p->p);
6584  if(!nGreaterZero(lcset))
6585  {
6586  set[i].p=p_Neg(set[i].p,currRing);
6587  if (set[i].t_p!=NULL)
6588  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6589  lcset=pGetCoeff(set[i].p);
6590  }
6591  if(!nGreaterZero(lcp))
6592  {
6593  p->p=p_Neg(p->p,currRing);
6594  if (p->t_p!=NULL)
6595  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6596  lcp=pGetCoeff(p->p);
6597  }
6598  if(nGreater(lcset, lcp))
6599  {
6600  an = i;
6601  }
6602  else
6603  {
6604  en = i;
6605  }
6606  }
6607  }
6608 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define nGreaterZero(n)
Definition: numbers.h:27
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1013
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInL13()

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

Definition at line 6802 of file kutil.cc.

6804 {
6805  if (length<0) return 0;
6806 
6807  int o = p->GetpFDeg();
6808 
6809  if (set[length].GetpFDeg() > o)
6810  return length+1;
6811 
6812  int i;
6813  int an = 0;
6814  int en= length;
6815  loop
6816  {
6817  if (an >= en-1)
6818  {
6819  if (set[an].GetpFDeg() >= o)
6820  return en;
6821  return an;
6822  }
6823  i=(an+en) / 2;
6824  if (set[i].GetpFDeg() >= o)
6825  an=i;
6826  else
6827  en=i;
6828  }
6829 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL15()

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

Definition at line 6837 of file kutil.cc.

6839 {
6840  if (length<0) return 0;
6841 
6842  int o = p->GetpFDeg() + p->ecart;
6843  int op = set[length].GetpFDeg() + set[length].ecart;
6844 
6845  if ((op > o)
6846  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6847  return length+1;
6848  int i;
6849  int an = 0;
6850  int en= length;
6851  loop
6852  {
6853  if (an >= en-1)
6854  {
6855  op = set[an].GetpFDeg() + set[an].ecart;
6856  if ((op > o)
6857  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6858  return en;
6859  return an;
6860  }
6861  i=(an+en) / 2;
6862  op = set[i].GetpFDeg() + set[i].ecart;
6863  if ((op > o)
6864  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6865  an=i;
6866  else
6867  en=i;
6868  }
6869 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL15Ring()

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

Definition at line 6872 of file kutil.cc.

6874 {
6875  if (length<0) return 0;
6876 
6877  int o = p->GetpFDeg() + p->ecart;
6878  int op = set[length].GetpFDeg() + set[length].ecart;
6879 
6880  if ((op > o)
6881  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6882  return length+1;
6883  int i;
6884  int an = 0;
6885  int en= length;
6886  loop
6887  {
6888  if (an >= en-1)
6889  {
6890  op = set[an].GetpFDeg() + set[an].ecart;
6891  if ((op > o)
6892  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6893  return en;
6894  return an;
6895  }
6896  i=(an+en) / 2;
6897  op = set[i].GetpFDeg() + set[i].ecart;
6898  if ((op > o)
6899  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6900  an=i;
6901  else
6902  en=i;
6903  }
6904 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInL17()

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

Definition at line 6913 of file kutil.cc.

6915 {
6916  if (length<0) return 0;
6917 
6918  int o = p->GetpFDeg() + p->ecart;
6919 
6920  if ((set[length].GetpFDeg() + set[length].ecart > o)
6921  || ((set[length].GetpFDeg() + set[length].ecart == o)
6922  && (set[length].ecart > p->ecart))
6923  || ((set[length].GetpFDeg() + set[length].ecart == o)
6924  && (set[length].ecart == p->ecart)
6925  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6926  return length+1;
6927  int i;
6928  int an = 0;
6929  int en= length;
6930  loop
6931  {
6932  if (an >= en-1)
6933  {
6934  if ((set[an].GetpFDeg() + set[an].ecart > o)
6935  || ((set[an].GetpFDeg() + set[an].ecart == o)
6936  && (set[an].ecart > p->ecart))
6937  || ((set[an].GetpFDeg() + set[an].ecart == o)
6938  && (set[an].ecart == p->ecart)
6939  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6940  return en;
6941  return an;
6942  }
6943  i=(an+en) / 2;
6944  if ((set[i].GetpFDeg() + set[i].ecart > o)
6945  || ((set[i].GetpFDeg() + set[i].ecart == o)
6946  && (set[i].ecart > p->ecart))
6947  || ((set[i].GetpFDeg() +set[i].ecart == o)
6948  && (set[i].ecart == p->ecart)
6949  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6950  an=i;
6951  else
6952  en=i;
6953  }
6954 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL17_c()

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

Definition at line 7007 of file kutil.cc.

7009 {
7010  if (length<0) return 0;
7011 
7012  int cc = (-1+2*currRing->order[0]==ringorder_c);
7013  /* cc==1 for (c,..), cc==-1 for (C,..) */
7014  unsigned long c = pGetComp(p->p)*cc;
7015  int o = p->GetpFDeg() + p->ecart;
7016 
7017  if (pGetComp(set[length].p)*cc > c)
7018  return length+1;
7019  if (pGetComp(set[length].p)*cc == c)
7020  {
7021  if ((set[length].GetpFDeg() + set[length].ecart > o)
7022  || ((set[length].GetpFDeg() + set[length].ecart == o)
7023  && (set[length].ecart > p->ecart))
7024  || ((set[length].GetpFDeg() + set[length].ecart == o)
7025  && (set[length].ecart == p->ecart)
7026  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
7027  return length+1;
7028  }
7029  int i;
7030  int an = 0;
7031  int en= length;
7032  loop
7033  {
7034  if (an >= en-1)
7035  {
7036  if (pGetComp(set[an].p)*cc > c)
7037  return en;
7038  if (pGetComp(set[an].p)*cc == c)
7039  {
7040  if ((set[an].GetpFDeg() + set[an].ecart > o)
7041  || ((set[an].GetpFDeg() + set[an].ecart == o)
7042  && (set[an].ecart > p->ecart))
7043  || ((set[an].GetpFDeg() + set[an].ecart == o)
7044  && (set[an].ecart == p->ecart)
7045  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
7046  return en;
7047  }
7048  return an;
7049  }
7050  i=(an+en) / 2;
7051  if (pGetComp(set[i].p)*cc > c)
7052  an=i;
7053  else if (pGetComp(set[i].p)*cc == c)
7054  {
7055  if ((set[i].GetpFDeg() + set[i].ecart > o)
7056  || ((set[i].GetpFDeg() + set[i].ecart == o)
7057  && (set[i].ecart > p->ecart))
7058  || ((set[i].GetpFDeg() +set[i].ecart == o)
7059  && (set[i].ecart == p->ecart)
7060  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
7061  an=i;
7062  else
7063  en=i;
7064  }
7065  else
7066  en=i;
7067  }
7068 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL17_cRing()

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

Definition at line 7071 of file kutil.cc.

7073 {
7074  if (length<0) return 0;
7075 
7076  int cc = (-1+2*currRing->order[0]==ringorder_c);
7077  /* cc==1 for (c,..), cc==-1 for (C,..) */
7078  unsigned long c = pGetComp(p->p)*cc;
7079  int o = p->GetpFDeg() + p->ecart;
7080 
7081  if (pGetComp(set[length].p)*cc > c)
7082  return length+1;
7083  if (pGetComp(set[length].p)*cc == c)
7084  {
7085  if ((set[length].GetpFDeg() + set[length].ecart > o)
7086  || ((set[length].GetpFDeg() + set[length].ecart == o)
7087  && (set[length].ecart > p->ecart))
7088  || ((set[length].GetpFDeg() + set[length].ecart == o)
7089  && (set[length].ecart == p->ecart)
7090  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
7091  return length+1;
7092  }
7093  int i;
7094  int an = 0;
7095  int en= length;
7096  loop
7097  {
7098  if (an >= en-1)
7099  {
7100  if (pGetComp(set[an].p)*cc > c)
7101  return en;
7102  if (pGetComp(set[an].p)*cc == c)
7103  {
7104  if ((set[an].GetpFDeg() + set[an].ecart > o)
7105  || ((set[an].GetpFDeg() + set[an].ecart == o)
7106  && (set[an].ecart > p->ecart))
7107  || ((set[an].GetpFDeg() + set[an].ecart == o)
7108  && (set[an].ecart == p->ecart)
7109  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
7110  return en;
7111  }
7112  return an;
7113  }
7114  i=(an+en) / 2;
7115  if (pGetComp(set[i].p)*cc > c)
7116  an=i;
7117  else if (pGetComp(set[i].p)*cc == c)
7118  {
7119  if ((set[i].GetpFDeg() + set[i].ecart > o)
7120  || ((set[i].GetpFDeg() + set[i].ecart == o)
7121  && (set[i].ecart > p->ecart))
7122  || ((set[i].GetpFDeg() +set[i].ecart == o)
7123  && (set[i].ecart == p->ecart)
7124  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
7125  an=i;
7126  else
7127  en=i;
7128  }
7129  else
7130  en=i;
7131  }
7132 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInL17Ring()

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

Definition at line 6957 of file kutil.cc.

6959 {
6960  if (length<0) return 0;
6961 
6962  int o = p->GetpFDeg() + p->ecart;
6963 
6964  if ((set[length].GetpFDeg() + set[length].ecart > o)
6965  || ((set[length].GetpFDeg() + set[length].ecart == o)
6966  && (set[length].ecart > p->ecart))
6967  || ((set[length].GetpFDeg() + set[length].ecart == o)
6968  && (set[length].ecart == p->ecart)
6969  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6970  return length+1;
6971  int i;
6972  int an = 0;
6973  int en= length;
6974  loop
6975  {
6976  if (an >= en-1)
6977  {
6978  if ((set[an].GetpFDeg() + set[an].ecart > o)
6979  || ((set[an].GetpFDeg() + set[an].ecart == o)
6980  && (set[an].ecart > p->ecart))
6981  || ((set[an].GetpFDeg() + set[an].ecart == o)
6982  && (set[an].ecart == p->ecart)
6983  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6984  return en;
6985  return an;
6986  }
6987  i=(an+en) / 2;
6988  if ((set[i].GetpFDeg() + set[i].ecart > o)
6989  || ((set[i].GetpFDeg() + set[i].ecart == o)
6990  && (set[i].ecart > p->ecart))
6991  || ((set[i].GetpFDeg() +set[i].ecart == o)
6992  && (set[i].ecart == p->ecart)
6993  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6994  an=i;
6995  else
6996  en=i;
6997  }
6998 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInLF5C()

int posInLF5C ( const LSet  ,
const int  ,
LObject ,
const kStrategy  strat 
)

Definition at line 6404 of file kutil.cc.

6406 {
6407  return strat->Ll+1;
6408 }
int Ll
Definition: kutil.h:347

◆ posInLF5CRing()

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

Definition at line 6492 of file kutil.cc.

6494 {
6495  if (length<0) return 0;
6496  if(start == (length +1)) return (length+1);
6497  int o = p->GetpFDeg();
6498  int op = set[length].GetpFDeg();
6499 
6500  if ((op > o)
6501  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6502  return length+1;
6503  int i;
6504  int an = start;
6505  int en= length;
6506  loop
6507  {
6508  if (an >= en-1)
6509  {
6510  op = set[an].GetpFDeg();
6511  if ((op > o)
6512  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6513  return en;
6514  return an;
6515  }
6516  i=(an+en) / 2;
6517  op = set[i].GetpFDeg();
6518  if ((op > o)
6519  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6520  an=i;
6521  else
6522  en=i;
6523  }
6524 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInLrg0()

int posInLrg0 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 6630 of file kutil.cc.

6640 {
6641  if (length < 0) return 0;
6642 
6643  int o = p->GetpFDeg();
6644  int op = set[length].GetpFDeg();
6645 
6646  if ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6647  return length + 1;
6648  int i;
6649  int an = 0;
6650  int en = length;
6651  loop
6652  {
6653  if (an >= en - 1)
6654  {
6655  op = set[an].GetpFDeg();
6656  if ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6657  return en;
6658  return an;
6659  }
6660  i = (an+en) / 2;
6661  op = set[i].GetpFDeg();
6662  if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6663  an = i;
6664  else
6665  en = i;
6666  }
6667 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInLRing()

int posInLRing ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 6303 of file kutil.cc.

6305 {
6306  if (length < 0) return 0;
6307  if (set[length].FDeg > p->FDeg)
6308  return length+1;
6309  if (set[length].FDeg == p->FDeg)
6310  if(set[length].GetpLength() > p->GetpLength())
6311  return length+1;
6312  int i;
6313  int an = 0;
6314  int en= length+1;
6315  loop
6316  {
6317  if (an >= en-1)
6318  {
6319  if(an == en)
6320  return en;
6321  if (set[an].FDeg > p->FDeg)
6322  return en;
6323  if(set[an].FDeg == p->FDeg)
6324  {
6325  if(set[an].GetpLength() > p->GetpLength())
6326  return en;
6327  else
6328  {
6329  if(set[an].GetpLength() == p->GetpLength())
6330  {
6331  if(nGreater(set[an].p->coef, p->p->coef))
6332  return en;
6333  else
6334  return an;
6335  }
6336  else
6337  {
6338  return an;
6339  }
6340  }
6341  }
6342  else
6343  return an;
6344  }
6345  i=(an+en) / 2;
6346  if (set[i].FDeg > p->FDeg)
6347  an=i;
6348  else
6349  {
6350  if(set[i].FDeg == p->FDeg)
6351  {
6352  if(set[i].GetpLength() > p->GetpLength())
6353  an=i;
6354  else
6355  {
6356  if(set[i].GetpLength() == p->GetpLength())
6357  {
6358  if(nGreater(set[i].p->coef, p->p->coef))
6359  an = i;
6360  else
6361  en = i;
6362  }
6363  else
6364  {
6365  en=i;
6366  }
6367  }
6368  }
6369  else
6370  en=i;
6371  }
6372  }
6373 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28

◆ posInLSig()

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

Definition at line 6216 of file kutil.cc.

6218 {
6219  if (length<0) return 0;
6220  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6221  return length+1;
6222 
6223  int i;
6224  int an = 0;
6225  int en= length;
6226  loop
6227  {
6228  if (an >= en-1)
6229  {
6230  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6231  return an;
6232  }
6233  i=(an+en) / 2;
6234  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6235  else en=i;
6236  /*aend. fuer lazy == in !=- machen */
6237  }
6238 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInLSigRing()

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

Definition at line 6240 of file kutil.cc.

6242 {
6243  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6244  if (length<0) return 0;
6245  if (pLtCmp(set[length].sig,p->sig)== 1)
6246  return length+1;
6247 
6248  int an,en,i;
6249  an = 0;
6250  en = length+1;
6251  int cmp;
6252  loop
6253  {
6254  if (an >= en-1)
6255  {
6256  if(an == en)
6257  return en;
6258  cmp = pLtCmp(set[an].sig,p->sig);
6259  if (cmp == 1)
6260  return en;
6261  if (cmp == -1)
6262  return an;
6263  if (cmp == 0)
6264  {
6265  if (set[an].FDeg > p->FDeg)
6266  return en;
6267  if (set[an].FDeg < p->FDeg)
6268  return an;
6269  if (set[an].FDeg == p->FDeg)
6270  {
6271  cmp = pLtCmp(set[an].p,p->p);
6272  if(cmp == 1)
6273  return en;
6274  else
6275  return an;
6276  }
6277  }
6278  }
6279  i=(an+en) / 2;
6280  cmp = pLtCmp(set[i].sig,p->sig);
6281  if (cmp == 1)
6282  an = i;
6283  if (cmp == -1)
6284  en = i;
6285  if (cmp == 0)
6286  {
6287  if (set[i].FDeg > p->FDeg)
6288  an = i;
6289  if (set[i].FDeg < p->FDeg)
6290  en = i;
6291  if (set[i].FDeg == p->FDeg)
6292  {
6293  cmp = pLtCmp(set[i].p,p->p);
6294  if(cmp == 1)
6295  an = i;
6296  else
6297  en = i;
6298  }
6299  }
6300  }
6301 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477

◆ posInLSpecial()

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

Definition at line 6115 of file kutil.cc.

6117 {
6118  if (length<0) return 0;
6119 
6120  int d=p->GetpFDeg();
6121  int op=set[length].GetpFDeg();
6122 
6123  if ((op > d)
6124  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
6125  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
6126  return length+1;
6127 
6128  int i;
6129  int an = 0;
6130  int en= length;
6131  loop
6132  {
6133  if (an >= en-1)
6134  {
6135  op=set[an].GetpFDeg();
6136  if ((op > d)
6137  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
6138  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
6139  return en;
6140  return an;
6141  }
6142  i=(an+en) / 2;
6143  op=set[i].GetpFDeg();
6144  if ((op>d)
6145  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
6146  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
6147  an=i;
6148  else
6149  en=i;
6150  }
6151 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

◆ posInS()

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

Definition at line 5128 of file kutil.cc.

5130 {
5131  if(length==-1) return 0;
5132  polyset set=strat->S;
5133  int i;
5134  int an = 0;
5135  int en = length;
5136  int cmp_int = currRing->OrdSgn;
5138 #ifdef HAVE_PLURAL
5139  && (currRing->real_var_start==0)
5140 #endif
5141 #if 0
5142  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5143 #endif
5144  )
5145  {
5146  int o=p_Deg(p,currRing);
5147  int oo=p_Deg(set[length],currRing);
5148 
5149  if ((oo<o)
5150  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5151  return length+1;
5152 
5153  loop
5154  {
5155  if (an >= en-1)
5156  {
5157  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5158  {
5159  return an;
5160  }
5161  return en;
5162  }
5163  i=(an+en) / 2;
5164  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5165  else an=i;
5166  }
5167  }
5168  else
5169  {
5170  if (rField_is_Ring(currRing))
5171  {
5172  if (pLmCmp(set[length],p)== -cmp_int)
5173  return length+1;
5174  int cmp;
5175  loop
5176  {
5177  if (an >= en-1)
5178  {
5179  cmp = pLmCmp(set[an],p);
5180  if (cmp == cmp_int) return an;
5181  if (cmp == -cmp_int) return en;
5182  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5183  return an;
5184  }
5185  i = (an+en) / 2;
5186  cmp = pLmCmp(set[i],p);
5187  if (cmp == cmp_int) en = i;
5188  else if (cmp == -cmp_int) an = i;
5189  else
5190  {
5191  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5192  else en = i;
5193  }
5194  }
5195  }
5196  else
5197  if (pLmCmp(set[length],p)== -cmp_int)
5198  return length+1;
5199 
5200  loop
5201  {
5202  if (an >= en-1)
5203  {
5204  if (pLmCmp(set[an],p) == cmp_int) return an;
5205  if (pLmCmp(set[an],p) == -cmp_int) return en;
5206  if ((cmp_int!=1)
5207  && ((strat->ecartS[an])>ecart_p))
5208  return an;
5209  return en;
5210  }
5211  i=(an+en) / 2;
5212  if (pLmCmp(set[i],p) == cmp_int) en=i;
5213  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5214  else
5215  {
5216  if ((cmp_int!=1)
5217  &&((strat->ecartS[i])<ecart_p))
5218  en=i;
5219  else
5220  an=i;
5221  }
5222  }
5223  }
5224 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int ak
Definition: kutil.h:349
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:752
intset ecartS
Definition: kutil.h:303
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
poly * polyset
Definition: hutil.h:15

◆ posInSMonFirst()

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

Definition at line 5229 of file kutil.cc.

5230 {
5231  if (length<0) return 0;
5232  polyset set=strat->S;
5233  if(pNext(p) == NULL)
5234  {
5235  int mon = 0;
5236  for(int i = 0;i<=length;i++)
5237  {
5238  if(set[i] != NULL && pNext(set[i]) == NULL)
5239  mon++;
5240  }
5241  int o = p_Deg(p,currRing);
5242  int op = p_Deg(set[mon],currRing);
5243 
5244  if ((op < o)
5245  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5246  return length+1;
5247  int i;
5248  int an = 0;
5249  int en= mon;
5250  loop
5251  {
5252  if (an >= en-1)
5253  {
5254  op = p_Deg(set[an],currRing);
5255  if ((op < o)
5256  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5257  return en;
5258  return an;
5259  }
5260  i=(an+en) / 2;
5261  op = p_Deg(set[i],currRing);
5262  if ((op < o)
5263  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5264  an=i;
5265  else
5266  en=i;
5267  }
5268  }
5269  else /*if(pNext(p) != NULL)*/
5270  {
5271  int o = p_Deg(p,currRing);
5272  int op = p_Deg(set[length],currRing);
5273 
5274  if ((op < o)
5275  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5276  return length+1;
5277  int i;
5278  int an = 0;
5279  for(i=0;i<=length;i++)
5280  if(set[i] != NULL && pNext(set[i]) == NULL)
5281  an++;
5282  int en= length;
5283  loop
5284  {
5285  if (an >= en-1)
5286  {
5287  op = p_Deg(set[an],currRing);
5288  if ((op < o)
5289  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5290  return en;
5291  return an;
5292  }
5293  i=(an+en) / 2;
5294  op = p_Deg(set[i],currRing);
5295  if ((op < o)
5296  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5297  an=i;
5298  else
5299  en=i;
5300  }
5301  }
5302 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
#define pNext(p)
Definition: monomials.h:43

◆ posInSyz()

int posInSyz ( const kStrategy  strat,
poly  sig 
)

Definition at line 6376 of file kutil.cc.

6377 {
6378  if (strat->syzl==0) return 0;
6379  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6380  return strat->syzl;
6381  int i;
6382  int an = 0;
6383  int en= strat->syzl-1;
6384  loop
6385  {
6386  if (an >= en-1)
6387  {
6388  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6389  return an;
6390  }
6391  i=(an+en) / 2;
6392  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6393  else en=i;
6394  /*aend. fuer lazy == in !=- machen */
6395  }
6396 }
loop
Definition: myNF.cc:98
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
polyset syz
Definition: kutil.h:301
int syzl
Definition: kutil.h:345

◆ posInT0()

int posInT0 ( const TSet  ,
const int  length,
LObject  
)

Definition at line 5350 of file kutil.cc.

5351 {
5352  return (length+1);
5353 }

◆ posInT1()

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

Definition at line 5361 of file kutil.cc.

5362 {
5363  if (length==-1) return 0;
5364 
5365  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5366 
5367  int i;
5368  int an = 0;
5369  int en= length;
5370 
5371  loop
5372  {
5373  if (an >= en-1)
5374  {
5375  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5376  return en;
5377  }
5378  i=(an+en) / 2;
5379  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5380  else an=i;
5381  }
5382 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT11()

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

Definition at line 5419 of file kutil.cc.

5420 {
5421  if (length==-1) return 0;
5422 
5423  int o = p.GetpFDeg();
5424  int op = set[length].GetpFDeg();
5425 
5426  if ((op < o)
5427  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5428  return length+1;
5429 
5430  int i;
5431  int an = 0;
5432  int en= length;
5433 
5434  loop
5435  {
5436  if (an >= en-1)
5437  {
5438  op= set[an].GetpFDeg();
5439  if ((op > o)
5440  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5441  return an;
5442  return en;
5443  }
5444  i=(an+en) / 2;
5445  op = set[i].GetpFDeg();
5446  if (( op > o)
5447  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5448  en=i;
5449  else
5450  an=i;
5451  }
5452 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT110()

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

Definition at line 5572 of file kutil.cc.

5573 {
5574  p.GetpLength();
5575  if (length==-1) return 0;
5576 
5577  int o = p.GetpFDeg();
5578  int op = set[length].GetpFDeg();
5579 
5580  if (( op < o)
5581  || (( op == o) && (set[length].length<p.length))
5582  || (( op == o) && (set[length].length == p.length)
5583  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5584  return length+1;
5585 
5586  int i;
5587  int an = 0;
5588  int en= length;
5589  loop
5590  {
5591  if (an >= en-1)
5592  {
5593  op = set[an].GetpFDeg();
5594  if (( op > o)
5595  || (( op == o) && (set[an].length > p.length))
5596  || (( op == o) && (set[an].length == p.length)
5597  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5598  return an;
5599  return en;
5600  }
5601  i=(an+en) / 2;
5602  op = set[i].GetpFDeg();
5603  if (( op > o)
5604  || (( op == o) && (set[i].length > p.length))
5605  || (( op == o) && (set[i].length == p.length)
5606  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5607  en=i;
5608  else
5609  an=i;
5610  }
5611 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT110Ring()

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

Definition at line 5614 of file kutil.cc.

5615 {
5616  p.GetpLength();
5617  if (length==-1) return 0;
5618 
5619  int o = p.GetpFDeg();
5620  int op = set[length].GetpFDeg();
5621 
5622  if (( op < o)
5623  || (( op == o) && (set[length].length<p.length))
5624  || (( op == o) && (set[length].length == p.length)
5625  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5626  return length+1;
5627 
5628  int i;
5629  int an = 0;
5630  int en= length;
5631  loop
5632  {
5633  if (an >= en-1)
5634  {
5635  op = set[an].GetpFDeg();
5636  if (( op > o)
5637  || (( op == o) && (set[an].length > p.length))
5638  || (( op == o) && (set[an].length == p.length)
5639  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5640  return an;
5641  return en;
5642  }
5643  i=(an+en) / 2;
5644  op = set[i].GetpFDeg();
5645  if (( op > o)
5646  || (( op == o) && (set[i].length > p.length))
5647  || (( op == o) && (set[i].length == p.length)
5648  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5649  en=i;
5650  else
5651  an=i;
5652  }
5653 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

◆ posInT11Ring()

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

Definition at line 5455 of file kutil.cc.

5456 {
5457  if (length==-1) return 0;
5458 
5459  int o = p.GetpFDeg();
5460  int op = set[length].GetpFDeg();
5461 
5462  if ((op < o)
5463  || ((op == o) && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5464  return length+1;
5465 
5466  int i;
5467  int an = 0;
5468  int en= length;
5469 
5470  loop
5471  {
5472  if (an >= en-1)
5473  {
5474  op= set[an].GetpFDeg();
5475  if ((op > o)
5476  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5477  return an;
5478  return en;
5479  }
5480  i=(an+en) / 2;
5481  op = set[i].GetpFDeg();
5482  if (( op > o)
5483  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5484  en=i;
5485  else
5486  an=i;
5487  }
5488 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

◆ posInT13()

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

Definition at line 5661 of file kutil.cc.

5662 {
5663  if (length==-1) return 0;
5664 
5665  int o = p.GetpFDeg();
5666 
5667  if (set[length].GetpFDeg() <= o)
5668  return length+1;
5669 
5670  int i;
5671  int an = 0;
5672  int en= length;
5673  loop
5674  {
5675  if (an >= en-1)
5676  {
5677  if (set[an].GetpFDeg() > o)
5678  return an;
5679  return en;
5680  }
5681  i=(an+en) / 2;
5682  if (set[i].GetpFDeg() > o)
5683  en=i;
5684  else
5685  an=i;
5686  }
5687 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInT15()

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

Definition at line 5729 of file kutil.cc.

5748 {
5749  if (length==-1) return 0;
5750 
5751  int o = p.GetpFDeg() + p.ecart;
5752  int op = set[length].GetpFDeg()+set[length].ecart;
5753 
5754  if ((op < o)
5755  || ((op == o)
5756  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5757  return length+1;
5758 
5759  int i;
5760  int an = 0;
5761  int en= length;
5762  loop
5763  {
5764  if (an >= en-1)
5765  {
5766  op = set[an].GetpFDeg()+set[an].ecart;
5767  if (( op > o)
5768  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5769  return an;
5770  return en;
5771  }
5772  i=(an+en) / 2;
5773  op = set[i].GetpFDeg()+set[i].ecart;
5774  if (( op > o)
5775  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5776  en=i;
5777  else
5778  an=i;
5779  }
5780 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT15Ring()

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

Definition at line 5783 of file kutil.cc.

5784 {
5785  if (length==-1) return 0;
5786 
5787  int o = p.GetpFDeg() + p.ecart;
5788  int op = set[length].GetpFDeg()+set[length].ecart;
5789 
5790  if ((op < o)
5791  || ((op == o)
5792  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5793  return length+1;
5794 
5795  int i;
5796  int an = 0;
5797  int en= length;
5798  loop
5799  {
5800  if (an >= en-1)
5801  {
5802  op = set[an].GetpFDeg()+set[an].ecart;
5803  if (( op > o)
5804  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5805  return an;
5806  return en;
5807  }
5808  i=(an+en) / 2;
5809  op = set[i].GetpFDeg()+set[i].ecart;
5810  if (( op > o)
5811  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5812  en=i;
5813  else
5814  an=i;
5815  }
5816 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

◆ posInT17()

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

Definition at line 5824 of file kutil.cc.

5845 {
5846  if (length==-1) return 0;
5847 
5848  int o = p.GetpFDeg() + p.ecart;
5849  int op = set[length].GetpFDeg()+set[length].ecart;
5850 
5851  if ((op < o)
5852  || (( op == o) && (set[length].ecart > p.ecart))
5853  || (( op == o) && (set[length].ecart==p.ecart)
5854  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5855  return length+1;
5856 
5857  int i;
5858  int an = 0;
5859  int en= length;
5860  loop
5861  {
5862  if (an >= en-1)
5863  {
5864  op = set[an].GetpFDeg()+set[an].ecart;
5865  if (( op > o)
5866  || (( op == o) && (set[an].ecart < p.ecart))
5867  || (( op == o) && (set[an].ecart==p.ecart)
5868  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5869  return an;
5870  return en;
5871  }
5872  i=(an+en) / 2;
5873  op = set[i].GetpFDeg()+set[i].ecart;
5874  if ((op > o)
5875  || (( op == o) && (set[i].ecart < p.ecart))
5876  || (( op == o) && (set[i].ecart == p.ecart)
5877  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5878  en=i;
5879  else
5880  an=i;
5881  }
5882 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT17_c()

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

Definition at line 5931 of file kutil.cc.

5932 {
5933  if (length==-1) return 0;
5934 
5935  int cc = (-1+2*currRing->order[0]==ringorder_c);
5936  /* cc==1 for (c,..), cc==-1 for (C,..) */
5937  int o = p.GetpFDeg() + p.ecart;
5938  int c = pGetComp(p.p)*cc;
5939 
5940  if (pGetComp(set[length].p)*cc < c)
5941  return length+1;
5942  if (pGetComp(set[length].p)*cc == c)
5943  {
5944  int op = set[length].GetpFDeg()+set[length].ecart;
5945  if ((op < o)
5946  || ((op == o) && (set[length].ecart > p.ecart))
5947  || ((op == o) && (set[length].ecart==p.ecart)
5948  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5949  return length+1;
5950  }
5951 
5952  int i;
5953  int an = 0;
5954  int en= length;
5955  loop
5956  {
5957  if (an >= en-1)
5958  {
5959  if (pGetComp(set[an].p)*cc < c)
5960  return en;
5961  if (pGetComp(set[an].p)*cc == c)
5962  {
5963  int op = set[an].GetpFDeg()+set[an].ecart;
5964  if ((op > o)
5965  || ((op == o) && (set[an].ecart < p.ecart))
5966  || ((op == o) && (set[an].ecart==p.ecart)
5967  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5968  return an;
5969  }
5970  return en;
5971  }
5972  i=(an+en) / 2;
5973  if (pGetComp(set[i].p)*cc > c)
5974  en=i;
5975  else if (pGetComp(set[i].p)*cc == c)
5976  {
5977  int op = set[i].GetpFDeg()+set[i].ecart;
5978  if ((op > o)
5979  || ((op == o) && (set[i].ecart < p.ecart))
5980  || ((op == o) && (set[i].ecart == p.ecart)
5981  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5982  en=i;
5983  else
5984  an=i;
5985  }
5986  else
5987  an=i;
5988  }
5989 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

◆ posInT17_cRing()

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

Definition at line 5992 of file kutil.cc.

5993 {
5994  if (length==-1) return 0;
5995 
5996  int cc = (-1+2*currRing->order[0]==ringorder_c);
5997  /* cc==1 for (c,..), cc==-1 for (C,..) */
5998  int o = p.GetpFDeg() + p.ecart;
5999  int c = pGetComp(p.p)*cc;
6000 
6001  if (pGetComp(set[length].p)*cc < c)
6002  return length+1;
6003  if (pGetComp(set[length].p)*cc == c)
6004  {
6005  int op = set[length].GetpFDeg()+set[length].ecart;
6006  if ((op < o)
6007  || ((op == o) && (set[length].ecart > p.ecart))
6008  || ((op == o) && (set[length].ecart==p.ecart)
6009  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
6010  return length+1;
6011  }
6012 
6013  int i;
6014  int an = 0;
6015  int en= length;
6016  loop
6017  {
6018  if (an >= en-1)
6019  {
6020  if (pGetComp(set[an].p)*cc < c)
6021  return en;
6022  if (pGetComp(set[an].p)*cc == c)
6023  {
6024  int op = set[an].GetpFDeg()+set[an].ecart;
6025  if ((op > o)
6026  || ((op == o) && (set[an].ecart < p.ecart))
6027  || ((op == o) && (set[an].ecart==p.ecart)
6028  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
6029  return an;
6030  }
6031  return en;
6032  }
6033  i=(an+en) / 2;
6034  if (pGetComp(set[i].p)*cc > c)
6035  en=i;
6036  else if (pGetComp(set[i].p)*cc == c)
6037  {
6038  int op = set[i].GetpFDeg()+set[i].ecart;
6039  if ((op > o)
6040  || ((op == o) && (set[i].ecart < p.ecart))
6041  || ((op == o) && (set[i].ecart == p.ecart)
6042  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
6043  en=i;
6044  else
6045  an=i;
6046  }
6047  else
6048  an=i;
6049  }
6050 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pGetComp(p)
Component.
Definition: polys.h:37
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

◆ posInT17Ring()

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

Definition at line 5885 of file kutil.cc.

5886 {
5887  if (length==-1) return 0;
5888 
5889  int o = p.GetpFDeg() + p.ecart;
5890  int op = set[length].GetpFDeg()+set[length].ecart;
5891 
5892  if ((op < o)
5893  || (( op == o) && (set[length].ecart > p.ecart))
5894  || (( op == o) && (set[length].ecart==p.ecart)
5895  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5896  return length+1;
5897 
5898  int i;
5899  int an = 0;
5900  int en= length;
5901  loop
5902  {
5903  if (an >= en-1)
5904  {
5905  op = set[an].GetpFDeg()+set[an].ecart;
5906  if (( op > o)
5907  || (( op == o) && (set[an].ecart < p.ecart))
5908  || (( op == o) && (set[an].ecart==p.ecart)
5909  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5910  return an;
5911  return en;
5912  }
5913  i=(an+en) / 2;
5914  op = set[i].GetpFDeg()+set[i].ecart;
5915  if ((op > o)
5916  || (( op == o) && (set[i].ecart < p.ecart))
5917  || (( op == o) && (set[i].ecart == p.ecart)
5918  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5919  en=i;
5920  else
5921  an=i;
5922  }
5923 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

◆ posInT19()

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

Definition at line 6058 of file kutil.cc.

6059 {
6060  p.GetpLength();
6061  if (length==-1) return 0;
6062 
6063  int o = p.ecart;
6064  int op=p.GetpFDeg();
6065 
6066  if (set[length].ecart < o)
6067  return length+1;
6068  if (set[length].ecart == o)
6069  {
6070  int oo=set[length].GetpFDeg();
6071  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
6072  return length+1;
6073  }
6074 
6075  int i;
6076  int an = 0;
6077  int en= length;
6078  loop
6079  {
6080  if (an >= en-1)
6081  {
6082  if (set[an].ecart > o)
6083  return an;
6084  if (set[an].ecart == o)
6085  {
6086  int oo=set[an].GetpFDeg();
6087  if((oo > op)
6088  || ((oo==op) && (set[an].length > p.length)))
6089  return an;
6090  }
6091  return en;
6092  }
6093  i=(an+en) / 2;
6094  if (set[i].ecart > o)
6095  en=i;
6096  else if (set[i].ecart == o)
6097  {
6098  int oo=set[i].GetpFDeg();
6099  if ((oo > op)
6100  || ((oo == op) && (set[i].length > p.length)))
6101  en=i;
6102  else
6103  an=i;
6104  }
6105  else
6106  an=i;
6107  }
6108 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInT2()

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

Definition at line 5389 of file kutil.cc.

5390 {
5391  p.GetpLength();
5392  if (length==-1)
5393  return 0;
5394  if (set[length].length<p.length)
5395  return length+1;
5396 
5397  int i;
5398  int an = 0;
5399  int en= length;
5400 
5401  loop
5402  {
5403  if (an >= en-1)
5404  {
5405  if (set[an].length>p.length) return an;
5406  return en;
5407  }
5408  i=(an+en) / 2;
5409  if (set[i].length>p.length) en=i;
5410  else an=i;
5411  }
5412 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

◆ posInT_EcartFDegpLength()

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

Definition at line 11701 of file kutil.cc.

11702 {
11703 
11704  if (length==-1) return 0;
11705 
11706  int o = p.ecart;
11707  int op=p.GetpFDeg();
11708  int ol = p.GetpLength();
11709 
11710  if (set[length].ecart < o)
11711  return length+1;
11712  if (set[length].ecart == o)
11713  {
11714  int oo=set[length].GetpFDeg();
11715  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11716  return length+1;
11717  }
11718 
11719  int i;
11720  int an = 0;
11721  int en= length;
11722  loop
11723  {
11724  if (an >= en-1)
11725  {
11726  if (set[an].ecart > o)
11727  return an;
11728  if (set[an].ecart == o)
11729  {
11730  int oo=set[an].GetpFDeg();
11731  if((oo > op)
11732  || ((oo==op) && (set[an].pLength > ol)))
11733  return an;
11734  }
11735  return en;
11736  }
11737  i=(an+en) / 2;
11738  if (set[i].ecart > o)
11739  en=i;
11740  else if (set[i].ecart == o)
11741  {
11742  int oo=set[i].GetpFDeg();
11743  if ((oo > op)
11744  || ((oo == op) && (set[i].pLength > ol)))
11745  en=i;
11746  else
11747  an=i;
11748  }
11749  else
11750  an=i;
11751  }
11752 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInT_EcartpLength()

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

Definition at line 5690 of file kutil.cc.

5691 {
5692  int ol = p.GetpLength();
5693  if (length==-1) return 0;
5694 
5695  int op=p.ecart;
5696 
5697  int oo=set[length].ecart;
5698  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5699  return length+1;
5700 
5701  int i;
5702  int an = 0;
5703  int en= length;
5704  loop
5705  {
5706  if (an >= en-1)
5707  {
5708  int oo=set[an].ecart;
5709  if((oo > op)
5710  || ((oo==op) && (set[an].pLength > ol)))
5711  return an;
5712  return en;
5713  }
5714  i=(an+en) / 2;
5715  int oo=set[i].ecart;
5716  if ((oo > op)
5717  || ((oo == op) && (set[i].pLength > ol)))
5718  en=i;
5719  else
5720  an=i;
5721  }
5722 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInT_FDegpLength()

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

Definition at line 11755 of file kutil.cc.

11756 {
11757 
11758  if (length==-1) return 0;
11759 
11760  int op=p.GetpFDeg();
11761  int ol = p.GetpLength();
11762 
11763  int oo=set[length].GetpFDeg();
11764  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11765  return length+1;
11766 
11767  int i;
11768  int an = 0;
11769  int en= length;
11770  loop
11771  {
11772  if (an >= en-1)
11773  {
11774  int oo=set[an].GetpFDeg();
11775  if((oo > op)
11776  || ((oo==op) && (set[an].pLength > ol)))
11777  return an;
11778  return en;
11779  }
11780  i=(an+en) / 2;
11781  int oo=set[i].GetpFDeg();
11782  if ((oo > op)
11783  || ((oo == op) && (set[i].pLength > ol)))
11784  en=i;
11785  else
11786  an=i;
11787  }
11788 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInT_pLength()

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

Definition at line 11792 of file kutil.cc.

11793 {
11794  int ol = p.GetpLength();
11795  if (length==-1)
11796  return 0;
11797  if (set[length].length<p.length)
11798  return length+1;
11799 
11800  int i;
11801  int an = 0;
11802  int en= length;
11803 
11804  loop
11805  {
11806  if (an >= en-1)
11807  {
11808  if (set[an].pLength>ol) return an;
11809  return en;
11810  }
11811  i=(an+en) / 2;
11812  if (set[i].pLength>ol) en=i;
11813  else an=i;
11814  }
11815 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static unsigned pLength(poly a)
Definition: p_polys.h:189

◆ posInTrg0()

int posInTrg0 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 5496 of file kutil.cc.

5497 {
5498  if (length==-1) return 0;
5499  int o = p.GetpFDeg();
5500  int op = set[length].GetpFDeg();
5501  int i;
5502  int an = 0;
5503  int en = length;
5504  int cmp_int = currRing->OrdSgn;
5505  if ((op < o) || (pLmCmp(set[length].p,p.p)== -cmp_int))
5506  return length+1;
5507  int cmp;
5508  loop
5509  {
5510  if (an >= en-1)
5511  {
5512  op = set[an].GetpFDeg();
5513  if (op > o) return an;
5514  if (op < 0) return en;
5515  cmp = pLmCmp(set[an].p,p.p);
5516  if (cmp == cmp_int) return an;
5517  if (cmp == -cmp_int) return en;
5518  if (nGreater(pGetCoeff(p.p), pGetCoeff(set[an].p))) return en;
5519  return an;
5520  }
5521  i = (an + en) / 2;
5522  op = set[i].GetpFDeg();
5523  if (op > o) en = i;
5524  else if (op < o) an = i;
5525  else
5526  {
5527  cmp = pLmCmp(set[i].p,p.p);
5528  if (cmp == cmp_int) en = i;
5529  else if (cmp == -cmp_int) an = i;
5530  else if (nGreater(pGetCoeff(p.p), pGetCoeff(set[i].p))) an = i;
5531  else en = i;
5532  }
5533  }
5534 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28

◆ 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 11057 of file kutil.cc.

11058 {
11059  if(!nCoeff_is_Ring_Z(currRing->cf))
11060  return;
11061  poly pH = h->GetP();
11062  poly p,pp;
11063  p = pH;
11064  bool deleted = FALSE, ok = FALSE;
11065  for(int i = 0; i<=strat->sl; i++)
11066  {
11067  p = pH;
11068  if(pNext(strat->S[i]) == NULL)
11069  {
11070  //pWrite(p);
11071  //pWrite(strat->S[i]);
11072  while(ok == FALSE && p != NULL)
11073  {
11074  if(pLmDivisibleBy(strat->S[i], p))
11075  {
11076  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11077  p_SetCoeff(p,dummy,currRing);
11078  }
11079  if(nIsZero(p->coef))
11080  {
11081  pLmDelete(&p);
11082  h->p = p;
11083  deleted = TRUE;
11084  }
11085  else
11086  {
11087  ok = TRUE;
11088  }
11089  }
11090  if (p!=NULL)
11091  {
11092  pp = pNext(p);
11093  while(pp != NULL)
11094  {
11095  if(pLmDivisibleBy(strat->S[i], pp))
11096  {
11097  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11098  p_SetCoeff(pp,dummy,currRing);
11099  if(nIsZero(pp->coef))
11100  {
11101  pLmDelete(&pNext(p));
11102  pp = pNext(p);
11103  deleted = TRUE;
11104  }
11105  else
11106  {
11107  p = pp;
11108  pp = pNext(p);
11109  }
11110  }
11111  else
11112  {
11113  p = pp;
11114  pp = pNext(p);
11115  }
11116  }
11117  }
11118  }
11119  }
11120  h->SetLmCurrRing();
11121  if((deleted)&&(h->p!=NULL))
11122  strat->initEcart(h);
11123 }
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,b,r) >=0
Definition: coeffs.h:632
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

◆ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11125 of file kutil.cc.

11126 {
11127  if(!nCoeff_is_Ring_Z(currRing->cf))
11128  return;
11129  poly hSig = h->sig;
11130  poly pH = h->GetP();
11131  poly p,pp;
11132  p = pH;
11133  bool deleted = FALSE, ok = FALSE;
11134  for(int i = 0; i<=strat->sl; i++)
11135  {
11136  p = pH;
11137  if(pNext(strat->S[i]) == NULL)
11138  {
11139  while(ok == FALSE && p!=NULL)
11140  {
11141  if(pLmDivisibleBy(strat->S[i], p))
11142  {
11143  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11144  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11145  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11146  {
11147  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11148  p_SetCoeff(p,dummy,currRing);
11149  }
11150  pDelete(&sigMult);
11151  }
11152  if(nIsZero(p->coef))
11153  {
11154  pLmDelete(&p);
11155  h->p = p;
11156  deleted = TRUE;
11157  }
11158  else
11159  {
11160  ok = TRUE;
11161  }
11162  }
11163  if(p == NULL)
11164  return;
11165  pp = pNext(p);
11166  while(pp != NULL)
11167  {
11168  if(pLmDivisibleBy(strat->S[i], pp))
11169  {
11170  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11171  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11172  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11173  {
11174  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11175  p_SetCoeff(pp,dummy,currRing);
11176  if(nIsZero(pp->coef))
11177  {
11178  pLmDelete(&pNext(p));
11179  pp = pNext(p);
11180  deleted = TRUE;
11181  }
11182  else
11183  {
11184  p = pp;
11185  pp = pNext(p);
11186  }
11187  }
11188  else
11189  {
11190  p = pp;
11191  pp = pNext(p);
11192  }
11193  pDelete(&sigMult);
11194  }
11195  else
11196  {
11197  p = pp;
11198  pp = pNext(p);
11199  }
11200  }
11201  }
11202  }
11203  h->SetLmCurrRing();
11204  if(deleted)
11205  strat->initEcart(h);
11206 
11207 }
polyset sig
Definition: kutil.h:302
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,b,r) >=0
Definition: coeffs.h:632
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define ppMult_mm(p, m)
Definition: polys.h:184
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pDivideM(a, b)
Definition: polys.h:276
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:300
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

◆ preIntegerCheck()

poly preIntegerCheck ( const ideal  Forig,
const ideal  Q 
)

used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell

Definition at line 10889 of file kutil.cc.

10890 {
10892  if(!nCoeff_is_Ring_Z(currRing->cf))
10893  return NULL;
10894  ideal F = idCopy(Forig);
10895  idSkipZeroes(F);
10896  poly pmon;
10897  ring origR = currRing;
10898  ideal monred = idInit(1,1);
10899  for(int i=0; i<idElem(F); i++)
10900  {
10901  if(pNext(F->m[i]) == NULL)
10902  idInsertPoly(monred, pCopy(F->m[i]));
10903  }
10904  int posconst = idPosConstant(F);
10905  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10906  {
10907  idDelete(&F);
10908  idDelete(&monred);
10909  return NULL;
10910  }
10911  int idelemQ = 0;
10912  if(Q!=NULL)
10913  {
10914  idelemQ = IDELEMS(Q);
10915  for(int i=0; i<idelemQ; i++)
10916  {
10917  if(pNext(Q->m[i]) == NULL)
10918  idInsertPoly(monred, pCopy(Q->m[i]));
10919  }
10920  idSkipZeroes(monred);
10921  posconst = idPosConstant(monred);
10922  //the constant, if found, will be from Q
10923  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10924  {
10925  pmon = pCopy(monred->m[posconst]);
10926  idDelete(&F);
10927  idDelete(&monred);
10928  return pmon;
10929  }
10930  }
10931  ring QQ_ring = rCopy0(currRing,FALSE);
10932  nKillChar(QQ_ring->cf);
10933  QQ_ring->cf = nInitChar(n_Q, NULL);
10934  rComplete(QQ_ring,1);
10935  QQ_ring = rAssure_c_dp(QQ_ring);
10936  rChangeCurrRing(QQ_ring);
10937  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10938  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10939  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10940  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10941  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10942  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10943  ideal one = kStd(II, NULL, isNotHomog, NULL);
10944  idSkipZeroes(one);
10945  if(idIsConstant(one))
10946  {
10947  //one should be <1>
10948  for(int i = IDELEMS(II)-1; i>=0; i--)
10949  if(II->m[i] != NULL)
10950  II->m[i+1] = II->m[i];
10951  II->m[0] = pOne();
10952  ideal syz = idSyzygies(II, isNotHomog, NULL);
10953  poly integer = NULL;
10954  for(int i = IDELEMS(syz)-1;i>=0; i--)
10955  {
10956  if(pGetComp(syz->m[i]) == 1)
10957  {
10958  pSetComp(syz->m[i],0);
10959  if(pIsConstant(pHead(syz->m[i])))
10960  {
10961  integer = pHead(syz->m[i]);
10962  break;
10963  }
10964  }
10965  }
10966  rChangeCurrRing(origR);
10967  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10968  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10969  idDelete(&monred);
10970  idDelete(&F);
10971  id_Delete(&II,QQ_ring);
10972  id_Delete(&one,QQ_ring);
10973  id_Delete(&syz,QQ_ring);
10974  p_Delete(&integer,QQ_ring);
10975  rDelete(QQ_ring);
10976  return pmon;
10977  }
10978  else
10979  {
10980  if(idIs0(monred))
10981  {
10982  poly mindegmon = NULL;
10983  for(int i = 0; i<IDELEMS(one); i++)
10984  {
10985  if(pNext(one->m[i]) == NULL)
10986  {
10987  if(mindegmon == NULL)
10988  mindegmon = pCopy(one->m[i]);
10989  else
10990  {
10991  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10992  mindegmon = pCopy(one->m[i]);
10993  }
10994  }
10995  }
10996  if(mindegmon != NULL)
10997  {
10998  for(int i = IDELEMS(II)-1; i>=0; i--)
10999  if(II->m[i] != NULL)
11000  II->m[i+1] = II->m[i];
11001  II->m[0] = pCopy(mindegmon);
11002  ideal syz = idSyzygies(II, isNotHomog, NULL);
11003  bool found = FALSE;
11004  for(int i = IDELEMS(syz)-1;i>=0; i--)
11005  {
11006  if(pGetComp(syz->m[i]) == 1)
11007  {
11008  pSetComp(syz->m[i],0);
11009  if(pIsConstant(pHead(syz->m[i])))
11010  {
11011  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
11012  found = TRUE;
11013  break;
11014  }
11015  }
11016  }
11017  id_Delete(&syz,QQ_ring);
11018  if (found == FALSE)
11019  {
11020  rChangeCurrRing(origR);
11021  idDelete(&monred);
11022  idDelete(&F);
11023  id_Delete(&II,QQ_ring);
11024  id_Delete(&one,QQ_ring);
11025  rDelete(QQ_ring);
11026  return NULL;
11027  }
11028  rChangeCurrRing(origR);
11029  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11030  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11031  idDelete(&monred);
11032  idDelete(&F);
11033  id_Delete(&II,QQ_ring);
11034  id_Delete(&one,QQ_ring);
11035  id_Delete(&syz,QQ_ring);
11036  rDelete(QQ_ring);
11037  return pmon;
11038  }
11039  }
11040  }
11041  rChangeCurrRing(origR);
11042  idDelete(&monred);
11043  idDelete(&F);
11044  id_Delete(&II,QQ_ring);
11045  id_Delete(&one,QQ_ring);
11046  rDelete(QQ_ring);
11047  return NULL;
11048 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:98
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc:4863
#define pGetComp(p)
Component.
Definition: polys.h:37
bool found
Definition: facFactorize.cc:56
poly prMapR(poly src, nMapFunc nMap, ring src_r, ring dest_r)
Definition: prCopy.cc:47
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
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:3356
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1323
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
#define pSetComp(p, v)
Definition: polys.h:38
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:297
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
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:725
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rChangeCurrRing(ring r)
Definition: polys.cc:12
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:450
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
int idElem(const ideal F)
count non-zero elements
polyrec * poly
Definition: hilb.h:10
ideal idSyzygies(ideal h1, tHomog h, intvec **w, BOOLEAN setSyzComp, BOOLEAN setRegularity, int *deg)
Definition: ideals.cc:515
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:504
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:341
#define idIsConstant(I)
Definition: ideals.h:40

◆ redBba()

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

Definition at line 8957 of file kutil.cc.

8958 {
8959  int j = 0;
8960  unsigned long not_sev = ~ pGetShortExpVector(h);
8961 
8962  while (j <= maxIndex)
8963  {
8964  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
8965  {
8966  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8967  if (h==NULL) return NULL;
8968  j = 0;
8969  not_sev = ~ pGetShortExpVector(h);
8970  }
8971  else j++;
8972  }
8973  return h;
8974 }
int j
Definition: myNF.cc:70
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
polyset S
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:316
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1053
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ redBba1()

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

Definition at line 8852 of file kutil.cc.

8853 {
8854  int j = 0;
8855  unsigned long not_sev = ~ pGetShortExpVector(h);
8856 
8857  while (j <= maxIndex)
8858  {
8859  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
8860  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
8861  else j++;
8862  }
8863  return h;
8864 }
int j
Definition: myNF.cc:70
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
polyset S
Definition: kutil.h:300
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1063
unsigned long * sevS
Definition: kutil.h:316
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63

◆ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 172 of file kstd1.cc.

173 {
174  int i,at,ei,li,ii;
175  int j = 0;
176  int pass = 0;
177  long d,reddeg;
178 
179  d = h->GetpFDeg()+ h->ecart;
180  reddeg = strat->LazyDegree+d;
181  h->SetShortExpVector();
182  loop
183  {
184  j = kFindDivisibleByInT(strat, h);
185  if (j < 0)
186  {
187  if (strat->honey) h->SetLength(strat->length_pLength);
188  return 1;
189  }
190 
191  ei = strat->T[j].ecart;
192  ii = j;
193 
194  if (ei > h->ecart && ii < strat->tl)
195  {
196  li = strat->T[j].length;
197  // the polynomial to reduce with (up to the moment) is;
198  // pi with ecart ei and length li
199  // look for one with smaller ecart
200  i = j;
201  loop
202  {
203  /*- takes the first possible with respect to ecart -*/
204  i++;
205 #if 1
206  if (i > strat->tl) break;
207  if ((strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
208  strat->T[i].length < li))
209  &&
210  p_LmShortDivisibleBy(strat->T[i].GetLmTailRing(), strat->sevT[i], h->GetLmTailRing(), ~h->sev, strat->tailRing))
211 #else
212  j = kFindDivisibleByInT(strat, h, i);
213  if (j < 0) break;
214  i = j;
215  if (strat->T[i].ecart < ei || (strat->T[i].ecart == ei &&
216  strat->T[i].length < li))
217 #endif
218  {
219  // the polynomial to reduce with is now
220  ii = i;
221  ei = strat->T[i].ecart;
222  if (ei <= h->ecart) break;
223  li = strat->T[i].length;
224  }
225  }
226  }
227 
228  // end of search: have to reduce with pi
229  if (ei > h->ecart)
230  {
231  // It is not possible to reduce h with smaller ecart;
232  // if possible h goes to the lazy-set L,i.e
233  // if its position in L would be not the last one
234  strat->fromT = TRUE;
235  if (!TEST_OPT_REDTHROUGH && strat->Ll >= 0) /*- L is not empty -*/
236  {
237  h->SetLmCurrRing();
238  if (strat->honey && strat->posInLDependsOnLength)
239  h->SetLength(strat->length_pLength);
240  assume(h->FDeg == h->pFDeg());
241  at = strat->posInL(strat->L,strat->Ll,h,strat);
242  if (at <= strat->Ll)
243  {
244  /*- h will not become the next element to reduce -*/
245  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
246 #ifdef KDEBUG
247  if (TEST_OPT_DEBUG) Print(" ecart too big; -> L%d\n",at);
248 #endif
249  h->Clear();
250  strat->fromT = FALSE;
251  return -1;
252  }
253  }
254  }
255 
256  // now we finally can reduce
257  doRed(h,&(strat->T[ii]),strat->fromT,strat,FALSE);
258  strat->fromT=FALSE;
259 
260  // are we done ???
261  if (h->IsNull())
262  {
264  if (h->lcm!=NULL) pLmFree(h->lcm);
265  h->Clear();
266  return 0;
267  }
268 
269  // NO!
270  h->SetShortExpVector();
271  h->SetpFDeg();
272  if (strat->honey)
273  {
274  if (ei <= h->ecart)
275  h->ecart = d-h->GetpFDeg();
276  else
277  h->ecart = d-h->GetpFDeg()+ei-h->ecart;
278  }
279  else
280  // this has the side effect of setting h->length
281  h->ecart = h->pLDeg(strat->LDegLast) - h->GetpFDeg();
282 #if 0
283  if (strat->syzComp!=0)
284  {
285  if ((strat->syzComp>0) && (h->Comp() > strat->syzComp))
286  {
287  assume(h->MinComp() > strat->syzComp);
288  if (strat->honey) h->SetLength();
289 #ifdef KDEBUG
290  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
291 #endif
292  return -2;
293  }
294  }
295 #endif
296  /*- try to reduce the s-polynomial -*/
297  pass++;
298  d = h->GetpFDeg()+h->ecart;
299  /*
300  *test whether the polynomial should go to the lazyset L
301  *-if the degree jumps
302  *-if the number of pre-defined reductions jumps
303  */
304  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
305  && ((d >= reddeg) || (pass > strat->LazyPass)))
306  {
307  h->SetLmCurrRing();
308  if (strat->honey && strat->posInLDependsOnLength)
309  h->SetLength(strat->length_pLength);
310  assume(h->FDeg == h->pFDeg());
311  at = strat->posInL(strat->L,strat->Ll,h,strat);
312  if (at <= strat->Ll)
313  {
314  int dummy=strat->sl;
315  if (kFindDivisibleByInS(strat, &dummy, h) < 0)
316  {
317  if (strat->honey && !strat->posInLDependsOnLength)
318  h->SetLength(strat->length_pLength);
319  return 1;
320  }
321  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
322 #ifdef KDEBUG
323  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
324 #endif
325  h->Clear();
326  return -1;
327  }
328  }
329  else if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
330  {
331  Print(".%ld",d);mflush();
332  reddeg = d+1;
333  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
334  {
335  strat->overflow=TRUE;
336  //Print("OVERFLOW in redEcart d=%ld, max=%ld",d,strat->tailRing->bitmask);
337  h->GetP();
338  at = strat->posInL(strat->L,strat->Ll,h,strat);
339  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
340  h->Clear();
341  return -1;
342  }
343  }
344  }
345 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
BOOLEAN length_pLength
Definition: kutil.h:384
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:319
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
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:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:321
BOOLEAN LDegLast
Definition: kutil.h:382
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
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:88
int LazyPass
Definition: kutil.h:349
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:349

◆ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 601 of file kstd1.cc.

602 {
603  if (h->IsNull()) return 0;
604 
605  int at;
606  long reddeg,d;
607  int pass = 0;
608  int j = 0;
609 
610  if (! strat->homog)
611  {
612  d = h->GetpFDeg() + h->ecart;
613  reddeg = strat->LazyDegree+d;
614  }
615  h->SetShortExpVector();
616  loop
617  {
618  j = kFindDivisibleByInT(strat, h);
619  if (j < 0)
620  {
621  h->SetDegStuffReturnLDeg(strat->LDegLast);
622  return 1;
623  }
624 
626  strat->T[j].pNorm();
627 #ifdef KDEBUG
628  if (TEST_OPT_DEBUG)
629  {
630  PrintS("reduce ");
631  h->wrp();
632  PrintS(" with ");
633  strat->T[j].wrp();
634  }
635 #endif
636  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
637 #ifdef KDEBUG
638  if (TEST_OPT_DEBUG)
639  {
640  PrintS(" to ");
641  wrp(h->p);
642  PrintLn();
643  }
644 #endif
645  if (h->IsNull())
646  {
648  if (h->lcm!=NULL) pLmFree(h->lcm);
649  h->Clear();
650  return 0;
651  }
652  h->SetShortExpVector();
653 
654 #if 0
655  if ((strat->syzComp!=0) && !strat->honey)
656  {
657  if ((strat->syzComp>0) &&
658  (h->Comp() > strat->syzComp))
659  {
660  assume(h->MinComp() > strat->syzComp);
661 #ifdef KDEBUG
662  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
663 #endif
664  if (strat->homog)
665  h->SetDegStuffReturnLDeg(strat->LDegLast);
666  return -2;
667  }
668  }
669 #endif
670  if (!strat->homog)
671  {
672  if (!TEST_OPT_OLDSTD && strat->honey)
673  {
674  h->SetpFDeg();
675  if (strat->T[j].ecart <= h->ecart)
676  h->ecart = d - h->GetpFDeg();
677  else
678  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
679 
680  d = h->GetpFDeg() + h->ecart;
681  }
682  else
683  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
684  /*- try to reduce the s-polynomial -*/
685  pass++;
686  /*
687  *test whether the polynomial should go to the lazyset L
688  *-if the degree jumps
689  *-if the number of pre-defined reductions jumps
690  */
691  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
692  && ((d >= reddeg) || (pass > strat->LazyPass)))
693  {
694  h->SetLmCurrRing();
695  if (strat->posInLDependsOnLength)
696  h->SetLength(strat->length_pLength);
697  at = strat->posInL(strat->L,strat->Ll,h,strat);
698  if (at <= strat->Ll)
699  {
700  int dummy=strat->sl;
701  if (kFindDivisibleByInS(strat,&dummy, h) < 0)
702  return 1;
703  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
704 #ifdef KDEBUG
705  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
706 #endif
707  h->Clear();
708  return -1;
709  }
710  }
711  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
712  {
713  reddeg = d+1;
714  Print(".%ld",d);mflush();
715  if (h->pTotalDeg()+h->ecart >= (int)strat->tailRing->bitmask)
716  {
717  strat->overflow=TRUE;
718  //Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
719  h->GetP();
720  at = strat->posInL(strat->L,strat->Ll,h,strat);
721  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
722  h->Clear();
723  return -1;
724  }
725  }
726  }
727  }
728 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
BOOLEAN length_pLength
Definition: kutil.h:384
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:347
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
#define TRUE
Definition: auxiliary.h:98
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:45
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1227
#define mflush()
Definition: reporter.h:57
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:394
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:197
void PrintS(const char *s)
Definition: reporter.cc:284
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:321
BOOLEAN LDegLast
Definition: kutil.h:382
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
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:88
void wrp(poly p)
Definition: polys.h:292
int LazyPass
Definition: kutil.h:349
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int LazyDegree
Definition: kutil.h:349

◆ redMora()

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

Definition at line 8981 of file kutil.cc.

8982 {
8983  int j=0;
8984  int e,l;
8985  unsigned long not_sev = ~ pGetShortExpVector(h);
8986 
8987  if (maxIndex >= 0)
8988  {
8989  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
8990  do
8991  {
8992  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
8993  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
8994  {
8995 #ifdef KDEBUG
8996  if (TEST_OPT_DEBUG)
8997  {
8998  PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);
8999  }
9000 #endif
9001  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
9002 #ifdef KDEBUG
9003  if(TEST_OPT_DEBUG)
9004  {
9005  PrintS(")\nto "); wrp(h); PrintLn();
9006  }
9007 #endif
9008  // pDelete(&h);
9009  if (h == NULL) return NULL;
9010  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
9011  j = 0;
9012  not_sev = ~ pGetShortExpVector(h);
9013  }
9014  else j++;
9015  }
9016  while (j <= maxIndex);
9017  }
9018  return h;
9019 }
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define TEST_OPT_DEBUG
Definition: options.h:103
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
BOOLEAN kHEdgeFound
Definition: kutil.h:373
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:316
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1053
void wrp(poly p)
Definition: polys.h:292
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94

◆ redtail() [1/2]

poly redtail ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 7522 of file kutil.cc.

7523 {
7524  poly h, hn;
7525  strat->redTailChange=FALSE;
7526 
7527  L->GetP();
7528  poly p = L->p;
7529  if (strat->noTailReduction || pNext(p) == NULL)
7530  return p;
7531 
7532  LObject Ln(strat->tailRing);
7533  TObject* With;
7534  // placeholder in case strat->tl < 0
7535  TObject With_s(strat->tailRing);
7536  h = p;
7537  hn = pNext(h);
7538  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7539  long e;
7540  int l;
7541  BOOLEAN save_HE=strat->kHEdgeFound;
7542  strat->kHEdgeFound |=
7543  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7544 
7545  while(hn != NULL)
7546  {
7547  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7548  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7549  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7550  loop
7551  {
7552  Ln.Set(hn, strat->tailRing);
7553  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7554  if (strat->kHEdgeFound)
7555  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7556  else
7557  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
7558  if (With == NULL) break;
7559  With->length=0;
7560  With->pLength=0;
7561  strat->redTailChange=TRUE;
7562  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7563  {
7564  // reducing the tail would violate the exp bound
7565  if (kStratChangeTailRing(strat, L))
7566  {
7567  strat->kHEdgeFound = save_HE;
7568  return redtail(L, pos, strat);
7569  }
7570  else
7571  return NULL;
7572  }
7573  hn = pNext(h);
7574  if (hn == NULL) goto all_done;
7575  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7576  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7577  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7578  }
7579  h = hn;
7580  hn = pNext(h);
7581  }
7582 
7583  all_done:
7584  if (strat->redTailChange)
7585  {
7586  L->pLength = 0;
7587  }
7588  strat->kHEdgeFound = save_HE;
7589  return p;
7590 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define TRUE
Definition: auxiliary.h:98
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11280
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
int Kstd1_deg
Definition: kutil.cc:236
BOOLEAN kHEdgeFound
Definition: kutil.h:373
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4627
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:396
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:59

◆ redtail() [2/2]

poly redtail ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 7592 of file kutil.cc.

7593 {
7594  LObject L(p, currRing);
7595  return redtail(&L, pos, strat);
7596 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10

◆ redtailBba()

poly redtailBba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 7598 of file kutil.cc.

7599 {
7600 #define REDTAIL_CANONICALIZE 100
7601  strat->redTailChange=FALSE;
7602  if (strat->noTailReduction) return L->GetLmCurrRing();
7603  poly h, p;
7604  p = h = L->GetLmTailRing();
7605  if ((h==NULL) || (pNext(h)==NULL))
7606  return L->GetLmCurrRing();
7607 
7608  TObject* With;
7609  // placeholder in case strat->tl < 0
7610  TObject With_s(strat->tailRing);
7611 
7612  LObject Ln(pNext(h), strat->tailRing);
7613  Ln.pLength = L->GetpLength() - 1;
7614 
7615  pNext(h) = NULL;
7616  if (L->p != NULL) pNext(L->p) = NULL;
7617  L->pLength = 1;
7618 
7619  Ln.PrepareRed(strat->use_buckets);
7620 
7621  int cnt=REDTAIL_CANONICALIZE;
7622  while(!Ln.IsNull())
7623  {
7624  loop
7625  {
7626  if (TEST_OPT_IDLIFT)
7627  {
7628  if (Ln.p!=NULL)
7629  {
7630  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7631  }
7632  else
7633  {
7634  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7635  }
7636  }
7637  Ln.SetShortExpVector();
7638  if (withT)
7639  {
7640  int j;
7641  j = kFindDivisibleByInT(strat, &Ln);
7642  if (j < 0) break;
7643  With = &(strat->T[j]);
7644  }
7645  else
7646  {
7647  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7648  if (With == NULL) break;
7649  }
7650  cnt--;
7651  if (cnt==0)
7652  {
7654  /*poly tmp=*/Ln.CanonicalizeP();
7655  if (normalize)
7656  {
7657  Ln.Normalize();
7658  //pNormalize(tmp);
7659  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7660  }
7661  }
7662  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7663  {
7664  With->pNorm();
7665  }
7666  strat->redTailChange=TRUE;
7667  if (ksReducePolyTail(L, With, &Ln))
7668  {
7669  // reducing the tail would violate the exp bound
7670  // set a flag and hope for a retry (in bba)
7671  strat->completeReduce_retry=TRUE;
7672  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7673  do
7674  {
7675  pNext(h) = Ln.LmExtractAndIter();
7676  pIter(h);
7677  L->pLength++;
7678  } while (!Ln.IsNull());
7679  goto all_done;
7680  }
7681  if (Ln.IsNull()) goto all_done;
7682  if (! withT) With_s.Init(currRing);
7683  }
7684  pNext(h) = Ln.LmExtractAndIter();
7685  pIter(h);
7686  pNormalize(h);
7687  L->pLength++;
7688  }
7689 
7690  all_done:
7691  Ln.Delete();
7692  if (L->p != NULL) pNext(L->p) = pNext(p);
7693 
7694  if (strat->redTailChange)
7695  {
7696  L->length = 0;
7697  L->pLength = 0;
7698  }
7699 
7700  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7701  //L->Normalize(); // HANNES: should have a test
7702  kTest_L(L);
7703  return L->GetLmCurrRing();
7704 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:400
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:652
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:339
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:88
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:396
class sTObject TObject
Definition: kutil.h:59

◆ redtailBba_Z()

poly redtailBba_Z ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 7823 of file kutil.cc.

7825 {
7826  strat->redTailChange=FALSE;
7827  if (strat->noTailReduction) return L->GetLmCurrRing();
7828  poly h, p;
7829  p = h = L->GetLmTailRing();
7830  if ((h==NULL) || (pNext(h)==NULL))
7831  return L->GetLmCurrRing();
7832 
7833  TObject* With;
7834  // placeholder in case strat->tl < 0
7835  TObject With_s(strat->tailRing);
7836 
7837  LObject Ln(pNext(h), strat->tailRing);
7838  Ln.pLength = L->GetpLength() - 1;
7839 
7840  pNext(h) = NULL;
7841  if (L->p != NULL) pNext(L->p) = NULL;
7842  L->pLength = 1;
7843 
7844  Ln.PrepareRed(strat->use_buckets);
7845 
7846  int cnt=REDTAIL_CANONICALIZE;
7847  while(!Ln.IsNull())
7848  {
7849  loop
7850  {
7851  Ln.SetShortExpVector();
7852  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7853  if (With == NULL) break;
7854  cnt--;
7855  if (cnt==0)
7856  {
7858  /*poly tmp=*/Ln.CanonicalizeP();
7859  }
7860  // we are in Z, do not call pNorm
7861  strat->redTailChange=TRUE;
7862  // test divisibility of coefs:
7863  poly p_Ln=Ln.GetLmCurrRing();
7864  poly p_With=With->GetLmCurrRing();
7865  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7866  if (!nIsZero(z))
7867  {
7868  // subtract z*Ln, add z.Ln to L
7869  poly m=pHead(p_Ln);
7870  pSetCoeff(m,z);
7871  poly mm=pHead(m);
7872  pNext(h) = m;
7873  pIter(h);
7874  L->pLength++;
7875  mm=pNeg(mm);
7876  if (Ln.bucket!=NULL)
7877  {
7878  int dummy=1;
7879  kBucket_Add_q(Ln.bucket,mm,&dummy);
7880  }
7881  else
7882  {
7883  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7884  Ln.GetP();
7885  if (Ln.p!=NULL)
7886  {
7887  Ln.p=pAdd(Ln.p,mm);
7888  if (Ln.t_p!=NULL)
7889  {
7890  pNext(Ln.t_p)=NULL;
7891  p_LmDelete(Ln.t_p,strat->tailRing);
7892  }
7893  }
7894  }
7895  }
7896  else
7897  nDelete(&z);
7898 
7899  if (ksReducePolyTail(L, With, &Ln))
7900  {
7901  // reducing the tail would violate the exp bound
7902  // set a flag and hope for a retry (in bba)
7903  strat->completeReduce_retry=TRUE;
7904  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7905  do
7906  {
7907  pNext(h) = Ln.LmExtractAndIter();
7908  pIter(h);
7909  L->pLength++;
7910  } while (!Ln.IsNull());
7911  goto all_done;
7912  }
7913  if (Ln.IsNull()) goto all_done;
7914  With_s.Init(currRing);
7915  }
7916  pNext(h) = Ln.LmExtractAndIter();
7917  pIter(h);
7918  pNormalize(h);
7919  L->pLength++;
7920  }
7921 
7922  all_done:
7923  Ln.Delete();
7924  if (L->p != NULL) pNext(L->p) = pNext(p);
7925 
7926  if (strat->redTailChange)
7927  {
7928  L->length = 0;
7929  }
7930 
7931  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7932  //L->Normalize(); // HANNES: should have a test
7933  kTest_L(L);
7934  return L->GetLmCurrRing();
7935 }
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,b,r) >=0
Definition: coeffs.h:632
#define pAdd(p, q)
Definition: polys.h:186
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define pNeg(p)
Definition: polys.h:181
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:400
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:652
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
BOOLEAN use_buckets
Definition: kutil.h:380
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
char redTailChange
Definition: kutil.h:396
class sTObject TObject
Definition: kutil.h:59
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:628

◆ redtailBbaBound()

poly redtailBbaBound ( LObject L,
int  pos,
kStrategy  strat,
int  bound,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 7706 of file kutil.cc.

7707 {
7708 #define REDTAIL_CANONICALIZE 100
7709  strat->redTailChange=FALSE;
7710  if (strat->noTailReduction) return L->GetLmCurrRing();
7711  poly h, p;
7712  p = h = L->GetLmTailRing();
7713  if ((h==NULL) || (pNext(h)==NULL))
7714  return L->GetLmCurrRing();
7715 
7716  TObject* With;
7717  // placeholder in case strat->tl < 0
7718  TObject With_s(strat->tailRing);
7719 
7720  LObject Ln(pNext(h), strat->tailRing);
7721  Ln.pLength = L->GetpLength() - 1;
7722 
7723  pNext(h) = NULL;
7724  if (L->p != NULL) pNext(L->p) = NULL;
7725  L->pLength = 1;
7726 
7727  Ln.PrepareRed(strat->use_buckets);
7728 
7729  int cnt=REDTAIL_CANONICALIZE;
7730  while(!Ln.IsNull())
7731  {
7732  loop
7733  {
7734  if (TEST_OPT_IDLIFT)
7735  {
7736  if (Ln.p!=NULL)
7737  {
7738  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7739  }
7740  else
7741  {
7742  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7743  }
7744  }
7745  Ln.SetShortExpVector();
7746  if (withT)
7747  {
7748  int j;
7749  j = kFindDivisibleByInT(strat, &Ln);
7750  if (j < 0) break;
7751  With = &(strat->T[j]);
7752  }
7753  else
7754  {
7755  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7756  if (With == NULL) break;
7757  }
7758  cnt--;
7759  if (cnt==0)
7760  {
7762  /*poly tmp=*/Ln.CanonicalizeP();
7763  if (normalize)
7764  {
7765  Ln.Normalize();
7766  //pNormalize(tmp);
7767  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7768  }
7769  }
7770  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7771  {
7772  With->pNorm();
7773  }
7774  strat->redTailChange=TRUE;
7775  if (ksReducePolyTail(L, With, &Ln))
7776  {
7777  // reducing the tail would violate the exp bound
7778  // set a flag and hope for a retry (in bba)
7779  strat->completeReduce_retry=TRUE;
7780  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7781  do
7782  {
7783  pNext(h) = Ln.LmExtractAndIter();
7784  pIter(h);
7785  L->pLength++;
7786  } while (!Ln.IsNull());
7787  goto all_done;
7788  }
7789  if(!Ln.IsNull())
7790  {
7791  Ln.GetP();
7792  Ln.p = pJet(Ln.p,bound);
7793  }
7794  if (Ln.IsNull())
7795  {
7796  goto all_done;
7797  }
7798  if (! withT) With_s.Init(currRing);
7799  }
7800  pNext(h) = Ln.LmExtractAndIter();
7801  pIter(h);
7802  pNormalize(h);
7803  L->pLength++;
7804  }
7805 
7806  all_done:
7807  Ln.Delete();
7808  if (L->p != NULL) pNext(L->p) = pNext(p);
7809 
7810  if (strat->redTailChange)
7811  {
7812  L->length = 0;
7813  L->pLength = 0;
7814  }
7815 
7816  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7817  //L->Normalize(); // HANNES: should have a test
7818  kTest_L(L);
7819  return L->GetLmCurrRing();
7820 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:400
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:652
#define pJet(p, m)
Definition: polys.h:350
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
ring tailRing
Definition: kutil.h:339
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:88
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:396
class sTObject TObject
Definition: kutil.h:59

◆ redtailBbaShift()

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

Definition at line 12774 of file kutil.cc.

12775 {
12776  /* for the shift case need to run it with withT = TRUE */
12777  strat->redTailChange=FALSE;
12778  if (strat->noTailReduction) return L->GetLmCurrRing();
12779  poly h, p;
12780  p = h = L->GetLmTailRing();
12781  if ((h==NULL) || (pNext(h)==NULL))
12782  return L->GetLmCurrRing();
12783 
12784  TObject* With;
12785  // placeholder in case strat->tl < 0
12786  TObject With_s(strat->tailRing);
12787 
12788  LObject Ln(pNext(h), strat->tailRing);
12789  Ln.pLength = L->GetpLength() - 1;
12790 
12791  pNext(h) = NULL;
12792  if (L->p != NULL) pNext(L->p) = NULL;
12793  L->pLength = 1;
12794 
12795  Ln.PrepareRed(strat->use_buckets);
12796 
12797  while(!Ln.IsNull())
12798  {
12799  loop
12800  {
12801  Ln.SetShortExpVector();
12802  if (withT)
12803  {
12804  int j;
12805  j = kFindDivisibleByInT(strat, &Ln);
12806  if (j < 0) break;
12807  With = &(strat->T[j]);
12808  }
12809  else
12810  {
12811  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12812  if (With == NULL) break;
12813  }
12814  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12815  {
12816  With->pNorm();
12817  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12818  }
12819  strat->redTailChange=TRUE;
12820  if (ksReducePolyTail(L, With, &Ln))
12821  {
12822  // reducing the tail would violate the exp bound
12823  // set a flag and hope for a retry (in bba)
12824  strat->completeReduce_retry=TRUE;
12825  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12826  do
12827  {
12828  pNext(h) = Ln.LmExtractAndIter();
12829  pIter(h);
12830  L->pLength++;
12831  } while (!Ln.IsNull());
12832  goto all_done;
12833  }
12834  if (Ln.IsNull()) goto all_done;
12835  if (! withT) With_s.Init(currRing);
12836  }
12837  pNext(h) = Ln.LmExtractAndIter();
12838  pIter(h);
12839  L->pLength++;
12840  }
12841 
12842  all_done:
12843  Ln.Delete();
12844  if (L->p != NULL) pNext(L->p) = pNext(p);
12845 
12846  if (strat->redTailChange)
12847  {
12848  L->length = 0;
12849  }
12850  L->Normalize(); // HANNES: should have a test
12851  kTest_L(L);
12852  return L->GetLmCurrRing();
12853 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:400
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define kTest_L(T)
Definition: kutil.h:652
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7384
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:320
BOOLEAN use_buckets
Definition: kutil.h:380
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:88
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:396
class sTObject TObject
Definition: kutil.h:59

◆ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 5075 of file kutil.cc.

5076 {
5077  int i,j,at,ecart, s2r;
5078  int fq=0;
5079  unsigned long sev;
5080  poly p;
5081  int new_suc=strat->sl+1;
5082  i= *suc;
5083  if (i<0) i=0;
5084 
5085  for (; i<=strat->sl; i++)
5086  {
5087  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5088  if (at != i)
5089  {
5090  if (new_suc > at) new_suc = at;
5091  p = strat->S[i];
5092  ecart = strat->ecartS[i];
5093  sev = strat->sevS[i];
5094  s2r = strat->S_2_R[i];
5095  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5096  for (j=i; j>=at+1; j--)
5097  {
5098  strat->S[j] = strat->S[j-1];
5099  strat->ecartS[j] = strat->ecartS[j-1];
5100  strat->sevS[j] = strat->sevS[j-1];
5101  strat->S_2_R[j] = strat->S_2_R[j-1];
5102  }
5103  strat->S[at] = p;
5104  strat->ecartS[at] = ecart;
5105  strat->sevS[at] = sev;
5106  strat->S_2_R[at] = s2r;
5107  if (strat->fromQ!=NULL)
5108  {
5109  for (j=i; j>=at+1; j--)
5110  {
5111  strat->fromQ[j] = strat->fromQ[j-1];
5112  }
5113  strat->fromQ[at]=fq;
5114  }
5115  }
5116  }
5117  if (new_suc <= strat->sl) *suc=new_suc;
5118  else *suc=-1;
5119 }
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5128
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10

◆ sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair ( LObject h,
kStrategy  strat 
)

Definition at line 1665 of file kutil.cc.

1666 {
1667  if(strat->sl < 0) return FALSE;
1668  int i;
1669  for(i=0;i<strat->sl;i++)
1670  {
1671  //Construct the gcd pair between h and S[i]
1672  number d, s, t;
1673  poly m1, m2, gcd;
1674  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1675  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1676  {
1677  nDelete(&d);
1678  nDelete(&s);
1679  nDelete(&t);
1680  }
1681  else
1682  {
1683  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1684  pSetCoeff0(m1, s);
1685  pSetCoeff0(m2, t);
1686  pSetCoeff0(gcd, d);
1687  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);
1688  poly pSigMult = p_Copy(h->sig,currRing);
1689  poly sSigMult = p_Copy(strat->sig[i],currRing);
1690  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1691  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1692  p_LmDelete(m1, strat->tailRing);
1693  p_LmDelete(m2, strat->tailRing);
1694  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1695  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1696  {
1697  #ifdef ADIDEBUG
1698  printf("\nCan replace * (sig = *) with * (sig = *) since of * with sig *\n");
1699  pWrite(h->p);pWrite(h->sig);pWrite(gcd);pWrite(pairsig);pWrite(strat->S[i]);pWrite(strat->sig[i]);
1700  //getchar();
1701  #endif
1702  pDelete(&h->p);
1703  h->p = gcd;
1704  pDelete(&h->sig);
1705  h->sig = pairsig;
1706  pNext(h->sig) = NULL;
1707  strat->initEcart(h);
1708  h->sev = pGetShortExpVector(h->p);
1709  h->sevSig = pGetShortExpVector(h->sig);
1710  h->i_r1 = -1;h->i_r2 = -1;
1711  if(h->lcm != NULL)
1712  {
1713  pLmDelete(h->lcm);
1714  h->lcm = NULL;
1715  }
1716  if (currRing!=strat->tailRing)
1717  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1718  return TRUE;
1719  }
1720  //Delete what you didn't use
1721  pDelete(&gcd);
1722  pDelete(&pairsig);
1723  }
1724  }
1725  return FALSE;
1726 }
polyset sig
Definition: kutil.h:302
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:94
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLtCmp(p, q)
Definition: polys.h:123
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:804
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:876
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
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:697
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
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:978
int sl
Definition: kutil.h:344
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

◆ sbaRing()

ring sbaRing ( kStrategy  strat,
const ring  r,
BOOLEAN  ,
int   
)

Definition at line 11406 of file kutil.cc.

11407 {
11408  int n = rBlocks(r); // Including trailing zero!
11409  // if sbaOrder == 1 => use (C,monomial order from r)
11410  if (strat->sbaOrder == 1)
11411  {
11412  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11413  {
11414  return r;
11415  }
11416  ring res = rCopy0(r, TRUE, FALSE);
11417  res->order = (rRingOrder_t *)omAlloc0((n+1)*sizeof(rRingOrder_t));
11418  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11419  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11420  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11421  res->wvhdl = wvhdl;
11422  for (int i=1; i<n; i++)
11423  {
11424  res->order[i] = r->order[i-1];
11425  res->block0[i] = r->block0[i-1];
11426  res->block1[i] = r->block1[i-1];
11427  res->wvhdl[i] = r->wvhdl[i-1];
11428  }
11429 
11430  // new 1st block
11431  res->order[0] = ringorder_C; // Prefix
11432  // removes useless secondary component order if defined in old ring
11433  for (int i=rBlocks(res); i>0; --i)
11434  {
11435  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11436  {
11437  res->order[i] = (rRingOrder_t)0;
11438  }
11439  }
11440  rComplete(res, 1);
11441 #ifdef HAVE_PLURAL
11442  if (rIsPluralRing(r))
11443  {
11444  if ( nc_rComplete(r, res, false) ) // no qideal!
11445  {
11446 #ifndef SING_NDEBUG
11447  WarnS("error in nc_rComplete");
11448 #endif
11449  // cleanup?
11450 
11451  // rDelete(res);
11452  // return r;
11453 
11454  // just go on..
11455  }
11456  }
11457 #endif
11458  strat->tailRing = res;
11459  return (res);
11460  }
11461  // if sbaOrder == 3 => degree - position - ring order
11462  if (strat->sbaOrder == 3)
11463  {
11464  ring res = rCopy0(r, TRUE, FALSE);
11465  res->order = (rRingOrder_t*)omAlloc0((n+2)*sizeof(rRingOrder_t));
11466  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11467  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11468  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11469  res->wvhdl = wvhdl;
11470  for (int i=2; i<n+2; i++)
11471  {
11472  res->order[i] = r->order[i-2];
11473  res->block0[i] = r->block0[i-2];
11474  res->block1[i] = r->block1[i-2];
11475  res->wvhdl[i] = r->wvhdl[i-2];
11476  }
11477 
11478  // new 1st block
11479  res->order[0] = ringorder_a; // Prefix
11480  res->block0[0] = 1;
11481  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11482  for (int i=0; i<res->N; ++i)
11483  res->wvhdl[0][i] = 1;
11484  res->block1[0] = si_min(res->N, rVar(res));
11485  // new 2nd block
11486  res->order[1] = ringorder_C; // Prefix
11487  res->wvhdl[1] = NULL;
11488  // removes useless secondary component order if defined in old ring
11489  for (int i=rBlocks(res); i>1; --i)
11490  {
11491  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11492  {
11493  res->order[i] = (rRingOrder_t)0;
11494  }
11495  }
11496  rComplete(res, 1);
11497 #ifdef HAVE_PLURAL
11498  if (rIsPluralRing(r))
11499  {
11500  if ( nc_rComplete(r, res, false) ) // no qideal!
11501  {
11502 #ifndef SING_NDEBUG
11503  WarnS("error in nc_rComplete");
11504 #endif
11505  // cleanup?
11506 
11507  // rDelete(res);
11508  // return r;
11509 
11510  // just go on..
11511  }
11512  }
11513 #endif
11514  strat->tailRing = res;
11515  return (res);
11516  }
11517 
11518  // not sbaOrder == 1 => use Schreyer order
11519  // this is done by a trick when initializing the signatures
11520  // in initSLSba():
11521  // Instead of using the signature 1e_i for F->m[i], we start
11522  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11523  // Schreyer order w.r.t. the underlying monomial order.
11524  // => we do not need to change the underlying polynomial ring at all!
11525 
11526  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11527 
11528  /*
11529  else
11530  {
11531  ring res = rCopy0(r, FALSE, FALSE);
11532  // Create 2 more blocks for prefix/suffix:
11533  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11534  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11535  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11536  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11537 
11538  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11539  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11540 
11541  // new 1st block
11542  int j = 0;
11543  res->order[j] = ringorder_IS; // Prefix
11544  res->block0[j] = res->block1[j] = 0;
11545  // wvhdl[j] = NULL;
11546  j++;
11547 
11548  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11549  {
11550  res->order [j] = r->order [i];
11551  res->block0[j] = r->block0[i];
11552  res->block1[j] = r->block1[i];
11553 
11554  if (r->wvhdl[i] != NULL)
11555  {
11556  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11557  } // else wvhdl[j] = NULL;
11558  }
11559 
11560  // new last block
11561  res->order [j] = ringorder_IS; // Suffix
11562  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11563  // wvhdl[j] = NULL;
11564  j++;
11565 
11566  // res->order [j] = 0; // The End!
11567  res->wvhdl = wvhdl;
11568 
11569  // j == the last zero block now!
11570  assume(j == (n+1));
11571  assume(res->order[0]==ringorder_IS);
11572  assume(res->order[j-1]==ringorder_IS);
11573  assume(res->order[j]==0);
11574 
11575  if (complete)
11576  {
11577  rComplete(res, 1);
11578 
11579 #ifdef HAVE_PLURAL
11580  if (rIsPluralRing(r))
11581  {
11582  if ( nc_rComplete(r, res, false) ) // no qideal!
11583  {
11584  }
11585  }
11586  assume(rIsPluralRing(r) == rIsPluralRing(res));
11587 #endif
11588 
11589 
11590 #ifdef HAVE_PLURAL
11591  ring old_ring = r;
11592 
11593 #endif
11594 
11595  if (r->qideal!=NULL)
11596  {
11597  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11598 
11599  assume(idRankFreeModule(res->qideal, res) == 0);
11600 
11601 #ifdef HAVE_PLURAL
11602  if( rIsPluralRing(res) )
11603  if( nc_SetupQuotient(res, r, true) )
11604  {
11605  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11606  }
11607 
11608 #endif
11609  assume(idRankFreeModule(res->qideal, res) == 0);
11610  }
11611 
11612 #ifdef HAVE_PLURAL
11613  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11614  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11615  assume(rIsSCA(res) == rIsSCA(old_ring));
11616  assume(ncRingType(res) == ncRingType(old_ring));
11617 #endif
11618  }
11619  strat->tailRing = res;
11620  return res;
11621  }
11622  */
11623 
11624  assume(FALSE);
11625  return(NULL);
11626 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:121
#define FALSE
Definition: auxiliary.h:94
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5497
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:559
const ring r
Definition: syzextra.cc:208
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:3356
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1323
rRingOrder_t
order stuff
Definition: ring.h:75
unsigned sbaOrder
Definition: kutil.h:310
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define omAlloc0(size)
Definition: omAllocDecl.h:211

◆ showOption()

char* showOption ( )

Definition at line 717 of file misc_ip.cc.

718 {
719  int i;
720  BITSET tmp;
721 
722  StringSetS("//options:");
723  if ((si_opt_1!=0)||(si_opt_2!=0))
724  {
725  tmp=si_opt_1;
726  if(tmp)
727  {
728  for (i=0; optionStruct[i].setval!=0; i++)
729  {
730  if (optionStruct[i].setval & tmp)
731  {
732  StringAppend(" %s",optionStruct[i].name);
733  tmp &=optionStruct[i].resetval;
734  }
735  }
736  for (i=0; i<32; i++)
737  {
738  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
739  }
740  }
741  tmp=si_opt_2;
742  if (tmp)
743  {
744  for (i=0; verboseStruct[i].setval!=0; i++)
745  {
746  if (verboseStruct[i].setval & tmp)
747  {
748  StringAppend(" %s",verboseStruct[i].name);
749  tmp &=verboseStruct[i].resetval;
750  }
751  }
752  for (i=1; i<32; i++)
753  {
754  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
755  }
756  }
757  return StringEndS();
758  }
759  StringAppendS(" none");
760  return StringEndS();
761 }
unsigned si_opt_1
Definition: options.c:5
const struct soptionStruct optionStruct[]
Definition: misc_ip.cc:516
unsigned setval
Definition: ipid.h:152
unsigned resetval
Definition: ipid.h:153
char * StringEndS()
Definition: reporter.cc:151
#define BITSET
Definition: structs.h:18
#define Sy_bit(x)
Definition: options.h:30
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
const struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:546
char name(const Variable &v)
Definition: factory.h:178
unsigned si_opt_2
Definition: options.c:6

◆ sugarDivisibleBy()

static BOOLEAN sugarDivisibleBy ( int  ecart1,
int  ecart2 
)
inlinestatic

Definition at line 1284 of file kutil.cc.

1285 {
1286  return (ecart1 <= ecart2);
1287 }

◆ superenterpairs()

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

Definition at line 4915 of file kutil.cc.

4916 {
4918  // enter also zero divisor * poly, if this is non zero and of smaller degree
4919  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4920  initenterpairs(h, k, ecart, 0, strat, atR);
4921  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4922  clearSbatch(h, k, pos, strat);
4923 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4889
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3847
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4627
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4676
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static Poly * h
Definition: janet.cc:978

◆ superenterpairsSig()

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

Definition at line 4925 of file kutil.cc.

4926 {
4928  // enter also zero divisor * poly, if this is non zero and of smaller degree
4929  #ifdef ADIDEBUG
4930  printf("\n Trying to add extended spolys\n");
4931  #endif
4932  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4933  if(strat->sigdrop) return;
4934  #ifdef ADIDEBUG
4935  printf("\n Trying to add spolys\n");
4936  #endif
4937  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4938  if(strat->sigdrop) return;
4939  #ifdef ADIDEBUG
4940  printf("\n Trying to add gcd-polys\n");
4941  #endif
4942  initenterstrongPairsSig(h, hSig, k, ecart, 0, strat, atR);
4943  if(strat->sigdrop) return;
4944  clearSbatch(h, k, pos, strat);
4945 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4889
bool sigdrop
Definition: kutil.h:356
void initenterpairsSigRing(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3977
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void enterExtendedSpolySig(poly h, poly hSig, kStrategy strat)
Definition: kutil.cc:4759
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static void initenterstrongPairsSig(poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4649
static Poly * h
Definition: janet.cc:978

◆ syzCriterion()

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

Definition at line 7138 of file kutil.cc.

7139 {
7140 //#if 1
7141 #ifdef DEBUGF5
7142  PrintS("syzygy criterion checks: ");
7143  pWrite(sig);
7144 #endif
7145  for (int k=0; k<strat->syzl; k++)
7146  {
7147  //printf("-%d",k);
7148 //#if 1
7149 #ifdef DEBUGF5
7150  Print("checking with: %d / %d -- \n",k,strat->syzl);
7151  pWrite(pHead(strat->syz[k]));
7152 #endif
7153  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7154  && (!rField_is_Ring(currRing) ||
7155  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7156  {
7157 //#if 1
7158 #ifdef DEBUGF5
7159  PrintS("DELETE!\n");
7160 #endif
7161  #ifdef ADIDEBUG
7162  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7163  #endif
7164  strat->nrsyzcrit++;
7165  //printf("- T -\n\n");
7166  return TRUE;
7167  }
7168  }
7169  //printf("- F -\n\n");
7170  return FALSE;
7171 }
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:94
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrsyzcrit
Definition: kutil.h:357
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
unsigned long * sevSyz
Definition: kutil.h:317
polyset syz
Definition: kutil.h:301
int syzl
Definition: kutil.h:345

◆ syzCriterionInc()

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

Definition at line 7176 of file kutil.cc.

7177 {
7178 //#if 1
7179  if(sig == NULL)
7180  return FALSE;
7181 #ifdef DEBUGF5
7182  PrintS("--- syzygy criterion checks: ");
7183  pWrite(sig);
7184 #endif
7185  int comp = p_GetComp(sig, currRing);
7186  int min, max;
7187  if (comp<=1)
7188  return FALSE;
7189  else
7190  {
7191  min = strat->syzIdx[comp-2];
7192  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7193  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7194  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7195  if (comp == strat->currIdx)
7196  {
7197  max = strat->syzl;
7198  }
7199  else
7200  {
7201  max = strat->syzIdx[comp-1];
7202  }
7203  for (int k=min; k<max; k++)
7204  {
7205 #ifdef F5DEBUG
7206  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7207  Print("checking with: %d -- ",k);
7208  pWrite(pHead(strat->syz[k]));
7209 #endif
7210  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7211  && (!rField_is_Ring(currRing) ||
7212  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7213  {
7214  #ifdef ADIDEBUG
7215  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7216  #endif
7217  strat->nrsyzcrit++;
7218  return TRUE;
7219  }
7220  }
7221  return FALSE;
7222  }
7223 }
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:94
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int currIdx
Definition: kutil.h:311
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrsyzcrit
Definition: kutil.h:357
static int max(int a, int b)
Definition: fast_mult.cc:264
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
void PrintS(const char *s)
Definition: reporter.cc:284
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
unsigned long * sevSyz
Definition: kutil.h:317
polyset syz
Definition: kutil.h:301
int syzl
Definition: kutil.h:345
intset syzIdx
Definition: kutil.h:307

◆ twoPow()

long twoPow ( long  arg)

Definition at line 4240 of file kutil.cc.

4241 {
4242  return 1L << arg;
4243 }

◆ updateResult()

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

Definition at line 10427 of file kutil.cc.

10428 {
10429  int l;
10430  if (strat->ak>0)
10431  {
10432  for (l=IDELEMS(r)-1;l>=0;l--)
10433  {
10434  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10435  {
10436  pDelete(&r->m[l]); // and set it to NULL
10437  }
10438  }
10439  int q;
10440  poly p;
10441  if(!rField_is_Ring(currRing))
10442  {
10443  for (l=IDELEMS(r)-1;l>=0;l--)
10444  {
10445  if ((r->m[l]!=NULL)
10446  //&& (strat->syzComp>0)
10447  //&& (pGetComp(r->m[l])<=strat->syzComp)
10448  )
10449  {
10450  for(q=IDELEMS(Q)-1; q>=0;q--)
10451  {
10452  if ((Q->m[q]!=NULL)
10453  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10454  {
10455  if (TEST_OPT_REDSB)
10456  {
10457  p=r->m[l];
10458  r->m[l]=kNF(Q,NULL,p);
10459  pDelete(&p);
10460  }
10461  else
10462  {
10463  pDelete(&r->m[l]); // and set it to NULL
10464  }
10465  break;
10466  }
10467  }
10468  }
10469  }
10470  }
10471  #ifdef HAVE_RINGS
10472  else
10473  {
10474  for (l=IDELEMS(r)-1;l>=0;l--)
10475  {
10476  if ((r->m[l]!=NULL)
10477  //&& (strat->syzComp>0)
10478  //&& (pGetComp(r->m[l])<=strat->syzComp)
10479  )
10480  {
10481  for(q=IDELEMS(Q)-1; q>=0;q--)
10482  {
10483  if ((Q->m[q]!=NULL)
10484  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10485  {
10486  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10487  {
10488  if (TEST_OPT_REDSB)
10489  {
10490  p=r->m[l];
10491  r->m[l]=kNF(Q,NULL,p);
10492  pDelete(&p);
10493  }
10494  else
10495  {
10496  pDelete(&r->m[l]); // and set it to NULL
10497  }
10498  break;
10499  }
10500  }
10501  }
10502  }
10503  }
10504  }
10505  #endif
10506  }
10507  else
10508  {
10509  int q;
10510  poly p;
10511  BOOLEAN reduction_found=FALSE;
10512  if (!rField_is_Ring(currRing))
10513  {
10514  for (l=IDELEMS(r)-1;l>=0;l--)
10515  {
10516  if (r->m[l]!=NULL)
10517  {
10518  for(q=IDELEMS(Q)-1; q>=0;q--)
10519  {
10520  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10521  {
10522  if (TEST_OPT_REDSB)
10523  {
10524  p=r->m[l];
10525  r->m[l]=kNF(Q,NULL,p);
10526  pDelete(&p);
10527  reduction_found=TRUE;
10528  }
10529  else
10530  {
10531  pDelete(&r->m[l]); // and set it to NULL
10532  }
10533  break;
10534  }
10535  }
10536  }
10537  }
10538  }
10539  #ifdef HAVE_RINGS
10540  //Also need divisibility of the leading coefficients
10541  else
10542  {
10543  for (l=IDELEMS(r)-1;l>=0;l--)
10544  {
10545  if (r->m[l]!=NULL)
10546  {
10547  for(q=IDELEMS(Q)-1; q>=0;q--)
10548  {
10549  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10550  {
10551  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10552  {
10553  if (TEST_OPT_REDSB)
10554  {
10555  p=r->m[l];
10556  r->m[l]=kNF(Q,NULL,p);
10557  pDelete(&p);
10558  reduction_found=TRUE;
10559  }
10560  else
10561  {
10562  pDelete(&r->m[l]); // and set it to NULL
10563  }
10564  break;
10565  }
10566  }
10567  }
10568  }
10569  }
10570  }
10571  #endif
10572  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10573  {
10574  #ifdef HAVE_RINGS
10576  {
10577  for (l=IDELEMS(r)-1;l>=0;l--)
10578  {
10579  if (r->m[l]!=NULL)
10580  {
10581  for(q=IDELEMS(r)-1;q>=0;q--)
10582  {
10583  if ((l!=q)
10584  && (r->m[q]!=NULL)
10585  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10586  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10587  )
10588  {
10589  //If they are equal then take the one with the smallest length
10590  if(pLmDivisibleBy(r->m[q],r->m[l])
10591  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10592  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10593  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10594  {
10595  pDelete(&r->m[l]);
10596  break;
10597  }
10598  else
10599  pDelete(&r->m[q]);
10600  }
10601  }
10602  }
10603  }
10604  }
10605  else
10606  #endif
10607  {
10608  for (l=IDELEMS(r)-1;l>=0;l--)
10609  {
10610  if (r->m[l]!=NULL)
10611  {
10612  for(q=IDELEMS(r)-1;q>=0;q--)
10613  {
10614  if ((l!=q)
10615  && (r->m[q]!=NULL)
10616  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10617  )
10618  {
10619  //If they are equal then take the one with the smallest length
10620  if(pLmDivisibleBy(r->m[q],r->m[l])
10621  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10622  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10623  {
10624  pDelete(&r->m[l]);
10625  break;
10626  }
10627  else
10628  pDelete(&r->m[q]);
10629  }
10630  }
10631  }
10632  }
10633  }
10634  }
10635  }
10636  idSkipZeroes(r);
10637 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:349
#define Q
Definition: sirandom.c:25
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
#define nGreaterZero(n)
Definition: numbers.h:27
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#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:138
#define pDelete(p_ptr)
Definition: polys.h:169
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:85
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

◆ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9026 of file kutil.cc.

9027 {
9028  LObject h;
9029  int i, suc=0;
9030  poly redSi=NULL;
9031  BOOLEAN change,any_change;
9032 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9033 // for (i=0; i<=(strat->sl); i++)
9034 // {
9035 // Print("s%d:",i);
9036 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9037 // pWrite(strat->S[i]);
9038 // }
9039 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9040  any_change=FALSE;
9042  {
9043  while (suc != -1)
9044  {
9045  i=suc+1;
9046  while (i<=strat->sl)
9047  {
9048  change=FALSE;
9050  any_change = FALSE;
9051  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9052  {
9053  redSi = pHead(strat->S[i]);
9054  strat->S[i] = redBba(strat->S[i],i-1,strat);
9055  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9056  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9057  if (pCmp(redSi,strat->S[i])!=0)
9058  {
9059  change=TRUE;
9060  any_change=TRUE;
9061  #ifdef KDEBUG
9062  if (TEST_OPT_DEBUG)
9063  {
9064  PrintS("reduce:");
9065  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9066  }
9067  #endif
9068  if (TEST_OPT_PROT)
9069  {
9070  if (strat->S[i]==NULL)
9071  PrintS("V");
9072  else
9073  PrintS("v");
9074  mflush();
9075  }
9076  }
9077  pLmDelete(&redSi);
9078  if (strat->S[i]==NULL)
9079  {
9080  deleteInS(i,strat);
9081  i--;
9082  }
9083  else if (change)
9084  {
9086  {
9087  if (TEST_OPT_CONTENTSB)
9088  {
9089  number n;
9090  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9091  if (!nIsOne(n))
9092  {
9094  denom->n=nInvers(n);
9095  denom->next=DENOMINATOR_LIST;
9096  DENOMINATOR_LIST=denom;
9097  }
9098  nDelete(&n);
9099  }
9100  else
9101  {
9102  //pContent(strat->S[i]);
9103  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9104  }
9105  }
9106  else
9107  {
9108  pNorm(strat->S[i]);
9109  }
9110  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9111  }
9112  }
9113  i++;
9114  }
9115  if (any_change) reorderS(&suc,strat);
9116  else break;
9117  }
9118  if (toT)
9119  {
9120  for (i=0; i<=strat->sl; i++)
9121  {
9122  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9123  {
9124  h.p = redtailBba(strat->S[i],i-1,strat);
9126  {
9127  h.pCleardenom();// also does a pContent
9128  }
9129  }
9130  else
9131  {
9132  h.p = strat->S[i];
9133  }
9134  strat->initEcart(&h);
9135  if (strat->honey)
9136  {
9137  strat->ecartS[i] = h.ecart;
9138  }
9139  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9140  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9141  h.sev = strat->sevS[i];
9142  /*puts the elements of S also to T*/
9143  strat->initEcart(&h);
9144  enterT(h,strat);
9145  strat->S_2_R[i] = strat->tl;
9146  }
9147  }
9148  }
9149  else
9150  {
9151  while (suc != -1)
9152  {
9153  i=suc;
9154  while (i<=strat->sl)
9155  {
9156  change=FALSE;
9157  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9158  {
9159  redSi=pHead((strat->S)[i]);
9160  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9161  if ((strat->S)[i]==NULL)
9162  {
9163  deleteInS(i,strat);
9164  i--;
9165  }
9166  else if (pCmp((strat->S)[i],redSi)!=0)
9167  {
9168  any_change=TRUE;
9169  h.p = strat->S[i];
9170  strat->initEcart(&h);
9171  strat->ecartS[i] = h.ecart;
9173  {
9174  if (TEST_OPT_CONTENTSB)
9175  {
9176  number n;
9177  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9178  if (!nIsOne(n))
9179  {
9181  denom->n=nInvers(n);
9182  denom->next=DENOMINATOR_LIST;
9183  DENOMINATOR_LIST=denom;
9184  }
9185  nDelete(&n);
9186  }
9187  else
9188  {
9189  //pContent(strat->S[i]);
9190  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9191  }
9192  }
9193  else
9194  {
9195  pNorm(strat->S[i]); // == h.p
9196  }
9197  h.sev = pGetShortExpVector(h.p);
9198  strat->sevS[i] = h.sev;
9199  }
9200  pLmDelete(&redSi);
9201  kTest(strat);
9202  }
9203  i++;
9204  }
9205 #ifdef KDEBUG
9206  kTest(strat);
9207 #endif
9208  if (any_change) reorderS(&suc,strat);
9209  else { suc=-1; break; }
9210  if (h.p!=NULL)
9211  {
9212  if (!strat->kHEdgeFound)
9213  {
9214  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9215  }
9216  if (strat->kHEdgeFound)
9217  newHEdge(strat);
9218  }
9219  }
9220  for (i=0; i<=strat->sl; i++)
9221  {
9222  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9223  {
9224  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9225  strat->initEcart(&h);
9226  strat->ecartS[i] = h.ecart;
9227  h.sev = pGetShortExpVector(h.p);
9228  strat->sevS[i] = h.sev;
9229  }
9230  else
9231  {
9232  h.p = strat->S[i];
9233  h.ecart=strat->ecartS[i];
9234  h.sev = strat->sevS[i];
9235  h.length = h.pLength = pLength(h.p);
9236  }
9237  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9238  cancelunit1(&h,&suc,strat->sl,strat);
9239  h.SetpFDeg();
9240  /*puts the elements of S also to T*/
9241  enterT(h,strat);
9242  strat->S_2_R[i] = strat->tl;
9243  }
9244  if (suc!= -1) updateS(toT,strat);
9245  }
9246 #ifdef KDEBUG
9247  kTest(strat);
9248 #endif
9249 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7522
BOOLEAN honey
Definition: kutil.h:374
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8869
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5075
#define TEST_OPT_CONTENTSB
Definition: options.h:121
int tl
Definition: kutil.h:346
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pCmp(p1, p2)
pCmp: args may be NULL returns: (p2==NULL ? 1 : (p1 == NULL ? -1 : p_LmCmp(p1, p2))) ...
Definition: polys.h:115
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
#define kTest(A)
Definition: kutil.h:648
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1058
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7598
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8957
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9495
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2875
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
static unsigned pLength(poly a)
Definition: p_polys.h:189
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
int int kStrategy strat
Definition: myNF.cc:68
#define nInvers(a)
Definition: numbers.h:33
BOOLEAN kHEdgeFound
Definition: kutil.h:373
intset ecartS
Definition: kutil.h:303
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:750
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
denominator_list next
Definition: kutil.h:67
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9026
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8981
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10762
void wrp(poly p)
Definition: polys.h:292
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:85
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2747

◆ updateSShift()

void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 12086 of file kutil.cc.

12087 {
12088  /* to use after updateS(toT=FALSE,strat) */
12089  /* fills T with shifted elt's of S */
12090  int i;
12091  LObject h;
12092  int atT = -1; // or figure out smth better
12093  strat->tl = -1; // init
12094  for (i=0; i<=strat->sl; i++)
12095  {
12096  memset(&h,0,sizeof(h));
12097  h.p = strat->S[i]; // lm in currRing, tail in TR
12098  strat->initEcart(&h);
12099  h.sev = strat->sevS[i];
12100  h.t_p = NULL;
12101  h.GetTP(); // creates correct t_p
12102  /*puts the elements of S with their shifts to T*/
12103  // int atT, int uptodeg, int lV)
12104  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12105  // need a small check for above; we insert >=1 elements
12106  // insert this check into kTest_TS ?
12107  enterTShift(h,strat,atT,uptodeg,lV);
12108  }
12109  /* what about setting strat->tl? */
12110 }
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
int tl
Definition: kutil.h:346
void(* initEcart)(TObject *L)
Definition: kutil.h:274
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12731
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:316
int sl
Definition: kutil.h:344
static Poly * h
Definition: janet.cc:978

Variable Documentation

◆ DENOMINATOR_LIST

denominator_list DENOMINATOR_LIST =NULL

Definition at line 89 of file kutil.cc.

◆ HCord

int HCord

Definition at line 235 of file kutil.cc.

◆ Kstd1_deg

int Kstd1_deg

Definition at line 236 of file kutil.cc.

◆ Kstd1_mu

int Kstd1_mu =32000

Definition at line 237 of file kutil.cc.