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
 

Functions

static poly redMora (poly h, int maxIndex, kStrategy strat)
 
static poly redBba (poly h, int maxIndex, kStrategy strat)
 
static int pDivCompRing (poly p, poly q)
 
static int pDivComp (poly p, poly q)
 
void deleteHC (LObject *L, kStrategy strat, BOOLEAN fromNext)
 
void deleteHC (poly *p, int *e, int *l, kStrategy strat)
 
void cancelunit (LObject *L, BOOLEAN inNF)
 
void HEckeTest (poly pp, kStrategy strat)
 
static intset initec (const int maxnr)
 
static unsigned long * initsevS (const int maxnr)
 
static int * initS_2_R (const int maxnr)
 
static void enlargeT (TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
 
void cleanT (kStrategy strat)
 
void cleanTSbaRing (kStrategy strat)
 
static void enlargeL (LSet *L, int *length, const int incr)
 
void initPairtest (kStrategy strat)
 
BOOLEAN isInPairsetL (int length, poly p1, poly p2, int *k, kStrategy strat)
 
BOOLEAN isInPairsetB (poly q, int *k, kStrategy strat)
 
int kFindInT (poly p, TSet T, int tlength)
 returns index of p in TSet, or -1 if not found More...
 
int kFindInT (poly p, kStrategy strat)
 
void deleteInS (int i, kStrategy strat)
 
void deleteInSSba (int i, kStrategy strat)
 
void deleteInL (LSet set, int *length, int j, kStrategy strat)
 
void enterL (LSet *set, int *length, int *LSetmax, LObject p, int at)
 
void initEcartNormal (TObject *h)
 
void initEcartBBA (TObject *h)
 
void initEcartPairBba (LObject *Lp, poly, poly, int, int)
 
void initEcartPairMora (LObject *Lp, poly, poly, int ecartF, int ecartG)
 
static BOOLEAN sugarDivisibleBy (int ecart1, int ecart2)
 
void enterOnePairRing (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
BOOLEAN enterOneStrongPoly (int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
 
BOOLEAN sbaCheckGcdPair (LObject *h, kStrategy strat)
 
BOOLEAN enterOneStrongPolySig (int i, poly p, poly sig, int, int, kStrategy strat, int atR)
 
void enterOnePairNormal (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
static BOOLEAN p_HasNotCF_Lift (poly p1, poly p2, const ring r)
 p_HasNotCF for the IDLIFT case: ignore component More...
 
void enterOnePairLift (int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSig (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSigRing (int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterOnePairSpecial (int i, poly p, int ecart, kStrategy strat, int atR=-1)
 
void kMergeBintoL (kStrategy strat)
 
void kMergeBintoLSba (kStrategy strat)
 
void chainCritNormal (poly p, int ecart, kStrategy strat)
 
void chainCritOpt_1 (poly, int, kStrategy strat)
 
void chainCritSig (poly p, int, kStrategy strat)
 
void chainCritPart (poly p, int ecart, kStrategy strat)
 
void initenterpairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterpairsSigRing (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void chainCritRing (poly p, int, kStrategy strat)
 
long ind2 (long arg)
 
long ind_fact_2 (long arg)
 
long twoPow (long arg)
 
void enterOneZeroPairRing (poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
 
int nextZeroSimplexExponent (long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
 
poly kCreateZeroPoly (long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
 
void initenterzeropairsRing (poly p, int ecart, kStrategy strat, int atR)
 
ideal createG0 ()
 
void initenterstrongPairs (poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void initenterstrongPairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
 
void enterExtendedSpoly (poly h, kStrategy strat)
 
void enterExtendedSpolySig (poly h, poly hSig, kStrategy strat)
 
void clearSbatch (poly h, int k, int pos, kStrategy strat)
 
void superenterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void superenterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairs (poly h, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSig (poly h, poly hSig, int hFrom, int k, int ecart, int pos, kStrategy strat, int atR)
 
void enterpairsSpecial (poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
 
void reorderS (int *suc, kStrategy strat)
 
int posInS (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInSMonFirst (const kStrategy strat, const int length, const poly p, const int ecart_p)
 
int posInIdealMonFirst (const ideal F, const poly p, int start, int end)
 
int posInT0 (const TSet, const int length, LObject &)
 
int posInT1 (const TSet set, const int length, LObject &p)
 
int posInT2 (const TSet set, const int length, LObject &p)
 
int posInT11 (const TSet set, const int length, LObject &p)
 
int posInT11Ring (const TSet set, const int length, LObject &p)
 
int posInTrg0 (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT110Ring (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT15Ring (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17Ring (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT17_cRing (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInLSpecial (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSig (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSigRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLRing (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInSyz (const kStrategy strat, poly sig)
 
int posInLF5C (const LSet, const int, LObject *, const kStrategy strat)
 
int posInL11 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL11Ring (const LSet set, const int length, LObject *p, const kStrategy strat)
 
int posInLF5CRing (const LSet set, int start, const int length, LObject *p, const kStrategy strat)
 
int posInL11Ringls (const LSet set, const int length, LObject *p, const kStrategy strat)
 
int getIndexRng (long coeff)
 
int posInLrg0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL110Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL13 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17Ring (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_c (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_cRing (const LSet set, const int length, LObject *p, const kStrategy)
 
BOOLEAN syzCriterion (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN syzCriterionInc (poly sig, unsigned long not_sevSig, kStrategy strat)
 
BOOLEAN faugereRewCriterion (poly sig, unsigned long not_sevSig, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterion (poly, unsigned long, poly, kStrategy strat, int start=0)
 
BOOLEAN arriRewCriterionPre (poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int)
 
TObjectkFindDivisibleByInS (kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
 
poly redtail (LObject *L, int pos, kStrategy strat)
 
poly redtail (poly p, int pos, kStrategy strat)
 
poly redtailBba (LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
 
poly 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

#define REDTAIL_CANONICALIZE   100

Function Documentation

§ arriRewCriterion()

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

Definition at line 7275 of file kutil.cc.

7276 {
7277  #ifdef ADIDEBUG
7278  printf("\narriRewCrit\n");
7279  #endif
7281  return FALSE;
7282  poly p1 = pOne();
7283  poly p2 = pOne();
7284  for (int ii=strat->sl; ii>start; ii--)
7285  {
7286  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
7287  {
7288  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
7289  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
7290  if (!(pLmCmp(p1,p2) == 1))
7291  {
7292  #ifdef ADIDEBUG
7293  printf("\narriRewCrit deleted: sig, P.sig\n");
7294  #endif
7295  pDelete(&p1);
7296  pDelete(&p2);
7297  return TRUE;
7298  }
7299  }
7300  }
7301  pDelete(&p1);
7302  pDelete(&p2);
7303  return FALSE;
7304 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:97
#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:101
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:298
#define pOne()
Definition: polys.h:298
polyset S
Definition: kutil.h:302
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:346
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10

§ arriRewCriterionPre()

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

Definition at line 7306 of file kutil.cc.

7307 {
7308  #ifdef ADIDEBUG
7309  printf("\narriRewCritPre\n");
7310  #endif
7311  //Over Rings, there are still some changes to do: considering coeffs
7313  return FALSE;
7314  int found = -1;
7315  for (int i=strat->Bl; i>-1; i--) {
7316  if (pLmEqual(strat->B[i].sig,sig))
7317  {
7318  found = i;
7319  break;
7320  }
7321  }
7322  if (found != -1)
7323  {
7324  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1)
7325  {
7326  deleteInL(strat->B,&strat->Bl,found,strat);
7327  #ifdef ADIDEBUG
7328  printf("\nDelete!\n");
7329  #endif
7330  }
7331  else
7332  {
7333  #ifdef ADIDEBUG
7334  printf("\nDelete this one!\n");
7335  #endif
7336  return TRUE;
7337  }
7338  }
7339  poly p1 = pOne();
7340  poly p2 = pOne();
7341  for (int ii=strat->sl; ii>-1; ii--)
7342  {
7343  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
7344  {
7345  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
7346  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
7347  if (!(pLmCmp(p1,p2) == 1))
7348  {
7349  pDelete(&p1);
7350  pDelete(&p2);
7351  #ifdef ADIDEBUG
7352  printf("\nDelete this one!\n");
7353  #endif
7354  return TRUE;
7355  }
7356  }
7357  }
7358  pDelete(&p1);
7359  pDelete(&p2);
7360  return FALSE;
7361 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:97
#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:350
#define TRUE
Definition: auxiliary.h:101
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:298
polyset S
Definition: kutil.h:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
LSet B
Definition: kutil.h:324
#define pDelete(p_ptr)
Definition: polys.h:169
int sl
Definition: kutil.h:346
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 = 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 = NULL;
451 
452  if (L->t_p != NULL && pNext(L->t_p) != NULL)
453  p_Delete(&pNext(L->t_p),r);
454  if (L->p != NULL && pNext(L->p) != NULL)
455  pNext(L->p) = NULL;
456 
457  return;
458  }
459  i = 0;
460  loop
461  {
462  i++;
463  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
464  if (i == r->N) break; // does divide, try next monom
465  }
466  //wrp(p); PrintS(" divide ");wrp(h); PrintLn();
467  pIter(h);
468  }
469  }
470 }
return
Definition: syzextra.cc:280
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
void pWrite(poly p)
Definition: polys.h:291
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
CanonicalForm lc(const CanonicalForm &f)
#define pIter(p)
Definition: monomials.h:44
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
const ring r
Definition: syzextra.cc:208
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
#define TEST_OPT_CANCELUNIT
Definition: options.h:122
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
#define pSetCoeff0(p, n)
Definition: monomials.h:67
polyrec * poly
Definition: hilb.h:10
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1208

§ cancelunit1()

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

Definition at line 8738 of file kutil.cc.

8739 {
8740  int k;
8741  poly r,h,h1,q;
8742 
8743  if (!pIsVector((*p).p) && ((*p).ecart != 0))
8744  {
8745 #ifdef HAVE_RINGS
8746  // Leading coef have to be a unit: no
8747  // example 2x+4x2 should be simplified to 2x*(1+2x)
8748  // and 2 is not a unit in Z
8749  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
8750 #endif
8751  k = 0;
8752  h1 = r = pCopy((*p).p);
8753  h =pNext(r);
8754  loop
8755  {
8756  if (h==NULL)
8757  {
8758  pDelete(&r);
8759  pDelete(&(pNext((*p).p)));
8760  (*p).ecart = 0;
8761  (*p).length = 1;
8762  (*p).pLength = 1;
8763  (*suc)=0;
8764  return;
8765  }
8766  if (!pDivisibleBy(r,h))
8767  {
8768  q=redBba1(h,index ,strat);
8769  if (q != h)
8770  {
8771  k++;
8772  pDelete(&h);
8773  pNext(h1) = h = q;
8774  }
8775  else
8776  {
8777  pDelete(&r);
8778  return;
8779  }
8780  }
8781  else
8782  {
8783  h1 = h;
8784  pIter(h);
8785  }
8786  if (k > 10)
8787  {
8788  pDelete(&r);
8789  return;
8790  }
8791  }
8792  }
8793 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8721
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:592
#define NULL
Definition: omList.c:10
#define pDivisibleBy(a, b)
returns TRUE, if leading monom of a divides leading monom of b i.e., if there exists a expvector c > ...
Definition: polys.h:138
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:168
#define pIsVector(p)
Definition: polys.h:233

§ chainCritNormal()

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

Definition at line 3250 of file kutil.cc.

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

§ chainCritOpt_1()

void chainCritOpt_1 ( poly  ,
int  ,
kStrategy  strat 
)

Definition at line 3463 of file kutil.cc.

3464 {
3465  if (strat->pairtest!=NULL)
3466  {
3467  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
3468  strat->pairtest=NULL;
3469  }
3470  /*
3471  *the elements of B enter L
3472  */
3473  kMergeBintoL(strat);
3474 }
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:331
#define NULL
Definition: omList.c:10
int sl
Definition: kutil.h:346
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:3204
int BOOLEAN
Definition: auxiliary.h:88

§ chainCritPart()

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

Definition at line 3538 of file kutil.cc.

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

§ chainCritRing()

void chainCritRing ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 4024 of file kutil.cc.

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

§ chainCritSig()

void chainCritSig ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 3479 of file kutil.cc.

3480 {
3481  int i,j,l;
3482  kMergeBintoLSba(strat);
3483  j = strat->Ll;
3484  loop /*cannot be changed into a for !!! */
3485  {
3486  if (j <= 0)
3487  {
3488  /*now L[0] cannot be canceled any more and the tail can be removed*/
3489  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
3490  break;
3491  }
3492  if (strat->L[j].p2 == p)
3493  {
3494  i = j-1;
3495  loop
3496  {
3497  if (i < 0) break;
3498  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
3499  {
3500  /*L[i] could be canceled but we search for a better one to cancel*/
3501  strat->c3++;
3502  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
3503  && (pNext(strat->L[l].p) == strat->tail)
3504  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3505  && pDivisibleBy(p,strat->L[l].lcm))
3506  {
3507  /*
3508  *"NOT equal(...)" because in case of "equal" the element L[l]
3509  *is "older" and has to be from theoretical point of view behind
3510  *L[i], but we do not want to reorder L
3511  */
3512  strat->L[i].p2 = strat->tail;
3513  /*
3514  *L[l] will be canceled, we cannot cancel L[i] later on,
3515  *so we mark it with "tail"
3516  */
3517  deleteInL(strat->L,&strat->Ll,l,strat);
3518  i--;
3519  }
3520  else
3521  {
3522  deleteInL(strat->L,&strat->Ll,i,strat);
3523  }
3524  j--;
3525  }
3526  i--;
3527  }
3528  }
3529  else if (strat->L[j].p2 == strat->tail)
3530  {
3531  /*now L[j] cannot be canceled any more and the tail can be removed*/
3532  strat->L[j].p2 = p;
3533  }
3534  j--;
3535  }
3536 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:345
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:332
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:3227
LSet L
Definition: kutil.h:323
#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 != NULL)
567  {
568  p_LmFree(strat->T[j].max, 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:348
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
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:341
#define pDelete(p_ptr)
Definition: polys.h:169
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
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 != NULL)
618  {
619  p_LmFree(strat->T[j].max, 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:348
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
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:341
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10

§ clearSbatch()

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

Definition at line 4873 of file kutil.cc.

4874 {
4875  int j = pos;
4876  if ( (!strat->fromT)
4877  && ((strat->syzComp==0)
4878  ||(pGetComp(h)<=strat->syzComp)
4879  ))
4880  {
4881  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
4882  unsigned long h_sev = pGetShortExpVector(h);
4883  loop
4884  {
4885  if (j > k) break;
4886  clearS(h,h_sev, &j,&k,strat);
4887  j++;
4888  }
4889  // Print("end clearS sl=%d\n",strat->sl);
4890  }
4891 }
int syzComp
Definition: kutil.h:352
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
BOOLEAN fromT
Definition: kutil.h:378
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:1141
static Poly * h
Definition: janet.cc:978

§ completeReduce()

void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 10508 of file kutil.cc.

10509 {
10510  int i;
10511  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
10512  LObject L;
10513 
10514 #ifdef KDEBUG
10515  // need to set this: during tailreductions of T[i], T[i].max is out of
10516  // sync
10517  sloppy_max = TRUE;
10518 #endif
10519 
10520  strat->noTailReduction = FALSE;
10521  //if(rHasMixedOrdering(currRing)) strat->noTailReduction = TRUE;
10522  if (TEST_OPT_PROT)
10523  {
10524  PrintLn();
10525 // if (timerv) writeTime("standard base computed:");
10526  }
10527  if (TEST_OPT_PROT)
10528  {
10529  Print("(S:%d)",strat->sl);mflush();
10530  }
10531  for (i=strat->sl; i>=low; i--)
10532  {
10533  int end_pos=strat->sl;
10534  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
10535  if (strat->ak==0) end_pos=i-1;
10536  TObject* T_j = strat->s_2_t(i);
10537  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
10538  {
10539  L = *T_j;
10540  #ifdef KDEBUG
10541  if (TEST_OPT_DEBUG)
10542  {
10543  Print("test S[%d]:",i);
10544  p_wrp(L.p,currRing,strat->tailRing);
10545  PrintLn();
10546  }
10547  #endif
10549  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
10550  else
10551  strat->S[i] = redtail(&L, strat->sl, strat);
10552  #ifdef KDEBUG
10553  if (TEST_OPT_DEBUG)
10554  {
10555  Print("to (tailR) S[%d]:",i);
10556  p_wrp(strat->S[i],currRing,strat->tailRing);
10557  PrintLn();
10558  }
10559  #endif
10560 
10561  if (strat->redTailChange && strat->tailRing != currRing)
10562  {
10563  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
10564  if (pNext(T_j->p) != NULL)
10565  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
10566  else
10567  T_j->max = NULL;
10568  }
10570  T_j->pCleardenom();
10571  }
10572  else
10573  {
10574  assume(currRing == strat->tailRing);
10575  #ifdef KDEBUG
10576  if (TEST_OPT_DEBUG)
10577  {
10578  Print("test S[%d]:",i);
10579  p_wrp(strat->S[i],currRing,strat->tailRing);
10580  PrintLn();
10581  }
10582  #endif
10584  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
10585  else
10586  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
10588  {
10589  if (TEST_OPT_CONTENTSB)
10590  {
10591  number n;
10592  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
10593  if (!nIsOne(n))
10594  {
10596  denom->n=nInvers(n);
10597  denom->next=DENOMINATOR_LIST;
10598  DENOMINATOR_LIST=denom;
10599  }
10600  nDelete(&n);
10601  }
10602  else
10603  {
10604  //pContent(strat->S[i]);
10605  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
10606  }
10607  }
10608  #ifdef KDEBUG
10609  if (TEST_OPT_DEBUG)
10610  {
10611  Print("to (-tailR) S[%d]:",i);
10612  p_wrp(strat->S[i],currRing,strat->tailRing);
10613  PrintLn();
10614  }
10615  #endif
10616  }
10617  if (TEST_OPT_PROT)
10618  PrintS("-");
10619  }
10620  if (TEST_OPT_PROT) PrintLn();
10621 #ifdef KDEBUG
10622  sloppy_max = FALSE;
10623 #endif
10624 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7507
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:60
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
#define TEST_OPT_CONTENTSB
Definition: options.h:121
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:89
int ak
Definition: kutil.h:351
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:678
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2844
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
#define nInvers(a)
Definition: numbers.h:33
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
ring tailRing
Definition: kutil.h:341
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:346
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:2716
char redTailChange
Definition: kutil.h:398
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:1138

§ createG0()

ideal createG0 ( )

Definition at line 4545 of file kutil.cc.

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

§ deleteHC() [1/2]

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

Definition at line 243 of file kutil.cc.

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

§ 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:341
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:332
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70

§ deleteInS()

void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 1041 of file kutil.cc.

1042 {
1043 #ifdef ENTER_USE_MEMMOVE
1044  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
1045  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
1046  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
1047  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
1048 #else
1049  int j;
1050  for (j=i; j<strat->sl; j++)
1051  {
1052  strat->S[j] = strat->S[j+1];
1053  strat->ecartS[j] = strat->ecartS[j+1];
1054  strat->sevS[j] = strat->sevS[j+1];
1055  strat->S_2_R[j] = strat->S_2_R[j+1];
1056  }
1057 #endif
1058  if (strat->lenS!=NULL)
1059  {
1060 #ifdef ENTER_USE_MEMMOVE
1061  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1062 #else
1063  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1064 #endif
1065  }
1066  if (strat->lenSw!=NULL)
1067  {
1068 #ifdef ENTER_USE_MEMMOVE
1069  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1070 #else
1071  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1072 #endif
1073  }
1074  if (strat->fromQ!=NULL)
1075  {
1076 #ifdef ENTER_USE_MEMMOVE
1077  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1078 #else
1079  for (j=i; j<strat->sl; j++)
1080  {
1081  strat->fromQ[j] = strat->fromQ[j+1];
1082  }
1083 #endif
1084  }
1085  strat->S[strat->sl] = NULL;
1086  strat->sl--;
1087 }
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
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:320
polyset sig
Definition: kutil.h:304
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10

§ enlargeL()

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

Definition at line 662 of file kutil.cc.

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

§ enlargeT()

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

Definition at line 531 of file kutil.cc.

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

§ enterExtendedSpoly()

void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 4660 of file kutil.cc.

4661 {
4662  if (nIsOne(pGetCoeff(h))) return;
4663  number gcd;
4664  bool go = false;
4665  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
4666  {
4667  gcd = n_Ann(pGetCoeff(h),currRing->cf);
4668  go = true;
4669  }
4670  else
4671  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
4672  if (go || !nIsOne(gcd))
4673  {
4674  poly p = h->next;
4675  if (!go)
4676  {
4677  number tmp = gcd;
4678  gcd = n_Ann(gcd,currRing->cf);
4679  nDelete(&tmp);
4680  }
4681  p_Test(p,strat->tailRing);
4682  p = pp_Mult_nn(p, gcd, strat->tailRing);
4683  nDelete(&gcd);
4684 
4685  if (p != NULL)
4686  {
4687  if (TEST_OPT_PROT)
4688  {
4689  PrintS("Z");
4690  }
4691 #ifdef KDEBUG
4692  if (TEST_OPT_DEBUG)
4693  {
4694  PrintS("--- create zero spoly: ");
4695  p_wrp(h,currRing,strat->tailRing);
4696  PrintS(" ---> ");
4697  }
4698 #endif
4699  poly tmp = pInit();
4700  pSetCoeff0(tmp, pGetCoeff(p));
4701  for (int i = 1; i <= rVar(currRing); i++)
4702  {
4703  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
4704  }
4706  {
4707  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
4708  }
4709  p_Setm(tmp, currRing);
4710  p = p_LmFreeAndNext(p, strat->tailRing);
4711  pNext(tmp) = p;
4712  LObject Lp;
4713  Lp.Init();
4714  Lp.p = tmp;
4715  Lp.tailRing = strat->tailRing;
4716  int posx;
4717  if (Lp.p!=NULL)
4718  {
4719  strat->initEcart(&Lp);
4720  if (strat->Ll==-1)
4721  posx =0;
4722  else
4723  posx = strat->posInL(strat->L,strat->Ll,&Lp,strat);
4724  Lp.sev = pGetShortExpVector(Lp.p);
4725  if (strat->tailRing != currRing)
4726  {
4727  Lp.t_p = k_LmInit_currRing_2_tailRing(Lp.p, strat->tailRing);
4728  }
4729 #ifdef KDEBUG
4730  if (TEST_OPT_DEBUG)
4731  {
4732  p_wrp(tmp,currRing,strat->tailRing);
4733  PrintLn();
4734  }
4735 #endif
4736  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,posx);
4737  }
4738  }
4739  }
4740  nDelete(&gcd);
4741 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
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:349
#define pSetExp(p, i, v)
Definition: polys.h:42
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:242
#define p_GetComp(p, r)
Definition: monomials.h:72
static poly pp_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:922
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
#define nIsOne(n)
Definition: numbers.h:25
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static FORCE_INLINE number n_Ann(number a, const coeffs r)
if r is a ring with zero divisors, return an annihilator!=0 of b otherwise return NULL ...
Definition: coeffs.h:705
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:901
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:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ enterExtendedSpolySig()

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

Definition at line 4743 of file kutil.cc.

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

§ enterL()

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

Definition at line 1210 of file kutil.cc.

1211 {
1212  // this should be corrected
1213  assume(p.FDeg == p.pFDeg());
1214 
1215  if ((*length)>=0)
1216  {
1217  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1218  if (at <= (*length))
1219 #ifdef ENTER_USE_MEMMOVE
1220  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1221 #else
1222  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1223 #endif
1224  }
1225  else at = 0;
1226  (*set)[at] = p;
1227  (*length)++;
1228 }
class sLObject LObject
Definition: kutil.h:60
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:30
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:662
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:52

§ enterOnePairLift()

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

Definition at line 2217 of file kutil.cc.

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

12060 {
12061  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12062 
12065 
12066  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
12067  /* that is create the pairs (f, s \dot g) */
12068 
12069  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
12070 
12071  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
12072  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
12073 
12074  /* determine how many elements we have to insert for a given s[i] */
12075  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12076  /* hence, a total number of elt's to add is: */
12077  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12078  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12079 
12080 #ifdef KDEBUG
12081  if (TEST_OPT_DEBUG)
12082  {
12083  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
12084  }
12085 #endif
12086 
12087  assume(i<=strat->sl); // from OnePair
12088 
12089  /* these vars hold for all shifts of s[i] */
12090  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12091 
12092  int qfromQ;
12093  if (strat->fromQ != NULL)
12094  {
12095  qfromQ = strat->fromQ[i];
12096  }
12097  else
12098  {
12099  qfromQ = -1;
12100  }
12101 
12102  int j;
12103 
12104  poly q/*, s*/;
12105 
12106  // for the 0th shift: insert the orig. pair
12107  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
12108 
12109  for (j=1; j<= toInsert; j++)
12110  {
12111  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12112  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12113  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12114  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12115  // pNext(q) = s; // in tailRing
12116  /* here we need to call enterOnePair with two polys ... */
12117 
12118 #ifdef KDEBUG
12119  //if (TEST_OPT_DEBUG)
12120  //{
12121  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
12122  //}
12123 #endif
12124  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
12125  }
12126 }
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:12197
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
#define TEST_OPT_DEBUG
Definition: options.h:103
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
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:341
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10

§ enterOnePairNormal()

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

Definition at line 1934 of file kutil.cc.

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

§ enterOnePairRing()

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

Definition at line 1276 of file kutil.cc.

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

§ enterOnePairSelfShifts()

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

Definition at line 12134 of file kutil.cc.

12135 {
12136 
12137  /* format: p,qq are in LObject form: lm in CR, tail in TR */
12138  /* for true self pairs qq ==p */
12139  /* we test both qq and p */
12141  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
12144 
12145  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
12146 
12147  // int j = 0;
12148  int j = 1;
12149 
12150  /* for such self pairs start with 1, not with 0 */
12151  if (qq == p) j=1;
12152 
12153  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
12154  /* that is create the pairs (f, s \dot g) */
12155 
12156  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
12157 
12158 #ifdef KDEBUG
12159  //if (TEST_OPT_DEBUG)
12160  //{
12161  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
12162  //}
12163 #endif
12164 
12165  poly q;
12166 
12167  /* these vars hold for all shifts of s[i] */
12168  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
12169  int qfromQ = 0; // strat->fromQ[i];
12170 
12171  for (; j<= toInsert; j++)
12172  {
12173  // q = pLPshift(strat->S[i],j,uptodeg,lV);
12174  /* we increase shifts by one; must delete q there*/
12175  // q = qq; q = pMoveCurrTail2poly(q,strat);
12176  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
12177  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
12178  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
12179  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
12180  // pNext(q) = s; // in tailRing
12181  /* here we need to call enterOnePair with two polys ... */
12182 #ifdef KDEBUG
12183  //if (TEST_OPT_DEBUG)
12184  //{
12185  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
12186  //}
12187 #endif
12188  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
12189  }
12190 }
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:12197
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:324
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:341
#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 12197 of file kutil.cc.

12198 {
12199 
12200  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
12201 
12202  /* check this Formats: */
12204  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
12207 
12208 #ifdef KDEBUG
12209 // if (TEST_OPT_DEBUG)
12210 // {
12211 // PrintS("enterOnePairShift(q,p) invoked with q = ");
12212 // wrp(q); // wrp(pHead(q));
12213 // PrintS(", p = ");
12214 // wrp(p); //wrp(pHead(p));
12215 // PrintLn();
12216 // }
12217 #endif
12218 
12219  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
12220 
12221  int qfromQ = qisFromQ;
12222 
12223  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
12224 
12225  int l,j,compare;
12226  LObject Lp;
12227  Lp.i_r = -1;
12228 
12229 #ifdef KDEBUG
12230  Lp.ecart=0; Lp.length=0;
12231 #endif
12232  /*- computes the lcm(s[i],p) -*/
12233  Lp.lcm = pInit();
12234 
12235  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
12236  pSetm(Lp.lcm);
12237 
12238  /* apply the V criterion */
12239  if (!isInV(Lp.lcm, lV))
12240  {
12241 #ifdef KDEBUG
12242  if (TEST_OPT_DEBUG)
12243  {
12244  PrintS("V crit applied to q = ");
12245  wrp(q); // wrp(pHead(q));
12246  PrintS(", p = ");
12247  wrp(p); //wrp(pHead(p));
12248  PrintLn();
12249  }
12250 #endif
12251  pLmFree(Lp.lcm);
12252  Lp.lcm=NULL;
12253  /* + counter for applying the V criterion */
12254  strat->cv++;
12255  return;
12256  }
12257 
12258  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
12259  {
12260  if((!((ecartq>0)&&(ecart>0)))
12261  && pHasNotCF(p,q))
12262  {
12263  /*
12264  *the product criterion has applied for (s,p),
12265  *i.e. lcm(s,p)=product of the leading terms of s and p.
12266  *Suppose (s,r) is in L and the leading term
12267  *of p divides lcm(s,r)
12268  *(==> the leading term of p divides the leading term of r)
12269  *but the leading term of s does not divide the leading term of r
12270  *(notice that this condition is automatically satisfied if r is still
12271  *in S), then (s,r) can be cancelled.
12272  *This should be done here because the
12273  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12274  *
12275  *Moreover, skipping (s,r) holds also for the noncommutative case.
12276  */
12277  strat->cp++;
12278  pLmFree(Lp.lcm);
12279  Lp.lcm=NULL;
12280  return;
12281  }
12282  else
12283  Lp.ecart = si_max(ecart,ecartq);
12284  if (strat->fromT && (ecartq>ecart))
12285  {
12286  pLmFree(Lp.lcm);
12287  Lp.lcm=NULL;
12288  return;
12289  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12290  }
12291  /*
12292  *the set B collects the pairs of type (S[j],p)
12293  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12294  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12295  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12296  */
12297  {
12298  j = strat->Bl;
12299  loop
12300  {
12301  if (j < 0) break;
12302  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12303  if ((compare==1)
12304  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
12305  {
12306  strat->c3++;
12307  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12308  {
12309  pLmFree(Lp.lcm);
12310  return;
12311  }
12312  break;
12313  }
12314  else
12315  if ((compare ==-1)
12316  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
12317  {
12318  deleteInL(strat->B,&strat->Bl,j,strat);
12319  strat->c3++;
12320  }
12321  j--;
12322  }
12323  }
12324  }
12325  else /*sugarcrit*/
12326  {
12327  if (ALLOW_PROD_CRIT(strat))
12328  {
12329  // if currRing->nc_type!=quasi (or skew)
12330  // TODO: enable productCrit for super commutative algebras...
12331  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
12332  pHasNotCF(p,q))
12333  {
12334  /*
12335  *the product criterion has applied for (s,p),
12336  *i.e. lcm(s,p)=product of the leading terms of s and p.
12337  *Suppose (s,r) is in L and the leading term
12338  *of p devides lcm(s,r)
12339  *(==> the leading term of p devides the leading term of r)
12340  *but the leading term of s does not devide the leading term of r
12341  *(notice that tis condition is automatically satisfied if r is still
12342  *in S), then (s,r) can be canceled.
12343  *This should be done here because the
12344  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
12345  */
12346  strat->cp++;
12347  pLmFree(Lp.lcm);
12348  Lp.lcm=NULL;
12349  return;
12350  }
12351  if (strat->fromT && (ecartq>ecart))
12352  {
12353  pLmFree(Lp.lcm);
12354  Lp.lcm=NULL;
12355  return;
12356  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
12357  }
12358  /*
12359  *the set B collects the pairs of type (S[j],p)
12360  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
12361  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
12362  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
12363  */
12364  for(j = strat->Bl;j>=0;j--)
12365  {
12366  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
12367  if (compare==1)
12368  {
12369  strat->c3++;
12370  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
12371  {
12372  pLmFree(Lp.lcm);
12373  return;
12374  }
12375  break;
12376  }
12377  else
12378  if (compare ==-1)
12379  {
12380  deleteInL(strat->B,&strat->Bl,j,strat);
12381  strat->c3++;
12382  }
12383  }
12384  }
12385  }
12386  /*
12387  *the pair (S[i],p) enters B if the spoly != 0
12388  */
12389  /*- compute the short s-polynomial -*/
12390  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
12391  pNorm(p);
12392  if ((q==NULL) || (p==NULL))
12393  return;
12394  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
12395  Lp.p=NULL;
12396  else
12397  {
12398 // if ( rIsPluralRing(currRing) )
12399 // {
12400 // if(pHasNotCF(p, q))
12401 // {
12402 // if(ncRingType(currRing) == nc_lie)
12403 // {
12404 // // generalized prod-crit for lie-type
12405 // strat->cp++;
12406 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
12407 // }
12408 // else
12409 // if( ALLOW_PROD_CRIT(strat) )
12410 // {
12411 // // product criterion for homogeneous case in SCA
12412 // strat->cp++;
12413 // Lp.p = NULL;
12414 // }
12415 // else
12416 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
12417 // }
12418 // else Lp.p = nc_CreateSpoly(q,p,currRing);
12419 // }
12420 // else
12421 // {
12422 
12423  /* ksCreateShortSpoly needs two Lobject-kind presentations */
12424  /* p is already in this form, so convert q */
12425  // q = pMove2CurrTail(q, strat);
12426  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
12427  // }
12428  }
12429  if (Lp.p == NULL)
12430  {
12431  /*- the case that the s-poly is 0 -*/
12432  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
12433 // if (strat->pairtest==NULL) initPairtest(strat);
12434 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
12435 // strat->pairtest[strat->sl+1] = TRUE;
12436  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12437  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
12438  /*
12439  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
12440  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
12441  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
12442  *term of p devides the lcm(s,r)
12443  *(this canceling should be done here because
12444  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
12445  *the first case is handeled in chainCrit
12446  */
12447  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
12448  }
12449  else
12450  {
12451  /*- the pair (S[i],p) enters B -*/
12452  /* both of them should have their LM in currRing and TAIL in tailring */
12453  Lp.p1 = q; // already in the needed form
12454  Lp.p2 = p; // already in the needed form
12455 
12456  if ( !rIsPluralRing(currRing) )
12457  pNext(Lp.p) = strat->tail;
12458 
12459  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
12460  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
12461  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
12462  {
12463  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
12464  Lp.i_r2 = atR;
12465  }
12466  else
12467  {
12468  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
12469  Lp.i_r1 = -1;
12470  Lp.i_r2 = -1;
12471  }
12472  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
12473 
12475  {
12476  if (!rIsPluralRing(currRing))
12477  nDelete(&(Lp.p->coef));
12478  }
12479 
12480  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
12481  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
12482  }
12483 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#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:345
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:368
int Bl
Definition: kutil.h:350
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:278
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
#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:824
int Bmax
Definition: kutil.h:350
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:378
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
intset fromQ
Definition: kutil.h:317
static int si_max(const int a, const int b)
Definition: auxiliary.h:123
void PrintS(const char *s)
Definition: reporter.cc:284
int isInV(poly p, int lV)
Definition: shiftgb.cc:241
poly tail
Definition: kutil.h:332
BOOLEAN sugarCrit
Definition: kutil.h:376
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pNext(p)
Definition: monomials.h:43
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:394
void wrp(poly p)
Definition: polys.h:293
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1267
int l
Definition: cfEzgcd.cc:94

§ enterOnePairSig()

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

Definition at line 2433 of file kutil.cc.

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

§ enterOnePairSigRing()

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

Definition at line 2690 of file kutil.cc.

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

§ enterOnePairSpecial()

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

Definition at line 3136 of file kutil.cc.

3137 {
3138  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
3139  if(pHasNotCF(p,strat->S[i]))
3140  {
3141  //PrintS("prod-crit\n");
3142  if(ALLOW_PROD_CRIT(strat))
3143  {
3144  //PrintS("prod-crit\n");
3145  strat->cp++;
3146  return;
3147  }
3148  }
3149 
3150  int l,j,compare;
3151  LObject Lp;
3152  Lp.i_r = -1;
3153 
3154  Lp.lcm = pInit();
3155  pLcm(p,strat->S[i],Lp.lcm);
3156  pSetm(Lp.lcm);
3157  /*- compute the short s-polynomial -*/
3158 
3159  #ifdef HAVE_PLURAL
3160  if (rIsPluralRing(currRing))
3161  {
3162  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
3163  }
3164  else
3165  #endif
3166  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
3167 
3168  if (Lp.p == NULL)
3169  {
3170  //PrintS("short spoly==NULL\n");
3171  pLmFree(Lp.lcm);
3172  }
3173  else
3174  {
3175  /*- the pair (S[i],p) enters L -*/
3176  Lp.p1 = strat->S[i];
3177  Lp.p2 = p;
3178  if (atR >= 0)
3179  {
3180  Lp.i_r1 = strat->S_2_R[i];
3181  Lp.i_r2 = atR;
3182  }
3183  else
3184  {
3185  Lp.i_r1 = -1;
3186  Lp.i_r2 = -1;
3187  }
3188  assume(pNext(Lp.p) == NULL);
3189  pNext(Lp.p) = strat->tail;
3190  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
3192  {
3193  nDelete(&(Lp.p->coef));
3194  }
3195  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
3196  //Print("-> L[%d]\n",l);
3197  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
3198  }
3199 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
#define pSetm(p)
Definition: polys.h:253
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
#define pHasNotCF(p1, p2)
Definition: polys.h:245
#define pLcm(a, b, m)
Definition: polys.h:278
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:283
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1939
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:824
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
polyset S
Definition: kutil.h:302
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:345
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
#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:394
int l
Definition: cfEzgcd.cc:94

§ enterOneStrongPoly()

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

Definition at line 1513 of file kutil.cc.

1514 {
1515  number d, s, t;
1516  assume(atR >= 0);
1517  poly m1, m2, gcd,si;
1518  if(!enterTstrong)
1519  {
1520  assume(i<=strat->sl);
1521  si = strat->S[i];
1522  }
1523  else
1524  {
1525  assume(i<=strat->tl);
1526  si = strat->T[i].p;
1527  }
1528  //printf("\n--------------------------------\n");
1529  //pWrite(p);pWrite(si);
1530  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(si), &s, &t, currRing->cf);
1531 
1532  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1533  {
1534  nDelete(&d);
1535  nDelete(&s);
1536  nDelete(&t);
1537  return FALSE;
1538  }
1539 
1540  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1541  //p_Test(m1,strat->tailRing);
1542  //p_Test(m2,strat->tailRing);
1543  /*if(!enterTstrong)
1544  {
1545  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1546  {
1547  memset(&(strat->P), 0, sizeof(strat->P));
1548  kStratChangeTailRing(strat);
1549  strat->P = *(strat->R[atR]);
1550  p_LmFree(m1, strat->tailRing);
1551  p_LmFree(m2, strat->tailRing);
1552  p_LmFree(gcd, currRing);
1553  k_GetStrongLeadTerms(p, si, currRing, m1, m2, gcd, strat->tailRing);
1554  }
1555  }*/
1556  pSetCoeff0(m1, s);
1557  pSetCoeff0(m2, t);
1558  pSetCoeff0(gcd, d);
1559  p_Test(m1,strat->tailRing);
1560  p_Test(m2,strat->tailRing);
1561  //printf("\n===================================\n");
1562  //pWrite(m1);pWrite(m2);pWrite(gcd);
1563 #ifdef KDEBUG
1564  if (TEST_OPT_DEBUG)
1565  {
1566  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1567  PrintS("m1 = ");
1568  p_wrp(m1, strat->tailRing);
1569  PrintS(" ; m2 = ");
1570  p_wrp(m2, strat->tailRing);
1571  PrintS(" ; gcd = ");
1572  wrp(gcd);
1573  PrintS("\n--- create strong gcd poly: ");
1574  Print("\n p: %d", i);
1575  wrp(p);
1576  Print("\n strat->S[%d]: ", i);
1577  wrp(si);
1578  PrintS(" ---> ");
1579  }
1580 #endif
1581 
1582  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(si), m2, strat->tailRing), strat->tailRing);
1583  p_LmDelete(m1, strat->tailRing);
1584  p_LmDelete(m2, strat->tailRing);
1585 #ifdef KDEBUG
1586  if (TEST_OPT_DEBUG)
1587  {
1588  wrp(gcd);
1589  PrintLn();
1590  }
1591 #endif
1592 
1593  LObject h;
1594  h.p = gcd;
1595  h.tailRing = strat->tailRing;
1596  int posx;
1597  h.pCleardenom();
1598  strat->initEcart(&h);
1599  h.sev = pGetShortExpVector(h.p);
1600  h.i_r1 = -1;h.i_r2 = -1;
1601  if (currRing!=strat->tailRing)
1602  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1603  if(!enterTstrong)
1604  {
1605  #if 1
1606  h.p1 = p;h.p2 = strat->S[i];
1607  #endif
1608  if (atR >= 0)
1609  {
1610  h.i_r2 = strat->S_2_R[i];
1611  h.i_r1 = atR;
1612  }
1613  else
1614  {
1615  h.i_r1 = -1;
1616  h.i_r2 = -1;
1617  }
1618  if (strat->Ll==-1)
1619  posx =0;
1620  else
1621  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1622  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1623  }
1624  else
1625  {
1626  if(h.IsNull()) return FALSE;
1627  //int red_result;
1628  //reduzieren ist teur!!!
1629  //if(strat->L != NULL)
1630  //red_result = strat->red(&h,strat);
1631  if(!h.IsNull())
1632  {
1633  enterT(h, strat,-1);
1634  //int pos = posInS(strat,strat->sl,h.p,h.ecart);
1635  //strat->enterS(h,pos,strat,-1);
1636  }
1637  }
1638  //#if 1
1639  #ifdef ADIDEBUG
1640  printf("\nThis strong poly was added to L:\n");pWrite(h.p);pWrite(h.p1);pWrite(h.p2);
1641  #endif
1642  return TRUE;
1643 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
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:349
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
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:101
void pWrite(poly p)
Definition: polys.h:291
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:901
#define assume(x)
Definition: mod2.h:403
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
polyset S
Definition: kutil.h:302
#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:323
#define nIsZero(n)
Definition: numbers.h:19
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
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:1003
TSet T
Definition: kutil.h:322
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:706
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
void wrp(poly p)
Definition: polys.h:293
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
static Poly * h
Definition: janet.cc:978

§ enterOneStrongPolySig()

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

Definition at line 1708 of file kutil.cc.

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

§ enterOneZeroPairRing()

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

Definition at line 4232 of file kutil.cc.

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

§ enterpairs()

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

Definition at line 4936 of file kutil.cc.

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

12492 {
12493  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12494  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
12495  int j=pos;
12496 
12498  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
12499  if ( (!strat->fromT)
12500  && ((strat->syzComp==0)
12501  ||(pGetComp(h)<=strat->syzComp)))
12502  {
12503  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
12504  unsigned long h_sev = pGetShortExpVector(h);
12505  loop
12506  {
12507  if (j > k) break;
12508  clearS(h,h_sev, &j,&k,strat);
12509  j++;
12510  }
12511  //Print("end clearS sl=%d\n",strat->sl);
12512  }
12513  // PrintS("end enterpairs\n");
12514 }
int syzComp
Definition: kutil.h:352
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:12523
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:378
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1141
static Poly * h
Definition: janet.cc:978

§ enterpairsSig()

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

Definition at line 4962 of file kutil.cc.

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

§ enterpairsSpecial()

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

Definition at line 4985 of file kutil.cc.

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

§ enterSBba()

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

Definition at line 9124 of file kutil.cc.

9125 {
9126  strat->news = TRUE;
9127  /*- puts p to the standardbasis s at position at -*/
9128  if (strat->sl == IDELEMS(strat->Shdl)-1)
9129  {
9130  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9131  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9132  (IDELEMS(strat->Shdl)+setmaxTinc)
9133  *sizeof(unsigned long));
9134  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9135  IDELEMS(strat->Shdl)*sizeof(int),
9136  (IDELEMS(strat->Shdl)+setmaxTinc)
9137  *sizeof(int));
9138  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9139  IDELEMS(strat->Shdl)*sizeof(int),
9140  (IDELEMS(strat->Shdl)+setmaxTinc)
9141  *sizeof(int));
9142  if (strat->lenS!=NULL)
9143  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9144  IDELEMS(strat->Shdl)*sizeof(int),
9145  (IDELEMS(strat->Shdl)+setmaxTinc)
9146  *sizeof(int));
9147  if (strat->lenSw!=NULL)
9148  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9149  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9150  (IDELEMS(strat->Shdl)+setmaxTinc)
9151  *sizeof(wlen_type));
9152  if (strat->fromQ!=NULL)
9153  {
9154  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9155  IDELEMS(strat->Shdl)*sizeof(int),
9156  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9157  }
9158  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9159  IDELEMS(strat->Shdl)+=setmaxTinc;
9160  strat->Shdl->m=strat->S;
9161  }
9162  if (atS <= strat->sl)
9163  {
9164 #ifdef ENTER_USE_MEMMOVE
9165  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9166  (strat->sl - atS + 1)*sizeof(poly));
9167  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9168  (strat->sl - atS + 1)*sizeof(int));
9169  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9170  (strat->sl - atS + 1)*sizeof(unsigned long));
9171  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9172  (strat->sl - atS + 1)*sizeof(int));
9173  if (strat->lenS!=NULL)
9174  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9175  (strat->sl - atS + 1)*sizeof(int));
9176  if (strat->lenSw!=NULL)
9177  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9178  (strat->sl - atS + 1)*sizeof(wlen_type));
9179 #else
9180  for (i=strat->sl+1; i>=atS+1; i--)
9181  {
9182  strat->S[i] = strat->S[i-1];
9183  strat->ecartS[i] = strat->ecartS[i-1];
9184  strat->sevS[i] = strat->sevS[i-1];
9185  strat->S_2_R[i] = strat->S_2_R[i-1];
9186  }
9187  if (strat->lenS!=NULL)
9188  for (i=strat->sl+1; i>=atS+1; i--)
9189  strat->lenS[i] = strat->lenS[i-1];
9190  if (strat->lenSw!=NULL)
9191  for (i=strat->sl+1; i>=atS+1; i--)
9192  strat->lenSw[i] = strat->lenSw[i-1];
9193 #endif
9194  }
9195  if (strat->fromQ!=NULL)
9196  {
9197 #ifdef ENTER_USE_MEMMOVE
9198  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9199  (strat->sl - atS + 1)*sizeof(int));
9200 #else
9201  for (i=strat->sl+1; i>=atS+1; i--)
9202  {
9203  strat->fromQ[i] = strat->fromQ[i-1];
9204  }
9205 #endif
9206  strat->fromQ[atS]=0;
9207  }
9208 
9209  /*- save result -*/
9210  strat->S[atS] = p.p;
9211  if (strat->honey) strat->ecartS[atS] = p.ecart;
9212  if (p.sev == 0)
9213  p.sev = pGetShortExpVector(p.p);
9214  else
9215  assume(p.sev == pGetShortExpVector(p.p));
9216  strat->sevS[atS] = p.sev;
9217  strat->ecartS[atS] = p.ecart;
9218  strat->S_2_R[atS] = atR;
9219  strat->sl++;
9220 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:376
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:399
#define TRUE
Definition: auxiliary.h:101
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
#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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3556
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299

§ 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:280
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
poly kNoether
Definition: kutil.h:326
#define TRUE
Definition: auxiliary.h:101
#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:354
#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:284
BOOLEAN kHEdgeFound
Definition: kutil.h:375
#define NULL
Definition: omList.c:10
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1295
ring tailRing
Definition: kutil.h:341
BOOLEAN posInLOldFlag
Definition: kutil.h:381
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10631
#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:9124

§ 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:326
#define TRUE
Definition: auxiliary.h:101
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
BOOLEAN kHEdgeFound
Definition: kutil.h:375
#define NULL
Definition: omList.c:10
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10631
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9124

§ enterSSba()

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

Definition at line 9226 of file kutil.cc.

9227 {
9228  strat->news = TRUE;
9229  /*- puts p to the standardbasis s at position at -*/
9230  if (strat->sl == IDELEMS(strat->Shdl)-1)
9231  {
9232  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
9233  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9234  (IDELEMS(strat->Shdl)+setmaxTinc)
9235  *sizeof(unsigned long));
9236  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
9237  IDELEMS(strat->Shdl)*sizeof(unsigned long),
9238  (IDELEMS(strat->Shdl)+setmaxTinc)
9239  *sizeof(unsigned long));
9240  strat->ecartS = (intset)omReallocSize(strat->ecartS,
9241  IDELEMS(strat->Shdl)*sizeof(int),
9242  (IDELEMS(strat->Shdl)+setmaxTinc)
9243  *sizeof(int));
9244  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
9245  IDELEMS(strat->Shdl)*sizeof(int),
9246  (IDELEMS(strat->Shdl)+setmaxTinc)
9247  *sizeof(int));
9248  if (strat->lenS!=NULL)
9249  strat->lenS=(int*)omRealloc0Size(strat->lenS,
9250  IDELEMS(strat->Shdl)*sizeof(int),
9251  (IDELEMS(strat->Shdl)+setmaxTinc)
9252  *sizeof(int));
9253  if (strat->lenSw!=NULL)
9254  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
9255  IDELEMS(strat->Shdl)*sizeof(wlen_type),
9256  (IDELEMS(strat->Shdl)+setmaxTinc)
9257  *sizeof(wlen_type));
9258  if (strat->fromQ!=NULL)
9259  {
9260  strat->fromQ = (intset)omReallocSize(strat->fromQ,
9261  IDELEMS(strat->Shdl)*sizeof(int),
9262  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
9263  }
9264  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
9265  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
9266  IDELEMS(strat->Shdl)+=setmaxTinc;
9267  strat->Shdl->m=strat->S;
9268  }
9269  // in a signature-based algorithm the following situation will never
9270  // appear due to the fact that the critical pairs are already sorted
9271  // by increasing signature.
9272  // True. However, in the case of integers we need to put the element
9273  // that caused the signature drop on the first position
9274  if (atS <= strat->sl)
9275  {
9276 #ifdef ENTER_USE_MEMMOVE
9277  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
9278  (strat->sl - atS + 1)*sizeof(poly));
9279  memmove(&(strat->sig[atS+1]), &(strat->sig[atS]),
9280  (strat->sl - atS + 1)*sizeof(poly));
9281  memmove(&(strat->sevSig[atS+1]), &(strat->sevSig[atS]),
9282  (strat->sl - atS + 1)*sizeof(unsigned long));
9283  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
9284  (strat->sl - atS + 1)*sizeof(int));
9285  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
9286  (strat->sl - atS + 1)*sizeof(unsigned long));
9287  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
9288  (strat->sl - atS + 1)*sizeof(int));
9289  if (strat->lenS!=NULL)
9290  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
9291  (strat->sl - atS + 1)*sizeof(int));
9292  if (strat->lenSw!=NULL)
9293  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
9294  (strat->sl - atS + 1)*sizeof(wlen_type));
9295 #else
9296  for (i=strat->sl+1; i>=atS+1; i--)
9297  {
9298  strat->S[i] = strat->S[i-1];
9299  strat->ecartS[i] = strat->ecartS[i-1];
9300  strat->sevS[i] = strat->sevS[i-1];
9301  strat->S_2_R[i] = strat->S_2_R[i-1];
9302  strat->sig[i] = strat->sig[i-1];
9303  strat->sevSig[i] = strat->sevSig[i-1];
9304  }
9305  if (strat->lenS!=NULL)
9306  for (i=strat->sl+1; i>=atS+1; i--)
9307  strat->lenS[i] = strat->lenS[i-1];
9308  if (strat->lenSw!=NULL)
9309  for (i=strat->sl+1; i>=atS+1; i--)
9310  strat->lenSw[i] = strat->lenSw[i-1];
9311 #endif
9312  }
9313  if (strat->fromQ!=NULL)
9314  {
9315 #ifdef ENTER_USE_MEMMOVE
9316  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
9317  (strat->sl - atS + 1)*sizeof(int));
9318 #else
9319  for (i=strat->sl+1; i>=atS+1; i--)
9320  {
9321  strat->fromQ[i] = strat->fromQ[i-1];
9322  }
9323 #endif
9324  strat->fromQ[atS]=0;
9325  }
9326 
9327  /*- save result -*/
9328  strat->S[atS] = p.p;
9329  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
9330  if (strat->honey) strat->ecartS[atS] = p.ecart;
9331  if (p.sev == 0)
9332  p.sev = pGetShortExpVector(p.p);
9333  else
9334  assume(p.sev == pGetShortExpVector(p.p));
9335  strat->sevS[atS] = p.sev;
9336  // during the interreduction process of a signature-based algorithm we do not
9337  // compute the signature at this point, but when the whole interreduction
9338  // process finishes, i.e. f5c terminates!
9339  if (p.sig != NULL)
9340  {
9341  if (p.sevSig == 0)
9342  p.sevSig = pGetShortExpVector(p.sig);
9343  else
9344  assume(p.sevSig == pGetShortExpVector(p.sig));
9345  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
9346  }
9347  strat->ecartS[atS] = p.ecart;
9348  strat->S_2_R[atS] = atR;
9349  strat->sl++;
9350 #ifdef DEBUGF5
9351  int k;
9352  Print("--- LIST S: %d ---\n",strat->sl);
9353  for(k=0;k<=strat->sl;k++)
9354  {
9355  pWrite(strat->sig[k]);
9356  }
9357  PrintS("--- LIST S END ---\n");
9358 #endif
9359 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:376
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:316
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:399
#define TRUE
Definition: auxiliary.h:101
void pWrite(poly p)
Definition: polys.h:291
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
#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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset lenS
Definition: kutil.h:315
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3556
int64 wlen_type
Definition: kutil.h:56
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
int * intset
Definition: kutil.h:55
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299

§ enterSyz()

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

Definition at line 9561 of file kutil.cc.

9562 {
9563  #ifdef ADIDEBUG
9564  printf("\n Entersyz:\n");pWrite(p.sig);
9565  #endif
9566  int i;
9567  strat->newt = TRUE;
9568  if (strat->syzl == strat->syzmax-1)
9569  {
9570  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
9571  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
9572  (strat->syzmax)*sizeof(unsigned long),
9573  ((strat->syzmax)+setmaxTinc)
9574  *sizeof(unsigned long));
9575  strat->syzmax += setmaxTinc;
9576  }
9577  if (atT < strat->syzl)
9578  {
9579 #ifdef ENTER_USE_MEMMOVE
9580  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
9581  (strat->syzl-atT+1)*sizeof(poly));
9582  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
9583  (strat->syzl-atT+1)*sizeof(unsigned long));
9584 #endif
9585  for (i=strat->syzl; i>=atT+1; i--)
9586  {
9587 #ifndef ENTER_USE_MEMMOVE
9588  strat->syz[i] = strat->syz[i-1];
9589  strat->sevSyz[i] = strat->sevSyz[i-1];
9590 #endif
9591  }
9592  }
9593  //i = strat->syzl;
9594  i = atT;
9595  //Makes sure the syz saves just the signature
9596  #ifdef HAVE_RINGS
9598  pNext(p.sig) = NULL;
9599  #endif
9600  strat->syz[atT] = p.sig;
9601  strat->sevSyz[atT] = p.sevSig;
9602  strat->syzl++;
9603 #if F5DEBUG
9604  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
9605  pWrite(strat->syz[atT]);
9606 #endif
9607  // recheck pairs in strat->L with new rule and delete correspondingly
9608  int cc = strat->Ll;
9609  while (cc>-1)
9610  {
9611  //printf("\nCheck if syz is div by L\n");pWrite(strat->syz[atT]);pWrite(strat->L[cc].sig);
9612  //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);
9613  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
9614  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing)
9615  #ifdef HAVE_RINGS
9616  &&((!rField_is_Ring(currRing))
9617  || (n_DivBy(pGetCoeff(strat->L[cc].sig),pGetCoeff(strat->syz[atT]),currRing) && (pLtCmp(strat->L[cc].sig,strat->syz[atT])==1)))
9618  #endif
9619  )
9620  {
9621  //printf("\nYES!\n");
9622  #ifdef ADIDEBUG
9623  printf("\n syzCrit deleted!\n");pWrite(strat->L[cc].p);pWrite(strat->L[cc].sig);
9624  #endif
9625  deleteInL(strat->L,&strat->Ll,cc,strat);
9626  }
9627  cc--;
9628  }
9629 //#if 1
9630 #ifdef DEBUGF5
9631  PrintS("--- Syzygies ---\n");
9632  Print("syzl %d\n",strat->syzl);
9633  Print("syzmax %d\n",strat->syzmax);
9634  PrintS("--------------------------------\n");
9635  for(i=0;i<=strat->syzl-1;i++)
9636  {
9637  Print("%d - ",i);
9638  pWrite(strat->syz[i]);
9639  }
9640  PrintS("--------------------------------\n");
9641 #endif
9642 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
int Ll
Definition: kutil.h:349
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:400
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
void pWrite(poly p)
Definition: polys.h:291
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether &#39;a&#39; is divisible &#39;b&#39;; for r encoding a field: TRUE iff &#39;b&#39; does not represent zero in Z:...
Definition: coeffs.h:787
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:323
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:3556
#define pNext(p)
Definition: monomials.h:43
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
polyrec * poly
Definition: hilb.h:10
int syzl
Definition: kutil.h:347

§ enterT()

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

Definition at line 9364 of file kutil.cc.

9365 {
9366  int i;
9367 
9368  pp_Test(p.p, currRing, p.tailRing);
9369  assume(strat->tailRing == p.tailRing);
9370  // redMoraNF complains about this -- but, we don't really
9371  // neeed this so far
9372  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9373  assume(p.FDeg == p.pFDeg());
9374  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9375 
9376 #ifdef KDEBUG
9377  // do not put an LObject twice into T:
9378  for(i=strat->tl;i>=0;i--)
9379  {
9380  if (p.p==strat->T[i].p)
9381  {
9382  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9383  return;
9384  }
9385  }
9386 #endif
9387 
9388 #ifdef HAVE_TAIL_RING
9389  if (currRing!=strat->tailRing)
9390  {
9391  p.t_p=p.GetLmTailRing();
9392  }
9393 #endif
9394  strat->newt = TRUE;
9395  if (atT < 0)
9396  atT = strat->posInT(strat->T, strat->tl, p);
9397  if (strat->tl == strat->tmax-1)
9398  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9399  if (atT <= strat->tl)
9400  {
9401 #ifdef ENTER_USE_MEMMOVE
9402  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9403  (strat->tl-atT+1)*sizeof(TObject));
9404  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9405  (strat->tl-atT+1)*sizeof(unsigned long));
9406 #endif
9407  for (i=strat->tl+1; i>=atT+1; i--)
9408  {
9409 #ifndef ENTER_USE_MEMMOVE
9410  strat->T[i] = strat->T[i-1];
9411  strat->sevT[i] = strat->sevT[i-1];
9412 #endif
9413  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9414  }
9415  }
9416 
9417  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9418  {
9420  (strat->tailRing != NULL ?
9421  strat->tailRing : currRing),
9422  strat->tailBin);
9423  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9424  }
9425  strat->T[atT] = (TObject) p;
9426  #ifdef ADIDEBUG
9427  printf("\nenterT: add in position %i\n",atT);
9428  p_Write(p.p,strat->tailRing);p_Write(p.sig,currRing);
9429  #endif
9430  //printf("\nenterT: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9431 
9432  if (strat->tailRing != currRing && pNext(p.p) != NULL)
9433  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9434  else
9435  strat->T[atT].max = NULL;
9436 
9437  strat->tl++;
9438  strat->R[strat->tl] = &(strat->T[atT]);
9439  strat->T[atT].i_r = strat->tl;
9440  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9441  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9442  kTest_T(&(strat->T[atT]));
9443 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
char newt
Definition: kutil.h:400
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
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:277
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:531
#define assume(x)
Definition: mod2.h:403
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:162
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:869
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:338
int tmax
Definition: kutil.h:348
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:322
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:1138

§ enterT_strong()

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

Definition at line 9449 of file kutil.cc.

9450 {
9452  int i;
9453 
9454  pp_Test(p.p, currRing, p.tailRing);
9455  assume(strat->tailRing == p.tailRing);
9456  // redMoraNF complains about this -- but, we don't really
9457  // neeed this so far
9458  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
9459  assume(p.FDeg == p.pFDeg());
9460  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
9461 
9462 #ifdef KDEBUG
9463  // do not put an LObject twice into T:
9464  for(i=strat->tl;i>=0;i--)
9465  {
9466  if (p.p==strat->T[i].p)
9467  {
9468  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
9469  return;
9470  }
9471  }
9472 #endif
9473 
9474 #ifdef HAVE_TAIL_RING
9475  if (currRing!=strat->tailRing)
9476  {
9477  p.t_p=p.GetLmTailRing();
9478  }
9479 #endif
9480  strat->newt = TRUE;
9481  if (atT < 0)
9482  atT = strat->posInT(strat->T, strat->tl, p);
9483  if (strat->tl == strat->tmax-1)
9484  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
9485  if (atT <= strat->tl)
9486  {
9487 #ifdef ENTER_USE_MEMMOVE
9488  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
9489  (strat->tl-atT+1)*sizeof(TObject));
9490  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
9491  (strat->tl-atT+1)*sizeof(unsigned long));
9492 #endif
9493  for (i=strat->tl+1; i>=atT+1; i--)
9494  {
9495 #ifndef ENTER_USE_MEMMOVE
9496  strat->T[i] = strat->T[i-1];
9497  strat->sevT[i] = strat->sevT[i-1];
9498 #endif
9499  strat->R[strat->T[i].i_r] = &(strat->T[i]);
9500  }
9501  }
9502 
9503  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
9504  {
9506  (strat->tailRing != NULL ?
9507  strat->tailRing : currRing),
9508  strat->tailBin);
9509  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
9510  }
9511  strat->T[atT] = (TObject) p;
9512  #ifdef ADIDEBUG
9513  printf("\nenterT_strong: add in position %i\n",atT);
9514  pWrite(p.p);
9515  #endif
9516  //printf("\nenterT_strong: neue hingefügt: länge = %i, ecart = %i\n",p.length,p.ecart);
9517 
9518  if (strat->tailRing != currRing && pNext(p.p) != NULL)
9519  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
9520  else
9521  strat->T[atT].max = NULL;
9522 
9523  strat->tl++;
9524  strat->R[strat->tl] = &(strat->T[atT]);
9525  strat->T[atT].i_r = strat->tl;
9526  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
9527  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
9528  #if 1
9530  && !n_IsUnit(p.p->coef, currRing->cf))
9531  {
9532  #ifdef ADIDEBUG
9533  printf("\nDas ist p:\n");pWrite(p.p);
9534  #endif
9535  for(i=strat->tl;i>=0;i--)
9536  {
9537  if(strat->T[i].ecart <= p.ecart && pLmDivisibleBy(strat->T[i].p,p.p))
9538  {
9539  #ifdef ADIDEBUG
9540  printf("\nFound one: %i\n",i);pWrite(strat->T[i].p);
9541  #endif
9542  enterOneStrongPoly(i,p.p,p.ecart,0,strat,0 , TRUE);
9543  }
9544  }
9545  }
9546  /*
9547  printf("\nThis is T:\n");
9548  for(i=strat->tl;i>=0;i--)
9549  {
9550  pWrite(strat->T[i].p);
9551  }
9552  //getchar();*/
9553  #endif
9554  kTest_T(&(strat->T[atT]));
9555 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
char newt
Definition: kutil.h:400
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:321
void pWrite(poly p)
Definition: polys.h:291
#define pLmDivisibleBy(a, b)
like pDivisibleBy, except that it is assumed that a!=NULL, b!=NULL
Definition: polys.h:140
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
static int pLength(poly a)
Definition: p_polys.h:189
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:531
#define assume(x)
Definition: mod2.h:403
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:152
#define pp_Test(p, lmRing, tailRing)
Definition: p_polys.h:162
static poly p_ShallowCopyDelete(poly p, const ring r, omBin bin)
Definition: p_polys.h:869
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:338
int tmax
Definition: kutil.h:348
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR, bool enterTstrong)
Definition: kutil.cc:1513
ring tailRing
Definition: kutil.h:341
omBin tailBin
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:33
TSet T
Definition: kutil.h:322
#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:1138

§ enterTShift()

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

Definition at line 12596 of file kutil.cc.

12597 {
12598  /* determine how many elements we have to insert */
12599  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
12600  /* hence, a total number of elt's to add is: */
12601  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
12602 
12603  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
12604 
12605 #ifdef PDEBUG
12606  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
12607 #endif
12608  int i;
12609 
12610  if (atT < 0)
12611  atT = strat->posInT(strat->T, strat->tl, p);
12612 
12613  /* can call enterT in a sequence, e.g. */
12614 
12615  /* shift0 = it's our model for further shifts */
12616  enterT(p,strat,atT);
12617  LObject qq;
12618  for (i=1; i<=toInsert; i++) // toIns - 1?
12619  {
12620  qq = p; //qq.Copy();
12621  qq.p = NULL;
12622  qq.max = NULL;
12623  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
12624  qq.GetP();
12625  // update q.sev
12626  qq.sev = pGetShortExpVector(qq.p);
12627  /* enter it into T, first el't is with the shift 0 */
12628  // compute the position for qq
12629  atT = strat->posInT(strat->T, strat->tl, qq);
12630  enterT(qq,strat,atT);
12631  }
12632 /* Q: what to do with this one in the orig enterT ? */
12633 /* strat->R[strat->tl] = &(strat->T[atT]); */
12634 /* Solution: it is done by enterT each time separately */
12635 }
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:348
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
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:9364
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:341
TSet T
Definition: kutil.h:322

§ exitBuchMora()

void exitBuchMora ( kStrategy  strat)

Definition at line 10063 of file kutil.cc.

10064 {
10065  /*- release temp data -*/
10066  cleanT(strat);
10067  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10068  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10069  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10070  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10071  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10072  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10073  /*- set L: should be empty -*/
10074  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10075  /*- set B: should be empty -*/
10076  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10077  pLmDelete(&strat->tail);
10078  strat->syzComp=0;
10079 }
int syzComp
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#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:321
void * ADDRESS
Definition: auxiliary.h:118
int Bmax
Definition: kutil.h:350
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
void cleanT(kStrategy strat)
Definition: kutil.cc:552
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
unsigned long * sevS
Definition: kutil.h:318
TSet T
Definition: kutil.h:322
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59

§ exitSba()

void exitSba ( kStrategy  strat)

Definition at line 10256 of file kutil.cc.

10257 {
10258  /*- release temp data -*/
10260  cleanTSbaRing(strat);
10261  else
10262  cleanT(strat);
10263  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
10264  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
10265  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
10266  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
10267  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10268  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
10269  if(strat->syzmax>0)
10270  {
10271  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
10272  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
10273  if (strat->sbaOrder == 1)
10274  {
10275  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
10276  }
10277  }
10278  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
10279  /*- set L: should be empty -*/
10280  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
10281  /*- set B: should be empty -*/
10282  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
10283  /*- set sig: no need for the signatures anymore -*/
10284  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
10285  pLmDelete(&strat->tail);
10286  strat->syzComp=0;
10287 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
int syzComp
Definition: kutil.h:352
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
#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:321
void * ADDRESS
Definition: auxiliary.h:118
int Bmax
Definition: kutil.h:350
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:312
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
intset ecartS
Definition: kutil.h:305
LSet L
Definition: kutil.h:323
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:324
int Lmax
Definition: kutil.h:349
int syzidxmax
Definition: kutil.h:347
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
polyset syz
Definition: kutil.h:303
TSet T
Definition: kutil.h:322
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
class sTObject TObject
Definition: kutil.h:59
intset syzIdx
Definition: kutil.h:309

§ faugereRewCriterion()

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

Definition at line 7213 of file kutil.cc.

7214 {
7215  //printf("Faugere Rewritten Criterion\n");
7217  return FALSE;
7218 //#if 1
7219 #ifdef DEBUGF5
7220  PrintS("rewritten criterion checks: ");
7221  pWrite(sig);
7222 #endif
7223  for(int k = strat->sl; k>=start; k--)
7224  {
7225 //#if 1
7226 #ifdef DEBUGF5
7227  PrintS("checking with: ");
7228  pWrite(strat->sig[k]);
7229  pWrite(pHead(strat->S[k]));
7230 #endif
7231  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
7232  {
7233 //#if 1
7234 #ifdef DEBUGF5
7235  PrintS("DELETE!\n");
7236 #endif
7237  #ifdef ADIDEBUG
7238  printf("\nFaugere RewCrit: * divisible by *\n");pWrite(sig);pWrite(strat->sig[k]);
7239  #endif
7240  strat->nrrewcrit++;
7241  return TRUE;
7242  }
7243  //k--;
7244  }
7245 #ifdef DEBUGF5
7246  PrintS("ALL ELEMENTS OF S\n----------------------------------------\n");
7247  for(int kk = 0; kk<strat->sl+1; kk++)
7248  {
7249  pWrite(pHead(strat->S[kk]));
7250  }
7251  PrintS("------------------------------\n");
7252 #endif
7253  return FALSE;
7254 }
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
void pWrite(poly p)
Definition: polys.h:291
int k
Definition: cfEzgcd.cc:93
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrrewcrit
Definition: kutil.h:360
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:302
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int sl
Definition: kutil.h:346

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

11081 {
11082  if(!nCoeff_is_Ring_Z(currRing->cf))
11083  return;
11084  poly p,pp;
11085  for(int j = 0; j<=strat->sl; j++)
11086  {
11087  if((strat->S[j]!=NULL)&&(pNext(strat->S[j]) == NULL))
11088  {
11089  for(int i = 0; i<=strat->sl; i++)
11090  {
11091  if((i != j) && (strat->S[i] != NULL))
11092  {
11093  p = strat->S[i];
11094  if(pLmDivisibleBy(strat->S[j], p))
11095  {
11096  number dummy = n_IntMod(p->coef, strat->S[j]->coef, currRing->cf);
11097  p_SetCoeff(p,dummy,currRing);
11098  }
11099  pp = pNext(p);
11100  if((pp == NULL) && (nIsZero(p->coef)))
11101  {
11102  deleteInS(i, strat);
11103  }
11104  else
11105  {
11106  while(pp != NULL)
11107  {
11108  if(pLmDivisibleBy(strat->S[j], pp))
11109  {
11110  number dummy = n_IntMod(pp->coef, strat->S[j]->coef, currRing->cf);
11111  p_SetCoeff(pp,dummy,currRing);
11112  if(nIsZero(pp->coef))
11113  {
11114  pLmDelete(&pNext(p));
11115  pp = pNext(p);
11116  }
11117  else
11118  {
11119  p = pp;
11120  pp = pNext(p);
11121  }
11122  }
11123  else
11124  {
11125  p = pp;
11126  pp = pNext(p);
11127  }
11128  }
11129  }
11130  if(strat->S[i]!= NULL && nIsZero(pGetCoeff(strat->S[i])))
11131  {
11132  if(pNext(strat->S[i]) == NULL)
11133  strat->S[i]=NULL;
11134  else
11135  strat->S[i]=pNext(strat->S[i]);
11136  }
11137  }
11138  }
11139  //idPrint(strat->Shdl);
11140  }
11141  }
11142  //idSkipZeroes(strat->Shdl);
11143 }
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:302
#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:346
polyrec * poly
Definition: hilb.h:10

§ getIndexRng()

int getIndexRng ( long  coeff)
inline

Definition at line 6602 of file kutil.cc.

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

§ HEckeTest()

void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 482 of file kutil.cc.

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

§ ind2()

long ind2 ( long  arg)

Definition at line 4197 of file kutil.cc.

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

§ ind_fact_2()

long ind_fact_2 ( long  arg)

Definition at line 4209 of file kutil.cc.

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

§ initBuchMora()

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

Definition at line 9987 of file kutil.cc.

9988 {
9989  strat->interpt = BTEST1(OPT_INTERRUPT);
9990  strat->kHEdge=NULL;
9992  /*- creating temp data structures------------------- -*/
9993  strat->cp = 0;
9994  strat->c3 = 0;
9995  strat->tail = pInit();
9996  /*- set s -*/
9997  strat->sl = -1;
9998  /*- set L -*/
9999  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10000  strat->Ll = -1;
10001  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10002  /*- set B -*/
10003  strat->Bmax = setmaxL;
10004  strat->Bl = -1;
10005  strat->B = initL();
10006  /*- set T -*/
10007  strat->tl = -1;
10008  strat->tmax = setmaxT;
10009  strat->T = initT();
10010  strat->R = initR();
10011  strat->sevT = initsevT();
10012  /*- init local data struct.---------------------------------------- -*/
10013  strat->P.ecart=0;
10014  strat->P.length=0;
10015  strat->P.pLength=0;
10017  {
10018  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10019  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10020  }
10022  {
10023  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10024  }
10025  else
10026  {
10027  if(TEST_OPT_SB_1)
10028  {
10029  int i;
10030  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10031  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10032  {
10033  P->m[i-strat->newIdeal] = F->m[i];
10034  F->m[i] = NULL;
10035  }
10036  initSSpecial(F,Q,P,strat);
10037  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10038  {
10039  F->m[i] = P->m[i-strat->newIdeal];
10040  P->m[i-strat->newIdeal] = NULL;
10041  }
10042  idDelete(&P);
10043  }
10044  else
10045  {
10046  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
10047  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
10048  }
10049  }
10050  strat->fromT = FALSE;
10052  if ((!TEST_OPT_SB_1)
10053  || (rField_is_Ring(currRing))
10054  )
10055  {
10056  updateS(TRUE,strat);
10057  }
10058  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10059  strat->fromQ=NULL;
10060  assume(kTest_TS(strat));
10061 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8024
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:101
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:370
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:378
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8430
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:375
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8895
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:420
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63

§ initBuchMoraCrit()

void initBuchMoraCrit ( kStrategy  strat)

Definition at line 9663 of file kutil.cc.

9664 {
9666  strat->chainCrit=chainCritNormal;
9667  if (TEST_OPT_SB_1)
9668  strat->chainCrit=chainCritOpt_1;
9669 #ifdef HAVE_RINGS
9670  if (rField_is_Ring(currRing))
9671  {
9673  strat->chainCrit=chainCritRing;
9674  }
9675 #endif
9676 #ifdef HAVE_RATGRING
9677  if (rIsRatGRing(currRing))
9678  {
9679  strat->chainCrit=chainCritPart;
9680  /* enterOnePairNormal get rational part in it */
9681  }
9682 #endif
9683  if (TEST_OPT_IDLIFT /* i.e. also strat->syzComp==1 */
9684  && (!rIsPluralRing(currRing)))
9686 
9687  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9688  strat->Gebauer = strat->homog || strat->sugarCrit;
9689  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9690  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9691  strat->pairtest = NULL;
9692  /* alway use tailreduction, except:
9693  * - in local rings, - in lex order case, -in ring over extensions */
9695  //if(rHasMixedOrdering(currRing)==2)
9696  //{
9697  // strat->noTailReduction =TRUE;
9698  //}
9699 
9700 #ifdef HAVE_PLURAL
9701  // and r is plural_ring
9702  // hence this holds for r a rational_plural_ring
9703  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9704  { //or it has non-quasi-comm type... later
9705  strat->sugarCrit = FALSE;
9706  strat->Gebauer = FALSE;
9707  strat->honey = FALSE;
9708  }
9709 #endif
9710 
9711  // Coefficient ring?
9712  if (rField_is_Ring(currRing))
9713  {
9714  strat->sugarCrit = FALSE;
9715  strat->Gebauer = FALSE ;
9716  strat->honey = FALSE;
9717  }
9718  #ifdef KDEBUG
9719  if (TEST_OPT_DEBUG)
9720  {
9721  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9722  else PrintS("ideal/module is not homogeneous\n");
9723  }
9724  #endif
9725 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:376
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3250
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:373
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1934
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:286
BOOLEAN homog
Definition: kutil.h:371
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4024
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:377
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:376
#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:287
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
#define TEST_OPT_IDLIFT
Definition: options.h:123
#define TEST_OPT_SB_1
Definition: options.h:113
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3463
void enterOnePairLift(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2217
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538

§ initBuchMoraPos()

void initBuchMoraPos ( kStrategy  strat)

Definition at line 9814 of file kutil.cc.

9815 {
9817  {
9818  if (strat->honey)
9819  {
9820  strat->posInL = posInL15;
9821  // ok -- here is the deal: from my experiments for Singular-2-0
9822  // I conclude that that posInT_EcartpLength is the best of
9823  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9824  // see the table at the end of this file
9825  if (TEST_OPT_OLDSTD)
9826  strat->posInT = posInT15;
9827  else
9828  strat->posInT = posInT_EcartpLength;
9829  }
9830  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9831  {
9832  strat->posInL = posInL11;
9833  strat->posInT = posInT11;
9834  }
9835  else if (TEST_OPT_INTSTRATEGY)
9836  {
9837  strat->posInL = posInL11;
9838  strat->posInT = posInT11;
9839  }
9840  else
9841  {
9842  strat->posInL = posInL0;
9843  strat->posInT = posInT0;
9844  }
9845  //if (strat->minim>0) strat->posInL =posInLSpecial;
9846  if (strat->homog)
9847  {
9848  strat->posInL = posInL110;
9849  strat->posInT = posInT110;
9850  }
9851  }
9852  else
9853  {
9854  if (strat->homog)
9855  {
9856  strat->posInL = posInL11;
9857  strat->posInT = posInT11;
9858  }
9859  else
9860  {
9861  if ((currRing->order[0]==ringorder_c)
9862  ||(currRing->order[0]==ringorder_C))
9863  {
9864  strat->posInL = posInL17_c;
9865  strat->posInT = posInT17_c;
9866  }
9867  else
9868  {
9869  strat->posInL = posInL17;
9870  strat->posInT = posInT17;
9871  }
9872  }
9873  }
9874  if (strat->minim>0) strat->posInL =posInLSpecial;
9875  // for further tests only
9876  if ((BTEST1(11)) || (BTEST1(12)))
9877  strat->posInL = posInL11;
9878  else if ((BTEST1(13)) || (BTEST1(14)))
9879  strat->posInL = posInL13;
9880  else if ((BTEST1(15)) || (BTEST1(16)))
9881  strat->posInL = posInL15;
9882  else if ((BTEST1(17)) || (BTEST1(18)))
9883  strat->posInL = posInL17;
9884  if (BTEST1(11))
9885  strat->posInT = posInT11;
9886  else if (BTEST1(13))
9887  strat->posInT = posInT13;
9888  else if (BTEST1(15))
9889  strat->posInT = posInT15;
9890  else if ((BTEST1(17)))
9891  strat->posInT = posInT17;
9892  else if ((BTEST1(19)))
9893  strat->posInT = posInT19;
9894  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
9895  strat->posInT = posInT1;
9897 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:376
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6898
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
#define BTEST1(a)
Definition: options.h:32
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9798
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
BOOLEAN homog
Definition: kutil.h:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

§ initBuchMoraPosRing()

void initBuchMoraPosRing ( kStrategy  strat)

Definition at line 9900 of file kutil.cc.

9901 {
9903  {
9904  if (strat->honey)
9905  {
9906  strat->posInL = posInL15Ring;
9907  // ok -- here is the deal: from my experiments for Singular-2-0
9908  // I conclude that that posInT_EcartpLength is the best of
9909  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
9910  // see the table at the end of this file
9911  if (TEST_OPT_OLDSTD)
9912  strat->posInT = posInT15Ring;
9913  else
9914  strat->posInT = posInT_EcartpLength;
9915  }
9916  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
9917  {
9918  strat->posInL = posInL11Ring;
9919  strat->posInT = posInT11;
9920  }
9921  else if (TEST_OPT_INTSTRATEGY)
9922  {
9923  strat->posInL = posInL11Ring;
9924  strat->posInT = posInT11;
9925  }
9926  else
9927  {
9928  strat->posInL = posInL0Ring;
9929  strat->posInT = posInT0;
9930  }
9931  //if (strat->minim>0) strat->posInL =posInLSpecial;
9932  if (strat->homog)
9933  {
9934  strat->posInL = posInL110Ring;
9935  strat->posInT = posInT110Ring;
9936  }
9937  }
9938  else
9939  {
9940  if (strat->homog)
9941  {
9942  //printf("\nHere 3\n");
9943  strat->posInL = posInL11Ring;
9944  strat->posInT = posInT11Ring;
9945  }
9946  else
9947  {
9948  if ((currRing->order[0]==ringorder_c)
9949  ||(currRing->order[0]==ringorder_C))
9950  {
9951  strat->posInL = posInL17_cRing;
9952  strat->posInT = posInT17_cRing;
9953  }
9954  else
9955  {
9956  strat->posInL = posInL11Ringls;
9957  strat->posInT = posInT17Ring;
9958  }
9959  }
9960  }
9961  if (strat->minim>0) strat->posInL =posInLSpecial;
9962  // for further tests only
9963  if ((BTEST1(11)) || (BTEST1(12)))
9964  strat->posInL = posInL11Ring;
9965  else if ((BTEST1(13)) || (BTEST1(14)))
9966  strat->posInL = posInL13;
9967  else if ((BTEST1(15)) || (BTEST1(16)))
9968  strat->posInL = posInL15Ring;
9969  else if ((BTEST1(17)) || (BTEST1(18)))
9970  strat->posInL = posInL17Ring;
9971  if (BTEST1(11))
9972  strat->posInT = posInT11Ring;
9973  else if (BTEST1(13))
9974  strat->posInT = posInT13;
9975  else if (BTEST1(15))
9976  strat->posInT = posInT15Ring;
9977  else if ((BTEST1(17)))
9978  strat->posInT = posInT17Ring;
9979  else if ((BTEST1(19)))
9980  strat->posInT = posInT19;
9981  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
9982  strat->posInT = posInT1;
9984 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:376
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6857
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6942
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5768
#define BTEST1(a)
Definition: options.h:32
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7056
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:9798
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5404
BOOLEAN homog
Definition: kutil.h:371
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5440
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5870
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5599
int posInL0Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6169
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5977
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

§ initBuchMoraShift()

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

Definition at line 11980 of file kutil.cc.

11981 {
11982  strat->interpt = BTEST1(OPT_INTERRUPT);
11983  strat->kHEdge=NULL;
11985  /*- creating temp data structures------------------- -*/
11986  strat->cp = 0;
11987  strat->c3 = 0;
11988  strat->cv = 0;
11989  strat->tail = pInit();
11990  /*- set s -*/
11991  strat->sl = -1;
11992  /*- set L -*/
11993  strat->Lmax = setmaxL;
11994  strat->Ll = -1;
11995  strat->L = initL();
11996  /*- set B -*/
11997  strat->Bmax = setmaxL;
11998  strat->Bl = -1;
11999  strat->B = initL();
12000  /*- set T -*/
12001  strat->tl = -1;
12002  strat->tmax = setmaxT;
12003  strat->T = initT();
12004  strat->R = initR();
12005  strat->sevT = initsevT();
12006  /*- init local data struct.---------------------------------------- -*/
12007  strat->P.ecart=0;
12008  strat->P.length=0;
12010  {
12011  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
12012  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
12013  }
12015  {
12016  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12017  }
12018  {
12019  if(TEST_OPT_SB_1)
12020  {
12021  int i;
12022  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
12023  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12024  {
12025  P->m[i-strat->newIdeal] = F->m[i];
12026  F->m[i] = NULL;
12027  }
12028  initSSpecial(F,Q,P,strat);
12029  for (i=strat->newIdeal;i<IDELEMS(F);i++)
12030  {
12031  F->m[i] = P->m[i-strat->newIdeal];
12032  P->m[i-strat->newIdeal] = NULL;
12033  }
12034  idDelete(&P);
12035  }
12036  else
12037  {
12038  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
12039  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
12040  }
12041  }
12042  strat->fromT = FALSE;
12043  if (!TEST_OPT_SB_1)
12044  {
12045  /* the only change: we do not fill the set T*/
12046  if(!rField_is_Ring(currRing)) updateS(FALSE,strat);
12047  }
12048  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
12049  strat->fromQ=NULL;
12050  /* more changes: fill the set T with all the shifts of elts of S*/
12051  /* is done by other procedure */
12052 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int c3
Definition: kutil.h:345
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
int cv
Definition: kutil.h:368
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8024
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:370
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:378
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8430
#define setmaxT
Definition: kutil.h:32
intset fromQ
Definition: kutil.h:317
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:375
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8895
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:420
int newIdeal
Definition: kutil.h:355
ideal Shdl
Definition: kutil.h:299
#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 int 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 int 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:123

§ initenterpairs()

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

Definition at line 3827 of file kutil.cc.

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

§ initenterpairsShift()

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

Definition at line 12523 of file kutil.cc.

12524 {
12525  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
12526  // atR = -1;
12527  if ((strat->syzComp==0)
12528  || (pGetComp(h)<=strat->syzComp))
12529  {
12530  int j;
12531  BOOLEAN new_pair=FALSE;
12532 
12533  if (pGetComp(h)==0)
12534  {
12535  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
12536  if ((isFromQ)&&(strat->fromQ!=NULL))
12537  {
12538  for (j=0; j<=k; j++)
12539  {
12540  if (!strat->fromQ[j])
12541  {
12542  new_pair=TRUE;
12543  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12544  // other side pairs:
12545  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12546  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12547  }
12548  }
12549  }
12550  else
12551  {
12552  new_pair=TRUE;
12553  for (j=0; j<=k; j++)
12554  {
12555  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
12556  // other side pairs
12557  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12558  }
12559  /* HERE we put (h, s*h) pairs */
12560  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
12561  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12562  }
12563  }
12564  else
12565  {
12566  for (j=0; j<=k; j++)
12567  {
12568  if ((pGetComp(h)==pGetComp(strat->S[j]))
12569  || (pGetComp(strat->S[j])==0))
12570  {
12571  new_pair=TRUE;
12572  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
12573  // other side pairs
12574  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
12575  //Print("j:%d, Ll:%d\n",j,strat->Ll);
12576  }
12577  }
12578  /* HERE we put (h, s*h) pairs */
12579  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
12580  }
12581 
12582  if (new_pair)
12583  {
12584  strat->chainCrit(h,ecart,strat);
12585  }
12586 
12587  }
12588 }
int syzComp
Definition: kutil.h:352
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
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:317
polyset S
Definition: kutil.h:302
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12059
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:12134

§ initenterpairsSig()

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

Definition at line 3897 of file kutil.cc.

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

§ initenterpairsSigRing()

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

Definition at line 3957 of file kutil.cc.

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

§ initenterstrongPairs()

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

Definition at line 4611 of file kutil.cc.

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

§ initenterstrongPairsSig()

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

Definition at line 4633 of file kutil.cc.

4634 {
4635  const int iCompH = pGetComp(h);
4636  if (!nIsOne(pGetCoeff(h)))
4637  {
4638  int j;
4639 
4640  for (j=0; j<=k && !strat->sigdrop; j++)
4641  {
4642  // Print("j:%d, Ll:%d\n",j,strat->Ll);
4643 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
4644 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
4645  if (((iCompH == pGetComp(strat->S[j]))
4646  || (0 == pGetComp(strat->S[j])))
4647  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
4648  {
4649  enterOneStrongPolySig(j,h,hSig,ecart,isFromQ,strat, atR);
4650  }
4651  }
4652  }
4653 }
int syzComp
Definition: kutil.h:352
bool sigdrop
Definition: kutil.h:358
#define nIsOne(n)
Definition: numbers.h:25
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
#define pGetComp(p)
Component.
Definition: polys.h:37
int j
Definition: myNF.cc:70
END_NAMESPACE BEGIN_NAMESPACE_SINGULARXX ideal poly int syzComp
Definition: myNF.cc:291
BOOLEAN enterOneStrongPolySig(int i, poly p, poly sig, int, int, kStrategy strat, int atR)
Definition: kutil.cc:1708
polyset S
Definition: kutil.h:302
static Poly * h
Definition: janet.cc:978

§ initenterzeropairsRing()

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

Definition at line 4479 of file kutil.cc.

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

§ initHilbCrit()

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

Definition at line 9645 of file kutil.cc.

9646 {
9647 
9648  //if the ordering is local, then hilb criterion
9649  //can be used also if the ideal is not homogenous
9651  {
9653  *hilb=NULL;
9654  else
9655  return;
9656  }
9657  if (strat->homog!=isHomog)
9658  {
9659  *hilb=NULL;
9660  }
9661 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
#define FALSE
Definition: auxiliary.h:97
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:371
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:748
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10

§ initPairtest()

void initPairtest ( kStrategy  strat)

Definition at line 672 of file kutil.cc.

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

§ initS()

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

Definition at line 7928 of file kutil.cc.

7929 {
7930  int i,pos;
7931 
7932  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7933  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
7934  strat->ecartS=initec(i);
7935  strat->sevS=initsevS(i);
7936  strat->S_2_R=initS_2_R(i);
7937  strat->fromQ=NULL;
7938  strat->Shdl=idInit(i,F->rank);
7939  strat->S=strat->Shdl->m;
7940  /*- put polys into S -*/
7941  if (Q!=NULL)
7942  {
7943  strat->fromQ=initec(i);
7944  memset(strat->fromQ,0,i*sizeof(int));
7945  for (i=0; i<IDELEMS(Q); i++)
7946  {
7947  if (Q->m[i]!=NULL)
7948  {
7949  LObject h;
7950  h.p = pCopy(Q->m[i]);
7952  {
7953  //pContent(h.p);
7954  h.pCleardenom(); // also does a pContent
7955  }
7956  else
7957  {
7958  h.pNorm();
7959  }
7961  {
7962  deleteHC(&h, strat);
7963  }
7964  if (h.p!=NULL)
7965  {
7966  strat->initEcart(&h);
7967  if (strat->sl==-1)
7968  pos =0;
7969  else
7970  {
7971  pos = posInS(strat,strat->sl,h.p,h.ecart);
7972  }
7973  h.sev = pGetShortExpVector(h.p);
7974  strat->enterS(h,pos,strat,-1);
7975  strat->fromQ[pos]=1;
7976  }
7977  }
7978  }
7979  }
7980  for (i=0; i<IDELEMS(F); i++)
7981  {
7982  if (F->m[i]!=NULL)
7983  {
7984  LObject h;
7985  h.p = pCopy(F->m[i]);
7987  {
7988  cancelunit(&h); /*- tries to cancel a unit -*/
7989  deleteHC(&h, strat);
7990  }
7991  if (h.p!=NULL)
7992  // do not rely on the input being a SB!
7993  {
7995  {
7996  //pContent(h.p);
7997  h.pCleardenom(); // also does a pContent
7998  }
7999  else
8000  {
8001  h.pNorm();
8002  }
8003  strat->initEcart(&h);
8004  if (strat->sl==-1)
8005  pos =0;
8006  else
8007  pos = posInS(strat,strat->sl,h.p,h.ecart);
8008  h.sev = pGetShortExpVector(h.p);
8009  strat->enterS(h,pos,strat,-1);
8010  }
8011  }
8012  }
8013  /*- test, if a unit is in F -*/
8014  if ((strat->sl>=0)
8015 #ifdef HAVE_RINGS
8016  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
8017 #endif
8018  && pIsConstant(strat->S[0]))
8019  {
8020  while (strat->sl>0) deleteInS(strat->sl,strat);
8021  }
8022 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
static FORCE_INLINE BOOLEAN n_IsUnit(number n, const coeffs r)
TRUE iff n has a multiplicative inverse in the given coeff field/ring r.
Definition: coeffs.h:519
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
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:276
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:317
#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:282
#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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
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 10183 of file kutil.cc.

10184 {
10185  strat->interpt = BTEST1(OPT_INTERRUPT);
10186  strat->kHEdge=NULL;
10188  /*- creating temp data structures------------------- -*/
10189  strat->cp = 0;
10190  strat->c3 = 0;
10191  strat->tail = pInit();
10192  /*- set s -*/
10193  strat->sl = -1;
10194  /*- set ps -*/
10195  strat->syzl = -1;
10196  /*- set L -*/
10197  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
10198  strat->Ll = -1;
10199  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
10200  /*- set B -*/
10201  strat->Bmax = setmaxL;
10202  strat->Bl = -1;
10203  strat->B = initL();
10204  /*- set T -*/
10205  strat->tl = -1;
10206  strat->tmax = setmaxT;
10207  strat->T = initT();
10208  strat->R = initR();
10209  strat->sevT = initsevT();
10210  /*- init local data struct.---------------------------------------- -*/
10211  strat->P.ecart=0;
10212  strat->P.length=0;
10214  {
10215  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
10216  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
10217  }
10219  {
10220  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10221  }
10222  else
10223  {
10224  if(TEST_OPT_SB_1)
10225  {
10226  int i;
10227  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
10228  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10229  {
10230  P->m[i-strat->newIdeal] = F->m[i];
10231  F->m[i] = NULL;
10232  }
10233  initSSpecialSba(F,Q,P,strat);
10234  for (i=strat->newIdeal;i<IDELEMS(F);i++)
10235  {
10236  F->m[i] = P->m[i-strat->newIdeal];
10237  P->m[i-strat->newIdeal] = NULL;
10238  }
10239  idDelete(&P);
10240  }
10241  else
10242  {
10243  initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
10244  }
10245  }
10246  strat->fromT = FALSE;
10247  if (!TEST_OPT_SB_1)
10248  {
10249  if(!rField_is_Ring(currRing)) updateS(TRUE,strat);
10250  }
10251  //if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
10252  //strat->fromQ=NULL;
10253  assume(kTest_TS(strat));
10254 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:29
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:325
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
int c3
Definition: kutil.h:345
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
int Bl
Definition: kutil.h:350
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:101
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:8575
unsigned long * sevT
Definition: kutil.h:321
int ak
Definition: kutil.h:351
#define setmaxLinc
Definition: kutil.h:30
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:8123
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:350
BOOLEAN interpt
Definition: kutil.h:370
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:378
#define setmaxT
Definition: kutil.h:32
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:403
#define pSetComp(p, v)
Definition: polys.h:38
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
#define IDELEMS(i)
Definition: simpleideals.h:24
int tmax
Definition: kutil.h:348
int cp
Definition: kutil.h:345
BOOLEAN kHEdgeFound
Definition: kutil.h:375
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
#define TEST_OPT_SB_1
Definition: options.h:113
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8895
int sl
Definition: kutil.h:346
TSet T
Definition: kutil.h:322
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:420
int newIdeal
Definition: kutil.h:355
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:347

§ initSbaCrit()

void initSbaCrit ( kStrategy  strat)

Definition at line 9727 of file kutil.cc.

9728 {
9729  //strat->enterOnePair=enterOnePairNormal;
9731  //strat->chainCrit=chainCritNormal;
9732  strat->chainCrit = chainCritSig;
9733  /******************************************
9734  * rewCrit1 and rewCrit2 are already set in
9735  * kSba() in kstd1.cc
9736  *****************************************/
9737  //strat->rewCrit1 = faugereRewCriterion;
9738  if (strat->sbaOrder == 1)
9739  {
9740  strat->syzCrit = syzCriterionInc;
9741  }
9742  else
9743  {
9744  strat->syzCrit = syzCriterion;
9745  }
9746 #ifdef HAVE_RINGS
9747  if (rField_is_Ring(currRing))
9748  {
9750  strat->chainCrit=chainCritRing;
9751  }
9752 #endif
9753 #ifdef HAVE_RATGRING
9754  if (rIsRatGRing(currRing))
9755  {
9756  strat->chainCrit=chainCritPart;
9757  /* enterOnePairNormal get rational part in it */
9758  }
9759 #endif
9760 
9761  strat->sugarCrit = TEST_OPT_SUGARCRIT;
9762  strat->Gebauer = strat->homog || strat->sugarCrit;
9763  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
9764  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
9765  strat->pairtest = NULL;
9766  /* alway use tailreduction, except:
9767  * - in local rings, - in lex order case, -in ring over extensions */
9770 
9771 #ifdef HAVE_PLURAL
9772  // and r is plural_ring
9773  // hence this holds for r a rational_plural_ring
9774  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
9775  { //or it has non-quasi-comm type... later
9776  strat->sugarCrit = FALSE;
9777  strat->Gebauer = FALSE;
9778  strat->honey = FALSE;
9779  }
9780 #endif
9781 
9782  // Coefficient ring?
9783  if (rField_is_Ring(currRing))
9784  {
9785  strat->sugarCrit = FALSE;
9786  strat->Gebauer = FALSE ;
9787  strat->honey = FALSE;
9788  }
9789  #ifdef KDEBUG
9790  if (TEST_OPT_DEBUG)
9791  {
9792  if (strat->homog) PrintS("ideal/module is homogeneous\n");
9793  else PrintS("ideal/module is not homogeneous\n");
9794  }
9795  #endif
9796 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:376
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:415
BOOLEAN * pairtest
Definition: kutil.h:331
BOOLEAN z2homog
Definition: kutil.h:373
#define TRUE
Definition: auxiliary.h:101
#define TEST_OPT_DEBUG
Definition: options.h:103
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:3479
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1934
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:288
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:286
BOOLEAN homog
Definition: kutil.h:371
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:4024
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:377
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
unsigned sbaOrder
Definition: kutil.h:312
void PrintS(const char *s)
Definition: reporter.cc:284
BOOLEAN sugarCrit
Definition: kutil.h:376
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:748
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7123
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:7161
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1276
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3538

§ initSbaPos()

void initSbaPos ( kStrategy  strat)

Definition at line 10081 of file kutil.cc.

10082 {
10084  {
10085  if (strat->honey)
10086  {
10087  strat->posInL = posInL15;
10088  // ok -- here is the deal: from my experiments for Singular-2-0
10089  // I conclude that that posInT_EcartpLength is the best of
10090  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
10091  // see the table at the end of this file
10092  if (TEST_OPT_OLDSTD)
10093  strat->posInT = posInT15;
10094  else
10095  strat->posInT = posInT_EcartpLength;
10096  }
10097  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
10098  {
10099  strat->posInL = posInL11;
10100  strat->posInT = posInT11;
10101  }
10102  else if (TEST_OPT_INTSTRATEGY)
10103  {
10104  strat->posInL = posInL11;
10105  strat->posInT = posInT11;
10106  }
10107  else
10108  {
10109  strat->posInL = posInL0;
10110  strat->posInT = posInT0;
10111  }
10112  //if (strat->minim>0) strat->posInL =posInLSpecial;
10113  if (strat->homog)
10114  {
10115  strat->posInL = posInL110;
10116  strat->posInT = posInT110;
10117  }
10118  }
10119  else
10120  {
10121  if (strat->homog)
10122  {
10123  strat->posInL = posInL11;
10124  strat->posInT = posInT11;
10125  }
10126  else
10127  {
10128  if ((currRing->order[0]==ringorder_c)
10129  ||(currRing->order[0]==ringorder_C))
10130  {
10131  strat->posInL = posInL17_c;
10132  strat->posInT = posInT17_c;
10133  }
10134  else
10135  {
10136  strat->posInL = posInL17;
10137  strat->posInT = posInT17;
10138  }
10139  }
10140  }
10141  if (strat->minim>0) strat->posInL =posInLSpecial;
10142  // for further tests only
10143  if ((BTEST1(11)) || (BTEST1(12)))
10144  strat->posInL = posInL11;
10145  else if ((BTEST1(13)) || (BTEST1(14)))
10146  strat->posInL = posInL13;
10147  else if ((BTEST1(15)) || (BTEST1(16)))
10148  strat->posInL = posInL15;
10149  else if ((BTEST1(17)) || (BTEST1(18)))
10150  strat->posInL = posInL17;
10151  if (BTEST1(11))
10152  strat->posInT = posInT11;
10153  else if (BTEST1(13))
10154  strat->posInT = posInT13;
10155  else if (BTEST1(15))
10156  strat->posInT = posInT15;
10157  else if ((BTEST1(17)))
10158  strat->posInT = posInT17;
10159  else if ((BTEST1(19)))
10160  strat->posInT = posInT19;
10161  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
10162  strat->posInT = posInT1;
10163  if (rField_is_Ring(currRing))
10164  {
10165  strat->posInL = posInL11Ring;
10166  if(rHasLocalOrMixedOrdering(currRing) && currRing->pLexOrder == TRUE)
10167  strat->posInL = posInL11Ringls;
10168  strat->posInT = posInT11;
10169  }
10170  strat->posInLDependsOnLength = FALSE;
10171  strat->posInLSba = posInLSig;
10172  //strat->posInL = posInLSig;
10173  strat->posInL = posInLF5C;
10174  /*
10175  if (rField_is_Ring(currRing))
10176  {
10177  strat->posInLSba = posInLSigRing;
10178  strat->posInL = posInL11Ring;
10179  }*/
10180  //strat->posInT = posInTSig;
10181 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
BOOLEAN honey
Definition: kutil.h:376
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6898
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
#define FALSE
Definition: auxiliary.h:97
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:101
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:6389
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
int minim
Definition: kutil.h:356
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6201
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
BOOLEAN homog
Definition: kutil.h:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
#define TEST_OPT_OLDSTD
Definition: options.h:117
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646

§ initsevS()

static unsigned long* initsevS ( const int  maxnr)
inlinestatic

Definition at line 522 of file kutil.cc.

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

§ initSL()

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

Definition at line 8024 of file kutil.cc.

8025 {
8026  int i,pos;
8027 
8028  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8029  else i=setmaxT;
8030  strat->ecartS=initec(i);
8031  strat->sevS=initsevS(i);
8032  strat->S_2_R=initS_2_R(i);
8033  strat->fromQ=NULL;
8034  strat->Shdl=idInit(i,F->rank);
8035  strat->S=strat->Shdl->m;
8036  /*- put polys into S -*/
8037  if (Q!=NULL)
8038  {
8039  strat->fromQ=initec(i);
8040  memset(strat->fromQ,0,i*sizeof(int));
8041  for (i=0; i<IDELEMS(Q); i++)
8042  {
8043  if (Q->m[i]!=NULL)
8044  {
8045  LObject h;
8046  h.p = pCopy(Q->m[i]);
8048  {
8049  deleteHC(&h,strat);
8050  }
8052  {
8053  //pContent(h.p);
8054  h.pCleardenom(); // also does a pContent
8055  }
8056  else
8057  {
8058  h.pNorm();
8059  }
8060  if (h.p!=NULL)
8061  {
8062  strat->initEcart(&h);
8063  if (strat->sl==-1)
8064  pos =0;
8065  else
8066  {
8067  pos = posInS(strat,strat->sl,h.p,h.ecart);
8068  }
8069  h.sev = pGetShortExpVector(h.p);
8070  strat->enterS(h,pos,strat,-1);
8071  strat->fromQ[pos]=1;
8072  }
8073  }
8074  }
8075  }
8076  for (i=0; i<IDELEMS(F); i++)
8077  {
8078  if (F->m[i]!=NULL)
8079  {
8080  LObject h;
8081  h.p = pCopy(F->m[i]);
8082  if (h.p!=NULL)
8083  {
8085  {
8086  cancelunit(&h); /*- tries to cancel a unit -*/
8087  deleteHC(&h, strat);
8088  }
8089  if (h.p!=NULL)
8090  {
8092  {
8093  //pContent(h.p);
8094  h.pCleardenom(); // also does a pContent
8095  }
8096  else
8097  {
8098  h.pNorm();
8099  }
8100  strat->initEcart(&h);
8101  if (strat->Ll==-1)
8102  pos =0;
8103  else
8104  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
8105  h.sev = pGetShortExpVector(h.p);
8106  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8107  }
8108  }
8109  }
8110  }
8111  /*- test, if a unit is in F -*/
8112 
8113  if ((strat->Ll>=0)
8114 #ifdef HAVE_RINGS
8115  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8116 #endif
8117  && pIsConstant(strat->L[strat->Ll].p))
8118  {
8119  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8120  }
8121 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
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:349
int * S_2_R
Definition: kutil.h:340
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:276
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:317
#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:282
#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:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
ideal Shdl
Definition: kutil.h:299
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 8123 of file kutil.cc.

8124 {
8125  int i,pos;
8126  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8127  else i=setmaxT;
8128  strat->ecartS = initec(i);
8129  strat->sevS = initsevS(i);
8130  strat->sevSig = initsevS(i);
8131  strat->S_2_R = initS_2_R(i);
8132  strat->fromQ = NULL;
8133  strat->Shdl = idInit(i,F->rank);
8134  strat->S = strat->Shdl->m;
8135  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
8136  if (strat->sbaOrder != 1)
8137  {
8138  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
8139  strat->sevSyz = initsevS(i);
8140  strat->syzmax = i;
8141  strat->syzl = 0;
8142  }
8143  /*- put polys into S -*/
8144  if (Q!=NULL)
8145  {
8146  strat->fromQ=initec(i);
8147  memset(strat->fromQ,0,i*sizeof(int));
8148  for (i=0; i<IDELEMS(Q); i++)
8149  {
8150  if (Q->m[i]!=NULL)
8151  {
8152  LObject h;
8153  h.p = pCopy(Q->m[i]);
8155  {
8156  deleteHC(&h,strat);
8157  }
8159  {
8160  //pContent(h.p);
8161  h.pCleardenom(); // also does a pContent
8162  }
8163  else
8164  {
8165  h.pNorm();
8166  }
8167  if (h.p!=NULL)
8168  {
8169  strat->initEcart(&h);
8170  if (strat->sl==-1)
8171  pos =0;
8172  else
8173  {
8174  pos = posInS(strat,strat->sl,h.p,h.ecart);
8175  }
8176  h.sev = pGetShortExpVector(h.p);
8177  strat->enterS(h,pos,strat,-1);
8178  strat->fromQ[pos]=1;
8179  }
8180  }
8181  }
8182  }
8183  for (i=0; i<IDELEMS(F); i++)
8184  {
8185  if (F->m[i]!=NULL)
8186  {
8187  LObject h;
8188  h.p = pCopy(F->m[i]);
8189  h.sig = pOne();
8190  //h.sig = pInit();
8191  //p_SetCoeff(h.sig,nInit(1),currRing);
8192  p_SetComp(h.sig,i+1,currRing);
8193  // if we are working with the Schreyer order we generate it
8194  // by multiplying the initial signatures with the leading monomial
8195  // of the corresponding initial polynomials generating the ideal
8196  // => we can keep the underlying monomial order and get a Schreyer
8197  // order without any bigger overhead
8198  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
8199  {
8200  p_ExpVectorAdd (h.sig,F->m[i],currRing);
8201  }
8202  h.sevSig = pGetShortExpVector(h.sig);
8203 #ifdef DEBUGF5
8204  pWrite(h.p);
8205  pWrite(h.sig);
8206 #endif
8207  if (h.p!=NULL)
8208  {
8210  {
8211  cancelunit(&h); /*- tries to cancel a unit -*/
8212  deleteHC(&h, strat);
8213  }
8214  if (h.p!=NULL)
8215  {
8217  {
8218  //pContent(h.p);
8219  h.pCleardenom(); // also does a pContent
8220  }
8221  else
8222  {
8223  h.pNorm();
8224  }
8225  strat->initEcart(&h);
8226  if (strat->Ll==-1)
8227  pos =0;
8228  else
8229  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
8230  h.sev = pGetShortExpVector(h.p);
8231  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
8232  }
8233  }
8234  /*
8235  if (strat->sbaOrder != 1)
8236  {
8237  for(j=0;j<i;j++)
8238  {
8239  strat->syz[ctr] = pCopy(F->m[j]);
8240  p_SetCompP(strat->syz[ctr],i+1,currRing);
8241  // add LM(F->m[i]) to the signature to get a Schreyer order
8242  // without changing the underlying polynomial ring at all
8243  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
8244  // since p_Add_q() destroys all input
8245  // data we need to recreate help
8246  // each time
8247  poly help = pCopy(F->m[i]);
8248  p_SetCompP(help,j+1,currRing);
8249  pWrite(strat->syz[ctr]);
8250  pWrite(help);
8251  printf("%d\n",pLmCmp(strat->syz[ctr],help));
8252  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
8253  printf("%d. SYZ ",ctr);
8254  pWrite(strat->syz[ctr]);
8255  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
8256  ctr++;
8257  }
8258  strat->syzl = ps;
8259  }
8260  */
8261  }
8262  }
8263  /*- test, if a unit is in F -*/
8264 
8265  if ((strat->Ll>=0)
8266 #ifdef HAVE_RINGS
8267  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
8268 #endif
8269  && pIsConstant(strat->L[strat->Ll].p))
8270  {
8271  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
8272  }
8273 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
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:347
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int * S_2_R
Definition: kutil.h:340
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:278
void pWrite(poly p)
Definition: polys.h:291
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:332
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1210
#define Q
Definition: sirandom.c:25
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1148
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:317
#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:282
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
#define pOne()
Definition: polys.h:298
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
LSet L
Definition: kutil.h:323
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
unsigned long * sevS
Definition: kutil.h:318
unsigned long * sevSyz
Definition: kutil.h:319
#define setmaxTinc
Definition: kutil.h:33
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:347
#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 8430 of file kutil.cc.

8431 {
8432  int i,pos;
8433 
8434  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8435  else i=setmaxT;
8436  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
8437  strat->ecartS=initec(i);
8438  strat->sevS=initsevS(i);
8439  strat->S_2_R=initS_2_R(i);
8440  strat->fromQ=NULL;
8441  strat->Shdl=idInit(i,F->rank);
8442  strat->S=strat->Shdl->m;
8443 
8444  /*- put polys into S -*/
8445  if (Q!=NULL)
8446  {
8447  strat->fromQ=initec(i);
8448  memset(strat->fromQ,0,i*sizeof(int));
8449  for (i=0; i<IDELEMS(Q); i++)
8450  {
8451  if (Q->m[i]!=NULL)
8452  {
8453  LObject h;
8454  h.p = pCopy(Q->m[i]);
8455  //if (TEST_OPT_INTSTRATEGY)
8456  //{
8457  // //pContent(h.p);
8458  // h.pCleardenom(); // also does a pContent
8459  //}
8460  //else
8461  //{
8462  // h.pNorm();
8463  //}
8465  {
8466  deleteHC(&h,strat);
8467  }
8468  if (h.p!=NULL)
8469  {
8470  strat->initEcart(&h);
8471  if (strat->sl==-1)
8472  pos =0;
8473  else
8474  {
8475  pos = posInS(strat,strat->sl,h.p,h.ecart);
8476  }
8477  h.sev = pGetShortExpVector(h.p);
8478  strat->enterS(h,pos,strat, strat->tl+1);
8479  enterT(h, strat);
8480  strat->fromQ[pos]=1;
8481  }
8482  }
8483  }
8484  }
8485  /*- put polys into S -*/
8486  for (i=0; i<IDELEMS(F); i++)
8487  {
8488  if (F->m[i]!=NULL)
8489  {
8490  LObject h;
8491  h.p = pCopy(F->m[i]);
8493  {
8494  deleteHC(&h,strat);
8495  }
8496  else
8497  {
8498  h.p=redtailBba(h.p,strat->sl,strat);
8499  }
8500  if (h.p!=NULL)
8501  {
8502  strat->initEcart(&h);
8503  if (strat->sl==-1)
8504  pos =0;
8505  else
8506  pos = posInS(strat,strat->sl,h.p,h.ecart);
8507  h.sev = pGetShortExpVector(h.p);
8508  strat->enterS(h,pos,strat, strat->tl+1);
8509  enterT(h,strat);
8510  }
8511  }
8512  }
8513  for (i=0; i<IDELEMS(P); i++)
8514  {
8515  if (P->m[i]!=NULL)
8516  {
8517  LObject h;
8518  h.p=pCopy(P->m[i]);
8520  {
8521  h.pCleardenom();
8522  }
8523  else
8524  {
8525  h.pNorm();
8526  }
8527  if(strat->sl>=0)
8528  {
8530  {
8531  h.p=redBba(h.p,strat->sl,strat);
8532  if (h.p!=NULL)
8533  {
8534  h.p=redtailBba(h.p,strat->sl,strat);
8535  }
8536  }
8537  else
8538  {
8539  h.p=redMora(h.p,strat->sl,strat);
8540  }
8541  if(h.p!=NULL)
8542  {
8543  strat->initEcart(&h);
8545  {
8546  h.pCleardenom();
8547  }
8548  else
8549  {
8550  h.is_normalized = 0;
8551  h.pNorm();
8552  }
8553  h.sev = pGetShortExpVector(h.p);
8554  h.SetpFDeg();
8555  pos = posInS(strat,strat->sl,h.p,h.ecart);
8556  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8557  strat->enterS(h,pos,strat, strat->tl+1);
8558  enterT(h,strat);
8559  }
8560  }
8561  else
8562  {
8563  h.sev = pGetShortExpVector(h.p);
8564  strat->initEcart(&h);
8565  strat->enterS(h,0,strat, strat->tl+1);
8566  enterT(h,strat);
8567  }
8568  }
8569  }
8570 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:526
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4985
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8826
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:317
#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:282
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
intset ecartS
Definition: kutil.h:305
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8850
kBucketDestroy & P
Definition: myNF.cc:191
ideal Shdl
Definition: kutil.h:299
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 8575 of file kutil.cc.

8576 {
8577  int i,pos;
8578 
8579  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
8580  else i=setmaxT;
8581  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
8582  strat->sevS=initsevS(i);
8583  strat->sevSig=initsevS(i);
8584  strat->S_2_R=initS_2_R(i);
8585  strat->fromQ=NULL;
8586  strat->Shdl=idInit(i,F->rank);
8587  strat->S=strat->Shdl->m;
8588  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
8589  /*- put polys into S -*/
8590  if (Q!=NULL)
8591  {
8592  strat->fromQ=initec(i);
8593  memset(strat->fromQ,0,i*sizeof(int));
8594  for (i=0; i<IDELEMS(Q); i++)
8595  {
8596  if (Q->m[i]!=NULL)
8597  {
8598  LObject h;
8599  h.p = pCopy(Q->m[i]);
8600  //if (TEST_OPT_INTSTRATEGY)
8601  //{
8602  // //pContent(h.p);
8603  // h.pCleardenom(); // also does a pContent
8604  //}
8605  //else
8606  //{
8607  // h.pNorm();
8608  //}
8610  {
8611  deleteHC(&h,strat);
8612  }
8613  if (h.p!=NULL)
8614  {
8615  strat->initEcart(&h);
8616  if (strat->sl==-1)
8617  pos =0;
8618  else
8619  {
8620  pos = posInS(strat,strat->sl,h.p,h.ecart);
8621  }
8622  h.sev = pGetShortExpVector(h.p);
8623  strat->enterS(h,pos,strat, strat->tl+1);
8624  enterT(h, strat);
8625  strat->fromQ[pos]=1;
8626  }
8627  }
8628  }
8629  }
8630  /*- put polys into S -*/
8631  for (i=0; i<IDELEMS(F); i++)
8632  {
8633  if (F->m[i]!=NULL)
8634  {
8635  LObject h;
8636  h.p = pCopy(F->m[i]);
8638  {
8639  deleteHC(&h,strat);
8640  }
8641  else
8642  {
8643  h.p=redtailBba(h.p,strat->sl,strat);
8644  }
8645  if (h.p!=NULL)
8646  {
8647  strat->initEcart(&h);
8648  if (strat->sl==-1)
8649  pos =0;
8650  else
8651  pos = posInS(strat,strat->sl,h.p,h.ecart);
8652  h.sev = pGetShortExpVector(h.p);
8653  strat->enterS(h,pos,strat, strat->tl+1);
8654  enterT(h,strat);
8655  }
8656  }
8657  }
8658  for (i=0; i<IDELEMS(P); i++)
8659  {
8660  if (P->m[i]!=NULL)
8661  {
8662  LObject h;
8663  h.p=pCopy(P->m[i]);
8665  {
8666  h.pCleardenom();
8667  }
8668  else
8669  {
8670  h.pNorm();
8671  }
8672  if(strat->sl>=0)
8673  {
8675  {
8676  h.p=redBba(h.p,strat->sl,strat);
8677  if (h.p!=NULL)
8678  {
8679  h.p=redtailBba(h.p,strat->sl,strat);
8680  }
8681  }
8682  else
8683  {
8684  h.p=redMora(h.p,strat->sl,strat);
8685  }
8686  if(h.p!=NULL)
8687  {
8688  strat->initEcart(&h);
8690  {
8691  h.pCleardenom();
8692  }
8693  else
8694  {
8695  h.is_normalized = 0;
8696  h.pNorm();
8697  }
8698  h.sev = pGetShortExpVector(h.p);
8699  h.SetpFDeg();
8700  pos = posInS(strat,strat->sl,h.p,h.ecart);
8701  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
8702  strat->enterS(h,pos,strat, strat->tl+1);
8703  enterT(h,strat);
8704  }
8705  }
8706  else
8707  {
8708  h.sev = pGetShortExpVector(h.p);
8709  strat->initEcart(&h);
8710  strat->enterS(h,0,strat, strat->tl+1);
8711  enterT(h,strat);
8712  }
8713  }
8714  }
8715 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
unsigned long * sevSig
Definition: kutil.h:320
polyset sig
Definition: kutil.h:304
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:340
int tl
Definition: kutil.h:348
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:4985
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:7583
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8826
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
void(* initEcart)(TObject *L)
Definition: kutil.h:276
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:317
#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:282
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:243
polyset S
Definition: kutil.h:302
#define IDELEMS(i)
Definition: simpleideals.h:24
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
unsigned long * sevS
Definition: kutil.h:318
#define setmaxTinc
Definition: kutil.h:33
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8850
kBucketDestroy & P
Definition: myNF.cc:191
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299
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 8275 of file kutil.cc.

8276 {
8277  if( strat->S[0] )
8278  {
8279  if( strat->S[1] && !rField_is_Ring(currRing))
8280  {
8281  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
8282  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
8283  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
8284  }
8285  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
8286  /************************************************************
8287  * computing the length of the syzygy array needed
8288  ***********************************************************/
8289  for(i=1; i<=strat->sl; i++)
8290  {
8291  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8292  {
8293  ps += i;
8294  }
8295  }
8296  ps += strat->sl+1;
8297  //comp = pGetComp (strat->P.sig);
8298  comp = strat->currIdx;
8299  strat->syzIdx = initec(comp);
8300  strat->sevSyz = initsevS(ps);
8301  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
8302  strat->syzmax = ps;
8303  strat->syzl = 0;
8304  strat->syzidxmax = comp;
8305 #if defined(DEBUGF5) || defined(DEBUGF51)
8306  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
8307 #endif
8308  i = 1;
8309  j = 0;
8310  /************************************************************
8311  * generating the leading terms of the principal syzygies
8312  ***********************************************************/
8313  while (i <= strat->sl)
8314  {
8315  /**********************************************************
8316  * principal syzygies start with component index 2
8317  * the array syzIdx starts with index 0
8318  * => the rules for a signature with component comp start
8319  * at strat->syz[strat->syzIdx[comp-2]] !
8320  *********************************************************/
8321  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
8322  {
8323  comp = pGetComp(strat->sig[i]);
8324  comp_old = pGetComp(strat->sig[i-1]);
8325  diff = comp - comp_old - 1;
8326  // diff should be zero, but sometimes also the initial generating
8327  // elements of the input ideal reduce to zero. then there is an
8328  // index-gap between the signatures. for these inbetween signatures we
8329  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8330  // in the following.
8331  // doing this, we keep the relation "j = comp - 2" alive, which makes
8332  // jumps way easier when checking criteria
8333  while (diff>0)
8334  {
8335  strat->syzIdx[j] = 0;
8336  diff--;
8337  j++;
8338  }
8339  strat->syzIdx[j] = ctr;
8340  j++;
8341  LObject Q;
8342  int pos;
8343  for (k = 0; k<i; k++)
8344  {
8345  Q.sig = pOne();
8347  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8348  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8349  p_SetCompP (Q.sig, comp, currRing);
8350  poly q = p_One(currRing);
8352  p_SetCoeff(q,nCopy(p_GetCoeff(strat->S[i],currRing)),currRing);
8353  p_ExpVectorCopy(q,strat->S[i],currRing);
8354  q = p_Neg (q, currRing);
8355  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8356  Q.sig = p_Add_q (Q.sig, q, currRing);
8357  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8358  pos = posInSyz(strat, Q.sig);
8359  enterSyz(Q, strat, pos);
8360  ctr++;
8361  }
8362  }
8363  i++;
8364  }
8365  /**************************************************************
8366  * add syzygies for upcoming first element of new iteration step
8367  **************************************************************/
8368  comp = strat->currIdx;
8369  comp_old = pGetComp(strat->sig[i-1]);
8370  diff = comp - comp_old - 1;
8371  // diff should be zero, but sometimes also the initial generating
8372  // elements of the input ideal reduce to zero. then there is an
8373  // index-gap between the signatures. for these inbetween signatures we
8374  // can safely set syzIdx[j] = 0 as no such element will be ever computed
8375  // in the following.
8376  // doing this, we keep the relation "j = comp - 2" alive, which makes
8377  // jumps way easier when checking criteria
8378  while (diff>0)
8379  {
8380  strat->syzIdx[j] = 0;
8381  diff--;
8382  j++;
8383  }
8384  strat->syzIdx[j] = ctr;
8385  LObject Q;
8386  int pos;
8387  for (k = 0; k<strat->sl+1; k++)
8388  {
8389  Q.sig = pOne();
8391  p_SetCoeff(Q.sig,nCopy(p_GetCoeff(strat->S[k],currRing)),currRing);
8392  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
8393  p_SetCompP (Q.sig, comp, currRing);
8394  poly q = p_One(currRing);
8396  p_SetCoeff(q,nCopy(p_GetCoeff(strat->L[strat->Ll].p,currRing)),currRing);
8397  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
8398  q = p_Neg (q, currRing);
8399  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
8400  Q.sig = p_Add_q (Q.sig, q, currRing);
8401  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
8402  pos = posInSyz(strat, Q.sig);
8403  enterSyz(Q, strat, pos);
8404  ctr++;
8405  }
8406 //#if 1
8407 #ifdef DEBUGF5
8408  PrintS("Principal syzygies:\n");
8409  Print("syzl %d\n",strat->syzl);
8410  Print("syzmax %d\n",strat->syzmax);
8411  Print("ps %d\n",ps);
8412  PrintS("--------------------------------\n");
8413  for(i=0;i<=strat->syzl-1;i++)
8414  {
8415  Print("%d - ",i);
8416  pWrite(strat->syz[i]);
8417  }
8418  for(i=0;i<strat->currIdx;i++)
8419  {
8420  Print("%d - %d\n",i,strat->syzIdx[i]);
8421  }
8422  PrintS("--------------------------------\n");
8423 #endif
8424  }
8425 }
polyset sig
Definition: kutil.h:304
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:347
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
#define p_GetComp(p, r)
Definition: monomials.h:72
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:291
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:522
#define omAlloc(size)
Definition: omAllocDecl.h:210
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
int currIdx
Definition: kutil.h:313
#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:1313
int j
Definition: myNF.cc:70
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1236
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define pOne()
Definition: polys.h:298
polyset S
Definition: kutil.h:302
unsigned long p_GetShortExpVector(const poly p, const ring r)
Definition: p_polys.cc:4589
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:6361
int syzidxmax
Definition: kutil.h:347
#define nCopy(n)
Definition: numbers.h:15
unsigned long * sevSyz
Definition: kutil.h:319
#define p_GetCoeff(p, r)
Definition: monomials.h:57
polyset syz
Definition: kutil.h:303
static intset initec(const int maxnr)
Definition: kutil.cc:517
int sl
Definition: kutil.h:346
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:347
void enterSyz(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9561
intset syzIdx
Definition: kutil.h:309

§ 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:97
return P p
Definition: myNF.cc:203
int Bl
Definition: kutil.h:350
#define TRUE
Definition: auxiliary.h:101
int k
Definition: cfEzgcd.cc:93
LSet B
Definition: kutil.h:324

§ 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:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
int k
Definition: cfEzgcd.cc:93
LSet L
Definition: kutil.h:323
END_NAMESPACE const void * p2
Definition: syzextra.cc:202

§ kCheckSpolyCreation()

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

Definition at line 10697 of file kutil.cc.

10698 {
10699  if (strat->overflow) return FALSE;
10700  assume(L->p1 != NULL && L->p2 != NULL);
10701  // shift changes: from 0 to -1
10702  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
10703  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
10704  assume(strat->tailRing != currRing);
10705 
10706  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
10707  return FALSE;
10708  // shift changes: extra case inserted
10709  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
10710  {
10711  return TRUE;
10712  }
10713  poly p1_max = (strat->R[L->i_r1])->max;
10714  poly p2_max = (strat->R[L->i_r2])->max;
10715 
10716  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10717  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10718  {
10719  p_LmFree(m1, strat->tailRing);
10720  p_LmFree(m2, strat->tailRing);
10721  m1 = NULL;
10722  m2 = NULL;
10723  return FALSE;
10724  }
10725  return TRUE;
10726 }
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:960
#define FALSE
Definition: auxiliary.h:97
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
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
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:403
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
polyrec * poly
Definition: hilb.h:10

§ kCheckStrongCreation()

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

Definition at line 10735 of file kutil.cc.

10736 {
10737  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
10738  //assume(strat->tailRing != currRing);
10739 
10740  poly p1_max = (strat->R[atR])->max;
10741  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
10742 
10743  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
10744  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
10745  {
10746  return FALSE;
10747  }
10748  return TRUE;
10749 }
#define FALSE
Definition: auxiliary.h:97
int * S_2_R
Definition: kutil.h:340
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1911
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
static int max(int a, int b)
Definition: fast_mult.cc:264
#define assume(x)
Definition: mod2.h:403
TObject ** R
Definition: kutil.h:338
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
polyrec * poly
Definition: hilb.h:10

§ kCreateZeroPoly()

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

Definition at line 4416 of file kutil.cc.

4417 {
4418 
4419  poly zeroPoly = NULL;
4420 
4421  number tmp1;
4422  poly tmp2, tmp3;
4423 
4424  if (cabsind == -1)
4425  {
4426  cabsind = 0;
4427  for (int i = 1; i <= leadRing->N; i++)
4428  {
4429  cabsind += ind_fact_2(exp[i]);
4430  }
4431 // Print("cabsind: %d\n", cabsind);
4432  }
4433  if (cabsind < leadRing->ch)
4434  {
4435  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
4436  }
4437  else
4438  {
4439  zeroPoly = p_ISet(1, tailRing);
4440  }
4441  for (int i = 1; i <= leadRing->N; i++)
4442  {
4443  for (long j = 1; j <= exp[i]; j++)
4444  {
4445  tmp1 = nInit(j);
4446  tmp2 = p_ISet(1, tailRing);
4447  p_SetExp(tmp2, i, 1, tailRing);
4448  p_Setm(tmp2, tailRing);
4449  if (nIsZero(tmp1))
4450  { // should nowbe obsolet, test ! TODO OLIVER
4451  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
4452  }
4453  else
4454  {
4455  tmp3 = p_NSet(nCopy(tmp1), tailRing);
4456  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
4457  }
4458  }
4459  }
4460  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
4461  for (int i = 1; i <= leadRing->N; i++)
4462  {
4463  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
4464  }
4465  p_Setm(tmp2, leadRing);
4466  *t_p = zeroPoly;
4467  zeroPoly = pNext(zeroPoly);
4468  pNext(*t_p) = NULL;
4469  pNext(tmp2) = zeroPoly;
4470  return tmp2;
4471 }
#define pSetExp(p, i, v)
Definition: polys.h:42
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1443
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
long twoPow(long arg)
Definition: kutil.cc:4224
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:464
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
CFList tmp2
Definition: facFqBivar.cc:70
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:483
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:4209
CFList tmp1
Definition: facFqBivar.cc:70
#define nCopy(n)
Definition: numbers.h:15
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
p exp[i]
Definition: DebugPrint.cc:39
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
#define nInit(i)
Definition: numbers.h:24
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297
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 11692 of file kutil.cc.

11693 {
11694  PrintS("red: ");
11695  if (strat->red==redFirst) PrintS("redFirst\n");
11696  else if (strat->red==redHoney) PrintS("redHoney\n");
11697  else if (strat->red==redEcart) PrintS("redEcart\n");
11698  else if (strat->red==redHomog) PrintS("redHomog\n");
11699  else Print("%p\n",(void*)strat->red);
11700  PrintS("posInT: ");
11701  if (strat->posInT==posInT0) PrintS("posInT0\n");
11702  else if (strat->posInT==posInT1) PrintS("posInT1\n");
11703  else if (strat->posInT==posInT11) PrintS("posInT11\n");
11704  else if (strat->posInT==posInT110) PrintS("posInT110\n");
11705  else if (strat->posInT==posInT13) PrintS("posInT13\n");
11706  else if (strat->posInT==posInT15) PrintS("posInT15\n");
11707  else if (strat->posInT==posInT17) PrintS("posInT17\n");
11708  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
11709  else if (strat->posInT==posInT19) PrintS("posInT19\n");
11710  else if (strat->posInT==posInT2) PrintS("posInT2\n");
11711  #ifdef HAVE_RINGS
11712  else if (strat->posInT==posInT11Ring) PrintS("posInT11Ring\n");
11713  else if (strat->posInT==posInT110Ring) PrintS("posInT110Ring\n");
11714  else if (strat->posInT==posInT15Ring) PrintS("posInT15Ring\n");
11715  else if (strat->posInT==posInT17Ring) PrintS("posInT17Ring\n");
11716  else if (strat->posInT==posInT17_cRing) PrintS("posInT17_cRing\n");
11717  #endif
11718 #ifdef HAVE_MORE_POS_IN_T
11719  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
11720  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
11721  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
11722 #endif
11723  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
11724  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
11725  else Print("%p\n",(void*)strat->posInT);
11726  PrintS("posInL: ");
11727  if (strat->posInL==posInL0) PrintS("posInL0\n");
11728  else if (strat->posInL==posInL10) PrintS("posInL10\n");
11729  else if (strat->posInL==posInL11) PrintS("posInL11\n");
11730  else if (strat->posInL==posInL110) PrintS("posInL110\n");
11731  else if (strat->posInL==posInL13) PrintS("posInL13\n");
11732  else if (strat->posInL==posInL15) PrintS("posInL15\n");
11733  else if (strat->posInL==posInL17) PrintS("posInL17\n");
11734  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
11735  #ifdef HAVE_RINGS
11736  else if (strat->posInL==posInL0) PrintS("posInL0Ring\n");
11737  else if (strat->posInL==posInL11Ring) PrintS("posInL11Ring\n");
11738  else if (strat->posInL==posInL11Ringls) PrintS("posInL11Ringls\n");
11739  else if (strat->posInL==posInL110Ring) PrintS("posInL110Ring\n");
11740  else if (strat->posInL==posInL15Ring) PrintS("posInL15Ring\n");
11741  else if (strat->posInL==posInL17Ring) PrintS("posInL17Ring\n");
11742  else if (strat->posInL==posInL17_cRing) PrintS("posInL17_cRing\n");
11743  #endif
11744  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
11745  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
11746  else Print("%p\n",(void*)strat->posInL);
11747  PrintS("enterS: ");
11748  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
11749  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
11750  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
11751  else Print("%p\n",(void*)strat->enterS);
11752  PrintS("initEcart: ");
11753  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
11754  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
11755  else Print("%p\n",(void*)strat->initEcart);
11756  PrintS("initEcartPair: ");
11757  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
11758  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
11759  else Print("%p\n",(void*)strat->initEcartPair);
11760  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
11761  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
11762  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
11763  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
11764  PrintS("chainCrit: ");
11765  if (strat->chainCrit==chainCritNormal) PrintS("chainCritNormal\n");
11766  else if (strat->chainCrit==chainCritOpt_1) PrintS("chainCritOpt_1\n");
11767  else Print("%p\n",(void*)strat->chainCrit);
11768  Print("posInLDependsOnLength=%d\n",
11769  strat->posInLDependsOnLength);
11770  PrintS(showOption());PrintLn();
11771  PrintS("LDeg: ");
11772  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11773  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11774  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
11775  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11776  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11777  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11778  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11779  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11780  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11781  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11782  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11783  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11784  else Print("? (%lx)", (long)currRing->pLDeg);
11785  PrintS(" / ");
11786  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
11787  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
11788  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
11789  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
11790  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
11791  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
11792  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
11793  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
11794  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
11795  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
11796  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
11797  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
11798  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
11799  PrintLn();
11800  PrintS("currRing->pFDeg: ");
11801  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
11802  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
11803  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
11804  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
11805  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
11806  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
11807  else Print("? (%lx)", (long)currRing->pFDeg);
11808  PrintLn();
11809  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
11810  if(TEST_OPT_DEGBOUND)
11811  Print(" degBound: %d\n", Kstd1_deg);
11812 
11813  if( ecartWeights != NULL )
11814  {
11815  PrintS("ecartWeights: ");
11816  for (int i = rVar(currRing); i > 0; i--)
11817  Print("%hd ", ecartWeights[i]);
11818  PrintLn();
11820  }
11821 
11822 #ifndef SING_NDEBUG
11824 #endif
11825 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1249
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6401
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11658
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5481
BOOLEAN honey
Definition: kutil.h:376
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6898
void enterSMora(LObject &p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1362
void PrintLn()
Definition: reporter.cc:310
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5374
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:841
#define TEST_OPT_DEGBOUND
Definition: options.h:108
int posInL11Ringls(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6513
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1005
int posInL15Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6857
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:877
BOOLEAN noTailReduction
Definition: kutil.h:377
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5346
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:3250
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6615
int posInL17Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6942
short * ecartWeights
Definition: weight0.c:28
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:708
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6822
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:711
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6787
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
int posInT15Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5768
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:770
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:283
int ak
Definition: kutil.h:351
char * showOption()
Definition: misc_ip.cc:717
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:910
int posInL17_cRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:7056
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5714
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:274
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:536
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:277
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:5335
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:941
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1450
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5404
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5916
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
BOOLEAN homog
Definition: kutil.h:371
int posInT11Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5440
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1256
int posInL11Ring(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kutil.cc:6443
BOOLEAN Gebauer
Definition: kutil.h:377
#define assume(x)
Definition: mod2.h:403
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:596
void initEcartBBA(TObject *h)
Definition: kutil.cc:1242
int posInT17Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5870
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:739
void(* enterS)(LObject &h, int pos, kStrategy strat, int atR)
Definition: kutil.h:282
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2218
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6143
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6992
void rDebugPrint(const ring r)
Definition: ring.cc:4033
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5809
BOOLEAN sugarCrit
Definition: kutil.h:376
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:11567
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:287
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:811
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:975
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:172
ring tailRing
Definition: kutil.h:341
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5557
int posInT110Ring(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5599
void chainCritOpt_1(poly, int, kStrategy strat)
Definition: kutil.cc:3463
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1038
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:601
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6100
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1068
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:613
BOOLEAN use_buckets
Definition: kutil.h:382
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:6043
void initEcartNormal(TObject *h)
Definition: kutil.cc:1234
int LazyPass
Definition: kutil.h:351
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:11621
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5675
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098
int LazyDegree
Definition: kutil.h:351
int posInT17_cRing(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5977
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:5646
void enterSBba(LObject &p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:9124

§ kFindDivisibleByInS()

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

Definition at line 7369 of file kutil.cc.

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

§ kMergeBintoL()

void kMergeBintoL ( kStrategy  strat)

Definition at line 3204 of file kutil.cc.

3205 {
3206  int j=strat->Ll+strat->Bl+1;
3207  if (j>strat->Lmax)
3208  {
3209  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
3210  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
3211  j*sizeof(LObject));
3212  strat->Lmax=j;
3213  }
3214  j = strat->Ll;
3215  int i;
3216  for (i=strat->Bl; i>=0; i--)
3217  {
3218  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
3219  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3220  }
3221  strat->Bl = -1;
3222 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:280
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int Bl
Definition: kutil.h:350
#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:323
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349

§ kMergeBintoLSba()

void kMergeBintoLSba ( kStrategy  strat)

Definition at line 3227 of file kutil.cc.

3228 {
3229  int j=strat->Ll+strat->Bl+1;
3230  if (j>strat->Lmax)
3231  {
3232  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
3233  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
3234  j*sizeof(LObject));
3235  strat->Lmax=j;
3236  }
3237  j = strat->Ll;
3238  int i;
3239  for (i=strat->Bl; i>=0; i--)
3240  {
3241  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
3242  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
3243  }
3244  strat->Bl = -1;
3245 }
class sLObject LObject
Definition: kutil.h:60
int Ll
Definition: kutil.h:349
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:278
int Bl
Definition: kutil.h:350
#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:323
LSet B
Definition: kutil.h:324
int Lmax
Definition: kutil.h:349

§ kPosInLDependsOnLength()

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

Definition at line 9798 of file kutil.cc.

9801 {
9802  if (pos_in_l == posInL110
9803  || pos_in_l == posInL10
9804  #ifdef HAVE_RINGS
9805  || pos_in_l == posInL110Ring
9806  || pos_in_l == posInLRing
9807  #endif
9808  )
9809  return TRUE;
9810 
9811  return FALSE;
9812 }
#define FALSE
Definition: auxiliary.h:97
int posInL110Ring(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6740
int posInLRing(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6288
#define TRUE
Definition: auxiliary.h:101
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:6699
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:1098

§ kStratChangeTailRing()

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

Definition at line 11146 of file kutil.cc.

11147 {
11148  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask <= currRing->bitmask));
11149  /* initial setup or extending */
11150 
11151  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
11152  if (expbound >= currRing->bitmask) return FALSE;
11153  strat->overflow=FALSE;
11154  ring new_tailRing = rModifyRing(currRing,
11155  // Hmmm .. the condition pFDeg == p_Deg
11156  // might be too strong
11157  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // omit degree
11158  (strat->ak==0), // omit_comp if the input is an ideal
11159  expbound); // exp_limit
11160 
11161  if (new_tailRing == currRing) return TRUE;
11162 
11163  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
11164  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
11165 
11166  if (currRing->pFDeg != currRing->pFDegOrig)
11167  {
11168  new_tailRing->pFDeg = currRing->pFDeg;
11169  new_tailRing->pLDeg = currRing->pLDeg;
11170  }
11171 
11172  if (TEST_OPT_PROT)
11173  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
11174  kTest_TS(strat);
11175  assume(new_tailRing != strat->tailRing);
11176  pShallowCopyDeleteProc p_shallow_copy_delete
11177  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
11178 
11179  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
11180 
11181  int i;
11182  for (i=0; i<=strat->tl; i++)
11183  {
11184  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
11185  p_shallow_copy_delete);
11186  }
11187  for (i=0; i<=strat->Ll; i++)
11188  {
11189  assume(strat->L[i].p != NULL);
11190  if (pNext(strat->L[i].p) != strat->tail)
11191  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11192  }
11193  if ((strat->P.t_p != NULL) ||
11194  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
11195  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11196 
11197  if ((L != NULL) && (L->tailRing != new_tailRing))
11198  {
11199  if (L->i_r < 0)
11200  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
11201  else
11202  {
11203  assume(L->i_r <= strat->tl);
11204  TObject* t_l = strat->R[L->i_r];
11205  assume(t_l != NULL);
11206  L->tailRing = new_tailRing;
11207  L->p = t_l->p;
11208  L->t_p = t_l->t_p;
11209  L->max = t_l->max;
11210  }
11211  }
11212 
11213  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
11214  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
11215 
11216  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
11217  if (strat->tailRing != currRing)
11218  rKillModifiedRing(strat->tailRing);
11219 
11220  strat->tailRing = new_tailRing;
11221  strat->tailBin = new_tailBin;
11222  strat->p_shallow_copy_delete
11223  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
11224 
11225  if (strat->kHEdge != NULL)
11226  {
11227  if (strat->t_kHEdge != NULL)
11228  p_LmFree(strat->t_kHEdge, strat->tailRing);
11229  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
11230  }
11231 
11232  if (strat->kNoether != NULL)
11233  {
11234  if (strat->t_kNoether != NULL)
11235  p_LmFree(strat->t_kNoether, strat->tailRing);
11237  new_tailRing);
11238  }
11239  kTest_TS(strat);
11240  if (TEST_OPT_PROT)
11241  PrintS("]");
11242  return TRUE;
11243 }
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:325
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:295
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
poly kNoether
Definition: kutil.h:326
int tl
Definition: kutil.h:348
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2597
#define TRUE
Definition: auxiliary.h:101
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:336
int ak
Definition: kutil.h:351
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:587
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:901
BOOLEAN homog
Definition: kutil.h:371
#define kTest_TS(A)
Definition: kutil.h:654
#define assume(x)
Definition: mod2.h:403
LObject P
Definition: kutil.h:298
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
poly tail
Definition: kutil.h:332
TObject ** R
Definition: kutil.h:338
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:327
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:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
omBin tailBin
Definition: kutil.h:343
char overflow
Definition: kutil.h:403
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2963
TSet T
Definition: kutil.h:322
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:294
class sTObject TObject
Definition: kutil.h:59

§ kStratInitChangeTailRing()

void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 11245 of file kutil.cc.

11246 {
11247  unsigned long l = 0;
11248  int i;
11249  long e;
11250 
11251  assume(strat->tailRing == currRing);
11252 
11253  for (i=0; i<= strat->Ll; i++)
11254  {
11255  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
11256  }
11257  for (i=0; i<=strat->tl; i++)
11258  {
11259  // Hmm ... this we could do in one Step
11260  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
11261  }
11262  if (rField_is_Ring(currRing))
11263  {
11264  l *= 2;
11265  }
11266  e = p_GetMaxExp(l, currRing);
11267  if (e <= 1) e = 2;
11268 
11269  kStratChangeTailRing(strat, NULL, NULL, e);
11270 }
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:1175
int Ll
Definition: kutil.h:349
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:742
int tl
Definition: kutil.h:348
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:403
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:11146
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:323
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
TSet T
Definition: kutil.h:322
int l
Definition: cfEzgcd.cc:94

§ message()

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

Definition at line 7810 of file kutil.cc.

7811 {
7812  if (i != *olddeg)
7813  {
7814  Print("%d",i);
7815  *olddeg = i;
7816  }
7817  if (TEST_OPT_OLDSTD)
7818  {
7819  if (strat->Ll != *reduc)
7820  {
7821  if (strat->Ll != *reduc-1)
7822  Print("(%d)",strat->Ll+1);
7823  else
7824  PrintS("-");
7825  *reduc = strat->Ll;
7826  }
7827  else
7828  PrintS(".");
7829  mflush();
7830  }
7831  else
7832  {
7833  if (red_result == 0)
7834  PrintS("-");
7835  else if (red_result < 0)
7836  PrintS(".");
7837  if ((red_result > 0) || ((strat->Ll % 100)==99))
7838  {
7839  if (strat->Ll != *reduc && strat->Ll > 0)
7840  {
7841  Print("(%d)",strat->Ll+1);
7842  *reduc = strat->Ll;
7843  }
7844  }
7845  }
7846 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:349
#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 7851 of file kutil.cc.

7852 {
7853  //PrintS("\nUsage/Allocation of temporary storage:\n");
7854  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7855  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7856  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7857  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7858  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7859  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7860  /*mflush();*/
7861 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:345
int cv
Definition: kutil.h:368
int cp
Definition: kutil.h:345

§ messageStatSBA()

void messageStatSBA ( int  hilbcount,
kStrategy  strat 
)

Definition at line 7863 of file kutil.cc.

7864 {
7865  //PrintS("\nUsage/Allocation of temporary storage:\n");
7866  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
7867  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
7868  Print("syz criterion:%d rew criterion:%d\n",strat->nrsyzcrit,strat->nrrewcrit);
7869  //Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
7870  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
7871  /* in usual case strat->cv is 0, it gets changed only in shift routines */
7872  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
7873  /*mflush();*/
7874 }
#define Print
Definition: emacs.cc:83
int cv
Definition: kutil.h:368
int nrsyzcrit
Definition: kutil.h:359
int nrrewcrit
Definition: kutil.h:360

§ newHEdge()

BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 10631 of file kutil.cc.

10632 {
10633  if (currRing->pLexOrder || rHasMixedOrdering(currRing))
10634  return FALSE;
10635  int i,j;
10636  poly newNoether;
10637 
10638 #if 0
10639  if (currRing->weight_all_1)
10640  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10641  else
10642  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10643 #else
10644  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
10645 #endif
10646  if (strat->kHEdge==NULL) return FALSE;
10647  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
10648  if (strat->tailRing != currRing)
10649  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
10650  /* compare old and new noether*/
10651  newNoether = pLmInit(strat->kHEdge);
10652  j = p_FDeg(newNoether,currRing);
10653  for (i=1; i<=(currRing->N); i++)
10654  {
10655  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
10656  }
10657  pSetm(newNoether);
10658  if (j < strat->HCord) /*- statistics -*/
10659  {
10660  if (TEST_OPT_PROT)
10661  {
10662  Print("H(%d)",j);
10663  mflush();
10664  }
10665  strat->HCord=j;
10666  #ifdef KDEBUG
10667  if (TEST_OPT_DEBUG)
10668  {
10669  Print("H(%d):",j);
10670  wrp(strat->kHEdge);
10671  PrintLn();
10672  }
10673  #endif
10674  }
10675  if (pCmp(strat->kNoether,newNoether)!=1)
10676  {
10677  pDelete(&strat->kNoether);
10678  strat->kNoether=newNoether;
10679  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
10680  if (strat->tailRing != currRing)
10681  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
10682 
10683  return TRUE;
10684  }
10685  if (rField_is_Ring(currRing))
10686  pLmDelete(newNoether);
10687  else
10688  pLmFree(newNoether);
10689  return FALSE;
10690 }
#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:325
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:97
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:326
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:101
int ak
Definition: kutil.h:351
#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:353
#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:901
int j
Definition: myNF.cc:70
#define pLmInit(p)
like pInit, except that expvector is initialized to that of p, p must be != NULL
Definition: polys.h:64
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:375
int i
Definition: cfEzgcd.cc:123
BOOLEAN rHasMixedOrdering(const ring r)
Definition: ring.h:748
poly t_kHEdge
Definition: kutil.h:327
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
poly t_kNoether
Definition: kutil.h:329
#define pDelete(p_ptr)
Definition: polys.h:169
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
void wrp(poly p)
Definition: polys.h:293
polyrec * poly
Definition: hilb.h:10
ideal Shdl
Definition: kutil.h:299

§ nextZeroSimplexExponent()

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

Definition at line 4350 of file kutil.cc.

4352 {
4353  long add = ind2(cexp[1] + 2);
4354  if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
4355  {
4356  cexp[1] += 2;
4357  cind[1] += add;
4358  *cabsind += add;
4359  }
4360  else
4361  {
4362  // cabsind >= habsind
4363  if (N == 1) return 0;
4364  int i = 1;
4365  while (exp[i] == cexp[i] && i <= N) i++;
4366  cexp[i] = exp[i];
4367  *cabsind -= cind[i];
4368  cind[i] = ind[i];
4369  step[i] = 500000;
4370  *cabsind += cind[i];
4371  // Print("in: %d\n", *cabsind);
4372  i += 1;
4373  if (i > N) return 0;
4374  do
4375  {
4376  step[1] = 500000;
4377  for (int j = i + 1; j <= N; j++)
4378  {
4379  if (step[1] > step[j]) step[1] = step[j];
4380  }
4381  add = ind2(cexp[i] + 2);
4382  if (*cabsind - step[1] + add >= bound)
4383  {
4384  cexp[i] = exp[i];
4385  *cabsind -= cind[i];
4386  cind[i] = ind[i];
4387  *cabsind += cind[i];
4388  step[i] = 500000;
4389  i += 1;
4390  if (i > N) return 0;
4391  }
4392  else step[1] = -1;
4393  } while (step[1] != -1);
4394  step[1] = 500000;
4395  cexp[i] += 2;
4396  cind[i] += add;
4397  *cabsind += add;
4398  if (add < step[i]) step[i] = add;
4399  for (i = 2; i <= N; i++)
4400  {
4401  if (step[1] > step[i]) step[1] = step[i];
4402  }
4403  }
4404  return 1;
4405 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
static unsigned add[]
Definition: misc_ip.cc:83
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:4197

§ p_HasNotCF_Lift()

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

p_HasNotCF for the IDLIFT case: ignore component

Definition at line 2200 of file kutil.cc.

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

11860 {
11861  /* restores a poly in currRing from LObject */
11862  LObject h = H;
11863  h.Copy();
11864  poly p;
11865  if (h.p == NULL)
11866  {
11867  if (h.t_p != NULL)
11868  {
11869  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
11870  return(p);
11871  }
11872  else
11873  {
11874  /* h.tp == NULL -> the object is NULL */
11875  return(NULL);
11876  }
11877  }
11878  /* we're here if h.p != NULL */
11879  if (h.t_p == NULL)
11880  {
11881  /* then h.p is the whole poly in currRing */
11882  p = h.p;
11883  return(p);
11884  }
11885  /* we're here if h.p != NULL and h.t_p != NULL */
11886  // clean h.p, get poly from t_p
11887  pNext(h.p)=NULL;
11888  pLmDelete(&h.p);
11889  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
11890  /* dest. ring: */ currRing);
11891  // no need to clean h: we re-used the polys
11892  return(p);
11893 }
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:341
#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:97
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:101
#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:88
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:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
#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:88
const poly b
Definition: syzextra.cc:213

§ pMove2CurrTail()

poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 11828 of file kutil.cc.

11829 {
11830  /* assume: p is completely in currRing */
11831  /* produces an object with LM in curring
11832  and TAIL in tailring */
11833  if (pNext(p)!=NULL)
11834  {
11835  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
11836  }
11837  return(p);
11838 }
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:341
#define pNext(p)
Definition: monomials.h:43

§ pMoveCurrTail2poly()

poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 11842 of file kutil.cc.

11843 {
11844  /* assume: p has LM in curring and TAIL in tailring */
11845  /* convert it to complete currRing */
11846 
11847  /* check that LM is in currRing */
11849 
11850  if (pNext(p)!=NULL)
11851  {
11852  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
11853  }
11854  return(p);
11855 }
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:91
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:403
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43

§ posInIdealMonFirst()

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

Definition at line 5291 of file kutil.cc.

5292 {
5293  if(end < 0 || end >= IDELEMS(F))
5294  end = IDELEMS(F);
5295  if (end<0) return 0;
5296  if(pNext(p) == NULL) return start;
5297  polyset set=F->m;
5298  int o = p_Deg(p,currRing);
5299  int op;
5300  int i;
5301  int an = start;
5302  for(i=start;i<end;i++)
5303  if(set[i] != NULL && pNext(set[i]) == NULL)
5304  an++;
5305  if(an == end-1)
5306  return end;
5307  int en= end;
5308  loop
5309  {
5310  if(an>=en)
5311  return en;
5312  if (an == en-1)
5313  {
5314  op = p_Deg(set[an],currRing);
5315  if ((op < o)
5316  || ((op == o) && (pLtCmp(set[an],p) == -1)))
5317  return en;
5318  return an;
5319  }
5320  i=(an+en) / 2;
5321  op = p_Deg(set[i],currRing);
5322  if ((op < o)
5323  || ((op == o) && (pLtCmp(set[i],p) == -1)))
5324  an=i;
5325  else
5326  en=i;
5327  }
5328 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
poly * polyset
Definition: hutil.h:15
#define pNext(p)
Definition: monomials.h:43

§ posInL0()

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

Definition at line 6143 of file kutil.cc.

6145 {
6146  if (length<0) return 0;
6147 
6148  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
6149  return length+1;
6150 
6151  int i;
6152  int an = 0;
6153  int en= length;
6154  loop
6155  {
6156  if (an >= en-1)
6157  {
6158  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
6159  return an;
6160  }
6161  i=(an+en) / 2;
6162  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
6163  else en=i;
6164  /*aend. fuer lazy == in !=- machen */
6165  }
6166 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInL0Ring()

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

Definition at line 6169 of file kutil.cc.

6171 {
6172  if (length<0) return 0;
6173 
6174  if (pLtCmpOrdSgnEqP(set[length].p,p->p))
6175  return length+1;
6176 
6177  int i;
6178  int an = 0;
6179  int en= length;
6180  loop
6181  {
6182  if (an >= en-1)
6183  {
6184  if (pLtCmpOrdSgnEqP(set[an].p,p->p)) return en;
6185  return an;
6186  }
6187  i=(an+en) / 2;
6188  if (pLtCmpOrdSgnEqP(set[i].p,p->p)) an=i;
6189  else en=i;
6190  /*aend. fuer lazy == in !=- machen */
6191  }
6192 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

§ posInL11()

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

Definition at line 6401 of file kutil.cc.

6403 {
6404  if (length<0) return 0;
6405 
6406  int o = p->GetpFDeg();
6407  int op = set[length].GetpFDeg();
6408 
6409  if ((op > o)
6410  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6411  return length+1;
6412  int i;
6413  int an = 0;
6414  int en= length;
6415  loop
6416  {
6417  if (an >= en-1)
6418  {
6419  op = set[an].GetpFDeg();
6420  if ((op > o)
6421  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6422  return en;
6423  return an;
6424  }
6425  i=(an+en) / 2;
6426  op = set[i].GetpFDeg();
6427  if ((op > o)
6428  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6429  an=i;
6430  else
6431  en=i;
6432  }
6433 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInL110()

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

Definition at line 6699 of file kutil.cc.

6701 {
6702  if (length<0) return 0;
6703 
6704  int o = p->GetpFDeg();
6705  int op = set[length].GetpFDeg();
6706 
6707  if ((op > o)
6708  || ((op == o) && (set[length].length >p->length))
6709  || ((op == o) && (set[length].length <= p->length)
6710  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6711  return length+1;
6712  int i;
6713  int an = 0;
6714  int en= length;
6715  loop
6716  {
6717  if (an >= en-1)
6718  {
6719  op = set[an].GetpFDeg();
6720  if ((op > o)
6721  || ((op == o) && (set[an].length >p->length))
6722  || ((op == o) && (set[an].length <=p->length)
6723  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6724  return en;
6725  return an;
6726  }
6727  i=(an+en) / 2;
6728  op = set[i].GetpFDeg();
6729  if ((op > o)
6730  || ((op == o) && (set[i].length > p->length))
6731  || ((op == o) && (set[i].length <= p->length)
6732  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6733  an=i;
6734  else
6735  en=i;
6736  }
6737 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInL110Ring()

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

Definition at line 6740 of file kutil.cc.

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

§ posInL11Ring()

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

Definition at line 6443 of file kutil.cc.

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

§ posInL11Ringls()

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

Definition at line 6513 of file kutil.cc.

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

§ posInL13()

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

Definition at line 6787 of file kutil.cc.

6789 {
6790  if (length<0) return 0;
6791 
6792  int o = p->GetpFDeg();
6793 
6794  if (set[length].GetpFDeg() > o)
6795  return length+1;
6796 
6797  int i;
6798  int an = 0;
6799  int en= length;
6800  loop
6801  {
6802  if (an >= en-1)
6803  {
6804  if (set[an].GetpFDeg() >= o)
6805  return en;
6806  return an;
6807  }
6808  i=(an+en) / 2;
6809  if (set[i].GetpFDeg() >= o)
6810  an=i;
6811  else
6812  en=i;
6813  }
6814 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInL15()

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

Definition at line 6822 of file kutil.cc.

6824 {
6825  if (length<0) return 0;
6826 
6827  int o = p->GetpFDeg() + p->ecart;
6828  int op = set[length].GetpFDeg() + set[length].ecart;
6829 
6830  if ((op > o)
6831  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6832  return length+1;
6833  int i;
6834  int an = 0;
6835  int en= length;
6836  loop
6837  {
6838  if (an >= en-1)
6839  {
6840  op = set[an].GetpFDeg() + set[an].ecart;
6841  if ((op > o)
6842  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6843  return en;
6844  return an;
6845  }
6846  i=(an+en) / 2;
6847  op = set[i].GetpFDeg() + set[i].ecart;
6848  if ((op > o)
6849  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6850  an=i;
6851  else
6852  en=i;
6853  }
6854 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInL15Ring()

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

Definition at line 6857 of file kutil.cc.

6859 {
6860  if (length<0) return 0;
6861 
6862  int o = p->GetpFDeg() + p->ecart;
6863  int op = set[length].GetpFDeg() + set[length].ecart;
6864 
6865  if ((op > o)
6866  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6867  return length+1;
6868  int i;
6869  int an = 0;
6870  int en= length;
6871  loop
6872  {
6873  if (an >= en-1)
6874  {
6875  op = set[an].GetpFDeg() + set[an].ecart;
6876  if ((op > o)
6877  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6878  return en;
6879  return an;
6880  }
6881  i=(an+en) / 2;
6882  op = set[i].GetpFDeg() + set[i].ecart;
6883  if ((op > o)
6884  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6885  an=i;
6886  else
6887  en=i;
6888  }
6889 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInL17()

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

Definition at line 6898 of file kutil.cc.

6900 {
6901  if (length<0) return 0;
6902 
6903  int o = p->GetpFDeg() + p->ecart;
6904 
6905  if ((set[length].GetpFDeg() + set[length].ecart > o)
6906  || ((set[length].GetpFDeg() + set[length].ecart == o)
6907  && (set[length].ecart > p->ecart))
6908  || ((set[length].GetpFDeg() + set[length].ecart == o)
6909  && (set[length].ecart == p->ecart)
6910  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6911  return length+1;
6912  int i;
6913  int an = 0;
6914  int en= length;
6915  loop
6916  {
6917  if (an >= en-1)
6918  {
6919  if ((set[an].GetpFDeg() + set[an].ecart > o)
6920  || ((set[an].GetpFDeg() + set[an].ecart == o)
6921  && (set[an].ecart > p->ecart))
6922  || ((set[an].GetpFDeg() + set[an].ecart == o)
6923  && (set[an].ecart == p->ecart)
6924  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6925  return en;
6926  return an;
6927  }
6928  i=(an+en) / 2;
6929  if ((set[i].GetpFDeg() + set[i].ecart > o)
6930  || ((set[i].GetpFDeg() + set[i].ecart == o)
6931  && (set[i].ecart > p->ecart))
6932  || ((set[i].GetpFDeg() +set[i].ecart == o)
6933  && (set[i].ecart == p->ecart)
6934  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6935  an=i;
6936  else
6937  en=i;
6938  }
6939 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInL17_c()

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

Definition at line 6992 of file kutil.cc.

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

§ posInL17_cRing()

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

Definition at line 7056 of file kutil.cc.

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

§ posInL17Ring()

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

Definition at line 6942 of file kutil.cc.

6944 {
6945  if (length<0) return 0;
6946 
6947  int o = p->GetpFDeg() + p->ecart;
6948 
6949  if ((set[length].GetpFDeg() + set[length].ecart > o)
6950  || ((set[length].GetpFDeg() + set[length].ecart == o)
6951  && (set[length].ecart > p->ecart))
6952  || ((set[length].GetpFDeg() + set[length].ecart == o)
6953  && (set[length].ecart == p->ecart)
6954  && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6955  return length+1;
6956  int i;
6957  int an = 0;
6958  int en= length;
6959  loop
6960  {
6961  if (an >= en-1)
6962  {
6963  if ((set[an].GetpFDeg() + set[an].ecart > o)
6964  || ((set[an].GetpFDeg() + set[an].ecart == o)
6965  && (set[an].ecart > p->ecart))
6966  || ((set[an].GetpFDeg() + set[an].ecart == o)
6967  && (set[an].ecart == p->ecart)
6968  && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6969  return en;
6970  return an;
6971  }
6972  i=(an+en) / 2;
6973  if ((set[i].GetpFDeg() + set[i].ecart > o)
6974  || ((set[i].GetpFDeg() + set[i].ecart == o)
6975  && (set[i].ecart > p->ecart))
6976  || ((set[i].GetpFDeg() +set[i].ecart == o)
6977  && (set[i].ecart == p->ecart)
6978  && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6979  an=i;
6980  else
6981  en=i;
6982  }
6983 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInLF5C()

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

Definition at line 6389 of file kutil.cc.

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

§ posInLF5CRing()

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

Definition at line 6477 of file kutil.cc.

6479 {
6480  if (length<0) return 0;
6481  if(start == (length +1)) return (length+1);
6482  int o = p->GetpFDeg();
6483  int op = set[length].GetpFDeg();
6484 
6485  if ((op > o)
6486  || ((op == o) && (pLtCmpOrdSgnDiffM(set[length].p,p->p))))
6487  return length+1;
6488  int i;
6489  int an = start;
6490  int en= length;
6491  loop
6492  {
6493  if (an >= en-1)
6494  {
6495  op = set[an].GetpFDeg();
6496  if ((op > o)
6497  || ((op == o) && (pLtCmpOrdSgnDiffM(set[an].p,p->p))))
6498  return en;
6499  return an;
6500  }
6501  i=(an+en) / 2;
6502  op = set[i].GetpFDeg();
6503  if ((op > o)
6504  || ((op == o) && (pLtCmpOrdSgnDiffM(set[i].p,p->p))))
6505  an=i;
6506  else
6507  en=i;
6508  }
6509 }
#define pLtCmpOrdSgnDiffM(p, q)
Definition: polys.h:125
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInLrg0()

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

Definition at line 6615 of file kutil.cc.

6625 {
6626  if (length < 0) return 0;
6627 
6628  int o = p->GetpFDeg();
6629  int op = set[length].GetpFDeg();
6630 
6631  if ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
6632  return length + 1;
6633  int i;
6634  int an = 0;
6635  int en = length;
6636  loop
6637  {
6638  if (an >= en - 1)
6639  {
6640  op = set[an].GetpFDeg();
6641  if ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
6642  return en;
6643  return an;
6644  }
6645  i = (an+en) / 2;
6646  op = set[i].GetpFDeg();
6647  if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
6648  an = i;
6649  else
6650  en = i;
6651  }
6652 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInLRing()

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

Definition at line 6288 of file kutil.cc.

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

§ posInLSig()

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

Definition at line 6201 of file kutil.cc.

6203 {
6204  if (length<0) return 0;
6205  if (pLtCmp(set[length].sig,p->sig)== currRing->OrdSgn)
6206  return length+1;
6207 
6208  int i;
6209  int an = 0;
6210  int en= length;
6211  loop
6212  {
6213  if (an >= en-1)
6214  {
6215  if (pLtCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
6216  return an;
6217  }
6218  i=(an+en) / 2;
6219  if (pLtCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
6220  else en=i;
6221  /*aend. fuer lazy == in !=- machen */
6222  }
6223 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInLSigRing()

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

Definition at line 6225 of file kutil.cc.

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

§ posInLSpecial()

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

Definition at line 6100 of file kutil.cc.

6102 {
6103  if (length<0) return 0;
6104 
6105  int d=p->GetpFDeg();
6106  int op=set[length].GetpFDeg();
6107 
6108  if ((op > d)
6109  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
6110  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
6111  return length+1;
6112 
6113  int i;
6114  int an = 0;
6115  int en= length;
6116  loop
6117  {
6118  if (an >= en-1)
6119  {
6120  op=set[an].GetpFDeg();
6121  if ((op > d)
6122  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
6123  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
6124  return en;
6125  return an;
6126  }
6127  i=(an+en) / 2;
6128  op=set[i].GetpFDeg();
6129  if ((op>d)
6130  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
6131  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
6132  an=i;
6133  else
6134  en=i;
6135  }
6136 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10

§ posInS()

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

Definition at line 5112 of file kutil.cc.

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

§ posInSMonFirst()

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

Definition at line 5213 of file kutil.cc.

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

§ posInSyz()

int posInSyz ( const kStrategy  strat,
poly  sig 
)

Definition at line 6361 of file kutil.cc.

6362 {
6363  if (strat->syzl==0) return 0;
6364  if (pLtCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
6365  return strat->syzl;
6366  int i;
6367  int an = 0;
6368  int en= strat->syzl-1;
6369  loop
6370  {
6371  if (an >= en-1)
6372  {
6373  if (pLtCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
6374  return an;
6375  }
6376  i=(an+en) / 2;
6377  if (pLtCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
6378  else en=i;
6379  /*aend. fuer lazy == in !=- machen */
6380  }
6381 }
loop
Definition: myNF.cc:98
#define pLtCmp(p, q)
Definition: polys.h:123
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

§ posInT0()

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

Definition at line 5335 of file kutil.cc.

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

§ posInT1()

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

Definition at line 5346 of file kutil.cc.

5347 {
5348  if (length==-1) return 0;
5349 
5350  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
5351 
5352  int i;
5353  int an = 0;
5354  int en= length;
5355 
5356  loop
5357  {
5358  if (an >= en-1)
5359  {
5360  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
5361  return en;
5362  }
5363  i=(an+en) / 2;
5364  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
5365  else an=i;
5366  }
5367 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInT11()

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

Definition at line 5404 of file kutil.cc.

5405 {
5406  if (length==-1) return 0;
5407 
5408  int o = p.GetpFDeg();
5409  int op = set[length].GetpFDeg();
5410 
5411  if ((op < o)
5412  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5413  return length+1;
5414 
5415  int i;
5416  int an = 0;
5417  int en= length;
5418 
5419  loop
5420  {
5421  if (an >= en-1)
5422  {
5423  op= set[an].GetpFDeg();
5424  if ((op > o)
5425  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5426  return an;
5427  return en;
5428  }
5429  i=(an+en) / 2;
5430  op = set[i].GetpFDeg();
5431  if (( op > o)
5432  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5433  en=i;
5434  else
5435  an=i;
5436  }
5437 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInT110()

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

Definition at line 5557 of file kutil.cc.

5558 {
5559  p.GetpLength();
5560  if (length==-1) return 0;
5561 
5562  int o = p.GetpFDeg();
5563  int op = set[length].GetpFDeg();
5564 
5565  if (( op < o)
5566  || (( op == o) && (set[length].length<p.length))
5567  || (( op == o) && (set[length].length == p.length)
5568  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5569  return length+1;
5570 
5571  int i;
5572  int an = 0;
5573  int en= length;
5574  loop
5575  {
5576  if (an >= en-1)
5577  {
5578  op = set[an].GetpFDeg();
5579  if (( op > o)
5580  || (( op == o) && (set[an].length > p.length))
5581  || (( op == o) && (set[an].length == p.length)
5582  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5583  return an;
5584  return en;
5585  }
5586  i=(an+en) / 2;
5587  op = set[i].GetpFDeg();
5588  if (( op > o)
5589  || (( op == o) && (set[i].length > p.length))
5590  || (( op == o) && (set[i].length == p.length)
5591  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5592  en=i;
5593  else
5594  an=i;
5595  }
5596 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInT110Ring()

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

Definition at line 5599 of file kutil.cc.

5600 {
5601  p.GetpLength();
5602  if (length==-1) return 0;
5603 
5604  int o = p.GetpFDeg();
5605  int op = set[length].GetpFDeg();
5606 
5607  if (( op < o)
5608  || (( op == o) && (set[length].length<p.length))
5609  || (( op == o) && (set[length].length == p.length)
5610  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5611  return length+1;
5612 
5613  int i;
5614  int an = 0;
5615  int en= length;
5616  loop
5617  {
5618  if (an >= en-1)
5619  {
5620  op = set[an].GetpFDeg();
5621  if (( op > o)
5622  || (( op == o) && (set[an].length > p.length))
5623  || (( op == o) && (set[an].length == p.length)
5624  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5625  return an;
5626  return en;
5627  }
5628  i=(an+en) / 2;
5629  op = set[i].GetpFDeg();
5630  if (( op > o)
5631  || (( op == o) && (set[i].length > p.length))
5632  || (( op == o) && (set[i].length == p.length)
5633  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5634  en=i;
5635  else
5636  an=i;
5637  }
5638 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

§ posInT11Ring()

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

Definition at line 5440 of file kutil.cc.

5441 {
5442  if (length==-1) return 0;
5443 
5444  int o = p.GetpFDeg();
5445  int op = set[length].GetpFDeg();
5446 
5447  if ((op < o)
5448  || ((op == o) && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5449  return length+1;
5450 
5451  int i;
5452  int an = 0;
5453  int en= length;
5454 
5455  loop
5456  {
5457  if (an >= en-1)
5458  {
5459  op= set[an].GetpFDeg();
5460  if ((op > o)
5461  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5462  return an;
5463  return en;
5464  }
5465  i=(an+en) / 2;
5466  op = set[i].GetpFDeg();
5467  if (( op > o)
5468  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5469  en=i;
5470  else
5471  an=i;
5472  }
5473 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

§ posInT13()

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

Definition at line 5646 of file kutil.cc.

5647 {
5648  if (length==-1) return 0;
5649 
5650  int o = p.GetpFDeg();
5651 
5652  if (set[length].GetpFDeg() <= o)
5653  return length+1;
5654 
5655  int i;
5656  int an = 0;
5657  int en= length;
5658  loop
5659  {
5660  if (an >= en-1)
5661  {
5662  if (set[an].GetpFDeg() > o)
5663  return an;
5664  return en;
5665  }
5666  i=(an+en) / 2;
5667  if (set[i].GetpFDeg() > o)
5668  en=i;
5669  else
5670  an=i;
5671  }
5672 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInT15()

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

Definition at line 5714 of file kutil.cc.

5733 {
5734  if (length==-1) return 0;
5735 
5736  int o = p.GetpFDeg() + p.ecart;
5737  int op = set[length].GetpFDeg()+set[length].ecart;
5738 
5739  if ((op < o)
5740  || ((op == o)
5741  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5742  return length+1;
5743 
5744  int i;
5745  int an = 0;
5746  int en= length;
5747  loop
5748  {
5749  if (an >= en-1)
5750  {
5751  op = set[an].GetpFDeg()+set[an].ecart;
5752  if (( op > o)
5753  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5754  return an;
5755  return en;
5756  }
5757  i=(an+en) / 2;
5758  op = set[i].GetpFDeg()+set[i].ecart;
5759  if (( op > o)
5760  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5761  en=i;
5762  else
5763  an=i;
5764  }
5765 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInT15Ring()

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

Definition at line 5768 of file kutil.cc.

5769 {
5770  if (length==-1) return 0;
5771 
5772  int o = p.GetpFDeg() + p.ecart;
5773  int op = set[length].GetpFDeg()+set[length].ecart;
5774 
5775  if ((op < o)
5776  || ((op == o)
5777  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5778  return length+1;
5779 
5780  int i;
5781  int an = 0;
5782  int en= length;
5783  loop
5784  {
5785  if (an >= en-1)
5786  {
5787  op = set[an].GetpFDeg()+set[an].ecart;
5788  if (( op > o)
5789  || (( op == o) && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5790  return an;
5791  return en;
5792  }
5793  i=(an+en) / 2;
5794  op = set[i].GetpFDeg()+set[i].ecart;
5795  if (( op > o)
5796  || (( op == o) && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5797  en=i;
5798  else
5799  an=i;
5800  }
5801 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

§ posInT17()

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

Definition at line 5809 of file kutil.cc.

5830 {
5831  if (length==-1) return 0;
5832 
5833  int o = p.GetpFDeg() + p.ecart;
5834  int op = set[length].GetpFDeg()+set[length].ecart;
5835 
5836  if ((op < o)
5837  || (( op == o) && (set[length].ecart > p.ecart))
5838  || (( op == o) && (set[length].ecart==p.ecart)
5839  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
5840  return length+1;
5841 
5842  int i;
5843  int an = 0;
5844  int en= length;
5845  loop
5846  {
5847  if (an >= en-1)
5848  {
5849  op = set[an].GetpFDeg()+set[an].ecart;
5850  if (( op > o)
5851  || (( op == o) && (set[an].ecart < p.ecart))
5852  || (( op == o) && (set[an].ecart==p.ecart)
5853  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
5854  return an;
5855  return en;
5856  }
5857  i=(an+en) / 2;
5858  op = set[i].GetpFDeg()+set[i].ecart;
5859  if ((op > o)
5860  || (( op == o) && (set[i].ecart < p.ecart))
5861  || (( op == o) && (set[i].ecart == p.ecart)
5862  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
5863  en=i;
5864  else
5865  an=i;
5866  }
5867 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p<q w.r.t monomial ordering
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int i
Definition: cfEzgcd.cc:123

§ posInT17_c()

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

Definition at line 5916 of file kutil.cc.

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

§ posInT17_cRing()

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

Definition at line 5977 of file kutil.cc.

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

§ posInT17Ring()

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

Definition at line 5870 of file kutil.cc.

5871 {
5872  if (length==-1) return 0;
5873 
5874  int o = p.GetpFDeg() + p.ecart;
5875  int op = set[length].GetpFDeg()+set[length].ecart;
5876 
5877  if ((op < o)
5878  || (( op == o) && (set[length].ecart > p.ecart))
5879  || (( op == o) && (set[length].ecart==p.ecart)
5880  && (pLtCmpOrdSgnDiffP(set[length].p,p.p))))
5881  return length+1;
5882 
5883  int i;
5884  int an = 0;
5885  int en= length;
5886  loop
5887  {
5888  if (an >= en-1)
5889  {
5890  op = set[an].GetpFDeg()+set[an].ecart;
5891  if (( op > o)
5892  || (( op == o) && (set[an].ecart < p.ecart))
5893  || (( op == o) && (set[an].ecart==p.ecart)
5894  && (pLtCmpOrdSgnEqP(set[an].p,p.p))))
5895  return an;
5896  return en;
5897  }
5898  i=(an+en) / 2;
5899  op = set[i].GetpFDeg()+set[i].ecart;
5900  if ((op > o)
5901  || (( op == o) && (set[i].ecart < p.ecart))
5902  || (( op == o) && (set[i].ecart == p.ecart)
5903  && (pLtCmpOrdSgnEqP(set[i].p,p.p))))
5904  en=i;
5905  else
5906  an=i;
5907  }
5908 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define pLtCmpOrdSgnDiffP(p, q)
Definition: polys.h:126
int i
Definition: cfEzgcd.cc:123
#define pLtCmpOrdSgnEqP(p, q)
Definition: polys.h:128

§ posInT19()

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

Definition at line 6043 of file kutil.cc.

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

§ posInT2()

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

Definition at line 5374 of file kutil.cc.

5375 {
5376  p.GetpLength();
5377  if (length==-1)
5378  return 0;
5379  if (set[length].length<p.length)
5380  return length+1;
5381 
5382  int i;
5383  int an = 0;
5384  int en= length;
5385 
5386  loop
5387  {
5388  if (an >= en-1)
5389  {
5390  if (set[an].length>p.length) return an;
5391  return en;
5392  }
5393  i=(an+en) / 2;
5394  if (set[i].length>p.length) en=i;
5395  else an=i;
5396  }
5397 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123

§ posInT_EcartFDegpLength()

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

Definition at line 11567 of file kutil.cc.

11568 {
11569 
11570  if (length==-1) return 0;
11571 
11572  int o = p.ecart;
11573  int op=p.GetpFDeg();
11574  int ol = p.GetpLength();
11575 
11576  if (set[length].ecart < o)
11577  return length+1;
11578  if (set[length].ecart == o)
11579  {
11580  int oo=set[length].GetpFDeg();
11581  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11582  return length+1;
11583  }
11584 
11585  int i;
11586  int an = 0;
11587  int en= length;
11588  loop
11589  {
11590  if (an >= en-1)
11591  {
11592  if (set[an].ecart > o)
11593  return an;
11594  if (set[an].ecart == o)
11595  {
11596  int oo=set[an].GetpFDeg();
11597  if((oo > op)
11598  || ((oo==op) && (set[an].pLength > ol)))
11599  return an;
11600  }
11601  return en;
11602  }
11603  i=(an+en) / 2;
11604  if (set[i].ecart > o)
11605  en=i;
11606  else if (set[i].ecart == o)
11607  {
11608  int oo=set[i].GetpFDeg();
11609  if ((oo > op)
11610  || ((oo == op) && (set[i].pLength > ol)))
11611  en=i;
11612  else
11613  an=i;
11614  }
11615  else
11616  an=i;
11617  }
11618 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ posInT_EcartpLength()

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

Definition at line 5675 of file kutil.cc.

5676 {
5677  int ol = p.GetpLength();
5678  if (length==-1) return 0;
5679 
5680  int op=p.ecart;
5681 
5682  int oo=set[length].ecart;
5683  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
5684  return length+1;
5685 
5686  int i;
5687  int an = 0;
5688  int en= length;
5689  loop
5690  {
5691  if (an >= en-1)
5692  {
5693  int oo=set[an].ecart;
5694  if((oo > op)
5695  || ((oo==op) && (set[an].pLength > ol)))
5696  return an;
5697  return en;
5698  }
5699  i=(an+en) / 2;
5700  int oo=set[i].ecart;
5701  if ((oo > op)
5702  || ((oo == op) && (set[i].pLength > ol)))
5703  en=i;
5704  else
5705  an=i;
5706  }
5707 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ posInT_FDegpLength()

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

Definition at line 11621 of file kutil.cc.

11622 {
11623 
11624  if (length==-1) return 0;
11625 
11626  int op=p.GetpFDeg();
11627  int ol = p.GetpLength();
11628 
11629  int oo=set[length].GetpFDeg();
11630  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
11631  return length+1;
11632 
11633  int i;
11634  int an = 0;
11635  int en= length;
11636  loop
11637  {
11638  if (an >= en-1)
11639  {
11640  int oo=set[an].GetpFDeg();
11641  if((oo > op)
11642  || ((oo==op) && (set[an].pLength > ol)))
11643  return an;
11644  return en;
11645  }
11646  i=(an+en) / 2;
11647  int oo=set[i].GetpFDeg();
11648  if ((oo > op)
11649  || ((oo == op) && (set[i].pLength > ol)))
11650  en=i;
11651  else
11652  an=i;
11653  }
11654 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ posInT_pLength()

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

Definition at line 11658 of file kutil.cc.

11659 {
11660  int ol = p.GetpLength();
11661  if (length==-1)
11662  return 0;
11663  if (set[length].length<p.length)
11664  return length+1;
11665 
11666  int i;
11667  int an = 0;
11668  int en= length;
11669 
11670  loop
11671  {
11672  if (an >= en-1)
11673  {
11674  if (set[an].pLength>ol) return an;
11675  return en;
11676  }
11677  i=(an+en) / 2;
11678  if (set[i].pLength>ol) en=i;
11679  else an=i;
11680  }
11681 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static int pLength(poly a)
Definition: p_polys.h:189
int i
Definition: cfEzgcd.cc:123

§ posInTrg0()

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

Definition at line 5481 of file kutil.cc.

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

§ postReduceByMon()

void postReduceByMon ( LObject h,
kStrategy  strat 
)

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

Definition at line 10926 of file kutil.cc.

10927 {
10928  if(!nCoeff_is_Ring_Z(currRing->cf))
10929  return;
10930  poly pH = h->GetP();
10931  poly p,pp;
10932  p = pH;
10933  bool deleted = FALSE, ok = FALSE;
10934  for(int i = 0; i<=strat->sl; i++)
10935  {
10936  p = pH;
10937  if(pNext(strat->S[i]) == NULL)
10938  {
10939  //pWrite(p);
10940  //pWrite(strat->S[i]);
10941  while(ok == FALSE && p != NULL)
10942  {
10943  if(pLmDivisibleBy(strat->S[i], p))
10944  {
10945  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
10946  p_SetCoeff(p,dummy,currRing);
10947  }
10948  if(nIsZero(p->coef))
10949  {
10950  pLmDelete(&p);
10951  h->p = p;
10952  deleted = TRUE;
10953  }
10954  else
10955  {
10956  ok = TRUE;
10957  }
10958  }
10959  pp = pNext(p);
10960  while(pp != NULL)
10961  {
10962  if(pLmDivisibleBy(strat->S[i], pp))
10963  {
10964  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
10965  p_SetCoeff(pp,dummy,currRing);
10966  if(nIsZero(pp->coef))
10967  {
10968  pLmDelete(&pNext(p));
10969  pp = pNext(p);
10970  deleted = TRUE;
10971  }
10972  else
10973  {
10974  p = pp;
10975  pp = pNext(p);
10976  }
10977  }
10978  else
10979  {
10980  p = pp;
10981  pp = pNext(p);
10982  }
10983  }
10984  }
10985  }
10986  h->SetLmCurrRing();
10987  if(deleted)
10988  strat->initEcart(h);
10989 }
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:97
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:101
#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:276
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:302
#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:346
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978

§ postReduceByMonSig()

void postReduceByMonSig ( LObject h,
kStrategy  strat 
)

Definition at line 10991 of file kutil.cc.

10992 {
10993  if(!nCoeff_is_Ring_Z(currRing->cf))
10994  return;
10995  poly hSig = h->sig;
10996  poly pH = h->GetP();
10997  poly p,pp;
10998  p = pH;
10999  bool deleted = FALSE, ok = FALSE;
11000  for(int i = 0; i<=strat->sl; i++)
11001  {
11002  p = pH;
11003  if(pNext(strat->S[i]) == NULL)
11004  {
11005  while(ok == FALSE && p!=NULL)
11006  {
11007  if(pLmDivisibleBy(strat->S[i], p))
11008  {
11009  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11010  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11011  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11012  {
11013  number dummy = n_IntMod(p->coef, strat->S[i]->coef, currRing->cf);
11014  p_SetCoeff(p,dummy,currRing);
11015  }
11016  pDelete(&sigMult);
11017  }
11018  if(nIsZero(p->coef))
11019  {
11020  pLmDelete(&p);
11021  h->p = p;
11022  deleted = TRUE;
11023  }
11024  else
11025  {
11026  ok = TRUE;
11027  }
11028  }
11029  if(p == NULL)
11030  return;
11031  pp = pNext(p);
11032  while(pp != NULL)
11033  {
11034  if(pLmDivisibleBy(strat->S[i], pp))
11035  {
11036  poly sigMult = pDivideM(pHead(p),pHead(strat->S[i]));
11037  sigMult = ppMult_mm(sigMult,pCopy(strat->sig[i]));
11038  if(sigMult!= NULL && pLtCmp(hSig,sigMult) == 1)
11039  {
11040  number dummy = n_IntMod(pp->coef, strat->S[i]->coef, currRing->cf);
11041  p_SetCoeff(pp,dummy,currRing);
11042  if(nIsZero(pp->coef))
11043  {
11044  pLmDelete(&pNext(p));
11045  pp = pNext(p);
11046  deleted = TRUE;
11047  }
11048  else
11049  {
11050  p = pp;
11051  pp = pNext(p);
11052  }
11053  }
11054  else
11055  {
11056  p = pp;
11057  pp = pNext(p);
11058  }
11059  pDelete(&sigMult);
11060  }
11061  else
11062  {
11063  p = pp;
11064  pp = pNext(p);
11065  }
11066  }
11067  }
11068  }
11069  h->SetLmCurrRing();
11070  if(deleted)
11071  strat->initEcart(h);
11072 
11073 }
polyset sig
Definition: kutil.h:304
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:97
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:101
#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:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define pDivideM(a, b)
Definition: polys.h:277
int i
Definition: cfEzgcd.cc:123
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
polyset S
Definition: kutil.h:302
#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:346
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 10758 of file kutil.cc.

10759 {
10761  if(!nCoeff_is_Ring_Z(currRing->cf))
10762  return NULL;
10763  ideal F = idCopy(Forig);
10764  idSkipZeroes(F);
10765  poly pmon;
10766  ring origR = currRing;
10767  ideal monred = idInit(1,1);
10768  for(int i=0; i<idElem(F); i++)
10769  {
10770  if(pNext(F->m[i]) == NULL)
10771  idInsertPoly(monred, pCopy(F->m[i]));
10772  }
10773  int posconst = idPosConstant(F);
10774  if((posconst != -1) && (!nIsZero(F->m[posconst]->coef)))
10775  {
10776  idDelete(&F);
10777  idDelete(&monred);
10778  return NULL;
10779  }
10780  int idelemQ = 0;
10781  if(Q!=NULL)
10782  {
10783  idelemQ = IDELEMS(Q);
10784  for(int i=0; i<idelemQ; i++)
10785  {
10786  if(pNext(Q->m[i]) == NULL)
10787  idInsertPoly(monred, pCopy(Q->m[i]));
10788  }
10789  idSkipZeroes(monred);
10790  posconst = idPosConstant(monred);
10791  //the constant, if found, will be from Q
10792  if((posconst != -1) && (!nIsZero(monred->m[posconst]->coef)))
10793  {
10794  pmon = pCopy(monred->m[posconst]);
10795  idDelete(&F);
10796  idDelete(&monred);
10797  return pmon;
10798  }
10799  }
10800  ring QQ_ring = rCopy0(currRing,FALSE);
10801  nKillChar(QQ_ring->cf);
10802  QQ_ring->cf = nInitChar(n_Q, NULL);
10803  rComplete(QQ_ring,1);
10804  QQ_ring = rAssure_c_dp(QQ_ring);
10805  rChangeCurrRing(QQ_ring);
10806  nMapFunc nMap = n_SetMap(origR->cf, QQ_ring->cf);
10807  ideal II = idInit(IDELEMS(F)+idelemQ+2,id_RankFreeModule(F, origR));
10808  for(int i = 0, j = 0; i<IDELEMS(F); i++)
10809  II->m[j++] = prMapR(F->m[i], nMap, origR, QQ_ring);
10810  for(int i = 0, j = IDELEMS(F); i<idelemQ; i++)
10811  II->m[j++] = prMapR(Q->m[i], nMap, origR, QQ_ring);
10812  ideal one = kStd(II, NULL, isNotHomog, NULL);
10813  idSkipZeroes(one);
10814  if(idIsConstant(one))
10815  {
10816  //one should be <1>
10817  for(int i = IDELEMS(II)-1; i>=0; i--)
10818  if(II->m[i] != NULL)
10819  II->m[i+1] = II->m[i];
10820  II->m[0] = pOne();
10821  ideal syz = idSyzygies(II, isNotHomog, NULL);
10822  poly integer = NULL;
10823  for(int i = IDELEMS(syz)-1;i>=0; i--)
10824  {
10825  if(pGetComp(syz->m[i]) == 1)
10826  {
10827  pSetComp(syz->m[i],0);
10828  if(pIsConstant(pHead(syz->m[i])))
10829  {
10830  integer = pHead(syz->m[i]);
10831  break;
10832  }
10833  }
10834  }
10835  rChangeCurrRing(origR);
10836  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10837  pmon = prMapR(integer, nMap2, QQ_ring, origR);
10838  idDelete(&monred);
10839  idDelete(&F);
10840  id_Delete(&II,QQ_ring);
10841  id_Delete(&one,QQ_ring);
10842  id_Delete(&syz,QQ_ring);
10843  p_Delete(&integer,QQ_ring);
10844  rDelete(QQ_ring);
10845  return pmon;
10846  }
10847  else
10848  {
10849  if(idIs0(monred))
10850  {
10851  poly mindegmon = NULL;
10852  for(int i = 0; i<IDELEMS(one); i++)
10853  {
10854  if(pNext(one->m[i]) == NULL)
10855  {
10856  if(mindegmon == NULL)
10857  mindegmon = pCopy(one->m[i]);
10858  else
10859  {
10860  if(p_Deg(one->m[i], QQ_ring) < p_Deg(mindegmon, QQ_ring))
10861  mindegmon = pCopy(one->m[i]);
10862  }
10863  }
10864  }
10865  if(mindegmon != NULL)
10866  {
10867  for(int i = IDELEMS(II)-1; i>=0; i--)
10868  if(II->m[i] != NULL)
10869  II->m[i+1] = II->m[i];
10870  II->m[0] = pCopy(mindegmon);
10871  ideal syz = idSyzygies(II, isNotHomog, NULL);
10872  bool found = FALSE;
10873  for(int i = IDELEMS(syz)-1;i>=0; i--)
10874  {
10875  if(pGetComp(syz->m[i]) == 1)
10876  {
10877  pSetComp(syz->m[i],0);
10878  if(pIsConstant(pHead(syz->m[i])))
10879  {
10880  pSetCoeff(mindegmon, nCopy(syz->m[i]->coef));
10881  found = TRUE;
10882  break;
10883  }
10884  }
10885  }
10886  id_Delete(&syz,QQ_ring);
10887  if (found == FALSE)
10888  {
10889  rChangeCurrRing(origR);
10890  idDelete(&monred);
10891  idDelete(&F);
10892  id_Delete(&II,QQ_ring);
10893  id_Delete(&one,QQ_ring);
10894  rDelete(QQ_ring);
10895  return NULL;
10896  }
10897  rChangeCurrRing(origR);
10898  nMapFunc nMap2 = n_SetMap(QQ_ring->cf, origR->cf);
10899  pmon = prMapR(mindegmon, nMap2, QQ_ring, origR);
10900  idDelete(&monred);
10901  idDelete(&F);
10902  id_Delete(&II,QQ_ring);
10903  id_Delete(&one,QQ_ring);
10904  id_Delete(&syz,QQ_ring);
10905  rDelete(QQ_ring);
10906  return pmon;
10907  }
10908  }
10909  }
10910  rChangeCurrRing(origR);
10911  idDelete(&monred);
10912  idDelete(&F);
10913  id_Delete(&II,QQ_ring);
10914  id_Delete(&one,QQ_ring);
10915  rDelete(QQ_ring);
10916  return NULL;
10917 }
#define idPosConstant(I)
index of generator with leading term in ground ring (if any); otherwise -1
Definition: ideals.h:39
#define idDelete(H)
delete an ideal
Definition: ideals.h:31
#define FALSE
Definition: auxiliary.h:97
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:101
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:4893
#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:587
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:3435
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1321
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
BOOLEAN idInsertPoly(ideal h1, poly h2)
insert h2 into h1 (if h2 is not the zero polynomial) return TRUE iff h2 was indeed inserted ...
#define pSetComp(p, v)
Definition: polys.h:38
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:221
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:298
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:725
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idCopy(ideal A)
Definition: ideals.h:62
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:490
#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:329
#define idIsConstant(I)
Definition: ideals.h:42

§ redBba()

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

Definition at line 8826 of file kutil.cc.

8827 {
8828  int j = 0;
8829  unsigned long not_sev = ~ pGetShortExpVector(h);
8830 
8831  while (j <= maxIndex)
8832  {
8833  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
8834  {
8835  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8836  if (h==NULL) return NULL;
8837  j = 0;
8838  not_sev = ~ pGetShortExpVector(h);
8839  }
8840  else j++;
8841  }
8842  return h;
8843 }
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:302
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1078
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 8721 of file kutil.cc.

8722 {
8723  int j = 0;
8724  unsigned long not_sev = ~ pGetShortExpVector(h);
8725 
8726  while (j <= maxIndex)
8727  {
8728  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
8729  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
8730  else j++;
8731  }
8732  return h;
8733 }
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:302
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1088
unsigned long * sevS
Definition: kutil.h:318
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:280
BOOLEAN honey
Definition: kutil.h:376
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
BOOLEAN length_pLength
Definition: kutil.h:386
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
#define FALSE
Definition: auxiliary.h:97
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
static int doRed(LObject *h, TObject *with, BOOLEAN intoT, kStrategy strat, bool redMoraNF)
Definition: kstd1.cc:122
int tl
Definition: kutil.h:348
#define TRUE
Definition: auxiliary.h:101
unsigned long * sevT
Definition: kutil.h:321
#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:378
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1802
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
Definition: kstd2.cc:197
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
LSet L
Definition: kutil.h:323
BOOLEAN LDegLast
Definition: kutil.h:384
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
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:346
TSet T
Definition: kutil.h:322
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:351
#define TEST_OPT_REDTHROUGH
Definition: options.h:116
static Poly * h
Definition: janet.cc:978
int LazyDegree
Definition: kutil.h:351

§ 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:280
BOOLEAN honey
Definition: kutil.h:376
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:352
BOOLEAN length_pLength
Definition: kutil.h:386
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:349
BOOLEAN posInLDependsOnLength
Definition: kutil.h:388
#define TRUE
Definition: auxiliary.h:101
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:40
#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:371
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define TEST_OPT_OLDSTD
Definition: options.h:117
#define assume(x)
Definition: mod2.h:403
int kFindDivisibleByInS(const kStrategy strat, int *max_ind, LObject *L)
return -1 if no divisor is found number of first divisor in S, otherwise
Definition: kstd2.cc:197
void PrintS(const char *s)
Definition: reporter.cc:284
int int kStrategy strat
Definition: myNF.cc:68
LSet L
Definition: kutil.h:323
BOOLEAN LDegLast
Definition: kutil.h:384
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:349
ring tailRing
Definition: kutil.h:341
char overflow
Definition: kutil.h:403
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:346
TSet T
Definition: kutil.h:322
int kFindDivisibleByInT(const kStrategy strat, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:88
void wrp(poly p)
Definition: polys.h:293
int LazyPass
Definition: kutil.h:351
#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:351

§ redMora()

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

Definition at line 8850 of file kutil.cc.

8851 {
8852  int j=0;
8853  int e,l;
8854  unsigned long not_sev = ~ pGetShortExpVector(h);
8855 
8856  if (maxIndex >= 0)
8857  {
8858  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
8859  do
8860  {
8861  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
8862  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
8863  {
8864 #ifdef KDEBUG
8865  if (TEST_OPT_DEBUG)
8866  {
8867  PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);
8868  }
8869 #endif
8870  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
8871 #ifdef KDEBUG
8872  if(TEST_OPT_DEBUG)
8873  {
8874  PrintS(")\nto "); wrp(h); PrintLn();
8875  }
8876 #endif
8877  // pDelete(&h);
8878  if (h == NULL) return NULL;
8879  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
8880  j = 0;
8881  not_sev = ~ pGetShortExpVector(h);
8882  }
8883  else j++;
8884  }
8885  while (j <= maxIndex);
8886  }
8887  return h;
8888 }
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:302
BOOLEAN kHEdgeFound
Definition: kutil.h:375
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1078
void wrp(poly p)
Definition: polys.h:293
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94

§ redtail() [1/2]

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

Definition at line 7507 of file kutil.cc.

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

§ redtail() [2/2]

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

Definition at line 7577 of file kutil.cc.

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

§ redtailBba()

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

Definition at line 7583 of file kutil.cc.

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

§ redtailBba_Z()

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

Definition at line 7692 of file kutil.cc.

7694 {
7695  strat->redTailChange=FALSE;
7696  if (strat->noTailReduction) return L->GetLmCurrRing();
7697  poly h, p;
7698  p = h = L->GetLmTailRing();
7699  if ((h==NULL) || (pNext(h)==NULL))
7700  return L->GetLmCurrRing();
7701 
7702  TObject* With;
7703  // placeholder in case strat->tl < 0
7704  TObject With_s(strat->tailRing);
7705 
7706  LObject Ln(pNext(h), strat->tailRing);
7707  Ln.pLength = L->GetpLength() - 1;
7708 
7709  pNext(h) = NULL;
7710  if (L->p != NULL) pNext(L->p) = NULL;
7711  L->pLength = 1;
7712 
7713  Ln.PrepareRed(strat->use_buckets);
7714 
7715  int cnt=REDTAIL_CANONICALIZE;
7716  while(!Ln.IsNull())
7717  {
7718  loop
7719  {
7720  Ln.SetShortExpVector();
7721  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
7722  if (With == NULL) break;
7723  cnt--;
7724  if (cnt==0)
7725  {
7727  /*poly tmp=*/Ln.CanonicalizeP();
7728  }
7729  // we are in Z, do not call pNorm
7730  strat->redTailChange=TRUE;
7731  // test divisibility of coefs:
7732  poly p_Ln=Ln.GetLmCurrRing();
7733  poly p_With=With->GetLmCurrRing();
7734  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
7735  if (!nIsZero(z))
7736  {
7737  // subtract z*Ln, add z.Ln to L
7738  poly m=pHead(p_Ln);
7739  pSetCoeff(m,z);
7740  poly mm=pHead(m);
7741  pNext(h) = m;
7742  pIter(h);
7743  L->pLength++;
7744  mm=pNeg(mm);
7745  if (Ln.bucket!=NULL)
7746  {
7747  int dummy=1;
7748  kBucket_Add_q(Ln.bucket,mm,&dummy);
7749  }
7750  else
7751  {
7752  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
7753  Ln.GetP();
7754  if (Ln.p!=NULL)
7755  {
7756  Ln.p=pAdd(Ln.p,mm);
7757  if (Ln.t_p!=NULL)
7758  {
7759  pNext(Ln.t_p)=NULL;
7760  p_LmDelete(Ln.t_p,strat->tailRing);
7761  }
7762  }
7763  }
7764  }
7765  else
7766  nDelete(&z);
7767 
7768  if (ksReducePolyTail(L, With, &Ln))
7769  {
7770  // reducing the tail would violate the exp bound
7771  // set a flag and hope for a retry (in bba)
7772  strat->completeReduce_retry=TRUE;
7773  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
7774  do
7775  {
7776  pNext(h) = Ln.LmExtractAndIter();
7777  pIter(h);
7778  L->pLength++;
7779  } while (!Ln.IsNull());
7780  goto all_done;
7781  }
7782  if (Ln.IsNull()) goto all_done;
7783  With_s.Init(currRing);
7784  }
7785  pNext(h) = Ln.LmExtractAndIter();
7786  pIter(h);
7787  pNormalize(h);
7788  L->pLength++;
7789  }
7790 
7791  all_done:
7792  Ln.Delete();
7793  if (L->p != NULL) pNext(L->p) = pNext(p);
7794 
7795  if (strat->redTailChange)
7796  {
7797  L->length = 0;
7798  }
7799 
7800  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
7801  //L->Normalize(); // HANNES: should have a test
7802  kTest_L(L);
7803  return L->GetLmCurrRing();
7804 }
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:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define pNeg(p)
Definition: polys.h:181
#define TRUE
Definition: auxiliary.h:101
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:402
#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:7369
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
#define nDelete(n)
Definition: numbers.h:16
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#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:382
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:398
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

§ redtailBbaShift()

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

Definition at line 12639 of file kutil.cc.

12640 {
12641  /* for the shift case need to run it with withT = TRUE */
12642  strat->redTailChange=FALSE;
12643  if (strat->noTailReduction) return L->GetLmCurrRing();
12644  poly h, p;
12645  p = h = L->GetLmTailRing();
12646  if ((h==NULL) || (pNext(h)==NULL))
12647  return L->GetLmCurrRing();
12648 
12649  TObject* With;
12650  // placeholder in case strat->tl < 0
12651  TObject With_s(strat->tailRing);
12652 
12653  LObject Ln(pNext(h), strat->tailRing);
12654  Ln.pLength = L->GetpLength() - 1;
12655 
12656  pNext(h) = NULL;
12657  if (L->p != NULL) pNext(L->p) = NULL;
12658  L->pLength = 1;
12659 
12660  Ln.PrepareRed(strat->use_buckets);
12661 
12662  while(!Ln.IsNull())
12663  {
12664  loop
12665  {
12666  Ln.SetShortExpVector();
12667  if (withT)
12668  {
12669  int j;
12670  j = kFindDivisibleByInT(strat, &Ln);
12671  if (j < 0) break;
12672  With = &(strat->T[j]);
12673  }
12674  else
12675  {
12676  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
12677  if (With == NULL) break;
12678  }
12679  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
12680  {
12681  With->pNorm();
12682  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
12683  }
12684  strat->redTailChange=TRUE;
12685  if (ksReducePolyTail(L, With, &Ln))
12686  {
12687  // reducing the tail would violate the exp bound
12688  // set a flag and hope for a retry (in bba)
12689  strat->completeReduce_retry=TRUE;
12690  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
12691  do
12692  {
12693  pNext(h) = Ln.LmExtractAndIter();
12694  pIter(h);
12695  L->pLength++;
12696  } while (!Ln.IsNull());
12697  goto all_done;
12698  }
12699  if (Ln.IsNull()) goto all_done;
12700  if (! withT) With_s.Init(currRing);
12701  }
12702  pNext(h) = Ln.LmExtractAndIter();
12703  pIter(h);
12704  L->pLength++;
12705  }
12706 
12707  all_done:
12708  Ln.Delete();
12709  if (L->p != NULL) pNext(L->p) = pNext(p);
12710 
12711  if (strat->redTailChange)
12712  {
12713  L->length = 0;
12714  }
12715  L->Normalize(); // HANNES: should have a test
12716  kTest_L(L);
12717  return L->GetLmCurrRing();
12718 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1024
class sLObject LObject
Definition: kutil.h:60
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:97
BOOLEAN noTailReduction
Definition: kutil.h:377
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1051
#define TRUE
Definition: auxiliary.h:101
#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:402
#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:7369
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:322
BOOLEAN use_buckets
Definition: kutil.h:382
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:398
class sTObject TObject
Definition: kutil.h:59

§ reorderS()

void reorderS ( int *  suc,
kStrategy  strat 
)

Definition at line 5059 of file kutil.cc.

5060 {
5061  int i,j,at,ecart, s2r;
5062  int fq=0;
5063  unsigned long sev;
5064  poly p;
5065  int new_suc=strat->sl+1;
5066  i= *suc;
5067  if (i<0) i=0;
5068 
5069  for (; i<=strat->sl; i++)
5070  {
5071  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
5072  if (at != i)
5073  {
5074  if (new_suc > at) new_suc = at;
5075  p = strat->S[i];
5076  ecart = strat->ecartS[i];
5077  sev = strat->sevS[i];
5078  s2r = strat->S_2_R[i];
5079  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
5080  for (j=i; j>=at+1; j--)
5081  {
5082  strat->S[j] = strat->S[j-1];
5083  strat->ecartS[j] = strat->ecartS[j-1];
5084  strat->sevS[j] = strat->sevS[j-1];
5085  strat->S_2_R[j] = strat->S_2_R[j-1];
5086  }
5087  strat->S[at] = p;
5088  strat->ecartS[at] = ecart;
5089  strat->sevS[at] = sev;
5090  strat->S_2_R[at] = s2r;
5091  if (strat->fromQ!=NULL)
5092  {
5093  for (j=i; j>=at+1; j--)
5094  {
5095  strat->fromQ[j] = strat->fromQ[j-1];
5096  }
5097  strat->fromQ[at]=fq;
5098  }
5099  }
5100  }
5101  if (new_suc <= strat->sl) *suc=new_suc;
5102  else *suc=-1;
5103 }
int * S_2_R
Definition: kutil.h:340
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:317
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
intset ecartS
Definition: kutil.h:305
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:5112
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
polyrec * poly
Definition: hilb.h:10

§ sbaCheckGcdPair()

BOOLEAN sbaCheckGcdPair ( LObject h,
kStrategy  strat 
)

Definition at line 1645 of file kutil.cc.

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

11273 {
11274  int n = rBlocks(r); // Including trailing zero!
11275  // if sbaOrder == 1 => use (C,monomial order from r)
11276  if (strat->sbaOrder == 1)
11277  {
11278  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
11279  {
11280  return r;
11281  }
11282  ring res = rCopy0(r, TRUE, FALSE);
11283  res->order = (int *)omAlloc0((n+1)*sizeof(int));
11284  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
11285  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
11286  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
11287  res->wvhdl = wvhdl;
11288  for (int i=1; i<n; i++)
11289  {
11290  res->order[i] = r->order[i-1];
11291  res->block0[i] = r->block0[i-1];
11292  res->block1[i] = r->block1[i-1];
11293  res->wvhdl[i] = r->wvhdl[i-1];
11294  }
11295 
11296  // new 1st block
11297  res->order[0] = ringorder_C; // Prefix
11298  // removes useless secondary component order if defined in old ring
11299  for (int i=rBlocks(res); i>0; --i)
11300  {
11301  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11302  {
11303  res->order[i] = 0;
11304  }
11305  }
11306  rComplete(res, 1);
11307 #ifdef HAVE_PLURAL
11308  if (rIsPluralRing(r))
11309  {
11310  if ( nc_rComplete(r, res, false) ) // no qideal!
11311  {
11312 #ifndef SING_NDEBUG
11313  WarnS("error in nc_rComplete");
11314 #endif
11315  // cleanup?
11316 
11317  // rDelete(res);
11318  // return r;
11319 
11320  // just go on..
11321  }
11322  }
11323 #endif
11324  strat->tailRing = res;
11325  return (res);
11326  }
11327  // if sbaOrder == 3 => degree - position - ring order
11328  if (strat->sbaOrder == 3)
11329  {
11330  ring res = rCopy0(r, TRUE, FALSE);
11331  res->order = (int *)omAlloc0((n+2)*sizeof(int));
11332  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
11333  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
11334  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
11335  res->wvhdl = wvhdl;
11336  for (int i=2; i<n+2; i++)
11337  {
11338  res->order[i] = r->order[i-2];
11339  res->block0[i] = r->block0[i-2];
11340  res->block1[i] = r->block1[i-2];
11341  res->wvhdl[i] = r->wvhdl[i-2];
11342  }
11343 
11344  // new 1st block
11345  res->order[0] = ringorder_a; // Prefix
11346  res->block0[0] = 1;
11347  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
11348  for (int i=0; i<res->N; ++i)
11349  res->wvhdl[0][i] = 1;
11350  res->block1[0] = si_min(res->N, rVar(res));
11351  // new 2nd block
11352  res->order[1] = ringorder_C; // Prefix
11353  res->wvhdl[1] = NULL;
11354  // removes useless secondary component order if defined in old ring
11355  for (int i=rBlocks(res); i>1; --i)
11356  {
11357  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c)
11358  {
11359  res->order[i] = 0;
11360  }
11361  }
11362  rComplete(res, 1);
11363 #ifdef HAVE_PLURAL
11364  if (rIsPluralRing(r))
11365  {
11366  if ( nc_rComplete(r, res, false) ) // no qideal!
11367  {
11368 #ifndef SING_NDEBUG
11369  WarnS("error in nc_rComplete");
11370 #endif
11371  // cleanup?
11372 
11373  // rDelete(res);
11374  // return r;
11375 
11376  // just go on..
11377  }
11378  }
11379 #endif
11380  strat->tailRing = res;
11381  return (res);
11382  }
11383 
11384  // not sbaOrder == 1 => use Schreyer order
11385  // this is done by a trick when initializing the signatures
11386  // in initSLSba():
11387  // Instead of using the signature 1e_i for F->m[i], we start
11388  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
11389  // Schreyer order w.r.t. the underlying monomial order.
11390  // => we do not need to change the underlying polynomial ring at all!
11391 
11392  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
11393 
11394  /*
11395  else
11396  {
11397  ring res = rCopy0(r, FALSE, FALSE);
11398  // Create 2 more blocks for prefix/suffix:
11399  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
11400  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
11401  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
11402  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
11403 
11404  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
11405  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
11406 
11407  // new 1st block
11408  int j = 0;
11409  res->order[j] = ringorder_IS; // Prefix
11410  res->block0[j] = res->block1[j] = 0;
11411  // wvhdl[j] = NULL;
11412  j++;
11413 
11414  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
11415  {
11416  res->order [j] = r->order [i];
11417  res->block0[j] = r->block0[i];
11418  res->block1[j] = r->block1[i];
11419 
11420  if (r->wvhdl[i] != NULL)
11421  {
11422  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
11423  } // else wvhdl[j] = NULL;
11424  }
11425 
11426  // new last block
11427  res->order [j] = ringorder_IS; // Suffix
11428  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
11429  // wvhdl[j] = NULL;
11430  j++;
11431 
11432  // res->order [j] = 0; // The End!
11433  res->wvhdl = wvhdl;
11434 
11435  // j == the last zero block now!
11436  assume(j == (n+1));
11437  assume(res->order[0]==ringorder_IS);
11438  assume(res->order[j-1]==ringorder_IS);
11439  assume(res->order[j]==0);
11440 
11441  if (complete)
11442  {
11443  rComplete(res, 1);
11444 
11445 #ifdef HAVE_PLURAL
11446  if (rIsPluralRing(r))
11447  {
11448  if ( nc_rComplete(r, res, false) ) // no qideal!
11449  {
11450  }
11451  }
11452  assume(rIsPluralRing(r) == rIsPluralRing(res));
11453 #endif
11454 
11455 
11456 #ifdef HAVE_PLURAL
11457  ring old_ring = r;
11458 
11459 #endif
11460 
11461  if (r->qideal!=NULL)
11462  {
11463  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
11464 
11465  assume(idRankFreeModule(res->qideal, res) == 0);
11466 
11467 #ifdef HAVE_PLURAL
11468  if( rIsPluralRing(res) )
11469  if( nc_SetupQuotient(res, r, true) )
11470  {
11471  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
11472  }
11473 
11474 #endif
11475  assume(idRankFreeModule(res->qideal, res) == 0);
11476  }
11477 
11478 #ifdef HAVE_PLURAL
11479  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
11480  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
11481  assume(rIsSCA(res) == rIsSCA(old_ring));
11482  assume(ncRingType(res) == ncRingType(old_ring));
11483 #endif
11484  }
11485  strat->tailRing = res;
11486  return res;
11487  }
11488  */
11489 
11490  assume(FALSE);
11491  return(NULL);
11492 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:124
#define FALSE
Definition: auxiliary.h:97
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5527
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
#define TRUE
Definition: auxiliary.h:101
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:556
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3435
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1321
unsigned sbaOrder
Definition: kutil.h:312
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:341
#define omAlloc0(size)
Definition: omAllocDecl.h:211

§ showOption()

char* showOption ( )

Definition at line 717 of file misc_ip.cc.

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

§ sugarDivisibleBy()

static BOOLEAN sugarDivisibleBy ( int  ecart1,
int  ecart2 
)
inlinestatic

Definition at line 1267 of file kutil.cc.

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

§ superenterpairs()

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

Definition at line 4899 of file kutil.cc.

4900 {
4902  // enter also zero divisor * poly, if this is non zero and of smaller degree
4903  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
4904  initenterpairs(h, k, ecart, 0, strat, atR);
4905  initenterstrongPairs(h, k, ecart, 0, strat, atR);
4906  clearSbatch(h, k, pos, strat);
4907 }
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:4873
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3827
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:4611
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:480
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:4660
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
static Poly * h
Definition: janet.cc:978

§ superenterpairsSig()

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

Definition at line 4909 of file kutil.cc.

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

§ syzCriterion()

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

Definition at line 7123 of file kutil.cc.

7124 {
7125 //#if 1
7126 #ifdef DEBUGF5
7127  PrintS("syzygy criterion checks: ");
7128  pWrite(sig);
7129 #endif
7130  for (int k=0; k<strat->syzl; k++)
7131  {
7132  //printf("-%d",k);
7133 //#if 1
7134 #ifdef DEBUGF5
7135  Print("checking with: %d / %d -- \n",k,strat->syzl);
7136  pWrite(pHead(strat->syz[k]));
7137 #endif
7138  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing)
7139  && (!rField_is_Ring(currRing) ||
7140  (n_DivBy(pGetCoeff(sig), pGetCoeff(strat->syz[k]),currRing) && pLtCmp(sig,strat->syz[k]) == 1)))
7141  {
7142 //#if 1
7143 #ifdef DEBUGF5
7144  PrintS("DELETE!\n");
7145 #endif
7146  #ifdef ADIDEBUG
7147  printf("\nsyzCrit:\n");pWrite(strat->syz[k]);pWrite(sig);
7148  #endif
7149  strat->nrsyzcrit++;
7150  //printf("- T -\n\n");
7151  return TRUE;
7152  }
7153  }
7154  //printf("- F -\n\n");
7155  return FALSE;
7156 }
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:97
#define pLtCmp(p, q)
Definition: polys.h:123
#define TRUE
Definition: auxiliary.h:101
void pWrite(poly p)
Definition: polys.h:291
int k
Definition: cfEzgcd.cc:93
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
int nrsyzcrit
Definition: kutil.h:359
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:319
polyset syz
Definition: kutil.h:303
int syzl
Definition: kutil.h:347

§ syzCriterionInc()

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

Definition at line 7161 of file kutil.cc.

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

§ twoPow()

long twoPow ( long  arg)

Definition at line 4224 of file kutil.cc.

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

§ updateResult()

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

Definition at line 10296 of file kutil.cc.

10297 {
10298  int l;
10299  if (strat->ak>0)
10300  {
10301  for (l=IDELEMS(r)-1;l>=0;l--)
10302  {
10303  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
10304  {
10305  pDelete(&r->m[l]); // and set it to NULL
10306  }
10307  }
10308  int q;
10309  poly p;
10310  if(!rField_is_Ring(currRing))
10311  {
10312  for (l=IDELEMS(r)-1;l>=0;l--)
10313  {
10314  if ((r->m[l]!=NULL)
10315  //&& (strat->syzComp>0)
10316  //&& (pGetComp(r->m[l])<=strat->syzComp)
10317  )
10318  {
10319  for(q=IDELEMS(Q)-1; q>=0;q--)
10320  {
10321  if ((Q->m[q]!=NULL)
10322  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10323  {
10324  if (TEST_OPT_REDSB)
10325  {
10326  p=r->m[l];
10327  r->m[l]=kNF(Q,NULL,p);
10328  pDelete(&p);
10329  }
10330  else
10331  {
10332  pDelete(&r->m[l]); // and set it to NULL
10333  }
10334  break;
10335  }
10336  }
10337  }
10338  }
10339  }
10340  #ifdef HAVE_RINGS
10341  else
10342  {
10343  for (l=IDELEMS(r)-1;l>=0;l--)
10344  {
10345  if ((r->m[l]!=NULL)
10346  //&& (strat->syzComp>0)
10347  //&& (pGetComp(r->m[l])<=strat->syzComp)
10348  )
10349  {
10350  for(q=IDELEMS(Q)-1; q>=0;q--)
10351  {
10352  if ((Q->m[q]!=NULL)
10353  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
10354  {
10355  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
10356  {
10357  if (TEST_OPT_REDSB)
10358  {
10359  p=r->m[l];
10360  r->m[l]=kNF(Q,NULL,p);
10361  pDelete(&p);
10362  }
10363  else
10364  {
10365  pDelete(&r->m[l]); // and set it to NULL
10366  }
10367  break;
10368  }
10369  }
10370  }
10371  }
10372  }
10373  }
10374  #endif
10375  }
10376  else
10377  {
10378  int q;
10379  poly p;
10380  BOOLEAN reduction_found=FALSE;
10381  if (!rField_is_Ring(currRing))
10382  {
10383  for (l=IDELEMS(r)-1;l>=0;l--)
10384  {
10385  if (r->m[l]!=NULL)
10386  {
10387  for(q=IDELEMS(Q)-1; q>=0;q--)
10388  {
10389  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
10390  {
10391  if (TEST_OPT_REDSB)
10392  {
10393  p=r->m[l];
10394  r->m[l]=kNF(Q,NULL,p);
10395  pDelete(&p);
10396  reduction_found=TRUE;
10397  }
10398  else
10399  {
10400  pDelete(&r->m[l]); // and set it to NULL
10401  }
10402  break;
10403  }
10404  }
10405  }
10406  }
10407  }
10408  #ifdef HAVE_RINGS
10409  //Also need divisibility of the leading coefficients
10410  else
10411  {
10412  for (l=IDELEMS(r)-1;l>=0;l--)
10413  {
10414  if (r->m[l]!=NULL)
10415  {
10416  for(q=IDELEMS(Q)-1; q>=0;q--)
10417  {
10418  if(n_DivBy(r->m[l]->coef, Q->m[q]->coef, currRing))
10419  {
10420  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])) && pDivisibleBy(Q->m[q],r->m[l]))
10421  {
10422  if (TEST_OPT_REDSB)
10423  {
10424  p=r->m[l];
10425  r->m[l]=kNF(Q,NULL,p);
10426  pDelete(&p);
10427  reduction_found=TRUE;
10428  }
10429  else
10430  {
10431  pDelete(&r->m[l]); // and set it to NULL
10432  }
10433  break;
10434  }
10435  }
10436  }
10437  }
10438  }
10439  }
10440  #endif
10441  if (/*TEST_OPT_REDSB &&*/ reduction_found)
10442  {
10443  #ifdef HAVE_RINGS
10445  {
10446  for (l=IDELEMS(r)-1;l>=0;l--)
10447  {
10448  if (r->m[l]!=NULL)
10449  {
10450  for(q=IDELEMS(r)-1;q>=0;q--)
10451  {
10452  if ((l!=q)
10453  && (r->m[q]!=NULL)
10454  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10455  &&(n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing))
10456  )
10457  {
10458  //If they are equal then take the one with the smallest length
10459  if(pLmDivisibleBy(r->m[q],r->m[l])
10460  && n_DivBy(r->m[q]->coef, r->m[l]->coef, currRing)
10461  && (pLength(r->m[q]) < pLength(r->m[l]) ||
10462  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10463  {
10464  pDelete(&r->m[l]);
10465  break;
10466  }
10467  else
10468  pDelete(&r->m[q]);
10469  }
10470  }
10471  }
10472  }
10473  }
10474  else
10475  #endif
10476  {
10477  for (l=IDELEMS(r)-1;l>=0;l--)
10478  {
10479  if (r->m[l]!=NULL)
10480  {
10481  for(q=IDELEMS(r)-1;q>=0;q--)
10482  {
10483  if ((l!=q)
10484  && (r->m[q]!=NULL)
10485  &&(pLmDivisibleBy(r->m[l],r->m[q]))
10486  )
10487  {
10488  //If they are equal then take the one with the smallest length
10489  if(pLmDivisibleBy(r->m[q],r->m[l])
10490  &&(pLength(r->m[q]) < pLength(r->m[l]) ||
10491  (pLength(r->m[q]) == pLength(r->m[l]) && nGreaterZero(r->m[q]->coef))))
10492  {
10493  pDelete(&r->m[l]);
10494  break;
10495  }
10496  else
10497  pDelete(&r->m[q]);
10498  }
10499  }
10500  }
10501  }
10502  }
10503  }
10504  }
10505  idSkipZeroes(r);
10506 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2971
#define FALSE
Definition: auxiliary.h:97
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:101
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:351
#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
static int pLength(poly a)
Definition: p_polys.h:189
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
#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:88
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94

§ updateS()

void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 8895 of file kutil.cc.

8896 {
8897  LObject h;
8898  int i, suc=0;
8899  poly redSi=NULL;
8900  BOOLEAN change,any_change;
8901 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
8902 // for (i=0; i<=(strat->sl); i++)
8903 // {
8904 // Print("s%d:",i);
8905 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
8906 // pWrite(strat->S[i]);
8907 // }
8908 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
8909  any_change=FALSE;
8911  {
8912  while (suc != -1)
8913  {
8914  i=suc+1;
8915  while (i<=strat->sl)
8916  {
8917  change=FALSE;
8919  any_change = FALSE;
8920  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
8921  {
8922  redSi = pHead(strat->S[i]);
8923  strat->S[i] = redBba(strat->S[i],i-1,strat);
8924  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
8925  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
8926  if (pCmp(redSi,strat->S[i])!=0)
8927  {
8928  change=TRUE;
8929  any_change=TRUE;
8930  #ifdef KDEBUG
8931  if (TEST_OPT_DEBUG)
8932  {
8933  PrintS("reduce:");
8934  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
8935  }
8936  #endif
8937  if (TEST_OPT_PROT)
8938  {
8939  if (strat->S[i]==NULL)
8940  PrintS("V");
8941  else
8942  PrintS("v");
8943  mflush();
8944  }
8945  }
8946  pLmDelete(&redSi);
8947  if (strat->S[i]==NULL)
8948  {
8949  deleteInS(i,strat);
8950  i--;
8951  }
8952  else if (change)
8953  {
8955  {
8956  if (TEST_OPT_CONTENTSB)
8957  {
8958  number n;
8959  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8960  if (!nIsOne(n))
8961  {
8963  denom->n=nInvers(n);
8964  denom->next=DENOMINATOR_LIST;
8965  DENOMINATOR_LIST=denom;
8966  }
8967  nDelete(&n);
8968  }
8969  else
8970  {
8971  //pContent(strat->S[i]);
8972  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8973  }
8974  }
8975  else
8976  {
8977  pNorm(strat->S[i]);
8978  }
8979  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
8980  }
8981  }
8982  i++;
8983  }
8984  if (any_change) reorderS(&suc,strat);
8985  else break;
8986  }
8987  if (toT)
8988  {
8989  for (i=0; i<=strat->sl; i++)
8990  {
8991  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
8992  {
8993  h.p = redtailBba(strat->S[i],i-1,strat);
8995  {
8996  h.pCleardenom();// also does a pContent
8997  }
8998  }
8999  else
9000  {
9001  h.p = strat->S[i];
9002  }
9003  strat->initEcart(&h);
9004  if (strat->honey)
9005  {
9006  strat->ecartS[i] = h.ecart;
9007  }
9008  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
9009  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
9010  h.sev = strat->sevS[i];
9011  /*puts the elements of S also to T*/
9012  strat->initEcart(&h);
9013  enterT(h,strat);
9014  strat->S_2_R[i] = strat->tl;
9015  }
9016  }
9017  }
9018  else
9019  {
9020  while (suc != -1)
9021  {
9022  i=suc;
9023  while (i<=strat->sl)
9024  {
9025  change=FALSE;
9026  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
9027  {
9028  redSi=pHead((strat->S)[i]);
9029  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
9030  if ((strat->S)[i]==NULL)
9031  {
9032  deleteInS(i,strat);
9033  i--;
9034  }
9035  else if (pCmp((strat->S)[i],redSi)!=0)
9036  {
9037  any_change=TRUE;
9038  h.p = strat->S[i];
9039  strat->initEcart(&h);
9040  strat->ecartS[i] = h.ecart;
9042  {
9043  if (TEST_OPT_CONTENTSB)
9044  {
9045  number n;
9046  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
9047  if (!nIsOne(n))
9048  {
9050  denom->n=nInvers(n);
9051  denom->next=DENOMINATOR_LIST;
9052  DENOMINATOR_LIST=denom;
9053  }
9054  nDelete(&n);
9055  }
9056  else
9057  {
9058  //pContent(strat->S[i]);
9059  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
9060  }
9061  }
9062  else
9063  {
9064  pNorm(strat->S[i]); // == h.p
9065  }
9066  h.sev = pGetShortExpVector(h.p);
9067  strat->sevS[i] = h.sev;
9068  }
9069  pLmDelete(&redSi);
9070  kTest(strat);
9071  }
9072  i++;
9073  }
9074 #ifdef KDEBUG
9075  kTest(strat);
9076 #endif
9077  if (any_change) reorderS(&suc,strat);
9078  else { suc=-1; break; }
9079  if (h.p!=NULL)
9080  {
9081  if (!strat->kHEdgeFound)
9082  {
9083  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
9084  }
9085  if (strat->kHEdgeFound)
9086  newHEdge(strat);
9087  }
9088  }
9089  for (i=0; i<=strat->sl; i++)
9090  {
9091  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9092  {
9093  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
9094  strat->initEcart(&h);
9095  strat->ecartS[i] = h.ecart;
9096  h.sev = pGetShortExpVector(h.p);
9097  strat->sevS[i] = h.sev;
9098  }
9099  else
9100  {
9101  h.p = strat->S[i];
9102  h.ecart=strat->ecartS[i];
9103  h.sev = strat->sevS[i];
9104  h.length = h.pLength = pLength(h.p);
9105  }
9106  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
9107  cancelunit1(&h,&suc,strat->sl,strat);
9108  h.SetpFDeg();
9109  /*puts the elements of S also to T*/
9110  enterT(h,strat);
9111  strat->S_2_R[i] = strat->tl;
9112  }
9113  if (suc!= -1) updateS(toT,strat);
9114  }
9115 #ifdef KDEBUG
9116  kTest(strat);
9117 #endif
9118 }
denominator_list_s * denominator_list
Definition: kutil.h:65
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:7507
BOOLEAN honey
Definition: kutil.h:376
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:97
int * S_2_R
Definition: kutil.h:340
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:8738
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:5059
#define TEST_OPT_CONTENTSB
Definition: options.h:121
int tl
Definition: kutil.h:348
#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:101
#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:7583
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:482
static int pLength(poly a)
Definition: p_polys.h:189
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8826
void enterT(LObject &p, kStrategy strat, int atT)
Definition: kutil.cc:9364
#define mflush()
Definition: reporter.h:57
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2844
void(* initEcart)(TObject *L)
Definition: kutil.h:276
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:10
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:403
intset fromQ
Definition: kutil.h:317
#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
#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:302
#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:375
intset ecartS
Definition: kutil.h:305
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:477
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:746
ring tailRing
Definition: kutil.h:341
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:346
denominator_list next
Definition: kutil.h:67
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:8895
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:8850
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:237
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:10631
void wrp(poly p)
Definition: polys.h:293
polyrec * poly
Definition: hilb.h:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:88
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2716

§ updateSShift()

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

Definition at line 11952 of file kutil.cc.

11953 {
11954  /* to use after updateS(toT=FALSE,strat) */
11955  /* fills T with shifted elt's of S */
11956  int i;
11957  LObject h;
11958  int atT = -1; // or figure out smth better
11959  strat->tl = -1; // init
11960  for (i=0; i<=strat->sl; i++)
11961  {
11962  memset(&h,0,sizeof(h));
11963  h.p = strat->S[i]; // lm in currRing, tail in TR
11964  strat->initEcart(&h);
11965  h.sev = strat->sevS[i];
11966  h.t_p = NULL;
11967  h.GetTP(); // creates correct t_p
11968  /*puts the elements of S with their shifts to T*/
11969  // int atT, int uptodeg, int lV)
11970  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
11971  // need a small check for above; we insert >=1 elements
11972  // insert this check into kTest_TS ?
11973  enterTShift(h,strat,atT,uptodeg,lV);
11974  }
11975  /* what about setting strat->tl? */
11976 }
class sLObject LObject
Definition: kutil.h:60
int * S_2_R
Definition: kutil.h:340
int tl
Definition: kutil.h:348
void(* initEcart)(TObject *L)
Definition: kutil.h:276
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:12596
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:302
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:318
int sl
Definition: kutil.h:346
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.