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)
 
void enterOnePairRing (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
BOOLEAN enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
 
BOOLEAN sbaCheckGcdPair (LObject *h, kStrategy strat)
 
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...
 
void enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSig (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
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)
 
void initenterstrongPairsSig (poly h, poly hSig, int hFrom, 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, const int ecart_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 strat)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *p, const kStrategy strat)
 
int posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy strat)
 
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)
 
void enterOnePairManyShifts (int i, poly p, int ecart, int isFromQ, kStrategy strat, int, 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 enterpairsShift (poly h, int k, int ecart, int pos, kStrategy strat, int atR, int uptodeg, int lV)
 
void initenterpairsShift (poly h, int k, int ecart, int isFromQ, 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 7275 of file kutil.cc.

7276 {
7277  #ifdef ADIDEBUG
7278  printf("\narriRewCrit\n");
7279  #endif
7281  return FALSE;
7282  poly p1 = pOne();
7283  poly p2 = pOne();
7284  for (int ii=strat->sl; ii>start; ii--)
7285  {
7286  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7287  {
7288  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7289  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7290  if (!(pLmCmp(p1,p2) == 1))
7291  {
7292  #ifdef ADIDEBUG
7293  printf("\narriRewCrit deleted: sig, P.sig\n");
7294  #endif
7295  pDelete(&p1);
7296  pDelete(&p2);
7297  return TRUE;
7298  }
7299  }
7300  }
7301  pDelete(&p1);
7302  pDelete(&p2);
7303  return FALSE;
7304 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:95
#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:99
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:298
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 7306 of file kutil.cc.

7307 {
7308  #ifdef ADIDEBUG
7309  printf("\narriRewCritPre\n");
7310  #endif
7311  //Over Rings, there are still some changes to do: considering coeffs
7313  return FALSE;
7314  int found = -1;
7315  for (int i=strat->Bl; i>-1; i--) {
7316  if (pLmEqual(strat->B[i].sig,sig))
7317  {
7318  found = i;
7319  break;
7320  }
7321  }
7322  if (found != -1)
7323  {
7324  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7325  {
7326  deleteInL(strat->B,&strat->Bl,found,strat);
7327  #ifdef ADIDEBUG
7328  printf("\nDelete!\n");
7329  #endif
7330  }
7331  else
7332  {
7333  #ifdef ADIDEBUG
7334  printf("\nDelete this one!\n");
7335  #endif
7336  return TRUE;
7337  }
7338  }
7339  poly p1 = pOne();
7340  poly p2 = pOne();
7341  for (int ii=strat->sl; ii>-1; ii--)
7342  {
7343  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7344  {
7345  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7346  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7347  if (!(pLmCmp(p1,p2) == 1))
7348  {
7349  pDelete(&p1);
7350  pDelete(&p2);
7351  #ifdef ADIDEBUG
7352  printf("\nDelete this one!\n");
7353  #endif
7354  return TRUE;
7355  }
7356  }
7357  }
7358  pDelete(&p1);
7359  pDelete(&p2);
7360  return FALSE;
7361 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:95
#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:99
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
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:298
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 = 0;
400  loop
401  {
402  i++;
403  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
404  if (i == r->N) 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 = 0;
460  loop
461  {
462  i++;
463  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
464  if (i == r->N) break; // does divide, try next monom
465  }
466  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
467  pIter(h);
468  }
469  }
470 }
return
Definition: syzextra.cc:280
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
void pWrite(poly p)
Definition: polys.h:291
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:746
#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 8854 of file kutil.cc.

8855 {
8856  int k;
8857  poly r,h,h1,q;
8858 
8859  if (!pIsVector((*p).p) && ((*p).ecart != 0))
8860  {
8861 #ifdef HAVE_RINGS
8862  // Leading coef have to be a unit: no
8863  // example 2x+4x2 should be simplified to 2x*(1+2x)
8864  // and 2 is not a unit in Z
8865  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
8866 #endif
8867  k = 0;
8868  h1 = r = pCopy((*p).p);
8869  h =pNext(r);
8870  loop
8871  {
8872  if (h==NULL)
8873  {
8874  pDelete(&r);
8875  pDelete(&(pNext((*p).p)));
8876  (*p).ecart = 0;
8877  (*p).length = 1;
8878  (*p).pLength = 1;
8879  (*suc)=0;
8880  return;
8881  }
8882  if (!pDivisibleBy(r,h))
8883  {
8884  q=redBba1(h,index ,strat);
8885  if (q != h)
8886  {
8887  k++;
8888  pDelete(&h);
8889  pNext(h1) = h = q;
8890  }
8891  else
8892  {
8893  pDelete(&r);
8894  return;
8895  }
8896  }
8897  else
8898  {
8899  h1 = h;
8900  pIter(h);
8901  }
8902  if (k > 10)
8903  {
8904  pDelete(&r);
8905  return;
8906  }
8907  }
8908  }
8909 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8837
#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 3250 of file kutil.cc.

3251 {
3252  int i,j,l;
3253 
3254  /*
3255  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3256  *In this case all elements in B such
3257  *that their lcm is divisible by the leading term of S[i] can be canceled
3258  */
3259  if (strat->pairtest!=NULL)
3260  {
3261  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3262  for (j=0; j<=strat->sl; j++)
3263  {
3264  if (strat->pairtest[j])
3265  {
3266  for (i=strat->Bl; i>=0; i--)
3267  {
3268  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
3269  {
3270  deleteInL(strat->B,&strat->Bl,i,strat);
3271  strat->c3++;
3272  }
3273  }
3274  }
3275  }
3276  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3277  strat->pairtest=NULL;
3278  }
3279  if (strat->Gebauer || strat->fromT)
3280  {
3281  if (strat->sugarCrit)
3282  {
3283  /*
3284  *suppose L[j] == (s,r) and p/lcm(s,r)
3285  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3286  *and in case the sugar is o.k. then L[j] can be canceled
3287  */
3288  for (j=strat->Ll; j>=0; j--)
3289  {
3290  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3291  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3292  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3293  {
3294  if (strat->L[j].p == strat->tail)
3295  {
3296  deleteInL(strat->L,&strat->Ll,j,strat);
3297  strat->c3++;
3298  }
3299  }
3300  }
3301  /*
3302  *this is GEBAUER-MOELLER:
3303  *in B all elements with the same lcm except the "best"
3304  *(i.e. the last one in B with this property) will be canceled
3305  */
3306  j = strat->Bl;
3307  loop /*cannot be changed into a for !!! */
3308  {
3309  if (j <= 0) break;
3310  i = j-1;
3311  loop
3312  {
3313  if (i < 0) break;
3314  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3315  {
3316  strat->c3++;
3317  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3318  {
3319  deleteInL(strat->B,&strat->Bl,i,strat);
3320  j--;
3321  }
3322  else
3323  {
3324  deleteInL(strat->B,&strat->Bl,j,strat);
3325  break;
3326  }
3327  }
3328  i--;
3329  }
3330  j--;
3331  }
3332  }
3333  else /*sugarCrit*/
3334  {
3335  /*
3336  *suppose L[j] == (s,r) and p/lcm(s,r)
3337  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3338  *and in case the sugar is o.k. then L[j] can be canceled
3339  */
3340  for (j=strat->Ll; j>=0; j--)
3341  {
3342  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3343  {
3344  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3345  {
3346  deleteInL(strat->L,&strat->Ll,j,strat);
3347  strat->c3++;
3348  }
3349  }
3350  }
3351  /*
3352  *this is GEBAUER-MOELLER:
3353  *in B all elements with the same lcm except the "best"
3354  *(i.e. the last one in B with this property) will be canceled
3355  */
3356  j = strat->Bl;
3357  loop /*cannot be changed into a for !!! */
3358  {
3359  if (j <= 0) break;
3360  for(i=j-1; i>=0; i--)
3361  {
3362  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3363  {
3364  strat->c3++;
3365  deleteInL(strat->B,&strat->Bl,i,strat);
3366  j--;
3367  }
3368  }
3369  j--;
3370  }
3371  }
3372  /*
3373  *the elements of B enter L
3374  */
3375  kMergeBintoL(strat);
3376  }
3377  else
3378  {
3379  for (j=strat->Ll; j>=0; j--)
3380  {
3381  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3382  {
3383  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3384  {
3385  deleteInL(strat->L,&strat->Ll,j,strat);
3386  strat->c3++;
3387  }
3388  }
3389  }
3390  /*
3391  *this is our MODIFICATION of GEBAUER-MOELLER:
3392  *First the elements of B enter L,
3393  *then we fix a lcm and the "best" element in L
3394  *(i.e the last in L with this lcm and of type (s,p))
3395  *and cancel all the other elements of type (r,p) with this lcm
3396  *except the case the element (s,r) has also the same lcm
3397  *and is on the worst position with respect to (s,p) and (r,p)
3398  */
3399  /*
3400  *B enters to L/their order with respect to B is permutated for elements
3401  *B[i].p with the same leading term
3402  */
3403  kMergeBintoL(strat);
3404  j = strat->Ll;
3405  loop /*cannot be changed into a for !!! */
3406  {
3407  if (j <= 0)
3408  {
3409  /*now L[0] cannot be canceled any more and the tail can be removed*/
3410  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3411  break;
3412  }
3413  if (strat->L[j].p2 == p)
3414  {
3415  i = j-1;
3416  loop
3417  {
3418  if (i < 0) break;
3419  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3420  {
3421  /*L[i] could be canceled but we search for a better one to cancel*/
3422  strat->c3++;
3423  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3424  && (pNext(strat->L[l].p) == strat->tail)
3425  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3426  && pDivisibleBy(p,strat->L[l].lcm))
3427  {
3428  /*
3429  *"NOT equal(...)" because in case of "equal" the element L[l]
3430  *is "older" and has to be from theoretical point of view behind
3431  *L[i], but we do not want to reorder L
3432  */
3433  strat->L[i].p2 = strat->tail;
3434  /*
3435  *L[l] will be canceled, we cannot cancel L[i] later on,
3436  *so we mark it with "tail"
3437  */
3438  deleteInL(strat->L,&strat->Ll,l,strat);
3439  i--;
3440  }
3441  else
3442  {
3443  deleteInL(strat->L,&strat->Ll,i,strat);
3444  }
3445  j--;
3446  }
3447  i--;
3448  }
3449  }
3450  else if (strat->L[j].p2 == strat->tail)
3451  {
3452  /*now L[j] cannot be canceled any more and the tail can be removed*/
3453  strat->L[j].p2 = p;
3454  }
3455  j--;
3456  }
3457  }
3458 }
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:1148
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:746
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3204
int BOOLEAN
Definition: auxiliary.h:86
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1267
#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 3463 of file kutil.cc.

3464 {
3465  if (strat->pairtest!=NULL)
3466  {
3467  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3468  strat->pairtest=NULL;
3469  }
3470  /*
3471  *the elements of B enter L
3472  */
3473  kMergeBintoL(strat);
3474 }
#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:3204
int BOOLEAN
Definition: auxiliary.h:86

§ chainCritPart()

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

Definition at line 3538 of file kutil.cc.

3539 {
3540  int i,j,l;
3541 
3542  /*
3543  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
3544  *In this case all elements in B such
3545  *that their lcm is divisible by the leading term of S[i] can be canceled
3546  */
3547  if (strat->pairtest!=NULL)
3548  {
3549  /*- i.e. there is an i with pairtest[i]==TRUE -*/
3550  for (j=0; j<=strat->sl; j++)
3551  {
3552  if (strat->pairtest[j])
3553  {
3554  for (i=strat->Bl; i>=0; i--)
3555  {
3556  if (_p_LmDivisibleByPart(strat->S[j],currRing,
3557  strat->B[i].lcm,currRing,
3558  currRing->real_var_start,currRing->real_var_end))
3559  {
3560  if(TEST_OPT_DEBUG)
3561  {
3562  Print("chain-crit-part: S[%d]=",j);
3563  p_wrp(strat->S[j],currRing);
3564  Print(" divide B[%d].lcm=",i);
3565  p_wrp(strat->B[i].lcm,currRing);
3566  PrintLn();
3567  }
3568  deleteInL(strat->B,&strat->Bl,i,strat);
3569  strat->c3++;
3570  }
3571  }
3572  }
3573  }
3574  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3575  strat->pairtest=NULL;
3576  }
3577  if (strat->Gebauer || strat->fromT)
3578  {
3579  if (strat->sugarCrit)
3580  {
3581  /*
3582  *suppose L[j] == (s,r) and p/lcm(s,r)
3583  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3584  *and in case the sugar is o.k. then L[j] can be canceled
3585  */
3586  for (j=strat->Ll; j>=0; j--)
3587  {
3588  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
3589  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
3590  && pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3591  {
3592  if (strat->L[j].p == strat->tail)
3593  {
3594  if(TEST_OPT_DEBUG)
3595  {
3596  PrintS("chain-crit-part: pCompareChainPart p=");
3597  p_wrp(p,currRing);
3598  Print(" delete L[%d]",j);
3599  p_wrp(strat->L[j].lcm,currRing);
3600  PrintLn();
3601  }
3602  deleteInL(strat->L,&strat->Ll,j,strat);
3603  strat->c3++;
3604  }
3605  }
3606  }
3607  /*
3608  *this is GEBAUER-MOELLER:
3609  *in B all elements with the same lcm except the "best"
3610  *(i.e. the last one in B with this property) will be canceled
3611  */
3612  j = strat->Bl;
3613  loop /*cannot be changed into a for !!! */
3614  {
3615  if (j <= 0) break;
3616  i = j-1;
3617  loop
3618  {
3619  if (i < 0) break;
3620  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3621  {
3622  strat->c3++;
3623  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
3624  {
3625  if(TEST_OPT_DEBUG)
3626  {
3627  Print("chain-crit-part: sugar B[%d].lcm=",j);
3628  p_wrp(strat->B[j].lcm,currRing);
3629  Print(" delete B[%d]",i);
3630  p_wrp(strat->B[i].lcm,currRing);
3631  PrintLn();
3632  }
3633  deleteInL(strat->B,&strat->Bl,i,strat);
3634  j--;
3635  }
3636  else
3637  {
3638  if(TEST_OPT_DEBUG)
3639  {
3640  Print("chain-crit-part: sugar B[%d].lcm=",i);
3641  p_wrp(strat->B[i].lcm,currRing);
3642  Print(" delete B[%d]",j);
3643  p_wrp(strat->B[j].lcm,currRing);
3644  PrintLn();
3645  }
3646  deleteInL(strat->B,&strat->Bl,j,strat);
3647  break;
3648  }
3649  }
3650  i--;
3651  }
3652  j--;
3653  }
3654  }
3655  else /*sugarCrit*/
3656  {
3657  /*
3658  *suppose L[j] == (s,r) and p/lcm(s,r)
3659  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
3660  *and in case the sugar is o.k. then L[j] can be canceled
3661  */
3662  for (j=strat->Ll; j>=0; j--)
3663  {
3664  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3665  {
3666  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3667  {
3668  if(TEST_OPT_DEBUG)
3669  {
3670  PrintS("chain-crit-part: sugar:pCompareChainPart p=");
3671  p_wrp(p,currRing);
3672  Print(" delete L[%d]",j);
3673  p_wrp(strat->L[j].lcm,currRing);
3674  PrintLn();
3675  }
3676  deleteInL(strat->L,&strat->Ll,j,strat);
3677  strat->c3++;
3678  }
3679  }
3680  }
3681  /*
3682  *this is GEBAUER-MOELLER:
3683  *in B all elements with the same lcm except the "best"
3684  *(i.e. the last one in B with this property) will be canceled
3685  */
3686  j = strat->Bl;
3687  loop /*cannot be changed into a for !!! */
3688  {
3689  if (j <= 0) break;
3690  for(i=j-1; i>=0; i--)
3691  {
3692  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
3693  {
3694  if(TEST_OPT_DEBUG)
3695  {
3696  Print("chain-crit-part: equal lcm B[%d].lcm=",j);
3697  p_wrp(strat->B[j].lcm,currRing);
3698  Print(" delete B[%d]\n",i);
3699  }
3700  strat->c3++;
3701  deleteInL(strat->B,&strat->Bl,i,strat);
3702  j--;
3703  }
3704  }
3705  j--;
3706  }
3707  }
3708  /*
3709  *the elements of B enter L
3710  */
3711  kMergeBintoL(strat);
3712  }
3713  else
3714  {
3715  for (j=strat->Ll; j>=0; j--)
3716  {
3717  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
3718  {
3719  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
3720  {
3721  if(TEST_OPT_DEBUG)
3722  {
3723  PrintS("chain-crit-part: pCompareChainPart p=");
3724  p_wrp(p,currRing);
3725  Print(" delete L[%d]",j);
3726  p_wrp(strat->L[j].lcm,currRing);
3727  PrintLn();
3728  }
3729  deleteInL(strat->L,&strat->Ll,j,strat);
3730  strat->c3++;
3731  }
3732  }
3733  }
3734  /*
3735  *this is our MODIFICATION of GEBAUER-MOELLER:
3736  *First the elements of B enter L,
3737  *then we fix a lcm and the "best" element in L
3738  *(i.e the last in L with this lcm and of type (s,p))
3739  *and cancel all the other elements of type (r,p) with this lcm
3740  *except the case the element (s,r) has also the same lcm
3741  *and is on the worst position with respect to (s,p) and (r,p)
3742  */
3743  /*
3744  *B enters to L/their order with respect to B is permutated for elements
3745  *B[i].p with the same leading term
3746  */
3747  kMergeBintoL(strat);
3748  j = strat->Ll;
3749  loop /*cannot be changed into a for !!! */
3750  {
3751  if (j <= 0)
3752  {
3753  /*now L[0] cannot be canceled any more and the tail can be removed*/
3754  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3755  break;
3756  }
3757  if (strat->L[j].p2 == p)
3758  {
3759  i = j-1;
3760  loop
3761  {
3762  if (i < 0) break;
3763  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3764  {
3765  /*L[i] could be canceled but we search for a better one to cancel*/
3766  strat->c3++;
3767  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3768  && (pNext(strat->L[l].p) == strat->tail)
3769  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3771  strat->L[l].lcm,currRing,
3772  currRing->real_var_start, currRing->real_var_end))
3773 
3774  {
3775  /*
3776  *"NOT equal(...)" because in case of "equal" the element L[l]
3777  *is "older" and has to be from theoretical point of view behind
3778  *L[i], but we do not want to reorder L
3779  */
3780  strat->L[i].p2 = strat->tail;
3781  /*
3782  *L[l] will be canceled, we cannot cancel L[i] later on,
3783  *so we mark it with "tail"
3784  */
3785  if(TEST_OPT_DEBUG)
3786  {
3787  PrintS("chain-crit-part: divisible_by p=");
3788  p_wrp(p,currRing);
3789  Print(" delete L[%d]",l);
3790  p_wrp(strat->L[l].lcm,currRing);
3791  PrintLn();
3792  }
3793  deleteInL(strat->L,&strat->Ll,l,strat);
3794  i--;
3795  }
3796  else
3797  {
3798  if(TEST_OPT_DEBUG)
3799  {
3800  PrintS("chain-crit-part: divisible_by(2) p=");
3801  p_wrp(p,currRing);
3802  Print(" delete L[%d]",i);
3803  p_wrp(strat->L[i].lcm,currRing);
3804  PrintLn();
3805  }
3806  deleteInL(strat->L,&strat->Ll,i,strat);
3807  }
3808  j--;
3809  }
3810  i--;
3811  }
3812  }
3813  else if (strat->L[j].p2 == strat->tail)
3814  {
3815  /*now L[j] cannot be canceled any more and the tail can be removed*/
3816  strat->L[j].p2 = p;
3817  }
3818  j--;
3819  }
3820  }
3821 }
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:1148
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:746
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3204
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
int BOOLEAN
Definition: auxiliary.h:86
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1267
#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 4024 of file kutil.cc.

4025 {
4026  int i,j,l;
4027  /*
4028  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
4029  *In this case all elements in B such
4030  *that their lcm is divisible by the leading term of S[i] can be canceled
4031  */
4032  if (strat->pairtest!=NULL)
4033  {
4034  {
4035  /*- i.e. there is an i with pairtest[i]==TRUE -*/
4036  for (j=0; j<=strat->sl; j++)
4037  {
4038  if (strat->pairtest[j])
4039  {
4040  for (i=strat->Bl; i>=0; i--)
4041  {
4042  if (pDivisibleBy(strat->S[j],strat->B[i].lcm) && n_DivBy(pGetCoeff(strat->B[i].lcm), pGetCoeff(strat->S[j]),currRing->cf))
4043  {
4044 #ifdef KDEBUG
4045  if (TEST_OPT_DEBUG)
4046  {
4047  PrintS("--- chain criterion func chainCritRing type 1\n");
4048  PrintS("strat->S[j]:");
4049  wrp(strat->S[j]);
4050  PrintS(" strat->B[i].lcm:");
4051  wrp(strat->B[i].lcm);PrintLn();
4052  pWrite(strat->B[i].p);
4053  pWrite(strat->B[i].p1);
4054  pWrite(strat->B[i].p2);
4055  wrp(strat->B[i].lcm);
4056  PrintLn();
4057  }
4058 #endif
4059  #ifdef ADIDEBUG
4060  printf("\nChainCrit1\n");
4061  pWrite(strat->B[i].p);
4062  pWrite(strat->B[i].p1);
4063  pWrite(strat->B[i].p2);
4064  #endif
4065  deleteInL(strat->B,&strat->Bl,i,strat);
4066  strat->c3++;
4067  }
4068  }
4069  }
4070  }
4071  }
4072  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
4073  strat->pairtest=NULL;
4074  }
4075  assume(!(strat->Gebauer || strat->fromT));
4076  for (j=strat->Ll; j>=0; j--)
4077  {
4078  if ((strat->L[j].lcm != NULL) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(p), currRing->cf))
4079  {
4080  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
4081  {
4082  if ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
4083  {
4084  #ifdef ADIDEBUG
4085  printf("\nChainCrit2\n");
4086  pWrite(strat->L[j].p);
4087  pWrite(strat->L[j].p1);
4088  pWrite(strat->L[j].p2);
4089  #endif
4090  deleteInL(strat->L,&strat->Ll,j,strat);
4091  strat->c3++;
4092 #ifdef KDEBUG
4093  if (TEST_OPT_DEBUG)
4094  {
4095  PrintS("--- chain criterion func chainCritRing type 2\n");
4096  PrintS("strat->L[j].p:");
4097  wrp(strat->L[j].p);
4098  PrintS(" p:");
4099  wrp(p);
4100  PrintLn();
4101  }
4102 #endif
4103  }
4104  }
4105  }
4106  }
4107  /*
4108  *this is our MODIFICATION of GEBAUER-MOELLER:
4109  *First the elements of B enter L,
4110  *then we fix a lcm and the "best" element in L
4111  *(i.e the last in L with this lcm and of type (s,p))
4112  *and cancel all the other elements of type (r,p) with this lcm
4113  *except the case the element (s,r) has also the same lcm
4114  *and is on the worst position with respect to (s,p) and (r,p)
4115  */
4116  /*
4117  *B enters to L/their order with respect to B is permutated for elements
4118  *B[i].p with the same leading term
4119  */
4120  kMergeBintoL(strat);
4121  j = strat->Ll;
4122  loop /*cannot be changed into a for !!! */
4123  {
4124  if (j <= 0)
4125  {
4126  /*now L[0] cannot be canceled any more and the tail can be removed*/
4127  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
4128  break;
4129  }
4130  if (strat->L[j].p2 == p) // Was the element added from B?
4131  {
4132  i = j-1;
4133  loop
4134  {
4135  if (i < 0) break;
4136  // Element is from B and has the same lcm as L[j]
4137  if ((strat->L[i].p2 == p) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(strat->L[i].lcm), currRing->cf)
4138  && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
4139  {
4140  /*L[i] could be canceled but we search for a better one to cancel*/
4141  strat->c3++;
4142 #ifdef KDEBUG
4143  if (TEST_OPT_DEBUG)
4144  {
4145  PrintS("--- chain criterion func chainCritRing type 3\n");
4146  PrintS("strat->L[j].lcm:");
4147  wrp(strat->L[j].lcm);
4148  PrintS(" strat->L[i].lcm:");
4149  wrp(strat->L[i].lcm);
4150  PrintLn();
4151  }
4152 #endif
4153  #ifdef ADIDEBUG
4154  printf("\nChainCrit3\n");
4155  pWrite(strat->L[j].p);
4156  pWrite(strat->L[j].p1);
4157  pWrite(strat->L[j].p2);
4158  #endif
4159  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
4160  && (pNext(strat->L[l].p) == strat->tail)
4161  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
4162  && pDivisibleBy(p,strat->L[l].lcm))
4163  {
4164  /*
4165  *"NOT equal(...)" because in case of "equal" the element L[l]
4166  *is "older" and has to be from theoretical point of view behind
4167  *L[i], but we do not want to reorder L
4168  */
4169  strat->L[i].p2 = strat->tail;
4170  /*
4171  *L[l] will be canceled, we cannot cancel L[i] later on,
4172  *so we mark it with "tail"
4173  */
4174  deleteInL(strat->L,&strat->Ll,l,strat);
4175  i--;
4176  }
4177  else
4178  {
4179  deleteInL(strat->L,&strat->Ll,i,strat);
4180  }
4181  j--;
4182  }
4183  i--;
4184  }
4185  }
4186  else if (strat->L[j].p2 == strat->tail)
4187  {
4188  /*now L[j] cannot be canceled any more and the tail can be removed*/
4189  strat->L[j].p2 = p;
4190  }
4191  j--;
4192  }
4193 }
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:291
#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:1148
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:403
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:746
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3204
void wrp(poly p)
Definition: polys.h:293
int BOOLEAN
Definition: auxiliary.h:86
#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 3479 of file kutil.cc.

3480 {
3481  int i,j,l;
3482  kMergeBintoLSba(strat);
3483  j = strat->Ll;
3484  loop /*cannot be changed into a for !!! */
3485  {
3486  if (j <= 0)
3487  {
3488  /*now L[0] cannot be canceled any more and the tail can be removed*/
3489  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3490  break;
3491  }
3492  if (strat->L[j].p2 == p)
3493  {
3494  i = j-1;
3495  loop
3496  {
3497  if (i < 0) break;
3498  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3499  {
3500  /*L[i] could be canceled but we search for a better one to cancel*/
3501  strat->c3++;
3502  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3503  && (pNext(strat->L[l].p) == strat->tail)
3504  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3505  && pDivisibleBy(p,strat->L[l].lcm))
3506  {
3507  /*
3508  *"NOT equal(...)" because in case of "equal" the element L[l]
3509  *is "older" and has to be from theoretical point of view behind
3510  *L[i], but we do not want to reorder L
3511  */
3512  strat->L[i].p2 = strat->tail;
3513  /*
3514  *L[l] will be canceled, we cannot cancel L[i] later on,
3515  *so we mark it with "tail"
3516  */
3517  deleteInL(strat->L,&strat->Ll,l,strat);
3518  i--;
3519  }
3520  else
3521  {
3522  deleteInL(strat->L,&strat->Ll,i,strat);
3523  }
3524  j--;
3525  }
3526  i--;
3527  }
3528  }
3529  else if (strat->L[j].p2 == strat->tail)
3530  {
3531  /*now L[j] cannot be canceled any more and the tail can be removed*/
3532  strat->L[j].p2 = p;
3533  }
3534  j--;
3535  }
3536 }
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:1148
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:3227
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:403
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:403
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 4873 of file kutil.cc.

4874 {
4875  int j = pos;
4876  if ( (!strat->fromT)
4877  && ((strat->syzComp==0)
4878  ||(pGetComp(h)<=strat->syzComp)
4879  ))
4880  {
4881  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4882  unsigned long h_sev = pGetShortExpVector(h);
4883  loop
4884  {
4885  if (j > k) break;
4886  clearS(h,h_sev, &j,&k,strat);
4887  j++;
4888  }
4889  // Print("end clearS sl=%d\n",strat->sl);
4890  }
4891 }
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 10624 of file kutil.cc.

10625 {
10626  int i;
10627  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10628  LObject L;
10629 
10630 #ifdef KDEBUG
10631  // need to set this: during tailreductions of T[i], T[i].max is out of
10632  // sync
10633  sloppy_max = TRUE;
10634 #endif
10635 
10636  strat->noTailReduction = FALSE;
10637  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10638  if (TEST_OPT_PROT)
10639  {
10640  PrintLn();
10641 // if (timerv) writeTime("standard base computed:");
10642  }
10643  if (TEST_OPT_PROT)
10644  {
10645  Print("(S:%d)",strat->sl);mflush();
10646  }
10647  for (i=strat->sl; i>=low; i--)
10648  {
10649  int end_pos=strat->sl;
10650  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10651  if (strat->ak==0) end_pos=i-1;
10652  TObject* T_j = strat->s_2_t(i);
10653  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10654  {
10655  L = *T_j;
10656  #ifdef KDEBUG
10657  if (TEST_OPT_DEBUG)
10658  {
10659  Print("test S[%d]:",i);
10660  p_wrp(L.p,currRing,strat->tailRing);
10661  PrintLn();
10662  }
10663  #endif
10665  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10666  else
10667  strat->S[i] = redtail(&L, strat->sl, strat);
10668  #ifdef KDEBUG
10669  if (TEST_OPT_DEBUG)
10670  {
10671  Print("to (tailR) S[%d]:",i);
10672  p_wrp(strat->S[i],currRing,strat->tailRing);
10673  PrintLn();
10674  }
10675  #endif
10676 
10677  if (strat->redTailChange)
10678  {
10679  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10680  if (pNext(T_j->p) != NULL)
10681  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10682  else
10683  T_j->max_exp = NULL;
10684  }
10686  T_j->pCleardenom();
10687  }
10688  else
10689  {
10690  assume(currRing == strat->tailRing);
10691  #ifdef KDEBUG
10692  if (TEST_OPT_DEBUG)
10693  {
10694  Print("test S[%d]:",i);
10695  p_wrp(strat->S[i],currRing,strat->tailRing);
10696  PrintLn();
10697  }
10698  #endif
10700  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10701  else
10702  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10704  {
10705  if (TEST_OPT_CONTENTSB)
10706  {
10707  number n;
10708  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10709  if (!nIsOne(n))
10710  {
10712  denom->n=nInvers(n);
10713  denom->next=DENOMINATOR_LIST;
10714  DENOMINATOR_LIST=denom;
10715  }
10716  nDelete(&n);
10717  }
10718  else
10719  {
10720  //pContent(strat->S[i]);
10721  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10722  }
10723  }
10724  #ifdef KDEBUG
10725  if (TEST_OPT_DEBUG)
10726  {
10727  Print("to (-tailR) S[%d]:",i);
10728  p_wrp(strat->S[i],currRing,strat->tailRing);
10729  PrintLn();
10730  }
10731  #endif
10732  }
10733  if (TEST_OPT_PROT)
10734  PrintS("-");
10735  }
10736  if (TEST_OPT_PROT) PrintLn();
10737 #ifdef KDEBUG
10738  sloppy_max = FALSE;
10739 #endif
10740 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7507
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:95
BOOLEAN noTailReduction
Definition: kutil.h:375
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:99
#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:7583
#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:2843
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:403
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:746
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:2715
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 4545 of file kutil.cc.

4546 {
4547  // Initialize
4548  long exp[50]; // The exponent of \hat{X} (basepoint)
4549  long cexp[50]; // The current exponent for iterating over all
4550  long ind[50]; // The power of 2 in the i-th component of exp
4551  long cind[50]; // analog for cexp
4552  long mult[50]; // How to multiply the elements of G
4553  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4554  long habsind = 0; // The abs. index of the coefficient of h
4555  long step[50]; // The last increases
4556  for (int i = 1; i <= currRing->N; i++)
4557  {
4558  exp[i] = 0;
4559  cexp[i] = exp[i];
4560  ind[i] = 0;
4561  step[i] = 500000;
4562  cind[i] = ind[i];
4563  }
4564  long bound = currRing->ch;
4565  step[1] = 500000;
4566 #ifdef OLI_DEBUG
4567  PrintS("-------------\npoly :");
4568 // wrp(p);
4569  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4570  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4571  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4572  Print("bound : %d\n", bound);
4573  Print("cind : %d\n", cabsind);
4574 #endif
4575  if (cabsind == 0)
4576  {
4577  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4578  {
4579  return idInit(1, 1);
4580  }
4581  }
4582  ideal G0 = idInit(1, 1);
4583  // Now the whole simplex
4584  do
4585  {
4586  // Build s-polynomial
4587  // 2**ind-def * mult * g - exp-def * h
4588  poly t_p;
4589  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
4590 #ifdef OLI_DEBUG
4591  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4592  PrintS("zPoly : ");
4593  wrp(zeroPoly);
4594  PrintLn();
4595 #endif
4596  // Add to ideal
4597  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
4598  IDELEMS(G0) += 1;
4599  G0->m[IDELEMS(G0) - 1] = zeroPoly;
4600  }
4601  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4602  idSkipZeroes(G0);
4603  return G0;
4604 }
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:4416
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:4350
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:3555
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:293
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:403
#define kTest_L(T)
Definition: kutil.h:658
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 1148 of file kutil.cc.

1149 {
1150  if (set[j].lcm!=NULL)
1151  {
1152 #ifdef HAVE_RINGS
1153  if (pGetCoeff(set[j].lcm) != NULL)
1154  pLmDelete(set[j].lcm);
1155  else
1156 #endif
1157  pLmFree(set[j].lcm);
1158  }
1159  if (set[j].sig!=NULL)
1160  {
1161 #ifdef HAVE_RINGS
1162  if (pGetCoeff(set[j].sig) != NULL)
1163  pLmDelete(set[j].sig);
1164  else
1165 #endif
1166  pLmFree(set[j].sig);
1167  }
1168  if (set[j].p!=NULL)
1169  {
1170  if (pNext(set[j].p) == strat->tail)
1171  {
1172 #ifdef HAVE_RINGS
1173  if (pGetCoeff(set[j].p) != NULL)
1174  pLmDelete(set[j].p);
1175  else
1176 #endif
1177  pLmFree(set[j].p);
1178  /*- tail belongs to several int spolys -*/
1179  }
1180  else
1181  {
1182  // search p in T, if it is there, do not delete it
1183  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1184  {
1185  // assure that for global orderings kFindInT fails
1186  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1187  set[j].Delete();
1188  }
1189  }
1190  }
1191  if (*length > 0 && j < *length)
1192  {
1193 #ifdef ENTER_USE_MEMMOVE
1194  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1195 #else
1196  int i;
1197  for (i=j; i < (*length); i++)
1198  set[i] = set[i+1];
1199 #endif
1200  }
1201 #ifdef KDEBUG
1202  memset(&(set[*length]),0,sizeof(LObject));
1203 #endif
1204  (*length)--;
1205 }
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:746
#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 1041 of file kutil.cc.

1042 {
1043 #ifdef ENTER_USE_MEMMOVE
1044  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1045  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1046  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1047  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1048 #else
1049  int j;
1050  for (j=i; j<strat->sl; j++)
1051  {
1052  strat->S[j] = strat->S[j+1];
1053  strat->ecartS[j] = strat->ecartS[j+1];
1054  strat->sevS[j] = strat->sevS[j+1];
1055  strat->S_2_R[j] = strat->S_2_R[j+1];
1056  }
1057 #endif
1058  if (strat->lenS!=NULL)
1059  {
1060 #ifdef ENTER_USE_MEMMOVE
1061  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1062 #else
1063  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1064 #endif
1065  }
1066  if (strat->lenSw!=NULL)
1067  {
1068 #ifdef ENTER_USE_MEMMOVE
1069  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1070 #else
1071  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1072 #endif
1073  }
1074  if (strat->fromQ!=NULL)
1075  {
1076 #ifdef ENTER_USE_MEMMOVE
1077  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1078 #else
1079  for (j=i; j<strat->sl; j++)
1080  {
1081  strat->fromQ[j] = strat->fromQ[j+1];
1082  }
1083 #endif
1084  }
1085  strat->S[strat->sl] = NULL;
1086  strat->sl--;
1087 }
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 1093 of file kutil.cc.

1094 {
1095 #ifdef ENTER_USE_MEMMOVE
1096  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1097  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
1098  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1099  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1100  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
1101  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1102 #else
1103  int j;
1104  for (j=i; j<strat->sl; j++)
1105  {
1106  strat->S[j] = strat->S[j+1];
1107  strat->sig[j] = strat->sig[j+1];
1108  strat->ecartS[j] = strat->ecartS[j+1];
1109  strat->sevS[j] = strat->sevS[j+1];
1110  strat->sevSig[j] = strat->sevSig[j+1];
1111  strat->S_2_R[j] = strat->S_2_R[j+1];
1112  }
1113 #endif
1114  if (strat->lenS!=NULL)
1115  {
1116 #ifdef ENTER_USE_MEMMOVE
1117  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1118 #else
1119  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1120 #endif
1121  }
1122  if (strat->lenSw!=NULL)
1123  {
1124 #ifdef ENTER_USE_MEMMOVE
1125  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1126 #else
1127  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1128 #endif
1129  }
1130  if (strat->fromQ!=NULL)
1131  {
1132 #ifdef ENTER_USE_MEMMOVE
1133  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1134 #else
1135  for (j=i; j<strat->sl; j++)
1136  {
1137  strat->fromQ[j] = strat->fromQ[j+1];
1138  }
1139 #endif
1140  }
1141  strat->S[strat->sl] = NULL;
1142  strat->sl--;
1143 }
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:403
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:403
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 4660 of file kutil.cc.

4661 {
4662  if (nIsOne(pGetCoeff(h))) return;
4663  number gcd;
4664  bool go = false;
4665  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4666  {
4667  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4668  go = true;
4669  }
4670  else
4671  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4672  if (go || !nIsOne(gcd))
4673  {
4674  poly p = h->next;
4675  if (!go)
4676  {
4677  number tmp = gcd;
4678  gcd = n_Ann(gcd,currRing->cf);
4679  nDelete(&tmp);
4680  }
4681  p_Test(p,strat->tailRing);
4682  p = pp_Mult_nn(p, gcd, strat->tailRing);
4683  nDelete(&gcd);
4684 
4685  if (p != NULL)
4686  {
4687  if (TEST_OPT_PROT)
4688  {
4689  PrintS("Z");
4690  }
4691 #ifdef KDEBUG
4692  if (TEST_OPT_DEBUG)
4693  {
4694  PrintS("--- create zero spoly: ");
4695  p_wrp(h,currRing,strat->tailRing);
4696  PrintS(" ---> ");
4697  }
4698 #endif
4699  poly tmp = pInit();
4700  pSetCoeff0(tmp, pGetCoeff(p));
4701  for (int i = 1; i <= rVar(currRing); i++)
4702  {
4703  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4704  }
4706  {
4707  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4708  }
4709  p_Setm(tmp, currRing);
4710  p = p_LmFreeAndNext(p, strat->tailRing);
4711  pNext(tmp) = p;
4712  LObject Lp;
4713  Lp.Init();
4714  Lp.p = tmp;
4715  Lp.tailRing = strat->tailRing;
4716  int posx;
4717  if (Lp.p!=NULL)
4718  {
4719  strat->initEcart(&Lp);
4720  if (strat->Ll==-1)
4721  posx =0;
4722  else
4723  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4724  Lp.sev = pGetShortExpVector(Lp.p);
4725  if (strat->tailRing != currRing)
4726  {
4727  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4728  }
4729 #ifdef KDEBUG
4730  if (TEST_OPT_DEBUG)
4731  {
4732  p_wrp(tmp,currRing,strat->tailRing);
4733  PrintLn();
4734  }
4735 #endif
4736  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4737  }
4738  }
4739  }
4740  nDelete(&gcd);
4741 }
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:580
#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:1210
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 4743 of file kutil.cc.

4744 {
4745  if (nIsOne(pGetCoeff(h))) return;
4746  number gcd;
4747  bool go = false;
4748  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4749  {
4750  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4751  go = true;
4752  }
4753  else
4754  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4755  if (go || !nIsOne(gcd))
4756  {
4757  poly p = h->next;
4758  if (!go)
4759  {
4760  number tmp = gcd;
4761  gcd = n_Ann(gcd,currRing->cf);
4762  nDelete(&tmp);
4763  }
4764  p_Test(p,strat->tailRing);
4765  p = pp_Mult_nn(p, gcd, strat->tailRing);
4766 
4767  if (p != NULL)
4768  {
4769  if (TEST_OPT_PROT)
4770  {
4771  PrintS("Z");
4772  }
4773 #ifdef KDEBUG
4774  if (TEST_OPT_DEBUG)
4775  {
4776  PrintS("--- create zero spoly: ");
4777  p_wrp(h,currRing,strat->tailRing);
4778  PrintS(" ---> ");
4779  }
4780 #endif
4781  poly tmp = pInit();
4782  pSetCoeff0(tmp, pGetCoeff(p));
4783  for (int i = 1; i <= rVar(currRing); i++)
4784  {
4785  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4786  }
4788  {
4789  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4790  }
4791  p_Setm(tmp, currRing);
4792  p = p_LmFreeAndNext(p, strat->tailRing);
4793  pNext(tmp) = p;
4794  LObject Lp;
4795  Lp.Init();
4796  Lp.p = tmp;
4797  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4798  #if EXT_POLY_NEW
4799  Lp.sig = pp_Mult_nn(hSig, gcd, currRing);
4800  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4801  {
4802  #ifdef ADIDEBUG
4803  printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig);
4804  #endif
4805  strat->sigdrop = TRUE;
4806  //Try to reduce it as far as we can via redRing
4807  int red_result = redRing(&Lp,strat);
4808  #ifdef ADIDEBUG
4809  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
4810  #endif
4811  if(red_result == 0)
4812  {
4813  // Cancel the sigdrop
4814  #ifdef ADIDEBUG
4815  printf("\nCancel the sigdrop. It reduced to 0\n");
4816  #endif
4817  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4818  strat->sigdrop = FALSE;
4819  return;
4820  }
4821  else
4822  {
4823  #ifdef ADIDEBUG
4824  printf("\nSigdrop. end\n");
4825  #endif
4826  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4827  #if 1
4828  strat->enterS(Lp,0,strat,strat->tl);
4829  #endif
4830  return;
4831  }
4832 
4833  }
4834  #else
4835  Lp.sig = pOne();
4836  if(strat->Ll >= 0)
4837  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4838  else
4839  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4840  #endif
4841  Lp.tailRing = strat->tailRing;
4842  int posx;
4843  if (Lp.p!=NULL)
4844  {
4845  strat->initEcart(&Lp);
4846  if (strat->Ll==-1)
4847  posx =0;
4848  else
4849  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4850  Lp.sev = pGetShortExpVector(Lp.p);
4851  if (strat->tailRing != currRing)
4852  {
4853  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4854  }
4855 #ifdef KDEBUG
4856  if (TEST_OPT_DEBUG)
4857  {
4858  p_wrp(tmp,currRing,strat->tailRing);
4859  PrintLn();
4860  }
4861 #endif
4862  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4863  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4864  }
4865  }
4866  nDelete(&gcd);
4867  }
4868  nDelete(&gcd);
4869 }
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:95
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:580
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:99
#define nIsOne(n)
Definition: numbers.h:25
void pWrite(poly p)
Definition: polys.h:291
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
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:298
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 1210 of file kutil.cc.

1211 {
1212  // this should be corrected
1213  assume(p.FDeg == p.pFDeg());
1214 
1215  if ((*length)>=0)
1216  {
1217  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1218  if (at <= (*length))
1219 #ifdef ENTER_USE_MEMMOVE
1220  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1221 #else
1222  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1223 #endif
1224  }
1225  else at = 0;
1226  (*set)[at] = p;
1227  (*length)++;
1228 }
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:403
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()

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

Definition at line 2217 of file kutil.cc.

2218 {
2219  assume(ALLOW_PROD_CRIT(strat));
2221  assume(strat->syzComp==1);
2222  assume(i<=strat->sl);
2223 
2224  int l,j,compare;
2225  LObject Lp;
2226  Lp.i_r = -1;
2227 
2228 #ifdef KDEBUG
2229  Lp.ecart=0; Lp.length=0;
2230 #endif
2231  /*- computes the lcm(s[i],p) -*/
2232  Lp.lcm = pInit();
2233 
2234  pLcm(p,strat->S[i],Lp.lcm);
2235  pSetm(Lp.lcm);
2236 
2237  if (strat->sugarCrit)
2238  {
2239  if((!((strat->ecartS[i]>0)&&(ecart>0)))
2240  && p_HasNotCF_Lift(p,strat->S[i],currRing))
2241  {
2242  /*
2243  *the product criterion has applied for (s,p),
2244  *i.e. lcm(s,p)=product of the leading terms of s and p.
2245  *Suppose (s,r) is in L and the leading term
2246  *of p divides lcm(s,r)
2247  *(==> the leading term of p divides the leading term of r)
2248  *but the leading term of s does not divide the leading term of r
2249  *(notice that tis condition is automatically satisfied if r is still
2250  *in S), then (s,r) can be cancelled.
2251  *This should be done here because the
2252  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2253  *
2254  *Moreover, skipping (s,r) holds also for the noncommutative case.
2255  */
2256  strat->cp++;
2257  pLmFree(Lp.lcm);
2258  Lp.lcm=NULL;
2259  return;
2260  }
2261  else
2262  Lp.ecart = si_max(ecart,strat->ecartS[i]);
2263  if (strat->fromT && (strat->ecartS[i]>ecart))
2264  {
2265  pLmFree(Lp.lcm);
2266  Lp.lcm=NULL;
2267  return;
2268  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2269  }
2270  /*
2271  *the set B collects the pairs of type (S[j],p)
2272  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2273  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2274  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2275  */
2276  {
2277  j = strat->Bl;
2278  loop
2279  {
2280  if (j < 0) break;
2281  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2282  if ((compare==1)
2283  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2284  {
2285  strat->c3++;
2286  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2287  {
2288  pLmFree(Lp.lcm);
2289  return;
2290  }
2291  break;
2292  }
2293  else
2294  if ((compare ==-1)
2295  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2296  {
2297  deleteInL(strat->B,&strat->Bl,j,strat);
2298  strat->c3++;
2299  }
2300  j--;
2301  }
2302  }
2303  }
2304  else /*sugarcrit*/
2305  {
2306  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2307  p_HasNotCF_Lift(p,strat->S[i],currRing))
2308  {
2309  /*
2310  *the product criterion has applied for (s,p),
2311  *i.e. lcm(s,p)=product of the leading terms of s and p.
2312  *Suppose (s,r) is in L and the leading term
2313  *of p devides lcm(s,r)
2314  *(==> the leading term of p devides the leading term of r)
2315  *but the leading term of s does not devide the leading term of r
2316  *(notice that tis condition is automatically satisfied if r is still
2317  *in S), then (s,r) can be canceled.
2318  *This should be done here because the
2319  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2320  */
2321  strat->cp++;
2322  pLmFree(Lp.lcm);
2323  Lp.lcm=NULL;
2324  return;
2325  }
2326  if (strat->fromT && (strat->ecartS[i]>ecart))
2327  {
2328  pLmFree(Lp.lcm);
2329  Lp.lcm=NULL;
2330  return;
2331  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2332  }
2333  /*
2334  *the set B collects the pairs of type (S[j],p)
2335  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2336  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2337  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2338  */
2339  for(j = strat->Bl;j>=0;j--)
2340  {
2341  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2342  if (compare==1)
2343  {
2344  strat->c3++;
2345  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2346  {
2347  pLmFree(Lp.lcm);
2348  return;
2349  }
2350  break;
2351  }
2352  else
2353  if (compare ==-1)
2354  {
2355  deleteInL(strat->B,&strat->Bl,j,strat);
2356  strat->c3++;
2357  }
2358  }
2359  }
2360  /*
2361  *the pair (S[i],p) enters B if the spoly != 0
2362  */
2363  /*- compute the short s-polynomial -*/
2364  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2365  pNorm(p);
2366 
2367  if ((strat->S[i]==NULL) || (p==NULL))
2368  return;
2369 
2370  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2371  Lp.p=NULL;
2372  else
2373  {
2375  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2376  }
2377  if (Lp.p == NULL)
2378  {
2379  /*- the case that the s-poly is 0 -*/
2380  if (strat->pairtest==NULL) initPairtest(strat);
2381  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2382  strat->pairtest[strat->sl+1] = TRUE;
2383  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2384  /*
2385  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2386  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2387  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2388  *term of p devides the lcm(s,r)
2389  *(this canceling should be done here because
2390  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2391  *the first case is handeled in chainCrit
2392  */
2393  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2394  }
2395  else
2396  {
2397  /*- the pair (S[i],p) enters B -*/
2398  Lp.p1 = strat->S[i];
2399  Lp.p2 = p;
2400 
2401  pNext(Lp.p) = strat->tail; // !!!
2402 
2403  if (atR >= 0)
2404  {
2405  Lp.i_r1 = strat->S_2_R[i];
2406  Lp.i_r2 = atR;
2407  }
2408  else
2409  {
2410  Lp.i_r1 = -1;
2411  Lp.i_r2 = -1;
2412  }
2413  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2414 
2416  {
2417  nDelete(&(Lp.p->coef));
2418  }
2419 
2420  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2421  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2422  }
2423 }
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:2200
#define TRUE
Definition: auxiliary.h:99
#define pLcm(a, b, m)
Definition: polys.h:278
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:1210
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:1148
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:403
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:121
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:346
#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:1267
int l
Definition: cfEzgcd.cc:94

§ enterOnePairManyShifts()

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

Definition at line 12175 of file kutil.cc.

12176 {
12177  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12178 
12181 
12182  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12183  /* that is create the pairs (f, s \dot g) */
12184 
12185  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
12186 
12187  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12188  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12189 
12190  /* determine how many elements we have to insert for a given s[i] */
12191  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12192  /* hence, a total number of elt's to add is: */
12193  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12194  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12195 
12196 #ifdef KDEBUG
12197  if (TEST_OPT_DEBUG)
12198  {
12199  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
12200  }
12201 #endif
12202 
12203  assume(i<=strat->sl); // from OnePair
12204 
12205  /* these vars hold for all shifts of s[i] */
12206  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12207 
12208  int qfromQ;
12209  if (strat->fromQ != NULL)
12210  {
12211  qfromQ = strat->fromQ[i];
12212  }
12213  else
12214  {
12215  qfromQ = -1;
12216  }
12217 
12218  int j;
12219 
12220  poly q/*, s*/;
12221 
12222  // for the 0th shift: insert the orig. pair
12223  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12224 
12225  for (j=1; j<= toInsert; j++)
12226  {
12227  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12228  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12229  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12230  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12231  // pNext(q) = s; // in tailRing
12232  /* here we need to call enterOnePair with two polys ... */
12233 
12234 #ifdef KDEBUG
12235  //if (TEST_OPT_DEBUG)
12236  //{
12237  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
12238  //}
12239 #endif
12240  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12241  }
12242 }
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:12313
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:403
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 1934 of file kutil.cc.

1935 {
1936  assume(i<=strat->sl);
1937 
1938  int l,j,compare;
1939  LObject Lp;
1940  Lp.i_r = -1;
1941 
1942 #ifdef KDEBUG
1943  Lp.ecart=0; Lp.length=0;
1944 #endif
1945  /*- computes the lcm(s[i],p) -*/
1946  Lp.lcm = pInit();
1947 
1948 #ifndef HAVE_RATGRING
1949  pLcm(p,strat->S[i],Lp.lcm);
1950 #elif defined(HAVE_RATGRING)
1951  if (rIsRatGRing(currRing))
1952  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1953  else
1954  pLcm(p,strat->S[i],Lp.lcm);
1955 #endif
1956  pSetm(Lp.lcm);
1957 
1958 
1959  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1960  {
1961  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1962  && pHasNotCF(p,strat->S[i]))
1963  {
1964  /*
1965  *the product criterion has applied for (s,p),
1966  *i.e. lcm(s,p)=product of the leading terms of s and p.
1967  *Suppose (s,r) is in L and the leading term
1968  *of p divides lcm(s,r)
1969  *(==> the leading term of p divides the leading term of r)
1970  *but the leading term of s does not divide the leading term of r
1971  *(notice that tis condition is automatically satisfied if r is still
1972  *in S), then (s,r) can be cancelled.
1973  *This should be done here because the
1974  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1975  *
1976  *Moreover, skipping (s,r) holds also for the noncommutative case.
1977  */
1978  strat->cp++;
1979  pLmFree(Lp.lcm);
1980  Lp.lcm=NULL;
1981  return;
1982  }
1983  else
1984  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1985  if (strat->fromT && (strat->ecartS[i]>ecart))
1986  {
1987  pLmFree(Lp.lcm);
1988  Lp.lcm=NULL;
1989  return;
1990  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1991  }
1992  /*
1993  *the set B collects the pairs of type (S[j],p)
1994  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1995  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1996  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1997  */
1998  {
1999  j = strat->Bl;
2000  loop
2001  {
2002  if (j < 0) break;
2003  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2004  if ((compare==1)
2005  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2006  {
2007  strat->c3++;
2008  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2009  {
2010  pLmFree(Lp.lcm);
2011  return;
2012  }
2013  break;
2014  }
2015  else
2016  if ((compare ==-1)
2017  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2018  {
2019  deleteInL(strat->B,&strat->Bl,j,strat);
2020  strat->c3++;
2021  }
2022  j--;
2023  }
2024  }
2025  }
2026  else /*sugarcrit*/
2027  {
2028  if (ALLOW_PROD_CRIT(strat))
2029  {
2030  // if currRing->nc_type!=quasi (or skew)
2031  // TODO: enable productCrit for super commutative algebras...
2032  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2033  pHasNotCF(p,strat->S[i]))
2034  {
2035  /*
2036  *the product criterion has applied for (s,p),
2037  *i.e. lcm(s,p)=product of the leading terms of s and p.
2038  *Suppose (s,r) is in L and the leading term
2039  *of p devides lcm(s,r)
2040  *(==> the leading term of p devides the leading term of r)
2041  *but the leading term of s does not devide the leading term of r
2042  *(notice that tis condition is automatically satisfied if r is still
2043  *in S), then (s,r) can be canceled.
2044  *This should be done here because the
2045  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2046  */
2047  strat->cp++;
2048  pLmFree(Lp.lcm);
2049  Lp.lcm=NULL;
2050  return;
2051  }
2052  if (strat->fromT && (strat->ecartS[i]>ecart))
2053  {
2054  pLmFree(Lp.lcm);
2055  Lp.lcm=NULL;
2056  return;
2057  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2058  }
2059  /*
2060  *the set B collects the pairs of type (S[j],p)
2061  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2062  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2063  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2064  */
2065  for(j = strat->Bl;j>=0;j--)
2066  {
2067  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2068  if (compare==1)
2069  {
2070  strat->c3++;
2071  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2072  {
2073  pLmFree(Lp.lcm);
2074  return;
2075  }
2076  break;
2077  }
2078  else
2079  if (compare ==-1)
2080  {
2081  deleteInL(strat->B,&strat->Bl,j,strat);
2082  strat->c3++;
2083  }
2084  }
2085  }
2086  }
2087  /*
2088  *the pair (S[i],p) enters B if the spoly != 0
2089  */
2090  /*- compute the short s-polynomial -*/
2091  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2092  pNorm(p);
2093 
2094  if ((strat->S[i]==NULL) || (p==NULL))
2095  return;
2096 
2097  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2098  Lp.p=NULL;
2099  else
2100  {
2101  #ifdef HAVE_PLURAL
2102  if ( rIsPluralRing(currRing) )
2103  {
2104  if(pHasNotCF(p, strat->S[i]))
2105  {
2106  if(ncRingType(currRing) == nc_lie)
2107  {
2108  // generalized prod-crit for lie-type
2109  strat->cp++;
2110  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2111  }
2112  else
2113  if( ALLOW_PROD_CRIT(strat) )
2114  {
2115  // product criterion for homogeneous case in SCA
2116  strat->cp++;
2117  Lp.p = NULL;
2118  }
2119  else
2120  {
2121  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2122  nc_CreateShortSpoly(strat->S[i], p, currRing);
2123  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2124  pNext(Lp.p) = strat->tail; // !!!
2125  }
2126  }
2127  else
2128  {
2129  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2130  nc_CreateShortSpoly(strat->S[i], p, currRing);
2131 
2132  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2133  pNext(Lp.p) = strat->tail; // !!!
2134  }
2135  }
2136  else
2137  #endif
2138  {
2140  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2141  }
2142  }
2143  if (Lp.p == NULL)
2144  {
2145  /*- the case that the s-poly is 0 -*/
2146  if (strat->pairtest==NULL) initPairtest(strat);
2147  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2148  strat->pairtest[strat->sl+1] = TRUE;
2149  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2150  /*
2151  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2152  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2153  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2154  *term of p devides the lcm(s,r)
2155  *(this canceling should be done here because
2156  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2157  *the first case is handeled in chainCrit
2158  */
2159  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2160  }
2161  else
2162  {
2163  /*- the pair (S[i],p) enters B -*/
2164  Lp.p1 = strat->S[i];
2165  Lp.p2 = p;
2166 
2167  if (
2169 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2170  )
2171  {
2172  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2173  pNext(Lp.p) = strat->tail; // !!!
2174  }
2175 
2176  if (atR >= 0)
2177  {
2178  Lp.i_r1 = strat->S_2_R[i];
2179  Lp.i_r2 = atR;
2180  }
2181  else
2182  {
2183  Lp.i_r1 = -1;
2184  Lp.i_r2 = -1;
2185  }
2186  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2187 
2189  {
2190  if (!rIsPluralRing(currRing))
2191  nDelete(&(Lp.p->coef));
2192  }
2193 
2194  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2195  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2196  }
2197 }
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:99
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:278
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:1210
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:1148
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:403
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:121
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:346
#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:1267
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ enterOnePairRing()

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

Definition at line 1276 of file kutil.cc.

1277 {
1278  assume(atR >= 0);
1279  assume(i<=strat->sl);
1280  assume(p!=NULL);
1281  #if ALL_VS_JUST
1282  //Over rings, if we construct the strong pair, do not add the spair
1284  {
1285  number s,t,d;
1286  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1287 
1288  if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
1289  {
1290  nDelete(&d);
1291  nDelete(&s);
1292  nDelete(&t);
1293  return;
1294  }
1295  nDelete(&d);
1296  nDelete(&s);
1297  nDelete(&t);
1298  }
1299  #endif
1300  int l,j,compare,compareCoeff;
1301  LObject h;
1302 
1303 #ifdef KDEBUG
1304  h.ecart=0; h.length=0;
1305 #endif
1306  /*- computes the lcm(s[i],p) -*/
1307  h.lcm = pInit();
1308  pSetCoeff0(h.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
1309  if (nIsZero(pGetCoeff(h.lcm)))
1310  {
1311  strat->cp++;
1312  pLmDelete(h.lcm);
1313  return;
1314  }
1315  // basic chain criterion
1316  pLcm(p,strat->S[i],h.lcm);
1317  pSetm(h.lcm);
1318  /*
1319  *the set B collects the pairs of type (S[j],p)
1320  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
1321  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1322  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1323  */
1324 
1325  for(j = strat->Bl;j>=0;j--)
1326  {
1327  compare=pDivCompRing(strat->B[j].lcm,h.lcm);
1328  compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(h.lcm), currRing->cf);
1329  #ifdef ADIDEBUG
1330  printf("\nChainCrit in enteronepairring\n");
1331  printf("\nB[j]\n");
1332  pWrite(strat->B[j].p);
1333  pWrite(strat->B[j].p1);
1334  pWrite(strat->B[j].p2);
1335  pWrite(strat->B[j].lcm);
1336  printf("\nh - neue Paar\n");
1337  pWrite(h.p);
1338  pWrite(p);
1339  pWrite(strat->S[i]);
1340  pWrite(h.lcm);
1341  printf("\ncompare = %i\ncompareCoeff = %i\n",compare,compareCoeff);
1342  #endif
1343  if(compare == pDivComp_EQUAL)
1344  {
1345  //They have the same LM
1346  if(compareCoeff == pDivComp_LESS)
1347  {
1348  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1349  {
1350  #ifdef ADIDEBUG
1351  printf("\nGelöscht h\n");
1352  #endif
1353  strat->c3++;
1354  pLmDelete(h.lcm);
1355  return;
1356  }
1357  break;
1358  }
1359  if(compareCoeff == pDivComp_GREATER)
1360  {
1361  #ifdef ADIDEBUG
1362  printf("\nGelöscht: B[j]\n");
1363  #endif
1364  deleteInL(strat->B,&strat->Bl,j,strat);
1365  strat->c3++;
1366  }
1367  if(compareCoeff == pDivComp_EQUAL)
1368  {
1369  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1370  {
1371  #ifdef ADIDEBUG
1372  printf("\nGelöscht h\n");
1373  #endif
1374  strat->c3++;
1375  pLmDelete(h.lcm);
1376  return;
1377  }
1378  break;
1379  }
1380  }
1381  if(compareCoeff == compare || compareCoeff == pDivComp_EQUAL)
1382  {
1383  if(compare == pDivComp_LESS)
1384  {
1385  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1386  {
1387  #ifdef ADIDEBUG
1388  printf("\nGelöscht h\n");
1389  #endif
1390  strat->c3++;
1391  pLmDelete(h.lcm);
1392  return;
1393  }
1394  break;
1395  }
1396  if(compare == pDivComp_GREATER)
1397  {
1398  #ifdef ADIDEBUG
1399  printf("\nGelöscht: B[j]\n");
1400  #endif
1401  deleteInL(strat->B,&strat->Bl,j,strat);
1402  strat->c3++;
1403  }
1404  }
1405  }
1406  number s, t;
1407  poly m1, m2, gcd = NULL;
1408  #ifdef ADIDEBUG
1409  printf("\nTrying to add spair S[%i] und p\n",i);pWrite(strat->S[i]);pWrite(p);
1410  #endif
1411  s = pGetCoeff(strat->S[i]);
1412  t = pGetCoeff(p);
1413  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
1414  ksCheckCoeff(&s, &t, currRing->cf);
1415  pSetCoeff0(m1, s);
1416  pSetCoeff0(m2, t);
1417  m2 = pNeg(m2);
1418  p_Test(m1,strat->tailRing);
1419  p_Test(m2,strat->tailRing);
1420  poly si = pCopy(strat->S[i]);
1421  poly pm1 = pp_Mult_mm(pNext(p), m1, strat->tailRing);
1422  poly sim2 = pp_Mult_mm(pNext(si), m2, strat->tailRing);
1423  pDelete(&si);
1424  if(sim2 == NULL)
1425  {
1426  pDelete(&m1);
1427  pDelete(&m2);
1428  if(pm1 == NULL)
1429  {
1430  if(h.lcm != NULL)
1431  pDelete(&h.lcm);
1432  h.Clear();
1433  if (strat->pairtest==NULL) initPairtest(strat);
1434  strat->pairtest[i] = TRUE;
1435  strat->pairtest[strat->sl+1] = TRUE;
1436  return;
1437  }
1438  else
1439  {
1440  gcd = pm1;
1441  pm1 = NULL;
1442  }
1443  }
1444  else
1445  {
1446  if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
1447  {
1448  p_SetCompP(sim2, pGetComp(p), strat->tailRing);
1449  pSetmComp(sim2);
1450  }
1451  //p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
1452  gcd = p_Add_q(pm1, sim2, strat->tailRing);
1453  }
1454  p_Test(gcd, strat->tailRing);
1455  //p_LmDelete(m1, strat->tailRing);
1456  //p_LmDelete(m2, strat->tailRing);
1457 #ifdef KDEBUG
1458  if (TEST_OPT_DEBUG)
1459  {
1460  wrp(gcd);
1461  PrintLn();
1462  }
1463 #endif
1464  h.p = gcd;
1465  h.i_r = -1;
1466  if(h.p == NULL)
1467  {
1468  if (strat->pairtest==NULL) initPairtest(strat);
1469  strat->pairtest[i] = TRUE;
1470  strat->pairtest[strat->sl+1] = TRUE;
1471  return;
1472  }
1473  h.tailRing = strat->tailRing;
1474  int posx;
1475  //h.pCleardenom();
1476  //pSetm(h.p);
1477  #ifdef ADIDEBUG
1478  printf("\nThis is afterwards:\n");
1479  pWrite(h.p);
1480  #endif
1481  h.i_r1 = -1;h.i_r2 = -1;
1482  strat->initEcart(&h);
1483  #if 1
1484  h.p2 = strat->S[i];
1485  h.p1 = p;
1486  #endif
1487  #if 1
1488  if (atR >= 0)
1489  {
1490  h.i_r1 = atR;
1491  h.i_r2 = strat->S_2_R[i];
1492  }
1493  #endif
1494  if (strat->Bl==-1)
1495  posx =0;
1496  else
1497  posx = strat->posInL(strat->B,strat->Bl,&h,strat);
1498  h.sev = pGetShortExpVector(h.p);
1499  if (currRing!=strat->tailRing)
1500  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1501  #ifdef ADIDEBUG
1502  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);
1503  #endif
1504  enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
1505  kTest_TS(strat);
1506 }
#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:99
#define pLcm(a, b, m)
Definition: polys.h:278
void pWrite(poly p)
Definition: polys.h:291
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
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:1148
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:655
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
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:293
#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
int l
Definition: cfEzgcd.cc:94
#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 12250 of file kutil.cc.

12251 {
12252 
12253  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12254  /* for true self pairs qq ==p */
12255  /* we test both qq and p */
12257  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12260 
12261  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12262 
12263  // int j = 0;
12264  int j = 1;
12265 
12266  /* for such self pairs start with 1, not with 0 */
12267  if (qq == p) j=1;
12268 
12269  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12270  /* that is create the pairs (f, s \dot g) */
12271 
12272  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12273 
12274 #ifdef KDEBUG
12275  //if (TEST_OPT_DEBUG)
12276  //{
12277  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12278  //}
12279 #endif
12280 
12281  poly q;
12282 
12283  /* these vars hold for all shifts of s[i] */
12284  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12285  int qfromQ = 0; // strat->fromQ[i];
12286 
12287  for (; j<= toInsert; j++)
12288  {
12289  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12290  /* we increase shifts by one; must delete q there*/
12291  // q = qq; q = pMoveCurrTail2poly(q,strat);
12292  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12293  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12294  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12295  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12296  // pNext(q) = s; // in tailRing
12297  /* here we need to call enterOnePair with two polys ... */
12298 #ifdef KDEBUG
12299  //if (TEST_OPT_DEBUG)
12300  //{
12301  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12302  //}
12303 #endif
12304  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12305  }
12306 }
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:12313
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:403
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 12313 of file kutil.cc.

12314 {
12315 
12316  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12317 
12318  /* check this Formats: */
12320  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12323 
12324 #ifdef KDEBUG
12325 // if (TEST_OPT_DEBUG)
12326 // {
12327 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12328 // wrp(q); // wrp(pHead(q));
12329 // PrintS(", p = ");
12330 // wrp(p); //wrp(pHead(p));
12331 // PrintLn();
12332 // }
12333 #endif
12334 
12335  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12336 
12337  int qfromQ = qisFromQ;
12338 
12339  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12340 
12341  int l,j,compare;
12342  LObject Lp;
12343  Lp.i_r = -1;
12344 
12345 #ifdef KDEBUG
12346  Lp.ecart=0; Lp.length=0;
12347 #endif
12348  /*- computes the lcm(s[i],p) -*/
12349  Lp.lcm = pInit();
12350 
12351  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
12352  pSetm(Lp.lcm);
12353 
12354  /* apply the V criterion */
12355  if (!isInV(Lp.lcm, lV))
12356  {
12357 #ifdef KDEBUG
12358  if (TEST_OPT_DEBUG)
12359  {
12360  PrintS("V crit applied to q = ");
12361  wrp(q); // wrp(pHead(q));
12362  PrintS(", p = ");
12363  wrp(p); //wrp(pHead(p));
12364  PrintLn();
12365  }
12366 #endif
12367  pLmFree(Lp.lcm);
12368  Lp.lcm=NULL;
12369  /* + counter for applying the V criterion */
12370  strat->cv++;
12371  return;
12372  }
12373 
12374  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12375  {
12376  if((!((ecartq>0)&&(ecart>0)))
12377  && pHasNotCF(p,q))
12378  {
12379  /*
12380  *the product criterion has applied for (s,p),
12381  *i.e. lcm(s,p)=product of the leading terms of s and p.
12382  *Suppose (s,r) is in L and the leading term
12383  *of p divides lcm(s,r)
12384  *(==> the leading term of p divides the leading term of r)
12385  *but the leading term of s does not divide the leading term of r
12386  *(notice that this condition is automatically satisfied if r is still
12387  *in S), then (s,r) can be cancelled.
12388  *This should be done here because the
12389  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12390  *
12391  *Moreover, skipping (s,r) holds also for the noncommutative case.
12392  */
12393  strat->cp++;
12394  pLmFree(Lp.lcm);
12395  Lp.lcm=NULL;
12396  return;
12397  }
12398  else
12399  Lp.ecart = si_max(ecart,ecartq);
12400  if (strat->fromT && (ecartq>ecart))
12401  {
12402  pLmFree(Lp.lcm);
12403  Lp.lcm=NULL;
12404  return;
12405  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12406  }
12407  /*
12408  *the set B collects the pairs of type (S[j],p)
12409  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12410  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12411  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12412  */
12413  {
12414  j = strat->Bl;
12415  loop
12416  {
12417  if (j < 0) break;
12418  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12419  if ((compare==1)
12420  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12421  {
12422  strat->c3++;
12423  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12424  {
12425  pLmFree(Lp.lcm);
12426  return;
12427  }
12428  break;
12429  }
12430  else
12431  if ((compare ==-1)
12432  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12433  {
12434  deleteInL(strat->B,&strat->Bl,j,strat);
12435  strat->c3++;
12436  }
12437  j--;
12438  }
12439  }
12440  }
12441  else /*sugarcrit*/
12442  {
12443  if (ALLOW_PROD_CRIT(strat))
12444  {
12445  // if currRing->nc_type!=quasi (or skew)
12446  // TODO: enable productCrit for super commutative algebras...
12447  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12448  pHasNotCF(p,q))
12449  {
12450  /*
12451  *the product criterion has applied for (s,p),
12452  *i.e. lcm(s,p)=product of the leading terms of s and p.
12453  *Suppose (s,r) is in L and the leading term
12454  *of p devides lcm(s,r)
12455  *(==> the leading term of p devides the leading term of r)
12456  *but the leading term of s does not devide the leading term of r
12457  *(notice that tis condition is automatically satisfied if r is still
12458  *in S), then (s,r) can be canceled.
12459  *This should be done here because the
12460  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12461  */
12462  strat->cp++;
12463  pLmFree(Lp.lcm);
12464  Lp.lcm=NULL;
12465  return;
12466  }
12467  if (strat->fromT && (ecartq>ecart))
12468  {
12469  pLmFree(Lp.lcm);
12470  Lp.lcm=NULL;
12471  return;
12472  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12473  }
12474  /*
12475  *the set B collects the pairs of type (S[j],p)
12476  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12477  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12478  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12479  */
12480  for(j = strat->Bl;j>=0;j--)
12481  {
12482  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12483  if (compare==1)
12484  {
12485  strat->c3++;
12486  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12487  {
12488  pLmFree(Lp.lcm);
12489  return;
12490  }
12491  break;
12492  }
12493  else
12494  if (compare ==-1)
12495  {
12496  deleteInL(strat->B,&strat->Bl,j,strat);
12497  strat->c3++;
12498  }
12499  }
12500  }
12501  }
12502  /*
12503  *the pair (S[i],p) enters B if the spoly != 0
12504  */
12505  /*- compute the short s-polynomial -*/
12506  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12507  pNorm(p);
12508  if ((q==NULL) || (p==NULL))
12509  return;
12510  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12511  Lp.p=NULL;
12512  else
12513  {
12514 // if ( rIsPluralRing(currRing) )
12515 // {
12516 // if(pHasNotCF(p, q))
12517 // {
12518 // if(ncRingType(currRing) == nc_lie)
12519 // {
12520 // // generalized prod-crit for lie-type
12521 // strat->cp++;
12522 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12523 // }
12524 // else
12525 // if( ALLOW_PROD_CRIT(strat) )
12526 // {
12527 // // product criterion for homogeneous case in SCA
12528 // strat->cp++;
12529 // Lp.p = NULL;
12530 // }
12531 // else
12532 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12533 // }
12534 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12535 // }
12536 // else
12537 // {
12538 
12539  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12540  /* p is already in this form, so convert q */
12541  // q = pMove2CurrTail(q, strat);
12542  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12543  // }
12544  }
12545  if (Lp.p == NULL)
12546  {
12547  /*- the case that the s-poly is 0 -*/
12548  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12549 // if (strat->pairtest==NULL) initPairtest(strat);
12550 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12551 // strat->pairtest[strat->sl+1] = TRUE;
12552  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12553  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12554  /*
12555  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12556  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12557  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12558  *term of p devides the lcm(s,r)
12559  *(this canceling should be done here because
12560  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12561  *the first case is handeled in chainCrit
12562  */
12563  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12564  }
12565  else
12566  {
12567  /*- the pair (S[i],p) enters B -*/
12568  /* both of them should have their LM in currRing and TAIL in tailring */
12569  Lp.p1 = q; // already in the needed form
12570  Lp.p2 = p; // already in the needed form
12571 
12572  if ( !rIsPluralRing(currRing) )
12573  pNext(Lp.p) = strat->tail;
12574 
12575  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12576  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12577  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12578  {
12579  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12580  Lp.i_r2 = atR;
12581  }
12582  else
12583  {
12584  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12585  Lp.i_r1 = -1;
12586  Lp.i_r2 = -1;
12587  }
12588  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12589 
12591  {
12592  if (!rIsPluralRing(currRing))
12593  nDelete(&(Lp.p->coef));
12594  }
12595 
12596  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12597  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12598  }
12599 }
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:278
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:1210
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:1148
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:403
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:121
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:346
#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:293
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1267
int l
Definition: cfEzgcd.cc:94

§ enterOnePairSig()

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

Definition at line 2433 of file kutil.cc.

2435 {
2436  assume(i<=strat->sl);
2437 
2438  int l;
2439  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2440  // the corresponding signatures for criteria checks
2441  LObject Lp;
2442  poly pSigMult = p_Copy(pSig,currRing);
2443  poly sSigMult = p_Copy(strat->sig[i],currRing);
2444  unsigned long pSigMultNegSev,sSigMultNegSev;
2445  Lp.i_r = -1;
2446 
2447 #ifdef KDEBUG
2448  Lp.ecart=0; Lp.length=0;
2449 #endif
2450  /*- computes the lcm(s[i],p) -*/
2451  Lp.lcm = pInit();
2452  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2453 #ifndef HAVE_RATGRING
2454  pLcm(p,strat->S[i],Lp.lcm);
2455 #elif defined(HAVE_RATGRING)
2456  // if (rIsRatGRing(currRing))
2457  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2458 #endif
2459  pSetm(Lp.lcm);
2460 
2461  // set coeffs of multipliers m1 and m2
2462  pSetCoeff0(m1, nInit(1));
2463  pSetCoeff0(m2, nInit(1));
2464 //#if 1
2465 #ifdef DEBUGF5
2466  PrintS("P1 ");
2467  pWrite(pHead(p));
2468  PrintS("P2 ");
2469  pWrite(pHead(strat->S[i]));
2470  PrintS("M1 ");
2471  pWrite(m1);
2472  PrintS("M2 ");
2473  pWrite(m2);
2474 #endif
2475  // get multiplied signatures for testing
2476  pSigMult = currRing->p_Procs->pp_Mult_mm(pSigMult,m1,currRing);
2477  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2478  sSigMult = currRing->p_Procs->pp_Mult_mm(sSigMult,m2,currRing);
2479  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2480 
2481 //#if 1
2482 #ifdef DEBUGF5
2483  PrintS("----------------\n");
2484  pWrite(pSigMult);
2485  pWrite(sSigMult);
2486  PrintS("----------------\n");
2487  Lp.checked = 0;
2488 #endif
2489  int sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2490 //#if 1
2491 #if DEBUGF5
2492  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2493  pWrite(pSigMult);
2494  pWrite(sSigMult);
2495 #endif
2496  if(sigCmp==0)
2497  {
2498  // printf("!!!! EQUAL SIGS !!!!\n");
2499  // pSig = sSig, delete element due to Rewritten Criterion
2500  pDelete(&pSigMult);
2501  pDelete(&sSigMult);
2502  if (rField_is_Ring(currRing))
2503  pLmDelete(Lp.lcm);
2504  else
2505  pLmFree(Lp.lcm);
2506  Lp.lcm=NULL;
2507  pDelete (&m1);
2508  pDelete (&m2);
2509  return;
2510  }
2511  // testing by syzCrit = F5 Criterion
2512  // testing by rewCrit1 = Rewritten Criterion
2513  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2514  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2515  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2516  || strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2517  )
2518  {
2519  pDelete(&pSigMult);
2520  pDelete(&sSigMult);
2521  if (rField_is_Ring(currRing))
2522  pLmDelete(Lp.lcm);
2523  else
2524  pLmFree(Lp.lcm);
2525  Lp.lcm=NULL;
2526  pDelete (&m1);
2527  pDelete (&m2);
2528  return;
2529  }
2530  /*
2531  *the pair (S[i],p) enters B if the spoly != 0
2532  */
2533  /*- compute the short s-polynomial -*/
2534  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2535  pNorm(p);
2536 
2537  if ((strat->S[i]==NULL) || (p==NULL))
2538  return;
2539 
2540  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2541  Lp.p=NULL;
2542  else
2543  {
2544  #ifdef HAVE_PLURAL
2545  if ( rIsPluralRing(currRing) )
2546  {
2547  if(pHasNotCF(p, strat->S[i]))
2548  {
2549  if(ncRingType(currRing) == nc_lie)
2550  {
2551  // generalized prod-crit for lie-type
2552  strat->cp++;
2553  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2554  }
2555  else
2556  if( ALLOW_PROD_CRIT(strat) )
2557  {
2558  // product criterion for homogeneous case in SCA
2559  strat->cp++;
2560  Lp.p = NULL;
2561  }
2562  else
2563  {
2564  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2565  nc_CreateShortSpoly(strat->S[i], p, currRing);
2566 
2567  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2568  pNext(Lp.p) = strat->tail; // !!!
2569  }
2570  }
2571  else
2572  {
2573  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2574  nc_CreateShortSpoly(strat->S[i], p, currRing);
2575 
2576  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2577  pNext(Lp.p) = strat->tail; // !!!
2578  }
2579  }
2580  else
2581  #endif
2582  {
2584  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2585  }
2586  }
2587  // store from which element this pair comes from for further tests
2588  //Lp.from = strat->sl+1;
2589  if(sigCmp==currRing->OrdSgn)
2590  {
2591  // pSig > sSig
2592  pDelete (&sSigMult);
2593  Lp.sig = pSigMult;
2594  Lp.sevSig = ~pSigMultNegSev;
2595  }
2596  else
2597  {
2598  // pSig < sSig
2599  pDelete (&pSigMult);
2600  Lp.sig = sSigMult;
2601  Lp.sevSig = ~sSigMultNegSev;
2602  }
2603  if (Lp.p == NULL)
2604  {
2605  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2606  int pos = posInSyz(strat, Lp.sig);
2607  enterSyz(Lp, strat, pos);
2608  }
2609  else
2610  {
2611  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
2612  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
2613  {
2614  pLmFree(Lp.lcm);
2615  pDelete(&Lp.sig);
2616  Lp.lcm=NULL;
2617  pDelete (&m1);
2618  pDelete (&m2);
2619  return;
2620  }
2621  // in any case Lp is checked up to the next strat->P which is added
2622  // to S right after this critical pair creation.
2623  // NOTE: this even holds if the 2nd generator gives the bigger signature
2624  // moreover, this improves rewCriterion,
2625  // i.e. strat->checked > strat->from if and only if the 2nd generator
2626  // gives the bigger signature.
2627  Lp.checked = strat->sl+1;
2628  // at this point it is clear that the pair will be added to L, since it has
2629  // passed all tests up to now
2630 
2631  // adds buchberger's first criterion
2632  if (pLmCmp(m2,pHead(p)) == 0)
2633  {
2634  Lp.prod_crit = TRUE; // Product Criterion
2635 #if 0
2636  int pos = posInSyz(strat, Lp.sig);
2637  enterSyz(Lp, strat, pos);
2638  Lp.lcm=NULL;
2639  pDelete (&m1);
2640  pDelete (&m2);
2641  return;
2642 #endif
2643  }
2644  pDelete (&m1);
2645  pDelete (&m2);
2646 #if DEBUGF5
2647  PrintS("SIGNATURE OF PAIR: ");
2648  pWrite(Lp.sig);
2649 #endif
2650  /*- the pair (S[i],p) enters B -*/
2651  Lp.p1 = strat->S[i];
2652  Lp.p2 = p;
2653 
2654  if (
2656 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2657  )
2658  {
2659  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2660  pNext(Lp.p) = strat->tail; // !!!
2661  }
2662 
2663  if (atR >= 0)
2664  {
2665  Lp.i_r1 = strat->S_2_R[i];
2666  Lp.i_r2 = atR;
2667  }
2668  else
2669  {
2670  Lp.i_r1 = -1;
2671  Lp.i_r2 = -1;
2672  }
2673  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2674 
2676  {
2677  if (!rIsPluralRing(currRing))
2678  nDelete(&(Lp.p->coef));
2679  }
2680 
2681  l = strat->posInLSba(strat->B,strat->Bl,&Lp,strat);
2682  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2683  }
2684 }
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:99
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:278
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:291
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:1210
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:403
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:4588
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:6361
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
#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:9677
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ enterOnePairSigRing()

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

Definition at line 2690 of file kutil.cc.

2692 {
2693  #ifdef ADIDEBUG
2694  printf("\nTrying to add p and S[%i]\n",i);
2695  pWrite(p);pWrite(pSig);
2696  pWrite(strat->S[i]);pWrite(strat->sig[i]);
2697  #endif
2698  #if ALL_VS_JUST
2699  //Over rings, if we construct the strong pair, do not add the spair
2701  {
2702  number s,t,d;
2703  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
2704 
2705  if (!nIsZero(s) && !nIsZero(t)) // evtl. durch divBy tests ersetzen
2706  {
2707  nDelete(&d);
2708  nDelete(&s);
2709  nDelete(&t);
2710  return;
2711  }
2712  nDelete(&d);
2713  nDelete(&s);
2714  nDelete(&t);
2715  }
2716  #endif
2717  assume(i<=strat->sl);
2718  int l;
2719  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
2720  // the corresponding signatures for criteria checks
2721  LObject Lp;
2722  poly pSigMult = p_Copy(pSig,currRing);
2723  poly sSigMult = p_Copy(strat->sig[i],currRing);
2724  unsigned long pSigMultNegSev,sSigMultNegSev;
2725  Lp.i_r = -1;
2726 
2727 #ifdef KDEBUG
2728  Lp.ecart=0; Lp.length=0;
2729 #endif
2730  /*- computes the lcm(s[i],p) -*/
2731  Lp.lcm = pInit();
2732  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
2733 #ifndef HAVE_RATGRING
2734  pLcm(p,strat->S[i],Lp.lcm);
2735 #elif defined(HAVE_RATGRING)
2736  // if (rIsRatGRing(currRing))
2737  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
2738 #endif
2739  pSetm(Lp.lcm);
2740 
2741  // set coeffs of multipliers m1 and m2
2743  {
2744  number s = nCopy(pGetCoeff(strat->S[i]));
2745  number t = nCopy(pGetCoeff(p));
2746  pSetCoeff0(Lp.lcm, n_Lcm(s, t, currRing->cf));
2747  ksCheckCoeff(&s, &t, currRing->cf);
2748  pSetCoeff0(m1,s);
2749  pSetCoeff0(m2,t);
2750  #ifdef ADIDEBUG
2751  printf("\nIn Spoly: m1, m2 :\n");pWrite(m1);pWrite(m2);
2752  #endif
2753  }
2754  else
2755  {
2756  pSetCoeff0(m1, nInit(1));
2757  pSetCoeff0(m2, nInit(1));
2758  }
2759 #ifdef DEBUGF5
2760  Print("P1 ");
2761  pWrite(pHead(p));
2762  Print("P2 ");
2763  pWrite(pHead(strat->S[i]));
2764  Print("M1 ");
2765  pWrite(m1);
2766  Print("M2 ");
2767  pWrite(m2);
2768 #endif
2769 
2770  // get multiplied signatures for testing
2771  pSigMult = pp_Mult_mm(pSigMult,m1,currRing);
2772  if(pSigMult != NULL)
2773  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
2774  sSigMult = pp_Mult_mm(sSigMult,m2,currRing);
2775  if(sSigMult != NULL)
2776  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
2777 //#if 1
2778 #ifdef DEBUGF5
2779  Print("----------------\n");
2780  pWrite(pSigMult);
2781  pWrite(sSigMult);
2782  Print("----------------\n");
2783  Lp.checked = 0;
2784 #endif
2785  int sigCmp;
2786  if(pSigMult != NULL && sSigMult != NULL)
2787  {
2789  sigCmp = p_LtCmpNoAbs(pSigMult,sSigMult,currRing);
2790  else
2791  sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
2792  }
2793  else
2794  {
2795  if(pSigMult == NULL)
2796  {
2797  if(sSigMult == NULL)
2798  sigCmp = 0;
2799  else
2800  sigCmp = -1;
2801  }
2802  else
2803  sigCmp = 1;
2804  }
2805 //#if 1
2806 #if DEBUGF5
2807  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
2808  pWrite(pSigMult);
2809  pWrite(sSigMult);
2810 #endif
2811  //In the ring case we already build the sig
2813  {
2814  if(sigCmp == 0)
2815  {
2816  #ifdef ADIDEBUG
2817  printf("\nPossible sigdrop in enterpairSig (due to lost of sig)\n");
2818  #endif
2819  //sigdrop since we loose the signature
2820  strat->sigdrop = TRUE;
2821  //Try to reduce it as far as we can via redRing
2823  {
2824  poly p1 = p_Copy(p,currRing);
2825  poly p2 = p_Copy(strat->S[i],currRing);
2826  p1 = p_Mult_mm(p1,m1,currRing);
2827  p2 = p_Mult_mm(p2,m2,currRing);
2828  Lp.p = p_Sub(p1,p2,currRing);
2829  if(Lp.p != NULL)
2830  Lp.sev = p_GetShortExpVector(Lp.p,currRing);
2831  }
2832  int red_result = redRing(&Lp,strat);
2833  #ifdef ADIDEBUG
2834  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
2835  #endif
2836  if(red_result == 0)
2837  {
2838  // Cancel the sigdrop
2839  #ifdef ADIDEBUG
2840  printf("\nCancel the sigdrop. It reduced to 0\n");
2841  #endif
2842  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
2843  strat->sigdrop = FALSE;
2844  return;
2845  }
2846  else
2847  {
2848  #ifdef ADIDEBUG
2849  printf("\nSigdrop. end\n");
2850  #endif
2851  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
2852  #if 1
2853  strat->enterS(Lp,0,strat,strat->tl);
2854  #endif
2855  return;
2856  }
2857  }
2858  if(pSigMult != NULL && sSigMult != NULL && p_LmCmp(pSigMult,sSigMult,currRing) == 0)
2859  {
2860  //Same lm, have to substract
2861  Lp.sig = p_Sub(pCopy(pSigMult),pCopy(sSigMult),currRing);
2862  }
2863  else
2864  {
2865  if(sigCmp == 1)
2866  {
2867  Lp.sig = pCopy(pSigMult);
2868  }
2869  if(sigCmp == -1)
2870  {
2871  Lp.sig = pNeg(pCopy(sSigMult));
2872  }
2873  }
2874  Lp.sevSig = p_GetShortExpVector(Lp.sig,currRing);
2875  }
2876 
2877  #if 0
2878  if(sigCmp==0)
2879  {
2880  // printf("!!!! EQUAL SIGS !!!!\n");
2881  // pSig = sSig, delete element due to Rewritten Criterion
2882  pDelete(&pSigMult);
2883  pDelete(&sSigMult);
2884  if (rField_is_Ring(currRing))
2885  pLmDelete(Lp.lcm);
2886  else
2887  pLmFree(Lp.lcm);
2888  Lp.lcm=NULL;
2889  pDelete (&m1);
2890  pDelete (&m2);
2891  return;
2892  }
2893  #endif
2894  // testing by syzCrit = F5 Criterion
2895  // testing by rewCrit1 = Rewritten Criterion
2896  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
2897  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
2898  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
2899  // With this rewCrit activated i get a wrong deletion in sba_int_56.tst
2900  //|| strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
2901  )
2902  {
2903  #ifdef ADIDEBUG
2904  printf("\nDELETED!\n");
2905  #endif
2906  pDelete(&pSigMult);
2907  pDelete(&sSigMult);
2908  if (rField_is_Ring(currRing))
2909  pLmDelete(Lp.lcm);
2910  else
2911  pLmFree(Lp.lcm);
2912  Lp.lcm=NULL;
2913  pDelete (&m1);
2914  pDelete (&m2);
2915  return;
2916  }
2917  /*
2918  *the pair (S[i],p) enters B if the spoly != 0
2919  */
2920  /*- compute the short s-polynomial -*/
2921  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2922  pNorm(p);
2923 
2924  if ((strat->S[i]==NULL) || (p==NULL))
2925  return;
2926 
2927  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2928  Lp.p=NULL;
2929  else
2930  {
2931  //Build p
2933  {
2934  poly p1 = p_Copy(p,currRing);
2935  poly p2 = p_Copy(strat->S[i],currRing);
2936  p1 = p_Mult_mm(p1,m1,currRing);
2937  p2 = p_Mult_mm(p2,m2,currRing);
2938  Lp.p = p_Sub(p1,p2,currRing);
2939  if(Lp.p != NULL)
2940  Lp.sev = p_GetShortExpVector(Lp.p,currRing);
2941  }
2942  else
2943  {
2944  #ifdef HAVE_PLURAL
2945  if ( rIsPluralRing(currRing) )
2946  {
2947  if(ncRingType(currRing) == nc_lie)
2948  {
2949  // generalized prod-crit for lie-type
2950  strat->cp++;
2951  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2952  }
2953  else
2954  if( ALLOW_PROD_CRIT(strat) )
2955  {
2956  // product criterion for homogeneous case in SCA
2957  strat->cp++;
2958  Lp.p = NULL;
2959  }
2960  else
2961  {
2962  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2963  nc_CreateShortSpoly(strat->S[i], p, currRing);
2964 
2965  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2966  pNext(Lp.p) = strat->tail; // !!!
2967  }
2968  }
2969  else
2970  #endif
2971  {
2973  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2974  }
2975  }
2976  }
2977  // store from which element this pair comes from for further tests
2978  //Lp.from = strat->sl+1;
2980  {
2981  //Put the sig to be > 0
2982  if(!nGreaterZero(pGetCoeff(Lp.sig)))
2983  {
2984  Lp.sig = pNeg(Lp.sig);
2985  Lp.p = pNeg(Lp.p);
2986  }
2987  }
2988  else
2989  {
2990  if(sigCmp==currRing->OrdSgn)
2991  {
2992  // pSig > sSig
2993  pDelete (&sSigMult);
2994  Lp.sig = pSigMult;
2995  Lp.sevSig = ~pSigMultNegSev;
2996  }
2997  else
2998  {
2999  // pSig < sSig
3000  pDelete (&pSigMult);
3001  Lp.sig = sSigMult;
3002  Lp.sevSig = ~sSigMultNegSev;
3003  }
3004  }
3005  if (Lp.p == NULL)
3006  {
3007  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
3008  int pos = posInSyz(strat, Lp.sig);
3009  enterSyz(Lp, strat, pos);
3010  }
3011  else
3012  {
3013  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
3014  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1))
3015  {
3016  pLmFree(Lp.lcm);
3017  #ifdef ADIDEBUG
3018  printf("\nrewCrit3 deletes it!\n");
3019  #endif
3020  pDelete(&Lp.sig);
3021  Lp.lcm=NULL;
3022  pDelete (&m1);
3023  pDelete (&m2);
3024  return;
3025  }
3026  // in any case Lp is checked up to the next strat->P which is added
3027  // to S right after this critical pair creation.
3028  // NOTE: this even holds if the 2nd generator gives the bigger signature
3029  // moreover, this improves rewCriterion,
3030  // i.e. strat->checked > strat->from if and only if the 2nd generator
3031  // gives the bigger signature.
3032  Lp.checked = strat->sl+1;
3033  // at this point it is clear that the pair will be added to L, since it has
3034  // passed all tests up to now
3035 
3036  // adds buchberger's first criterion
3037  if (pLmCmp(m2,pHead(p)) == 0)
3038  {
3039  Lp.prod_crit = TRUE; // Product Criterion
3040 #if 0
3041  int pos = posInSyz(strat, Lp.sig);
3042  enterSyz(Lp, strat, pos);
3043  Lp.lcm=NULL;
3044  pDelete (&m1);
3045  pDelete (&m2);
3046  return;
3047 #endif
3048  }
3049  pDelete (&m1);
3050  pDelete (&m2);
3051 #if DEBUGF5
3052  PrintS("SIGNATURE OF PAIR: ");
3053  pWrite(Lp.sig);
3054 #endif
3055  /*- the pair (S[i],p) enters B -*/
3056  Lp.p1 = strat->S[i];
3057  Lp.p2 = p;
3058 
3059  if (
3061 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
3063  )
3064  {
3065  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
3066  pNext(Lp.p) = strat->tail; // !!!
3067  }
3068 
3069  if (atR >= 0)
3070  {
3071  Lp.i_r1 = strat->S_2_R[i];
3072  Lp.i_r2 = atR;
3073  }
3074  else
3075  {
3076  Lp.i_r1 = -1;
3077  Lp.i_r2 = -1;
3078  }
3079  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3080 
3082  {
3084  nDelete(&(Lp.p->coef));
3085  }
3086  // Check for sigdrop
3087  if(rField_is_Ring(currRing) && pLtCmp(Lp.sig,pSig) == -1)
3088  {
3089  #ifdef ADIDEBUG
3090  printf("\nSigDrop in enteronepairSig\n");pWrite(Lp.sig);
3091  pWrite(p);pWrite(pSig);
3092  pWrite(strat->S[i]);pWrite(strat->sig[i]);
3093  #endif
3094  strat->sigdrop = TRUE;
3095  // Completely reduce it
3096  int red_result = redRing(&Lp,strat);
3097  if(red_result == 0)
3098  {
3099  // Reduced to 0
3100  #ifdef ADIDEBUG
3101  printf("\nCancel the sigdrop after redRing (=0)\n");
3102  #endif
3103  strat->sigdrop = FALSE;
3104  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
3105  return;
3106  }
3107  else
3108  {
3109  #ifdef ADIDEBUG
3110  printf("\nAfter redRing still sigdrop:\n");pWrite(Lp.p);
3111  #endif
3112  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
3113  // 0 - add just the original poly causing the sigdrop, 1 - add also this
3114  #if 1
3115  strat->enterS(Lp,0,strat, strat->tl+1);
3116  #endif
3117  return;
3118  }
3119  }
3120  #ifdef ADIDEBUG
3121  printf("\nThis spair was added to B:\n");
3122  pWrite(Lp.p);
3123  pWrite(Lp.p1);
3124  pWrite(Lp.p2);
3125  pWrite(Lp.sig);
3126  #endif
3127  l = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
3128  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3129  }
3130 }
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:95
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:99
#define pLcm(a, b, m)
Definition: polys.h:278
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:291
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:1210
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:1911
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:403
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:4588
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:6361
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
#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:9677
#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 3136 of file kutil.cc.

3137 {
3138  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
3139  if(pHasNotCF(p,strat->S[i]))
3140  {
3141  //PrintS("prod-crit\n");
3142  if(ALLOW_PROD_CRIT(strat))
3143  {
3144  //PrintS("prod-crit\n");
3145  strat->cp++;
3146  return;
3147  }
3148  }
3149 
3150  int l,j,compare;
3151  LObject Lp;
3152  Lp.i_r = -1;
3153 
3154  Lp.lcm = pInit();
3155  pLcm(p,strat->S[i],Lp.lcm);
3156  pSetm(Lp.lcm);
3157  /*- compute the short s-polynomial -*/
3158 
3159  #ifdef HAVE_PLURAL
3160  if (rIsPluralRing(currRing))
3161  {
3162  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
3163  }
3164  else
3165  #endif
3166  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
3167 
3168  if (Lp.p == NULL)
3169  {
3170  //PrintS("short spoly==NULL\n");
3171  pLmFree(Lp.lcm);
3172  }
3173  else
3174  {
3175  /*- the pair (S[i],p) enters L -*/
3176  Lp.p1 = strat->S[i];
3177  Lp.p2 = p;
3178  if (atR >= 0)
3179  {
3180  Lp.i_r1 = strat->S_2_R[i];
3181  Lp.i_r2 = atR;
3182  }
3183  else
3184  {
3185  Lp.i_r1 = -1;
3186  Lp.i_r2 = -1;
3187  }
3188  assume(pNext(Lp.p) == NULL);
3189  pNext(Lp.p) = strat->tail;
3190  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3192  {
3193  nDelete(&(Lp.p->coef));
3194  }
3195  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
3196  //Print("-> L[%d]\n",l);
3197  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3198  }
3199 }
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:278
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:1210
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
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
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()

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

Definition at line 1513 of file kutil.cc.

1514 {
1515  number d, s, t;
1516  assume(atR >= 0);
1517  poly m1, m2, gcd,si;
1518  if(!enterTstrong)
1519  {
1520  assume(i<=strat->sl);
1521  si = strat->S[i];
1522  }
1523  else
1524  {
1525  assume(i<=strat->tl);
1526  si = strat->T[i].p;
1527  }
1528  //printf("\n--------------------------------\n");
1529  //pWrite(p);pWrite(si);
1530  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1531 
1532  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1533  {
1534  nDelete(&d);
1535  nDelete(&s);
1536  nDelete(&t);
1537  return FALSE;
1538  }
1539 
1540  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1541  //p_Test(m1,strat->tailRing);
1542  //p_Test(m2,strat->tailRing);
1543  /*if(!enterTstrong)
1544  {
1545  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1546  {
1547  memset(&(strat->P), 0, sizeof(strat->P));
1548  kStratChangeTailRing(strat);
1549  strat->P = *(strat->R[atR]);
1550  p_LmFree(m1, strat->tailRing);
1551  p_LmFree(m2, strat->tailRing);
1552  p_LmFree(gcd, currRing);
1553  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1554  }
1555  }*/
1556  pSetCoeff0(m1, s);
1557  pSetCoeff0(m2, t);
1558  pSetCoeff0(gcd, d);
1559  p_Test(m1,strat->tailRing);
1560  p_Test(m2,strat->tailRing);
1561  //printf("\n===================================\n");
1562  //pWrite(m1);pWrite(m2);pWrite(gcd);
1563 #ifdef KDEBUG
1564  if (TEST_OPT_DEBUG)
1565  {
1566  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1567  PrintS("m1 = ");
1568  p_wrp(m1, strat->tailRing);
1569  PrintS(" ; m2 = ");
1570  p_wrp(m2, strat->tailRing);
1571  PrintS(" ; gcd = ");
1572  wrp(gcd);
1573  PrintS("\n--- create strong gcd poly: ");
1574  Print("\n p: %d", i);
1575  wrp(p);
1576  Print("\n strat->S[%d]: ", i);
1577  wrp(si);
1578  PrintS(" ---> ");
1579  }
1580 #endif
1581 
1582  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1583  p_LmDelete(m1, strat->tailRing);
1584  p_LmDelete(m2, strat->tailRing);
1585 #ifdef KDEBUG
1586  if (TEST_OPT_DEBUG)
1587  {
1588  wrp(gcd);
1589  PrintLn();
1590  }
1591 #endif
1592 
1593  LObject h;
1594  h.p = gcd;
1595  h.tailRing = strat->tailRing;
1596  int posx;
1597  h.pCleardenom();
1598  strat->initEcart(&h);
1599  h.sev = pGetShortExpVector(h.p);
1600  h.i_r1 = -1;h.i_r2 = -1;
1601  if (currRing!=strat->tailRing)
1602  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1603  if(!enterTstrong)
1604  {
1605  #if 1
1606  h.p1 = p;h.p2 = strat->S[i];
1607  #endif
1608  if (atR >= 0)
1609  {
1610  h.i_r2 = strat->S_2_R[i];
1611  h.i_r1 = atR;
1612  }
1613  else
1614  {
1615  h.i_r1 = -1;
1616  h.i_r2 = -1;
1617  }
1618  if (strat->Ll==-1)
1619  posx =0;
1620  else
1621  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1622  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1623  }
1624  else
1625  {
1626  if(h.IsNull()) return FALSE;
1627  //int red_result;
1628  //reduzieren ist teur!!!
1629  //if(strat->L != NULL)
1630  //red_result = strat->red(&h,strat);
1631  if(!h.IsNull())
1632  {
1633  enterT(h, strat,-1);
1634  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1635  //strat->enterS(h,pos,strat,-1);
1636  }
1637  }
1638  //#if 1
1639  #ifdef ADIDEBUG
1640  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1641  #endif
1642  return TRUE;
1643 }
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:95
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:99
void pWrite(poly p)
Definition: polys.h:291
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
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:9480
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:403
#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:293
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()

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

Definition at line 1708 of file kutil.cc.

1709 {
1710  number d, s, t;
1711  assume(atR >= 0);
1712  poly m1, m2, gcd,si;
1713  assume(i<=strat->sl);
1714  si = strat->S[i];
1715  //printf("\n--------------------------------\n");
1716  //pWrite(p);pWrite(si);
1717  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1718 
1719  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1720  {
1721  nDelete(&d);
1722  nDelete(&s);
1723  nDelete(&t);
1724  return FALSE;
1725  }
1726 
1727  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1728  //p_Test(m1,strat->tailRing);
1729  //p_Test(m2,strat->tailRing);
1730  /*if(!enterTstrong)
1731  {
1732  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1733  {
1734  memset(&(strat->P), 0, sizeof(strat->P));
1735  kStratChangeTailRing(strat);
1736  strat->P = *(strat->R[atR]);
1737  p_LmFree(m1, strat->tailRing);
1738  p_LmFree(m2, strat->tailRing);
1739  p_LmFree(gcd, currRing);
1740  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1741  }
1742  }*/
1743  pSetCoeff0(m1, s);
1744  pSetCoeff0(m2, t);
1745  pSetCoeff0(gcd, d);
1746  p_Test(m1,strat->tailRing);
1747  p_Test(m2,strat->tailRing);
1748  //printf("\n===================================\n");
1749  //pWrite(m1);pWrite(m2);pWrite(gcd);
1750 #ifdef KDEBUG
1751  if (TEST_OPT_DEBUG)
1752  {
1753  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1754  PrintS("m1 = ");
1755  p_wrp(m1, strat->tailRing);
1756  PrintS(" ; m2 = ");
1757  p_wrp(m2, strat->tailRing);
1758  PrintS(" ; gcd = ");
1759  wrp(gcd);
1760  PrintS("\n--- create strong gcd poly: ");
1761  Print("\n p: %d", i);
1762  wrp(p);
1763  Print("\n strat->S[%d]: ", i);
1764  wrp(si);
1765  PrintS(" ---> ");
1766  }
1767 #endif
1768 
1769  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1770 
1771 #ifdef KDEBUG
1772  if (TEST_OPT_DEBUG)
1773  {
1774  wrp(gcd);
1775  PrintLn();
1776  }
1777 #endif
1778 
1779  //Check and set the signatures
1780  poly pSigMult = p_Copy(sig,currRing);
1781  poly sSigMult = p_Copy(strat->sig[i],currRing);
1782  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1783  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1784  p_LmDelete(m1, strat->tailRing);
1785  p_LmDelete(m2, strat->tailRing);
1786  poly pairsig;
1787  if(pLmCmp(pSigMult,sSigMult) == 0)
1788  {
1789  //Same lm, have to add them
1790  pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1791  //This might be zero
1792  }
1793  else
1794  {
1795  //Set the sig to either pSigMult or sSigMult
1796  if(pLtCmp(pSigMult,sSigMult)==1)
1797  {
1798  pairsig = pSigMult;
1799  pDelete(&sSigMult);
1800  }
1801  else
1802  {
1803  pairsig = sSigMult;
1804  pDelete(&pSigMult);
1805  }
1806  }
1807 
1808  LObject h;
1809  h.p = gcd;
1810  h.tailRing = strat->tailRing;
1811  h.sig = pairsig;
1812  int posx;
1813  h.pCleardenom();
1814  strat->initEcart(&h);
1815  h.sev = pGetShortExpVector(h.p);
1816  h.i_r1 = -1;h.i_r2 = -1;
1817  if (currRing!=strat->tailRing)
1818  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1819  if(h.sig == NULL)
1820  {
1821  #ifdef ADIDEBUG
1822  printf("\nPossible sigdrop in enterpairstrongSig (due to lost of sig)\n");
1823  #endif
1824  //sigdrop since we loose the signature
1825  strat->sigdrop = TRUE;
1826  //Try to reduce it as far as we can via redRing
1827  int red_result = redRing(&h,strat);
1828  #ifdef ADIDEBUG
1829  printf("\nAfter redRing reduce:\n");pWrite(h.p);
1830  #endif
1831  if(red_result == 0)
1832  {
1833  // Cancel the sigdrop
1834  #ifdef ADIDEBUG
1835  printf("\nCancel the sigdrop. It reduced to 0\n");
1836  #endif
1837  p_Delete(&h.sig,currRing);h.sig = NULL;
1838  strat->sigdrop = FALSE;
1839  return FALSE;
1840  }
1841  else
1842  {
1843  #ifdef ADIDEBUG
1844  printf("\nSigdrop. end\n");
1845  #endif
1846  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1847  #if 1
1848  strat->enterS(h,0,strat,strat->tl);
1849  #endif
1850  return FALSE;
1851  }
1852  }
1853  if(!nGreaterZero(pGetCoeff(h.sig)))
1854  {
1855  h.sig = pNeg(h.sig);
1856  h.p = pNeg(h.p);
1857  }
1858 
1859  if(rField_is_Ring(currRing) && pLtCmp(h.sig,sig) == -1)
1860  {
1861  #ifdef ADIDEBUG
1862  printf("\nSigDrop in enteronestrongpolySig\n");
1863  pWrite(h.sig);
1864  pWrite(p);pWrite(sig);
1865  pWrite(strat->S[i]);pWrite(strat->sig[i]);
1866  #endif
1867  strat->sigdrop = TRUE;
1868  // Completely reduce it
1869  int red_result = redRing(&h,strat);
1870  if(red_result == 0)
1871  {
1872  // Reduced to 0
1873  #ifdef ADIDEBUG
1874  printf("\nCancel the sigdrop after redRing (=0)\n");
1875  #endif
1876  strat->sigdrop = FALSE;
1877  p_Delete(&h.sig,currRing);h.sig = NULL;
1878  return FALSE;
1879  }
1880  else
1881  {
1882  #ifdef ADIDEBUG
1883  printf("\nAfter redRing still sigdrop:\n");pWrite(h.p);
1884  #endif
1885  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1886  // 0 - add just the original poly causing the sigdrop, 1 - add also this
1887  #if 1
1888  strat->enterS(h,0,strat, strat->tl+1);
1889  #endif
1890  return FALSE;
1891  }
1892  }
1893  #ifdef ADIDEBUG
1894  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);pWrite(h.sig);
1895  #endif
1896  //Check for sigdrop
1897  if(gcd != NULL && pLtCmp(sig,pairsig) > 0 && pLtCmp(strat->sig[i],pairsig) > 0)
1898  {
1899  #ifdef ADIDEBUG
1900  printf("\nSigDrop in strongpair\noriginals: ");pWrite(sig);pWrite(strat->sig[i]);
1901  printf("\nnow: ");pWrite(pairsig);
1902  #endif
1903  strat->sigdrop = TRUE;
1904  //Enter this element to S
1905  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
1906  strat->enterS(h,strat->sl+1,strat,strat->tl+1);
1907  }
1908  #if 1
1909  h.p1 = p;h.p2 = strat->S[i];
1910  #endif
1911  if (atR >= 0)
1912  {
1913  h.i_r2 = strat->S_2_R[i];
1914  h.i_r1 = atR;
1915  }
1916  else
1917  {
1918  h.i_r1 = -1;
1919  h.i_r2 = -1;
1920  }
1921  if (strat->Ll==-1)
1922  posx =0;
1923  else
1924  posx = strat->posInLSba(strat->L,strat->Ll,&h,strat);
1925  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1926  return TRUE;
1927 }
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:95
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:99
void pWrite(poly p)
Definition: polys.h:291
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
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:403
#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:293
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 4232 of file kutil.cc.

4233 {
4234  int l,j,compare,compareCoeff;
4235  LObject Lp;
4236 
4237 #ifdef KDEBUG
4238  Lp.ecart=0; Lp.length=0;
4239 #endif
4240  /*- computes the lcm(s[i],p) -*/
4241  Lp.lcm = pInit();
4242 
4243  pLcm(p,f,Lp.lcm);
4244  pSetm(Lp.lcm);
4245  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
4246  assume(!strat->sugarCrit);
4247  assume(!strat->fromT);
4248  /*
4249  *the set B collects the pairs of type (S[j],p)
4250  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
4251  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
4252  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
4253  */
4254  for(j = strat->Bl;j>=0;j--)
4255  {
4256  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
4257  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
4258  if (compareCoeff == 0 || compare == compareCoeff)
4259  {
4260  if (compare == 1)
4261  {
4262  strat->c3++;
4263  pLmDelete(Lp.lcm);
4264  return;
4265  }
4266  else
4267  if (compare == -1)
4268  {
4269  deleteInL(strat->B,&strat->Bl,j,strat);
4270  strat->c3++;
4271  }
4272  }
4273  if (compare == pDivComp_EQUAL)
4274  {
4275  // Add hint for same LM and direction of LC (later) (TODO Oliver)
4276  if (compareCoeff == 1)
4277  {
4278  strat->c3++;
4279  pLmDelete(Lp.lcm);
4280  return;
4281  }
4282  else
4283  if (compareCoeff == -1)
4284  {
4285  deleteInL(strat->B,&strat->Bl,j,strat);
4286  strat->c3++;
4287  }
4288  }
4289  }
4290  /*
4291  *the pair (S[i],p) enters B if the spoly != 0
4292  */
4293  /*- compute the short s-polynomial -*/
4294  if ((f==NULL) || (p==NULL)) return;
4295  pNorm(p);
4296  {
4297  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
4298  }
4299  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
4300  {
4301  /*- the case that the s-poly is 0 -*/
4302 // if (strat->pairtest==NULL) initPairtest(strat);
4303 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
4304 // strat->pairtest[strat->sl+1] = TRUE;
4305  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
4306  /*
4307  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
4308  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
4309  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
4310  *term of p devides the lcm(s,r)
4311  *(this canceling should be done here because
4312  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
4313  *the first case is handeled in chainCrit
4314  */
4315  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
4316  }
4317  else
4318  {
4319  /*- the pair (S[i],p) enters B -*/
4320  Lp.p1 = f;
4321  Lp.p2 = p;
4322 
4323  pNext(Lp.p) = strat->tail;
4324 
4325  LObject tmp_h(f, currRing, strat->tailRing);
4326  tmp_h.SetShortExpVector();
4327  strat->initEcart(&tmp_h);
4328  tmp_h.sev = pGetShortExpVector(tmp_h.p);
4329  tmp_h.t_p = t_p;
4330 
4331  enterT(tmp_h, strat, strat->tl + 1);
4332 
4333  if (atR >= 0)
4334  {
4335  Lp.i_r2 = atR;
4336  Lp.i_r1 = strat->tl;
4337  }
4338 
4339  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
4340  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
4341  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
4342  }
4343 }
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:278
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:1210
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:9480
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
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:403
#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:7
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:346
#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 4936 of file kutil.cc.

4937 {
4938  int j=pos;
4939 
4941  initenterpairs(h,k,ecart,0,strat, atR);
4942  if ( (!strat->fromT)
4943  && ((strat->syzComp==0)
4944  ||(pGetComp(h)<=strat->syzComp)))
4945  {
4946  unsigned long h_sev = pGetShortExpVector(h);
4947  loop
4948  {
4949  if (j > k) break;
4950  clearS(h,h_sev, &j,&k,strat);
4951  j++;
4952  }
4953  }
4954 }
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:3827
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:403
#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 12607 of file kutil.cc.

12608 {
12609  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12610  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12611  int j=pos;
12612 
12614  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12615  if ( (!strat->fromT)
12616  && ((strat->syzComp==0)
12617  ||(pGetComp(h)<=strat->syzComp)))
12618  {
12619  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12620  unsigned long h_sev = pGetShortExpVector(h);
12621  loop
12622  {
12623  if (j > k) break;
12624  clearS(h,h_sev, &j,&k,strat);
12625  j++;
12626  }
12627  //Print("end clearS sl=%d\n",strat->sl);
12628  }
12629  // PrintS("end enterpairs\n");
12630 }
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:12639
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:403
#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 4962 of file kutil.cc.

4963 {
4964  int j=pos;
4966  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4967  if ( (!strat->fromT)
4968  && ((strat->syzComp==0)
4969  ||(pGetComp(h)<=strat->syzComp)))
4970  {
4971  unsigned long h_sev = pGetShortExpVector(h);
4972  loop
4973  {
4974  if (j > k) break;
4975  clearS(h,h_sev, &j,&k,strat);
4976  j++;
4977  }
4978  }
4979 }
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:3897
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:403
#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 4985 of file kutil.cc.

4986 {
4987  int j;
4988  const int iCompH = pGetComp(h);
4989 
4990  if (rField_is_Ring(currRing))
4991  {
4992  for (j=0; j<=k; j++)
4993  {
4994  const int iCompSj = pGetComp(strat->S[j]);
4995  if ((iCompH==iCompSj)
4996  //|| (0==iCompH) // can only happen,if iCompSj==0
4997  || (0==iCompSj))
4998  {
4999  enterOnePairRing(j,h,ecart,FALSE,strat, atR);
5000  }
5001  }
5002  kMergeBintoL(strat);
5003  }
5004  else
5005  {
5006  for (j=0; j<=k; j++)
5007  {
5008  const int iCompSj = pGetComp(strat->S[j]);
5009  if ((iCompH==iCompSj)
5010  //|| (0==iCompH) // can only happen,if iCompSj==0
5011  || (0==iCompSj))
5012  {
5013  enterOnePairSpecial(j,h,ecart,strat, atR);
5014  }
5015  }
5016  }
5017 
5018  if (strat->noClearS) return;
5019 
5020 // #ifdef HAVE_PLURAL
5021 /*
5022  if (rIsPluralRing(currRing))
5023  {
5024  j=pos;
5025  loop
5026  {
5027  if (j > k) break;
5028 
5029  if (pLmDivisibleBy(h, strat->S[j]))
5030  {
5031  deleteInS(j, strat);
5032  j--;
5033  k--;
5034  }
5035 
5036  j++;
5037  }
5038  }
5039  else
5040 */
5041 // #endif // ??? Why was the following cancelation disabled for non-commutative rings?
5042  {
5043  j=pos;
5044  loop
5045  {
5046  unsigned long h_sev = pGetShortExpVector(h);
5047  if (j > k) break;
5048  clearS(h,h_sev,&j,&k,strat);
5049  j++;
5050  }
5051  }
5052 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:95
char noClearS
Definition: kutil.h:399
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
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:3136
#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
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
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:3204
static Poly * h
Definition: janet.cc:978

§ enterSBba()

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

Definition at line 9240 of file kutil.cc.

9241 {
9242  strat->news = TRUE;
9243  /*- puts p to the standardbasis s at position at -*/
9244  if (strat->sl == IDELEMS(strat->Shdl)-1)
9245  {
9246  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9247  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9248  (IDELEMS(strat->Shdl)+setmaxTinc)
9249  *sizeof(unsigned long));
9250  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9251  IDELEMS(strat->Shdl)*sizeof(int),
9252  (IDELEMS(strat->Shdl)+setmaxTinc)
9253  *sizeof(int));
9254  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9255  IDELEMS(strat->Shdl)*sizeof(int),
9256  (IDELEMS(strat->Shdl)+setmaxTinc)
9257  *sizeof(int));
9258  if (strat->lenS!=NULL)
9259  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9260  IDELEMS(strat->Shdl)*sizeof(int),
9261  (IDELEMS(strat->Shdl)+setmaxTinc)
9262  *sizeof(int));
9263  if (strat->lenSw!=NULL)
9264  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9265  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9266  (IDELEMS(strat->Shdl)+setmaxTinc)
9267  *sizeof(wlen_type));
9268  if (strat->fromQ!=NULL)
9269  {
9270  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9271  IDELEMS(strat->Shdl)*sizeof(int),
9272  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9273  }
9274  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9275  IDELEMS(strat->Shdl)+=setmaxTinc;
9276  strat->Shdl->m=strat->S;
9277  }
9278  if (atS <= strat->sl)
9279  {
9280 #ifdef ENTER_USE_MEMMOVE
9281  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9282  (strat->sl - atS + 1)*sizeof(poly));
9283  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9284  (strat->sl - atS + 1)*sizeof(int));
9285  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9286  (strat->sl - atS + 1)*sizeof(unsigned long));
9287  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9288  (strat->sl - atS + 1)*sizeof(int));
9289  if (strat->lenS!=NULL)
9290  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9291  (strat->sl - atS + 1)*sizeof(int));
9292  if (strat->lenSw!=NULL)
9293  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9294  (strat->sl - atS + 1)*sizeof(wlen_type));
9295 #else
9296  for (i=strat->sl+1; i>=atS+1; i--)
9297  {
9298  strat->S[i] = strat->S[i-1];
9299  strat->ecartS[i] = strat->ecartS[i-1];
9300  strat->sevS[i] = strat->sevS[i-1];
9301  strat->S_2_R[i] = strat->S_2_R[i-1];
9302  }
9303  if (strat->lenS!=NULL)
9304  for (i=strat->sl+1; i>=atS+1; i--)
9305  strat->lenS[i] = strat->lenS[i-1];
9306  if (strat->lenSw!=NULL)
9307  for (i=strat->sl+1; i>=atS+1; i--)
9308  strat->lenSw[i] = strat->lenSw[i-1];
9309 #endif
9310  }
9311  if (strat->fromQ!=NULL)
9312  {
9313 #ifdef ENTER_USE_MEMMOVE
9314  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9315  (strat->sl - atS + 1)*sizeof(int));
9316 #else
9317  for (i=strat->sl+1; i>=atS+1; i--)
9318  {
9319  strat->fromQ[i] = strat->fromQ[i-1];
9320  }
9321 #endif
9322  strat->fromQ[atS]=0;
9323  }
9324 
9325  /*- save result -*/
9326  strat->S[atS] = p.p;
9327  if (strat->honey) strat->ecartS[atS] = p.ecart;
9328  if (p.sev == 0)
9329  p.sev = pGetShortExpVector(p.p);
9330  else
9331  assume(p.sev == pGetShortExpVector(p.p));
9332  strat->sevS[atS] = p.sev;
9333  strat->ecartS[atS] = p.ecart;
9334  strat->S_2_R[atS] = atR;
9335  strat->sl++;
9336 }
#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:99
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:403
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:3555
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:95
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
poly kNoether
Definition: kutil.h:324
#define TRUE
Definition: auxiliary.h:99
#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:10747
#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:9240

§ 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:99
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:10747
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9240

§ enterSSba()

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

Definition at line 9342 of file kutil.cc.

9343 {
9344  strat->news = TRUE;
9345  /*- puts p to the standardbasis s at position at -*/
9346  if (strat->sl == IDELEMS(strat->Shdl)-1)
9347  {
9348  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9349  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9350  (IDELEMS(strat->Shdl)+setmaxTinc)
9351  *sizeof(unsigned long));
9352  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9353  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9354  (IDELEMS(strat->Shdl)+setmaxTinc)
9355  *sizeof(unsigned long));
9356  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9357  IDELEMS(strat->Shdl)*sizeof(int),
9358  (IDELEMS(strat->Shdl)+setmaxTinc)
9359  *sizeof(int));
9360  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9361  IDELEMS(strat->Shdl)*sizeof(int),
9362  (IDELEMS(strat->Shdl)+setmaxTinc)
9363  *sizeof(int));
9364  if (strat->lenS!=NULL)
9365  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9366  IDELEMS(strat->Shdl)*sizeof(int),
9367  (IDELEMS(strat->Shdl)+setmaxTinc)
9368  *sizeof(int));
9369  if (strat->lenSw!=NULL)
9370  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9371  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9372  (IDELEMS(strat->Shdl)+setmaxTinc)
9373  *sizeof(wlen_type));
9374  if (strat->fromQ!=NULL)
9375  {
9376  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9377  IDELEMS(strat->Shdl)*sizeof(int),
9378  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9379  }
9380  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9381  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
9382  IDELEMS(strat->Shdl)+=setmaxTinc;
9383  strat->Shdl->m=strat->S;
9384  }
9385  // in a signature-based algorithm the following situation will never
9386  // appear due to the fact that the critical pairs are already sorted
9387  // by increasing signature.
9388  // True. However, in the case of integers we need to put the element
9389  // that caused the signature drop on the first position
9390  if (atS <= strat->sl)
9391  {
9392 #ifdef ENTER_USE_MEMMOVE
9393  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9394  (strat->sl - atS + 1)*sizeof(poly));
9395  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9396  (strat->sl - atS + 1)*sizeof(poly));
9397  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9398  (strat->sl - atS + 1)*sizeof(unsigned long));
9399  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9400  (strat->sl - atS + 1)*sizeof(int));
9401  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9402  (strat->sl - atS + 1)*sizeof(unsigned long));
9403  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9404  (strat->sl - atS + 1)*sizeof(int));
9405  if (strat->lenS!=NULL)
9406  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9407  (strat->sl - atS + 1)*sizeof(int));
9408  if (strat->lenSw!=NULL)
9409  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9410  (strat->sl - atS + 1)*sizeof(wlen_type));
9411 #else
9412  for (i=strat->sl+1; i>=atS+1; i--)
9413  {
9414  strat->S[i] = strat->S[i-1];
9415  strat->ecartS[i] = strat->ecartS[i-1];
9416  strat->sevS[i] = strat->sevS[i-1];
9417  strat->S_2_R[i] = strat->S_2_R[i-1];
9418  strat->sig[i] = strat->sig[i-1];
9419  strat->sevSig[i] = strat->sevSig[i-1];
9420  }
9421  if (strat->lenS!=NULL)
9422  for (i=strat->sl+1; i>=atS+1; i--)
9423  strat->lenS[i] = strat->lenS[i-1];
9424  if (strat->lenSw!=NULL)
9425  for (i=strat->sl+1; i>=atS+1; i--)
9426  strat->lenSw[i] = strat->lenSw[i-1];
9427 #endif
9428  }
9429  if (strat->fromQ!=NULL)
9430  {
9431 #ifdef ENTER_USE_MEMMOVE
9432  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9433  (strat->sl - atS + 1)*sizeof(int));
9434 #else
9435  for (i=strat->sl+1; i>=atS+1; i--)
9436  {
9437  strat->fromQ[i] = strat->fromQ[i-1];
9438  }
9439 #endif
9440  strat->fromQ[atS]=0;
9441  }
9442 
9443  /*- save result -*/
9444  strat->S[atS] = p.p;
9445  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9446  if (strat->honey) strat->ecartS[atS] = p.ecart;
9447  if (p.sev == 0)
9448  p.sev = pGetShortExpVector(p.p);
9449  else
9450  assume(p.sev == pGetShortExpVector(p.p));
9451  strat->sevS[atS] = p.sev;
9452  // during the interreduction process of a signature-based algorithm we do not
9453  // compute the signature at this point, but when the whole interreduction
9454  // process finishes, i.e. f5c terminates!
9455  if (p.sig != NULL)
9456  {
9457  if (p.sevSig == 0)
9458  p.sevSig = pGetShortExpVector(p.sig);
9459  else
9460  assume(p.sevSig == pGetShortExpVector(p.sig));
9461  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9462  }
9463  strat->ecartS[atS] = p.ecart;
9464  strat->S_2_R[atS] = atR;
9465  strat->sl++;
9466 #ifdef DEBUGF5
9467  int k;
9468  Print("--- LIST S: %d ---\n",strat->sl);
9469  for(k=0;k<=strat->sl;k++)
9470  {
9471  pWrite(strat->sig[k]);
9472  }
9473  PrintS("--- LIST S END ---\n");
9474 #endif
9475 }
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:99
void pWrite(poly p)
Definition: polys.h:291
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:403
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:3555
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 9677 of file kutil.cc.

9678 {
9679  #ifdef ADIDEBUG
9680  printf("\n Entersyz:\n");pWrite(p.sig);
9681  #endif
9682  int i;
9683  strat->newt = TRUE;
9684  if (strat->syzl == strat->syzmax-1)
9685  {
9686  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9687  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9688  (strat->syzmax)*sizeof(unsigned long),
9689  ((strat->syzmax)+setmaxTinc)
9690  *sizeof(unsigned long));
9691  strat->syzmax += setmaxTinc;
9692  }
9693  if (atT < strat->syzl)
9694  {
9695 #ifdef ENTER_USE_MEMMOVE
9696  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9697  (strat->syzl-atT+1)*sizeof(poly));
9698  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9699  (strat->syzl-atT+1)*sizeof(unsigned long));
9700 #endif
9701  for (i=strat->syzl; i>=atT+1; i--)
9702  {
9703 #ifndef ENTER_USE_MEMMOVE
9704  strat->syz[i] = strat->syz[i-1];
9705  strat->sevSyz[i] = strat->sevSyz[i-1];
9706 #endif
9707  }
9708  }
9709  //i = strat->syzl;
9710  i = atT;
9711  //Makes sure the syz saves just the signature
9712  #ifdef HAVE_RINGS
9714  pNext(p.sig) = NULL;
9715  #endif
9716  strat->syz[atT] = p.sig;
9717  strat->sevSyz[atT] = p.sevSig;
9718  strat->syzl++;
9719 #if F5DEBUG
9720  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9721  pWrite(strat->syz[atT]);
9722 #endif
9723  // recheck pairs in strat->L with new rule and delete correspondingly
9724  int cc = strat->Ll;
9725  while (cc>-1)
9726  {
9727  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9728  //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);
9729  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9730  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9731  #ifdef HAVE_RINGS
9732  &&((!rField_is_Ring(currRing))
9733  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9734  #endif
9735  )
9736  {
9737  //printf("\nYES!\n");
9738  #ifdef ADIDEBUG
9739  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9740  #endif
9741  deleteInL(strat->L,&strat->Ll,cc,strat);
9742  }
9743  cc--;
9744  }
9745 //#if 1
9746 #ifdef DEBUGF5
9747  PrintS("--- Syzygies ---\n");
9748  Print("syzl %d\n",strat->syzl);
9749  Print("syzmax %d\n",strat->syzmax);
9750  PrintS("--------------------------------\n");
9751  for(i=0;i<=strat->syzl-1;i++)
9752  {
9753  Print("%d - ",i);
9754  pWrite(strat->syz[i]);
9755  }
9756  PrintS("--------------------------------\n");
9757 #endif
9758 }
#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:99
void pWrite(poly p)
Definition: polys.h:291
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:1148
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:3555
#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 9480 of file kutil.cc.

9481 {
9482  int i;
9483 
9484  pp_Test(p.p, currRing, p.tailRing);
9485  assume(strat->tailRing == p.tailRing);
9486  // redMoraNF complains about this -- but, we don't really
9487  // neeed this so far
9488  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9489  assume(p.FDeg == p.pFDeg());
9490  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9491 
9492 #ifdef KDEBUG
9493  // do not put an LObject twice into T:
9494  for(i=strat->tl;i>=0;i--)
9495  {
9496  if (p.p==strat->T[i].p)
9497  {
9498  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9499  return;
9500  }
9501  }
9502 #endif
9503 
9504 #ifdef HAVE_TAIL_RING
9505  if (currRing!=strat->tailRing)
9506  {
9507  p.t_p=p.GetLmTailRing();
9508  }
9509 #endif
9510  strat->newt = TRUE;
9511  if (atT < 0)
9512  atT = strat->posInT(strat->T, strat->tl, p);
9513  if (strat->tl == strat->tmax-1)
9514  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9515  if (atT <= strat->tl)
9516  {
9517 #ifdef ENTER_USE_MEMMOVE
9518  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9519  (strat->tl-atT+1)*sizeof(TObject));
9520  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9521  (strat->tl-atT+1)*sizeof(unsigned long));
9522 #endif
9523  for (i=strat->tl+1; i>=atT+1; i--)
9524  {
9525 #ifndef ENTER_USE_MEMMOVE
9526  strat->T[i] = strat->T[i-1];
9527  strat->sevT[i] = strat->sevT[i-1];
9528 #endif
9529  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9530  }
9531  }
9532 
9533  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9534  {
9536  (strat->tailRing != NULL ?
9537  strat->tailRing : currRing),
9538  strat->tailBin);
9539  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9540  }
9541  strat->T[atT] = (TObject) p;
9542  #ifdef ADIDEBUG
9543  printf("\nenterT: add in position %i\n",atT);
9544  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9545  #endif
9546  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9547 
9548  if (pNext(p.p) != NULL)
9549  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9550  else
9551  strat->T[atT].max_exp = NULL;
9552 
9553  strat->tl++;
9554  strat->R[strat->tl] = &(strat->T[atT]);
9555  strat->T[atT].i_r = strat->tl;
9556  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9557  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9558  kTest_T(&(strat->T[atT]));
9559 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
char newt
Definition: kutil.h:398
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:99
#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:403
#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:656
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 9565 of file kutil.cc.

9566 {
9568  int i;
9569 
9570  pp_Test(p.p, currRing, p.tailRing);
9571  assume(strat->tailRing == p.tailRing);
9572  // redMoraNF complains about this -- but, we don't really
9573  // neeed this so far
9574  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9575  assume(p.FDeg == p.pFDeg());
9576  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9577 
9578 #ifdef KDEBUG
9579  // do not put an LObject twice into T:
9580  for(i=strat->tl;i>=0;i--)
9581  {
9582  if (p.p==strat->T[i].p)
9583  {
9584  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9585  return;
9586  }
9587  }
9588 #endif
9589 
9590 #ifdef HAVE_TAIL_RING
9591  if (currRing!=strat->tailRing)
9592  {
9593  p.t_p=p.GetLmTailRing();
9594  }
9595 #endif
9596  strat->newt = TRUE;
9597  if (atT < 0)
9598  atT = strat->posInT(strat->T, strat->tl, p);
9599  if (strat->tl == strat->tmax-1)
9600  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9601  if (atT <= strat->tl)
9602  {
9603 #ifdef ENTER_USE_MEMMOVE
9604  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9605  (strat->tl-atT+1)*sizeof(TObject));
9606  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9607  (strat->tl-atT+1)*sizeof(unsigned long));
9608 #endif
9609  for (i=strat->tl+1; i>=atT+1; i--)
9610  {
9611 #ifndef ENTER_USE_MEMMOVE
9612  strat->T[i] = strat->T[i-1];
9613  strat->sevT[i] = strat->sevT[i-1];
9614 #endif
9615  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9616  }
9617  }
9618 
9619  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9620  {
9622  (strat->tailRing != NULL ?
9623  strat->tailRing : currRing),
9624  strat->tailBin);
9625  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9626  }
9627  strat->T[atT] = (TObject) p;
9628  #ifdef ADIDEBUG
9629  printf("\nenterT_strong: add in position %i\n",atT);
9630  pWrite(p.p);
9631  #endif
9632  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9633 
9634  if (pNext(p.p) != NULL)
9635  strat->T[atT].max_exp = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9636  else
9637  strat->T[atT].max_exp = NULL;
9638 
9639  strat->tl++;
9640  strat->R[strat->tl] = &(strat->T[atT]);
9641  strat->T[atT].i_r = strat->tl;
9642  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9643  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9644  #if 1
9646  && !n_IsUnit(p.p->coef, currRing->cf))
9647  {
9648  #ifdef ADIDEBUG
9649  printf("\nDas ist p:\n");pWrite(p.p);
9650  #endif
9651  for(i=strat->tl;i>=0;i--)
9652  {
9653  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9654  {
9655  #ifdef ADIDEBUG
9656  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9657  #endif
9658  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9659  }
9660  }
9661  }
9662  /*
9663  printf("\nThis is T:\n");
9664  for(i=strat->tl;i>=0;i--)
9665  {
9666  pWrite(strat->T[i].p);
9667  }
9668  //getchar();*/
9669  #endif
9670  kTest_T(&(strat->T[atT]));
9671 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:708
char newt
Definition: kutil.h:398
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:99
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:319
void pWrite(poly p)
Definition: polys.h:291
#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:403
#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
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1513
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:656
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 12712 of file kutil.cc.

12713 {
12714  /* determine how many elements we have to insert */
12715  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12716  /* hence, a total number of elt's to add is: */
12717  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12718 
12719  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12720 
12721 #ifdef PDEBUG
12722  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12723 #endif
12724  int i;
12725 
12726  if (atT < 0)
12727  atT = strat->posInT(strat->T, strat->tl, p);
12728 
12729  /* can call enterT in a sequence, e.g. */
12730 
12731  /* shift0 = it's our model for further shifts */
12732  enterT(p,strat,atT);
12733  LObject qq;
12734  for (i=1; i<=toInsert; i++) // toIns - 1?
12735  {
12736  qq = p; //qq.Copy();
12737  qq.p = NULL;
12738  qq.max_exp = NULL;
12739  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12740  qq.GetP();
12741  // update q.sev
12742  qq.sev = pGetShortExpVector(qq.p);
12743  /* enter it into T, first el't is with the shift 0 */
12744  // compute the position for qq
12745  atT = strat->posInT(strat->T, strat->tl, qq);
12746  enterT(qq,strat,atT);
12747  }
12748 /* Q: what to do with this one in the orig enterT ? */
12749 /* strat->R[strat->tl] = &(strat->T[atT]); */
12750 /* Solution: it is done by enterT each time separately */
12751 }
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:9480
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 10179 of file kutil.cc.

10180 {
10181  /*- release temp data -*/
10182  cleanT(strat);
10183  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10184  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10185  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10186  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10187  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10188  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10189  /*- set L: should be empty -*/
10190  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10191  /*- set B: should be empty -*/
10192  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10193  pLmDelete(&strat->tail);
10194  strat->syzComp=0;
10195 }
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:116
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 10372 of file kutil.cc.

10373 {
10374  /*- release temp data -*/
10376  cleanTSbaRing(strat);
10377  else
10378  cleanT(strat);
10379  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10380  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10381  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10382  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10383  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10384  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10385  if(strat->syzmax>0)
10386  {
10387  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10388  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10389  if (strat->sbaOrder == 1)
10390  {
10391  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10392  }
10393  }
10394  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10395  /*- set L: should be empty -*/
10396  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10397  /*- set B: should be empty -*/
10398  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10399  /*- set sig: no need for the signatures anymore -*/
10400  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10401  pLmDelete(&strat->tail);
10402  strat->syzComp=0;
10403 }
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:116
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 7213 of file kutil.cc.

7214 {
7215  //printf("Faugere Rewritten Criterion\n");
7217  return FALSE;
7218 //#if 1
7219 #ifdef DEBUGF5
7220  PrintS("rewritten criterion checks: ");
7221  pWrite(sig);
7222 #endif
7223  for(int k = strat->sl; k>=start; k--)
7224  {
7225 //#if 1
7226 #ifdef DEBUGF5
7227  PrintS("checking with: ");
7228  pWrite(strat->sig[k]);
7229  pWrite(pHead(strat->S[k]));
7230 #endif
7231  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7232  {
7233 //#if 1
7234 #ifdef DEBUGF5
7235  PrintS("DELETE!\n");
7236 #endif
7237  #ifdef ADIDEBUG
7238  printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
7239  #endif
7240  strat->nrrewcrit++;
7241  return TRUE;
7242  }
7243  //k--;
7244  }
7245 #ifdef DEBUGF5
7246  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7247  for(int kk = 0; kk<strat->sl+1; kk++)
7248  {
7249  pWrite(pHead(strat->S[kk]));
7250  }
7251  PrintS("------------------------------\n");
7252 #endif
7253  return FALSE;
7254 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
void pWrite(poly p)
Definition: polys.h:291
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 11196 of file kutil.cc.

11197 {
11198  if(!nCoeff_is_Ring_Z(currRing->cf))
11199  return;
11200  poly p,pp;
11201  for(int j = 0; j<=strat->sl; j++)
11202  {
11203  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11204  {
11205  for(int i = 0; i<=strat->sl; i++)
11206  {
11207  if((i != j) && (strat->S[i] != NULL))
11208  {
11209  p = strat->S[i];
11210  if(pLmDivisibleBy(strat->S[j], p))
11211  {
11212  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11213  p_SetCoeff(p,dummy,currRing);
11214  }
11215  pp = pNext(p);
11216  if((pp == NULL) && (nIsZero(p->coef)))
11217  {
11218  deleteInS(i, strat);
11219  }
11220  else
11221  {
11222  while(pp != NULL)
11223  {
11224  if(pLmDivisibleBy(strat->S[j], pp))
11225  {
11226  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11227  p_SetCoeff(pp,dummy,currRing);
11228  if(nIsZero(pp->coef))
11229  {
11230  pLmDelete(&pNext(p));
11231  pp = pNext(p);
11232  }
11233  else
11234  {
11235  p = pp;
11236  pp = pNext(p);
11237  }
11238  }
11239  else
11240  {
11241  p = pp;
11242  pp = pNext(p);
11243  }
11244  }
11245  }
11246  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11247  {
11248  if(pNext(strat->S[i]) == NULL)
11249  strat->S[i]=NULL;
11250  else
11251  strat->S[i]=pNext(strat->S[i]);
11252  }
11253  }
11254  }
11255  //idPrint(strat->Shdl);
11256  }
11257  }
11258  //idSkipZeroes(strat->Shdl);
11259 }
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:1041
#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 6602 of file kutil.cc.

6603 {
6604  if (coeff == 0) return -1;
6605  long tmp = coeff;
6606  int ind = 0;
6607  while (tmp % 2 == 0)
6608  {
6609  tmp = tmp / 2;
6610  ind++;
6611  }
6612  return ind;
6613 }

§ 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:95
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:328
#define TRUE
Definition: auxiliary.h:99
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:748
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 4197 of file kutil.cc.

4198 {
4199  long ind = 0;
4200  if (arg <= 0) return 0;
4201  while (arg%2 == 0)
4202  {
4203  arg = arg / 2;
4204  ind++;
4205  }
4206  return ind;
4207 }

§ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4209 of file kutil.cc.

4210 {
4211  long ind = 0;
4212  if (arg <= 0) return 0;
4213  if (arg%2 == 1) { arg--; }
4214  while (arg > 0)
4215  {
4216  ind += ind2(arg);
4217  arg = arg - 2;
4218  }
4219  return ind;
4220 }
long ind2(long arg)
Definition: kutil.cc:4197

§ initBuchMora()

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

Definition at line 10103 of file kutil.cc.

10104 {
10105  strat->interpt = BTEST1(OPT_INTERRUPT);
10106  strat->kHEdge=NULL;
10108  /*- creating temp data structures------------------- -*/
10109  strat->cp = 0;
10110  strat->c3 = 0;
10111  strat->tail = pInit();
10112  /*- set s -*/
10113  strat->sl = -1;
10114  /*- set L -*/
10115  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10116  strat->Ll = -1;
10117  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10118  /*- set B -*/
10119  strat->Bmax = setmaxL;
10120  strat->Bl = -1;
10121  strat->B = initL();
10122  /*- set T -*/
10123  strat->tl = -1;
10124  strat->tmax = setmaxT;
10125  strat->T = initT();
10126  strat->R = initR();
10127  strat->sevT = initsevT();
10128  /*- init local data struct.---------------------------------------- -*/
10129  strat->P.ecart=0;
10130  strat->P.length=0;
10131  strat->P.pLength=0;
10133  {
10134  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10135  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10136  }
10138  {
10139  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10140  }
10141  else
10142  {
10143  if(TEST_OPT_SB_1)
10144  {
10145  int i;
10146  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10147  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10148  {
10149  P->m[i-strat->newIdeal] = F->m[i];
10150  F->m[i] = NULL;
10151  }
10152  initSSpecial(F,Q,P,strat);
10153  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10154  {
10155  F->m[i] = P->m[i-strat->newIdeal];
10156  P->m[i-strat->newIdeal] = NULL;
10157  }
10158  idDelete(&P);
10159  }
10160  else
10161  {
10162  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10163  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10164  }
10165  }
10166  strat->fromT = FALSE;
10168  if ((!TEST_OPT_SB_1)
10169  || (rField_is_Ring(currRing))
10170  )
10171  {
10172  updateS(TRUE,strat);
10173  }
10174  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10175  strat->fromQ=NULL;
10176  assume(kTest_TS(strat));
10177 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
#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:95
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:8140
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:99
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:8546
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:655
#define assume(x)
Definition: mod2.h:403
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:746
#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:9011
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 9779 of file kutil.cc.

9780 {
9782  strat->chainCrit=chainCritNormal;
9783  if (TEST_OPT_SB_1)
9784  strat->chainCrit=chainCritOpt_1;
9785 #ifdef HAVE_RINGS
9786  if (rField_is_Ring(currRing))
9787  {
9789  strat->chainCrit=chainCritRing;
9790  }
9791 #endif
9792 #ifdef HAVE_RATGRING
9793  if (rIsRatGRing(currRing))
9794  {
9795  strat->chainCrit=chainCritPart;
9796  /* enterOnePairNormal get rational part in it */
9797  }
9798 #endif
9799  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9800  && (!rIsPluralRing(currRing)))
9802 
9803  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9804  strat->Gebauer = strat->homog || strat->sugarCrit;
9805  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9806  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9807  strat->pairtest = NULL;
9808  /* alway use tailreduction, except:
9809  * - in local rings, - in lex order case, -in ring over extensions */
9811  //if(rHasMixedOrdering(currRing)==2)
9812  //{
9813  // strat->noTailReduction =TRUE;
9814  //}
9815 
9816 #ifdef HAVE_PLURAL
9817  // and r is plural_ring
9818  // hence this holds for r a rational_plural_ring
9819  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9820  { //or it has non-quasi-comm type... later
9821  strat->sugarCrit = FALSE;
9822  strat->Gebauer = FALSE;
9823  strat->honey = FALSE;
9824  }
9825 #endif
9826 
9827  // Coefficient ring?
9828  if (rField_is_Ring(currRing))
9829  {
9830  strat->sugarCrit = FALSE;
9831  strat->Gebauer = FALSE ;
9832  strat->honey = FALSE;
9833  }
9834  #ifdef KDEBUG
9835  if (TEST_OPT_DEBUG)
9836  {
9837  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9838  else PrintS("ideal/module is not homogeneous\n");
9839  }
9840  #endif
9841 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:95
BOOLEAN noTailReduction
Definition: kutil.h:375
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3250
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
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1934
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:4024
#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
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3463
void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2217
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538

§ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9930 of file kutil.cc.

9931 {
9933  {
9934  if (strat->honey)
9935  {
9936  strat->posInL = posInL15;
9937  // ok -- here is the deal: from my experiments for Singular-2-0
9938  // I conclude that that posInT_EcartpLength is the best of
9939  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9940  // see the table at the end of this file
9941  if (TEST_OPT_OLDSTD)
9942  strat->posInT = posInT15;
9943  else
9944  strat->posInT = posInT_EcartpLength;
9945  }
9946  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9947  {
9948  strat->posInL = posInL11;
9949  strat->posInT = posInT11;
9950  }
9951  else if (TEST_OPT_INTSTRATEGY)
9952  {
9953  strat->posInL = posInL11;
9954  strat->posInT = posInT11;
9955  }
9956  else
9957  {
9958  strat->posInL = posInL0;
9959  strat->posInT = posInT0;
9960  }
9961  //if (strat->minim>0) strat->posInL =posInLSpecial;
9962  if (strat->homog)
9963  {
9964  strat->posInL = posInL110;
9965  strat->posInT = posInT110;
9966  }
9967  }
9968  else
9969  {
9970  if (strat->homog)
9971  {
9972  strat->posInL = posInL11;
9973  strat->posInT = posInT11;
9974  }
9975  else
9976  {
9977  if ((currRing->order[0]==ringorder_c)
9978  ||(currRing->order[0]==ringorder_C))
9979  {
9980  strat->posInL = posInL17_c;
9981  strat->posInT = posInT17_c;
9982  }
9983  else
9984  {
9985  strat->posInL = posInL17;
9986  strat->posInT = posInT17;
9987  }
9988  }
9989  }
9990  if (strat->minim>0) strat->posInL =posInLSpecial;
9991  // for further tests only
9992  if ((BTEST1(11)) || (BTEST1(12)))
9993  strat->posInL = posInL11;
9994  else if ((BTEST1(13)) || (BTEST1(14)))
9995  strat->posInL = posInL13;
9996  else if ((BTEST1(15)) || (BTEST1(16)))
9997  strat->posInL = posInL15;
9998  else if ((BTEST1(17)) || (BTEST1(18)))
9999  strat->posInL = posInL17;
10000  if (BTEST1(11))
10001  strat->posInT = posInT11;
10002  else if (BTEST1(13))
10003  strat->posInT = posInT13;
10004  else if (BTEST1(15))
10005  strat->posInT = posInT15;
10006  else if ((BTEST1(17)))
10007  strat->posInT = posInT17;
10008  else if ((BTEST1(19)))
10009  strat->posInT = posInT19;
10010  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10011  strat->posInT = posInT1;
10013 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
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:6898
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
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:5714
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:6699
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9914
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:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
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:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

§ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10016 of file kutil.cc.

10017 {
10019  {
10020  if (strat->honey)
10021  {
10022  strat->posInL = posInL15Ring;
10023  // ok -- here is the deal: from my experiments for Singular-2-0
10024  // I conclude that that posInT_EcartpLength is the best of
10025  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10026  // see the table at the end of this file
10027  if (TEST_OPT_OLDSTD)
10028  strat->posInT = posInT15Ring;
10029  else
10030  strat->posInT = posInT_EcartpLength;
10031  }
10032  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10033  {
10034  strat->posInL = posInL11Ring;
10035  strat->posInT = posInT11;
10036  }
10037  else if (TEST_OPT_INTSTRATEGY)
10038  {
10039  strat->posInL = posInL11Ring;
10040  strat->posInT = posInT11;
10041  }
10042  else
10043  {
10044  strat->posInL = posInL0Ring;
10045  strat->posInT = posInT0;
10046  }
10047  //if (strat->minim>0) strat->posInL =posInLSpecial;
10048  if (strat->homog)
10049  {
10050  strat->posInL = posInL110Ring;
10051  strat->posInT = posInT110Ring;
10052  }
10053  }
10054  else
10055  {
10056  if (strat->homog)
10057  {
10058  //printf("\nHere 3\n");
10059  strat->posInL = posInL11Ring;
10060  strat->posInT = posInT11Ring;
10061  }
10062  else
10063  {
10064  if ((currRing->order[0]==ringorder_c)
10065  ||(currRing->order[0]==ringorder_C))
10066  {
10067  strat->posInL = posInL17_cRing;
10068  strat->posInT = posInT17_cRing;
10069  }
10070  else
10071  {
10072  strat->posInL = posInL11Ringls;
10073  strat->posInT = posInT17Ring;
10074  }
10075  }
10076  }
10077  if (strat->minim>0) strat->posInL =posInLSpecial;
10078  // for further tests only
10079  if ((BTEST1(11)) || (BTEST1(12)))
10080  strat->posInL = posInL11Ring;
10081  else if ((BTEST1(13)) || (BTEST1(14)))
10082  strat->posInL = posInL13;
10083  else if ((BTEST1(15)) || (BTEST1(16)))
10084  strat->posInL = posInL15Ring;
10085  else if ((BTEST1(17)) || (BTEST1(18)))
10086  strat->posInL = posInL17Ring;
10087  if (BTEST1(11))
10088  strat->posInT = posInT11Ring;
10089  else if (BTEST1(13))
10090  strat->posInT = posInT13;
10091  else if (BTEST1(15))
10092  strat->posInT = posInT15Ring;
10093  else if ((BTEST1(17)))
10094  strat->posInT = posInT17Ring;
10095  else if ((BTEST1(19)))
10096  strat->posInT = posInT19;
10097  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10098  strat->posInT = posInT1;
10100 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
BOOLEAN honey
Definition: kutil.h:374
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6857
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6942
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5768
#define BTEST1(a)
Definition: options.h:32
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7056
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:5335
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9914
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:5404
BOOLEAN homog
Definition: kutil.h:369
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5440
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5870
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5599
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6169
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5977
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

§ initBuchMoraShift()

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

Definition at line 12096 of file kutil.cc.

12097 {
12098  strat->interpt = BTEST1(OPT_INTERRUPT);
12099  strat->kHEdge=NULL;
12101  /*- creating temp data structures------------------- -*/
12102  strat->cp = 0;
12103  strat->c3 = 0;
12104  strat->cv = 0;
12105  strat->tail = pInit();
12106  /*- set s -*/
12107  strat->sl = -1;
12108  /*- set L -*/
12109  strat->Lmax = setmaxL;
12110  strat->Ll = -1;
12111  strat->L = initL();
12112  /*- set B -*/
12113  strat->Bmax = setmaxL;
12114  strat->Bl = -1;
12115  strat->B = initL();
12116  /*- set T -*/
12117  strat->tl = -1;
12118  strat->tmax = setmaxT;
12119  strat->T = initT();
12120  strat->R = initR();
12121  strat->sevT = initsevT();
12122  /*- init local data struct.---------------------------------------- -*/
12123  strat->P.ecart=0;
12124  strat->P.length=0;
12126  {
12127  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12128  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12129  }
12131  {
12132  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12133  }
12134  {
12135  if(TEST_OPT_SB_1)
12136  {
12137  int i;
12138  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12139  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12140  {
12141  P->m[i-strat->newIdeal] = F->m[i];
12142  F->m[i] = NULL;
12143  }
12144  initSSpecial(F,Q,P,strat);
12145  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12146  {
12147  F->m[i] = P->m[i-strat->newIdeal];
12148  P->m[i-strat->newIdeal] = NULL;
12149  }
12150  idDelete(&P);
12151  }
12152  else
12153  {
12154  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12155  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12156  }
12157  }
12158  strat->fromT = FALSE;
12159  if (!TEST_OPT_SB_1)
12160  {
12161  /* the only change: we do not fill the set T*/
12162  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12163  }
12164  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12165  strat->fromQ=NULL;
12166  /* more changes: fill the set T with all the shifts of elts of S*/
12167  /* is done by other procedure */
12168 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:95
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:8140
#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:8546
#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:746
#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:9011
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 1242 of file kutil.cc.

1243 {
1244  h->FDeg = h->pFDeg();
1245  (*h).ecart = 0;
1246  h->length=h->pLength=pLength(h->p);
1247 }
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 1234 of file kutil.cc.

1235 {
1236  h->FDeg = h->pFDeg();
1237  h->ecart = h->pLDeg() - h->FDeg;
1238  // h->length is set by h->pLDeg
1239  h->length=h->pLength=pLength(h->p);
1240 }
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 1249 of file kutil.cc.

1250 {
1251  Lp->FDeg = Lp->pFDeg();
1252  (*Lp).ecart = 0;
1253  (*Lp).length = 0;
1254 }

§ initEcartPairMora()

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

Definition at line 1256 of file kutil.cc.

1257 {
1258  Lp->FDeg = Lp->pFDeg();
1259  (*Lp).ecart = si_max(ecartF,ecartG);
1260  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1261  (*Lp).length = 0;
1262 }
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:121

§ initenterpairs()

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

Definition at line 3827 of file kutil.cc.

3828 {
3829 
3830  if ((strat->syzComp==0)
3831  || (pGetComp(h)<=strat->syzComp))
3832  {
3833  int j;
3834  BOOLEAN new_pair=FALSE;
3835 
3836  if (pGetComp(h)==0)
3837  {
3838  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3839  if ((isFromQ)&&(strat->fromQ!=NULL))
3840  {
3841  for (j=0; j<=k; j++)
3842  {
3843  if (!strat->fromQ[j])
3844  {
3845  new_pair=TRUE;
3846  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3847  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3848  }
3849  }
3850  }
3851  else
3852  {
3853  new_pair=TRUE;
3854  for (j=0; j<=k; j++)
3855  {
3856  #ifdef ADIDEBUG
3857  PrintS("\n Trying to add spoly : \n");
3858  PrintS(" ");p_Write(h, strat->tailRing);
3859  PrintS(" ");p_Write(strat->S[j],strat->tailRing);
3860  #endif
3861  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3862  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3863  }
3864  }
3865  }
3866  else
3867  {
3868  for (j=0; j<=k; j++)
3869  {
3870  if ((pGetComp(h)==pGetComp(strat->S[j]))
3871  || (pGetComp(strat->S[j])==0))
3872  {
3873  new_pair=TRUE;
3874  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
3875  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3876  }
3877  }
3878  }
3879  if (new_pair)
3880  {
3881  #ifdef HAVE_RATGRING
3882  if (currRing->real_var_start>0)
3883  chainCritPart(h,ecart,strat);
3884  else
3885  #endif
3886  strat->chainCrit(h,ecart,strat);
3887  }
3888  kMergeBintoL(strat);
3889  }
3890 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:3204
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:86
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538

§ initenterpairsShift()

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

Definition at line 12639 of file kutil.cc.

12640 {
12641  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12642  // atR = -1;
12643  if ((strat->syzComp==0)
12644  || (pGetComp(h)<=strat->syzComp))
12645  {
12646  int j;
12647  BOOLEAN new_pair=FALSE;
12648 
12649  if (pGetComp(h)==0)
12650  {
12651  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12652  if ((isFromQ)&&(strat->fromQ!=NULL))
12653  {
12654  for (j=0; j<=k; j++)
12655  {
12656  if (!strat->fromQ[j])
12657  {
12658  new_pair=TRUE;
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  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12663  }
12664  }
12665  }
12666  else
12667  {
12668  new_pair=TRUE;
12669  for (j=0; j<=k; j++)
12670  {
12671  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12672  // other side pairs
12673  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12674  }
12675  /* HERE we put (h, s*h) pairs */
12676  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
12677  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12678  }
12679  }
12680  else
12681  {
12682  for (j=0; j<=k; j++)
12683  {
12684  if ((pGetComp(h)==pGetComp(strat->S[j]))
12685  || (pGetComp(strat->S[j])==0))
12686  {
12687  new_pair=TRUE;
12688  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
12689  // other side pairs
12690  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12691  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12692  }
12693  }
12694  /* HERE we put (h, s*h) pairs */
12695  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12696  }
12697 
12698  if (new_pair)
12699  {
12700  strat->chainCrit(h,ecart,strat);
12701  }
12702 
12703  }
12704 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:86
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12175
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12250

§ initenterpairsSig()

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

Definition at line 3897 of file kutil.cc.

3898 {
3899 
3900  if ((strat->syzComp==0)
3901  || (pGetComp(h)<=strat->syzComp))
3902  {
3903  int j;
3904  BOOLEAN new_pair=FALSE;
3905 
3906  if (pGetComp(h)==0)
3907  {
3908  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3909  if ((isFromQ)&&(strat->fromQ!=NULL))
3910  {
3911  for (j=0; j<=k; j++)
3912  {
3913  if (!strat->fromQ[j])
3914  {
3915  new_pair=TRUE;
3916  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3917  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3918  }
3919  }
3920  }
3921  else
3922  {
3923  new_pair=TRUE;
3924  for (j=0; j<=k; j++)
3925  {
3926  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3927  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3928  }
3929  }
3930  }
3931  else
3932  {
3933  for (j=0; j<=k; j++)
3934  {
3935  if ((pGetComp(h)==pGetComp(strat->S[j]))
3936  || (pGetComp(strat->S[j])==0))
3937  {
3938  new_pair=TRUE;
3939  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3940  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3941  }
3942  }
3943  }
3944 
3945  if (new_pair)
3946  {
3947 #ifdef HAVE_RATGRING
3948  if (currRing->real_var_start>0)
3949  chainCritPart(h,ecart,strat);
3950  else
3951 #endif
3952  strat->chainCrit(h,ecart,strat);
3953  }
3954  }
3955 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:95
void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2433
#define TRUE
Definition: auxiliary.h:99
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:86
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538

§ initenterpairsSigRing()

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

Definition at line 3957 of file kutil.cc.

3958 {
3959 
3960  if ((strat->syzComp==0)
3961  || (pGetComp(h)<=strat->syzComp))
3962  {
3963  int j;
3964  BOOLEAN new_pair=FALSE;
3965 
3966  if (pGetComp(h)==0)
3967  {
3968  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3969  if ((isFromQ)&&(strat->fromQ!=NULL))
3970  {
3971  for (j=0; j<=k && !strat->sigdrop; j++)
3972  {
3973  if (!strat->fromQ[j])
3974  {
3975  new_pair=TRUE;
3976  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3977  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3978  }
3979  }
3980  }
3981  else
3982  {
3983  new_pair=TRUE;
3984  for (j=0; j<=k && !strat->sigdrop; j++)
3985  {
3986  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3987  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3988  }
3989  }
3990  }
3991  else
3992  {
3993  for (j=0; j<=k && !strat->sigdrop; j++)
3994  {
3995  if ((pGetComp(h)==pGetComp(strat->S[j]))
3996  || (pGetComp(strat->S[j])==0))
3997  {
3998  new_pair=TRUE;
3999  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
4000  //Print("j:%d, Ll:%d\n",j,strat->Ll);
4001  }
4002  }
4003  }
4004 
4005 #if 0
4006  if (new_pair)
4007  {
4008 #ifdef HAVE_RATGRING
4009  if (currRing->real_var_start>0)
4010  chainCritPart(h,ecart,strat);
4011  else
4012 #endif
4013  strat->chainCrit(h,ecart,strat);
4014  }
4015 #endif
4016  }
4017 }
int syzComp
Definition: kutil.h:350
bool sigdrop
Definition: kutil.h:356
#define FALSE
Definition: auxiliary.h:95
#define TRUE
Definition: auxiliary.h:99
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:86
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538
void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2690

§ initenterstrongPairs()

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

Definition at line 4611 of file kutil.cc.

4612 {
4613  const int iCompH = pGetComp(h);
4614  if (!nIsOne(pGetCoeff(h)))
4615  {
4616  int j;
4617 
4618  for (j=0; j<=k; j++)
4619  {
4620  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4621 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4622 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4623  if (((iCompH == pGetComp(strat->S[j]))
4624  || (0 == pGetComp(strat->S[j])))
4625  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4626  {
4627  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
4628  }
4629  }
4630  }
4631 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:95
#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
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1513
static Poly * h
Definition: janet.cc:978

§ initenterstrongPairsSig()

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

Definition at line 4633 of file kutil.cc.

4634 {
4635  const int iCompH = pGetComp(h);
4636  if (!nIsOne(pGetCoeff(h)))
4637  {
4638  int j;
4639 
4640  for (j=0; j<=k && !strat->sigdrop; j++)
4641  {
4642  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4643 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4644 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4645  if (((iCompH == pGetComp(strat->S[j]))
4646  || (0 == pGetComp(strat->S[j])))
4647  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4648  {
4649  enterOneStrongPolySig(j,h,hSig,ecart,isFromQ,strat, atR);
4650  }
4651  }
4652  }
4653 }
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 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
BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
Definition: kutil.cc:1708
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 4479 of file kutil.cc.

4480 {
4481  // Initialize
4482  long exp[50]; // The exponent of \hat{X} (basepoint)
4483  long cexp[50]; // The current exponent for iterating over all
4484  long ind[50]; // The power of 2 in the i-th component of exp
4485  long cind[50]; // analog for cexp
4486  long mult[50]; // How to multiply the elements of G
4487  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
4488  long habsind = 0; // The abs. index of the coefficient of h
4489  long step[50]; // The last increases
4490  for (int i = 1; i <= currRing->N; i++)
4491  {
4492  exp[i] = p_GetExp(p, i, currRing);
4493  if (exp[i] & 1 != 0)
4494  {
4495  exp[i] = exp[i] - 1;
4496  mult[i] = 1;
4497  }
4498  cexp[i] = exp[i];
4499  ind[i] = ind_fact_2(exp[i]);
4500  cabsind += ind[i];
4501  cind[i] = ind[i];
4502  step[i] = 500000;
4503  }
4504  step[1] = 500000;
4505  habsind = ind2(n_Int(pGetCoeff(p), currRing->cf);
4506  long bound = currRing->ch - habsind;
4507 #ifdef OLI_DEBUG
4508  PrintS("-------------\npoly :");
4509  wrp(p);
4510  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
4511  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
4512  Print("cind : (%d, %d)\n", cind[1], cind[2]);
4513  Print("bound : %d\n", bound);
4514  Print("cind : %d\n", cabsind);
4515 #endif
4516  if (cabsind == 0)
4517  {
4518  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
4519  {
4520  return;
4521  }
4522  }
4523  // Now the whole simplex
4524  do
4525  {
4526  // Build s-polynomial
4527  // 2**ind-def * mult * g - exp-def * h
4528  poly t_p;
4529  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, strat->tailRing);
4530 #ifdef OLI_DEBUG
4531  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
4532  PrintS("zPoly : ");
4533  wrp(zeroPoly);
4534  PrintLn();
4535 #endif
4536  enterOneZeroPairRing(zeroPoly, t_p, p, ecart, strat, atR);
4537  }
4538  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
4539 }
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:4416
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:4350
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:4232
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:4209
ring tailRing
Definition: kutil.h:339
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:4197
void wrp(poly p)
Definition: polys.h:293
polyrec * poly
Definition: hilb.h:10

§ initHilbCrit()

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

Definition at line 9761 of file kutil.cc.

9762 {
9763 
9764  //if the ordering is local, then hilb criterion
9765  //can be used also if the ideal is not homogenous
9767  {
9769  *hilb=NULL;
9770  else
9771  return;
9772  }
9773  if (strat->homog!=isHomog)
9774  {
9775  *hilb=NULL;
9776  }
9777 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
#define FALSE
Definition: auxiliary.h:95
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:748
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:86
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ initS()

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

Definition at line 8044 of file kutil.cc.

8045 {
8046  int i,pos;
8047 
8048  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8049  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8050  strat->ecartS=initec(i);
8051  strat->sevS=initsevS(i);
8052  strat->S_2_R=initS_2_R(i);
8053  strat->fromQ=NULL;
8054  strat->Shdl=idInit(i,F->rank);
8055  strat->S=strat->Shdl->m;
8056  /*- put polys into S -*/
8057  if (Q!=NULL)
8058  {
8059  strat->fromQ=initec(i);
8060  memset(strat->fromQ,0,i*sizeof(int));
8061  for (i=0; i<IDELEMS(Q); i++)
8062  {
8063  if (Q->m[i]!=NULL)
8064  {
8065  LObject h;
8066  h.p = pCopy(Q->m[i]);
8068  {
8069  //pContent(h.p);
8070  h.pCleardenom(); // also does a pContent
8071  }
8072  else
8073  {
8074  h.pNorm();
8075  }
8077  {
8078  deleteHC(&h, strat);
8079  }
8080  if (h.p!=NULL)
8081  {
8082  strat->initEcart(&h);
8083  if (strat->sl==-1)
8084  pos =0;
8085  else
8086  {
8087  pos = posInS(strat,strat->sl,h.p,h.ecart);
8088  }
8089  h.sev = pGetShortExpVector(h.p);
8090  strat->enterS(h,pos,strat,-1);
8091  strat->fromQ[pos]=1;
8092  }
8093  }
8094  }
8095  }
8096  for (i=0; i<IDELEMS(F); i++)
8097  {
8098  if (F->m[i]!=NULL)
8099  {
8100  LObject h;
8101  h.p = pCopy(F->m[i]);
8103  {
8104  cancelunit(&h); /*- tries to cancel a unit -*/
8105  deleteHC(&h, strat);
8106  }
8107  if (h.p!=NULL)
8108  // do not rely on the input being a SB!
8109  {
8111  {
8112  //pContent(h.p);
8113  h.pCleardenom(); // also does a pContent
8114  }
8115  else
8116  {
8117  h.pNorm();
8118  }
8119  strat->initEcart(&h);
8120  if (strat->sl==-1)
8121  pos =0;
8122  else
8123  pos = posInS(strat,strat->sl,h.p,h.ecart);
8124  h.sev = pGetShortExpVector(h.p);
8125  strat->enterS(h,pos,strat,-1);
8126  }
8127  }
8128  }
8129  /*- test, if a unit is in F -*/
8130  if ((strat->sl>=0)
8131 #ifdef HAVE_RINGS
8132  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8133 #endif
8134  && pIsConstant(strat->S[0]))
8135  {
8136  while (strat->sl>0) deleteInS(strat->sl,strat);
8137  }
8138 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:1041
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:5112
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 10299 of file kutil.cc.

10300 {
10301  strat->interpt = BTEST1(OPT_INTERRUPT);
10302  strat->kHEdge=NULL;
10304  /*- creating temp data structures------------------- -*/
10305  strat->cp = 0;
10306  strat->c3 = 0;
10307  strat->tail = pInit();
10308  /*- set s -*/
10309  strat->sl = -1;
10310  /*- set ps -*/
10311  strat->syzl = -1;
10312  /*- set L -*/
10313  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10314  strat->Ll = -1;
10315  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10316  /*- set B -*/
10317  strat->Bmax = setmaxL;
10318  strat->Bl = -1;
10319  strat->B = initL();
10320  /*- set T -*/
10321  strat->tl = -1;
10322  strat->tmax = setmaxT;
10323  strat->T = initT();
10324  strat->R = initR();
10325  strat->sevT = initsevT();
10326  /*- init local data struct.---------------------------------------- -*/
10327  strat->P.ecart=0;
10328  strat->P.length=0;
10330  {
10331  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10332  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10333  }
10335  {
10336  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10337  }
10338  else
10339  {
10340  if(TEST_OPT_SB_1)
10341  {
10342  int i;
10343  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10344  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10345  {
10346  P->m[i-strat->newIdeal] = F->m[i];
10347  F->m[i] = NULL;
10348  }
10349  initSSpecialSba(F,Q,P,strat);
10350  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10351  {
10352  F->m[i] = P->m[i-strat->newIdeal];
10353  P->m[i-strat->newIdeal] = NULL;
10354  }
10355  idDelete(&P);
10356  }
10357  else
10358  {
10359  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10360  }
10361  }
10362  strat->fromT = FALSE;
10363  if (!TEST_OPT_SB_1)
10364  {
10365  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10366  }
10367  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10368  //strat->fromQ=NULL;
10369  assume(kTest_TS(strat));
10370 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:95
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:99
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8691
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:8239
#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:655
#define assume(x)
Definition: mod2.h:403
#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:746
#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:9011
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 9843 of file kutil.cc.

9844 {
9845  //strat->enterOnePair=enterOnePairNormal;
9847  //strat->chainCrit=chainCritNormal;
9848  strat->chainCrit = chainCritSig;
9849  /******************************************
9850  * rewCrit1 and rewCrit2 are already set in
9851  * kSba() in kstd1.cc
9852  *****************************************/
9853  //strat->rewCrit1 = faugereRewCriterion;
9854  if (strat->sbaOrder == 1)
9855  {
9856  strat->syzCrit = syzCriterionInc;
9857  }
9858  else
9859  {
9860  strat->syzCrit = syzCriterion;
9861  }
9862 #ifdef HAVE_RINGS
9863  if (rField_is_Ring(currRing))
9864  {
9866  strat->chainCrit=chainCritRing;
9867  }
9868 #endif
9869 #ifdef HAVE_RATGRING
9870  if (rIsRatGRing(currRing))
9871  {
9872  strat->chainCrit=chainCritPart;
9873  /* enterOnePairNormal get rational part in it */
9874  }
9875 #endif
9876 
9877  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9878  strat->Gebauer = strat->homog || strat->sugarCrit;
9879  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9880  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9881  strat->pairtest = NULL;
9882  /* alway use tailreduction, except:
9883  * - in local rings, - in lex order case, -in ring over extensions */
9886 
9887 #ifdef HAVE_PLURAL
9888  // and r is plural_ring
9889  // hence this holds for r a rational_plural_ring
9890  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9891  { //or it has non-quasi-comm type... later
9892  strat->sugarCrit = FALSE;
9893  strat->Gebauer = FALSE;
9894  strat->honey = FALSE;
9895  }
9896 #endif
9897 
9898  // Coefficient ring?
9899  if (rField_is_Ring(currRing))
9900  {
9901  strat->sugarCrit = FALSE;
9902  strat->Gebauer = FALSE ;
9903  strat->honey = FALSE;
9904  }
9905  #ifdef KDEBUG
9906  if (TEST_OPT_DEBUG)
9907  {
9908  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9909  else PrintS("ideal/module is not homogeneous\n");
9910  }
9911  #endif
9912 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:374
#define FALSE
Definition: auxiliary.h:95
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:99
#define TEST_OPT_DEBUG
Definition: options.h:103
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3479
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1934
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:4024
#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:748
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7123
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7161
#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
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538

§ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10197 of file kutil.cc.

10198 {
10200  {
10201  if (strat->honey)
10202  {
10203  strat->posInL = posInL15;
10204  // ok -- here is the deal: from my experiments for Singular-2-0
10205  // I conclude that that posInT_EcartpLength is the best of
10206  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10207  // see the table at the end of this file
10208  if (TEST_OPT_OLDSTD)
10209  strat->posInT = posInT15;
10210  else
10211  strat->posInT = posInT_EcartpLength;
10212  }
10213  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10214  {
10215  strat->posInL = posInL11;
10216  strat->posInT = posInT11;
10217  }
10218  else if (TEST_OPT_INTSTRATEGY)
10219  {
10220  strat->posInL = posInL11;
10221  strat->posInT = posInT11;
10222  }
10223  else
10224  {
10225  strat->posInL = posInL0;
10226  strat->posInT = posInT0;
10227  }
10228  //if (strat->minim>0) strat->posInL =posInLSpecial;
10229  if (strat->homog)
10230  {
10231  strat->posInL = posInL110;
10232  strat->posInT = posInT110;
10233  }
10234  }
10235  else
10236  {
10237  if (strat->homog)
10238  {
10239  strat->posInL = posInL11;
10240  strat->posInT = posInT11;
10241  }
10242  else
10243  {
10244  if ((currRing->order[0]==ringorder_c)
10245  ||(currRing->order[0]==ringorder_C))
10246  {
10247  strat->posInL = posInL17_c;
10248  strat->posInT = posInT17_c;
10249  }
10250  else
10251  {
10252  strat->posInL = posInL17;
10253  strat->posInT = posInT17;
10254  }
10255  }
10256  }
10257  if (strat->minim>0) strat->posInL =posInLSpecial;
10258  // for further tests only
10259  if ((BTEST1(11)) || (BTEST1(12)))
10260  strat->posInL = posInL11;
10261  else if ((BTEST1(13)) || (BTEST1(14)))
10262  strat->posInL = posInL13;
10263  else if ((BTEST1(15)) || (BTEST1(16)))
10264  strat->posInL = posInL15;
10265  else if ((BTEST1(17)) || (BTEST1(18)))
10266  strat->posInL = posInL17;
10267  if (BTEST1(11))
10268  strat->posInT = posInT11;
10269  else if (BTEST1(13))
10270  strat->posInT = posInT13;
10271  else if (BTEST1(15))
10272  strat->posInT = posInT15;
10273  else if ((BTEST1(17)))
10274  strat->posInT = posInT17;
10275  else if ((BTEST1(19)))
10276  strat->posInT = posInT19;
10277  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10278  strat->posInT = posInT1;
10279  if (rField_is_Ring(currRing))
10280  {
10281  strat->posInL = posInL11Ring;
10282  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10283  strat->posInL = posInL11Ringls;
10284  strat->posInT = posInT11;
10285  }
10286  strat->posInLDependsOnLength = FALSE;
10287  strat->posInLSba = posInLSig;
10288  //strat->posInL = posInLSig;
10289  strat->posInL = posInLF5C;
10290  /*
10291  if (rField_is_Ring(currRing))
10292  {
10293  strat->posInLSba = posInLSigRing;
10294  strat->posInL = posInL11Ring;
10295  }*/
10296  //strat->posInT = posInTSig;
10297 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
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:6898
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
#define FALSE
Definition: auxiliary.h:95
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
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:99
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6389
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
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:6699
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6201
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:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
BOOLEAN homog
Definition: kutil.h:369
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

§ 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 8140 of file kutil.cc.

8141 {
8142  int i,pos;
8143 
8144  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8145  else i=setmaxT;
8146  strat->ecartS=initec(i);
8147  strat->sevS=initsevS(i);
8148  strat->S_2_R=initS_2_R(i);
8149  strat->fromQ=NULL;
8150  strat->Shdl=idInit(i,F->rank);
8151  strat->S=strat->Shdl->m;
8152  /*- put polys into S -*/
8153  if (Q!=NULL)
8154  {
8155  strat->fromQ=initec(i);
8156  memset(strat->fromQ,0,i*sizeof(int));
8157  for (i=0; i<IDELEMS(Q); i++)
8158  {
8159  if (Q->m[i]!=NULL)
8160  {
8161  LObject h;
8162  h.p = pCopy(Q->m[i]);
8164  {
8165  deleteHC(&h,strat);
8166  }
8168  {
8169  //pContent(h.p);
8170  h.pCleardenom(); // also does a pContent
8171  }
8172  else
8173  {
8174  h.pNorm();
8175  }
8176  if (h.p!=NULL)
8177  {
8178  strat->initEcart(&h);
8179  if (strat->sl==-1)
8180  pos =0;
8181  else
8182  {
8183  pos = posInS(strat,strat->sl,h.p,h.ecart);
8184  }
8185  h.sev = pGetShortExpVector(h.p);
8186  strat->enterS(h,pos,strat,-1);
8187  strat->fromQ[pos]=1;
8188  }
8189  }
8190  }
8191  }
8192  for (i=0; i<IDELEMS(F); i++)
8193  {
8194  if (F->m[i]!=NULL)
8195  {
8196  LObject h;
8197  h.p = pCopy(F->m[i]);
8198  if (h.p!=NULL)
8199  {
8201  {
8202  cancelunit(&h); /*- tries to cancel a unit -*/
8203  deleteHC(&h, strat);
8204  }
8205  if (h.p!=NULL)
8206  {
8208  {
8209  //pContent(h.p);
8210  h.pCleardenom(); // also does a pContent
8211  }
8212  else
8213  {
8214  h.pNorm();
8215  }
8216  strat->initEcart(&h);
8217  if (strat->Ll==-1)
8218  pos =0;
8219  else
8220  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8221  h.sev = pGetShortExpVector(h.p);
8222  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8223  }
8224  }
8225  }
8226  }
8227  /*- test, if a unit is in F -*/
8228 
8229  if ((strat->Ll>=0)
8230 #ifdef HAVE_RINGS
8231  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8232 #endif
8233  && pIsConstant(strat->L[strat->Ll].p))
8234  {
8235  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8236  }
8237 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:1210
#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:1148
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:5112
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 8239 of file kutil.cc.

8240 {
8241  int i,pos;
8242  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8243  else i=setmaxT;
8244  strat->ecartS = initec(i);
8245  strat->sevS = initsevS(i);
8246  strat->sevSig = initsevS(i);
8247  strat->S_2_R = initS_2_R(i);
8248  strat->fromQ = NULL;
8249  strat->Shdl = idInit(i,F->rank);
8250  strat->S = strat->Shdl->m;
8251  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8252  if (strat->sbaOrder != 1)
8253  {
8254  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8255  strat->sevSyz = initsevS(i);
8256  strat->syzmax = i;
8257  strat->syzl = 0;
8258  }
8259  /*- put polys into S -*/
8260  if (Q!=NULL)
8261  {
8262  strat->fromQ=initec(i);
8263  memset(strat->fromQ,0,i*sizeof(int));
8264  for (i=0; i<IDELEMS(Q); i++)
8265  {
8266  if (Q->m[i]!=NULL)
8267  {
8268  LObject h;
8269  h.p = pCopy(Q->m[i]);
8271  {
8272  deleteHC(&h,strat);
8273  }
8275  {
8276  //pContent(h.p);
8277  h.pCleardenom(); // also does a pContent
8278  }
8279  else
8280  {
8281  h.pNorm();
8282  }
8283  if (h.p!=NULL)
8284  {
8285  strat->initEcart(&h);
8286  if (strat->sl==-1)
8287  pos =0;
8288  else
8289  {
8290  pos = posInS(strat,strat->sl,h.p,h.ecart);
8291  }
8292  h.sev = pGetShortExpVector(h.p);
8293  strat->enterS(h,pos,strat,-1);
8294  strat->fromQ[pos]=1;
8295  }
8296  }
8297  }
8298  }
8299  for (i=0; i<IDELEMS(F); i++)
8300  {
8301  if (F->m[i]!=NULL)
8302  {
8303  LObject h;
8304  h.p = pCopy(F->m[i]);
8305  h.sig = pOne();
8306  //h.sig = pInit();
8307  //p_SetCoeff(h.sig,nInit(1),currRing);
8308  p_SetComp(h.sig,i+1,currRing);
8309  // if we are working with the Schreyer order we generate it
8310  // by multiplying the initial signatures with the leading monomial
8311  // of the corresponding initial polynomials generating the ideal
8312  // => we can keep the underlying monomial order and get a Schreyer
8313  // order without any bigger overhead
8314  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8315  {
8316  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8317  }
8318  h.sevSig = pGetShortExpVector(h.sig);
8319 #ifdef DEBUGF5
8320  pWrite(h.p);
8321  pWrite(h.sig);
8322 #endif
8323  if (h.p!=NULL)
8324  {
8326  {
8327  cancelunit(&h); /*- tries to cancel a unit -*/
8328  deleteHC(&h, strat);
8329  }
8330  if (h.p!=NULL)
8331  {
8333  {
8334  //pContent(h.p);
8335  h.pCleardenom(); // also does a pContent
8336  }
8337  else
8338  {
8339  h.pNorm();
8340  }
8341  strat->initEcart(&h);
8342  if (strat->Ll==-1)
8343  pos =0;
8344  else
8345  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8346  h.sev = pGetShortExpVector(h.p);
8347  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8348  }
8349  }
8350  /*
8351  if (strat->sbaOrder != 1)
8352  {
8353  for(j=0;j<i;j++)
8354  {
8355  strat->syz[ctr] = pCopy(F->m[j]);
8356  p_SetCompP(strat->syz[ctr],i+1,currRing);
8357  // add LM(F->m[i]) to the signature to get a Schreyer order
8358  // without changing the underlying polynomial ring at all
8359  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8360  // since p_Add_q() destroys all input
8361  // data we need to recreate help
8362  // each time
8363  poly help = pCopy(F->m[i]);
8364  p_SetCompP(help,j+1,currRing);
8365  pWrite(strat->syz[ctr]);
8366  pWrite(help);
8367  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8368  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8369  printf("%d. SYZ ",ctr);
8370  pWrite(strat->syz[ctr]);
8371  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8372  ctr++;
8373  }
8374  strat->syzl = ps;
8375  }
8376  */
8377  }
8378  }
8379  /*- test, if a unit is in F -*/
8380 
8381  if ((strat->Ll>=0)
8382 #ifdef HAVE_RINGS
8383  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8384 #endif
8385  && pIsConstant(strat->L[strat->Ll].p))
8386  {
8387  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8388  }
8389 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:291
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:1210
#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:1148
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:298
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:5112
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 8546 of file kutil.cc.

8547 {
8548  int i,pos;
8549 
8550  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8551  else i=setmaxT;
8552  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
8553  strat->ecartS=initec(i);
8554  strat->sevS=initsevS(i);
8555  strat->S_2_R=initS_2_R(i);
8556  strat->fromQ=NULL;
8557  strat->Shdl=idInit(i,F->rank);
8558  strat->S=strat->Shdl->m;
8559 
8560  /*- put polys into S -*/
8561  if (Q!=NULL)
8562  {
8563  strat->fromQ=initec(i);
8564  memset(strat->fromQ,0,i*sizeof(int));
8565  for (i=0; i<IDELEMS(Q); i++)
8566  {
8567  if (Q->m[i]!=NULL)
8568  {
8569  LObject h;
8570  h.p = pCopy(Q->m[i]);
8571  //if (TEST_OPT_INTSTRATEGY)
8572  //{
8573  // //pContent(h.p);
8574  // h.pCleardenom(); // also does a pContent
8575  //}
8576  //else
8577  //{
8578  // h.pNorm();
8579  //}
8581  {
8582  deleteHC(&h,strat);
8583  }
8584  if (h.p!=NULL)
8585  {
8586  strat->initEcart(&h);
8587  if (strat->sl==-1)
8588  pos =0;
8589  else
8590  {
8591  pos = posInS(strat,strat->sl,h.p,h.ecart);
8592  }
8593  h.sev = pGetShortExpVector(h.p);
8594  strat->enterS(h,pos,strat, strat->tl+1);
8595  enterT(h, strat);
8596  strat->fromQ[pos]=1;
8597  }
8598  }
8599  }
8600  }
8601  /*- put polys into S -*/
8602  for (i=0; i<IDELEMS(F); i++)
8603  {
8604  if (F->m[i]!=NULL)
8605  {
8606  LObject h;
8607  h.p = pCopy(F->m[i]);
8609  {
8610  deleteHC(&h,strat);
8611  }
8612  else
8613  {
8614  h.p=redtailBba(h.p,strat->sl,strat);
8615  }
8616  if (h.p!=NULL)
8617  {
8618  strat->initEcart(&h);
8619  if (strat->sl==-1)
8620  pos =0;
8621  else
8622  pos = posInS(strat,strat->sl,h.p,h.ecart);
8623  h.sev = pGetShortExpVector(h.p);
8624  strat->enterS(h,pos,strat, strat->tl+1);
8625  enterT(h,strat);
8626  }
8627  }
8628  }
8629  for (i=0; i<IDELEMS(P); i++)
8630  {
8631  if (P->m[i]!=NULL)
8632  {
8633  LObject h;
8634  h.p=pCopy(P->m[i]);
8636  {
8637  h.pCleardenom();
8638  }
8639  else
8640  {
8641  h.pNorm();
8642  }
8643  if(strat->sl>=0)
8644  {
8646  {
8647  h.p=redBba(h.p,strat->sl,strat);
8648  if (h.p!=NULL)
8649  {
8650  h.p=redtailBba(h.p,strat->sl,strat);
8651  }
8652  }
8653  else
8654  {
8655  h.p=redMora(h.p,strat->sl,strat);
8656  }
8657  if(h.p!=NULL)
8658  {
8659  strat->initEcart(&h);
8661  {
8662  h.pCleardenom();
8663  }
8664  else
8665  {
8666  h.is_normalized = 0;
8667  h.pNorm();
8668  }
8669  h.sev = pGetShortExpVector(h.p);
8670  h.SetpFDeg();
8671  pos = posInS(strat,strat->sl,h.p,h.ecart);
8672  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8673  strat->enterS(h,pos,strat, strat->tl+1);
8674  enterT(h,strat);
8675  }
8676  }
8677  else
8678  {
8679  h.sev = pGetShortExpVector(h.p);
8680  strat->initEcart(&h);
8681  strat->enterS(h,0,strat, strat->tl+1);
8682  enterT(h,strat);
8683  }
8684  }
8685  }
8686 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:4985
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8942
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9480
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:746
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
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:8966
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 8691 of file kutil.cc.

8692 {
8693  int i,pos;
8694 
8695  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8696  else i=setmaxT;
8697  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
8698  strat->sevS=initsevS(i);
8699  strat->sevSig=initsevS(i);
8700  strat->S_2_R=initS_2_R(i);
8701  strat->fromQ=NULL;
8702  strat->Shdl=idInit(i,F->rank);
8703  strat->S=strat->Shdl->m;
8704  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
8705  /*- put polys into S -*/
8706  if (Q!=NULL)
8707  {
8708  strat->fromQ=initec(i);
8709  memset(strat->fromQ,0,i*sizeof(int));
8710  for (i=0; i<IDELEMS(Q); i++)
8711  {
8712  if (Q->m[i]!=NULL)
8713  {
8714  LObject h;
8715  h.p = pCopy(Q->m[i]);
8716  //if (TEST_OPT_INTSTRATEGY)
8717  //{
8718  // //pContent(h.p);
8719  // h.pCleardenom(); // also does a pContent
8720  //}
8721  //else
8722  //{
8723  // h.pNorm();
8724  //}
8726  {
8727  deleteHC(&h,strat);
8728  }
8729  if (h.p!=NULL)
8730  {
8731  strat->initEcart(&h);
8732  if (strat->sl==-1)
8733  pos =0;
8734  else
8735  {
8736  pos = posInS(strat,strat->sl,h.p,h.ecart);
8737  }
8738  h.sev = pGetShortExpVector(h.p);
8739  strat->enterS(h,pos,strat, strat->tl+1);
8740  enterT(h, strat);
8741  strat->fromQ[pos]=1;
8742  }
8743  }
8744  }
8745  }
8746  /*- put polys into S -*/
8747  for (i=0; i<IDELEMS(F); i++)
8748  {
8749  if (F->m[i]!=NULL)
8750  {
8751  LObject h;
8752  h.p = pCopy(F->m[i]);
8754  {
8755  deleteHC(&h,strat);
8756  }
8757  else
8758  {
8759  h.p=redtailBba(h.p,strat->sl,strat);
8760  }
8761  if (h.p!=NULL)
8762  {
8763  strat->initEcart(&h);
8764  if (strat->sl==-1)
8765  pos =0;
8766  else
8767  pos = posInS(strat,strat->sl,h.p,h.ecart);
8768  h.sev = pGetShortExpVector(h.p);
8769  strat->enterS(h,pos,strat, strat->tl+1);
8770  enterT(h,strat);
8771  }
8772  }
8773  }
8774  for (i=0; i<IDELEMS(P); i++)
8775  {
8776  if (P->m[i]!=NULL)
8777  {
8778  LObject h;
8779  h.p=pCopy(P->m[i]);
8781  {
8782  h.pCleardenom();
8783  }
8784  else
8785  {
8786  h.pNorm();
8787  }
8788  if(strat->sl>=0)
8789  {
8791  {
8792  h.p=redBba(h.p,strat->sl,strat);
8793  if (h.p!=NULL)
8794  {
8795  h.p=redtailBba(h.p,strat->sl,strat);
8796  }
8797  }
8798  else
8799  {
8800  h.p=redMora(h.p,strat->sl,strat);
8801  }
8802  if(h.p!=NULL)
8803  {
8804  strat->initEcart(&h);
8806  {
8807  h.pCleardenom();
8808  }
8809  else
8810  {
8811  h.is_normalized = 0;
8812  h.pNorm();
8813  }
8814  h.sev = pGetShortExpVector(h.p);
8815  h.SetpFDeg();
8816  pos = posInS(strat,strat->sl,h.p,h.ecart);
8817  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8818  strat->enterS(h,pos,strat, strat->tl+1);
8819  enterT(h,strat);
8820  }
8821  }
8822  else
8823  {
8824  h.sev = pGetShortExpVector(h.p);
8825  strat->initEcart(&h);
8826  strat->enterS(h,0,strat, strat->tl+1);
8827  enterT(h,strat);
8828  }
8829  }
8830  }
8831 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
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:4985
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8942
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9480
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:746
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
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:8966
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 8391 of file kutil.cc.

8392 {
8393  if( strat->S[0] )
8394  {
8395  if( strat->S[1] && !rField_is_Ring(currRing))
8396  {
8397  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8398  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8399  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8400  }
8401  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8402  /************************************************************
8403  * computing the length of the syzygy array needed
8404  ***********************************************************/
8405  for(i=1; i<=strat->sl; i++)
8406  {
8407  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8408  {
8409  ps += i;
8410  }
8411  }
8412  ps += strat->sl+1;
8413  //comp = pGetComp (strat->P.sig);
8414  comp = strat->currIdx;
8415  strat->syzIdx = initec(comp);
8416  strat->sevSyz = initsevS(ps);
8417  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8418  strat->syzmax = ps;
8419  strat->syzl = 0;
8420  strat->syzidxmax = comp;
8421 #if defined(DEBUGF5) || defined(DEBUGF51)
8422  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8423 #endif
8424  i = 1;
8425  j = 0;
8426  /************************************************************
8427  * generating the leading terms of the principal syzygies
8428  ***********************************************************/
8429  while (i <= strat->sl)
8430  {
8431  /**********************************************************
8432  * principal syzygies start with component index 2
8433  * the array syzIdx starts with index 0
8434  * => the rules for a signature with component comp start
8435  * at strat->syz[strat->syzIdx[comp-2]] !
8436  *********************************************************/
8437  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8438  {
8439  comp = pGetComp(strat->sig[i]);
8440  comp_old = pGetComp(strat->sig[i-1]);
8441  diff = comp - comp_old - 1;
8442  // diff should be zero, but sometimes also the initial generating
8443  // elements of the input ideal reduce to zero. then there is an
8444  // index-gap between the signatures. for these inbetween signatures we
8445  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8446  // in the following.
8447  // doing this, we keep the relation "j = comp - 2" alive, which makes
8448  // jumps way easier when checking criteria
8449  while (diff>0)
8450  {
8451  strat->syzIdx[j] = 0;
8452  diff--;
8453  j++;
8454  }
8455  strat->syzIdx[j] = ctr;
8456  j++;
8457  LObject Q;
8458  int pos;
8459  for (k = 0; k<i; k++)
8460  {
8461  Q.sig = pOne();
8463  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8464  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8465  p_SetCompP (Q.sig, comp, currRing);
8466  poly q = p_One(currRing);
8468  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8469  p_ExpVectorCopy(q,strat->S[i],currRing);
8470  q = p_Neg (q, currRing);
8471  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8472  Q.sig = p_Add_q (Q.sig, q, currRing);
8473  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8474  pos = posInSyz(strat, Q.sig);
8475  enterSyz(Q, strat, pos);
8476  ctr++;
8477  }
8478  }
8479  i++;
8480  }
8481  /**************************************************************
8482  * add syzygies for upcoming first element of new iteration step
8483  **************************************************************/
8484  comp = strat->currIdx;
8485  comp_old = pGetComp(strat->sig[i-1]);
8486  diff = comp - comp_old - 1;
8487  // diff should be zero, but sometimes also the initial generating
8488  // elements of the input ideal reduce to zero. then there is an
8489  // index-gap between the signatures. for these inbetween signatures we
8490  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8491  // in the following.
8492  // doing this, we keep the relation "j = comp - 2" alive, which makes
8493  // jumps way easier when checking criteria
8494  while (diff>0)
8495  {
8496  strat->syzIdx[j] = 0;
8497  diff--;
8498  j++;
8499  }
8500  strat->syzIdx[j] = ctr;
8501  LObject Q;
8502  int pos;
8503  for (k = 0; k<strat->sl+1; k++)
8504  {
8505  Q.sig = pOne();
8507  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8508  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8509  p_SetCompP (Q.sig, comp, currRing);
8510  poly q = p_One(currRing);
8512  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8513  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8514  q = p_Neg (q, currRing);
8515  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8516  Q.sig = p_Add_q (Q.sig, q, currRing);
8517  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8518  pos = posInSyz(strat, Q.sig);
8519  enterSyz(Q, strat, pos);
8520  ctr++;
8521  }
8522 //#if 1
8523 #ifdef DEBUGF5
8524  PrintS("Principal syzygies:\n");
8525  Print("syzl %d\n",strat->syzl);
8526  Print("syzmax %d\n",strat->syzmax);
8527  Print("ps %d\n",ps);
8528  PrintS("--------------------------------\n");
8529  for(i=0;i<=strat->syzl-1;i++)
8530  {
8531  Print("%d - ",i);
8532  pWrite(strat->syz[i]);
8533  }
8534  for(i=0;i<strat->currIdx;i++)
8535  {
8536  Print("%d - %d\n",i,strat->syzIdx[i]);
8537  }
8538  PrintS("--------------------------------\n");
8539 #endif
8540  }
8541 }
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:291
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:298
polyset S
Definition: kutil.h:300
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4588
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:6361
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:9677
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:95
return P p
Definition: myNF.cc:203
int Bl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:99
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:95
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:99
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 10813 of file kutil.cc.

10814 {
10815  if (strat->overflow) return FALSE;
10816  assume(L->p1 != NULL && L->p2 != NULL);
10817  // shift changes: from 0 to -1
10818  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10819  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10820  assume(strat->tailRing != currRing);
10821 
10822  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10823  return FALSE;
10824  // shift changes: extra case inserted
10825  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10826  {
10827  return TRUE;
10828  }
10829  poly p1_max = (strat->R[L->i_r1])->max_exp;
10830  poly p2_max = (strat->R[L->i_r2])->max_exp;
10831 
10832  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10833  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10834  {
10835  p_LmFree(m1, strat->tailRing);
10836  p_LmFree(m2, strat->tailRing);
10837  m1 = NULL;
10838  m2 = NULL;
10839  return FALSE;
10840  }
10841  return TRUE;
10842 }
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:95
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:99
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:403
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 10851 of file kutil.cc.

10852 {
10853  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10854  //assume(strat->tailRing != currRing);
10855 
10856  poly p1_max = (strat->R[atR])->max_exp;
10857  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10858 
10859  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10860  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10861  {
10862  return FALSE;
10863  }
10864  return TRUE;
10865 }
#define FALSE
Definition: auxiliary.h:95
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:99
#define assume(x)
Definition: mod2.h:403
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 4416 of file kutil.cc.

4417 {
4418 
4419  poly zeroPoly = NULL;
4420 
4421  number tmp1;
4422  poly tmp2, tmp3;
4423 
4424  if (cabsind == -1)
4425  {
4426  cabsind = 0;
4427  for (int i = 1; i <= leadRing->N; i++)
4428  {
4429  cabsind += ind_fact_2(exp[i]);
4430  }
4431 // Print("cabsind: %d\n", cabsind);
4432  }
4433  if (cabsind < leadRing->ch)
4434  {
4435  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4436  }
4437  else
4438  {
4439  zeroPoly = p_ISet(1, tailRing);
4440  }
4441  for (int i = 1; i <= leadRing->N; i++)
4442  {
4443  for (long j = 1; j <= exp[i]; j++)
4444  {
4445  tmp1 = nInit(j);
4446  tmp2 = p_ISet(1, tailRing);
4447  p_SetExp(tmp2, i, 1, tailRing);
4448  p_Setm(tmp2, tailRing);
4449  if (nIsZero(tmp1))
4450  { // should nowbe obsolet, test ! TODO OLIVER
4451  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4452  }
4453  else
4454  {
4455  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4456  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4457  }
4458  }
4459  }
4460  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4461  for (int i = 1; i <= leadRing->N; i++)
4462  {
4463  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4464  }
4465  p_Setm(tmp2, leadRing);
4466  *t_p = zeroPoly;
4467  zeroPoly = pNext(zeroPoly);
4468  pNext(*t_p) = NULL;
4469  pNext(tmp2) = zeroPoly;
4470  return tmp2;
4471 }
#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:4224
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:4209
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 11808 of file kutil.cc.

11809 {
11810  PrintS("red: ");
11811  if (strat->red==redFirst) PrintS("redFirst\n");
11812  else if (strat->red==redHoney) PrintS("redHoney\n");
11813  else if (strat->red==redEcart) PrintS("redEcart\n");
11814  else if (strat->red==redHomog) PrintS("redHomog\n");
11815  else Print("%p\n",(void*)strat->red);
11816  PrintS("posInT: ");
11817  if (strat->posInT==posInT0) PrintS("posInT0\n");
11818  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11819  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11820  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11821  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11822  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11823  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11824  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11825  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11826  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11827  #ifdef HAVE_RINGS
11828  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11829  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11830  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11831  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11832  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11833  #endif
11834 #ifdef HAVE_MORE_POS_IN_T
11835  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11836  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11837  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11838 #endif
11839  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11840  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11841  else Print("%p\n",(void*)strat->posInT);
11842  PrintS("posInL: ");
11843  if (strat->posInL==posInL0) PrintS("posInL0\n");
11844  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11845  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11846  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11847  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11848  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11849  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11850  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11851  #ifdef HAVE_RINGS
11852  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11853  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11854  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11855  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11856  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11857  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11858  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11859  #endif
11860  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11861  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11862  else Print("%p\n",(void*)strat->posInL);
11863  PrintS("enterS: ");
11864  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11865  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11866  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11867  else Print("%p\n",(void*)strat->enterS);
11868  PrintS("initEcart: ");
11869  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11870  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11871  else Print("%p\n",(void*)strat->initEcart);
11872  PrintS("initEcartPair: ");
11873  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11874  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11875  else Print("%p\n",(void*)strat->initEcartPair);
11876  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11877  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11878  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11879  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11880  PrintS("chainCrit: ");
11881  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11882  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11883  else Print("%p\n",(void*)strat->chainCrit);
11884  Print("posInLDependsOnLength=%d\n",
11885  strat->posInLDependsOnLength);
11886  PrintS(showOption());PrintLn();
11887  PrintS("LDeg: ");
11888  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11889  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11890  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11891  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11892  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11893  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11894  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11895  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11896  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11897  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11898  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11899  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11900  else Print("? (%lx)", (long)currRing->pLDeg);
11901  PrintS(" / ");
11902  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11903  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11904  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11905  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11906  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11907  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11908  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11909  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11910  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11911  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11912  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11913  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11914  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11915  PrintLn();
11916  PrintS("currRing->pFDeg: ");
11917  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11918  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11919  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11920  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11921  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11922  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11923  else Print("? (%lx)", (long)currRing->pFDeg);
11924  PrintLn();
11925  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11926  if(TEST_OPT_DEGBOUND)
11927  Print(" degBound: %d\n", Kstd1_deg);
11928 
11929  if( ecartWeights != NULL )
11930  {
11931  PrintS("ecartWeights: ");
11932  for (int i = rVar(currRing); i > 0; i--)
11933  Print("%hd ", ecartWeights[i]);
11934  PrintLn();
11936  }
11937 
11938 #ifndef SING_NDEBUG
11940 #endif
11941 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1249
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11774
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:5481
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6898
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:5374
#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 posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
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:6857
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:5346
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3250
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6615
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6942
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:711
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5768
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:7056
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:272
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:536
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:6699
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
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:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
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:5440
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
BOOLEAN Gebauer
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:403
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5870
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:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
void rDebugPrint(const ring r)
Definition: ring.cc:3998
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:5809
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:11683
#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:5557
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5599
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3463
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:6100
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:6043
void initEcartNormal(TObject *h)
Definition: kutil.cc:1234
int LazyPass
Definition: kutil.h:349
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11737
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
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:5977
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9240

§ kFindDivisibleByInS()

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

Definition at line 7369 of file kutil.cc.

7371 {
7372  int j = 0;
7373  const unsigned long not_sev = ~L->sev;
7374  const unsigned long* sev = strat->sevS;
7375  poly p;
7376  ring r;
7377  L->GetLm(p, r);
7378 
7379  assume(~not_sev == p_GetShortExpVector(p, r));
7380 
7381  if (r == currRing)
7382  {
7383  if(!rField_is_Ring(r))
7384  {
7385  loop
7386  {
7387  if (j > pos) return NULL;
7388  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7389  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7390  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7391  {
7392  break;
7393  }
7394  #else
7395  if (!(sev[j] & not_sev) &&
7396  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7397  p_LmDivisibleBy(strat->S[j], p, r))
7398  {
7399  break;
7400  }
7401  #endif
7402  j++;
7403  }
7404  }
7405  #ifdef HAVE_RINGS
7406  else
7407  {
7408  loop
7409  {
7410  if (j > pos) return NULL;
7411  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7412  if (strat->S[j]!= NULL && p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
7413  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7414  {
7415  break;
7416  }
7417  #else
7418  if (!(sev[j] & not_sev) &&
7419  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
7420  p_LmDivisibleBy(strat->S[j], p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(strat->S[j]), r->cf))
7421  {
7422  break;
7423  }
7424  #endif
7425  j++;
7426  }
7427  }
7428  #endif
7429  // if called from NF, T objects do not exist:
7430  if (strat->tl < 0 || strat->S_2_R[j] == -1)
7431  {
7432  T->Set(strat->S[j], r, strat->tailRing);
7433  return T;
7434  }
7435  else
7436  {
7437 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
7438 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
7439 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
7440  return strat->S_2_T(j);
7441  }
7442  }
7443  else
7444  {
7445  TObject* t;
7446  if(!rField_is_Ring(r))
7447  {
7448  loop
7449  {
7450  if (j > pos) return NULL;
7451  assume(strat->S_2_R[j] != -1);
7452  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7453  t = strat->S_2_T(j);
7454  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7455  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7456  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7457  {
7458  return t;
7459  }
7460  #else
7461  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7462  {
7463  t = strat->S_2_T(j);
7464  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7465  if (p_LmDivisibleBy(t->t_p, p, r))
7466  {
7467  return t;
7468  }
7469  }
7470  #endif
7471  j++;
7472  }
7473  }
7474  #ifdef HAVE_RINGS
7475  else
7476  {
7477  loop
7478  {
7479  if (j > pos) return NULL;
7480  assume(strat->S_2_R[j] != -1);
7481  #if defined(PDEBUG) || defined(PDIV_DEBUG)
7482  t = strat->S_2_T(j);
7483  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
7484  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
7485  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7486  {
7487  return t;
7488  }
7489  #else
7490  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
7491  {
7492  t = strat->S_2_T(j);
7493  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
7494  if (p_LmDivisibleBy(t->t_p, p, r) && n_DivBy(pGetCoeff(p), pGetCoeff(t->t_p), r->cf))
7495  {
7496  return t;
7497  }
7498  }
7499  #endif
7500  j++;
7501  }
7502  }
7503  #endif
7504  }
7505 }
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:403
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:4588
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 3204 of file kutil.cc.

3205 {
3206  int j=strat->Ll+strat->Bl+1;
3207  if (j>strat->Lmax)
3208  {
3209  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
3210  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
3211  j*sizeof(LObject));
3212  strat->Lmax=j;
3213  }
3214  j = strat->Ll;
3215  int i;
3216  for (i=strat->Bl; i>=0; i--)
3217  {
3218  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
3219  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3220  }
3221  strat->Bl = -1;
3222 }
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:1210
#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 3227 of file kutil.cc.

3228 {
3229  int j=strat->Ll+strat->Bl+1;
3230  if (j>strat->Lmax)
3231  {
3232  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
3233  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
3234  j*sizeof(LObject));
3235  strat->Lmax=j;
3236  }
3237  j = strat->Ll;
3238  int i;
3239  for (i=strat->Bl; i>=0; i--)
3240  {
3241  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
3242  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3243  }
3244  strat->Bl = -1;
3245 }
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:1210
#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 9914 of file kutil.cc.

9917 {
9918  if (pos_in_l == posInL110
9919  || pos_in_l == posInL10
9920  #ifdef HAVE_RINGS
9921  || pos_in_l == posInL110Ring
9922  || pos_in_l == posInLRing
9923  #endif
9924  )
9925  return TRUE;
9926 
9927  return FALSE;
9928 }
#define FALSE
Definition: auxiliary.h:95
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6288
#define TRUE
Definition: auxiliary.h:99
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
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 11262 of file kutil.cc.

11263 {
11264  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11265  /* initial setup or extending */
11266 
11267  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11268  if (expbound >= currRing->bitmask) return FALSE;
11269  strat->overflow=FALSE;
11270  ring new_tailRing = rModifyRing(currRing,
11271  // Hmmm .. the condition pFDeg == p_Deg
11272  // might be too strong
11273  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11274  (strat->ak==0), // omit_comp if the input is an ideal
11275  expbound); // exp_limit
11276 
11277  if (new_tailRing == currRing) return TRUE;
11278 
11279  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11280  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11281 
11282  if (currRing->pFDeg != currRing->pFDegOrig)
11283  {
11284  new_tailRing->pFDeg = currRing->pFDeg;
11285  new_tailRing->pLDeg = currRing->pLDeg;
11286  }
11287 
11288  if (TEST_OPT_PROT)
11289  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11290  kTest_TS(strat);
11291  assume(new_tailRing != strat->tailRing);
11292  pShallowCopyDeleteProc p_shallow_copy_delete
11293  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11294 
11295  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11296 
11297  int i;
11298  for (i=0; i<=strat->tl; i++)
11299  {
11300  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11301  p_shallow_copy_delete);
11302  }
11303  for (i=0; i<=strat->Ll; i++)
11304  {
11305  assume(strat->L[i].p != NULL);
11306  if (pNext(strat->L[i].p) != strat->tail)
11307  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11308  }
11309  if ((strat->P.t_p != NULL) ||
11310  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11311  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11312 
11313  if ((L != NULL) && (L->tailRing != new_tailRing))
11314  {
11315  if (L->i_r < 0)
11316  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11317  else
11318  {
11319  assume(L->i_r <= strat->tl);
11320  TObject* t_l = strat->R[L->i_r];
11321  assume(t_l != NULL);
11322  L->tailRing = new_tailRing;
11323  L->p = t_l->p;
11324  L->t_p = t_l->t_p;
11325  L->max_exp = t_l->max_exp;
11326  }
11327  }
11328 
11329  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11330  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11331 
11332  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11333  if (strat->tailRing != currRing)
11334  rKillModifiedRing(strat->tailRing);
11335 
11336  strat->tailRing = new_tailRing;
11337  strat->tailBin = new_tailBin;
11338  strat->p_shallow_copy_delete
11339  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11340 
11341  if (strat->kHEdge != NULL)
11342  {
11343  if (strat->t_kHEdge != NULL)
11344  p_LmFree(strat->t_kHEdge, strat->tailRing);
11345  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11346  }
11347 
11348  if (strat->kNoether != NULL)
11349  {
11350  if (strat->t_kNoether != NULL)
11351  p_LmFree(strat->t_kNoether, strat->tailRing);
11353  new_tailRing);
11354  }
11355  kTest_TS(strat);
11356  if (TEST_OPT_PROT)
11357  PrintS("]");
11358  return TRUE;
11359 }
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:95
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:2596
#define TRUE
Definition: auxiliary.h:99
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:655
#define assume(x)
Definition: mod2.h:403
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:2962
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 11361 of file kutil.cc.

11362 {
11363  unsigned long l = 0;
11364  int i;
11365  long e;
11366 
11367  assume(strat->tailRing == currRing);
11368 
11369  for (i=0; i<= strat->Ll; i++)
11370  {
11371  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11372  }
11373  for (i=0; i<=strat->tl; i++)
11374  {
11375  // Hmm ... this we could do in one Step
11376  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11377  }
11378  if (rField_is_Ring(currRing))
11379  {
11380  l *= 2;
11381  }
11382  e = p_GetMaxExp(l, currRing);
11383  if (e <= 1) e = 2;
11384 
11385  kStratChangeTailRing(strat, NULL, NULL, e);
11386 }
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:403
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11262
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 7926 of file kutil.cc.

7927 {
7928  if (i != *olddeg)
7929  {
7930  Print("%d",i);
7931  *olddeg = i;
7932  }
7933  if (TEST_OPT_OLDSTD)
7934  {
7935  if (strat->Ll != *reduc)
7936  {
7937  if (strat->Ll != *reduc-1)
7938  Print("(%d)",strat->Ll+1);
7939  else
7940  PrintS("-");
7941  *reduc = strat->Ll;
7942  }
7943  else
7944  PrintS(".");
7945  mflush();
7946  }
7947  else
7948  {
7949  if (red_result == 0)
7950  PrintS("-");
7951  else if (red_result < 0)
7952  PrintS(".");
7953  if ((red_result > 0) || ((strat->Ll % 100)==99))
7954  {
7955  if (strat->Ll != *reduc && strat->Ll > 0)
7956  {
7957  Print("(%d)",strat->Ll+1);
7958  *reduc = strat->Ll;
7959  }
7960  }
7961  }
7962 }
#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 7967 of file kutil.cc.

7968 {
7969  //PrintS("\nUsage/Allocation of temporary storage:\n");
7970  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7971  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7972  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7973  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7974  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7975  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7976  /*mflush();*/
7977 }
#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 7979 of file kutil.cc.

7980 {
7981  //PrintS("\nUsage/Allocation of temporary storage:\n");
7982  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7983  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7984  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
7985  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7986  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7987  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7988  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7989  /*mflush();*/
7990 }
#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 10747 of file kutil.cc.

10748 {
10749  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10750  return FALSE;
10751  int i,j;
10752  poly newNoether;
10753 
10754 #if 0
10755  if (currRing->weight_all_1)
10756  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10757  else
10758  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10759 #else
10760  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10761 #endif
10762  if (strat->kHEdge==NULL) return FALSE;
10763  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10764  if (strat->tailRing != currRing)
10765  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10766  /* compare old and new noether*/
10767  newNoether = pLmInit(strat->kHEdge);
10768  j = p_FDeg(newNoether,currRing);
10769  for (i=1; i<=(currRing->N); i++)
10770  {
10771  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10772  }
10773  pSetm(newNoether);
10774  if (j < strat->HCord) /*- statistics -*/
10775  {
10776  if (TEST_OPT_PROT)
10777  {
10778  Print("H(%d)",j);
10779  mflush();
10780  }
10781  strat->HCord=j;
10782  #ifdef KDEBUG
10783  if (TEST_OPT_DEBUG)
10784  {
10785  Print("H(%d):",j);
10786  wrp(strat->kHEdge);
10787  PrintLn();
10788  }
10789  #endif
10790  }
10791  if (pCmp(strat->kNoether,newNoether)!=1)
10792  {
10793  pDelete(&strat->kNoether);
10794  strat->kNoether=newNoether;
10795  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10796  if (strat->tailRing != currRing)
10797  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10798 
10799  return TRUE;
10800  }
10801  if (rField_is_Ring(currRing))
10802  pLmDelete(newNoether);
10803  else
10804  pLmFree(newNoether);
10805  return FALSE;
10806 }
#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:95
#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:99
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:748
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:293
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 4350 of file kutil.cc.

4352 {
4353  long add = ind2(cexp[1] + 2);
4354  if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
4355  {
4356  cexp[1] += 2;
4357  cind[1] += add;
4358  *cabsind += add;
4359  }
4360  else
4361  {
4362  // cabsind >= habsind
4363  if (N == 1) return 0;
4364  int i = 1;
4365  while (exp[i] == cexp[i] && i <= N) i++;
4366  cexp[i] = exp[i];
4367  *cabsind -= cind[i];
4368  cind[i] = ind[i];
4369  step[i] = 500000;
4370  *cabsind += cind[i];
4371  // Print("in: %d\n", *cabsind);
4372  i += 1;
4373  if (i > N) return 0;
4374  do
4375  {
4376  step[1] = 500000;
4377  for (int j = i + 1; j <= N; j++)
4378  {
4379  if (step[1] > step[j]) step[1] = step[j];
4380  }
4381  add = ind2(cexp[i] + 2);
4382  if (*cabsind - step[1] + add >= bound)
4383  {
4384  cexp[i] = exp[i];
4385  *cabsind -= cind[i];
4386  cind[i] = ind[i];
4387  *cabsind += cind[i];
4388  step[i] = 500000;
4389  i += 1;
4390  if (i > N) return 0;
4391  }
4392  else step[1] = -1;
4393  } while (step[1] != -1);
4394  step[1] = 500000;
4395  cexp[i] += 2;
4396  cind[i] += add;
4397  *cabsind += add;
4398  if (add < step[i]) step[i] = add;
4399  for (i = 2; i <= N; i++)
4400  {
4401  if (step[1] > step[i]) step[1] = step[i];
4402  }
4403  }
4404  return 1;
4405 }
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:4197

§ 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 2200 of file kutil.cc.

2201 {
2202  int i = rVar(r);
2203  loop
2204  {
2205  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
2206  return FALSE;
2207  i--;
2208  if (i == 0)
2209  return TRUE;
2210  }
2211 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:95
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
#define TRUE
Definition: auxiliary.h:99
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 11975 of file kutil.cc.

11976 {
11977  /* restores a poly in currRing from LObject */
11978  LObject h = H;
11979  h.Copy();
11980  poly p;
11981  if (h.p == NULL)
11982  {
11983  if (h.t_p != NULL)
11984  {
11985  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11986  return(p);
11987  }
11988  else
11989  {
11990  /* h.tp == NULL -> the object is NULL */
11991  return(NULL);
11992  }
11993  }
11994  /* we're here if h.p != NULL */
11995  if (h.t_p == NULL)
11996  {
11997  /* then h.p is the whole poly in currRing */
11998  p = h.p;
11999  return(p);
12000  }
12001  /* we're here if h.p != NULL and h.t_p != NULL */
12002  // clean h.p, get poly from t_p
12003  pNext(h.p)=NULL;
12004  pLmDelete(&h.p);
12005  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12006  /* dest. ring: */ currRing);
12007  // no need to clean h: we re-used the polys
12008  return(p);
12009 }
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:95
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:99
#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:86
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:95
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:99
#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:86
const poly b
Definition: syzextra.cc:213

§ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 11944 of file kutil.cc.

11945 {
11946  /* assume: p is completely in currRing */
11947  /* produces an object with LM in curring
11948  and TAIL in tailring */
11949  if (pNext(p)!=NULL)
11950  {
11951  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11952  }
11953  return(p);
11954 }
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 11958 of file kutil.cc.

11959 {
11960  /* assume: p has LM in curring and TAIL in tailring */
11961  /* convert it to complete currRing */
11962 
11963  /* check that LM is in currRing */
11965 
11966  if (pNext(p)!=NULL)
11967  {
11968  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11969  }
11970  return(p);
11971 }
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:403
#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 5291 of file kutil.cc.

5292 {
5293  if(end < 0 || end >= IDELEMS(F))
5294  end = IDELEMS(F);
5295  if (end<0) return 0;
5296  if(pNext(p) == NULL) return start;
5297  polyset set=F->m;
5298  int o = p_Deg(p,currRing);
5299  int op;
5300  int i;
5301  int an = start;
5302  for(i=start;i<end;i++)
5303  if(set[i] != NULL && pNext(set[i]) == NULL)
5304  an++;
5305  if(an == end-1)
5306  return end;
5307  int en= end;
5308  loop
5309  {
5310  if(an>=en)
5311  return en;
5312  if (an == en-1)
5313  {
5314  op = p_Deg(set[an],currRing);
5315  if ((op < o)
5316  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5317  return en;
5318  return an;
5319  }
5320  i=(an+en) / 2;
5321  op = p_Deg(set[i],currRing);
5322  if ((op < o)
5323  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5324  an=i;
5325  else
5326  en=i;
5327  }
5328 }
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 6143 of file kutil.cc.

6145 {
6146  if (length<0) return 0;
6147 
6148  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6149  return length+1;
6150 
6151  int i;
6152  int an = 0;
6153  int en= length;
6154  loop
6155  {
6156  if (an >= en-1)
6157  {
6158  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6159  return an;
6160  }
6161  i=(an+en) / 2;
6162  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6163  else en=i;
6164  /*aend. fuer lazy == in !=- machen */
6165  }
6166 }
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 6169 of file kutil.cc.

6171 {
6172  if (length<0) return 0;
6173 
6174  if (pLtCmpOrdSgnEqP(set[length].p,p->p))
6175  return length+1;
6176 
6177  int i;
6178  int an = 0;
6179  int en= length;
6180  loop
6181  {
6182  if (an >= en-1)
6183  {
6184  if (pLtCmpOrdSgnEqP(set[an].p,p->p)) return en;
6185  return an;
6186  }
6187  i=(an+en) / 2;
6188  if (pLtCmpOrdSgnEqP(set[i].p,p->p)) an=i;
6189  else en=i;
6190  /*aend. fuer lazy == in !=- machen */
6191  }
6192 }
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 6401 of file kutil.cc.

6403 {
6404  if (length<0) return 0;
6405 
6406  int o = p->GetpFDeg();
6407  int op = set[length].GetpFDeg();
6408 
6409  if ((op > o)
6410  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6411  return length+1;
6412  int i;
6413  int an = 0;
6414  int en= length;
6415  loop
6416  {
6417  if (an >= en-1)
6418  {
6419  op = set[an].GetpFDeg();
6420  if ((op > o)
6421  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6422  return en;
6423  return an;
6424  }
6425  i=(an+en) / 2;
6426  op = set[i].GetpFDeg();
6427  if ((op > o)
6428  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6429  an=i;
6430  else
6431  en=i;
6432  }
6433 }
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 6699 of file kutil.cc.

6701 {
6702  if (length<0) return 0;
6703 
6704  int o = p->GetpFDeg();
6705  int op = set[length].GetpFDeg();
6706 
6707  if ((op > o)
6708  || ((op == o) && (set[length].length >p->length))
6709  || ((op == o) && (set[length].length <= p->length)
6710  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6711  return length+1;
6712  int i;
6713  int an = 0;
6714  int en= length;
6715  loop
6716  {
6717  if (an >= en-1)
6718  {
6719  op = set[an].GetpFDeg();
6720  if ((op > o)
6721  || ((op == o) && (set[an].length >p->length))
6722  || ((op == o) && (set[an].length <=p->length)
6723  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6724  return en;
6725  return an;
6726  }
6727  i=(an+en) / 2;
6728  op = set[i].GetpFDeg();
6729  if ((op > o)
6730  || ((op == o) && (set[i].length > p->length))
6731  || ((op == o) && (set[i].length <= p->length)
6732  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6733  an=i;
6734  else
6735  en=i;
6736  }
6737 }
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 6740 of file kutil.cc.

6742 {
6743  if (length<0) return 0;
6744 
6745  int o = p->GetpFDeg();
6746  int op = set[length].GetpFDeg();
6747 
6748  if ((op > o)
6749  || ((op == o) && (set[length].length >p->length))
6750  || ((op == o) && (set[length].length <= p->length)
6751  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6752  return length+1;
6753  int i;
6754  int an = 0;
6755  int en= length;
6756  loop
6757  {
6758  if (an >= en-1)
6759  {
6760  op = set[an].GetpFDeg();
6761  if ((op > o)
6762  || ((op == o) && (set[an].length >p->length))
6763  || ((op == o) && (set[an].length <=p->length)
6764  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6765  return en;
6766  return an;
6767  }
6768  i=(an+en) / 2;
6769  op = set[i].GetpFDeg();
6770  if ((op > o)
6771  || ((op == o) && (set[i].length > p->length))
6772  || ((op == o) && (set[i].length <= p->length)
6773  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6774  an=i;
6775  else
6776  en=i;
6777  }
6778 }
#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  strat 
)

Definition at line 6443 of file kutil.cc.

6445 {
6446  if (length<0) return 0;
6447 
6448  int o = p->GetpFDeg();
6449  int op = set[length].GetpFDeg();
6450 
6451  if ((op > o)
6452  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6453  return length+1;
6454  int i;
6455  int an = 0;
6456  int en= length;
6457  loop
6458  {
6459  if (an >= en-1)
6460  {
6461  op = set[an].GetpFDeg();
6462  if ((op > o)
6463  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6464  return en;
6465  return an;
6466  }
6467  i=(an+en) / 2;
6468  op = set[i].GetpFDeg();
6469  if ((op > o)
6470  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6471  an=i;
6472  else
6473  en=i;
6474  }
6475 }
#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  strat 
)

Definition at line 6513 of file kutil.cc.

6515 {
6516  if (length < 0) return 0;
6517  int an,en,i;
6518  an = 0;
6519  en = length+1;
6520  loop
6521  {
6522  if (an >= en-1)
6523  {
6524  if(an == en)
6525  return en;
6526  if (set[an].FDeg > p->FDeg)
6527  return en;
6528  if (set[an].FDeg < p->FDeg)
6529  return an;
6530  if (set[an].FDeg == p->FDeg)
6531  {
6532  number lcset,lcp;
6533  lcset = pGetCoeff(set[an].p);
6534  lcp = pGetCoeff(p->p);
6535  if(!nGreaterZero(lcset))
6536  {
6537  set[an].p=p_Neg(set[an].p,currRing);
6538  if (set[an].t_p!=NULL)
6539  pSetCoeff0(set[an].t_p,pGetCoeff(set[an].p));
6540  lcset=pGetCoeff(set[an].p);
6541  }
6542  if(!nGreaterZero(lcp))
6543  {
6544  p->p=p_Neg(p->p,currRing);
6545  if (p->t_p!=NULL)
6546  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6547  lcp=pGetCoeff(p->p);
6548  }
6549  if(nGreater(lcset, lcp))
6550  {
6551  return en;
6552  }
6553  else
6554  {
6555  return an;
6556  }
6557  }
6558  }
6559  i=(an+en) / 2;
6560  if (set[i].FDeg > p->FDeg)
6561  an=i;
6562  if (set[i].FDeg < p->FDeg)
6563  en=i;
6564  if (set[i].FDeg == p->FDeg)
6565  {
6566  number lcset,lcp;
6567  lcset = pGetCoeff(set[i].p);
6568  lcp = pGetCoeff(p->p);
6569  if(!nGreaterZero(lcset))
6570  {
6571  set[i].p=p_Neg(set[i].p,currRing);
6572  if (set[i].t_p!=NULL)
6573  pSetCoeff0(set[i].t_p,pGetCoeff(set[i].p));
6574  lcset=pGetCoeff(set[i].p);
6575  }
6576  if(!nGreaterZero(lcp))
6577  {
6578  p->p=p_Neg(p->p,currRing);
6579  if (p->t_p!=NULL)
6580  pSetCoeff0(p->t_p,pGetCoeff(p->p));
6581  lcp=pGetCoeff(p->p);
6582  }
6583  if(nGreater(lcset, lcp))
6584  {
6585  an = i;
6586  }
6587  else
6588  {
6589  en = i;
6590  }
6591  }
6592  }
6593 }
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 6787 of file kutil.cc.

6789 {
6790  if (length<0) return 0;
6791 
6792  int o = p->GetpFDeg();
6793 
6794  if (set[length].GetpFDeg() > o)
6795  return length+1;
6796 
6797  int i;
6798  int an = 0;
6799  int en= length;
6800  loop
6801  {
6802  if (an >= en-1)
6803  {
6804  if (set[an].GetpFDeg() >= o)
6805  return en;
6806  return an;
6807  }
6808  i=(an+en) / 2;
6809  if (set[i].GetpFDeg() >= o)
6810  an=i;
6811  else
6812  en=i;
6813  }
6814 }
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 6822 of file kutil.cc.

6824 {
6825  if (length<0) return 0;
6826 
6827  int o = p->GetpFDeg() + p->ecart;
6828  int op = set[length].GetpFDeg() + set[length].ecart;
6829 
6830  if ((op > o)
6831  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6832  return length+1;
6833  int i;
6834  int an = 0;
6835  int en= length;
6836  loop
6837  {
6838  if (an >= en-1)
6839  {
6840  op = set[an].GetpFDeg() + set[an].ecart;
6841  if ((op > o)
6842  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6843  return en;
6844  return an;
6845  }
6846  i=(an+en) / 2;
6847  op = set[i].GetpFDeg() + set[i].ecart;
6848  if ((op > o)
6849  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6850  an=i;
6851  else
6852  en=i;
6853  }
6854 }
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 6857 of file kutil.cc.

6859 {
6860  if (length<0) return 0;
6861 
6862  int o = p->GetpFDeg() + p->ecart;
6863  int op = set[length].GetpFDeg() + set[length].ecart;
6864 
6865  if ((op > o)
6866  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6867  return length+1;
6868  int i;
6869  int an = 0;
6870  int en= length;
6871  loop
6872  {
6873  if (an >= en-1)
6874  {
6875  op = set[an].GetpFDeg() + set[an].ecart;
6876  if ((op > o)
6877  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6878  return en;
6879  return an;
6880  }
6881  i=(an+en) / 2;
6882  op = set[i].GetpFDeg() + set[i].ecart;
6883  if ((op > o)
6884  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6885  an=i;
6886  else
6887  en=i;
6888  }
6889 }
#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 6898 of file kutil.cc.

6900 {
6901  if (length<0) return 0;
6902 
6903  int o = p->GetpFDeg() + p->ecart;
6904 
6905  if ((set[length].GetpFDeg() + set[length].ecart > o)
6906  || ((set[length].GetpFDeg() + set[length].ecart == o)
6907  && (set[length].ecart > p->ecart))
6908  || ((set[length].GetpFDeg() + set[length].ecart == o)
6909  && (set[length].ecart == p->ecart)
6910  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6911  return length+1;
6912  int i;
6913  int an = 0;
6914  int en= length;
6915  loop
6916  {
6917  if (an >= en-1)
6918  {
6919  if ((set[an].GetpFDeg() + set[an].ecart > o)
6920  || ((set[an].GetpFDeg() + set[an].ecart == o)
6921  && (set[an].ecart > p->ecart))
6922  || ((set[an].GetpFDeg() + set[an].ecart == o)
6923  && (set[an].ecart == p->ecart)
6924  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6925  return en;
6926  return an;
6927  }
6928  i=(an+en) / 2;
6929  if ((set[i].GetpFDeg() + set[i].ecart > o)
6930  || ((set[i].GetpFDeg() + set[i].ecart == o)
6931  && (set[i].ecart > p->ecart))
6932  || ((set[i].GetpFDeg() +set[i].ecart == o)
6933  && (set[i].ecart == p->ecart)
6934  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6935  an=i;
6936  else
6937  en=i;
6938  }
6939 }
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 6992 of file kutil.cc.

6994 {
6995  if (length<0) return 0;
6996 
6997  int cc = (-1+2*currRing->order[0]==ringorder_c);
6998  /* cc==1 for (c,..), cc==-1 for (C,..) */
6999  unsigned long c = pGetComp(p->p)*cc;
7000  int o = p->GetpFDeg() + p->ecart;
7001 
7002  if (pGetComp(set[length].p)*cc > c)
7003  return length+1;
7004  if (pGetComp(set[length].p)*cc == c)
7005  {
7006  if ((set[length].GetpFDeg() + set[length].ecart > o)
7007  || ((set[length].GetpFDeg() + set[length].ecart == o)
7008  && (set[length].ecart > p->ecart))
7009  || ((set[length].GetpFDeg() + set[length].ecart == o)
7010  && (set[length].ecart == p->ecart)
7011  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
7012  return length+1;
7013  }
7014  int i;
7015  int an = 0;
7016  int en= length;
7017  loop
7018  {
7019  if (an >= en-1)
7020  {
7021  if (pGetComp(set[an].p)*cc > c)
7022  return en;
7023  if (pGetComp(set[an].p)*cc == c)
7024  {
7025  if ((set[an].GetpFDeg() + set[an].ecart > o)
7026  || ((set[an].GetpFDeg() + set[an].ecart == o)
7027  && (set[an].ecart > p->ecart))
7028  || ((set[an].GetpFDeg() + set[an].ecart == o)
7029  && (set[an].ecart == p->ecart)
7030  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
7031  return en;
7032  }
7033  return an;
7034  }
7035  i=(an+en) / 2;
7036  if (pGetComp(set[i].p)*cc > c)
7037  an=i;
7038  else if (pGetComp(set[i].p)*cc == c)
7039  {
7040  if ((set[i].GetpFDeg() + set[i].ecart > o)
7041  || ((set[i].GetpFDeg() + set[i].ecart == o)
7042  && (set[i].ecart > p->ecart))
7043  || ((set[i].GetpFDeg() +set[i].ecart == o)
7044  && (set[i].ecart == p->ecart)
7045  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
7046  an=i;
7047  else
7048  en=i;
7049  }
7050  else
7051  en=i;
7052  }
7053 }
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 7056 of file kutil.cc.

7058 {
7059  if (length<0) return 0;
7060 
7061  int cc = (-1+2*currRing->order[0]==ringorder_c);
7062  /* cc==1 for (c,..), cc==-1 for (C,..) */
7063  unsigned long c = pGetComp(p->p)*cc;
7064  int o = p->GetpFDeg() + p->ecart;
7065 
7066  if (pGetComp(set[length].p)*cc > c)
7067  return length+1;
7068  if (pGetComp(set[length].p)*cc == c)
7069  {
7070  if ((set[length].GetpFDeg() + set[length].ecart > o)
7071  || ((set[length].GetpFDeg() + set[length].ecart == o)
7072  && (set[length].ecart > p->ecart))
7073  || ((set[length].GetpFDeg() + set[length].ecart == o)
7074  && (set[length].ecart == p->ecart)
7075  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
7076  return length+1;
7077  }
7078  int i;
7079  int an = 0;
7080  int en= length;
7081  loop
7082  {
7083  if (an >= en-1)
7084  {
7085  if (pGetComp(set[an].p)*cc > c)
7086  return en;
7087  if (pGetComp(set[an].p)*cc == c)
7088  {
7089  if ((set[an].GetpFDeg() + set[an].ecart > o)
7090  || ((set[an].GetpFDeg() + set[an].ecart == o)
7091  && (set[an].ecart > p->ecart))
7092  || ((set[an].GetpFDeg() + set[an].ecart == o)
7093  && (set[an].ecart == p->ecart)
7094  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
7095  return en;
7096  }
7097  return an;
7098  }
7099  i=(an+en) / 2;
7100  if (pGetComp(set[i].p)*cc > c)
7101  an=i;
7102  else if (pGetComp(set[i].p)*cc == c)
7103  {
7104  if ((set[i].GetpFDeg() + set[i].ecart > o)
7105  || ((set[i].GetpFDeg() + set[i].ecart == o)
7106  && (set[i].ecart > p->ecart))
7107  || ((set[i].GetpFDeg() +set[i].ecart == o)
7108  && (set[i].ecart == p->ecart)
7109  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
7110  an=i;
7111  else
7112  en=i;
7113  }
7114  else
7115  en=i;
7116  }
7117 }
#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 6942 of file kutil.cc.

6944 {
6945  if (length<0) return 0;
6946 
6947  int o = p->GetpFDeg() + p->ecart;
6948 
6949  if ((set[length].GetpFDeg() + set[length].ecart > o)
6950  || ((set[length].GetpFDeg() + set[length].ecart == o)
6951  && (set[length].ecart > p->ecart))
6952  || ((set[length].GetpFDeg() + set[length].ecart == o)
6953  && (set[length].ecart == p->ecart)
6954  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6955  return length+1;
6956  int i;
6957  int an = 0;
6958  int en= length;
6959  loop
6960  {
6961  if (an >= en-1)
6962  {
6963  if ((set[an].GetpFDeg() + set[an].ecart > o)
6964  || ((set[an].GetpFDeg() + set[an].ecart == o)
6965  && (set[an].ecart > p->ecart))
6966  || ((set[an].GetpFDeg() + set[an].ecart == o)
6967  && (set[an].ecart == p->ecart)
6968  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6969  return en;
6970  return an;
6971  }
6972  i=(an+en) / 2;
6973  if ((set[i].GetpFDeg() + set[i].ecart > o)
6974  || ((set[i].GetpFDeg() + set[i].ecart == o)
6975  && (set[i].ecart > p->ecart))
6976  || ((set[i].GetpFDeg() +set[i].ecart == o)
6977  && (set[i].ecart == p->ecart)
6978  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6979  an=i;
6980  else
6981  en=i;
6982  }
6983 }
#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 6389 of file kutil.cc.

6391 {
6392  return strat->Ll+1;
6393 }
int Ll
Definition: kutil.h:347

§ posInLF5CRing()

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

Definition at line 6477 of file kutil.cc.

6479 {
6480  if (length<0) return 0;
6481  if(start == (length +1)) return (length+1);
6482  int o = p->GetpFDeg();
6483  int op = set[length].GetpFDeg();
6484 
6485  if ((op > o)
6486  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6487  return length+1;
6488  int i;
6489  int an = start;
6490  int en= length;
6491  loop
6492  {
6493  if (an >= en-1)
6494  {
6495  op = set[an].GetpFDeg();
6496  if ((op > o)
6497  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6498  return en;
6499  return an;
6500  }
6501  i=(an+en) / 2;
6502  op = set[i].GetpFDeg();
6503  if ((op > o)
6504  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6505  an=i;
6506  else
6507  en=i;
6508  }
6509 }
#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 6615 of file kutil.cc.

6625 {
6626  if (length < 0) return 0;
6627 
6628  int o = p->GetpFDeg();
6629  int op = set[length].GetpFDeg();
6630 
6631  if ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6632  return length + 1;
6633  int i;
6634  int an = 0;
6635  int en = length;
6636  loop
6637  {
6638  if (an >= en - 1)
6639  {
6640  op = set[an].GetpFDeg();
6641  if ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6642  return en;
6643  return an;
6644  }
6645  i = (an+en) / 2;
6646  op = set[i].GetpFDeg();
6647  if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6648  an = i;
6649  else
6650  en = i;
6651  }
6652 }
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 6288 of file kutil.cc.

6290 {
6291  if (length < 0) return 0;
6292  if (set[length].FDeg > p->FDeg)
6293  return length+1;
6294  if (set[length].FDeg == p->FDeg)
6295  if(set[length].GetpLength() > p->GetpLength())
6296  return length+1;
6297  int i;
6298  int an = 0;
6299  int en= length+1;
6300  loop
6301  {
6302  if (an >= en-1)
6303  {
6304  if(an == en)
6305  return en;
6306  if (set[an].FDeg > p->FDeg)
6307  return en;
6308  if(set[an].FDeg == p->FDeg)
6309  {
6310  if(set[an].GetpLength() > p->GetpLength())
6311  return en;
6312  else
6313  {
6314  if(set[an].GetpLength() == p->GetpLength())
6315  {
6316  if(nGreater(set[an].p->coef, p->p->coef))
6317  return en;
6318  else
6319  return an;
6320  }
6321  else
6322  {
6323  return an;
6324  }
6325  }
6326  }
6327  else
6328  return an;
6329  }
6330  i=(an+en) / 2;
6331  if (set[i].FDeg > p->FDeg)
6332  an=i;
6333  else
6334  {
6335  if(set[i].FDeg == p->FDeg)
6336  {
6337  if(set[i].GetpLength() > p->GetpLength())
6338  an=i;
6339  else
6340  {
6341  if(set[i].GetpLength() == p->GetpLength())
6342  {
6343  if(nGreater(set[i].p->coef, p->p->coef))
6344  an = i;
6345  else
6346  en = i;
6347  }
6348  else
6349  {
6350  en=i;
6351  }
6352  }
6353  }
6354  else
6355  en=i;
6356  }
6357  }
6358 }
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 6201 of file kutil.cc.

6203 {
6204  if (length<0) return 0;
6205  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6206  return length+1;
6207 
6208  int i;
6209  int an = 0;
6210  int en= length;
6211  loop
6212  {
6213  if (an >= en-1)
6214  {
6215  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6216  return an;
6217  }
6218  i=(an+en) / 2;
6219  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6220  else en=i;
6221  /*aend. fuer lazy == in !=- machen */
6222  }
6223 }
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 6225 of file kutil.cc.

6227 {
6228  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6229  if (length<0) return 0;
6230  if (pLtCmp(set[length].sig,p->sig)== 1)
6231  return length+1;
6232 
6233  int an,en,i;
6234  an = 0;
6235  en = length+1;
6236  int cmp;
6237  loop
6238  {
6239  if (an >= en-1)
6240  {
6241  if(an == en)
6242  return en;
6243  cmp = pLtCmp(set[an].sig,p->sig);
6244  if (cmp == 1)
6245  return en;
6246  if (cmp == -1)
6247  return an;
6248  if (cmp == 0)
6249  {
6250  if (set[an].FDeg > p->FDeg)
6251  return en;
6252  if (set[an].FDeg < p->FDeg)
6253  return an;
6254  if (set[an].FDeg == p->FDeg)
6255  {
6256  cmp = pLtCmp(set[an].p,p->p);
6257  if(cmp == 1)
6258  return en;
6259  else
6260  return an;
6261  }
6262  }
6263  }
6264  i=(an+en) / 2;
6265  cmp = pLtCmp(set[i].sig,p->sig);
6266  if (cmp == 1)
6267  an = i;
6268  if (cmp == -1)
6269  en = i;
6270  if (cmp == 0)
6271  {
6272  if (set[i].FDeg > p->FDeg)
6273  an = i;
6274  if (set[i].FDeg < p->FDeg)
6275  en = i;
6276  if (set[i].FDeg == p->FDeg)
6277  {
6278  cmp = pLtCmp(set[i].p,p->p);
6279  if(cmp == 1)
6280  an = i;
6281  else
6282  en = i;
6283  }
6284  }
6285  }
6286 }
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:403
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 6100 of file kutil.cc.

6102 {
6103  if (length<0) return 0;
6104 
6105  int d=p->GetpFDeg();
6106  int op=set[length].GetpFDeg();
6107 
6108  if ((op > d)
6109  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
6110  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
6111  return length+1;
6112 
6113  int i;
6114  int an = 0;
6115  int en= length;
6116  loop
6117  {
6118  if (an >= en-1)
6119  {
6120  op=set[an].GetpFDeg();
6121  if ((op > d)
6122  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
6123  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
6124  return en;
6125  return an;
6126  }
6127  i=(an+en) / 2;
6128  op=set[i].GetpFDeg();
6129  if ((op>d)
6130  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
6131  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
6132  an=i;
6133  else
6134  en=i;
6135  }
6136 }
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 5112 of file kutil.cc.

5114 {
5115  if(length==-1) return 0;
5116  polyset set=strat->S;
5117  int i;
5118  int an = 0;
5119  int en = length;
5120  int cmp_int = currRing->OrdSgn;
5122 #ifdef HAVE_PLURAL
5123  && (currRing->real_var_start==0)
5124 #endif
5125 #if 0
5126  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
5127 #endif
5128  )
5129  {
5130  int o=p_Deg(p,currRing);
5131  int oo=p_Deg(set[length],currRing);
5132 
5133  if ((oo<o)
5134  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
5135  return length+1;
5136 
5137  loop
5138  {
5139  if (an >= en-1)
5140  {
5141  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
5142  {
5143  return an;
5144  }
5145  return en;
5146  }
5147  i=(an+en) / 2;
5148  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
5149  else an=i;
5150  }
5151  }
5152  else
5153  {
5154  if (rField_is_Ring(currRing))
5155  {
5156  if (pLmCmp(set[length],p)== -cmp_int)
5157  return length+1;
5158  int cmp;
5159  loop
5160  {
5161  if (an >= en-1)
5162  {
5163  cmp = pLmCmp(set[an],p);
5164  if (cmp == cmp_int) return an;
5165  if (cmp == -cmp_int) return en;
5166  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
5167  return an;
5168  }
5169  i = (an+en) / 2;
5170  cmp = pLmCmp(set[i],p);
5171  if (cmp == cmp_int) en = i;
5172  else if (cmp == -cmp_int) an = i;
5173  else
5174  {
5175  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
5176  else en = i;
5177  }
5178  }
5179  }
5180  else
5181  if (pLmCmp(set[length],p)== -cmp_int)
5182  return length+1;
5183 
5184  loop
5185  {
5186  if (an >= en-1)
5187  {
5188  if (pLmCmp(set[an],p) == cmp_int) return an;
5189  if (pLmCmp(set[an],p) == -cmp_int) return en;
5190  if ((cmp_int!=1)
5191  && ((strat->ecartS[an])>ecart_p))
5192  return an;
5193  return en;
5194  }
5195  i=(an+en) / 2;
5196  if (pLmCmp(set[i],p) == cmp_int) en=i;
5197  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
5198  else
5199  {
5200  if ((cmp_int!=1)
5201  &&((strat->ecartS[i])<ecart_p))
5202  en=i;
5203  else
5204  an=i;
5205  }
5206  }
5207  }
5208 }
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:748
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,
const int  ecart_p 
)

Definition at line 5213 of file kutil.cc.

5215 {
5216  if (length<0) return 0;
5217  polyset set=strat->S;
5218  if(pNext(p) == NULL)
5219  {
5220  int mon = 0;
5221  for(int i = 0;i<=length;i++)
5222  {
5223  if(set[i] != NULL && pNext(set[i]) == NULL)
5224  mon++;
5225  }
5226  int o = p_Deg(p,currRing);
5227  int op = p_Deg(set[mon],currRing);
5228 
5229  if ((op < o)
5230  || ((op == o) && (pLtCmp(set[mon],p) == -1)))
5231  return length+1;
5232  int i;
5233  int an = 0;
5234  int en= mon;
5235  loop
5236  {
5237  if (an >= en-1)
5238  {
5239  op = p_Deg(set[an],currRing);
5240  if ((op < o)
5241  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5242  return en;
5243  return an;
5244  }
5245  i=(an+en) / 2;
5246  op = p_Deg(set[i],currRing);
5247  if ((op < o)
5248  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5249  an=i;
5250  else
5251  en=i;
5252  }
5253  }
5254  if(pNext(p) != NULL)
5255  {
5256  int o = p_Deg(p,currRing);
5257  int op = p_Deg(set[length],currRing);
5258 
5259  if ((op < o)
5260  || ((op == o) && (pLtCmp(set[length],p) == -1)))
5261  return length+1;
5262  int i;
5263  int an = 0;
5264  for(i=0;i<=length;i++)
5265  if(set[i] != NULL && pNext(set[i]) == NULL)
5266  an++;
5267  int en= length;
5268  loop
5269  {
5270  if (an >= en-1)
5271  {
5272  op = p_Deg(set[an],currRing);
5273  if ((op < o)
5274  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5275  return en;
5276  return an;
5277  }
5278  i=(an+en) / 2;
5279  op = p_Deg(set[i],currRing);
5280  if ((op < o)
5281  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5282  an=i;
5283  else
5284  en=i;
5285  }
5286  }
5287 }
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 6361 of file kutil.cc.

6362 {
6363  if (strat->syzl==0) return 0;
6364  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6365  return strat->syzl;
6366  int i;
6367  int an = 0;
6368  int en= strat->syzl-1;
6369  loop
6370  {
6371  if (an >= en-1)
6372  {
6373  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6374  return an;
6375  }
6376  i=(an+en) / 2;
6377  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6378  else en=i;
6379  /*aend. fuer lazy == in !=- machen */
6380  }
6381 }
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 5335 of file kutil.cc.

5336 {
5337  return (length+1);
5338 }

§ posInT1()

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

Definition at line 5346 of file kutil.cc.

5347 {
5348  if (length==-1) return 0;
5349 
5350  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5351 
5352  int i;
5353  int an = 0;
5354  int en= length;
5355 
5356  loop
5357  {
5358  if (an >= en-1)
5359  {
5360  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5361  return en;
5362  }
5363  i=(an+en) / 2;
5364  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5365  else an=i;
5366  }
5367 }
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 5404 of file kutil.cc.

5405 {
5406  if (length==-1) return 0;
5407 
5408  int o = p.GetpFDeg();
5409  int op = set[length].GetpFDeg();
5410 
5411  if ((op < o)
5412  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5413  return length+1;
5414 
5415  int i;
5416  int an = 0;
5417  int en= length;
5418 
5419  loop
5420  {
5421  if (an >= en-1)
5422  {
5423  op= set[an].GetpFDeg();
5424  if ((op > o)
5425  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5426  return an;
5427  return en;
5428  }
5429  i=(an+en) / 2;
5430  op = set[i].GetpFDeg();
5431  if (( op > o)
5432  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5433  en=i;
5434  else
5435  an=i;
5436  }
5437 }
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 5557 of file kutil.cc.

5558 {
5559  p.GetpLength();
5560  if (length==-1) return 0;
5561 
5562  int o = p.GetpFDeg();
5563  int op = set[length].GetpFDeg();
5564 
5565  if (( op < o)
5566  || (( op == o) && (set[length].length<p.length))
5567  || (( op == o) && (set[length].length == p.length)
5568  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5569  return length+1;
5570 
5571  int i;
5572  int an = 0;
5573  int en= length;
5574  loop
5575  {
5576  if (an >= en-1)
5577  {
5578  op = set[an].GetpFDeg();
5579  if (( op > o)
5580  || (( op == o) && (set[an].length > p.length))
5581  || (( op == o) && (set[an].length == p.length)
5582  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5583  return an;
5584  return en;
5585  }
5586  i=(an+en) / 2;
5587  op = set[i].GetpFDeg();
5588  if (( op > o)
5589  || (( op == o) && (set[i].length > p.length))
5590  || (( op == o) && (set[i].length == p.length)
5591  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5592  en=i;
5593  else
5594  an=i;
5595  }
5596 }
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 5599 of file kutil.cc.

5600 {
5601  p.GetpLength();
5602  if (length==-1) return 0;
5603 
5604  int o = p.GetpFDeg();
5605  int op = set[length].GetpFDeg();
5606 
5607  if (( op < o)
5608  || (( op == o) && (set[length].length<p.length))
5609  || (( op == o) && (set[length].length == p.length)
5610  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5611  return length+1;
5612 
5613  int i;
5614  int an = 0;
5615  int en= length;
5616  loop
5617  {
5618  if (an >= en-1)
5619  {
5620  op = set[an].GetpFDeg();
5621  if (( op > o)
5622  || (( op == o) && (set[an].length > p.length))
5623  || (( op == o) && (set[an].length == p.length)
5624  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5625  return an;
5626  return en;
5627  }
5628  i=(an+en) / 2;
5629  op = set[i].GetpFDeg();
5630  if (( op > o)
5631  || (( op == o) && (set[i].length > p.length))
5632  || (( op == o) && (set[i].length == p.length)
5633  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5634  en=i;
5635  else
5636  an=i;
5637  }
5638 }
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 5440 of file kutil.cc.

5441 {
5442  if (length==-1) return 0;
5443 
5444  int o = p.GetpFDeg();
5445  int op = set[length].GetpFDeg();
5446 
5447  if ((op < o)
5448  || ((op == o) && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5449  return length+1;
5450 
5451  int i;
5452  int an = 0;
5453  int en= length;
5454 
5455  loop
5456  {
5457  if (an >= en-1)
5458  {
5459  op= set[an].GetpFDeg();
5460  if ((op > o)
5461  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5462  return an;
5463  return en;
5464  }
5465  i=(an+en) / 2;
5466  op = set[i].GetpFDeg();
5467  if (( op > o)
5468  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5469  en=i;
5470  else
5471  an=i;
5472  }
5473 }
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 5646 of file kutil.cc.

5647 {
5648  if (length==-1) return 0;
5649 
5650  int o = p.GetpFDeg();
5651 
5652  if (set[length].GetpFDeg() <= o)
5653  return length+1;
5654 
5655  int i;
5656  int an = 0;
5657  int en= length;
5658  loop
5659  {
5660  if (an >= en-1)
5661  {
5662  if (set[an].GetpFDeg() > o)
5663  return an;
5664  return en;
5665  }
5666  i=(an+en) / 2;
5667  if (set[i].GetpFDeg() > o)
5668  en=i;
5669  else
5670  an=i;
5671  }
5672 }
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 5714 of file kutil.cc.

5733 {
5734  if (length==-1) return 0;
5735 
5736  int o = p.GetpFDeg() + p.ecart;
5737  int op = set[length].GetpFDeg()+set[length].ecart;
5738 
5739  if ((op < o)
5740  || ((op == o)
5741  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5742  return length+1;
5743 
5744  int i;
5745  int an = 0;
5746  int en= length;
5747  loop
5748  {
5749  if (an >= en-1)
5750  {
5751  op = set[an].GetpFDeg()+set[an].ecart;
5752  if (( op > o)
5753  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5754  return an;
5755  return en;
5756  }
5757  i=(an+en) / 2;
5758  op = set[i].GetpFDeg()+set[i].ecart;
5759  if (( op > o)
5760  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5761  en=i;
5762  else
5763  an=i;
5764  }
5765 }
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 5768 of file kutil.cc.

5769 {
5770  if (length==-1) return 0;
5771 
5772  int o = p.GetpFDeg() + p.ecart;
5773  int op = set[length].GetpFDeg()+set[length].ecart;
5774 
5775  if ((op < o)
5776  || ((op == o)
5777  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5778  return length+1;
5779 
5780  int i;
5781  int an = 0;
5782  int en= length;
5783  loop
5784  {
5785  if (an >= en-1)
5786  {
5787  op = set[an].GetpFDeg()+set[an].ecart;
5788  if (( op > o)
5789  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5790  return an;
5791  return en;
5792  }
5793  i=(an+en) / 2;
5794  op = set[i].GetpFDeg()+set[i].ecart;
5795  if (( op > o)
5796  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5797  en=i;
5798  else
5799  an=i;
5800  }
5801 }
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 5809 of file kutil.cc.

5830 {
5831  if (length==-1) return 0;
5832 
5833  int o = p.GetpFDeg() + p.ecart;
5834  int op = set[length].GetpFDeg()+set[length].ecart;
5835 
5836  if ((op < o)
5837  || (( op == o) && (set[length].ecart > p.ecart))
5838  || (( op == o) && (set[length].ecart==p.ecart)
5839  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5840  return length+1;
5841 
5842  int i;
5843  int an = 0;
5844  int en= length;
5845  loop
5846  {
5847  if (an >= en-1)
5848  {
5849  op = set[an].GetpFDeg()+set[an].ecart;
5850  if (( op > o)
5851  || (( op == o) && (set[an].ecart < p.ecart))
5852  || (( op == o) && (set[an].ecart==p.ecart)
5853  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5854  return an;
5855  return en;
5856  }
5857  i=(an+en) / 2;
5858  op = set[i].GetpFDeg()+set[i].ecart;
5859  if ((op > o)
5860  || (( op == o) && (set[i].ecart < p.ecart))
5861  || (( op == o) && (set[i].ecart == p.ecart)
5862  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5863  en=i;
5864  else
5865  an=i;
5866  }
5867 }
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 5916 of file kutil.cc.

5917 {
5918  if (length==-1) return 0;
5919 
5920  int cc = (-1+2*currRing->order[0]==ringorder_c);
5921  /* cc==1 for (c,..), cc==-1 for (C,..) */
5922  int o = p.GetpFDeg() + p.ecart;
5923  int c = pGetComp(p.p)*cc;
5924 
5925  if (pGetComp(set[length].p)*cc < c)
5926  return length+1;
5927  if (pGetComp(set[length].p)*cc == c)
5928  {
5929  int op = set[length].GetpFDeg()+set[length].ecart;
5930  if ((op < o)
5931  || ((op == o) && (set[length].ecart > p.ecart))
5932  || ((op == o) && (set[length].ecart==p.ecart)
5933  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5934  return length+1;
5935  }
5936 
5937  int i;
5938  int an = 0;
5939  int en= length;
5940  loop
5941  {
5942  if (an >= en-1)
5943  {
5944  if (pGetComp(set[an].p)*cc < c)
5945  return en;
5946  if (pGetComp(set[an].p)*cc == c)
5947  {
5948  int op = set[an].GetpFDeg()+set[an].ecart;
5949  if ((op > o)
5950  || ((op == o) && (set[an].ecart < p.ecart))
5951  || ((op == o) && (set[an].ecart==p.ecart)
5952  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5953  return an;
5954  }
5955  return en;
5956  }
5957  i=(an+en) / 2;
5958  if (pGetComp(set[i].p)*cc > c)
5959  en=i;
5960  else if (pGetComp(set[i].p)*cc == c)
5961  {
5962  int op = set[i].GetpFDeg()+set[i].ecart;
5963  if ((op > o)
5964  || ((op == o) && (set[i].ecart < p.ecart))
5965  || ((op == o) && (set[i].ecart == p.ecart)
5966  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5967  en=i;
5968  else
5969  an=i;
5970  }
5971  else
5972  an=i;
5973  }
5974 }
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 5977 of file kutil.cc.

5978 {
5979  if (length==-1) return 0;
5980 
5981  int cc = (-1+2*currRing->order[0]==ringorder_c);
5982  /* cc==1 for (c,..), cc==-1 for (C,..) */
5983  int o = p.GetpFDeg() + p.ecart;
5984  int c = pGetComp(p.p)*cc;
5985 
5986  if (pGetComp(set[length].p)*cc < c)
5987  return length+1;
5988  if (pGetComp(set[length].p)*cc == c)
5989  {
5990  int op = set[length].GetpFDeg()+set[length].ecart;
5991  if ((op < o)
5992  || ((op == o) && (set[length].ecart > p.ecart))
5993  || ((op == o) && (set[length].ecart==p.ecart)
5994  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5995  return length+1;
5996  }
5997 
5998  int i;
5999  int an = 0;
6000  int en= length;
6001  loop
6002  {
6003  if (an >= en-1)
6004  {
6005  if (pGetComp(set[an].p)*cc < c)
6006  return en;
6007  if (pGetComp(set[an].p)*cc == c)
6008  {
6009  int op = set[an].GetpFDeg()+set[an].ecart;
6010  if ((op > o)
6011  || ((op == o) && (set[an].ecart < p.ecart))
6012  || ((op == o) && (set[an].ecart==p.ecart)
6013  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
6014  return an;
6015  }
6016  return en;
6017  }
6018  i=(an+en) / 2;
6019  if (pGetComp(set[i].p)*cc > c)
6020  en=i;
6021  else if (pGetComp(set[i].p)*cc == c)
6022  {
6023  int op = set[i].GetpFDeg()+set[i].ecart;
6024  if ((op > o)
6025  || ((op == o) && (set[i].ecart < p.ecart))
6026  || ((op == o) && (set[i].ecart == p.ecart)
6027  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
6028  en=i;
6029  else
6030  an=i;
6031  }
6032  else
6033  an=i;
6034  }
6035 }
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 5870 of file kutil.cc.

5871 {
5872  if (length==-1) return 0;
5873 
5874  int o = p.GetpFDeg() + p.ecart;
5875  int op = set[length].GetpFDeg()+set[length].ecart;
5876 
5877  if ((op < o)
5878  || (( op == o) && (set[length].ecart > p.ecart))
5879  || (( op == o) && (set[length].ecart==p.ecart)
5880  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5881  return length+1;
5882 
5883  int i;
5884  int an = 0;
5885  int en= length;
5886  loop
5887  {
5888  if (an >= en-1)
5889  {
5890  op = set[an].GetpFDeg()+set[an].ecart;
5891  if (( op > o)
5892  || (( op == o) && (set[an].ecart < p.ecart))
5893  || (( op == o) && (set[an].ecart==p.ecart)
5894  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5895  return an;
5896  return en;
5897  }
5898  i=(an+en) / 2;
5899  op = set[i].GetpFDeg()+set[i].ecart;
5900  if ((op > o)
5901  || (( op == o) && (set[i].ecart < p.ecart))
5902  || (( op == o) && (set[i].ecart == p.ecart)
5903  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5904  en=i;
5905  else
5906  an=i;
5907  }
5908 }
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 6043 of file kutil.cc.

6044 {
6045  p.GetpLength();
6046  if (length==-1) return 0;
6047 
6048  int o = p.ecart;
6049  int op=p.GetpFDeg();
6050 
6051  if (set[length].ecart < o)
6052  return length+1;
6053  if (set[length].ecart == o)
6054  {
6055  int oo=set[length].GetpFDeg();
6056  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
6057  return length+1;
6058  }
6059 
6060  int i;
6061  int an = 0;
6062  int en= length;
6063  loop
6064  {
6065  if (an >= en-1)
6066  {
6067  if (set[an].ecart > o)
6068  return an;
6069  if (set[an].ecart == o)
6070  {
6071  int oo=set[an].GetpFDeg();
6072  if((oo > op)
6073  || ((oo==op) && (set[an].length > p.length)))
6074  return an;
6075  }
6076  return en;
6077  }
6078  i=(an+en) / 2;
6079  if (set[i].ecart > o)
6080  en=i;
6081  else if (set[i].ecart == o)
6082  {
6083  int oo=set[i].GetpFDeg();
6084  if ((oo > op)
6085  || ((oo == op) && (set[i].length > p.length)))
6086  en=i;
6087  else
6088  an=i;
6089  }
6090  else
6091  an=i;
6092  }
6093 }
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 5374 of file kutil.cc.

5375 {
5376  p.GetpLength();
5377  if (length==-1)
5378  return 0;
5379  if (set[length].length<p.length)
5380  return length+1;
5381 
5382  int i;
5383  int an = 0;
5384  int en= length;
5385 
5386  loop
5387  {
5388  if (an >= en-1)
5389  {
5390  if (set[an].length>p.length) return an;
5391  return en;
5392  }
5393  i=(an+en) / 2;
5394  if (set[i].length>p.length) en=i;
5395  else an=i;
5396  }
5397 }
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 11683 of file kutil.cc.

11684 {
11685 
11686  if (length==-1) return 0;
11687 
11688  int o = p.ecart;
11689  int op=p.GetpFDeg();
11690  int ol = p.GetpLength();
11691 
11692  if (set[length].ecart < o)
11693  return length+1;
11694  if (set[length].ecart == o)
11695  {
11696  int oo=set[length].GetpFDeg();
11697  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11698  return length+1;
11699  }
11700 
11701  int i;
11702  int an = 0;
11703  int en= length;
11704  loop
11705  {
11706  if (an >= en-1)
11707  {
11708  if (set[an].ecart > o)
11709  return an;
11710  if (set[an].ecart == o)
11711  {
11712  int oo=set[an].GetpFDeg();
11713  if((oo > op)
11714  || ((oo==op) && (set[an].pLength > ol)))
11715  return an;
11716  }
11717  return en;
11718  }
11719  i=(an+en) / 2;
11720  if (set[i].ecart > o)
11721  en=i;
11722  else if (set[i].ecart == o)
11723  {
11724  int oo=set[i].GetpFDeg();
11725  if ((oo > op)
11726  || ((oo == op) && (set[i].pLength > ol)))
11727  en=i;
11728  else
11729  an=i;
11730  }
11731  else
11732  an=i;
11733  }
11734 }
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 5675 of file kutil.cc.

5676 {
5677  int ol = p.GetpLength();
5678  if (length==-1) return 0;
5679 
5680  int op=p.ecart;
5681 
5682  int oo=set[length].ecart;
5683  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5684  return length+1;
5685 
5686  int i;
5687  int an = 0;
5688  int en= length;
5689  loop
5690  {
5691  if (an >= en-1)
5692  {
5693  int oo=set[an].ecart;
5694  if((oo > op)
5695  || ((oo==op) && (set[an].pLength > ol)))
5696  return an;
5697  return en;
5698  }
5699  i=(an+en) / 2;
5700  int oo=set[i].ecart;
5701  if ((oo > op)
5702  || ((oo == op) && (set[i].pLength > ol)))
5703  en=i;
5704  else
5705  an=i;
5706  }
5707 }
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 11737 of file kutil.cc.

11738 {
11739 
11740  if (length==-1) return 0;
11741 
11742  int op=p.GetpFDeg();
11743  int ol = p.GetpLength();
11744 
11745  int oo=set[length].GetpFDeg();
11746  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11747  return length+1;
11748 
11749  int i;
11750  int an = 0;
11751  int en= length;
11752  loop
11753  {
11754  if (an >= en-1)
11755  {
11756  int oo=set[an].GetpFDeg();
11757  if((oo > op)
11758  || ((oo==op) && (set[an].pLength > ol)))
11759  return an;
11760  return en;
11761  }
11762  i=(an+en) / 2;
11763  int oo=set[i].GetpFDeg();
11764  if ((oo > op)
11765  || ((oo == op) && (set[i].pLength > ol)))
11766  en=i;
11767  else
11768  an=i;
11769  }
11770 }
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 11774 of file kutil.cc.

11775 {
11776  int ol = p.GetpLength();
11777  if (length==-1)
11778  return 0;
11779  if (set[length].length<p.length)
11780  return length+1;
11781 
11782  int i;
11783  int an = 0;
11784  int en= length;
11785 
11786  loop
11787  {
11788  if (an >= en-1)
11789  {
11790  if (set[an].pLength>ol) return an;
11791  return en;
11792  }
11793  i=(an+en) / 2;
11794  if (set[i].pLength>ol) en=i;
11795  else an=i;
11796  }
11797 }
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 5481 of file kutil.cc.

5482 {
5483  if (length==-1) return 0;
5484  int o = p.GetpFDeg();
5485  int op = set[length].GetpFDeg();
5486  int i;
5487  int an = 0;
5488  int en = length;
5489  int cmp_int = currRing->OrdSgn;
5490  if ((op < o) || (pLmCmp(set[length].p,p.p)== -cmp_int))
5491  return length+1;
5492  int cmp;
5493  loop
5494  {
5495  if (an >= en-1)
5496  {
5497  op = set[an].GetpFDeg();
5498  if (op > o) return an;
5499  if (op < 0) return en;
5500  cmp = pLmCmp(set[an].p,p.p);
5501  if (cmp == cmp_int) return an;
5502  if (cmp == -cmp_int) return en;
5503  if (nGreater(pGetCoeff(p.p), pGetCoeff(set[an].p))) return en;
5504  return an;
5505  }
5506  i = (an + en) / 2;
5507  op = set[i].GetpFDeg();
5508  if (op > o) en = i;
5509  else if (op < o) an = i;
5510  else
5511  {
5512  cmp = pLmCmp(set[i].p,p.p);
5513  if (cmp == cmp_int) en = i;
5514  else if (cmp == -cmp_int) an = i;
5515  else if (nGreater(pGetCoeff(p.p), pGetCoeff(set[i].p))) an = i;
5516  else en = i;
5517  }
5518  }
5519 }
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 11042 of file kutil.cc.

11043 {
11044  if(!nCoeff_is_Ring_Z(currRing->cf))
11045  return;
11046  poly pH = h->GetP();
11047  poly p,pp;
11048  p = pH;
11049  bool deleted = FALSE, ok = FALSE;
11050  for(int i = 0; i<=strat->sl; i++)
11051  {
11052  p = pH;
11053  if(pNext(strat->S[i]) == NULL)
11054  {
11055  //pWrite(p);
11056  //pWrite(strat->S[i]);
11057  while(ok == FALSE && p != NULL)
11058  {
11059  if(pLmDivisibleBy(strat->S[i], p))
11060  {
11061  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11062  p_SetCoeff(p,dummy,currRing);
11063  }
11064  if(nIsZero(p->coef))
11065  {
11066  pLmDelete(&p);
11067  h->p = p;
11068  deleted = TRUE;
11069  }
11070  else
11071  {
11072  ok = TRUE;
11073  }
11074  }
11075  pp = pNext(p);
11076  while(pp != NULL)
11077  {
11078  if(pLmDivisibleBy(strat->S[i], pp))
11079  {
11080  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11081  p_SetCoeff(pp,dummy,currRing);
11082  if(nIsZero(pp->coef))
11083  {
11084  pLmDelete(&pNext(p));
11085  pp = pNext(p);
11086  deleted = TRUE;
11087  }
11088  else
11089  {
11090  p = pp;
11091  pp = pNext(p);
11092  }
11093  }
11094  else
11095  {
11096  p = pp;
11097  pp = pNext(p);
11098  }
11099  }
11100  }
11101  }
11102  h->SetLmCurrRing();
11103  if(deleted)
11104  strat->initEcart(h);
11105 }
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:95
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:99
#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 11107 of file kutil.cc.

11108 {
11109  if(!nCoeff_is_Ring_Z(currRing->cf))
11110  return;
11111  poly hSig = h->sig;
11112  poly pH = h->GetP();
11113  poly p,pp;
11114  p = pH;
11115  bool deleted = FALSE, ok = FALSE;
11116  for(int i = 0; i<=strat->sl; i++)
11117  {
11118  p = pH;
11119  if(pNext(strat->S[i]) == NULL)
11120  {
11121  while(ok == FALSE && p!=NULL)
11122  {
11123  if(pLmDivisibleBy(strat->S[i], p))
11124  {
11125  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11126  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11127  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11128  {
11129  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11130  p_SetCoeff(p,dummy,currRing);
11131  }
11132  pDelete(&sigMult);
11133  }
11134  if(nIsZero(p->coef))
11135  {
11136  pLmDelete(&p);
11137  h->p = p;
11138  deleted = TRUE;
11139  }
11140  else
11141  {
11142  ok = TRUE;
11143  }
11144  }
11145  if(p == NULL)
11146  return;
11147  pp = pNext(p);
11148  while(pp != NULL)
11149  {
11150  if(pLmDivisibleBy(strat->S[i], pp))
11151  {
11152  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11153  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11154  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11155  {
11156  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11157  p_SetCoeff(pp,dummy,currRing);
11158  if(nIsZero(pp->coef))
11159  {
11160  pLmDelete(&pNext(p));
11161  pp = pNext(p);
11162  deleted = TRUE;
11163  }
11164  else
11165  {
11166  p = pp;
11167  pp = pNext(p);
11168  }
11169  }
11170  else
11171  {
11172  p = pp;
11173  pp = pNext(p);
11174  }
11175  pDelete(&sigMult);
11176  }
11177  else
11178  {
11179  p = pp;
11180  pp = pNext(p);
11181  }
11182  }
11183  }
11184  }
11185  h->SetLmCurrRing();
11186  if(deleted)
11187  strat->initEcart(h);
11188 
11189 }
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:95
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:99
#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:277
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 10874 of file kutil.cc.

10875 {
10877  if(!nCoeff_is_Ring_Z(currRing->cf))
10878  return NULL;
10879  ideal F = idCopy(Forig);
10880  idSkipZeroes(F);
10881  poly pmon;
10882  ring origR = currRing;
10883  ideal monred = idInit(1,1);
10884  for(int i=0; i<idElem(F); i++)
10885  {
10886  if(pNext(F->m[i]) == NULL)
10887  idInsertPoly(monred, pCopy(F->m[i]));
10888  }
10889  int posconst = idPosConstant(F);
10890  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10891  {
10892  idDelete(&F);
10893  idDelete(&monred);
10894  return NULL;
10895  }
10896  int idelemQ = 0;
10897  if(Q!=NULL)
10898  {
10899  idelemQ = IDELEMS(Q);
10900  for(int i=0; i<idelemQ; i++)
10901  {
10902  if(pNext(Q->m[i]) == NULL)
10903  idInsertPoly(monred, pCopy(Q->m[i]));
10904  }
10905  idSkipZeroes(monred);
10906  posconst = idPosConstant(monred);
10907  //the constant, if found, will be from Q
10908  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10909  {
10910  pmon = pCopy(monred->m[posconst]);
10911  idDelete(&F);
10912  idDelete(&monred);
10913  return pmon;
10914  }
10915  }
10916  ring QQ_ring = rCopy0(currRing,FALSE);
10917  nKillChar(QQ_ring->cf);
10918  QQ_ring->cf = nInitChar(n_Q, NULL);
10919  rComplete(QQ_ring,1);
10920  QQ_ring = rAssure_c_dp(QQ_ring);
10921  rChangeCurrRing(QQ_ring);
10922  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10923  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10924  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10925  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10926  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10927  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10928  ideal one = kStd(II, NULL, isNotHomog, NULL);
10929  idSkipZeroes(one);
10930  if(idIsConstant(one))
10931  {
10932  //one should be <1>
10933  for(int i = IDELEMS(II)-1; i>=0; i--)
10934  if(II->m[i] != NULL)
10935  II->m[i+1] = II->m[i];
10936  II->m[0] = pOne();
10937  ideal syz = idSyzygies(II, isNotHomog, NULL);
10938  poly integer = NULL;
10939  for(int i = IDELEMS(syz)-1;i>=0; i--)
10940  {
10941  if(pGetComp(syz->m[i]) == 1)
10942  {
10943  pSetComp(syz->m[i],0);
10944  if(pIsConstant(pHead(syz->m[i])))
10945  {
10946  integer = pHead(syz->m[i]);
10947  break;
10948  }
10949  }
10950  }
10951  rChangeCurrRing(origR);
10952  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10953  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10954  idDelete(&monred);
10955  idDelete(&F);
10956  id_Delete(&II,QQ_ring);
10957  id_Delete(&one,QQ_ring);
10958  id_Delete(&syz,QQ_ring);
10959  p_Delete(&integer,QQ_ring);
10960  rDelete(QQ_ring);
10961  return pmon;
10962  }
10963  else
10964  {
10965  if(idIs0(monred))
10966  {
10967  poly mindegmon = NULL;
10968  for(int i = 0; i<IDELEMS(one); i++)
10969  {
10970  if(pNext(one->m[i]) == NULL)
10971  {
10972  if(mindegmon == NULL)
10973  mindegmon = pCopy(one->m[i]);
10974  else
10975  {
10976  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10977  mindegmon = pCopy(one->m[i]);
10978  }
10979  }
10980  }
10981  if(mindegmon != NULL)
10982  {
10983  for(int i = IDELEMS(II)-1; i>=0; i--)
10984  if(II->m[i] != NULL)
10985  II->m[i+1] = II->m[i];
10986  II->m[0] = pCopy(mindegmon);
10987  ideal syz = idSyzygies(II, isNotHomog, NULL);
10988  bool found = FALSE;
10989  for(int i = IDELEMS(syz)-1;i>=0; i--)
10990  {
10991  if(pGetComp(syz->m[i]) == 1)
10992  {
10993  pSetComp(syz->m[i],0);
10994  if(pIsConstant(pHead(syz->m[i])))
10995  {
10996  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10997  found = TRUE;
10998  break;
10999  }
11000  }
11001  }
11002  id_Delete(&syz,QQ_ring);
11003  if (found == FALSE)
11004  {
11005  rChangeCurrRing(origR);
11006  idDelete(&monred);
11007  idDelete(&F);
11008  id_Delete(&II,QQ_ring);
11009  id_Delete(&one,QQ_ring);
11010  rDelete(QQ_ring);
11011  return NULL;
11012  }
11013  rChangeCurrRing(origR);
11014  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11015  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11016  idDelete(&monred);
11017  idDelete(&F);
11018  id_Delete(&II,QQ_ring);
11019  id_Delete(&one,QQ_ring);
11020  id_Delete(&syz,QQ_ring);
11021  rDelete(QQ_ring);
11022  return pmon;
11023  }
11024  }
11025  }
11026  rChangeCurrRing(origR);
11027  idDelete(&monred);
11028  idDelete(&F);
11029  id_Delete(&II,QQ_ring);
11030  id_Delete(&one,QQ_ring);
11031  rDelete(QQ_ring);
11032  return NULL;
11033 }
#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:95
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:99
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:4858
#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:3351
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1321
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:298
#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:448
#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:496
#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:334
#define idIsConstant(I)
Definition: ideals.h:40

§ redBba()

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

Definition at line 8942 of file kutil.cc.

8943 {
8944  int j = 0;
8945  unsigned long not_sev = ~ pGetShortExpVector(h);
8946 
8947  while (j <= maxIndex)
8948  {
8949  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
8950  {
8951  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8952  if (h==NULL) return NULL;
8953  j = 0;
8954  not_sev = ~ pGetShortExpVector(h);
8955  }
8956  else j++;
8957  }
8958  return h;
8959 }
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 8837 of file kutil.cc.

8838 {
8839  int j = 0;
8840  unsigned long not_sev = ~ pGetShortExpVector(h);
8841 
8842  while (j <= maxIndex)
8843  {
8844  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
8845  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
8846  else j++;
8847  }
8848  return h;
8849 }
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:95
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:99
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:1210
#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:403
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:99
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:1210
#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:403
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:293
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 8966 of file kutil.cc.

8967 {
8968  int j=0;
8969  int e,l;
8970  unsigned long not_sev = ~ pGetShortExpVector(h);
8971 
8972  if (maxIndex >= 0)
8973  {
8974  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
8975  do
8976  {
8977  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
8978  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
8979  {
8980 #ifdef KDEBUG
8981  if (TEST_OPT_DEBUG)
8982  {
8983  PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);
8984  }
8985 #endif
8986  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8987 #ifdef KDEBUG
8988  if(TEST_OPT_DEBUG)
8989  {
8990  PrintS(")\nto "); wrp(h); PrintLn();
8991  }
8992 #endif
8993  // pDelete(&h);
8994  if (h == NULL) return NULL;
8995  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
8996  j = 0;
8997  not_sev = ~ pGetShortExpVector(h);
8998  }
8999  else j++;
9000  }
9001  while (j <= maxIndex);
9002  }
9003  return h;
9004 }
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:293
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 7507 of file kutil.cc.

7508 {
7509  poly h, hn;
7510  strat->redTailChange=FALSE;
7511 
7512  L->GetP();
7513  poly p = L->p;
7514  if (strat->noTailReduction || pNext(p) == NULL)
7515  return p;
7516 
7517  LObject Ln(strat->tailRing);
7518  TObject* With;
7519  // placeholder in case strat->tl < 0
7520  TObject With_s(strat->tailRing);
7521  h = p;
7522  hn = pNext(h);
7523  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
7524  long e;
7525  int l;
7526  BOOLEAN save_HE=strat->kHEdgeFound;
7527  strat->kHEdgeFound |=
7528  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
7529 
7530  while(hn != NULL)
7531  {
7532  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7533  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7534  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7535  loop
7536  {
7537  Ln.Set(hn, strat->tailRing);
7538  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
7539  if (strat->kHEdgeFound)
7540  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7541  else
7542  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
7543  if (With == NULL) break;
7544  With->length=0;
7545  With->pLength=0;
7546  strat->redTailChange=TRUE;
7547  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
7548  {
7549  // reducing the tail would violate the exp bound
7550  if (kStratChangeTailRing(strat, L))
7551  {
7552  strat->kHEdgeFound = save_HE;
7553  return redtail(L, pos, strat);
7554  }
7555  else
7556  return NULL;
7557  }
7558  hn = pNext(h);
7559  if (hn == NULL) goto all_done;
7560  op = strat->tailRing->pFDeg(hn, strat->tailRing);
7561  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
7562  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
7563  }
7564  h = hn;
7565  hn = pNext(h);
7566  }
7567 
7568  all_done:
7569  if (strat->redTailChange)
7570  {
7571  L->pLength = 0;
7572  }
7573  strat->kHEdgeFound = save_HE;
7574  return p;
7575 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7507
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:95
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:99
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11262
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
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:4588
#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:86
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 7577 of file kutil.cc.

7578 {
7579  LObject L(p, currRing);
7580  return redtail(&L, pos, strat);
7581 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7507
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 7583 of file kutil.cc.

7584 {
7585 #define REDTAIL_CANONICALIZE 100
7586  strat->redTailChange=FALSE;
7587  if (strat->noTailReduction) return L->GetLmCurrRing();
7588  poly h, p;
7589  p = h = L->GetLmTailRing();
7590  if ((h==NULL) || (pNext(h)==NULL))
7591  return L->GetLmCurrRing();
7592 
7593  TObject* With;
7594  // placeholder in case strat->tl < 0
7595  TObject With_s(strat->tailRing);
7596 
7597  LObject Ln(pNext(h), strat->tailRing);
7598  Ln.pLength = L->GetpLength() - 1;
7599 
7600  pNext(h) = NULL;
7601  if (L->p != NULL) pNext(L->p) = NULL;
7602  L->pLength = 1;
7603 
7604  Ln.PrepareRed(strat->use_buckets);
7605 
7606  int cnt=REDTAIL_CANONICALIZE;
7607  while(!Ln.IsNull())
7608  {
7609  loop
7610  {
7611  if (TEST_OPT_IDLIFT)
7612  {
7613  if (Ln.p!=NULL)
7614  {
7615  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7616  }
7617  else
7618  {
7619  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7620  }
7621  }
7622  Ln.SetShortExpVector();
7623  if (withT)
7624  {
7625  int j;
7626  j = kFindDivisibleByInT(strat, &Ln);
7627  if (j < 0) break;
7628  With = &(strat->T[j]);
7629  }
7630  else
7631  {
7632  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7633  if (With == NULL) break;
7634  }
7635  cnt--;
7636  if (cnt==0)
7637  {
7639  /*poly tmp=*/Ln.CanonicalizeP();
7640  if (normalize)
7641  {
7642  Ln.Normalize();
7643  //pNormalize(tmp);
7644  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7645  }
7646  }
7647  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7648  {
7649  With->pNorm();
7650  }
7651  strat->redTailChange=TRUE;
7652  if (ksReducePolyTail(L, With, &Ln))
7653  {
7654  // reducing the tail would violate the exp bound
7655  // set a flag and hope for a retry (in bba)
7656  strat->completeReduce_retry=TRUE;
7657  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7658  do
7659  {
7660  pNext(h) = Ln.LmExtractAndIter();
7661  pIter(h);
7662  L->pLength++;
7663  } while (!Ln.IsNull());
7664  goto all_done;
7665  }
7666  if (Ln.IsNull()) goto all_done;
7667  if (! withT) With_s.Init(currRing);
7668  }
7669  pNext(h) = Ln.LmExtractAndIter();
7670  pIter(h);
7671  pNormalize(h);
7672  L->pLength++;
7673  }
7674 
7675  all_done:
7676  Ln.Delete();
7677  if (L->p != NULL) pNext(L->p) = pNext(p);
7678 
7679  if (strat->redTailChange)
7680  {
7681  L->length = 0;
7682  L->pLength = 0;
7683  }
7684 
7685  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7686  //L->Normalize(); // HANNES: should have a test
7687  kTest_L(L);
7688  return L->GetLmCurrRing();
7689 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1024
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:95
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:99
#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:658
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
#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 7808 of file kutil.cc.

7810 {
7811  strat->redTailChange=FALSE;
7812  if (strat->noTailReduction) return L->GetLmCurrRing();
7813  poly h, p;
7814  p = h = L->GetLmTailRing();
7815  if ((h==NULL) || (pNext(h)==NULL))
7816  return L->GetLmCurrRing();
7817 
7818  TObject* With;
7819  // placeholder in case strat->tl < 0
7820  TObject With_s(strat->tailRing);
7821 
7822  LObject Ln(pNext(h), strat->tailRing);
7823  Ln.pLength = L->GetpLength() - 1;
7824 
7825  pNext(h) = NULL;
7826  if (L->p != NULL) pNext(L->p) = NULL;
7827  L->pLength = 1;
7828 
7829  Ln.PrepareRed(strat->use_buckets);
7830 
7831  int cnt=REDTAIL_CANONICALIZE;
7832  while(!Ln.IsNull())
7833  {
7834  loop
7835  {
7836  Ln.SetShortExpVector();
7837  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7838  if (With == NULL) break;
7839  cnt--;
7840  if (cnt==0)
7841  {
7843  /*poly tmp=*/Ln.CanonicalizeP();
7844  }
7845  // we are in Z, do not call pNorm
7846  strat->redTailChange=TRUE;
7847  // test divisibility of coefs:
7848  poly p_Ln=Ln.GetLmCurrRing();
7849  poly p_With=With->GetLmCurrRing();
7850  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7851  if (!nIsZero(z))
7852  {
7853  // subtract z*Ln, add z.Ln to L
7854  poly m=pHead(p_Ln);
7855  pSetCoeff(m,z);
7856  poly mm=pHead(m);
7857  pNext(h) = m;
7858  pIter(h);
7859  L->pLength++;
7860  mm=pNeg(mm);
7861  if (Ln.bucket!=NULL)
7862  {
7863  int dummy=1;
7864  kBucket_Add_q(Ln.bucket,mm,&dummy);
7865  }
7866  else
7867  {
7868  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7869  Ln.GetP();
7870  if (Ln.p!=NULL)
7871  {
7872  Ln.p=pAdd(Ln.p,mm);
7873  if (Ln.t_p!=NULL)
7874  {
7875  pNext(Ln.t_p)=NULL;
7876  p_LmDelete(Ln.t_p,strat->tailRing);
7877  }
7878  }
7879  }
7880  }
7881  else
7882  nDelete(&z);
7883 
7884  if (ksReducePolyTail(L, With, &Ln))
7885  {
7886  // reducing the tail would violate the exp bound
7887  // set a flag and hope for a retry (in bba)
7888  strat->completeReduce_retry=TRUE;
7889  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7890  do
7891  {
7892  pNext(h) = Ln.LmExtractAndIter();
7893  pIter(h);
7894  L->pLength++;
7895  } while (!Ln.IsNull());
7896  goto all_done;
7897  }
7898  if (Ln.IsNull()) goto all_done;
7899  With_s.Init(currRing);
7900  }
7901  pNext(h) = Ln.LmExtractAndIter();
7902  pIter(h);
7903  pNormalize(h);
7904  L->pLength++;
7905  }
7906 
7907  all_done:
7908  Ln.Delete();
7909  if (L->p != NULL) pNext(L->p) = pNext(p);
7910 
7911  if (strat->redTailChange)
7912  {
7913  L->length = 0;
7914  }
7915 
7916  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7917  //L->Normalize(); // HANNES: should have a test
7918  kTest_L(L);
7919  return L->GetLmCurrRing();
7920 }
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:95
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:99
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:658
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
#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 7691 of file kutil.cc.

7692 {
7693 #define REDTAIL_CANONICALIZE 100
7694  strat->redTailChange=FALSE;
7695  if (strat->noTailReduction) return L->GetLmCurrRing();
7696  poly h, p;
7697  p = h = L->GetLmTailRing();
7698  if ((h==NULL) || (pNext(h)==NULL))
7699  return L->GetLmCurrRing();
7700 
7701  TObject* With;
7702  // placeholder in case strat->tl < 0
7703  TObject With_s(strat->tailRing);
7704 
7705  LObject Ln(pNext(h), strat->tailRing);
7706  Ln.pLength = L->GetpLength() - 1;
7707 
7708  pNext(h) = NULL;
7709  if (L->p != NULL) pNext(L->p) = NULL;
7710  L->pLength = 1;
7711 
7712  Ln.PrepareRed(strat->use_buckets);
7713 
7714  int cnt=REDTAIL_CANONICALIZE;
7715  while(!Ln.IsNull())
7716  {
7717  loop
7718  {
7719  if (TEST_OPT_IDLIFT)
7720  {
7721  if (Ln.p!=NULL)
7722  {
7723  if (p_GetComp(Ln.p,currRing)> strat->syzComp) break;
7724  }
7725  else
7726  {
7727  if (p_GetComp(Ln.t_p,strat->tailRing)> strat->syzComp) break;
7728  }
7729  }
7730  Ln.SetShortExpVector();
7731  if (withT)
7732  {
7733  int j;
7734  j = kFindDivisibleByInT(strat, &Ln);
7735  if (j < 0) break;
7736  With = &(strat->T[j]);
7737  }
7738  else
7739  {
7740  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7741  if (With == NULL) break;
7742  }
7743  cnt--;
7744  if (cnt==0)
7745  {
7747  /*poly tmp=*/Ln.CanonicalizeP();
7748  if (normalize)
7749  {
7750  Ln.Normalize();
7751  //pNormalize(tmp);
7752  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
7753  }
7754  }
7755  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
7756  {
7757  With->pNorm();
7758  }
7759  strat->redTailChange=TRUE;
7760  if (ksReducePolyTail(L, With, &Ln))
7761  {
7762  // reducing the tail would violate the exp bound
7763  // set a flag and hope for a retry (in bba)
7764  strat->completeReduce_retry=TRUE;
7765  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7766  do
7767  {
7768  pNext(h) = Ln.LmExtractAndIter();
7769  pIter(h);
7770  L->pLength++;
7771  } while (!Ln.IsNull());
7772  goto all_done;
7773  }
7774  if(!Ln.IsNull())
7775  {
7776  Ln.GetP();
7777  Ln.p = pJet(Ln.p,bound);
7778  }
7779  if (Ln.IsNull())
7780  {
7781  goto all_done;
7782  }
7783  if (! withT) With_s.Init(currRing);
7784  }
7785  pNext(h) = Ln.LmExtractAndIter();
7786  pIter(h);
7787  pNormalize(h);
7788  L->pLength++;
7789  }
7790 
7791  all_done:
7792  Ln.Delete();
7793  if (L->p != NULL) pNext(L->p) = pNext(p);
7794 
7795  if (strat->redTailChange)
7796  {
7797  L->length = 0;
7798  L->pLength = 0;
7799  }
7800 
7801  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7802  //L->Normalize(); // HANNES: should have a test
7803  kTest_L(L);
7804  return L->GetLmCurrRing();
7805 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1024
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:95
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:99
#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:658
#define pJet(p, m)
Definition: polys.h:351
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
#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 12755 of file kutil.cc.

12756 {
12757  /* for the shift case need to run it with withT = TRUE */
12758  strat->redTailChange=FALSE;
12759  if (strat->noTailReduction) return L->GetLmCurrRing();
12760  poly h, p;
12761  p = h = L->GetLmTailRing();
12762  if ((h==NULL) || (pNext(h)==NULL))
12763  return L->GetLmCurrRing();
12764 
12765  TObject* With;
12766  // placeholder in case strat->tl < 0
12767  TObject With_s(strat->tailRing);
12768 
12769  LObject Ln(pNext(h), strat->tailRing);
12770  Ln.pLength = L->GetpLength() - 1;
12771 
12772  pNext(h) = NULL;
12773  if (L->p != NULL) pNext(L->p) = NULL;
12774  L->pLength = 1;
12775 
12776  Ln.PrepareRed(strat->use_buckets);
12777 
12778  while(!Ln.IsNull())
12779  {
12780  loop
12781  {
12782  Ln.SetShortExpVector();
12783  if (withT)
12784  {
12785  int j;
12786  j = kFindDivisibleByInT(strat, &Ln);
12787  if (j < 0) break;
12788  With = &(strat->T[j]);
12789  }
12790  else
12791  {
12792  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12793  if (With == NULL) break;
12794  }
12795  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12796  {
12797  With->pNorm();
12798  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12799  }
12800  strat->redTailChange=TRUE;
12801  if (ksReducePolyTail(L, With, &Ln))
12802  {
12803  // reducing the tail would violate the exp bound
12804  // set a flag and hope for a retry (in bba)
12805  strat->completeReduce_retry=TRUE;
12806  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12807  do
12808  {
12809  pNext(h) = Ln.LmExtractAndIter();
12810  pIter(h);
12811  L->pLength++;
12812  } while (!Ln.IsNull());
12813  goto all_done;
12814  }
12815  if (Ln.IsNull()) goto all_done;
12816  if (! withT) With_s.Init(currRing);
12817  }
12818  pNext(h) = Ln.LmExtractAndIter();
12819  pIter(h);
12820  L->pLength++;
12821  }
12822 
12823  all_done:
12824  Ln.Delete();
12825  if (L->p != NULL) pNext(L->p) = pNext(p);
12826 
12827  if (strat->redTailChange)
12828  {
12829  L->length = 0;
12830  }
12831  L->Normalize(); // HANNES: should have a test
12832  kTest_L(L);
12833  return L->GetLmCurrRing();
12834 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1024
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:95
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:99
#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:658
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7369
#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 5059 of file kutil.cc.

5060 {
5061  int i,j,at,ecart, s2r;
5062  int fq=0;
5063  unsigned long sev;
5064  poly p;
5065  int new_suc=strat->sl+1;
5066  i= *suc;
5067  if (i<0) i=0;
5068 
5069  for (; i<=strat->sl; i++)
5070  {
5071  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5072  if (at != i)
5073  {
5074  if (new_suc > at) new_suc = at;
5075  p = strat->S[i];
5076  ecart = strat->ecartS[i];
5077  sev = strat->sevS[i];
5078  s2r = strat->S_2_R[i];
5079  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5080  for (j=i; j>=at+1; j--)
5081  {
5082  strat->S[j] = strat->S[j-1];
5083  strat->ecartS[j] = strat->ecartS[j-1];
5084  strat->sevS[j] = strat->sevS[j-1];
5085  strat->S_2_R[j] = strat->S_2_R[j-1];
5086  }
5087  strat->S[at] = p;
5088  strat->ecartS[at] = ecart;
5089  strat->sevS[at] = sev;
5090  strat->S_2_R[at] = s2r;
5091  if (strat->fromQ!=NULL)
5092  {
5093  for (j=i; j>=at+1; j--)
5094  {
5095  strat->fromQ[j] = strat->fromQ[j-1];
5096  }
5097  strat->fromQ[at]=fq;
5098  }
5099  }
5100  }
5101  if (new_suc <= strat->sl) *suc=new_suc;
5102  else *suc=-1;
5103 }
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:5112
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 1645 of file kutil.cc.

1646 {
1647  if(strat->sl < 0) return FALSE;
1648  int i;
1649  for(i=0;i<strat->sl;i++)
1650  {
1651  //Construct the gcd pair between h and S[i]
1652  number d, s, t;
1653  poly m1, m2, gcd;
1654  d = n_ExtGcd(pGetCoeff(h->p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1655  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1656  {
1657  nDelete(&d);
1658  nDelete(&s);
1659  nDelete(&t);
1660  }
1661  else
1662  {
1663  k_GetStrongLeadTerms(h->p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1664  pSetCoeff0(m1, s);
1665  pSetCoeff0(m2, t);
1666  pSetCoeff0(gcd, d);
1667  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);
1668  poly pSigMult = p_Copy(h->sig,currRing);
1669  poly sSigMult = p_Copy(strat->sig[i],currRing);
1670  pSigMult = p_Mult_mm(pSigMult,m1,currRing);
1671  sSigMult = p_Mult_mm(sSigMult,m2,currRing);
1672  p_LmDelete(m1, strat->tailRing);
1673  p_LmDelete(m2, strat->tailRing);
1674  poly pairsig = p_Add_q(pSigMult,sSigMult,currRing);
1675  if(pairsig!= NULL && pLtCmp(pairsig,h->sig) == 0)
1676  {
1677  #ifdef ADIDEBUG
1678  printf("\nCan replace * (sig = *) with * (sig = *) since of * with sig *\n");
1679  pWrite(h->p);pWrite(h->sig);pWrite(gcd);pWrite(pairsig);pWrite(strat->S[i]);pWrite(strat->sig[i]);
1680  //getchar();
1681  #endif
1682  pDelete(&h->p);
1683  h->p = gcd;
1684  pDelete(&h->sig);
1685  h->sig = pairsig;
1686  pNext(h->sig) = NULL;
1687  strat->initEcart(h);
1688  h->sev = pGetShortExpVector(h->p);
1689  h->sevSig = pGetShortExpVector(h->sig);
1690  h->i_r1 = -1;h->i_r2 = -1;
1691  if(h->lcm != NULL)
1692  {
1693  pDelete(&h->lcm);
1694  h->lcm = NULL;
1695  }
1696  if (currRing!=strat->tailRing)
1697  h->t_p = k_LmInit_currRing_2_tailRing(h->p, strat->tailRing);
1698  return TRUE;
1699  }
1700  //Delete what you didn't use
1701  pDelete(&gcd);
1702  pDelete(&pairsig);
1703  }
1704  }
1705  return FALSE;
1706 }
polyset sig
Definition: kutil.h:302
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:95
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:968
#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:99
void pWrite(poly p)
Definition: polys.h:291
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 11388 of file kutil.cc.

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

1268 {
1269  return (ecart1 <= ecart2);
1270 }

§ superenterpairs()

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

Definition at line 4899 of file kutil.cc.

4900 {
4902  // enter also zero divisor * poly, if this is non zero and of smaller degree
4903  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4904  initenterpairs(h, k, ecart, 0, strat, atR);
4905  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4906  clearSbatch(h, k, pos, strat);
4907 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4873
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3827
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4611
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:4660
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:403
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 4909 of file kutil.cc.

4910 {
4912  // enter also zero divisor * poly, if this is non zero and of smaller degree
4913  #ifdef ADIDEBUG
4914  printf("\n Trying to add extended spolys\n");
4915  #endif
4916  if (!(rField_is_Domain(currRing))) enterExtendedSpolySig(h, hSig, strat);
4917  if(strat->sigdrop) return;
4918  #ifdef ADIDEBUG
4919  printf("\n Trying to add spolys\n");
4920  #endif
4921  initenterpairsSigRing(h, hSig, hFrom, k, ecart, 0, strat, atR);
4922  if(strat->sigdrop) return;
4923  #ifdef ADIDEBUG
4924  printf("\n Trying to add gcd-polys\n");
4925  #endif
4926  initenterstrongPairsSig(h, hSig, hFrom,k, ecart, 0, strat, atR);
4927  if(strat->sigdrop) return;
4928  clearSbatch(h, k, pos, strat);
4929 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4873
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:3957
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:4743
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static Poly * h
Definition: janet.cc:978
void initenterstrongPairsSig(poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4633

§ syzCriterion()

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

Definition at line 7123 of file kutil.cc.

7124 {
7125 //#if 1
7126 #ifdef DEBUGF5
7127  PrintS("syzygy criterion checks: ");
7128  pWrite(sig);
7129 #endif
7130  for (int k=0; k<strat->syzl; k++)
7131  {
7132  //printf("-%d",k);
7133 //#if 1
7134 #ifdef DEBUGF5
7135  Print("checking with: %d / %d -- \n",k,strat->syzl);
7136  pWrite(pHead(strat->syz[k]));
7137 #endif
7138  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7139  && (!rField_is_Ring(currRing) ||
7140  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7141  {
7142 //#if 1
7143 #ifdef DEBUGF5
7144  PrintS("DELETE!\n");
7145 #endif
7146  #ifdef ADIDEBUG
7147  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7148  #endif
7149  strat->nrsyzcrit++;
7150  //printf("- T -\n\n");
7151  return TRUE;
7152  }
7153  }
7154  //printf("- F -\n\n");
7155  return FALSE;
7156 }
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:95
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:99
void pWrite(poly p)
Definition: polys.h:291
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 7161 of file kutil.cc.

7162 {
7163 //#if 1
7164  if(sig == NULL)
7165  return FALSE;
7166 #ifdef DEBUGF5
7167  PrintS("--- syzygy criterion checks: ");
7168  pWrite(sig);
7169 #endif
7170  int comp = p_GetComp(sig, currRing);
7171  int min, max;
7172  if (comp<=1)
7173  return FALSE;
7174  else
7175  {
7176  min = strat->syzIdx[comp-2];
7177  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
7178  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
7179  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
7180  if (comp == strat->currIdx)
7181  {
7182  max = strat->syzl;
7183  }
7184  else
7185  {
7186  max = strat->syzIdx[comp-1];
7187  }
7188  for (int k=min; k<max; k++)
7189  {
7190 #ifdef F5DEBUG
7191  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
7192  Print("checking with: %d -- ",k);
7193  pWrite(pHead(strat->syz[k]));
7194 #endif
7195  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7196  && (!rField_is_Ring(currRing) ||
7197  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing->cf) && pLtCmp(sig,strat->syz[k]) == 1)))
7198  {
7199  #ifdef ADIDEBUG
7200  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7201  #endif
7202  strat->nrsyzcrit++;
7203  return TRUE;
7204  }
7205  }
7206  return FALSE;
7207  }
7208 }
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:95
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:99
void pWrite(poly p)
Definition: polys.h:291
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 4224 of file kutil.cc.

4225 {
4226  return 1L << arg;
4227 }

§ updateResult()

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

Definition at line 10412 of file kutil.cc.

10413 {
10414  int l;
10415  if (strat->ak>0)
10416  {
10417  for (l=IDELEMS(r)-1;l>=0;l--)
10418  {
10419  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10420  {
10421  pDelete(&r->m[l]); // and set it to NULL
10422  }
10423  }
10424  int q;
10425  poly p;
10426  if(!rField_is_Ring(currRing))
10427  {
10428  for (l=IDELEMS(r)-1;l>=0;l--)
10429  {
10430  if ((r->m[l]!=NULL)
10431  //&& (strat->syzComp>0)
10432  //&& (pGetComp(r->m[l])<=strat->syzComp)
10433  )
10434  {
10435  for(q=IDELEMS(Q)-1; q>=0;q--)
10436  {
10437  if ((Q->m[q]!=NULL)
10438  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10439  {
10440  if (TEST_OPT_REDSB)
10441  {
10442  p=r->m[l];
10443  r->m[l]=kNF(Q,NULL,p);
10444  pDelete(&p);
10445  }
10446  else
10447  {
10448  pDelete(&r->m[l]); // and set it to NULL
10449  }
10450  break;
10451  }
10452  }
10453  }
10454  }
10455  }
10456  #ifdef HAVE_RINGS
10457  else
10458  {
10459  for (l=IDELEMS(r)-1;l>=0;l--)
10460  {
10461  if ((r->m[l]!=NULL)
10462  //&& (strat->syzComp>0)
10463  //&& (pGetComp(r->m[l])<=strat->syzComp)
10464  )
10465  {
10466  for(q=IDELEMS(Q)-1; q>=0;q--)
10467  {
10468  if ((Q->m[q]!=NULL)
10469  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10470  {
10471  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10472  {
10473  if (TEST_OPT_REDSB)
10474  {
10475  p=r->m[l];
10476  r->m[l]=kNF(Q,NULL,p);
10477  pDelete(&p);
10478  }
10479  else
10480  {
10481  pDelete(&r->m[l]); // and set it to NULL
10482  }
10483  break;
10484  }
10485  }
10486  }
10487  }
10488  }
10489  }
10490  #endif
10491  }
10492  else
10493  {
10494  int q;
10495  poly p;
10496  BOOLEAN reduction_found=FALSE;
10497  if (!rField_is_Ring(currRing))
10498  {
10499  for (l=IDELEMS(r)-1;l>=0;l--)
10500  {
10501  if (r->m[l]!=NULL)
10502  {
10503  for(q=IDELEMS(Q)-1; q>=0;q--)
10504  {
10505  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10506  {
10507  if (TEST_OPT_REDSB)
10508  {
10509  p=r->m[l];
10510  r->m[l]=kNF(Q,NULL,p);
10511  pDelete(&p);
10512  reduction_found=TRUE;
10513  }
10514  else
10515  {
10516  pDelete(&r->m[l]); // and set it to NULL
10517  }
10518  break;
10519  }
10520  }
10521  }
10522  }
10523  }
10524  #ifdef HAVE_RINGS
10525  //Also need divisibility of the leading coefficients
10526  else
10527  {
10528  for (l=IDELEMS(r)-1;l>=0;l--)
10529  {
10530  if (r->m[l]!=NULL)
10531  {
10532  for(q=IDELEMS(Q)-1; q>=0;q--)
10533  {
10534  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing->cf))
10535  {
10536  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10537  {
10538  if (TEST_OPT_REDSB)
10539  {
10540  p=r->m[l];
10541  r->m[l]=kNF(Q,NULL,p);
10542  pDelete(&p);
10543  reduction_found=TRUE;
10544  }
10545  else
10546  {
10547  pDelete(&r->m[l]); // and set it to NULL
10548  }
10549  break;
10550  }
10551  }
10552  }
10553  }
10554  }
10555  }
10556  #endif
10557  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10558  {
10559  #ifdef HAVE_RINGS
10561  {
10562  for (l=IDELEMS(r)-1;l>=0;l--)
10563  {
10564  if (r->m[l]!=NULL)
10565  {
10566  for(q=IDELEMS(r)-1;q>=0;q--)
10567  {
10568  if ((l!=q)
10569  && (r->m[q]!=NULL)
10570  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10571  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf))
10572  )
10573  {
10574  //If they are equal then take the one with the smallest length
10575  if(pLmDivisibleBy(r->m[q],r->m[l])
10576  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing->cf)
10577  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10578  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10579  {
10580  pDelete(&r->m[l]);
10581  break;
10582  }
10583  else
10584  pDelete(&r->m[q]);
10585  }
10586  }
10587  }
10588  }
10589  }
10590  else
10591  #endif
10592  {
10593  for (l=IDELEMS(r)-1;l>=0;l--)
10594  {
10595  if (r->m[l]!=NULL)
10596  {
10597  for(q=IDELEMS(r)-1;q>=0;q--)
10598  {
10599  if ((l!=q)
10600  && (r->m[q]!=NULL)
10601  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10602  )
10603  {
10604  //If they are equal then take the one with the smallest length
10605  if(pLmDivisibleBy(r->m[q],r->m[l])
10606  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10607  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10608  {
10609  pDelete(&r->m[l]);
10610  break;
10611  }
10612  else
10613  pDelete(&r->m[q]);
10614  }
10615  }
10616  }
10617  }
10618  }
10619  }
10620  }
10621  idSkipZeroes(r);
10622 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:95
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:99
#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:86
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

§ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9011 of file kutil.cc.

9012 {
9013  LObject h;
9014  int i, suc=0;
9015  poly redSi=NULL;
9016  BOOLEAN change,any_change;
9017 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
9018 // for (i=0; i<=(strat->sl); i++)
9019 // {
9020 // Print("s%d:",i);
9021 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
9022 // pWrite(strat->S[i]);
9023 // }
9024 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
9025  any_change=FALSE;
9027  {
9028  while (suc != -1)
9029  {
9030  i=suc+1;
9031  while (i<=strat->sl)
9032  {
9033  change=FALSE;
9035  any_change = FALSE;
9036  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9037  {
9038  redSi = pHead(strat->S[i]);
9039  strat->S[i] = redBba(strat->S[i],i-1,strat);
9040  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
9041  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
9042  if (pCmp(redSi,strat->S[i])!=0)
9043  {
9044  change=TRUE;
9045  any_change=TRUE;
9046  #ifdef KDEBUG
9047  if (TEST_OPT_DEBUG)
9048  {
9049  PrintS("reduce:");
9050  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
9051  }
9052  #endif
9053  if (TEST_OPT_PROT)
9054  {
9055  if (strat->S[i]==NULL)
9056  PrintS("V");
9057  else
9058  PrintS("v");
9059  mflush();
9060  }
9061  }
9062  pLmDelete(&redSi);
9063  if (strat->S[i]==NULL)
9064  {
9065  deleteInS(i,strat);
9066  i--;
9067  }
9068  else if (change)
9069  {
9071  {
9072  if (TEST_OPT_CONTENTSB)
9073  {
9074  number n;
9075  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9076  if (!nIsOne(n))
9077  {
9079  denom->n=nInvers(n);
9080  denom->next=DENOMINATOR_LIST;
9081  DENOMINATOR_LIST=denom;
9082  }
9083  nDelete(&n);
9084  }
9085  else
9086  {
9087  //pContent(strat->S[i]);
9088  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9089  }
9090  }
9091  else
9092  {
9093  pNorm(strat->S[i]);
9094  }
9095  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
9096  }
9097  }
9098  i++;
9099  }
9100  if (any_change) reorderS(&suc,strat);
9101  else break;
9102  }
9103  if (toT)
9104  {
9105  for (i=0; i<=strat->sl; i++)
9106  {
9107  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9108  {
9109  h.p = redtailBba(strat->S[i],i-1,strat);
9111  {
9112  h.pCleardenom();// also does a pContent
9113  }
9114  }
9115  else
9116  {
9117  h.p = strat->S[i];
9118  }
9119  strat->initEcart(&h);
9120  if (strat->honey)
9121  {
9122  strat->ecartS[i] = h.ecart;
9123  }
9124  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9125  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9126  h.sev = strat->sevS[i];
9127  /*puts the elements of S also to T*/
9128  strat->initEcart(&h);
9129  enterT(h,strat);
9130  strat->S_2_R[i] = strat->tl;
9131  }
9132  }
9133  }
9134  else
9135  {
9136  while (suc != -1)
9137  {
9138  i=suc;
9139  while (i<=strat->sl)
9140  {
9141  change=FALSE;
9142  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9143  {
9144  redSi=pHead((strat->S)[i]);
9145  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9146  if ((strat->S)[i]==NULL)
9147  {
9148  deleteInS(i,strat);
9149  i--;
9150  }
9151  else if (pCmp((strat->S)[i],redSi)!=0)
9152  {
9153  any_change=TRUE;
9154  h.p = strat->S[i];
9155  strat->initEcart(&h);
9156  strat->ecartS[i] = h.ecart;
9158  {
9159  if (TEST_OPT_CONTENTSB)
9160  {
9161  number n;
9162  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9163  if (!nIsOne(n))
9164  {
9166  denom->n=nInvers(n);
9167  denom->next=DENOMINATOR_LIST;
9168  DENOMINATOR_LIST=denom;
9169  }
9170  nDelete(&n);
9171  }
9172  else
9173  {
9174  //pContent(strat->S[i]);
9175  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9176  }
9177  }
9178  else
9179  {
9180  pNorm(strat->S[i]); // == h.p
9181  }
9182  h.sev = pGetShortExpVector(h.p);
9183  strat->sevS[i] = h.sev;
9184  }
9185  pLmDelete(&redSi);
9186  kTest(strat);
9187  }
9188  i++;
9189  }
9190 #ifdef KDEBUG
9191  kTest(strat);
9192 #endif
9193  if (any_change) reorderS(&suc,strat);
9194  else { suc=-1; break; }
9195  if (h.p!=NULL)
9196  {
9197  if (!strat->kHEdgeFound)
9198  {
9199  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9200  }
9201  if (strat->kHEdgeFound)
9202  newHEdge(strat);
9203  }
9204  }
9205  for (i=0; i<=strat->sl; i++)
9206  {
9207  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9208  {
9209  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9210  strat->initEcart(&h);
9211  strat->ecartS[i] = h.ecart;
9212  h.sev = pGetShortExpVector(h.p);
9213  strat->sevS[i] = h.sev;
9214  }
9215  else
9216  {
9217  h.p = strat->S[i];
9218  h.ecart=strat->ecartS[i];
9219  h.sev = strat->sevS[i];
9220  h.length = h.pLength = pLength(h.p);
9221  }
9222  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9223  cancelunit1(&h,&suc,strat->sl,strat);
9224  h.SetpFDeg();
9225  /*puts the elements of S also to T*/
9226  enterT(h,strat);
9227  strat->S_2_R[i] = strat->tl;
9228  }
9229  if (suc!= -1) updateS(toT,strat);
9230  }
9231 #ifdef KDEBUG
9232  kTest(strat);
9233 #endif
9234 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7507
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:95
int * S_2_R
Definition: kutil.h:338
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8854
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5059
#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:99
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
#define kTest(A)
Definition: kutil.h:654
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:1041
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
#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:8942
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9480
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2843
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:403
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:746
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
denominator_list next
Definition: kutil.h:67
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:9011
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:8966
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10747
void wrp(poly p)
Definition: polys.h:293
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:86
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2715

§ updateSShift()

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

Definition at line 12068 of file kutil.cc.

12069 {
12070  /* to use after updateS(toT=FALSE,strat) */
12071  /* fills T with shifted elt's of S */
12072  int i;
12073  LObject h;
12074  int atT = -1; // or figure out smth better
12075  strat->tl = -1; // init
12076  for (i=0; i<=strat->sl; i++)
12077  {
12078  memset(&h,0,sizeof(h));
12079  h.p = strat->S[i]; // lm in currRing, tail in TR
12080  strat->initEcart(&h);
12081  h.sev = strat->sevS[i];
12082  h.t_p = NULL;
12083  h.GetTP(); // creates correct t_p
12084  /*puts the elements of S with their shifts to T*/
12085  // int atT, int uptodeg, int lV)
12086  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
12087  // need a small check for above; we insert >=1 elements
12088  // insert this check into kTest_TS ?
12089  enterTShift(h,strat,atT,uptodeg,lV);
12090  }
12091  /* what about setting strat->tl? */
12092 }
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:12712
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.