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, 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)
 
static void initenterstrongPairsSig (poly h, poly hSig, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
 
void clearSbatch (poly h, int k, int pos, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSpecial (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
void reorderS (int *suc, kStrategy strat)
 
int posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInSMonFirst (const kStrategy strat, const int length, const poly p)
 
int posInIdealMonFirst (const ideal F, const poly p, int start, int end)
 
int posInT0 (const TSet, const int length, LObject &)
 
int posInT1 (const TSet set, const int length, LObject &p)
 
int posInT2 (const TSet set, const int length, LObject &p)
 
int posInT11 (const TSet set, const int length, LObject &p)
 
int posInT11Ring (const TSet set, const int length, LObject &p)
 
int posInTrg0 (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT110Ring (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT15Ring (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17Ring (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT17_cRing (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInLSpecial (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSig (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSigRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInSyz (const kStrategy strat, poly sig)
 
int posInLF5C (const LSet, const int, LObject *, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL11Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *p, const kStrategy)
 
int posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy)
 
int getIndexRng (long coeff)
 
int posInLrg0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL13 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_c (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_cRing (const LSet set, const int length, LObject *p, const kStrategy)
 
BOOLEAN syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN faugereRewCriterion (poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterion (poly, unsigned long, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
 
TObjectkFindDivisibleByInS (kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
 
poly redtail (LObject *L, int pos, kStrategy strat)
 
poly redtail (poly p, int pos, kStrategy strat)
 
poly redtailBba (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
poly redtailBbaBound (LObject *L, int pos, kStrategy strat, int bound, BOOLEAN withT, BOOLEAN normalize)
 
poly redtailBba_Z (LObject *L, int pos, kStrategy strat)
 
void message (int i, int *reduc, int *olddeg, kStrategy strat, int red_result)
 
void messageStat (int hilbcount, kStrategy strat)
 
void messageStatSBA (int hilbcount, kStrategy strat)
 
void initS (ideal F, ideal Q, kStrategy strat)
 
void initSL (ideal F, ideal Q, kStrategy strat)
 
void initSLSba (ideal F, ideal Q, kStrategy strat)
 
void initSyzRules (kStrategy strat)
 
void initSSpecial (ideal F, ideal Q, ideal P, kStrategy strat)
 
void initSSpecialSba (ideal F, ideal Q, ideal P, kStrategy strat)
 
static poly redBba1 (poly h, int maxIndex, kStrategy strat)
 
void cancelunit1 (LObject *p, int *suc, int index, kStrategy strat)
 
void updateS (BOOLEAN toT, kStrategy strat)
 
void enterSBba (LObject &p, int atS, kStrategy strat, int atR)
 
void enterSSba (LObject &p, int atS, kStrategy strat, int atR)
 
void enterT (LObject &p, kStrategy strat, int atT)
 
void enterT_strong (LObject &p, kStrategy strat, int atT)
 
void enterSyz (LObject &p, kStrategy strat, int atT)
 
void initHilbCrit (ideal, ideal, intvec **hilb, kStrategy strat)
 
void initBuchMoraCrit (kStrategy strat)
 
void initSbaCrit (kStrategy strat)
 
BOOLEAN kPosInLDependsOnLength (int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
 
void initBuchMoraPos (kStrategy strat)
 
void initBuchMoraPosRing (kStrategy strat)
 
void initBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitBuchMora (kStrategy strat)
 
void initSbaPos (kStrategy strat)
 
void initSbaBuchMora (ideal F, ideal Q, kStrategy strat)
 
void exitSba (kStrategy strat)
 
void updateResult (ideal r, ideal Q, kStrategy strat)
 
void completeReduce (kStrategy strat, BOOLEAN withT)
 
BOOLEAN newHEdge (kStrategy strat)
 
BOOLEAN kCheckSpolyCreation (LObject *L, kStrategy strat, poly &m1, poly &m2)
 
BOOLEAN kCheckStrongCreation (int atR, poly m1, int atS, poly m2, kStrategy strat)
 
poly preIntegerCheck (const ideal Forig, const ideal Q)
 used for GB over ZZ: look for constant and monomial elements in the ideal background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMon (LObject *h, kStrategy strat)
 used for GB over ZZ: intermediate reduction by monomial elements background: any known constant element of ideal suppresses intermediate coefficient swell More...
 
void postReduceByMonSig (LObject *h, kStrategy strat)
 
void finalReduceByMon (kStrategy strat)
 used for GB over ZZ: final reduction by constant elements background: any known constant element of ideal suppresses intermediate coefficient swell and beautifies output More...
 
BOOLEAN kStratChangeTailRing (kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
 
void kStratInitChangeTailRing (kStrategy strat)
 
ring sbaRing (kStrategy strat, const ring r, BOOLEAN, int)
 
int posInT_EcartFDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_FDegpLength (const TSet set, const int length, LObject &p)
 
int posInT_pLength (const TSet set, const int length, LObject &p)
 
int redFirst (LObject *h, kStrategy strat)
 
int redEcart (LObject *h, kStrategy strat)
 
void enterSMora (LObject &p, int atS, kStrategy strat, int atR=-1)
 
void enterSMoraNF (LObject &p, int atS, kStrategy strat, int atR=-1)
 
char * showOption ()
 
void kDebugPrint (kStrategy strat)
 Output some debug info about a given strategy. More...
 
poly pMove2CurrTail (poly p, kStrategy strat)
 
poly pMoveCurrTail2poly (poly p, kStrategy strat)
 
poly pCopyL2p (LObject H, kStrategy strat)
 
void updateSShift (kStrategy strat, int uptodeg, int lV)
 
void initBuchMoraShift (ideal F, ideal Q, kStrategy strat)
 
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 7273 of file kutil.cc.

7274 {
7275  #ifdef ADIDEBUG
7276  printf("\narriRewCrit\n");
7277  #endif
7279  return FALSE;
7280  poly p1 = pOne();
7281  poly p2 = pOne();
7282  for (int ii=strat->sl; ii>start; ii--)
7283  {
7284  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7285  {
7286  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7287  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7288  if (!(pLmCmp(p1,p2) == 1))
7289  {
7290  #ifdef ADIDEBUG
7291  printf("\narriRewCrit deleted: sig, P.sig\n");
7292  #endif
7293  pDelete(&p1);
7294  pDelete(&p2);
7295  return TRUE;
7296  }
7297  }
7298  }
7299  pDelete(&p1);
7300  pDelete(&p2);
7301  return FALSE;
7302 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:98
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
LObject P
Definition: kutil.h:296
#define pOne()
Definition: polys.h:297
polyset S
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:344
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10

§ arriRewCriterionPre()

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

Definition at line 7304 of file kutil.cc.

7305 {
7306  #ifdef ADIDEBUG
7307  printf("\narriRewCritPre\n");
7308  #endif
7309  //Over Rings, there are still some changes to do: considering coeffs
7311  return FALSE;
7312  int found = -1;
7313  for (int i=strat->Bl; i>-1; i--) {
7314  if (pLmEqual(strat->B[i].sig,sig))
7315  {
7316  found = i;
7317  break;
7318  }
7319  }
7320  if (found != -1)
7321  {
7322  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7323  {
7324  deleteInL(strat->B,&strat->Bl,found,strat);
7325  #ifdef ADIDEBUG
7326  printf("\nDelete!\n");
7327  #endif
7328  }
7329  else
7330  {
7331  #ifdef ADIDEBUG
7332  printf("\nDelete this one!\n");
7333  #endif
7334  return TRUE;
7335  }
7336  }
7337  poly p1 = pOne();
7338  poly p2 = pOne();
7339  for (int ii=strat->sl; ii>-1; ii--)
7340  {
7341  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7342  {
7343  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7344  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7345  if (!(pLmCmp(p1,p2) == 1))
7346  {
7347  pDelete(&p1);
7348  pDelete(&p2);
7349  #ifdef ADIDEBUG
7350  printf("\nDelete this one!\n");
7351  #endif
7352  return TRUE;
7353  }
7354  }
7355  }
7356  pDelete(&p1);
7357  pDelete(&p2);
7358  return FALSE;
7359 }
unsigned long * sevSig
Definition: kutil.h:318
polyset sig
Definition: kutil.h:302
#define FALSE
Definition: auxiliary.h:94
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
int Bl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc: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:297
polyset S
Definition: kutil.h:300
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
LSet B
Definition: kutil.h:322
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:344
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10
#define pLmEqual(p1, p2)
Definition: polys.h:111

§ cancelunit()

void cancelunit ( LObject L,
BOOLEAN  inNF 
)

Definition at line 332 of file kutil.cc.

333 {
334  int i;
335  poly h;
336  number lc;
337 
338  if(rHasGlobalOrdering (currRing)) return;
339  if(TEST_OPT_CANCELUNIT) return;
340 
341  ring r = L->tailRing;
342  poly p = L->GetLmTailRing();
343 
344  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
345  lc = pGetCoeff(p);
346  #ifdef ADIDEBUG
347  printf("\n cancelunit\n");
348  pWrite(p);
349  #endif
350 #ifdef HAVE_RINGS
351  // Leading coef have to be a unit
352  // example 2x+4x2 should be simplified to 2x*(1+2x)
353  // and 2 is not a unit in Z
354  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
355 #endif
356 
357  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
358 
359 // for(i=r->N;i>0;i--)
360 // {
361 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
362 // }
363  h = pNext(p);
364 
366  {
367  loop
368  {
369  if (h==NULL)
370  {
371  p_Delete(&pNext(p), r);
372  if (!inNF)
373  {
374  number eins= nCopy(lc);
375  if (L->p != NULL)
376  {
377  pSetCoeff(L->p,eins);
378  if (L->t_p != NULL)
379  pSetCoeff0(L->t_p,eins);
380  }
381  else
382  pSetCoeff(L->t_p,eins);
383  /* p and t_p share the same coeff, if both are !=NULL */
384  /* p==NULL==t_p cannot happen here */
385  }
386  L->ecart = 0;
387  L->length = 1;
388  //if (L->pLength > 0)
389  L->pLength = 1;
390  L->max_exp = NULL;
391 
392  if (L->t_p != NULL && pNext(L->t_p) != NULL)
393  p_Delete(&pNext(L->t_p),r);
394  if (L->p != NULL && pNext(L->p) != NULL)
395  pNext(L->p) = NULL;
396 
397  return;
398  }
399  i = 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:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
CanonicalForm lc(const CanonicalForm &f)
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#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 8852 of file kutil.cc.

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

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

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

§ chainCritPart()

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

Definition at line 3541 of file kutil.cc.

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

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

§ chainCritSig()

void chainCritSig ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3482 of file kutil.cc.

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

§ cleanT()

void cleanT ( kStrategy  strat)

Definition at line 552 of file kutil.cc.

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

§ cleanTSbaRing()

void cleanTSbaRing ( kStrategy  strat)

Definition at line 603 of file kutil.cc.

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

§ clearSbatch()

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

Definition at line 4872 of file kutil.cc.

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

10623 {
10624  int i;
10625  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10626  LObject L;
10627 
10628 #ifdef KDEBUG
10629  // need to set this: during tailreductions of T[i], T[i].max is out of
10630  // sync
10631  sloppy_max = TRUE;
10632 #endif
10633 
10634  strat->noTailReduction = FALSE;
10635  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10636  if (TEST_OPT_PROT)
10637  {
10638  PrintLn();
10639 // if (timerv) writeTime("standard base computed:");
10640  }
10641  if (TEST_OPT_PROT)
10642  {
10643  Print("(S:%d)",strat->sl);mflush();
10644  }
10645  for (i=strat->sl; i>=low; i--)
10646  {
10647  int end_pos=strat->sl;
10648  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10649  if (strat->ak==0) end_pos=i-1;
10650  TObject* T_j = strat->s_2_t(i);
10651  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10652  {
10653  L = *T_j;
10654  #ifdef KDEBUG
10655  if (TEST_OPT_DEBUG)
10656  {
10657  Print("test S[%d]:",i);
10658  p_wrp(L.p,currRing,strat->tailRing);
10659  PrintLn();
10660  }
10661  #endif
10663  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10664  else
10665  strat->S[i] = redtail(&L, strat->sl, strat);
10666  #ifdef KDEBUG
10667  if (TEST_OPT_DEBUG)
10668  {
10669  Print("to (tailR) S[%d]:",i);
10670  p_wrp(strat->S[i],currRing,strat->tailRing);
10671  PrintLn();
10672  }
10673  #endif
10674 
10675  if (strat->redTailChange)
10676  {
10677  if (T_j->max_exp != NULL) p_LmFree(T_j->max_exp, strat->tailRing);
10678  if (pNext(T_j->p) != NULL)
10679  T_j->max_exp = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10680  else
10681  T_j->max_exp = NULL;
10682  }
10684  T_j->pCleardenom();
10685  }
10686  else
10687  {
10688  assume(currRing == strat->tailRing);
10689  #ifdef KDEBUG
10690  if (TEST_OPT_DEBUG)
10691  {
10692  Print("test S[%d]:",i);
10693  p_wrp(strat->S[i],currRing,strat->tailRing);
10694  PrintLn();
10695  }
10696  #endif
10698  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10699  else
10700  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10702  {
10703  if (TEST_OPT_CONTENTSB)
10704  {
10705  number n;
10706  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10707  if (!nIsOne(n))
10708  {
10710  denom->n=nInvers(n);
10711  denom->next=DENOMINATOR_LIST;
10712  DENOMINATOR_LIST=denom;
10713  }
10714  nDelete(&n);
10715  }
10716  else
10717  {
10718  //pContent(strat->S[i]);
10719  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10720  }
10721  }
10722  #ifdef KDEBUG
10723  if (TEST_OPT_DEBUG)
10724  {
10725  Print("to (-tailR) S[%d]:",i);
10726  p_wrp(strat->S[i],currRing,strat->tailRing);
10727  PrintLn();
10728  }
10729  #endif
10730  }
10731  if (TEST_OPT_PROT)
10732  PrintS("-");
10733  }
10734  if (TEST_OPT_PROT) PrintLn();
10735 #ifdef KDEBUG
10736  sloppy_max = FALSE;
10737 #endif
10738 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7505
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
int ak
Definition: kutil.h:349
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7581
#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:394
intset fromQ
Definition: kutil.h:315
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
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 4544 of file kutil.cc.

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

§ deleteHC() [1/2]

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

Definition at line 243 of file kutil.cc.

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

§ enlargeT()

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

Definition at line 531 of file kutil.cc.

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

§ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4659 of file kutil.cc.

4660 {
4661  if (nIsOne(pGetCoeff(h))) return;
4662  number gcd;
4663  bool go = false;
4664  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4665  {
4666  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4667  go = true;
4668  }
4669  else
4670  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4671  if (go || !nIsOne(gcd))
4672  {
4673  poly p = h->next;
4674  if (!go)
4675  {
4676  number tmp = gcd;
4677  gcd = n_Ann(gcd,currRing->cf);
4678  nDelete(&tmp);
4679  }
4680  p_Test(p,strat->tailRing);
4681  p = pp_Mult_nn(p, gcd, strat->tailRing);
4682  nDelete(&gcd);
4683 
4684  if (p != NULL)
4685  {
4686  if (TEST_OPT_PROT)
4687  {
4688  PrintS("Z");
4689  }
4690 #ifdef KDEBUG
4691  if (TEST_OPT_DEBUG)
4692  {
4693  PrintS("--- create zero spoly: ");
4694  p_wrp(h,currRing,strat->tailRing);
4695  PrintS(" ---> ");
4696  }
4697 #endif
4698  poly tmp = pInit();
4699  pSetCoeff0(tmp, pGetCoeff(p));
4700  for (int i = 1; i <= rVar(currRing); i++)
4701  {
4702  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4703  }
4705  {
4706  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4707  }
4708  p_Setm(tmp, currRing);
4709  p = p_LmFreeAndNext(p, strat->tailRing);
4710  pNext(tmp) = p;
4711  LObject Lp;
4712  Lp.Init();
4713  Lp.p = tmp;
4714  Lp.tailRing = strat->tailRing;
4715  int posx;
4716  if (Lp.p!=NULL)
4717  {
4718  strat->initEcart(&Lp);
4719  if (strat->Ll==-1)
4720  posx =0;
4721  else
4722  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4723  Lp.sev = pGetShortExpVector(Lp.p);
4724  if (strat->tailRing != currRing)
4725  {
4726  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4727  }
4728 #ifdef KDEBUG
4729  if (TEST_OPT_DEBUG)
4730  {
4731  p_wrp(tmp,currRing,strat->tailRing);
4732  PrintLn();
4733  }
4734 #endif
4735  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4736  }
4737  }
4738  }
4739  nDelete(&gcd);
4740 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:690
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc: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 4742 of file kutil.cc.

4743 {
4744  if (nIsOne(pGetCoeff(h))) return;
4745  number gcd;
4746  bool go = false;
4747  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4748  {
4749  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4750  go = true;
4751  }
4752  else
4753  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4754  if (go || !nIsOne(gcd))
4755  {
4756  poly p = h->next;
4757  if (!go)
4758  {
4759  number tmp = gcd;
4760  gcd = n_Ann(gcd,currRing->cf);
4761  nDelete(&tmp);
4762  }
4763  p_Test(p,strat->tailRing);
4764  p = pp_Mult_nn(p, gcd, strat->tailRing);
4765 
4766  if (p != NULL)
4767  {
4768  if (TEST_OPT_PROT)
4769  {
4770  PrintS("Z");
4771  }
4772 #ifdef KDEBUG
4773  if (TEST_OPT_DEBUG)
4774  {
4775  PrintS("--- create zero spoly: ");
4776  p_wrp(h,currRing,strat->tailRing);
4777  PrintS(" ---> ");
4778  }
4779 #endif
4780  poly tmp = pInit();
4781  pSetCoeff0(tmp, pGetCoeff(p));
4782  for (int i = 1; i <= rVar(currRing); i++)
4783  {
4784  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4785  }
4787  {
4788  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4789  }
4790  p_Setm(tmp, currRing);
4791  p = p_LmFreeAndNext(p, strat->tailRing);
4792  pNext(tmp) = p;
4793  LObject Lp;
4794  Lp.Init();
4795  Lp.p = tmp;
4796  //printf("\nOld\n");pWrite(h);pWrite(hSig);
4797  #if EXT_POLY_NEW
4798  Lp.sig = pp_Mult_nn(hSig, gcd, currRing);
4799  if(Lp.sig == NULL || nIsZero(pGetCoeff(Lp.sig)))
4800  {
4801  #ifdef ADIDEBUG
4802  printf("\nSigdrop in enterextended spoly\n");pWrite(h);pWrite(hSig);
4803  #endif
4804  strat->sigdrop = TRUE;
4805  //Try to reduce it as far as we can via redRing
4806  int red_result = redRing(&Lp,strat);
4807  #ifdef ADIDEBUG
4808  printf("\nAfter redRing reduce:\n");pWrite(Lp.p);
4809  #endif
4810  if(red_result == 0)
4811  {
4812  // Cancel the sigdrop
4813  #ifdef ADIDEBUG
4814  printf("\nCancel the sigdrop. It reduced to 0\n");
4815  #endif
4816  p_Delete(&Lp.sig,currRing);Lp.sig = NULL;
4817  strat->sigdrop = FALSE;
4818  return;
4819  }
4820  else
4821  {
4822  #ifdef ADIDEBUG
4823  printf("\nSigdrop. end\n");
4824  #endif
4825  strat->enterS(strat->P,strat->sl+1,strat, strat->tl+1);
4826  #if 1
4827  strat->enterS(Lp,0,strat,strat->tl);
4828  #endif
4829  return;
4830  }
4831 
4832  }
4833  #else
4834  Lp.sig = pOne();
4835  if(strat->Ll >= 0)
4836  p_SetComp(Lp.sig,pGetComp(strat->L[0].sig)+1,currRing);
4837  else
4838  p_SetComp(Lp.sig,pGetComp(hSig)+1,currRing);
4839  #endif
4840  Lp.tailRing = strat->tailRing;
4841  int posx;
4842  if (Lp.p!=NULL)
4843  {
4844  strat->initEcart(&Lp);
4845  if (strat->Ll==-1)
4846  posx =0;
4847  else
4848  posx = strat->posInLSba(strat->L,strat->Ll,&Lp,strat);
4849  Lp.sev = pGetShortExpVector(Lp.p);
4850  if (strat->tailRing != currRing)
4851  {
4852  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4853  }
4854 #ifdef KDEBUG
4855  if (TEST_OPT_DEBUG)
4856  {
4857  p_wrp(tmp,currRing,strat->tailRing);
4858  PrintLn();
4859  }
4860 #endif
4861  //pWrite(h);pWrite(hSig);pWrite(Lp.p);pWrite(Lp.sig);printf("\n------------------\n");getchar();
4862  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4863  }
4864  }
4865  nDelete(&gcd);
4866  }
4867  nDelete(&gcd);
4868 }
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:690
int redRing(LObject *h, kStrategy strat)
Definition: kstd2.cc:432
void PrintLn()
Definition: reporter.cc:310
class sLObject LObject
Definition: kutil.h:60
bool sigdrop
Definition: kutil.h:356
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:347
#define pSetExp(p, i, v)
Definition: polys.h:42
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc: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:297
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:698
#define nDelete(n)
Definition: numbers.h:16
#define p_Test(p, r)
Definition: p_polys.h:160
#define rRing_has_Comp(r)
Definition: monomials.h:274
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
LSet L
Definition: kutil.h:321
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:347
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
int sl
Definition: kutil.h:344
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ enterL()

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

Definition at line 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:394
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:662
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:52

§ enterOnePairLift()

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

Definition at line 2220 of file kutil.cc.

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

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

§ enterOnePairNormal()

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

Definition at line 1937 of file kutil.cc.

1938 {
1939  assume(i<=strat->sl);
1940 
1941  int l,j,compare;
1942  LObject Lp;
1943  Lp.i_r = -1;
1944 
1945 #ifdef KDEBUG
1946  Lp.ecart=0; Lp.length=0;
1947 #endif
1948  /*- computes the lcm(s[i],p) -*/
1949  Lp.lcm = pInit();
1950 
1951 #ifndef HAVE_RATGRING
1952  pLcm(p,strat->S[i],Lp.lcm);
1953 #elif defined(HAVE_RATGRING)
1954  if (rIsRatGRing(currRing))
1955  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1956  else
1957  pLcm(p,strat->S[i],Lp.lcm);
1958 #endif
1959  pSetm(Lp.lcm);
1960 
1961 
1962  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1963  {
1964  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1965  && pHasNotCF(p,strat->S[i]))
1966  {
1967  /*
1968  *the product criterion has applied for (s,p),
1969  *i.e. lcm(s,p)=product of the leading terms of s and p.
1970  *Suppose (s,r) is in L and the leading term
1971  *of p divides lcm(s,r)
1972  *(==> the leading term of p divides the leading term of r)
1973  *but the leading term of s does not divide the leading term of r
1974  *(notice that tis condition is automatically satisfied if r is still
1975  *in S), then (s,r) can be cancelled.
1976  *This should be done here because the
1977  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1978  *
1979  *Moreover, skipping (s,r) holds also for the noncommutative case.
1980  */
1981  strat->cp++;
1982  pLmFree(Lp.lcm);
1983  Lp.lcm=NULL;
1984  return;
1985  }
1986  else
1987  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1988  if (strat->fromT && (strat->ecartS[i]>ecart))
1989  {
1990  pLmFree(Lp.lcm);
1991  Lp.lcm=NULL;
1992  return;
1993  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1994  }
1995  /*
1996  *the set B collects the pairs of type (S[j],p)
1997  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1998  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1999  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2000  */
2001  {
2002  j = strat->Bl;
2003  loop
2004  {
2005  if (j < 0) break;
2006  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2007  if ((compare==1)
2008  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
2009  {
2010  strat->c3++;
2011  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2012  {
2013  pLmFree(Lp.lcm);
2014  return;
2015  }
2016  break;
2017  }
2018  else
2019  if ((compare ==-1)
2020  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
2021  {
2022  deleteInL(strat->B,&strat->Bl,j,strat);
2023  strat->c3++;
2024  }
2025  j--;
2026  }
2027  }
2028  }
2029  else /*sugarcrit*/
2030  {
2031  if (ALLOW_PROD_CRIT(strat))
2032  {
2033  // if currRing->nc_type!=quasi (or skew)
2034  // TODO: enable productCrit for super commutative algebras...
2035  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
2036  pHasNotCF(p,strat->S[i]))
2037  {
2038  /*
2039  *the product criterion has applied for (s,p),
2040  *i.e. lcm(s,p)=product of the leading terms of s and p.
2041  *Suppose (s,r) is in L and the leading term
2042  *of p devides lcm(s,r)
2043  *(==> the leading term of p devides the leading term of r)
2044  *but the leading term of s does not devide the leading term of r
2045  *(notice that tis condition is automatically satisfied if r is still
2046  *in S), then (s,r) can be canceled.
2047  *This should be done here because the
2048  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
2049  */
2050  strat->cp++;
2051  pLmFree(Lp.lcm);
2052  Lp.lcm=NULL;
2053  return;
2054  }
2055  if (strat->fromT && (strat->ecartS[i]>ecart))
2056  {
2057  pLmFree(Lp.lcm);
2058  Lp.lcm=NULL;
2059  return;
2060  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
2061  }
2062  /*
2063  *the set B collects the pairs of type (S[j],p)
2064  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
2065  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
2066  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
2067  */
2068  for(j = strat->Bl;j>=0;j--)
2069  {
2070  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
2071  if (compare==1)
2072  {
2073  strat->c3++;
2074  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
2075  {
2076  pLmFree(Lp.lcm);
2077  return;
2078  }
2079  break;
2080  }
2081  else
2082  if (compare ==-1)
2083  {
2084  deleteInL(strat->B,&strat->Bl,j,strat);
2085  strat->c3++;
2086  }
2087  }
2088  }
2089  }
2090  /*
2091  *the pair (S[i],p) enters B if the spoly != 0
2092  */
2093  /*- compute the short s-polynomial -*/
2094  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
2095  pNorm(p);
2096 
2097  if ((strat->S[i]==NULL) || (p==NULL))
2098  return;
2099 
2100  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
2101  Lp.p=NULL;
2102  else
2103  {
2104  #ifdef HAVE_PLURAL
2105  if ( rIsPluralRing(currRing) )
2106  {
2107  if(pHasNotCF(p, strat->S[i]))
2108  {
2109  if(ncRingType(currRing) == nc_lie)
2110  {
2111  // generalized prod-crit for lie-type
2112  strat->cp++;
2113  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
2114  }
2115  else
2116  if( ALLOW_PROD_CRIT(strat) )
2117  {
2118  // product criterion for homogeneous case in SCA
2119  strat->cp++;
2120  Lp.p = NULL;
2121  }
2122  else
2123  {
2124  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2125  nc_CreateShortSpoly(strat->S[i], p, currRing);
2126  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2127  pNext(Lp.p) = strat->tail; // !!!
2128  }
2129  }
2130  else
2131  {
2132  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
2133  nc_CreateShortSpoly(strat->S[i], p, currRing);
2134 
2135  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2136  pNext(Lp.p) = strat->tail; // !!!
2137  }
2138  }
2139  else
2140  #endif
2141  {
2143  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
2144  }
2145  }
2146  if (Lp.p == NULL)
2147  {
2148  /*- the case that the s-poly is 0 -*/
2149  if (strat->pairtest==NULL) initPairtest(strat);
2150  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
2151  strat->pairtest[strat->sl+1] = TRUE;
2152  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
2153  /*
2154  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
2155  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
2156  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
2157  *term of p devides the lcm(s,r)
2158  *(this canceling should be done here because
2159  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
2160  *the first case is handeled in chainCrit
2161  */
2162  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
2163  }
2164  else
2165  {
2166  /*- the pair (S[i],p) enters B -*/
2167  Lp.p1 = strat->S[i];
2168  Lp.p2 = p;
2169 
2170  if (
2172 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2173  )
2174  {
2175  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2176  pNext(Lp.p) = strat->tail; // !!!
2177  }
2178 
2179  if (atR >= 0)
2180  {
2181  Lp.i_r1 = strat->S_2_R[i];
2182  Lp.i_r2 = atR;
2183  }
2184  else
2185  {
2186  Lp.i_r1 = -1;
2187  Lp.i_r2 = -1;
2188  }
2189  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2190 
2192  {
2193  if (!rIsPluralRing(currRing))
2194  nDelete(&(Lp.p->coef));
2195  }
2196 
2197  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
2198  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2199  }
2200 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2307
#define pSetm(p)
Definition: polys.h:253
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
static int pDivComp(poly p, poly q)
Definition: kutil.cc:187
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:98
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1938
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc: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:394
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:315
static int si_max(const int a, const int b)
Definition: auxiliary.h:120
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
polyset S
Definition: kutil.h:300
BOOLEAN sugarCrit
Definition: kutil.h:374
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:343
intset ecartS
Definition: kutil.h:303
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
int sl
Definition: kutil.h:344
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:392
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc: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  ,
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 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  {
1432  pLmDelete(h.lcm);
1433  h.lcm=NULL;
1434  }
1435  h.Clear();
1436  if (strat->pairtest==NULL) initPairtest(strat);
1437  strat->pairtest[i] = TRUE;
1438  strat->pairtest[strat->sl+1] = TRUE;
1439  return;
1440  }
1441  else
1442  {
1443  gcd = pm1;
1444  pm1 = NULL;
1445  }
1446  }
1447  else
1448  {
1449  if((pGetComp(strat->S[i]) == 0) && (0 != pGetComp(p)))
1450  {
1451  p_SetCompP(sim2, pGetComp(p), strat->tailRing);
1452  pSetmComp(sim2);
1453  }
1454  //p_Write(pm1,strat->tailRing);p_Write(sim2,strat->tailRing);
1455  gcd = p_Add_q(pm1, sim2, strat->tailRing);
1456  }
1457  p_Test(gcd, strat->tailRing);
1458  //p_LmDelete(m1, strat->tailRing);
1459  //p_LmDelete(m2, strat->tailRing);
1460 #ifdef KDEBUG
1461  if (TEST_OPT_DEBUG)
1462  {
1463  wrp(gcd);
1464  PrintLn();
1465  }
1466 #endif
1467  h.p = gcd;
1468  h.i_r = -1;
1469  if(h.p == NULL)
1470  {
1471  if (strat->pairtest==NULL) initPairtest(strat);
1472  strat->pairtest[i] = TRUE;
1473  strat->pairtest[strat->sl+1] = TRUE;
1474  return;
1475  }
1476  h.tailRing = strat->tailRing;
1477  int posx;
1478  //h.pCleardenom();
1479  //pSetm(h.p);
1480  #ifdef ADIDEBUG
1481  printf("\nThis is afterwards:\n");
1482  pWrite(h.p);
1483  #endif
1484  h.i_r1 = -1;h.i_r2 = -1;
1485  strat->initEcart(&h);
1486  #if 1
1487  h.p2 = strat->S[i];
1488  h.p1 = p;
1489  #endif
1490  #if 1
1491  if (atR >= 0)
1492  {
1493  h.i_r1 = atR;
1494  h.i_r2 = strat->S_2_R[i];
1495  }
1496  #endif
1497  if (strat->Bl==-1)
1498  posx =0;
1499  else
1500  posx = strat->posInL(strat->B,strat->Bl,&h,strat);
1501  h.sev = pGetShortExpVector(h.p);
1502  if (currRing!=strat->tailRing)
1503  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1504  #ifdef ADIDEBUG
1505  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);
1506  #endif
1507  enterL(&strat->B,&strat->Bl,&strat->Bmax,h,posx);
1508  kTest_TS(strat);
1509 }
#define pSetmComp(p)
TODO:
Definition: polys.h:255
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
const CanonicalForm int s
Definition: facAbsFact.cc:55
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:935
#define pSetm(p)
Definition: polys.h:253
#define pDivComp_LESS
Definition: kutil.cc:141
void PrintLn()
Definition: reporter.cc:310
#define pDivComp_EQUAL
Definition: kutil.cc:140
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:343
int ksCheckCoeff(number *a, number *b)
#define pNeg(p)
Definition: polys.h:181
BOOLEAN * pairtest
Definition: kutil.h:329
int Bl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:957
#define TRUE
Definition: auxiliary.h:98
#define pLcm(a, b, m)
Definition: polys.h:277
void pWrite(poly p)
Definition: polys.h:290
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc: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:654
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition: coeffs.h:526
polyset S
Definition: kutil.h:300
#define nDelete(n)
Definition: numbers.h:16
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:716
int cp
Definition: kutil.h:343
#define p_Test(p, r)
Definition: p_polys.h:160
static FORCE_INLINE number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
beware that ExtGCD is only relevant for a few chosen coeff. domains and may perform something unexpec...
Definition: coeffs.h:697
void initPairtest(kStrategy strat)
Definition: kutil.cc:672
#define nIsZero(n)
Definition: numbers.h:19
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:149
int sl
Definition: kutil.h:344
TSet T
Definition: kutil.h:320
void wrp(poly p)
Definition: polys.h:292
#define pDivComp_GREATER
Definition: kutil.cc:142
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168

§ enterOnePairSelfShifts()

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

Definition at line 12248 of file kutil.cc.

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

§ enterOnePairShift()

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

Definition at line 12311 of file kutil.cc.

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

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

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

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

§ enterOneStrongPoly()

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

Definition at line 1516 of file kutil.cc.

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

§ enterOneStrongPolySig()

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

Definition at line 1711 of file kutil.cc.

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

§ enterOneZeroPairRing()

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

Definition at line 4231 of file kutil.cc.

4232 {
4233  int l,j,compare,compareCoeff;
4234  LObject Lp;
4235 
4236 #ifdef KDEBUG
4237  Lp.ecart=0; Lp.length=0;
4238 #endif
4239  /*- computes the lcm(s[i],p) -*/
4240  Lp.lcm = pInit();
4241 
4242  pLcm(p,f,Lp.lcm);
4243  pSetm(Lp.lcm);
4244  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
4245  assume(!strat->sugarCrit);
4246  assume(!strat->fromT);
4247  /*
4248  *the set B collects the pairs of type (S[j],p)
4249  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
4250  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
4251  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
4252  */
4253  for(j = strat->Bl;j>=0;j--)
4254  {
4255  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
4256  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
4257  if (compareCoeff == 0 || compare == compareCoeff)
4258  {
4259  if (compare == 1)
4260  {
4261  strat->c3++;
4262  pLmDelete(Lp.lcm);
4263  return;
4264  }
4265  else
4266  if (compare == -1)
4267  {
4268  deleteInL(strat->B,&strat->Bl,j,strat);
4269  strat->c3++;
4270  }
4271  }
4272  if (compare == pDivComp_EQUAL)
4273  {
4274  // Add hint for same LM and direction of LC (later) (TODO Oliver)
4275  if (compareCoeff == 1)
4276  {
4277  strat->c3++;
4278  pLmDelete(Lp.lcm);
4279  return;
4280  }
4281  else
4282  if (compareCoeff == -1)
4283  {
4284  deleteInL(strat->B,&strat->Bl,j,strat);
4285  strat->c3++;
4286  }
4287  }
4288  }
4289  /*
4290  *the pair (S[i],p) enters B if the spoly != 0
4291  */
4292  /*- compute the short s-polynomial -*/
4293  if ((f==NULL) || (p==NULL)) return;
4294  pNorm(p);
4295  {
4296  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
4297  }
4298  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
4299  {
4300  /*- the case that the s-poly is 0 -*/
4301 // if (strat->pairtest==NULL) initPairtest(strat);
4302 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
4303 // strat->pairtest[strat->sl+1] = TRUE;
4304  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
4305  /*
4306  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
4307  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
4308  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
4309  *term of p devides the lcm(s,r)
4310  *(this canceling should be done here because
4311  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
4312  *the first case is handeled in chainCrit
4313  */
4314  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
4315  }
4316  else
4317  {
4318  /*- the pair (S[i],p) enters B -*/
4319  Lp.p1 = f;
4320  Lp.p2 = p;
4321 
4322  pNext(Lp.p) = strat->tail;
4323 
4324  LObject tmp_h(f, currRing, strat->tailRing);
4325  tmp_h.SetShortExpVector();
4326  strat->initEcart(&tmp_h);
4327  tmp_h.sev = pGetShortExpVector(tmp_h.p);
4328  tmp_h.t_p = t_p;
4329 
4330  enterT(tmp_h, strat, strat->tl + 1);
4331 
4332  if (atR >= 0)
4333  {
4334  Lp.i_r2 = atR;
4335  Lp.i_r1 = strat->tl;
4336  }
4337 
4338  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
4339  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
4340  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
4341  }
4342 }
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
f
Definition: cfModGcd.cc:4022
int c3
Definition: kutil.h:343
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define pLcm(a, b, m)
Definition: polys.h:277
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:281
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc: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:9478
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:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
poly tail
Definition: kutil.h:330
BOOLEAN sugarCrit
Definition: kutil.h:374
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
ring tailRing
Definition: kutil.h:339
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:345
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static int pDivCompRing(poly p, poly q)
Definition: kutil.cc:149
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
int l
Definition: cfEzgcd.cc:94

§ enterpairs()

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

Definition at line 4935 of file kutil.cc.

4936 {
4937  int j=pos;
4938 
4940  initenterpairs(h,k,ecart,0,strat, atR);
4941  if ( (!strat->fromT)
4942  && ((strat->syzComp==0)
4943  ||(pGetComp(h)<=strat->syzComp)))
4944  {
4945  unsigned long h_sev = pGetShortExpVector(h);
4946  loop
4947  {
4948  if (j > k) break;
4949  clearS(h,h_sev, &j,&k,strat);
4950  j++;
4951  }
4952  }
4953 }
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:3830
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

§ enterpairsShift()

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

Definition at line 12605 of file kutil.cc.

12606 {
12607  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12608  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12609  int j=pos;
12610 
12612  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12613  if ( (!strat->fromT)
12614  && ((strat->syzComp==0)
12615  ||(pGetComp(h)<=strat->syzComp)))
12616  {
12617  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12618  unsigned long h_sev = pGetShortExpVector(h);
12619  loop
12620  {
12621  if (j > k) break;
12622  clearS(h,h_sev, &j,&k,strat);
12623  j++;
12624  }
12625  //Print("end clearS sl=%d\n",strat->sl);
12626  }
12627  // PrintS("end enterpairs\n");
12628 }
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:12637
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

§ enterpairsSig()

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

Definition at line 4961 of file kutil.cc.

4962 {
4963  int j=pos;
4965  initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
4966  if ( (!strat->fromT)
4967  && ((strat->syzComp==0)
4968  ||(pGetComp(h)<=strat->syzComp)))
4969  {
4970  unsigned long h_sev = pGetShortExpVector(h);
4971  loop
4972  {
4973  if (j > k) break;
4974  clearS(h,h_sev, &j,&k,strat);
4975  j++;
4976  }
4977  }
4978 }
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:3900
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:394
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1122
static Poly * h
Definition: janet.cc:978

§ enterpairsSpecial()

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

Definition at line 4984 of file kutil.cc.

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

§ enterSBba()

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

Definition at line 9238 of file kutil.cc.

9239 {
9240  strat->news = TRUE;
9241  /*- puts p to the standardbasis s at position at -*/
9242  if (strat->sl == IDELEMS(strat->Shdl)-1)
9243  {
9244  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9245  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9246  (IDELEMS(strat->Shdl)+setmaxTinc)
9247  *sizeof(unsigned long));
9248  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9249  IDELEMS(strat->Shdl)*sizeof(int),
9250  (IDELEMS(strat->Shdl)+setmaxTinc)
9251  *sizeof(int));
9252  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9253  IDELEMS(strat->Shdl)*sizeof(int),
9254  (IDELEMS(strat->Shdl)+setmaxTinc)
9255  *sizeof(int));
9256  if (strat->lenS!=NULL)
9257  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9258  IDELEMS(strat->Shdl)*sizeof(int),
9259  (IDELEMS(strat->Shdl)+setmaxTinc)
9260  *sizeof(int));
9261  if (strat->lenSw!=NULL)
9262  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9263  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9264  (IDELEMS(strat->Shdl)+setmaxTinc)
9265  *sizeof(wlen_type));
9266  if (strat->fromQ!=NULL)
9267  {
9268  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9269  IDELEMS(strat->Shdl)*sizeof(int),
9270  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9271  }
9272  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9273  IDELEMS(strat->Shdl)+=setmaxTinc;
9274  strat->Shdl->m=strat->S;
9275  }
9276  if (atS <= strat->sl)
9277  {
9278 #ifdef ENTER_USE_MEMMOVE
9279  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9280  (strat->sl - atS + 1)*sizeof(poly));
9281  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9282  (strat->sl - atS + 1)*sizeof(int));
9283  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9284  (strat->sl - atS + 1)*sizeof(unsigned long));
9285  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9286  (strat->sl - atS + 1)*sizeof(int));
9287  if (strat->lenS!=NULL)
9288  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9289  (strat->sl - atS + 1)*sizeof(int));
9290  if (strat->lenSw!=NULL)
9291  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9292  (strat->sl - atS + 1)*sizeof(wlen_type));
9293 #else
9294  for (i=strat->sl+1; i>=atS+1; i--)
9295  {
9296  strat->S[i] = strat->S[i-1];
9297  strat->ecartS[i] = strat->ecartS[i-1];
9298  strat->sevS[i] = strat->sevS[i-1];
9299  strat->S_2_R[i] = strat->S_2_R[i-1];
9300  }
9301  if (strat->lenS!=NULL)
9302  for (i=strat->sl+1; i>=atS+1; i--)
9303  strat->lenS[i] = strat->lenS[i-1];
9304  if (strat->lenSw!=NULL)
9305  for (i=strat->sl+1; i>=atS+1; i--)
9306  strat->lenSw[i] = strat->lenSw[i-1];
9307 #endif
9308  }
9309  if (strat->fromQ!=NULL)
9310  {
9311 #ifdef ENTER_USE_MEMMOVE
9312  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9313  (strat->sl - atS + 1)*sizeof(int));
9314 #else
9315  for (i=strat->sl+1; i>=atS+1; i--)
9316  {
9317  strat->fromQ[i] = strat->fromQ[i-1];
9318  }
9319 #endif
9320  strat->fromQ[atS]=0;
9321  }
9322 
9323  /*- save result -*/
9324  strat->S[atS] = p.p;
9325  if (strat->honey) strat->ecartS[atS] = p.ecart;
9326  if (p.sev == 0)
9327  p.sev = pGetShortExpVector(p.p);
9328  else
9329  assume(p.sev == pGetShortExpVector(p.p));
9330  strat->sevS[atS] = p.sev;
9331  strat->ecartS[atS] = p.ecart;
9332  strat->S_2_R[atS] = atR;
9333  strat->sl++;
9334 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:374
wlen_set lenSw
Definition: kutil.h:314
int * S_2_R
Definition: kutil.h:338
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:397
#define TRUE
Definition: auxiliary.h:98
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:313
intset ecartS
Definition: kutil.h:303
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc: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:94
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
poly kNoether
Definition: kutil.h:324
#define TRUE
Definition: auxiliary.h:98
#define TEST_OPT_DEBUG
Definition: options.h:103
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
void updateL(kStrategy strat)
Definition: kstd1.cc:1131
int lastAxis
Definition: kutil.h:352
#define TEST_OPT_FINDET
Definition: options.h:106
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:1015
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1202
void reorderL(kStrategy strat)
Definition: kstd1.cc:957
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:282
BOOLEAN kHEdgeFound
Definition: kutil.h:373
#define NULL
Definition: omList.c:10
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1295
ring tailRing
Definition: kutil.h:339
BOOLEAN posInLOldFlag
Definition: kutil.h:379
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10745
#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:9238

§ enterSMoraNF()

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

Definition at line 1416 of file kstd1.cc.

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

§ enterSSba()

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

Definition at line 9340 of file kutil.cc.

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

9676 {
9677  #ifdef ADIDEBUG
9678  printf("\n Entersyz:\n");pWrite(p.sig);
9679  #endif
9680  int i;
9681  strat->newt = TRUE;
9682  if (strat->syzl == strat->syzmax-1)
9683  {
9684  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9685  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9686  (strat->syzmax)*sizeof(unsigned long),
9687  ((strat->syzmax)+setmaxTinc)
9688  *sizeof(unsigned long));
9689  strat->syzmax += setmaxTinc;
9690  }
9691  if (atT < strat->syzl)
9692  {
9693 #ifdef ENTER_USE_MEMMOVE
9694  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9695  (strat->syzl-atT+1)*sizeof(poly));
9696  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9697  (strat->syzl-atT+1)*sizeof(unsigned long));
9698 #endif
9699  for (i=strat->syzl; i>=atT+1; i--)
9700  {
9701 #ifndef ENTER_USE_MEMMOVE
9702  strat->syz[i] = strat->syz[i-1];
9703  strat->sevSyz[i] = strat->sevSyz[i-1];
9704 #endif
9705  }
9706  }
9707  //i = strat->syzl;
9708  i = atT;
9709  //Makes sure the syz saves just the signature
9710  #ifdef HAVE_RINGS
9712  pNext(p.sig) = NULL;
9713  #endif
9714  strat->syz[atT] = p.sig;
9715  strat->sevSyz[atT] = p.sevSig;
9716  strat->syzl++;
9717 #if F5DEBUG
9718  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9719  pWrite(strat->syz[atT]);
9720 #endif
9721  // recheck pairs in strat->L with new rule and delete correspondingly
9722  int cc = strat->Ll;
9723  while (cc>-1)
9724  {
9725  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9726  //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);
9727  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9728  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9729  #ifdef HAVE_RINGS
9730  &&((!rField_is_Ring(currRing))
9731  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing->cf) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9732  #endif
9733  )
9734  {
9735  //printf("\nYES!\n");
9736  #ifdef ADIDEBUG
9737  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9738  #endif
9739  deleteInL(strat->L,&strat->Ll,cc,strat);
9740  }
9741  cc--;
9742  }
9743 //#if 1
9744 #ifdef DEBUGF5
9745  PrintS("--- Syzygies ---\n");
9746  Print("syzl %d\n",strat->syzl);
9747  Print("syzmax %d\n",strat->syzmax);
9748  PrintS("--------------------------------\n");
9749  for(i=0;i<=strat->syzl-1;i++)
9750  {
9751  Print("%d - ",i);
9752  pWrite(strat->syz[i]);
9753  }
9754  PrintS("--------------------------------\n");
9755 #endif
9756 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:345
int Ll
Definition: kutil.h:347
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:398
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:98
void pWrite(poly p)
Definition: polys.h:290
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc: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 9478 of file kutil.cc.

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

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

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

10178 {
10179  /*- release temp data -*/
10180  cleanT(strat);
10181  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10182  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10183  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10184  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10185  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10186  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10187  /*- set L: should be empty -*/
10188  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10189  /*- set B: should be empty -*/
10190  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10191  pLmDelete(&strat->tail);
10192  strat->syzComp=0;
10193 }
int syzComp
Definition: kutil.h:350
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:338
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
unsigned long * sevT
Definition: kutil.h:319
void * ADDRESS
Definition: auxiliary.h:115
int Bmax
Definition: kutil.h:348
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
intset ecartS
Definition: kutil.h:303
LSet L
Definition: kutil.h:321
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:316
TSet T
Definition: kutil.h:320
ideal Shdl
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:59

§ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10370 of file kutil.cc.

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

§ faugereRewCriterion()

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

Definition at line 7211 of file kutil.cc.

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

§ finalReduceByMon()

void finalReduceByMon ( kStrategy  strat)

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

Definition at line 11194 of file kutil.cc.

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

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

§ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 482 of file kutil.cc.

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

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

§ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4208 of file kutil.cc.

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

§ initBuchMora()

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

Definition at line 10101 of file kutil.cc.

10102 {
10103  strat->interpt = BTEST1(OPT_INTERRUPT);
10104  strat->kHEdge=NULL;
10106  /*- creating temp data structures------------------- -*/
10107  strat->cp = 0;
10108  strat->c3 = 0;
10109  strat->tail = pInit();
10110  /*- set s -*/
10111  strat->sl = -1;
10112  /*- set L -*/
10113  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10114  strat->Ll = -1;
10115  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10116  /*- set B -*/
10117  strat->Bmax = setmaxL;
10118  strat->Bl = -1;
10119  strat->B = initL();
10120  /*- set T -*/
10121  strat->tl = -1;
10122  strat->tmax = setmaxT;
10123  strat->T = initT();
10124  strat->R = initR();
10125  strat->sevT = initsevT();
10126  /*- init local data struct.---------------------------------------- -*/
10127  strat->P.ecart=0;
10128  strat->P.length=0;
10129  strat->P.pLength=0;
10131  {
10132  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10133  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10134  }
10136  {
10137  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10138  }
10139  else
10140  {
10141  if(TEST_OPT_SB_1)
10142  {
10143  int i;
10144  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10145  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10146  {
10147  P->m[i-strat->newIdeal] = F->m[i];
10148  F->m[i] = NULL;
10149  }
10150  initSSpecial(F,Q,P,strat);
10151  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10152  {
10153  F->m[i] = P->m[i-strat->newIdeal];
10154  P->m[i-strat->newIdeal] = NULL;
10155  }
10156  idDelete(&P);
10157  }
10158  else
10159  {
10160  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10161  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10162  }
10163  }
10164  strat->fromT = FALSE;
10166  if ((!TEST_OPT_SB_1)
10167  || (rField_is_Ring(currRing))
10168  )
10169  {
10170  updateS(TRUE,strat);
10171  }
10172  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10173  strat->fromQ=NULL;
10174  assume(kTest_TS(strat));
10175 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8138
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
unsigned long * sevT
Definition: kutil.h:319
int ak
Definition: kutil.h:349
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:348
BOOLEAN interpt
Definition: kutil.h:368
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN fromT
Definition: kutil.h:376
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8544
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:394
intset fromQ
Definition: kutil.h:315
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#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:9009
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 9777 of file kutil.cc.

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

§ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9928 of file kutil.cc.

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

§ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 10014 of file kutil.cc.

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

§ initBuchMoraShift()

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

Definition at line 12094 of file kutil.cc.

12095 {
12096  strat->interpt = BTEST1(OPT_INTERRUPT);
12097  strat->kHEdge=NULL;
12099  /*- creating temp data structures------------------- -*/
12100  strat->cp = 0;
12101  strat->c3 = 0;
12102  strat->cv = 0;
12103  strat->tail = pInit();
12104  /*- set s -*/
12105  strat->sl = -1;
12106  /*- set L -*/
12107  strat->Lmax = setmaxL;
12108  strat->Ll = -1;
12109  strat->L = initL();
12110  /*- set B -*/
12111  strat->Bmax = setmaxL;
12112  strat->Bl = -1;
12113  strat->B = initL();
12114  /*- set T -*/
12115  strat->tl = -1;
12116  strat->tmax = setmaxT;
12117  strat->T = initT();
12118  strat->R = initR();
12119  strat->sevT = initsevT();
12120  /*- init local data struct.---------------------------------------- -*/
12121  strat->P.ecart=0;
12122  strat->P.length=0;
12124  {
12125  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12126  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12127  }
12129  {
12130  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12131  }
12132  {
12133  if(TEST_OPT_SB_1)
12134  {
12135  int i;
12136  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12137  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12138  {
12139  P->m[i-strat->newIdeal] = F->m[i];
12140  F->m[i] = NULL;
12141  }
12142  initSSpecial(F,Q,P,strat);
12143  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12144  {
12145  F->m[i] = P->m[i-strat->newIdeal];
12146  P->m[i-strat->newIdeal] = NULL;
12147  }
12148  idDelete(&P);
12149  }
12150  else
12151  {
12152  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12153  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12154  }
12155  }
12156  strat->fromT = FALSE;
12157  if (!TEST_OPT_SB_1)
12158  {
12159  /* the only change: we do not fill the set T*/
12160  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12161  }
12162  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12163  strat->fromQ=NULL;
12164  /* more changes: fill the set T with all the shifts of elts of S*/
12165  /* is done by other procedure */
12166 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:343
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:366
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8138
#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:8544
#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:749
#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:9009
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:120

§ initenterpairs()

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

Definition at line 3830 of file kutil.cc.

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

§ initenterpairsShift()

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

Definition at line 12637 of file kutil.cc.

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

§ initenterpairsSig()

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

Definition at line 3900 of file kutil.cc.

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

§ initenterpairsSigRing()

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

Definition at line 3960 of file kutil.cc.

3961 {
3962 
3963  if ((strat->syzComp==0)
3964  || (pGetComp(h)<=strat->syzComp))
3965  {
3966  int j;
3967 
3968  if (pGetComp(h)==0)
3969  {
3970  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
3971  if ((isFromQ)&&(strat->fromQ!=NULL))
3972  {
3973  for (j=0; j<=k && !strat->sigdrop; j++)
3974  {
3975  if (!strat->fromQ[j])
3976  {
3977  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3978  //Print("j:%d, Ll:%d\n",j,strat->Ll);
3979  }
3980  }
3981  }
3982  else
3983  {
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  enterOnePairSigRing(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
3999  //Print("j:%d, Ll:%d\n",j,strat->Ll);
4000  }
4001  }
4002  }
4003 
4004 #if 0
4005  if (new_pair)
4006  {
4007 #ifdef HAVE_RATGRING
4008  if (currRing->real_var_start>0)
4009  chainCritPart(h,ecart,strat);
4010  else
4011 #endif
4012  strat->chainCrit(h,ecart,strat);
4013  }
4014 #endif
4015  }
4016 }
int syzComp
Definition: kutil.h:350
bool sigdrop
Definition: kutil.h:356
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
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3541
void enterOnePairSigRing(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2693

§ initenterstrongPairs()

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

Definition at line 4610 of file kutil.cc.

4611 {
4612  const int iCompH = pGetComp(h);
4613  if (!nIsOne(pGetCoeff(h)))
4614  {
4615  int j;
4616 
4617  for (j=0; j<=k; j++)
4618  {
4619  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4620 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4621 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4622  if (((iCompH == pGetComp(strat->S[j]))
4623  || (0 == pGetComp(strat->S[j])))
4624  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4625  {
4626  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR, FALSE);
4627  }
4628  }
4629  }
4630 }
int syzComp
Definition: kutil.h:350
#define FALSE
Definition: auxiliary.h:94
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
polyset S
Definition: kutil.h:300
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1516
static Poly * h
Definition: janet.cc:978

§ initenterstrongPairsSig()

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

Definition at line 4632 of file kutil.cc.

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

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

§ initHilbCrit()

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

Definition at line 9759 of file kutil.cc.

9760 {
9761 
9762  //if the ordering is local, then hilb criterion
9763  //can be used also if the ideal is not homogenous
9765  {
9767  *hilb=NULL;
9768  else
9769  return;
9770  }
9771  if (strat->homog!=isHomog)
9772  {
9773  *hilb=NULL;
9774  }
9775 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
#define FALSE
Definition: auxiliary.h:94
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
BOOLEAN homog
Definition: kutil.h:369
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:751
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10

§ initPairtest()

void initPairtest ( kStrategy  strat)

Definition at line 672 of file kutil.cc.

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

§ initS()

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

Definition at line 8042 of file kutil.cc.

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

10298 {
10299  strat->interpt = BTEST1(OPT_INTERRUPT);
10300  strat->kHEdge=NULL;
10302  /*- creating temp data structures------------------- -*/
10303  strat->cp = 0;
10304  strat->c3 = 0;
10305  strat->tail = pInit();
10306  /*- set s -*/
10307  strat->sl = -1;
10308  /*- set ps -*/
10309  strat->syzl = -1;
10310  /*- set L -*/
10311  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10312  strat->Ll = -1;
10313  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10314  /*- set B -*/
10315  strat->Bmax = setmaxL;
10316  strat->Bl = -1;
10317  strat->B = initL();
10318  /*- set T -*/
10319  strat->tl = -1;
10320  strat->tmax = setmaxT;
10321  strat->T = initT();
10322  strat->R = initR();
10323  strat->sevT = initsevT();
10324  /*- init local data struct.---------------------------------------- -*/
10325  strat->P.ecart=0;
10326  strat->P.length=0;
10328  {
10329  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10330  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10331  }
10333  {
10334  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10335  }
10336  else
10337  {
10338  if(TEST_OPT_SB_1)
10339  {
10340  int i;
10341  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10342  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10343  {
10344  P->m[i-strat->newIdeal] = F->m[i];
10345  F->m[i] = NULL;
10346  }
10347  initSSpecialSba(F,Q,P,strat);
10348  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10349  {
10350  F->m[i] = P->m[i-strat->newIdeal];
10351  P->m[i-strat->newIdeal] = NULL;
10352  }
10353  idDelete(&P);
10354  }
10355  else
10356  {
10357  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10358  }
10359  }
10360  strat->fromT = FALSE;
10361  if (!TEST_OPT_SB_1)
10362  {
10363  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10364  }
10365  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10366  //strat->fromQ=NULL;
10367  assume(kTest_TS(strat));
10368 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:323
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:347
#define FALSE
Definition: auxiliary.h:94
int c3
Definition: kutil.h:343
poly kNoether
Definition: kutil.h:324
int tl
Definition: kutil.h:346
int Bl
Definition: kutil.h:348
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8689
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:8237
#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:654
#define assume(x)
Definition: mod2.h:394
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:296
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:330
TObject ** R
Definition: kutil.h:336
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:346
int cp
Definition: kutil.h:343
BOOLEAN kHEdgeFound
Definition: kutil.h:373
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:321
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:322
int Lmax
Definition: kutil.h:347
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
#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:9009
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 9841 of file kutil.cc.

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

§ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10195 of file kutil.cc.

10196 {
10198  {
10199  if (strat->honey)
10200  {
10201  strat->posInL = posInL15;
10202  // ok -- here is the deal: from my experiments for Singular-2-0
10203  // I conclude that that posInT_EcartpLength is the best of
10204  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10205  // see the table at the end of this file
10206  if (TEST_OPT_OLDSTD)
10207  strat->posInT = posInT15;
10208  else
10209  strat->posInT = posInT_EcartpLength;
10210  }
10211  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10212  {
10213  strat->posInL = posInL11;
10214  strat->posInT = posInT11;
10215  }
10216  else if (TEST_OPT_INTSTRATEGY)
10217  {
10218  strat->posInL = posInL11;
10219  strat->posInT = posInT11;
10220  }
10221  else
10222  {
10223  strat->posInL = posInL0;
10224  strat->posInT = posInT0;
10225  }
10226  //if (strat->minim>0) strat->posInL =posInLSpecial;
10227  if (strat->homog)
10228  {
10229  strat->posInL = posInL110;
10230  strat->posInT = posInT110;
10231  }
10232  }
10233  else
10234  {
10235  if (strat->homog)
10236  {
10237  strat->posInL = posInL11;
10238  strat->posInT = posInT11;
10239  }
10240  else
10241  {
10242  if ((currRing->order[0]==ringorder_c)
10243  ||(currRing->order[0]==ringorder_C))
10244  {
10245  strat->posInL = posInL17_c;
10246  strat->posInT = posInT17_c;
10247  }
10248  else
10249  {
10250  strat->posInL = posInL17;
10251  strat->posInT = posInT17;
10252  }
10253  }
10254  }
10255  if (strat->minim>0) strat->posInL =posInLSpecial;
10256  // for further tests only
10257  if ((BTEST1(11)) || (BTEST1(12)))
10258  strat->posInL = posInL11;
10259  else if ((BTEST1(13)) || (BTEST1(14)))
10260  strat->posInL = posInL13;
10261  else if ((BTEST1(15)) || (BTEST1(16)))
10262  strat->posInL = posInL15;
10263  else if ((BTEST1(17)) || (BTEST1(18)))
10264  strat->posInL = posInL17;
10265  if (BTEST1(11))
10266  strat->posInT = posInT11;
10267  else if (BTEST1(13))
10268  strat->posInT = posInT13;
10269  else if (BTEST1(15))
10270  strat->posInT = posInT15;
10271  else if ((BTEST1(17)))
10272  strat->posInT = posInT17;
10273  else if ((BTEST1(19)))
10274  strat->posInT = posInT19;
10275  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10276  strat->posInT = posInT1;
10277  if (rField_is_Ring(currRing))
10278  {
10279  strat->posInL = posInL11Ring;
10280  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10281  strat->posInL = posInL11Ringls;
10282  strat->posInT = posInT11;
10283  }
10284  strat->posInLDependsOnLength = FALSE;
10285  strat->posInLSba = posInLSig;
10286  //strat->posInL = posInLSig;
10287  strat->posInL = posInLF5C;
10288  /*
10289  if (rField_is_Ring(currRing))
10290  {
10291  strat->posInLSba = posInLSigRing;
10292  strat->posInL = posInL11Ring;
10293  }*/
10294  //strat->posInT = posInTSig;
10295 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:750
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6399
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:6896
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6441
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6511
#define FALSE
Definition: auxiliary.h:94
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5344
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6785
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:276
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:98
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6387
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5712
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:6697
int minim
Definition: kutil.h:354
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5333
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6199
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:5402
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5914
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:6141
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6990
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5807
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:749
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5555
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6098
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6041
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5673
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5644

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

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

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

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

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

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

§ isInPairsetB()

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

Definition at line 702 of file kutil.cc.

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

§ isInPairsetL()

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

Definition at line 681 of file kutil.cc.

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

§ kCheckSpolyCreation()

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

Definition at line 10811 of file kutil.cc.

10812 {
10813  if (strat->overflow) return FALSE;
10814  assume(L->p1 != NULL && L->p2 != NULL);
10815  // shift changes: from 0 to -1
10816  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10817  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10818  assume(strat->tailRing != currRing);
10819 
10820  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10821  return FALSE;
10822  // shift changes: extra case inserted
10823  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10824  {
10825  return TRUE;
10826  }
10827  poly p1_max = (strat->R[L->i_r1])->max_exp;
10828  poly p2_max = (strat->R[L->i_r2])->max_exp;
10829 
10830  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10831  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10832  {
10833  p_LmFree(m1, strat->tailRing);
10834  p_LmFree(m2, strat->tailRing);
10835  m1 = NULL;
10836  m2 = NULL;
10837  return FALSE;
10838  }
10839  return TRUE;
10840 }
KINLINE BOOLEAN k_GetLeadTerms(const poly p1, const poly p2, const ring p_r, poly &m1, poly &m2, const ring m_r)
Definition: kInline.h:935
#define FALSE
Definition: auxiliary.h:94
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:336
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
char overflow
Definition: kutil.h:401
polyrec * poly
Definition: hilb.h:10

§ kCheckStrongCreation()

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

Definition at line 10849 of file kutil.cc.

10850 {
10851  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10852  //assume(strat->tailRing != currRing);
10853 
10854  poly p1_max = (strat->R[atR])->max_exp;
10855  poly p2_max = (strat->R[strat->S_2_R[atS]])->max_exp;
10856 
10857  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10858  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10859  {
10860  return FALSE;
10861  }
10862  return TRUE;
10863 }
#define FALSE
Definition: auxiliary.h:94
int * S_2_R
Definition: kutil.h:338
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:346
#define TRUE
Definition: auxiliary.h:98
#define assume(x)
Definition: mod2.h:394
TObject ** R
Definition: kutil.h:336
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
polyrec * poly
Definition: hilb.h:10

§ kCreateZeroPoly()

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

Definition at line 4415 of file kutil.cc.

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

11807 {
11808  PrintS("red: ");
11809  if (strat->red==redFirst) PrintS("redFirst\n");
11810  else if (strat->red==redHoney) PrintS("redHoney\n");
11811  else if (strat->red==redEcart) PrintS("redEcart\n");
11812  else if (strat->red==redHomog) PrintS("redHomog\n");
11813  else Print("%p\n",(void*)strat->red);
11814  PrintS("posInT: ");
11815  if (strat->posInT==posInT0) PrintS("posInT0\n");
11816  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11817  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11818  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11819  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11820  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11821  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11822  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11823  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11824  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11825  #ifdef HAVE_RINGS
11826  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11827  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11828  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11829  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11830  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11831  #endif
11832 #ifdef HAVE_MORE_POS_IN_T
11833  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11834  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11835  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11836 #endif
11837  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11838  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11839  else Print("%p\n",(void*)strat->posInT);
11840  PrintS("posInL: ");
11841  if (strat->posInL==posInL0) PrintS("posInL0\n");
11842  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11843  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11844  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11845  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11846  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11847  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11848  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11849  #ifdef HAVE_RINGS
11850  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11851  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11852  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11853  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11854  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11855  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11856  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11857  #endif
11858  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11859  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11860  else Print("%p\n",(void*)strat->posInL);
11861  PrintS("enterS: ");
11862  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11863  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11864  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11865  else Print("%p\n",(void*)strat->enterS);
11866  PrintS("initEcart: ");
11867  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11868  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11869  else Print("%p\n",(void*)strat->initEcart);
11870  PrintS("initEcartPair: ");
11871  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11872  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11873  else Print("%p\n",(void*)strat->initEcartPair);
11874  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11875  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11876  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11877  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11878  PrintS("chainCrit: ");
11879  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11880  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11881  else Print("%p\n",(void*)strat->chainCrit);
11882  Print("posInLDependsOnLength=%d\n",
11883  strat->posInLDependsOnLength);
11884  PrintS(showOption());PrintLn();
11885  PrintS("LDeg: ");
11886  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11887  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11888  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11889  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11890  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11891  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11892  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11893  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11894  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11895  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11896  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11897  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11898  else Print("? (%lx)", (long)currRing->pLDeg);
11899  PrintS(" / ");
11900  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11901  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11902  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11903  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11904  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11905  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11906  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11907  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11908  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11909  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11910  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11911  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11912  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11913  PrintLn();
11914  PrintS("currRing->pFDeg: ");
11915  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11916  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11917  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11918  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11919  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11920  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11921  else Print("? (%lx)", (long)currRing->pFDeg);
11922  PrintLn();
11923  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11924  if(TEST_OPT_DEGBOUND)
11925  Print(" degBound: %d\n", Kstd1_deg);
11926 
11927  if( ecartWeights != NULL )
11928  {
11929  PrintS("ecartWeights: ");
11930  for (int i = rVar(currRing); i > 0; i--)
11931  Print("%hd ", ecartWeights[i]);
11932  PrintLn();
11934  }
11935 
11936 #ifndef SING_NDEBUG
11938 #endif
11939 }
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:6399
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11772
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:5479
BOOLEAN honey
Definition: kutil.h:374
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6896
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:5372
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:350
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6441
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6511
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:6855
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:5344
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3253
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6613
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6940
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:711
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6820
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:714
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6785
BOOLEAN posInLDependsOnLength
Definition: kutil.h:386
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6738
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5766
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:7054
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5712
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:6697
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5333
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:5402
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5914
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:5438
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
BOOLEAN Gebauer
Definition: kutil.h:375
#define assume(x)
Definition: mod2.h:394
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5868
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:6141
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6990
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:5807
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:11681
#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:5555
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5597
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3466
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:6098
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:6041
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:11735
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5673
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:5975
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5644
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9238

§ kFindDivisibleByInS()

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

Definition at line 7367 of file kutil.cc.

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

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

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

9915 {
9916  if (pos_in_l == posInL110
9917  || pos_in_l == posInL10
9918  #ifdef HAVE_RINGS
9919  || pos_in_l == posInL110Ring
9920  || pos_in_l == posInLRing
9921  #endif
9922  )
9923  return TRUE;
9924 
9925  return FALSE;
9926 }
#define FALSE
Definition: auxiliary.h:94
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6738
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6286
#define TRUE
Definition: auxiliary.h:98
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6697
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 11260 of file kutil.cc.

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

11360 {
11361  unsigned long l = 0;
11362  int i;
11363  long e;
11364 
11365  assume(strat->tailRing == currRing);
11366 
11367  for (i=0; i<= strat->Ll; i++)
11368  {
11369  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11370  }
11371  for (i=0; i<=strat->tl; i++)
11372  {
11373  // Hmm ... this we could do in one Step
11374  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11375  }
11376  if (rField_is_Ring(currRing))
11377  {
11378  l *= 2;
11379  }
11380  e = p_GetMaxExp(l, currRing);
11381  if (e <= 1) e = 2;
11382 
11383  kStratChangeTailRing(strat, NULL, NULL, e);
11384 }
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
Definition: p_polys.cc:1174
int Ll
Definition: kutil.h:347
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:346
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11260
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 7924 of file kutil.cc.

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

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

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

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

§ nextZeroSimplexExponent()

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

Definition at line 4349 of file kutil.cc.

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

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

2204 {
2205  int i = rVar(r);
2206  loop
2207  {
2208  if ((p_GetExp(p1, i, r) > 0) && (p_GetExp(p2, i, r) > 0))
2209  return FALSE;
2210  i--;
2211  if (i == 0)
2212  return TRUE;
2213  }
2214 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:583
#define TRUE
Definition: auxiliary.h:98
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int i
Definition: cfEzgcd.cc:123
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

§ pCopyL2p()

poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 11973 of file kutil.cc.

11974 {
11975  /* restores a poly in currRing from LObject */
11976  LObject h = H;
11977  h.Copy();
11978  poly p;
11979  if (h.p == NULL)
11980  {
11981  if (h.t_p != NULL)
11982  {
11983  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11984  return(p);
11985  }
11986  else
11987  {
11988  /* h.tp == NULL -> the object is NULL */
11989  return(NULL);
11990  }
11991  }
11992  /* we're here if h.p != NULL */
11993  if (h.t_p == NULL)
11994  {
11995  /* then h.p is the whole poly in currRing */
11996  p = h.p;
11997  return(p);
11998  }
11999  /* we're here if h.p != NULL and h.t_p != NULL */
12000  // clean h.p, get poly from t_p
12001  pNext(h.p)=NULL;
12002  pLmDelete(&h.p);
12003  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
12004  /* dest. ring: */ currRing);
12005  // no need to clean h: we re-used the polys
12006  return(p);
12007 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ pDivComp()

static int pDivComp ( poly  p,
poly  q 
)
inlinestatic

Definition at line 187 of file kutil.cc.

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

§ pDivCompRing()

static int pDivCompRing ( poly  p,
poly  q 
)
inlinestatic

Definition at line 149 of file kutil.cc.

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

§ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 11942 of file kutil.cc.

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

11957 {
11958  /* assume: p has LM in curring and TAIL in tailring */
11959  /* convert it to complete currRing */
11960 
11961  /* check that LM is in currRing */
11963 
11964  if (pNext(p)!=NULL)
11965  {
11966  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11967  }
11968  return(p);
11969 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:339
#define pNext(p)
Definition: monomials.h:43

§ posInIdealMonFirst()

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

Definition at line 5289 of file kutil.cc.

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

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

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

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

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

6740 {
6741  if (length<0) return 0;
6742 
6743  int o = p->GetpFDeg();
6744  int op = set[length].GetpFDeg();
6745 
6746  if ((op > o)
6747  || ((op == o) && (set[length].length >p->length))
6748  || ((op == o) && (set[length].length <= p->length)
6749  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6750  return length+1;
6751  int i;
6752  int an = 0;
6753  int en= length;
6754  loop
6755  {
6756  if (an >= en-1)
6757  {
6758  op = set[an].GetpFDeg();
6759  if ((op > o)
6760  || ((op == o) && (set[an].length >p->length))
6761  || ((op == o) && (set[an].length <=p->length)
6762  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6763  return en;
6764  return an;
6765  }
6766  i=(an+en) / 2;
6767  op = set[i].GetpFDeg();
6768  if ((op > o)
6769  || ((op == o) && (set[i].length > p->length))
6770  || ((op == o) && (set[i].length <= p->length)
6771  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6772  an=i;
6773  else
6774  en=i;
6775  }
6776 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInL11Ring()

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

Definition at line 6441 of file kutil.cc.

6443 {
6444  if (length<0) return 0;
6445 
6446  int o = p->GetpFDeg();
6447  int op = set[length].GetpFDeg();
6448 
6449  if ((op > o)
6450  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6451  return length+1;
6452  int i;
6453  int an = 0;
6454  int en= length;
6455  loop
6456  {
6457  if (an >= en-1)
6458  {
6459  op = set[an].GetpFDeg();
6460  if ((op > o)
6461  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6462  return en;
6463  return an;
6464  }
6465  i=(an+en) / 2;
6466  op = set[i].GetpFDeg();
6467  if ((op > o)
6468  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6469  an=i;
6470  else
6471  en=i;
6472  }
6473 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInL11Ringls()

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

Definition at line 6511 of file kutil.cc.

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

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

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

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

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

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

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

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

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

§ posInLF5CRing()

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

Definition at line 6475 of file kutil.cc.

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

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

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

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

6225 {
6226  assume(currRing->OrdSgn == 1 && rField_is_Ring(currRing));
6227  if (length<0) return 0;
6228  if (pLtCmp(set[length].sig,p->sig)== 1)
6229  return length+1;
6230 
6231  int an,en,i;
6232  an = 0;
6233  en = length+1;
6234  int cmp;
6235  loop
6236  {
6237  if (an >= en-1)
6238  {
6239  if(an == en)
6240  return en;
6241  cmp = pLtCmp(set[an].sig,p->sig);
6242  if (cmp == 1)
6243  return en;
6244  if (cmp == -1)
6245  return an;
6246  if (cmp == 0)
6247  {
6248  if (set[an].FDeg > p->FDeg)
6249  return en;
6250  if (set[an].FDeg < p->FDeg)
6251  return an;
6252  if (set[an].FDeg == p->FDeg)
6253  {
6254  cmp = pLtCmp(set[an].p,p->p);
6255  if(cmp == 1)
6256  return en;
6257  else
6258  return an;
6259  }
6260  }
6261  }
6262  i=(an+en) / 2;
6263  cmp = pLtCmp(set[i].sig,p->sig);
6264  if (cmp == 1)
6265  an = i;
6266  if (cmp == -1)
6267  en = i;
6268  if (cmp == 0)
6269  {
6270  if (set[i].FDeg > p->FDeg)
6271  an = i;
6272  if (set[i].FDeg < p->FDeg)
6273  en = i;
6274  if (set[i].FDeg == p->FDeg)
6275  {
6276  cmp = pLtCmp(set[i].p,p->p);
6277  if(cmp == 1)
6278  an = i;
6279  else
6280  en = i;
6281  }
6282  }
6283  }
6284 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
int i
Definition: cfEzgcd.cc:123
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477

§ posInLSpecial()

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

Definition at line 6098 of file kutil.cc.

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

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

§ posInSMonFirst()

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

Definition at line 5212 of file kutil.cc.

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

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

5334 {
5335  return (length+1);
5336 }

§ posInT1()

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

Definition at line 5344 of file kutil.cc.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

11041 {
11042  if(!nCoeff_is_Ring_Z(currRing->cf))
11043  return;
11044  poly pH = h->GetP();
11045  poly p,pp;
11046  p = pH;
11047  bool deleted = FALSE, ok = FALSE;
11048  for(int i = 0; i<=strat->sl; i++)
11049  {
11050  p = pH;
11051  if(pNext(strat->S[i]) == NULL)
11052  {
11053  //pWrite(p);
11054  //pWrite(strat->S[i]);
11055  while(ok == FALSE && p != NULL)
11056  {
11057  if(pLmDivisibleBy(strat->S[i], p))
11058  {
11059  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11060  p_SetCoeff(p,dummy,currRing);
11061  }
11062  if(nIsZero(p->coef))
11063  {
11064  pLmDelete(&p);
11065  h->p = p;
11066  deleted = TRUE;
11067  }
11068  else
11069  {
11070  ok = TRUE;
11071  }
11072  }
11073  pp = pNext(p);
11074  while(pp != NULL)
11075  {
11076  if(pLmDivisibleBy(strat->S[i], pp))
11077  {
11078  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11079  p_SetCoeff(pp,dummy,currRing);
11080  if(nIsZero(pp->coef))
11081  {
11082  pLmDelete(&pNext(p));
11083  pp = pNext(p);
11084  deleted = TRUE;
11085  }
11086  else
11087  {
11088  p = pp;
11089  pp = pNext(p);
11090  }
11091  }
11092  else
11093  {
11094  p = pp;
11095  pp = pNext(p);
11096  }
11097  }
11098  }
11099  }
11100  h->SetLmCurrRing();
11101  if(deleted)
11102  strat->initEcart(h);
11103 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:632
#define FALSE
Definition: auxiliary.h:94
return P p
Definition: myNF.cc:203
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:98
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
poly pp
Definition: myNF.cc:296
void(* initEcart)(TObject *L)
Definition: kutil.h:274
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:300
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:344
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 11105 of file kutil.cc.

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

§ preIntegerCheck()

poly preIntegerCheck ( const ideal  Forig,
const ideal  Q 
)

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

Definition at line 10872 of file kutil.cc.

10873 {
10875  if(!nCoeff_is_Ring_Z(currRing->cf))
10876  return NULL;
10877  ideal F = idCopy(Forig);
10878  idSkipZeroes(F);
10879  poly pmon;
10880  ring origR = currRing;
10881  ideal monred = idInit(1,1);
10882  for(int i=0; i<idElem(F); i++)
10883  {
10884  if(pNext(F->m[i]) == NULL)
10885  idInsertPoly(monred, pCopy(F->m[i]));
10886  }
10887  int posconst = idPosConstant(F);
10888  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10889  {
10890  idDelete(&F);
10891  idDelete(&monred);
10892  return NULL;
10893  }
10894  int idelemQ = 0;
10895  if(Q!=NULL)
10896  {
10897  idelemQ = IDELEMS(Q);
10898  for(int i=0; i<idelemQ; i++)
10899  {
10900  if(pNext(Q->m[i]) == NULL)
10901  idInsertPoly(monred, pCopy(Q->m[i]));
10902  }
10903  idSkipZeroes(monred);
10904  posconst = idPosConstant(monred);
10905  //the constant, if found, will be from Q
10906  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10907  {
10908  pmon = pCopy(monred->m[posconst]);
10909  idDelete(&F);
10910  idDelete(&monred);
10911  return pmon;
10912  }
10913  }
10914  ring QQ_ring = rCopy0(currRing,FALSE);
10915  nKillChar(QQ_ring->cf);
10916  QQ_ring->cf = nInitChar(n_Q, NULL);
10917  rComplete(QQ_ring,1);
10918  QQ_ring = rAssure_c_dp(QQ_ring);
10919  rChangeCurrRing(QQ_ring);
10920  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10921  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10922  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10923  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10924  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10925  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10926  ideal one = kStd(II, NULL, isNotHomog, NULL);
10927  idSkipZeroes(one);
10928  if(idIsConstant(one))
10929  {
10930  //one should be <1>
10931  for(int i = IDELEMS(II)-1; i>=0; i--)
10932  if(II->m[i] != NULL)
10933  II->m[i+1] = II->m[i];
10934  II->m[0] = pOne();
10935  ideal syz = idSyzygies(II, isNotHomog, NULL);
10936  poly integer = NULL;
10937  for(int i = IDELEMS(syz)-1;i>=0; i--)
10938  {
10939  if(pGetComp(syz->m[i]) == 1)
10940  {
10941  pSetComp(syz->m[i],0);
10942  if(pIsConstant(pHead(syz->m[i])))
10943  {
10944  integer = pHead(syz->m[i]);
10945  break;
10946  }
10947  }
10948  }
10949  rChangeCurrRing(origR);
10950  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10951  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10952  idDelete(&monred);
10953  idDelete(&F);
10954  id_Delete(&II,QQ_ring);
10955  id_Delete(&one,QQ_ring);
10956  id_Delete(&syz,QQ_ring);
10957  p_Delete(&integer,QQ_ring);
10958  rDelete(QQ_ring);
10959  return pmon;
10960  }
10961  else
10962  {
10963  if(idIs0(monred))
10964  {
10965  poly mindegmon = NULL;
10966  for(int i = 0; i<IDELEMS(one); i++)
10967  {
10968  if(pNext(one->m[i]) == NULL)
10969  {
10970  if(mindegmon == NULL)
10971  mindegmon = pCopy(one->m[i]);
10972  else
10973  {
10974  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10975  mindegmon = pCopy(one->m[i]);
10976  }
10977  }
10978  }
10979  if(mindegmon != NULL)
10980  {
10981  for(int i = IDELEMS(II)-1; i>=0; i--)
10982  if(II->m[i] != NULL)
10983  II->m[i+1] = II->m[i];
10984  II->m[0] = pCopy(mindegmon);
10985  ideal syz = idSyzygies(II, isNotHomog, NULL);
10986  bool found = FALSE;
10987  for(int i = IDELEMS(syz)-1;i>=0; i--)
10988  {
10989  if(pGetComp(syz->m[i]) == 1)
10990  {
10991  pSetComp(syz->m[i],0);
10992  if(pIsConstant(pHead(syz->m[i])))
10993  {
10994  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10995  found = TRUE;
10996  break;
10997  }
10998  }
10999  }
11000  id_Delete(&syz,QQ_ring);
11001  if (found == FALSE)
11002  {
11003  rChangeCurrRing(origR);
11004  idDelete(&monred);
11005  idDelete(&F);
11006  id_Delete(&II,QQ_ring);
11007  id_Delete(&one,QQ_ring);
11008  rDelete(QQ_ring);
11009  return NULL;
11010  }
11011  rChangeCurrRing(origR);
11012  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
11013  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
11014  idDelete(&monred);
11015  idDelete(&F);
11016  id_Delete(&II,QQ_ring);
11017  id_Delete(&one,QQ_ring);
11018  id_Delete(&syz,QQ_ring);
11019  rDelete(QQ_ring);
11020  return pmon;
11021  }
11022  }
11023  }
11024  rChangeCurrRing(origR);
11025  idDelete(&monred);
11026  idDelete(&F);
11027  id_Delete(&II,QQ_ring);
11028  id_Delete(&one,QQ_ring);
11029  rDelete(QQ_ring);
11030  return NULL;
11031 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:37
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
#define FALSE
Definition: auxiliary.h:94
rational (GMP) numbers
Definition: coeffs.h:31
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_Z(const coeffs r)
Definition: coeffs.h:759
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define TRUE
Definition: auxiliary.h:98
ideal kStd(ideal F, ideal Q, tHomog h, intvec **w, intvec *hilb, int syzComp, int newIdeal, intvec *vw, s_poly_proc_t sp)
Definition: kstd1.cc:2231
#define Q
Definition: sirandom.c:25
ring rAssure_c_dp(const ring r)
Definition: ring.cc: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:394
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:297
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:725
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:60
void rChangeCurrRing(ring r)
Definition: polys.cc:12
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc: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 8940 of file kutil.cc.

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

8836 {
8837  int j = 0;
8838  unsigned long not_sev = ~ pGetShortExpVector(h);
8839 
8840  while (j <= maxIndex)
8841  {
8842  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
8843  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
8844  else j++;
8845  }
8846  return h;
8847 }
int j
Definition: myNF.cc:70
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pLmShortDivisibleBy(a, sev_a, b, not_sev_b)
Divisibility tests based on Short Exponent vectors sev_a == pGetShortExpVector(a) not_sev_b == ~ pGet...
Definition: polys.h:146
polyset S
Definition: kutil.h:300
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1063
unsigned long * sevS
Definition: kutil.h:316
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63

§ redEcart()

int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 172 of file kstd1.cc.

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

§ redFirst()

int redFirst ( LObject h,
kStrategy  strat 
)

Definition at line 601 of file kstd1.cc.

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

§ redMora()

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

Definition at line 8964 of file kutil.cc.

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

§ redtail() [1/2]

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

Definition at line 7505 of file kutil.cc.

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

§ redtail() [2/2]

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

Definition at line 7575 of file kutil.cc.

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

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

7808 {
7809  strat->redTailChange=FALSE;
7810  if (strat->noTailReduction) return L->GetLmCurrRing();
7811  poly h, p;
7812  p = h = L->GetLmTailRing();
7813  if ((h==NULL) || (pNext(h)==NULL))
7814  return L->GetLmCurrRing();
7815 
7816  TObject* With;
7817  // placeholder in case strat->tl < 0
7818  TObject With_s(strat->tailRing);
7819 
7820  LObject Ln(pNext(h), strat->tailRing);
7821  Ln.pLength = L->GetpLength() - 1;
7822 
7823  pNext(h) = NULL;
7824  if (L->p != NULL) pNext(L->p) = NULL;
7825  L->pLength = 1;
7826 
7827  Ln.PrepareRed(strat->use_buckets);
7828 
7829  int cnt=REDTAIL_CANONICALIZE;
7830  while(!Ln.IsNull())
7831  {
7832  loop
7833  {
7834  Ln.SetShortExpVector();
7835  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7836  if (With == NULL) break;
7837  cnt--;
7838  if (cnt==0)
7839  {
7841  /*poly tmp=*/Ln.CanonicalizeP();
7842  }
7843  // we are in Z, do not call pNorm
7844  strat->redTailChange=TRUE;
7845  // test divisibility of coefs:
7846  poly p_Ln=Ln.GetLmCurrRing();
7847  poly p_With=With->GetLmCurrRing();
7848  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7849  if (!nIsZero(z))
7850  {
7851  // subtract z*Ln, add z.Ln to L
7852  poly m=pHead(p_Ln);
7853  pSetCoeff(m,z);
7854  poly mm=pHead(m);
7855  pNext(h) = m;
7856  pIter(h);
7857  L->pLength++;
7858  mm=pNeg(mm);
7859  if (Ln.bucket!=NULL)
7860  {
7861  int dummy=1;
7862  kBucket_Add_q(Ln.bucket,mm,&dummy);
7863  }
7864  else
7865  {
7866  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7867  Ln.GetP();
7868  if (Ln.p!=NULL)
7869  {
7870  Ln.p=pAdd(Ln.p,mm);
7871  if (Ln.t_p!=NULL)
7872  {
7873  pNext(Ln.t_p)=NULL;
7874  p_LmDelete(Ln.t_p,strat->tailRing);
7875  }
7876  }
7877  }
7878  }
7879  else
7880  nDelete(&z);
7881 
7882  if (ksReducePolyTail(L, With, &Ln))
7883  {
7884  // reducing the tail would violate the exp bound
7885  // set a flag and hope for a retry (in bba)
7886  strat->completeReduce_retry=TRUE;
7887  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7888  do
7889  {
7890  pNext(h) = Ln.LmExtractAndIter();
7891  pIter(h);
7892  L->pLength++;
7893  } while (!Ln.IsNull());
7894  goto all_done;
7895  }
7896  if (Ln.IsNull()) goto all_done;
7897  With_s.Init(currRing);
7898  }
7899  pNext(h) = Ln.LmExtractAndIter();
7900  pIter(h);
7901  pNormalize(h);
7902  L->pLength++;
7903  }
7904 
7905  all_done:
7906  Ln.Delete();
7907  if (L->p != NULL) pNext(L->p) = pNext(p);
7908 
7909  if (strat->redTailChange)
7910  {
7911  L->length = 0;
7912  }
7913 
7914  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7915  //L->Normalize(); // HANNES: should have a test
7916  kTest_L(L);
7917  return L->GetLmCurrRing();
7918 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) always: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a n_IntMod(a,b,r) >=0
Definition: coeffs.h:632
#define pAdd(p, q)
Definition: polys.h:186
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define pNeg(p)
Definition: polys.h:181
#define TRUE
Definition: auxiliary.h:98
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:400
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:657
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
#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 7689 of file kutil.cc.

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

12754 {
12755  /* for the shift case need to run it with withT = TRUE */
12756  strat->redTailChange=FALSE;
12757  if (strat->noTailReduction) return L->GetLmCurrRing();
12758  poly h, p;
12759  p = h = L->GetLmTailRing();
12760  if ((h==NULL) || (pNext(h)==NULL))
12761  return L->GetLmCurrRing();
12762 
12763  TObject* With;
12764  // placeholder in case strat->tl < 0
12765  TObject With_s(strat->tailRing);
12766 
12767  LObject Ln(pNext(h), strat->tailRing);
12768  Ln.pLength = L->GetpLength() - 1;
12769 
12770  pNext(h) = NULL;
12771  if (L->p != NULL) pNext(L->p) = NULL;
12772  L->pLength = 1;
12773 
12774  Ln.PrepareRed(strat->use_buckets);
12775 
12776  while(!Ln.IsNull())
12777  {
12778  loop
12779  {
12780  Ln.SetShortExpVector();
12781  if (withT)
12782  {
12783  int j;
12784  j = kFindDivisibleByInT(strat, &Ln);
12785  if (j < 0) break;
12786  With = &(strat->T[j]);
12787  }
12788  else
12789  {
12790  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12791  if (With == NULL) break;
12792  }
12793  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12794  {
12795  With->pNorm();
12796  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12797  }
12798  strat->redTailChange=TRUE;
12799  if (ksReducePolyTail(L, With, &Ln))
12800  {
12801  // reducing the tail would violate the exp bound
12802  // set a flag and hope for a retry (in bba)
12803  strat->completeReduce_retry=TRUE;
12804  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12805  do
12806  {
12807  pNext(h) = Ln.LmExtractAndIter();
12808  pIter(h);
12809  L->pLength++;
12810  } while (!Ln.IsNull());
12811  goto all_done;
12812  }
12813  if (Ln.IsNull()) goto all_done;
12814  if (! withT) With_s.Init(currRing);
12815  }
12816  pNext(h) = Ln.LmExtractAndIter();
12817  pIter(h);
12818  L->pLength++;
12819  }
12820 
12821  all_done:
12822  Ln.Delete();
12823  if (L->p != NULL) pNext(L->p) = pNext(p);
12824 
12825  if (strat->redTailChange)
12826  {
12827  L->length = 0;
12828  }
12829  L->Normalize(); // HANNES: should have a test
12830  kTest_L(L);
12831  return L->GetLmCurrRing();
12832 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1027
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:94
BOOLEAN noTailReduction
Definition: kutil.h:375
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1026
#define TRUE
Definition: auxiliary.h:98
#define nIsOne(n)
Definition: numbers.h:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
char completeReduce_retry
Definition: kutil.h:400
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define kTest_L(T)
Definition: kutil.h:657
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:7367
#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 5058 of file kutil.cc.

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

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

§ sbaRing()

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

Definition at line 11386 of file kutil.cc.

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

4899 {
4901  // enter also zero divisor * poly, if this is non zero and of smaller degree
4902  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4903  initenterpairs(h, k, ecart, 0, strat, atR);
4904  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4905  clearSbatch(h, k, pos, strat);
4906 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4872
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3830
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4610
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:4659
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:394
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static Poly * h
Definition: janet.cc:978

§ superenterpairsSig()

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

Definition at line 4908 of file kutil.cc.

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

§ syzCriterion()

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

Definition at line 7121 of file kutil.cc.

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

§ syzCriterionInc()

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

Definition at line 7159 of file kutil.cc.

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

§ twoPow()

long twoPow ( long  arg)

Definition at line 4223 of file kutil.cc.

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

§ updateResult()

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

Definition at line 10410 of file kutil.cc.

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

§ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 9009 of file kutil.cc.

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

§ updateSShift()

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

Definition at line 12066 of file kutil.cc.

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