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 KDEBUG   2
 
#define ENTER_USE_MEMMOVE
 
#define ADIDEBUG   0
 
#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 intinitS_2_R (const int maxnr)
 
static void enlargeT (TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
 
void cleanT (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=-1)
 
void enterOnePairNormal (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 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 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 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 enterExtendedSpoly (poly h, 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 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 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 posInTrg0 (const TSet set, const int length, LObject &p)
 
int posInT110 (const TSet set, const int length, LObject &p)
 
int posInT13 (const TSet set, const int length, LObject &p)
 
int posInT_EcartpLength (const TSet set, const int length, LObject &p)
 
int posInT15 (const TSet set, const int length, LObject &p)
 
int posInT17 (const TSet set, const int length, LObject &p)
 
int posInT17_c (const TSet set, const int length, LObject &p)
 
int posInT19 (const TSet set, const int length, LObject &p)
 
int posInLSpecial (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL0 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInLSig (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 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 posInL13 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL15 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17 (const LSet set, const int length, LObject *p, const kStrategy)
 
int posInL17_c (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 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 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 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)
 
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

#define ADIDEBUG   0

Definition at line 79 of file kutil.cc.

#define ENTER_USE_MEMMOVE

Definition at line 42 of file kutil.cc.

#define KDEBUG   2

Definition at line 27 of file kutil.cc.

#define KUTIL_CC

Definition at line 10 of file kutil.cc.

#define MYTEST   0

Definition at line 12 of file kutil.cc.

#define pDivComp_EQUAL   2

Definition at line 132 of file kutil.cc.

#define pDivComp_GREATER   -1

Definition at line 134 of file kutil.cc.

#define pDivComp_INCOMP   0

Definition at line 135 of file kutil.cc.

#define pDivComp_LESS   1

Definition at line 133 of file kutil.cc.

#define REDTAIL_CANONICALIZE   100

Function Documentation

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

Definition at line 5201 of file kutil.cc.

5202 {
5203  poly p1 = pOne();
5204  poly p2 = pOne();
5205  for (int ii=strat->sl; ii>start; ii--)
5206  {
5207  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], strat->P.sig, ~strat->P.sevSig, currRing))
5208  {
5209  p_ExpVectorSum(p1,strat->P.sig,strat->S[ii],currRing);
5210  p_ExpVectorSum(p2,strat->sig[ii],strat->P.p,currRing);
5211  if (!(pLmCmp(p1,p2) == 1))
5212  {
5213  pDelete(&p1);
5214  pDelete(&p2);
5215  return TRUE;
5216  }
5217  }
5218  }
5219  pDelete(&p1);
5220  pDelete(&p2);
5221  return FALSE;
5222 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:144
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h: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:1707
LObject P
Definition: kutil.h:300
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
#define pDelete(p_ptr)
Definition: polys.h:157
int sl
Definition: kutil.h:351
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:1353
BOOLEAN arriRewCriterionPre ( poly  sig,
unsigned long  not_sevSig,
poly  lm,
kStrategy  strat,
int   
)

Definition at line 5224 of file kutil.cc.

5225 {
5226  int found = -1;
5227  for (int i=strat->Bl; i>-1; i--) {
5228  if (pLmEqual(strat->B[i].sig,sig)) {
5229  found = i;
5230  break;
5231  }
5232  }
5233  if (found != -1) {
5234  if (pLmCmp(lm,strat->B[found].GetLmCurrRing()) == -1) {
5235  deleteInL(strat->B,&strat->Bl,found,strat);
5236  } else {
5237  return TRUE;
5238  }
5239  }
5240  poly p1 = pOne();
5241  poly p2 = pOne();
5242  for (int ii=strat->sl; ii>-1; ii--)
5243  {
5244  if (p_LmShortDivisibleBy(strat->sig[ii], strat->sevSig[ii], sig, not_sevSig, currRing))
5245  {
5246  p_ExpVectorSum(p1,sig,strat->S[ii],currRing);
5247  p_ExpVectorSum(p2,strat->sig[ii],lm,currRing);
5248  if (!(pLmCmp(p1,p2) == 1))
5249  {
5250  pDelete(&p1);
5251  pDelete(&p2);
5252  return TRUE;
5253  }
5254  }
5255  }
5256  pDelete(&p1);
5257  pDelete(&p2);
5258  return FALSE;
5259 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
#define FALSE
Definition: auxiliary.h:140
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int Bl
Definition: kutil.h:355
#define TRUE
Definition: auxiliary.h:144
bool found
Definition: facFactorize.cc:56
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h: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:1707
int i
Definition: cfEzgcd.cc:123
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
LSet B
Definition: kutil.h:326
#define pDelete(p_ptr)
Definition: polys.h:157
int sl
Definition: kutil.h:351
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:1353
#define pLmEqual(p1, p2)
Definition: polys.h:111
void cancelunit ( LObject L,
BOOLEAN  inNF 
)

Definition at line 324 of file kutil.cc.

325 {
326  int i;
327  poly h;
328  number lc;
329 
330  if(rHasGlobalOrdering (currRing)) return;
331  if(TEST_OPT_CANCELUNIT) return;
332 
333  ring r = L->tailRing;
334  poly p = L->GetLmTailRing();
335 
336 #ifdef HAVE_RINGS
337  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
338  lc = pGetCoeff(p);
339 #endif
340 
341 #ifdef HAVE_RINGS
342  // Leading coef have to be a unit
343  // example 2x+4x2 should be simplified to 2x*(1+2x)
344  // and 2 is not a unit in Z
345  //if ( !(n_IsUnit(pGetCoeff(p), r->cf)) ) return;
346 #endif
347 
348  if(p_GetComp(p, r) != 0 && !p_OneComp(p, r)) return;
349 
350 // for(i=r->N;i>0;i--)
351 // {
352 // if ((p_GetExp(p,i,r)>0) && (rIsPolyVar(i, r)==TRUE)) return;
353 // }
354  h = pNext(p);
355 
356  loop
357  {
358  if (h==NULL)
359  {
360  p_Delete(&pNext(p), r);
361  if (!inNF)
362  {
363  number eins;
364 #ifdef HAVE_RINGS
365  if (rField_is_Ring(r) /*&& (rHasLocalOrMixedOrdering(r))*/)
366  eins = nCopy(lc);
367  else
368 #endif
369  eins=nInit(1);
370  if (L->p != NULL)
371  {
372  pSetCoeff(L->p,eins);
373  if (L->t_p != NULL)
374  pSetCoeff0(L->t_p,eins);
375  }
376  else
377  pSetCoeff(L->t_p,eins);
378  /* p and t_p share the same coeff, if both are !=NULL */
379  /* p==NULL==t_p cannot happen here */
380  }
381  L->ecart = 0;
382  L->length = 1;
383  //if (L->pLength > 0)
384  L->pLength = 1;
385  L->max = NULL;
386 
387  if (L->t_p != NULL && pNext(L->t_p) != NULL)
388  p_Delete(&pNext(L->t_p),r);
389  if (L->p != NULL && pNext(L->p) != NULL)
390  pNext(L->p) = NULL;
391 
392  return;
393  }
394  i = 0;
395  loop
396  {
397  i++;
398  if (p_GetExp(p,i,r) > p_GetExp(h,i,r)) return ; // does not divide
399  #ifdef HAVE_RINGS
400  // Note: As long as qring j forbidden if j contains integer (i.e. ground rings are
401  // domains), no zerodivisor test needed CAUTION
402  if (rField_is_Ring(r) /*&&(rHasLocalOrMixedOrdering(r)) */)
403  if(n_DivBy(pGetCoeff(h),lc,r->cf) == 0)
404  return;
405  #endif
406  if (i == r->N) break; // does divide, try next monom
407  }
408  pIter(h);
409  }
410 }
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
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:12
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:465
polyrec * poly
Definition: hilb.h:10
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
BOOLEAN p_OneComp(poly p, const ring r)
return TRUE if all monoms have the same component
Definition: p_polys.cc:1207
void cancelunit1 ( LObject p,
int suc,
int  index,
kStrategy  strat 
)

Definition at line 6543 of file kutil.cc.

6544 {
6545  int k;
6546  poly r,h,h1,q;
6547 
6548  if (!pIsVector((*p).p) && ((*p).ecart != 0))
6549  {
6550 #ifdef HAVE_RINGS
6551  // Leading coef have to be a unit: no
6552  // example 2x+4x2 should be simplified to 2x*(1+2x)
6553  // and 2 is not a unit in Z
6554  //if ( !(n_IsUnit(pGetCoeff((*p).p), currRing->cf)) ) return;
6555 #endif
6556  k = 0;
6557  h1 = r = pCopy((*p).p);
6558  h =pNext(r);
6559  loop
6560  {
6561  if (h==NULL)
6562  {
6563  pDelete(&r);
6564  pDelete(&(pNext((*p).p)));
6565  (*p).ecart = 0;
6566  (*p).length = 1;
6567  (*p).pLength = 1;
6568  (*suc)=0;
6569  return;
6570  }
6571  if (!pDivisibleBy(r,h))
6572  {
6573  q=redBba1(h,index ,strat);
6574  if (q != h)
6575  {
6576  k++;
6577  pDelete(&h);
6578  pNext(h1) = h = q;
6579  }
6580  else
6581  {
6582  pDelete(&r);
6583  return;
6584  }
6585  }
6586  else
6587  {
6588  h1 = h;
6589  pIter(h);
6590  }
6591  if (k > 10)
6592  {
6593  pDelete(&r);
6594  return;
6595  }
6596  }
6597  }
6598 }
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
static poly redBba1(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6526
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:597
#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:126
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define pIsVector(p)
Definition: polys.h:221
void chainCritNormal ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2186 of file kutil.cc.

2187 {
2188  int i,j,l;
2189 
2190  /*
2191  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2192  *In this case all elements in B such
2193  *that their lcm is divisible by the leading term of S[i] can be canceled
2194  */
2195  if (strat->pairtest!=NULL)
2196  {
2197  {
2198  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2199  for (j=0; j<=strat->sl; j++)
2200  {
2201  if (strat->pairtest[j])
2202  {
2203  for (i=strat->Bl; i>=0; i--)
2204  {
2205  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
2206  {
2207  deleteInL(strat->B,&strat->Bl,i,strat);
2208  strat->c3++;
2209  }
2210  }
2211  }
2212  }
2213  }
2214  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2215  strat->pairtest=NULL;
2216  }
2217  if (strat->Gebauer || strat->fromT)
2218  {
2219  if (strat->sugarCrit)
2220  {
2221  /*
2222  *suppose L[j] == (s,r) and p/lcm(s,r)
2223  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2224  *and in case the sugar is o.k. then L[j] can be canceled
2225  */
2226  for (j=strat->Ll; j>=0; j--)
2227  {
2228  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
2229  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2230  && pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2231  {
2232  if (strat->L[j].p == strat->tail)
2233  {
2234  deleteInL(strat->L,&strat->Ll,j,strat);
2235  strat->c3++;
2236  }
2237  }
2238  }
2239  /*
2240  *this is GEBAUER-MOELLER:
2241  *in B all elements with the same lcm except the "best"
2242  *(i.e. the last one in B with this property) will be canceled
2243  */
2244  j = strat->Bl;
2245  loop /*cannot be changed into a for !!! */
2246  {
2247  if (j <= 0) break;
2248  i = j-1;
2249  loop
2250  {
2251  if (i < 0) break;
2252  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2253  {
2254  strat->c3++;
2255  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
2256  {
2257  deleteInL(strat->B,&strat->Bl,i,strat);
2258  j--;
2259  }
2260  else
2261  {
2262  deleteInL(strat->B,&strat->Bl,j,strat);
2263  break;
2264  }
2265  }
2266  i--;
2267  }
2268  j--;
2269  }
2270  }
2271  else /*sugarCrit*/
2272  {
2273  /*
2274  *suppose L[j] == (s,r) and p/lcm(s,r)
2275  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2276  *and in case the sugar is o.k. then L[j] can be canceled
2277  */
2278  for (j=strat->Ll; j>=0; j--)
2279  {
2280  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2281  {
2282  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2283  {
2284  deleteInL(strat->L,&strat->Ll,j,strat);
2285  strat->c3++;
2286  }
2287  }
2288  }
2289  /*
2290  *this is GEBAUER-MOELLER:
2291  *in B all elements with the same lcm except the "best"
2292  *(i.e. the last one in B with this property) will be canceled
2293  */
2294  j = strat->Bl;
2295  loop /*cannot be changed into a for !!! */
2296  {
2297  if (j <= 0) break;
2298  for(i=j-1; i>=0; i--)
2299  {
2300  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2301  {
2302  strat->c3++;
2303  deleteInL(strat->B,&strat->Bl,i,strat);
2304  j--;
2305  }
2306  }
2307  j--;
2308  }
2309  }
2310  /*
2311  *the elements of B enter L
2312  */
2313  kMergeBintoL(strat);
2314  }
2315  else
2316  {
2317  for (j=strat->Ll; j>=0; j--)
2318  {
2319  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2320  {
2321  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2322  {
2323  deleteInL(strat->L,&strat->Ll,j,strat);
2324  strat->c3++;
2325  }
2326  }
2327  }
2328  /*
2329  *this is our MODIFICATION of GEBAUER-MOELLER:
2330  *First the elements of B enter L,
2331  *then we fix a lcm and the "best" element in L
2332  *(i.e the last in L with this lcm and of type (s,p))
2333  *and cancel all the other elements of type (r,p) with this lcm
2334  *except the case the element (s,r) has also the same lcm
2335  *and is on the worst position with respect to (s,p) and (r,p)
2336  */
2337  /*
2338  *B enters to L/their order with respect to B is permutated for elements
2339  *B[i].p with the same leading term
2340  */
2341  kMergeBintoL(strat);
2342  j = strat->Ll;
2343  loop /*cannot be changed into a for !!! */
2344  {
2345  if (j <= 0)
2346  {
2347  /*now L[0] cannot be canceled any more and the tail can be removed*/
2348  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2349  break;
2350  }
2351  if (strat->L[j].p2 == p)
2352  {
2353  i = j-1;
2354  loop
2355  {
2356  if (i < 0) break;
2357  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2358  {
2359  /*L[i] could be canceled but we search for a better one to cancel*/
2360  strat->c3++;
2361  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2362  && (pNext(strat->L[l].p) == strat->tail)
2363  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2364  && pDivisibleBy(p,strat->L[l].lcm))
2365  {
2366  /*
2367  *"NOT equal(...)" because in case of "equal" the element L[l]
2368  *is "older" and has to be from theoretical point of view behind
2369  *L[i], but we do not want to reorder L
2370  */
2371  strat->L[i].p2 = strat->tail;
2372  /*
2373  *L[l] will be canceled, we cannot cancel L[i] later on,
2374  *so we mark it with "tail"
2375  */
2376  deleteInL(strat->L,&strat->Ll,l,strat);
2377  i--;
2378  }
2379  else
2380  {
2381  deleteInL(strat->L,&strat->Ll,i,strat);
2382  }
2383  j--;
2384  }
2385  i--;
2386  }
2387  }
2388  else if (strat->L[j].p2 == strat->tail)
2389  {
2390  /*now L[j] cannot be canceled any more and the tail can be removed*/
2391  strat->L[j].p2 = p;
2392  }
2393  j--;
2394  }
2395  }
2396 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:567
BOOLEAN Gebauer
Definition: kutil.h:372
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:21
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
polyset S
Definition: kutil.h:304
BOOLEAN sugarCrit
Definition: kutil.h:371
LSet L
Definition: kutil.h:325
#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:126
LSet B
Definition: kutil.h:326
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2140
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void chainCritPart ( poly  p,
int  ecart,
kStrategy  strat 
)

Definition at line 2460 of file kutil.cc.

2461 {
2462  int i,j,l;
2463 
2464  /*
2465  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2466  *In this case all elements in B such
2467  *that their lcm is divisible by the leading term of S[i] can be canceled
2468  */
2469  if (strat->pairtest!=NULL)
2470  {
2471  {
2472  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2473  for (j=0; j<=strat->sl; j++)
2474  {
2475  if (strat->pairtest[j])
2476  {
2477  for (i=strat->Bl; i>=0; i--)
2478  {
2479  if (_p_LmDivisibleByPart(strat->S[j],currRing,
2480  strat->B[i].lcm,currRing,
2481  currRing->real_var_start,currRing->real_var_end))
2482  {
2483  if(TEST_OPT_DEBUG)
2484  {
2485  Print("chain-crit-part: S[%d]=",j);
2486  p_wrp(strat->S[j],currRing);
2487  Print(" divide B[%d].lcm=",i);
2488  p_wrp(strat->B[i].lcm,currRing);
2489  PrintLn();
2490  }
2491  deleteInL(strat->B,&strat->Bl,i,strat);
2492  strat->c3++;
2493  }
2494  }
2495  }
2496  }
2497  }
2498  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2499  strat->pairtest=NULL;
2500  }
2501  if (strat->Gebauer || strat->fromT)
2502  {
2503  if (strat->sugarCrit)
2504  {
2505  /*
2506  *suppose L[j] == (s,r) and p/lcm(s,r)
2507  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2508  *and in case the sugar is o.k. then L[j] can be canceled
2509  */
2510  for (j=strat->Ll; j>=0; j--)
2511  {
2512  if (sugarDivisibleBy(ecart,strat->L[j].ecart)
2513  && ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2514  && pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2515  {
2516  if (strat->L[j].p == strat->tail)
2517  {
2518  if(TEST_OPT_DEBUG)
2519  {
2520  PrintS("chain-crit-part: pCompareChainPart p=");
2521  p_wrp(p,currRing);
2522  Print(" delete L[%d]",j);
2523  p_wrp(strat->L[j].lcm,currRing);
2524  PrintLn();
2525  }
2526  deleteInL(strat->L,&strat->Ll,j,strat);
2527  strat->c3++;
2528  }
2529  }
2530  }
2531  /*
2532  *this is GEBAUER-MOELLER:
2533  *in B all elements with the same lcm except the "best"
2534  *(i.e. the last one in B with this property) will be canceled
2535  */
2536  j = strat->Bl;
2537  loop /*cannot be changed into a for !!! */
2538  {
2539  if (j <= 0) break;
2540  i = j-1;
2541  loop
2542  {
2543  if (i < 0) break;
2544  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2545  {
2546  strat->c3++;
2547  if (sugarDivisibleBy(strat->B[j].ecart,strat->B[i].ecart))
2548  {
2549  if(TEST_OPT_DEBUG)
2550  {
2551  Print("chain-crit-part: sugar B[%d].lcm=",j);
2552  p_wrp(strat->B[j].lcm,currRing);
2553  Print(" delete B[%d]",i);
2554  p_wrp(strat->B[i].lcm,currRing);
2555  PrintLn();
2556  }
2557  deleteInL(strat->B,&strat->Bl,i,strat);
2558  j--;
2559  }
2560  else
2561  {
2562  if(TEST_OPT_DEBUG)
2563  {
2564  Print("chain-crit-part: sugar B[%d].lcm=",i);
2565  p_wrp(strat->B[i].lcm,currRing);
2566  Print(" delete B[%d]",j);
2567  p_wrp(strat->B[j].lcm,currRing);
2568  PrintLn();
2569  }
2570  deleteInL(strat->B,&strat->Bl,j,strat);
2571  break;
2572  }
2573  }
2574  i--;
2575  }
2576  j--;
2577  }
2578  }
2579  else /*sugarCrit*/
2580  {
2581  /*
2582  *suppose L[j] == (s,r) and p/lcm(s,r)
2583  *and lcm(s,r)#lcm(s,p) and lcm(s,r)#lcm(r,p)
2584  *and in case the sugar is o.k. then L[j] can be canceled
2585  */
2586  for (j=strat->Ll; j>=0; j--)
2587  {
2588  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2589  {
2590  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2591  {
2592  if(TEST_OPT_DEBUG)
2593  {
2594  PrintS("chain-crit-part: sugar:pCompareChainPart p=");
2595  p_wrp(p,currRing);
2596  Print(" delete L[%d]",j);
2597  p_wrp(strat->L[j].lcm,currRing);
2598  PrintLn();
2599  }
2600  deleteInL(strat->L,&strat->Ll,j,strat);
2601  strat->c3++;
2602  }
2603  }
2604  }
2605  /*
2606  *this is GEBAUER-MOELLER:
2607  *in B all elements with the same lcm except the "best"
2608  *(i.e. the last one in B with this property) will be canceled
2609  */
2610  j = strat->Bl;
2611  loop /*cannot be changed into a for !!! */
2612  {
2613  if (j <= 0) break;
2614  for(i=j-1; i>=0; i--)
2615  {
2616  if (pLmEqual(strat->B[j].lcm,strat->B[i].lcm))
2617  {
2618  if(TEST_OPT_DEBUG)
2619  {
2620  Print("chain-crit-part: equal lcm B[%d].lcm=",j);
2621  p_wrp(strat->B[j].lcm,currRing);
2622  Print(" delete B[%d]\n",i);
2623  }
2624  strat->c3++;
2625  deleteInL(strat->B,&strat->Bl,i,strat);
2626  j--;
2627  }
2628  }
2629  j--;
2630  }
2631  }
2632  /*
2633  *the elements of B enter L
2634  */
2635  kMergeBintoL(strat);
2636  }
2637  else
2638  {
2639  for (j=strat->Ll; j>=0; j--)
2640  {
2641  if (pCompareChainPart(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2642  {
2643  if ((pNext(strat->L[j].p) == strat->tail)||(rHasGlobalOrdering(currRing)))
2644  {
2645  if(TEST_OPT_DEBUG)
2646  {
2647  PrintS("chain-crit-part: pCompareChainPart p=");
2648  p_wrp(p,currRing);
2649  Print(" delete L[%d]",j);
2650  p_wrp(strat->L[j].lcm,currRing);
2651  PrintLn();
2652  }
2653  deleteInL(strat->L,&strat->Ll,j,strat);
2654  strat->c3++;
2655  }
2656  }
2657  }
2658  /*
2659  *this is our MODIFICATION of GEBAUER-MOELLER:
2660  *First the elements of B enter L,
2661  *then we fix a lcm and the "best" element in L
2662  *(i.e the last in L with this lcm and of type (s,p))
2663  *and cancel all the other elements of type (r,p) with this lcm
2664  *except the case the element (s,r) has also the same lcm
2665  *and is on the worst position with respect to (s,p) and (r,p)
2666  */
2667  /*
2668  *B enters to L/their order with respect to B is permutated for elements
2669  *B[i].p with the same leading term
2670  */
2671  kMergeBintoL(strat);
2672  j = strat->Ll;
2673  loop /*cannot be changed into a for !!! */
2674  {
2675  if (j <= 0)
2676  {
2677  /*now L[0] cannot be canceled any more and the tail can be removed*/
2678  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2679  break;
2680  }
2681  if (strat->L[j].p2 == p)
2682  {
2683  i = j-1;
2684  loop
2685  {
2686  if (i < 0) break;
2687  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2688  {
2689  /*L[i] could be canceled but we search for a better one to cancel*/
2690  strat->c3++;
2691  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2692  && (pNext(strat->L[l].p) == strat->tail)
2693  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2695  strat->L[l].lcm,currRing,
2696  currRing->real_var_start, currRing->real_var_end))
2697 
2698  {
2699  /*
2700  *"NOT equal(...)" because in case of "equal" the element L[l]
2701  *is "older" and has to be from theoretical point of view behind
2702  *L[i], but we do not want to reorder L
2703  */
2704  strat->L[i].p2 = strat->tail;
2705  /*
2706  *L[l] will be canceled, we cannot cancel L[i] later on,
2707  *so we mark it with "tail"
2708  */
2709  if(TEST_OPT_DEBUG)
2710  {
2711  PrintS("chain-crit-part: divisible_by p=");
2712  p_wrp(p,currRing);
2713  Print(" delete L[%d]",l);
2714  p_wrp(strat->L[l].lcm,currRing);
2715  PrintLn();
2716  }
2717  deleteInL(strat->L,&strat->Ll,l,strat);
2718  i--;
2719  }
2720  else
2721  {
2722  if(TEST_OPT_DEBUG)
2723  {
2724  PrintS("chain-crit-part: divisible_by(2) p=");
2725  p_wrp(p,currRing);
2726  Print(" delete L[%d]",i);
2727  p_wrp(strat->L[i].lcm,currRing);
2728  PrintLn();
2729  }
2730  deleteInL(strat->L,&strat->Ll,i,strat);
2731  }
2732  j--;
2733  }
2734  i--;
2735  }
2736  }
2737  else if (strat->L[j].p2 == strat->tail)
2738  {
2739  /*now L[j] cannot be canceled any more and the tail can be removed*/
2740  strat->L[j].p2 = p;
2741  }
2742  j--;
2743  }
2744  }
2745 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
#define TEST_OPT_DEBUG
Definition: options.h:103
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:567
BOOLEAN Gebauer
Definition: kutil.h:372
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
polyset S
Definition: kutil.h:304
BOOLEAN sugarCrit
Definition: kutil.h:371
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:1632
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2140
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
int BOOLEAN
Definition: auxiliary.h:131
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
#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:75
void chainCritRing ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 2885 of file kutil.cc.

2886 {
2887  int i,j,l;
2888  /*
2889  *pairtest[i] is TRUE if spoly(S[i],p) == 0.
2890  *In this case all elements in B such
2891  *that their lcm is divisible by the leading term of S[i] can be canceled
2892  */
2893  if (strat->pairtest!=NULL)
2894  {
2895  {
2896  /*- i.e. there is an i with pairtest[i]==TRUE -*/
2897  for (j=0; j<=strat->sl; j++)
2898  {
2899  if (strat->pairtest[j])
2900  {
2901  for (i=strat->Bl; i>=0; i--)
2902  {
2903  if (pDivisibleBy(strat->S[j],strat->B[i].lcm))
2904  {
2905 #ifdef KDEBUG
2906  if (TEST_OPT_DEBUG)
2907  {
2908  PrintS("--- chain criterion func chainCritRing type 1\n");
2909  PrintS("strat->S[j]:");
2910  wrp(strat->S[j]);
2911  PrintS(" strat->B[i].lcm:");
2912  wrp(strat->B[i].lcm);
2913  PrintLn();
2914  }
2915 #endif
2916  deleteInL(strat->B,&strat->Bl,i,strat);
2917  strat->c3++;
2918  }
2919  }
2920  }
2921  }
2922  }
2923  omFreeSize(strat->pairtest,(strat->sl+2)*sizeof(BOOLEAN));
2924  strat->pairtest=NULL;
2925  }
2926  assume(!(strat->Gebauer || strat->fromT));
2927  for (j=strat->Ll; j>=0; j--)
2928  {
2929  if ((strat->L[j].lcm != NULL) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(p), currRing->cf))
2930  {
2931  if (pCompareChain(p,strat->L[j].p1,strat->L[j].p2,strat->L[j].lcm))
2932  {
2933  if ((pNext(strat->L[j].p) == strat->tail) || (rHasGlobalOrdering(currRing)))
2934  {
2935  deleteInL(strat->L,&strat->Ll,j,strat);
2936  strat->c3++;
2937 #ifdef KDEBUG
2938  if (TEST_OPT_DEBUG)
2939  {
2940  PrintS("--- chain criterion func chainCritRing type 2\n");
2941  PrintS("strat->L[j].p:");
2942  wrp(strat->L[j].p);
2943  PrintS(" p:");
2944  wrp(p);
2945  PrintLn();
2946  }
2947 #endif
2948  }
2949  }
2950  }
2951  }
2952  /*
2953  *this is our MODIFICATION of GEBAUER-MOELLER:
2954  *First the elements of B enter L,
2955  *then we fix a lcm and the "best" element in L
2956  *(i.e the last in L with this lcm and of type (s,p))
2957  *and cancel all the other elements of type (r,p) with this lcm
2958  *except the case the element (s,r) has also the same lcm
2959  *and is on the worst position with respect to (s,p) and (r,p)
2960  */
2961  /*
2962  *B enters to L/their order with respect to B is permutated for elements
2963  *B[i].p with the same leading term
2964  */
2965  kMergeBintoL(strat);
2966  j = strat->Ll;
2967  loop /*cannot be changed into a for !!! */
2968  {
2969  if (j <= 0)
2970  {
2971  /*now L[0] cannot be canceled any more and the tail can be removed*/
2972  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2973  break;
2974  }
2975  if (strat->L[j].p2 == p) // Was the element added from B?
2976  {
2977  i = j-1;
2978  loop
2979  {
2980  if (i < 0) break;
2981  // Element is from B and has the same lcm as L[j]
2982  if ((strat->L[i].p2 == p) && n_DivBy(pGetCoeff(strat->L[j].lcm), pGetCoeff(strat->L[i].lcm), currRing->cf)
2983  && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2984  {
2985  /*L[i] could be canceled but we search for a better one to cancel*/
2986  strat->c3++;
2987 #ifdef KDEBUG
2988  if (TEST_OPT_DEBUG)
2989  {
2990  PrintS("--- chain criterion func chainCritRing type 3\n");
2991  PrintS("strat->L[j].lcm:");
2992  wrp(strat->L[j].lcm);
2993  PrintS(" strat->L[i].lcm:");
2994  wrp(strat->L[i].lcm);
2995  PrintLn();
2996  }
2997 #endif
2998  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2999  && (pNext(strat->L[l].p) == strat->tail)
3000  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
3001  && pDivisibleBy(p,strat->L[l].lcm))
3002  {
3003  /*
3004  *"NOT equal(...)" because in case of "equal" the element L[l]
3005  *is "older" and has to be from theoretical point of view behind
3006  *L[i], but we do not want to reorder L
3007  */
3008  strat->L[i].p2 = strat->tail;
3009  /*
3010  *L[l] will be canceled, we cannot cancel L[i] later on,
3011  *so we mark it with "tail"
3012  */
3013  deleteInL(strat->L,&strat->Ll,l,strat);
3014  i--;
3015  }
3016  else
3017  {
3018  deleteInL(strat->L,&strat->Ll,i,strat);
3019  }
3020  j--;
3021  }
3022  i--;
3023  }
3024  }
3025  else if (strat->L[j].p2 == strat->tail)
3026  {
3027  /*now L[j] cannot be canceled any more and the tail can be removed*/
3028  strat->L[j].p2 = p;
3029  }
3030  j--;
3031  }
3032 }
void PrintLn()
Definition: reporter.cc:322
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
#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:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:567
BOOLEAN Gebauer
Definition: kutil.h:372
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
BOOLEAN pCompareChain(poly p, poly p1, poly p2, poly lcm, const ring R)
Returns TRUE if.
Definition: kpolys.cc:21
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
polyset S
Definition: kutil.h:304
LSet L
Definition: kutil.h:325
#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:126
LSet B
Definition: kutil.h:326
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2140
void wrp(poly p)
Definition: polys.h:281
int BOOLEAN
Definition: auxiliary.h:131
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void chainCritSig ( poly  p,
int  ,
kStrategy  strat 
)

Definition at line 2401 of file kutil.cc.

2402 {
2403  int i,j,l;
2404  kMergeBintoLSba(strat);
2405  j = strat->Ll;
2406  loop /*cannot be changed into a for !!! */
2407  {
2408  if (j <= 0)
2409  {
2410  /*now L[0] cannot be canceled any more and the tail can be removed*/
2411  if (strat->L[0].p2 == strat->tail) strat->L[0].p2 = p;
2412  break;
2413  }
2414  if (strat->L[j].p2 == p)
2415  {
2416  i = j-1;
2417  loop
2418  {
2419  if (i < 0) break;
2420  if ((strat->L[i].p2 == p) && pLmEqual(strat->L[j].lcm,strat->L[i].lcm))
2421  {
2422  /*L[i] could be canceled but we search for a better one to cancel*/
2423  strat->c3++;
2424  if (isInPairsetL(i-1,strat->L[j].p1,strat->L[i].p1,&l,strat)
2425  && (pNext(strat->L[l].p) == strat->tail)
2426  && (!pLmEqual(strat->L[i].p,strat->L[l].p))
2427  && pDivisibleBy(p,strat->L[l].lcm))
2428  {
2429  /*
2430  *"NOT equal(...)" because in case of "equal" the element L[l]
2431  *is "older" and has to be from theoretical point of view behind
2432  *L[i], but we do not want to reorder L
2433  */
2434  strat->L[i].p2 = strat->tail;
2435  /*
2436  *L[l] will be canceled, we cannot cancel L[i] later on,
2437  *so we mark it with "tail"
2438  */
2439  deleteInL(strat->L,&strat->Ll,l,strat);
2440  i--;
2441  }
2442  else
2443  {
2444  deleteInL(strat->L,&strat->Ll,i,strat);
2445  }
2446  j--;
2447  }
2448  i--;
2449  }
2450  }
2451  else if (strat->L[j].p2 == strat->tail)
2452  {
2453  /*now L[j] cannot be canceled any more and the tail can be removed*/
2454  strat->L[j].p2 = p;
2455  }
2456  j--;
2457  }
2458 }
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
int j
Definition: myNF.cc:70
BOOLEAN isInPairsetL(int length, poly p1, poly p2, int *k, kStrategy strat)
Definition: kutil.cc:567
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
void kMergeBintoLSba(kStrategy strat)
Definition: kutil.cc:2163
LSet L
Definition: kutil.h:325
#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:126
#define pNext(p)
Definition: monomials.h:43
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void cleanT ( kStrategy  strat)

Definition at line 491 of file kutil.cc.

492 {
493  int i,j;
494  poly p;
495  assume(currRing == strat->tailRing || strat->tailRing != NULL);
496 
497  pShallowCopyDeleteProc p_shallow_copy_delete =
498  (strat->tailRing != currRing ?
500  NULL);
501 
502  for (j=0; j<=strat->tl; j++)
503  {
504  p = strat->T[j].p;
505  strat->T[j].p=NULL;
506  if (strat->T[j].max != NULL)
507  {
508  p_LmFree(strat->T[j].max, strat->tailRing);
509  }
510  i = -1;
511  loop
512  {
513  i++;
514  if (i>strat->sl)
515  {
516  if (strat->T[j].t_p != NULL)
517  {
518  p_Delete(&(strat->T[j].t_p), strat->tailRing);
519  p_LmFree(p, currRing);
520  }
521  else
522  pDelete(&p);
523  break;
524  }
525  if (p == strat->S[i])
526  {
527  if (strat->T[j].t_p != NULL)
528  {
529  assume(p_shallow_copy_delete != NULL);
530  pNext(p) = p_shallow_copy_delete(pNext(p),strat->tailRing,currRing,
531  currRing->PolyBin);
532  p_LmFree(strat->T[j].t_p, strat->tailRing);
533  }
534  break;
535  }
536  }
537  }
538  strat->tl=-1;
539 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:353
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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:343
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
void clearSbatch ( poly  h,
int  k,
int  pos,
kStrategy  strat 
)

Definition at line 3573 of file kutil.cc.

3574 {
3575  int j = pos;
3576  if ( (!strat->fromT)
3577  && ((strat->syzComp==0)
3578  ||(pGetComp(h)<=strat->syzComp)
3579  ))
3580  {
3581  // Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3582  unsigned long h_sev = pGetShortExpVector(h);
3583  loop
3584  {
3585  if (j > k) break;
3586  clearS(h,h_sev, &j,&k,strat);
3587  j++;
3588  }
3589  // Print("end clearS sl=%d\n",strat->sl);
3590  }
3591 }
int syzComp
Definition: kutil.h:357
loop
Definition: myNF.cc:98
int k
Definition: cfEzgcd.cc:93
#define pGetComp(p)
Component.
Definition: polys.h:37
BOOLEAN fromT
Definition: kutil.h:373
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:140
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void completeReduce ( kStrategy  strat,
BOOLEAN  withT 
)

Definition at line 7991 of file kutil.cc.

7992 {
7993  int i;
7994  int low = (((rHasGlobalOrdering(currRing)) && (strat->ak==0)) ? 1 : 0);
7995  LObject L;
7996 
7997 #ifdef KDEBUG
7998  // need to set this: during tailreductions of T[i], T[i].max is out of
7999  // sync
8000  sloppy_max = TRUE;
8001 #endif
8002 
8003  strat->noTailReduction = FALSE;
8004  if (TEST_OPT_PROT)
8005  {
8006  PrintLn();
8007 // if (timerv) writeTime("standard base computed:");
8008  }
8009  if (TEST_OPT_PROT)
8010  {
8011  Print("(S:%d)",strat->sl);mflush();
8012  }
8013  for (i=strat->sl; i>=low; i--)
8014  {
8015  int end_pos=strat->sl;
8016  if ((strat->fromQ!=NULL) && (strat->fromQ[i])) continue; // do not reduce Q_i
8017  if (strat->ak==0) end_pos=i-1;
8018  TObject* T_j = strat->s_2_t(i);
8019  if ((T_j != NULL)&&(T_j->p==strat->S[i]))
8020  {
8021  L = *T_j;
8022  #ifdef KDEBUG
8023  if (TEST_OPT_DEBUG)
8024  {
8025  Print("test S[%d]:",i);
8026  p_wrp(L.p,currRing,strat->tailRing);
8027  PrintLn();
8028  }
8029  #endif
8031  strat->S[i] = redtailBba(&L, end_pos, strat, withT);
8032  else
8033  strat->S[i] = redtail(&L, strat->sl, strat);
8034  #ifdef KDEBUG
8035  if (TEST_OPT_DEBUG)
8036  {
8037  Print("to (tailR) S[%d]:",i);
8038  p_wrp(strat->S[i],currRing,strat->tailRing);
8039  PrintLn();
8040  }
8041  #endif
8042 
8043  if (strat->redTailChange && strat->tailRing != currRing)
8044  {
8045  if (T_j->max != NULL) p_LmFree(T_j->max, strat->tailRing);
8046  if (pNext(T_j->p) != NULL)
8047  T_j->max = p_GetMaxExpP(pNext(T_j->p), strat->tailRing);
8048  else
8049  T_j->max = NULL;
8050  }
8052  T_j->pCleardenom();
8053  }
8054  else
8055  {
8056  assume(currRing == strat->tailRing);
8057  #ifdef KDEBUG
8058  if (TEST_OPT_DEBUG)
8059  {
8060  Print("test S[%d]:",i);
8061  p_wrp(strat->S[i],currRing,strat->tailRing);
8062  PrintLn();
8063  }
8064  #endif
8066  strat->S[i] = redtailBba(strat->S[i], end_pos, strat, withT);
8067  else
8068  strat->S[i] = redtail(strat->S[i], strat->sl, strat);
8070  {
8071  if (TEST_OPT_CONTENTSB)
8072  {
8073  number n;
8074  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
8075  if (!nIsOne(n))
8076  {
8078  denom->n=nInvers(n);
8079  denom->next=DENOMINATOR_LIST;
8080  DENOMINATOR_LIST=denom;
8081  }
8082  nDelete(&n);
8083  }
8084  else
8085  {
8086  //pContent(strat->S[i]);
8087  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
8088  }
8089  }
8090  #ifdef KDEBUG
8091  if (TEST_OPT_DEBUG)
8092  {
8093  Print("to (-tailR) S[%d]:",i);
8094  p_wrp(strat->S[i],currRing,strat->tailRing);
8095  PrintLn();
8096  }
8097  #endif
8098  }
8099  if (TEST_OPT_PROT)
8100  PrintS("-");
8101  }
8102  if (TEST_OPT_PROT) PrintLn();
8103 #ifdef KDEBUG
8104  sloppy_max = FALSE;
8105 #endif
8106 }
denominator_list_s * denominator_list
Definition: kutil.h:63
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
#define TEST_OPT_CONTENTSB
Definition: options.h:121
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
int ak
Definition: kutil.h:356
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:5412
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
#define mflush()
Definition: reporter.h:42
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2799
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
#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:741
ring tailRing
Definition: kutil.h:343
denominator_list next
Definition: kutil.h:65
#define pNext(p)
Definition: monomials.h:43
KINLINE TObject * s_2_t(int i)
Definition: kInline.h:44
int sl
Definition: kutil.h:351
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
ideal createG0 ( )

Definition at line 3385 of file kutil.cc.

3386 {
3387  // Initialize
3388  long exp[50]; // The exponent of \hat{X} (basepoint)
3389  long cexp[50]; // The current exponent for iterating over all
3390  long ind[50]; // The power of 2 in the i-th component of exp
3391  long cind[50]; // analog for cexp
3392  long mult[50]; // How to multiply the elements of G
3393  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3394  long habsind = 0; // The abs. index of the coefficient of h
3395  long step[50]; // The last increases
3396  for (int i = 1; i <= currRing->N; i++)
3397  {
3398  exp[i] = 0;
3399  cexp[i] = exp[i];
3400  ind[i] = 0;
3401  step[i] = 500000;
3402  cind[i] = ind[i];
3403  }
3404  long bound = currRing->ch;
3405  step[1] = 500000;
3406 #ifdef OLI_DEBUG
3407  PrintS("-------------\npoly :");
3408 // wrp(p);
3409  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3410  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3411  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3412  Print("bound : %d\n", bound);
3413  Print("cind : %d\n", cabsind);
3414 #endif
3415  if (cabsind == 0)
3416  {
3417  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3418  {
3419  return idInit(1, 1);
3420  }
3421  }
3422  ideal G0 = idInit(1, 1);
3423  // Now the whole simplex
3424  do
3425  {
3426  // Build s-polynomial
3427  // 2**ind-def * mult * g - exp-def * h
3428  poly t_p;
3429  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, currRing);
3430 #ifdef OLI_DEBUG
3431  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3432  Print("zPoly : ");
3433  wrp(zeroPoly);
3434  Print("\n");
3435 #endif
3436  // Add to ideal
3437  pEnlargeSet(&(G0->m), IDELEMS(G0), 1);
3438  IDELEMS(G0) += 1;
3439  G0->m[IDELEMS(G0) - 1] = zeroPoly;
3440  }
3441  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3442  idSkipZeroes(G0);
3443  return G0;
3444 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
#define Print
Definition: emacs.cc:83
const ideal
Definition: gb_hack.h:42
poly kCreateZeroPoly(long exp[], long cabsind, poly *t_p, ring leadRing, ring tailRing)
Definition: kutil.cc:3256
int nextZeroSimplexExponent(long exp[], long ind[], long cexp[], long cind[], long *cabsind, long step[], long bound, long N)
Definition: kutil.cc:3190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
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:3511
p exp[i]
Definition: DebugPrint.cc:39
void wrp(poly p)
Definition: polys.h:281
void deleteHC ( LObject L,
kStrategy  strat,
BOOLEAN  fromNext 
)

Definition at line 235 of file kutil.cc.

236 {
237  if (strat->kHEdgeFound)
238  {
239  kTest_L(L);
240  poly p1;
241  poly p = L->GetLmTailRing();
242  int l = 1;
244  if (L->bucket != NULL)
245  {
246  kBucketClear(L->bucket, &pNext(p), &L->pLength);
247  L->pLength++;
248  bucket = L->bucket;
249  L->bucket = NULL;
250  }
251 
252  if (!fromNext && p_Cmp(p,strat->kNoetherTail(), L->tailRing) == -1)
253  {
254  L->Delete();
255  L->Clear();
256  L->ecart = -1;
257  if (bucket != NULL) kBucketDestroy(&bucket);
258  return;
259  }
260  p1 = p;
261  while (pNext(p1)!=NULL)
262  {
263  if (p_LmCmp(pNext(p1), strat->kNoetherTail(), L->tailRing) == -1)
264  {
265  p_Delete(&pNext(p1), L->tailRing);
266  if (p1 == p)
267  {
268  if (L->t_p != NULL)
269  {
270  assume(L->p != NULL && p == L->t_p);
271  pNext(L->p) = NULL;
272  }
273  L->max = NULL;
274  }
275  else if (fromNext)
276  L->max = p_GetMaxExpP(pNext(L->p), L->tailRing ); // p1;
277  //if (L->pLength != 0)
278  L->pLength = l;
279  // Hmmm when called from updateT, then only
280  // reset ecart when cut
281  if (fromNext)
282  L->ecart = L->pLDeg() - L->GetpFDeg();
283  break;
284  }
285  l++;
286  pIter(p1);
287  }
288  if (! fromNext)
289  {
290  L->SetpFDeg();
291  L->ecart = L->pLDeg(strat->LDegLast) - L->GetpFDeg();
292  }
293  if (bucket != NULL)
294  {
295  if (L->pLength > 1)
296  {
297  kBucketInit(bucket, pNext(p), L->pLength - 1);
298  pNext(p) = NULL;
299  if (L->t_p != NULL) pNext(L->t_p) = NULL;
300  L->pLength = 0;
301  L->bucket = bucket;
302  }
303  else
304  kBucketDestroy(&bucket);
305  }
306  kTest_L(L);
307  }
308 }
void kBucketClear(kBucket_pt bucket, poly *p, int *length)
Definition: kbuckets.cc:500
void kBucketInit(kBucket_pt bucket, poly lm, int length)
Definition: kbuckets.cc:472
static int p_Cmp(poly p1, poly p2, ring r)
Definition: p_polys.h:1523
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
void kBucketDestroy(kBucket_pt *bucket_pt)
Definition: kbuckets.cc:205
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define kTest_L(T)
Definition: kutil.h:619
P bucket
Definition: myNF.cc:79
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
BOOLEAN kHEdgeFound
Definition: kutil.h:370
BOOLEAN LDegLast
Definition: kutil.h:380
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
void deleteHC ( poly p,
int e,
int l,
kStrategy  strat 
)

Definition at line 310 of file kutil.cc.

311 {
312  LObject L(*p, currRing, strat->tailRing);
313 
314  deleteHC(&L, strat);
315  *p = L.p;
316  *e = L.ecart;
317  *l = L.length;
318  if (L.t_p != NULL) p_LmFree(L.t_p, strat->tailRing);
319 }
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int l
Definition: cfEzgcd.cc:94
void deleteInL ( LSet  set,
int length,
int  j,
kStrategy  strat 
)

Definition at line 1039 of file kutil.cc.

1040 {
1041  if (set[j].lcm!=NULL)
1042  {
1043 #ifdef HAVE_RINGS
1044  if (pGetCoeff(set[j].lcm) != NULL)
1045  pLmDelete(set[j].lcm);
1046  else
1047 #endif
1048  pLmFree(set[j].lcm);
1049  }
1050  if (set[j].sig!=NULL)
1051  {
1052 #ifdef HAVE_RINGS
1053  if (pGetCoeff(set[j].sig) != NULL)
1054  pLmDelete(set[j].sig);
1055  else
1056 #endif
1057  pLmFree(set[j].sig);
1058  }
1059  if (set[j].p!=NULL)
1060  {
1061  if (pNext(set[j].p) == strat->tail)
1062  {
1063 #ifdef HAVE_RINGS
1064  if (pGetCoeff(set[j].p) != NULL)
1065  pLmDelete(set[j].p);
1066  else
1067 #endif
1068  pLmFree(set[j].p);
1069  /*- tail belongs to several int spolys -*/
1070  }
1071  else
1072  {
1073  // search p in T, if it is there, do not delete it
1074  if (rHasGlobalOrdering(currRing) || (kFindInT(set[j].p, strat) < 0))
1075  {
1076  // assure that for global orderings kFindInT fails
1077  //assume((rHasLocalOrMixedOrdering(currRing)) && (kFindInT(set[j].p, strat) >= 0));
1078  set[j].Delete();
1079  }
1080  }
1081  }
1082  if (*length > 0 && j < *length)
1083  {
1084 #ifdef ENTER_USE_MEMMOVE
1085  memmove(&(set[j]), &(set[j+1]), (*length - j)*sizeof(LObject));
1086 #else
1087  int i;
1088  for (i=j; i < (*length); i++)
1089  set[i] = set[i+1];
1090 #endif
1091  }
1092 #ifdef KDEBUG
1093  memset(&(set[*length]),0,sizeof(LObject));
1094 #endif
1095  (*length)--;
1096 }
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:58
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:603
#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:12
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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
void deleteInS ( int  i,
kStrategy  strat 
)

Definition at line 932 of file kutil.cc.

933 {
934 #ifdef ENTER_USE_MEMMOVE
935  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
936  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
937  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
938  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
939 #else
940  int j;
941  for (j=i; j<strat->sl; j++)
942  {
943  strat->S[j] = strat->S[j+1];
944  strat->ecartS[j] = strat->ecartS[j+1];
945  strat->sevS[j] = strat->sevS[j+1];
946  strat->S_2_R[j] = strat->S_2_R[j+1];
947  }
948 #endif
949  if (strat->lenS!=NULL)
950  {
951 #ifdef ENTER_USE_MEMMOVE
952  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
953 #else
954  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
955 #endif
956  }
957  if (strat->lenSw!=NULL)
958  {
959 #ifdef ENTER_USE_MEMMOVE
960  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
961 #else
962  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
963 #endif
964  }
965  if (strat->fromQ!=NULL)
966  {
967 #ifdef ENTER_USE_MEMMOVE
968  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
969 #else
970  for (j=i; j<strat->sl; j++)
971  {
972  strat->fromQ[j] = strat->fromQ[j+1];
973  }
974 #endif
975  }
976  strat->S[strat->sl] = NULL;
977  strat->sl--;
978 }
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
void deleteInSSba ( int  i,
kStrategy  strat 
)

Definition at line 984 of file kutil.cc.

985 {
986 #ifdef ENTER_USE_MEMMOVE
987  memmove(&(strat->S[i]), &(strat->S[i+1]), (strat->sl - i)*sizeof(poly));
988  memmove(&(strat->sig[i]), &(strat->sig[i+1]), (strat->sl - i)*sizeof(poly));
989  memmove(&(strat->ecartS[i]),&(strat->ecartS[i+1]),(strat->sl - i)*sizeof(int));
990  memmove(&(strat->sevS[i]),&(strat->sevS[i+1]),(strat->sl - i)*sizeof(unsigned long));
991  memmove(&(strat->sevSig[i]),&(strat->sevSig[i+1]),(strat->sl - i)*sizeof(unsigned long));
992  memmove(&(strat->S_2_R[i]),&(strat->S_2_R[i+1]),(strat->sl - i)*sizeof(int));
993 #else
994  int j;
995  for (j=i; j<strat->sl; j++)
996  {
997  strat->S[j] = strat->S[j+1];
998  strat->sig[j] = strat->sig[j+1];
999  strat->ecartS[j] = strat->ecartS[j+1];
1000  strat->sevS[j] = strat->sevS[j+1];
1001  strat->sevSig[j] = strat->sevSig[j+1];
1002  strat->S_2_R[j] = strat->S_2_R[j+1];
1003  }
1004 #endif
1005  if (strat->lenS!=NULL)
1006  {
1007 #ifdef ENTER_USE_MEMMOVE
1008  memmove(&(strat->lenS[i]),&(strat->lenS[i+1]),(strat->sl - i)*sizeof(int));
1009 #else
1010  for (j=i; j<strat->sl; j++) strat->lenS[j] = strat->lenS[j+1];
1011 #endif
1012  }
1013  if (strat->lenSw!=NULL)
1014  {
1015 #ifdef ENTER_USE_MEMMOVE
1016  memmove(&(strat->lenSw[i]),&(strat->lenSw[i+1]),(strat->sl - i)*sizeof(wlen_type));
1017 #else
1018  for (j=i; j<strat->sl; j++) strat->lenSw[j] = strat->lenSw[j+1];
1019 #endif
1020  }
1021  if (strat->fromQ!=NULL)
1022  {
1023 #ifdef ENTER_USE_MEMMOVE
1024  memmove(&(strat->fromQ[i]),&(strat->fromQ[i+1]),(strat->sl - i)*sizeof(int));
1025 #else
1026  for (j=i; j<strat->sl; j++)
1027  {
1028  strat->fromQ[j] = strat->fromQ[j+1];
1029  }
1030 #endif
1031  }
1032  strat->S[strat->sl] = NULL;
1033  strat->sl--;
1034 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
static void enlargeL ( LSet L,
int length,
const int  incr 
)
inlinestatic

Definition at line 548 of file kutil.cc.

549 {
550  assume((*L)!=NULL);
551  assume(((*length)+incr)>0);
552 
553  *L = (LSet)omReallocSize((*L),(*length)*sizeof(LObject),
554  ((*length)+incr)*sizeof(LObject));
555  (*length) += incr;
556 }
class sLObject LObject
Definition: kutil.h:58
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
LObject * LSet
Definition: kutil.h:60
#define NULL
Definition: omList.c:10
static void enlargeT ( TSet T,
TObject **&  R,
unsigned long *&  sevT,
int length,
const int  incr 
)
inlinestatic

Definition at line 470 of file kutil.cc.

472 {
473  assume(T!=NULL);
474  assume(sevT!=NULL);
475  assume(R!=NULL);
476  assume((length+incr) > 0);
477 
478  int i;
479  T = (TSet)omRealloc0Size(T, length*sizeof(TObject),
480  (length+incr)*sizeof(TObject));
481 
482  sevT = (unsigned long*) omReallocSize(sevT, length*sizeof(long*),
483  (length+incr)*sizeof(long*));
484 
485  R = (TObject**)omRealloc0Size(R,length*sizeof(TObject*),
486  (length+incr)*sizeof(TObject*));
487  for (i=length-1;i>=0;i--) R[T[i].i_r] = &(T[i]);
488  length += incr;
489 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
TObject * TSet
Definition: kutil.h:59
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:57
void enterExtendedSpoly ( poly  h,
kStrategy  strat 
)

Definition at line 3481 of file kutil.cc.

3482 {
3483  if (nIsOne(pGetCoeff(h))) return;
3484  number gcd;
3485  bool go = false;
3486  if (n_DivBy((number) 0, pGetCoeff(h), currRing->cf))
3487  {
3488  gcd = n_Ann(pGetCoeff(h),currRing->cf);
3489  go = true;
3490  }
3491  else
3492  gcd = n_Gcd((number) 0, pGetCoeff(h), strat->tailRing->cf);
3493  if (go || !nIsOne(gcd))
3494  {
3495  poly p = h->next;
3496  if (!go)
3497  {
3498  number tmp = gcd;
3499  gcd = n_Ann(gcd,currRing->cf);
3500  nDelete(&tmp);
3501  }
3502  p_Test(p,strat->tailRing);
3503  p = pp_Mult_nn(p, gcd, strat->tailRing);
3504  nDelete(&gcd);
3505 
3506  if (p != NULL)
3507  {
3508  if (TEST_OPT_PROT)
3509  {
3510  PrintS("Z");
3511  }
3512 #ifdef KDEBUG
3513  if (TEST_OPT_DEBUG)
3514  {
3515  PrintS("--- create zero spoly: ");
3516  p_wrp(h,currRing,strat->tailRing);
3517  PrintS(" ---> ");
3518  }
3519 #endif
3520  poly tmp = pInit();
3521  pSetCoeff0(tmp, pGetCoeff(p));
3522  for (int i = 1; i <= rVar(currRing); i++)
3523  {
3524  pSetExp(tmp, i, p_GetExp(p, i, strat->tailRing));
3525  }
3527  {
3528  p_SetComp(tmp, p_GetComp(p, strat->tailRing), currRing);
3529  }
3530  p_Setm(tmp, currRing);
3531  p = p_LmFreeAndNext(p, strat->tailRing);
3532  pNext(tmp) = p;
3533  LObject h;
3534  h.Init();
3535  h.p = tmp;
3536  h.tailRing = strat->tailRing;
3537  int posx;
3538  if (h.p!=NULL)
3539  {
3541  {
3542  //pContent(h.p);
3543  h.pCleardenom(); // also does a pContent
3544  }
3545  else
3546  {
3547  h.pNorm();
3548  }
3549  strat->initEcart(&h);
3550  if (strat->Ll==-1)
3551  posx =0;
3552  else
3553  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
3554  h.sev = pGetShortExpVector(h.p);
3555  if (strat->tailRing != currRing)
3556  {
3557  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
3558  }
3559 #ifdef KDEBUG
3560  if (TEST_OPT_DEBUG)
3561  {
3562  p_wrp(tmp,currRing,strat->tailRing);
3563  PrintLn();
3564  }
3565 #endif
3566  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
3567  }
3568  }
3569  }
3570  nDelete(&gcd);
3571 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:683
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#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:236
#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:927
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#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:1101
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:698
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
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:465
polyrec * poly
Definition: hilb.h:10
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static poly p_LmFreeAndNext(poly p, ring)
Definition: p_polys.h:699
#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:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
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:436
#define pSetCoeff0(p, n)
Definition: monomials.h:67
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
static Poly * h
Definition: janet.cc:978
void enterL ( LSet set,
int length,
int LSetmax,
LObject  p,
int  at 
)

Definition at line 1101 of file kutil.cc.

1102 {
1103  // this should be corrected
1104  assume(p.FDeg == p.pFDeg());
1105 
1106  if ((*length)>=0)
1107  {
1108  if ((*length) == (*LSetmax)-1) enlargeL(set,LSetmax,setmaxLinc);
1109  if (at <= (*length))
1110 #ifdef ENTER_USE_MEMMOVE
1111  memmove(&((*set)[at+1]), &((*set)[at]), ((*length)-at+1)*sizeof(LObject));
1112 #else
1113  for (i=(*length)+1; i>=at+1; i--) (*set)[i] = (*set)[i-1];
1114 #endif
1115  }
1116  else at = 0;
1117  (*set)[at] = p;
1118  (*length)++;
1119 }
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
#define setmaxLinc
Definition: kutil.h:28
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
static void enlargeL(LSet *L, int *length, const int incr)
Definition: kutil.cc:548
#define ENTER_USE_MEMMOVE
Definition: kutil.cc:42
void enterOnePairManyShifts ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  ,
int  uptodeg,
int  lV 
)

Definition at line 9134 of file kutil.cc.

9135 {
9136  /* p comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
9137 
9140 
9141  /* cycles through all shifts of s[i] until uptodeg - lastVblock(s[i]) */
9142  /* that is create the pairs (f, s \dot g) */
9143 
9144  poly qq = strat->S[i]; // lm in currRing, tail in tailRing
9145 
9146  // poly q = pCopy(pHead(strat->S[i])); // lm in currRing
9147  // pNext(q) = prCopyR(pNext(strat->S[i]),strat->tailRing,currRing); // zero shift
9148 
9149  /* determine how many elements we have to insert for a given s[i] */
9150  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
9151  /* hence, a total number of elt's to add is: */
9152  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
9153  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
9154 
9155 #ifdef KDEBUG
9156  if (TEST_OPT_DEBUG)
9157  {
9158  // Print("entered ManyShifts: with toInsert=%d",toInsert); PrintLn();
9159  }
9160 #endif
9161 
9162  assume(i<=strat->sl); // from OnePair
9163  if (strat->interred_flag) return; // ?
9164 
9165  /* these vars hold for all shifts of s[i] */
9166  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
9167 
9168  int qfromQ;
9169  if (strat->fromQ != NULL)
9170  {
9171  qfromQ = strat->fromQ[i];
9172  }
9173  else
9174  {
9175  qfromQ = -1;
9176  }
9177 
9178  int j;
9179 
9180  poly q/*, s*/;
9181 
9182  // for the 0th shift: insert the orig. pair
9183  enterOnePairShift(qq, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, 0, i, uptodeg, lV);
9184 
9185  for (j=1; j<= toInsert; j++)
9186  {
9187  // q = pLPshift(strat->S[i],j,uptodeg,lV);
9188  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
9189  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
9190  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
9191  // pNext(q) = s; // in tailRing
9192  /* here we need to call enterOnePair with two polys ... */
9193 
9194 #ifdef KDEBUG
9195  if (TEST_OPT_DEBUG)
9196  {
9197  // PrintS("ManyShifts: calling enterOnePairShift(q,p)"); PrintLn();
9198  }
9199 #endif
9200  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, i, uptodeg, lV);
9201  }
9202 }
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:9275
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:460
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:12
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN interred_flag
Definition: kutil.h:378
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
void enterOnePairNormal ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1490 of file kutil.cc.

1491 {
1492  assume(i<=strat->sl);
1493  if (strat->interred_flag) return;
1494 
1495  int l,j,compare;
1496  LObject Lp;
1497  Lp.i_r = -1;
1498 
1499 #ifdef KDEBUG
1500  Lp.ecart=0; Lp.length=0;
1501 #endif
1502  /*- computes the lcm(s[i],p) -*/
1503  Lp.lcm = pInit();
1504 
1505 #ifndef HAVE_RATGRING
1506  pLcm(p,strat->S[i],Lp.lcm);
1507 #elif defined(HAVE_RATGRING)
1508  // if (rIsRatGRing(currRing))
1509  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1510 #endif
1511  pSetm(Lp.lcm);
1512 
1513 
1514  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
1515  {
1516  if((!((strat->ecartS[i]>0)&&(ecart>0)))
1517  && pHasNotCF(p,strat->S[i]))
1518  {
1519  /*
1520  *the product criterion has applied for (s,p),
1521  *i.e. lcm(s,p)=product of the leading terms of s and p.
1522  *Suppose (s,r) is in L and the leading term
1523  *of p divides lcm(s,r)
1524  *(==> the leading term of p divides the leading term of r)
1525  *but the leading term of s does not divide the leading term of r
1526  *(notice that tis condition is automatically satisfied if r is still
1527  *in S), then (s,r) can be cancelled.
1528  *This should be done here because the
1529  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1530  *
1531  *Moreover, skipping (s,r) holds also for the noncommutative case.
1532  */
1533  strat->cp++;
1534  pLmFree(Lp.lcm);
1535  Lp.lcm=NULL;
1536  return;
1537  }
1538  else
1539  Lp.ecart = si_max(ecart,strat->ecartS[i]);
1540  if (strat->fromT && (strat->ecartS[i]>ecart))
1541  {
1542  pLmFree(Lp.lcm);
1543  Lp.lcm=NULL;
1544  return;
1545  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1546  }
1547  /*
1548  *the set B collects the pairs of type (S[j],p)
1549  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1550  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1551  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1552  */
1553  {
1554  j = strat->Bl;
1555  loop
1556  {
1557  if (j < 0) break;
1558  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1559  if ((compare==1)
1560  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
1561  {
1562  strat->c3++;
1563  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1564  {
1565  pLmFree(Lp.lcm);
1566  return;
1567  }
1568  break;
1569  }
1570  else
1571  if ((compare ==-1)
1572  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
1573  {
1574  deleteInL(strat->B,&strat->Bl,j,strat);
1575  strat->c3++;
1576  }
1577  j--;
1578  }
1579  }
1580  }
1581  else /*sugarcrit*/
1582  {
1583  if (ALLOW_PROD_CRIT(strat))
1584  {
1585  // if currRing->nc_type!=quasi (or skew)
1586  // TODO: enable productCrit for super commutative algebras...
1587  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
1588  pHasNotCF(p,strat->S[i]))
1589  {
1590  /*
1591  *the product criterion has applied for (s,p),
1592  *i.e. lcm(s,p)=product of the leading terms of s and p.
1593  *Suppose (s,r) is in L and the leading term
1594  *of p devides lcm(s,r)
1595  *(==> the leading term of p devides the leading term of r)
1596  *but the leading term of s does not devide the leading term of r
1597  *(notice that tis condition is automatically satisfied if r is still
1598  *in S), then (s,r) can be canceled.
1599  *This should be done here because the
1600  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
1601  */
1602  strat->cp++;
1603  pLmFree(Lp.lcm);
1604  Lp.lcm=NULL;
1605  return;
1606  }
1607  if (strat->fromT && (strat->ecartS[i]>ecart))
1608  {
1609  pLmFree(Lp.lcm);
1610  Lp.lcm=NULL;
1611  return;
1612  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
1613  }
1614  /*
1615  *the set B collects the pairs of type (S[j],p)
1616  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
1617  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1618  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1619  */
1620  for(j = strat->Bl;j>=0;j--)
1621  {
1622  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
1623  if (compare==1)
1624  {
1625  strat->c3++;
1626  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1627  {
1628  pLmFree(Lp.lcm);
1629  return;
1630  }
1631  break;
1632  }
1633  else
1634  if (compare ==-1)
1635  {
1636  deleteInL(strat->B,&strat->Bl,j,strat);
1637  strat->c3++;
1638  }
1639  }
1640  }
1641  }
1642  /*
1643  *the pair (S[i],p) enters B if the spoly != 0
1644  */
1645  /*- compute the short s-polynomial -*/
1646  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1647  pNorm(p);
1648 
1649  if ((strat->S[i]==NULL) || (p==NULL))
1650  return;
1651 
1652  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1653  Lp.p=NULL;
1654  else
1655  {
1656  #ifdef HAVE_PLURAL
1657  if ( rIsPluralRing(currRing) )
1658  {
1659  if(pHasNotCF(p, strat->S[i]))
1660  {
1661  if(ncRingType(currRing) == nc_lie)
1662  {
1663  // generalized prod-crit for lie-type
1664  strat->cp++;
1665  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
1666  }
1667  else
1668  if( ALLOW_PROD_CRIT(strat) )
1669  {
1670  // product criterion for homogeneous case in SCA
1671  strat->cp++;
1672  Lp.p = NULL;
1673  }
1674  else
1675  {
1676  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1677  nc_CreateShortSpoly(strat->S[i], p, currRing);
1678 
1679  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1680  pNext(Lp.p) = strat->tail; // !!!
1681  }
1682  }
1683  else
1684  {
1685  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1686  nc_CreateShortSpoly(strat->S[i], p, currRing);
1687 
1688  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1689  pNext(Lp.p) = strat->tail; // !!!
1690 
1691  }
1692 
1693 
1694 #if MYTEST
1695  if (TEST_OPT_DEBUG)
1696  {
1697  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1698  PrintS("p: "); pWrite(p);
1699  PrintS("SPoly: "); pWrite(Lp.p);
1700  }
1701 #endif
1702 
1703  }
1704  else
1705  #endif
1706  {
1708  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1709 #if MYTEST
1710  if (TEST_OPT_DEBUG)
1711  {
1712  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1713  PrintS("p: "); pWrite(p);
1714  PrintS("commutative SPoly: "); pWrite(Lp.p);
1715  }
1716 #endif
1717 
1718  }
1719  }
1720  if (Lp.p == NULL)
1721  {
1722  /*- the case that the s-poly is 0 -*/
1723  if (strat->pairtest==NULL) initPairtest(strat);
1724  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
1725  strat->pairtest[strat->sl+1] = TRUE;
1726  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
1727  /*
1728  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
1729  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
1730  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
1731  *term of p devides the lcm(s,r)
1732  *(this canceling should be done here because
1733  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
1734  *the first case is handeled in chainCrit
1735  */
1736  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
1737  }
1738  else
1739  {
1740  /*- the pair (S[i],p) enters B -*/
1741  Lp.p1 = strat->S[i];
1742  Lp.p2 = p;
1743 
1744  if (
1746 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
1747  )
1748  {
1749  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1750  pNext(Lp.p) = strat->tail; // !!!
1751  }
1752 
1753  if (atR >= 0)
1754  {
1755  Lp.i_r1 = strat->S_2_R[i];
1756  Lp.i_r2 = atR;
1757  }
1758  else
1759  {
1760  Lp.i_r1 = -1;
1761  Lp.i_r2 = -1;
1762  }
1763  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
1764 
1766  {
1767  if (!rIsPluralRing(currRing))
1768  nDelete(&(Lp.p->coef));
1769  }
1770 
1771  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
1772  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
1773  }
1774 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2295
#define pSetm(p)
Definition: polys.h:241
void pLcmRat(poly a, poly b, poly m, int rat_shift)
Definition: ratgring.cc:30
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
#define TRUE
Definition: auxiliary.h:144
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
void pWrite(poly p)
Definition: polys.h:279
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1926
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
int Bmax
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
polyset S
Definition: kutil.h:304
BOOLEAN sugarCrit
Definition: kutil.h:371
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:349
intset ecartS
Definition: kutil.h:307
BOOLEAN interred_flag
Definition: kutil.h:378
void initPairtest(kStrategy strat)
Definition: kutil.cc:558
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
ring tailRing
Definition: kutil.h:343
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
#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:351
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:390
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void enterOnePairRing ( int  i,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1167 of file kutil.cc.

1168 {
1169  assume(i<=strat->sl);
1170  int l,j,compare,compareCoeff;
1171  LObject Lp;
1172 
1173  if (strat->interred_flag) return;
1174 #ifdef KDEBUG
1175  Lp.ecart=0; Lp.length=0;
1176 #endif
1177  /*- computes the lcm(s[i],p) -*/
1178  Lp.lcm = pInit();
1179  pSetCoeff0(Lp.lcm, n_Lcm(pGetCoeff(p), pGetCoeff(strat->S[i]), currRing->cf));
1180 
1181  #if ADIDEBUG
1182  PrintS("\nLp.lcm (lc) = ");pWrite(Lp.lcm);
1183  #endif
1184 
1185  // Lp.lcm == 0
1186  if (nIsZero(pGetCoeff(Lp.lcm)))
1187  {
1188 #ifdef KDEBUG
1189  if (TEST_OPT_DEBUG)
1190  {
1191  PrintS("--- Lp.lcm == 0\n");
1192  PrintS("p:");
1193  wrp(p);
1194  Print(" strat->S[%d]:", i);
1195  wrp(strat->S[i]);
1196  PrintLn();
1197  }
1198 #endif
1199  strat->cp++;
1200  pLmDelete(Lp.lcm);
1201  return;
1202  }
1203  // basic product criterion
1204  pLcm(p,strat->S[i],Lp.lcm);
1205  pSetm(Lp.lcm);
1206 
1207  #if ADIDEBUG
1208  PrintS("\nLp.lcm (lcm) = ");pWrite(Lp.lcm);
1209  #endif
1210 
1211  assume(!strat->sugarCrit);
1212  if (pHasNotCF(p,strat->S[i]) && n_IsUnit(pGetCoeff(p),currRing->cf)
1213  && n_IsUnit(pGetCoeff(strat->S[i]),currRing->cf))
1214  {
1215 #ifdef KDEBUG
1216  if (TEST_OPT_DEBUG)
1217  {
1218  PrintS("--- product criterion func enterOnePairRing type 1\n");
1219  PrintS("p:");
1220  wrp(p);
1221  Print(" strat->S[%d]:", i);
1222  wrp(strat->S[i]);
1223  PrintLn();
1224  }
1225 #endif
1226  strat->cp++;
1227  pLmDelete(Lp.lcm);
1228  return;
1229  }
1230  assume(!strat->fromT);
1231  /*
1232  *the set B collects the pairs of type (S[j],p)
1233  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
1234  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
1235  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
1236  */
1237  for(j = strat->Bl;j>=0;j--)
1238  {
1239  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
1240  compareCoeff = n_DivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm), currRing->cf);
1241  if ((compareCoeff == pDivComp_EQUAL) || (compare == compareCoeff))
1242  {
1243  if (compare == 1)
1244  {
1245  strat->c3++;
1246 #ifdef KDEBUG
1247  if (TEST_OPT_DEBUG)
1248  {
1249  PrintS("--- chain criterion type 1\n");
1250  PrintS("strat->B[j]:");
1251  wrp(strat->B[j].lcm);
1252  PrintS(" Lp.lcm:");
1253  wrp(Lp.lcm);
1254  PrintLn();
1255  }
1256 #endif
1257  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1258  {
1259  pLmDelete(Lp.lcm);
1260  return;
1261  }
1262  break;
1263  }
1264  else if (compare == -1)
1265  {
1266 #ifdef KDEBUG
1267  if (TEST_OPT_DEBUG)
1268  {
1269  PrintS("--- chain criterion type 2\n");
1270  Print("strat->B[%d].lcm:",j);
1271  wrp(strat->B[j].lcm);
1272  PrintS(" Lp.lcm:");
1273  wrp(Lp.lcm);
1274  PrintLn();
1275  }
1276 #endif
1277  deleteInL(strat->B,&strat->Bl,j,strat);
1278  strat->c3++;
1279  }
1280  }
1281  if ((compare == pDivComp_EQUAL) && (compareCoeff != 2))
1282  {
1283  if (compareCoeff == pDivComp_LESS)
1284  {
1285 #ifdef KDEBUG
1286  if (TEST_OPT_DEBUG)
1287  {
1288  PrintS("--- chain criterion type 3\n");
1289  Print("strat->B[%d].lcm:", j);
1290  wrp(strat->B[j].lcm);
1291  PrintS(" Lp.lcm:");
1292  wrp(Lp.lcm);
1293  PrintLn();
1294  }
1295 #endif
1296  strat->c3++;
1297  if ((strat->fromQ==NULL) || (isFromQ==0) || (strat->fromQ[i]==0))
1298  {
1299  pLmDelete(Lp.lcm);
1300  return;
1301  }
1302  break;
1303  }
1304  else
1305  // Add hint for same LM and LC (later) (TODO Oliver)
1306  // if (compareCoeff == pDivComp_GREATER)
1307  {
1308 #ifdef KDEBUG
1309  if (TEST_OPT_DEBUG)
1310  {
1311  PrintS("--- chain criterion type 4\n");
1312  Print("strat->B[%d].lcm:", j);
1313  wrp(strat->B[j].lcm);
1314  PrintS(" Lp.lcm:");
1315  wrp(Lp.lcm);
1316  PrintLn();
1317  }
1318 #endif
1319  deleteInL(strat->B,&strat->Bl,j,strat);
1320  strat->c3++;
1321  }
1322  }
1323  }
1324  /*
1325  *the pair (S[i],p) enters B if the spoly != 0
1326  */
1327  /*- compute the short s-polynomial -*/
1328  if ((strat->S[i]==NULL) || (p==NULL))
1329  {
1330 #ifdef KDEBUG
1331  if (TEST_OPT_DEBUG)
1332  {
1333  PrintS("--- spoly = NULL\n");
1334  }
1335 #endif
1336  pLmDelete(Lp.lcm);
1337  return;
1338  }
1339  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1340  {
1341  // Is from a previous computed GB, therefore we know that spoly will
1342  // reduce to zero. Oliver.
1343  WarnS("Could we come here? 8738947389");
1344  Lp.p=NULL;
1345  }
1346  else
1347  {
1348  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1349  }
1350  if (Lp.p == NULL)
1351  {
1352 #ifdef KDEBUG
1353  if (TEST_OPT_DEBUG)
1354  {
1355  PrintS("--- spoly = NULL\n");
1356  }
1357 #endif
1358  /*- the case that the s-poly is 0 -*/
1359  if (strat->pairtest==NULL) initPairtest(strat);
1360  strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
1361  strat->pairtest[strat->sl+1] = TRUE;
1362  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
1363  /*
1364  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
1365  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
1366  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
1367  *term of p devides the lcm(s,r)
1368  *(this canceling should be done here because
1369  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
1370  *the first case is handeled in chainCrit
1371  */
1372  pLmDelete(Lp.lcm);
1373  }
1374  else
1375  {
1376  /*- the pair (S[i],p) enters B -*/
1377  Lp.p1 = strat->S[i];
1378  Lp.p2 = p;
1379 
1380  pNext(Lp.p) = strat->tail;
1381 
1382  if (atR >= 0)
1383  {
1384  Lp.i_r2 = atR;
1385  Lp.i_r1 = strat->S_2_R[i];
1386  }
1387  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
1388  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
1389  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
1390  }
1391 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define pSetm(p)
Definition: polys.h:241
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 pDivComp_LESS
Definition: kutil.cc:133
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define pDivComp_EQUAL
Definition: kutil.cc:132
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
BOOLEAN * pairtest
Definition: kutil.h:333
int Bl
Definition: kutil.h:355
#define pLmDelete(p)
assume p != NULL, deletes Lm(p)->coef and Lm(p)
Definition: polys.h:76
#define TRUE
Definition: auxiliary.h:144
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
void pWrite(poly p)
Definition: polys.h:279
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
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 WarnS
Definition: emacs.cc:81
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
int Bmax
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
static FORCE_INLINE int n_DivComp(number a, number b, const coeffs r)
Definition: coeffs.h:515
polyset S
Definition: kutil.h:304
BOOLEAN sugarCrit
Definition: kutil.h:371
static FORCE_INLINE number n_Lcm(number a, number b, const coeffs r)
in Z: return the lcm of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:709
int cp
Definition: kutil.h:349
intset ecartS
Definition: kutil.h:307
BOOLEAN interred_flag
Definition: kutil.h:378
void initPairtest(kStrategy strat)
Definition: kutil.cc:558
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
ring tailRing
Definition: kutil.h:343
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#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:141
int sl
Definition: kutil.h:351
void wrp(poly p)
Definition: polys.h:281
int l
Definition: cfEzgcd.cc:94
void enterOnePairSelfShifts ( poly  qq,
poly  p,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  ,
int  uptodeg,
int  lV 
)

Definition at line 9210 of file kutil.cc.

9211 {
9212 
9213  /* format: p,qq are in LObject form: lm in CR, tail in TR */
9214  /* for true self pairs qq ==p */
9215  /* we test both qq and p */
9217  assume(p_CheckIsFromRing(pNext(qq),strat->tailRing));
9220 
9221  /* since this proc is applied twice for (h, s*g) and (g,s*h), init j with 1 only */
9222 
9223  // int j = 0;
9224  int j = 1;
9225 
9226  /* for such self pairs start with 1, not with 0 */
9227  if (qq == p) j=1;
9228 
9229  /* should cycle through all shifts of q until uptodeg - lastVblock(q) */
9230  /* that is create the pairs (f, s \dot g) */
9231 
9232  int toInsert = itoInsert(qq, uptodeg, lV, strat->tailRing);
9233 
9234 #ifdef KDEBUG
9235  if (TEST_OPT_DEBUG)
9236  {
9237  // Print("entered SelfShifts: with toInsert=%d",toInsert); PrintLn();
9238  }
9239 #endif
9240 
9241  poly q;
9242 
9243  if (strat->interred_flag) return; // ?
9244 
9245  /* these vars hold for all shifts of s[i] */
9246  int ecartq = 0; //Hans says it's ok; we're in the homog case, no ecart
9247  int qfromQ = 0; // strat->fromQ[i];
9248 
9249  for (; j<= toInsert; j++)
9250  {
9251  // q = pLPshift(strat->S[i],j,uptodeg,lV);
9252  /* we increase shifts by one; must delete q there*/
9253  // q = qq; q = pMoveCurrTail2poly(q,strat);
9254  // q = pLPshift(q,j,uptodeg,lV); //,currRing);
9255  q = p_LPshiftT(qq, j, uptodeg, lV, strat, currRing);
9256  // q = p_mLPshift(qq,j,uptodeg,lV,currRing); // lm in currRing, shift this monomial
9257  // s = p_LPshift(pNext(qq), j, uptodeg, lV, strat->tailRing); // from tailRing
9258  // pNext(q) = s; // in tailRing
9259  /* here we need to call enterOnePair with two polys ... */
9260 #ifdef KDEBUG
9261  if (TEST_OPT_DEBUG)
9262  {
9263  // PrintS("SelfShifts: calling enterOnePairShift(q,p)"); PrintLn();
9264  }
9265 #endif
9266  enterOnePairShift(q, p, ecart, isFromQ, strat, -1, ecartq, qfromQ, j, -1, uptodeg, lV);
9267  }
9268 }
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:9275
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:460
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:12
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
poly p_LPshiftT(poly p, int sh, int uptodeg, int lV, kStrategy strat, const ring r)
Definition: shiftgb.cc:45
BOOLEAN interred_flag
Definition: kutil.h:378
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
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 9275 of file kutil.cc.

9276 {
9277 
9278  /* Format: q and p are like strat->P.p, so lm in CR, tail in TR */
9279 
9280  /* check this Formats: */
9282  assume(p_CheckIsFromRing(pNext(q),strat->tailRing));
9285 
9286 #ifdef KDEBUG
9287  if (TEST_OPT_DEBUG)
9288  {
9289 // PrintS("enterOnePairShift(q,p) invoked with q = ");
9290 // wrp(q); // wrp(pHead(q));
9291 // PrintS(", p = ");
9292 // wrp(p); //wrp(pHead(p));
9293 // PrintLn();
9294  }
9295 #endif
9296 
9297  /* poly q stays for s[i], ecartq = ecart(q), qisFromQ = applies to q */
9298 
9299  int qfromQ = qisFromQ;
9300 
9301  /* need additionally: int up_to_degree, poly V0 with the variables in (0) or just the number lV = the length of the first block */
9302 
9303  if (strat->interred_flag) return;
9304 
9305  int l,j,compare;
9306  LObject Lp;
9307  Lp.i_r = -1;
9308 
9309 #ifdef KDEBUG
9310  Lp.ecart=0; Lp.length=0;
9311 #endif
9312  /*- computes the lcm(s[i],p) -*/
9313  Lp.lcm = pInit();
9314 
9315  pLcm(p,q, Lp.lcm); // q is what was strat->S[i], so a poly in LM/TR presentation
9316  pSetm(Lp.lcm);
9317 
9318  /* apply the V criterion */
9319  if (!isInV(Lp.lcm, lV))
9320  {
9321 #ifdef KDEBUG
9322  if (TEST_OPT_DEBUG)
9323  {
9324  PrintS("V crit applied to q = ");
9325  wrp(q); // wrp(pHead(q));
9326  PrintS(", p = ");
9327  wrp(p); //wrp(pHead(p));
9328  PrintLn();
9329  }
9330 #endif
9331  pLmFree(Lp.lcm);
9332  Lp.lcm=NULL;
9333  /* + counter for applying the V criterion */
9334  strat->cv++;
9335  return;
9336  }
9337 
9338  if (strat->sugarCrit && ALLOW_PROD_CRIT(strat))
9339  {
9340  if((!((ecartq>0)&&(ecart>0)))
9341  && pHasNotCF(p,q))
9342  {
9343  /*
9344  *the product criterion has applied for (s,p),
9345  *i.e. lcm(s,p)=product of the leading terms of s and p.
9346  *Suppose (s,r) is in L and the leading term
9347  *of p divides lcm(s,r)
9348  *(==> the leading term of p divides the leading term of r)
9349  *but the leading term of s does not divide the leading term of r
9350  *(notice that this condition is automatically satisfied if r is still
9351  *in S), then (s,r) can be cancelled.
9352  *This should be done here because the
9353  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
9354  *
9355  *Moreover, skipping (s,r) holds also for the noncommutative case.
9356  */
9357  strat->cp++;
9358  pLmFree(Lp.lcm);
9359  Lp.lcm=NULL;
9360  return;
9361  }
9362  else
9363  Lp.ecart = si_max(ecart,ecartq);
9364  if (strat->fromT && (ecartq>ecart))
9365  {
9366  pLmFree(Lp.lcm);
9367  Lp.lcm=NULL;
9368  return;
9369  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
9370  }
9371  /*
9372  *the set B collects the pairs of type (S[j],p)
9373  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
9374  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
9375  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
9376  */
9377  {
9378  j = strat->Bl;
9379  loop
9380  {
9381  if (j < 0) break;
9382  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
9383  if ((compare==1)
9384  &&(sugarDivisibleBy(strat->B[j].ecart,Lp.ecart)))
9385  {
9386  strat->c3++;
9387  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
9388  {
9389  pLmFree(Lp.lcm);
9390  return;
9391  }
9392  break;
9393  }
9394  else
9395  if ((compare ==-1)
9396  && sugarDivisibleBy(Lp.ecart,strat->B[j].ecart))
9397  {
9398  deleteInL(strat->B,&strat->Bl,j,strat);
9399  strat->c3++;
9400  }
9401  j--;
9402  }
9403  }
9404  }
9405  else /*sugarcrit*/
9406  {
9407  if (ALLOW_PROD_CRIT(strat))
9408  {
9409  // if currRing->nc_type!=quasi (or skew)
9410  // TODO: enable productCrit for super commutative algebras...
9411  if(/*(strat->ak==0) && productCrit(p,strat->S[i])*/
9412  pHasNotCF(p,q))
9413  {
9414  /*
9415  *the product criterion has applied for (s,p),
9416  *i.e. lcm(s,p)=product of the leading terms of s and p.
9417  *Suppose (s,r) is in L and the leading term
9418  *of p devides lcm(s,r)
9419  *(==> the leading term of p devides the leading term of r)
9420  *but the leading term of s does not devide the leading term of r
9421  *(notice that tis condition is automatically satisfied if r is still
9422  *in S), then (s,r) can be canceled.
9423  *This should be done here because the
9424  *case lcm(s,r)=lcm(s,p) is not covered by chainCrit.
9425  */
9426  strat->cp++;
9427  pLmFree(Lp.lcm);
9428  Lp.lcm=NULL;
9429  return;
9430  }
9431  if (strat->fromT && (ecartq>ecart))
9432  {
9433  pLmFree(Lp.lcm);
9434  Lp.lcm=NULL;
9435  return;
9436  /*the pair is (s[i],t[.]), discard it if the ecart is too big*/
9437  }
9438  /*
9439  *the set B collects the pairs of type (S[j],p)
9440  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p)#lcm(r,p)
9441  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
9442  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
9443  */
9444  for(j = strat->Bl;j>=0;j--)
9445  {
9446  compare=pDivComp(strat->B[j].lcm,Lp.lcm);
9447  if (compare==1)
9448  {
9449  strat->c3++;
9450  if ((strat->fromQ==NULL) || (isFromQ==0) || (qfromQ==0))
9451  {
9452  pLmFree(Lp.lcm);
9453  return;
9454  }
9455  break;
9456  }
9457  else
9458  if (compare ==-1)
9459  {
9460  deleteInL(strat->B,&strat->Bl,j,strat);
9461  strat->c3++;
9462  }
9463  }
9464  }
9465  }
9466  /*
9467  *the pair (S[i],p) enters B if the spoly != 0
9468  */
9469  /*- compute the short s-polynomial -*/
9470  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
9471  pNorm(p);
9472  if ((q==NULL) || (p==NULL))
9473  return;
9474  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (qfromQ!=0))
9475  Lp.p=NULL;
9476  else
9477  {
9478 // if ( rIsPluralRing(currRing) )
9479 // {
9480 // if(pHasNotCF(p, q))
9481 // {
9482 // if(ncRingType(currRing) == nc_lie)
9483 // {
9484 // // generalized prod-crit for lie-type
9485 // strat->cp++;
9486 // Lp.p = nc_p_Bracket_qq(pCopy(p),q, currRing);
9487 // }
9488 // else
9489 // if( ALLOW_PROD_CRIT(strat) )
9490 // {
9491 // // product criterion for homogeneous case in SCA
9492 // strat->cp++;
9493 // Lp.p = NULL;
9494 // }
9495 // else
9496 // Lp.p = nc_CreateSpoly(q,p,currRing); // ?
9497 // }
9498 // else Lp.p = nc_CreateSpoly(q,p,currRing);
9499 // }
9500 // else
9501 // {
9502 
9503  /* ksCreateShortSpoly needs two Lobject-kind presentations */
9504  /* p is already in this form, so convert q */
9505  // q = pMove2CurrTail(q, strat);
9506  Lp.p = ksCreateShortSpoly(q, p, strat->tailRing);
9507  // }
9508  }
9509  if (Lp.p == NULL)
9510  {
9511  /*- the case that the s-poly is 0 -*/
9512  /* TEMPORARILY DISABLED FOR SHIFTS because there is no i*/
9513 // if (strat->pairtest==NULL) initPairtest(strat);
9514 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
9515 // strat->pairtest[strat->sl+1] = TRUE;
9516  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
9517  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
9518  /*
9519  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
9520  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
9521  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
9522  *term of p devides the lcm(s,r)
9523  *(this canceling should be done here because
9524  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
9525  *the first case is handeled in chainCrit
9526  */
9527  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
9528  }
9529  else
9530  {
9531  /*- the pair (S[i],p) enters B -*/
9532  /* both of them should have their LM in currRing and TAIL in tailring */
9533  Lp.p1 = q; // already in the needed form
9534  Lp.p2 = p; // already in the needed form
9535 
9536  if ( !rIsPluralRing(currRing) )
9537  pNext(Lp.p) = strat->tail;
9538 
9539  /* TEMPORARILY DISABLED FOR SHIFTS because there's no i*/
9540  /* at the beginning we DO NOT set atR = -1 ANYMORE*/
9541  if ( (atR >= 0) && (shiftcount==0) && (ifromS >=0) )
9542  {
9543  Lp.i_r1 = kFindInT(Lp.p1,strat); //strat->S_2_R[ifromS];
9544  Lp.i_r2 = atR;
9545  }
9546  else
9547  {
9548  /* END _ TEMPORARILY DISABLED FOR SHIFTS */
9549  Lp.i_r1 = -1;
9550  Lp.i_r2 = -1;
9551  }
9552  strat->initEcartPair(&Lp,q,p,ecartq,ecart);
9553 
9555  {
9556  if (!rIsPluralRing(currRing))
9557  nDelete(&(Lp.p->coef));
9558  }
9559 
9560  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
9561  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
9562  }
9563 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define pSetm(p)
Definition: polys.h:241
void PrintLn()
Definition: reporter.cc:322
BOOLEAN p_LmCheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:71
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
int kFindInT(poly p, TSet T, int tlength)
returns index of p in TSet, or -1 if not found
Definition: kutil.cc:603
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
int cv
Definition: kutil.h:350
int Bl
Definition: kutil.h:355
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
int Bmax
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
void PrintS(const char *s)
Definition: reporter.cc:294
int isInV(poly p, int lV)
Definition: shiftgb.cc:377
poly tail
Definition: kutil.h:334
BOOLEAN sugarCrit
Definition: kutil.h:371
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:349
BOOLEAN interred_flag
Definition: kutil.h:378
BOOLEAN p_CheckIsFromRing(poly p, ring r)
Definition: pDebug.cc:101
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
ring tailRing
Definition: kutil.h:343
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
#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:390
void wrp(poly p)
Definition: polys.h:281
static BOOLEAN sugarDivisibleBy(int ecart1, int ecart2)
Definition: kutil.cc:1158
int l
Definition: cfEzgcd.cc:94
void enterOnePairSig ( int  i,
poly  p,
poly  pSig,
int  ,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1784 of file kutil.cc.

1786 {
1787  assume(i<=strat->sl);
1788  if (strat->interred_flag) return;
1789 
1790  int l;
1791  poly m1 = NULL,m2 = NULL; // we need the multipliers for the s-polynomial to compute
1792  // the corresponding signatures for criteria checks
1793  LObject Lp;
1794  poly pSigMult = p_Copy(pSig,currRing);
1795  poly sSigMult = p_Copy(strat->sig[i],currRing);
1796  unsigned long pSigMultNegSev,sSigMultNegSev;
1797  Lp.i_r = -1;
1798 
1799 #ifdef KDEBUG
1800  Lp.ecart=0; Lp.length=0;
1801 #endif
1802  /*- computes the lcm(s[i],p) -*/
1803  Lp.lcm = pInit();
1804  k_GetLeadTerms(p,strat->S[i],currRing,m1,m2,currRing);
1805 #ifndef HAVE_RATGRING
1806  pLcm(p,strat->S[i],Lp.lcm);
1807 #elif defined(HAVE_RATGRING)
1808  // if (rIsRatGRing(currRing))
1809  pLcmRat(p,strat->S[i],Lp.lcm, currRing->real_var_start); // int rat_shift
1810 #endif
1811  pSetm(Lp.lcm);
1812 
1813  // set coeffs of multipliers m1 and m2
1814  pSetCoeff0(m1, nInit(1));
1815  pSetCoeff0(m2, nInit(1));
1816 //#if 1
1817 #ifdef DEBUGF5
1818  Print("P1 ");
1819  pWrite(pHead(p));
1820  Print("P2 ");
1821  pWrite(pHead(strat->S[i]));
1822  Print("M1 ");
1823  pWrite(m1);
1824  Print("M2 ");
1825  pWrite(m2);
1826 #endif
1827  // get multiplied signatures for testing
1828  pSigMult = currRing->p_Procs->pp_Mult_mm(pSigMult,m1,currRing);
1829  pSigMultNegSev = ~p_GetShortExpVector(pSigMult,currRing);
1830  sSigMult = currRing->p_Procs->pp_Mult_mm(sSigMult,m2,currRing);
1831  sSigMultNegSev = ~p_GetShortExpVector(sSigMult,currRing);
1832 
1833 //#if 1
1834 #ifdef DEBUGF5
1835  Print("----------------\n");
1836  pWrite(pSigMult);
1837  pWrite(sSigMult);
1838  Print("----------------\n");
1839  Lp.checked = 0;
1840 #endif
1841  int sigCmp = p_LmCmp(pSigMult,sSigMult,currRing);
1842 //#if 1
1843 #if DEBUGF5
1844  Print("IN PAIR GENERATION - COMPARING SIGS: %d\n",sigCmp);
1845  pWrite(pSigMult);
1846  pWrite(sSigMult);
1847 #endif
1848  if(sigCmp==0)
1849  {
1850  // printf("!!!! EQUAL SIGS !!!!\n");
1851  // pSig = sSig, delete element due to Rewritten Criterion
1852  pDelete(&pSigMult);
1853  pDelete(&sSigMult);
1854  pLmFree(Lp.lcm);
1855  Lp.lcm=NULL;
1856  pDelete (&m1);
1857  pDelete (&m2);
1858  return;
1859  }
1860  // testing by syzCrit = F5 Criterion
1861  // testing by rewCrit1 = Rewritten Criterion
1862  // NOTE: Arri's Rewritten Criterion is tested below, we need Lp.p for it!
1863  if ( strat->syzCrit(pSigMult,pSigMultNegSev,strat) ||
1864  strat->syzCrit(sSigMult,sSigMultNegSev,strat)
1865  || strat->rewCrit1(sSigMult,sSigMultNegSev,Lp.lcm,strat,i+1)
1866  )
1867  {
1868  pDelete(&pSigMult);
1869  pDelete(&sSigMult);
1870  pLmFree(Lp.lcm);
1871  Lp.lcm=NULL;
1872  pDelete (&m1);
1873  pDelete (&m2);
1874  return;
1875  }
1876  /*
1877  *the pair (S[i],p) enters B if the spoly != 0
1878  */
1879  /*- compute the short s-polynomial -*/
1880  if (strat->fromT && !TEST_OPT_INTSTRATEGY)
1881  pNorm(p);
1882 
1883  if ((strat->S[i]==NULL) || (p==NULL))
1884  return;
1885 
1886  if ((strat->fromQ!=NULL) && (isFromQ!=0) && (strat->fromQ[i]!=0))
1887  Lp.p=NULL;
1888  else
1889  {
1890  #ifdef HAVE_PLURAL
1891  if ( rIsPluralRing(currRing) )
1892  {
1893  if(pHasNotCF(p, strat->S[i]))
1894  {
1895  if(ncRingType(currRing) == nc_lie)
1896  {
1897  // generalized prod-crit for lie-type
1898  strat->cp++;
1899  Lp.p = nc_p_Bracket_qq(pCopy(p),strat->S[i], currRing);
1900  }
1901  else
1902  if( ALLOW_PROD_CRIT(strat) )
1903  {
1904  // product criterion for homogeneous case in SCA
1905  strat->cp++;
1906  Lp.p = NULL;
1907  }
1908  else
1909  {
1910  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1911  nc_CreateShortSpoly(strat->S[i], p, currRing);
1912 
1913  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1914  pNext(Lp.p) = strat->tail; // !!!
1915  }
1916  }
1917  else
1918  {
1919  Lp.p = // nc_CreateSpoly(strat->S[i],p,currRing);
1920  nc_CreateShortSpoly(strat->S[i], p, currRing);
1921 
1922  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
1923  pNext(Lp.p) = strat->tail; // !!!
1924 
1925  }
1926 
1927 
1928 #if MYTEST
1929  if (TEST_OPT_DEBUG)
1930  {
1931  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1932  PrintS("p: "); pWrite(p);
1933  PrintS("SPoly: "); pWrite(Lp.p);
1934  }
1935 #endif
1936 
1937  }
1938  else
1939  #endif
1940  {
1942  Lp.p = ksCreateShortSpoly(strat->S[i], p, strat->tailRing);
1943 #if MYTEST
1944  if (TEST_OPT_DEBUG)
1945  {
1946  PrintS("enterOnePairNormal::\n strat->S[i]: "); pWrite(strat->S[i]);
1947  PrintS("p: "); pWrite(p);
1948  PrintS("commutative SPoly: "); pWrite(Lp.p);
1949  }
1950 #endif
1951 
1952  }
1953  }
1954  // store from which element this pair comes from for further tests
1955  //Lp.from = strat->sl+1;
1956  if(sigCmp==currRing->OrdSgn)
1957  {
1958  // pSig > sSig
1959  pDelete (&sSigMult);
1960  Lp.sig = pSigMult;
1961  Lp.sevSig = ~pSigMultNegSev;
1962  }
1963  else
1964  {
1965  // pSig < sSig
1966  pDelete (&pSigMult);
1967  Lp.sig = sSigMult;
1968  Lp.sevSig = ~sSigMultNegSev;
1969  }
1970  if (Lp.p == NULL)
1971  {
1972  if (Lp.lcm!=NULL) pLmFree(Lp.lcm);
1973  int pos = posInSyz(strat, Lp.sig);
1974  enterSyz(Lp, strat, pos);
1975  }
1976  else
1977  {
1978  // testing by rewCrit3 = Arris Rewritten Criterion (for F5 nothing happens!)
1979  if (strat->rewCrit3(Lp.sig,~Lp.sevSig,Lp.p,strat,strat->sl+1)) {
1980  pLmFree(Lp.lcm);
1981  pDelete(&Lp.sig);
1982  Lp.lcm=NULL;
1983  pDelete (&m1);
1984  pDelete (&m2);
1985  return;
1986  }
1987  // in any case Lp is checked up to the next strat->P which is added
1988  // to S right after this critical pair creation.
1989  // NOTE: this even holds if the 2nd generator gives the bigger signature
1990  // moreover, this improves rewCriterion,
1991  // i.e. strat->checked > strat->from if and only if the 2nd generator
1992  // gives the bigger signature.
1993  Lp.checked = strat->sl+1;
1994  // at this point it is clear that the pair will be added to L, since it has
1995  // passed all tests up to now
1996 
1997  // adds buchberger's first criterion
1998  if (pLmCmp(m2,pHead(p)) == 0) {
1999  Lp.prod_crit = TRUE; // Product Criterion
2000 #if 0
2001  int pos = posInSyz(strat, Lp.sig);
2002  enterSyz(Lp, strat, pos);
2003  Lp.lcm=NULL;
2004  pDelete (&m1);
2005  pDelete (&m2);
2006  return;
2007 #endif
2008  }
2009  pDelete (&m1);
2010  pDelete (&m2);
2011 #if DEBUGF5
2012  PrintS("SIGNATURE OF PAIR: ");
2013  pWrite(Lp.sig);
2014 #endif
2015  /*- the pair (S[i],p) enters B -*/
2016  Lp.p1 = strat->S[i];
2017  Lp.p2 = p;
2018 
2019  if (
2021 // || (rIsPluralRing(currRing) && (ncRingType(currRing) != nc_lie))
2022  )
2023  {
2024  assume(pNext(Lp.p)==NULL); // TODO: this may be violated whenever ext.prod.crit. for Lie alg. is used
2025  pNext(Lp.p) = strat->tail; // !!!
2026  }
2027 
2028  if (atR >= 0)
2029  {
2030  Lp.i_r1 = strat->S_2_R[i];
2031  Lp.i_r2 = atR;
2032  }
2033  else
2034  {
2035  Lp.i_r1 = -1;
2036  Lp.i_r2 = -1;
2037  }
2038  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2039 
2041  {
2042  if (!rIsPluralRing(currRing))
2043  nDelete(&(Lp.p->coef));
2044  }
2045 
2046  l = strat->posInLSba(strat->B,strat->Bl,&Lp,strat);
2047  enterL(&strat->B,&strat->Bl,&strat->Bmax,Lp,l);
2048  }
2049 }
polyset sig
Definition: kutil.h:306
poly nc_p_Bracket_qq(poly p, const poly q, const ring r)
returns [p,q], destroys p
Definition: old.gring.cc:2295
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:964
#define pSetm(p)
Definition: polys.h:241
#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:292
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
void enterSyz(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7240
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:281
int Bl
Definition: kutil.h:355
#define TRUE
Definition: auxiliary.h:144
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
BOOLEAN(* rewCrit3)(poly sig, unsigned long not_sevSig, poly lm, kStrategy strat, int start)
Definition: kutil.h:294
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
void pWrite(poly p)
Definition: polys.h:279
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1926
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
int Bmax
Definition: kutil.h:355
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:291
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
#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:304
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:349
intset ecartS
Definition: kutil.h:307
BOOLEAN interred_flag
Definition: kutil.h:378
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:4624
ring tailRing
Definition: kutil.h:343
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
#define pInit()
allocates a new monomial and initializes everything to 0
Definition: polys.h:61
#define pDelete(p_ptr)
Definition: polys.h:157
#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:351
#define ALLOW_PROD_CRIT(A)
Definition: kutil.h:390
#define nInit(i)
Definition: numbers.h:24
int l
Definition: cfEzgcd.cc:94
Definition: nc.h:26
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void enterOnePairSpecial ( int  i,
poly  p,
int  ecart,
kStrategy  strat,
int  atR = -1 
)

Definition at line 2055 of file kutil.cc.

2056 {
2057  //PrintS("try ");wrp(strat->S[i]);PrintS(" and ");wrp(p);PrintLn();
2058  if(pHasNotCF(p,strat->S[i]))
2059  {
2060  //PrintS("prod-crit\n");
2061  if(ALLOW_PROD_CRIT(strat))
2062  {
2063  //PrintS("prod-crit\n");
2064  strat->cp++;
2065  return;
2066  }
2067  }
2068 
2069  int l,j,compare;
2070  LObject Lp;
2071  Lp.i_r = -1;
2072 
2073  Lp.lcm = pInit();
2074  pLcm(p,strat->S[i],Lp.lcm);
2075  pSetm(Lp.lcm);
2076  for(j = strat->Ll;j>=0;j--)
2077  {
2078  compare=pDivComp(strat->L[j].lcm,Lp.lcm);
2079  if ((compare==1) || (pLmEqual(strat->L[j].lcm,Lp.lcm)))
2080  {
2081  //PrintS("c3-crit\n");
2082  strat->c3++;
2083  pLmFree(Lp.lcm);
2084  return;
2085  }
2086  else if (compare ==-1)
2087  {
2088  //Print("c3-crit with L[%d]\n",j);
2089  deleteInL(strat->L,&strat->Ll,j,strat);
2090  strat->c3++;
2091  }
2092  }
2093  /*- compute the short s-polynomial -*/
2094 
2095  #ifdef HAVE_PLURAL
2096  if (rIsPluralRing(currRing))
2097  {
2098  Lp.p = nc_CreateShortSpoly(strat->S[i],p, currRing); // ??? strat->tailRing?
2099  }
2100  else
2101  #endif
2102  Lp.p = ksCreateShortSpoly(strat->S[i],p,strat->tailRing);
2103 
2104  if (Lp.p == NULL)
2105  {
2106  //PrintS("short spoly==NULL\n");
2107  pLmFree(Lp.lcm);
2108  }
2109  else
2110  {
2111  /*- the pair (S[i],p) enters L -*/
2112  Lp.p1 = strat->S[i];
2113  Lp.p2 = p;
2114  if (atR >= 0)
2115  {
2116  Lp.i_r1 = strat->S_2_R[i];
2117  Lp.i_r2 = atR;
2118  }
2119  else
2120  {
2121  Lp.i_r1 = -1;
2122  Lp.i_r2 = -1;
2123  }
2124  assume(pNext(Lp.p) == NULL);
2125  pNext(Lp.p) = strat->tail;
2126  strat->initEcartPair(&Lp,strat->S[i],p,strat->ecartS[i],ecart);
2128  {
2129  nDelete(&(Lp.p->coef));
2130  }
2131  l = strat->posInL(strat->L,strat->Ll,&Lp,strat);
2132  //Print("-> L[%d]\n",l);
2133  enterL(&strat->L,&strat->Ll,&strat->Lmax,Lp,l);
2134  }
2135 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define pSetm(p)
Definition: polys.h:241
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int c3
Definition: kutil.h:349
static int pDivComp(poly p, poly q)
Definition: kutil.cc:179
#define pHasNotCF(p1, p2)
Definition: polys.h:233
#define pLcm(a, b, m)
Definition: polys.h:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
poly nc_CreateShortSpoly(poly p1, poly p2, const ring r)
Definition: old.gring.cc:1926
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
poly ksCreateShortSpoly(poly p1, poly p2, ring tailRing)
Definition: kspoly.cc:563
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
polyset S
Definition: kutil.h:304
#define nDelete(n)
Definition: numbers.h:16
int cp
Definition: kutil.h:349
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
#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:390
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
BOOLEAN enterOneStrongPoly ( int  i,
poly  p,
int  ,
int  ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1398 of file kutil.cc.

1399 {
1400  number d, s, t;
1401  assume(i<=strat->sl);
1402  assume(atR >= 0);
1403  poly m1, m2, gcd;
1404 
1405  d = n_ExtGcd(pGetCoeff(p), pGetCoeff(strat->S[i]), &s, &t, currRing->cf);
1406 
1407  if (nIsZero(s) || nIsZero(t)) // evtl. durch divBy tests ersetzen
1408  {
1409  nDelete(&d);
1410  nDelete(&s);
1411  nDelete(&t);
1412  return FALSE;
1413  }
1414 
1415  k_GetStrongLeadTerms(p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1416  //p_Test(m1,strat->tailRing);
1417  //p_Test(m2,strat->tailRing);
1418  while (! kCheckStrongCreation(atR, m1, i, m2, strat) )
1419  {
1420  memset(&(strat->P), 0, sizeof(strat->P));
1421  kStratChangeTailRing(strat);
1422  strat->P = *(strat->R[atR]);
1423  p_LmFree(m1, strat->tailRing);
1424  p_LmFree(m2, strat->tailRing);
1425  p_LmFree(gcd, currRing);
1426  k_GetStrongLeadTerms(p, strat->S[i], currRing, m1, m2, gcd, strat->tailRing);
1427  }
1428  pSetCoeff0(m1, s);
1429  pSetCoeff0(m2, t);
1430  pSetCoeff0(gcd, d);
1431  p_Test(m1,strat->tailRing);
1432  p_Test(m2,strat->tailRing);
1433 
1434 #ifdef KDEBUG
1435  if (TEST_OPT_DEBUG)
1436  {
1437  // Print("t = %d; s = %d; d = %d\n", nInt(t), nInt(s), nInt(d));
1438  PrintS("m1 = ");
1439  p_wrp(m1, strat->tailRing);
1440  PrintS(" ; m2 = ");
1441  p_wrp(m2, strat->tailRing);
1442  PrintS(" ; gcd = ");
1443  wrp(gcd);
1444  PrintS("\n--- create strong gcd poly: ");
1445  Print("\n p: %d", i);
1446  wrp(p);
1447  Print("\n strat->S[%d]: ", i);
1448  wrp(strat->S[i]);
1449  PrintS(" ---> ");
1450  }
1451 #endif
1452 
1453  pNext(gcd) = p_Add_q(pp_Mult_mm(pNext(p), m1, strat->tailRing), pp_Mult_mm(pNext(strat->S[i]), m2, strat->tailRing), strat->tailRing);
1454  p_LmDelete(m1, strat->tailRing);
1455  p_LmDelete(m2, strat->tailRing);
1456 
1457 #ifdef KDEBUG
1458  if (TEST_OPT_DEBUG)
1459  {
1460  wrp(gcd);
1461  PrintLn();
1462  }
1463 #endif
1464 
1465  LObject h;
1466  h.p = gcd;
1467  h.tailRing = strat->tailRing;
1468  int posx;
1469  h.pCleardenom();
1470  strat->initEcart(&h);
1471  if (strat->Ll==-1)
1472  posx =0;
1473  else
1474  posx = strat->posInL(strat->L,strat->Ll,&h,strat);
1475  h.sev = pGetShortExpVector(h.p);
1476  if (currRing!=strat->tailRing)
1477  {
1478  if (h.t_p==NULL) /* may already been set by pLdeg() in initEcart */
1479  h.t_p = k_LmInit_currRing_2_tailRing(h.p, strat->tailRing);
1480  }
1481  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,posx);
1482  return TRUE;
1483 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
const CanonicalForm int s
Definition: facAbsFact.cc:55
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:962
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
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 void p_LmFree(poly p, ring)
Definition: p_polys.h:679
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
TObject ** R
Definition: kutil.h:340
polyset S
Definition: kutil.h:304
#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:690
LSet L
Definition: kutil.h:325
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int gcd(int a, int b)
Definition: walkSupport.cc:839
#define pNext(p)
Definition: monomials.h:43
BOOLEAN kCheckStrongCreation(int atR, poly m1, int atS, poly m2, kStrategy strat)
Definition: kutil.cc:8214
#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:1007
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
void wrp(poly p)
Definition: polys.h:281
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
static Poly * h
Definition: janet.cc:978
void enterOneZeroPairRing ( poly  f,
poly  t_p,
poly  p,
int  ecart,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3071 of file kutil.cc.

3072 {
3073  int l,j,compare,compareCoeff;
3074  LObject Lp;
3075 
3076  if (strat->interred_flag) return;
3077 #ifdef KDEBUG
3078  Lp.ecart=0; Lp.length=0;
3079 #endif
3080  /*- computes the lcm(s[i],p) -*/
3081  Lp.lcm = pInit();
3082 
3083  pLcm(p,f,Lp.lcm);
3084  pSetm(Lp.lcm);
3085  pSetCoeff(Lp.lcm, nLcm(pGetCoeff(p), pGetCoeff(f), currRing));
3086  assume(!strat->sugarCrit);
3087  assume(!strat->fromT);
3088  /*
3089  *the set B collects the pairs of type (S[j],p)
3090  *suppose (r,p) is in B and (s,p) is the new pair and lcm(s,p) != lcm(r,p)
3091  *if the leading term of s devides lcm(r,p) then (r,p) will be canceled
3092  *if the leading term of r devides lcm(s,p) then (s,p) will not enter B
3093  */
3094  for(j = strat->Bl;j>=0;j--)
3095  {
3096  compare=pDivCompRing(strat->B[j].lcm,Lp.lcm);
3097  compareCoeff = nDivComp(pGetCoeff(strat->B[j].lcm), pGetCoeff(Lp.lcm));
3098  if (compareCoeff == 0 || compare == compareCoeff)
3099  {
3100  if (compare == 1)
3101  {
3102  strat->c3++;
3103  pLmDelete(Lp.lcm);
3104  return;
3105  }
3106  else
3107  if (compare == -1)
3108  {
3109  deleteInL(strat->B,&strat->Bl,j,strat);
3110  strat->c3++;
3111  }
3112  }
3113  if (compare == pDivComp_EQUAL)
3114  {
3115  // Add hint for same LM and direction of LC (later) (TODO Oliver)
3116  if (compareCoeff == 1)
3117  {
3118  strat->c3++;
3119  pLmDelete(Lp.lcm);
3120  return;
3121  }
3122  else
3123  if (compareCoeff == -1)
3124  {
3125  deleteInL(strat->B,&strat->Bl,j,strat);
3126  strat->c3++;
3127  }
3128  }
3129  }
3130  /*
3131  *the pair (S[i],p) enters B if the spoly != 0
3132  */
3133  /*- compute the short s-polynomial -*/
3134  if ((f==NULL) || (p==NULL)) return;
3135  pNorm(p);
3136  {
3137  Lp.p = ksCreateShortSpoly(f, p, strat->tailRing);
3138  }
3139  if (Lp.p == NULL) //deactivated, as we are adding pairs with zeropoly and not from S
3140  {
3141  /*- the case that the s-poly is 0 -*/
3142 // if (strat->pairtest==NULL) initPairtest(strat);
3143 // strat->pairtest[i] = TRUE;/*- hint for spoly(S^[i],p)=0 -*/
3144 // strat->pairtest[strat->sl+1] = TRUE;
3145  /*hint for spoly(S[i],p) == 0 for some i,0 <= i <= sl*/
3146  /*
3147  *suppose we have (s,r),(r,p),(s,p) and spoly(s,p) == 0 and (r,p) is
3148  *still in B (i.e. lcm(r,p) == lcm(s,p) or the leading term of s does not
3149  *devide lcm(r,p)). In the last case (s,r) can be canceled if the leading
3150  *term of p devides the lcm(s,r)
3151  *(this canceling should be done here because
3152  *the case lcm(s,p) == lcm(s,r) is not covered in chainCrit)
3153  *the first case is handeled in chainCrit
3154  */
3155  if (Lp.lcm!=NULL) pLmDelete(Lp.lcm);
3156  }
3157  else
3158  {
3159  /*- the pair (S[i],p) enters B -*/
3160  Lp.p1 = f;
3161  Lp.p2 = p;
3162 
3163  pNext(Lp.p) = strat->tail;
3164 
3165  LObject tmp_h(f, currRing, strat->tailRing);
3166  tmp_h.SetShortExpVector();
3167  strat->initEcart(&tmp_h);
3168  tmp_h.sev = pGetShortExpVector(tmp_h.p);
3169  tmp_h.t_p = t_p;
3170 
3171  enterT(tmp_h, strat, strat->tl + 1);
3172 
3173  if (atR >= 0)
3174  {
3175  Lp.i_r2 = atR;
3176  Lp.i_r1 = strat->tl;
3177  }
3178 
3179  strat->initEcartPair(&Lp,f,p,0/*strat->ecartS[i]*/,ecart); // Attention: TODO: break ecart
3180  l = strat->posInL(strat->B,strat->Bl,&Lp,strat);
3181  enterL(&strat->B, &strat->Bl, &strat->Bmax, Lp, l);
3182  }
3183 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
#define pSetm(p)
Definition: polys.h:241
#define pDivComp_EQUAL
Definition: kutil.cc:132
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
f
Definition: cfModGcd.cc:4022
int c3
Definition: kutil.h:349
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
#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:266
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
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:563
int Bmax
Definition: kutil.h:355
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
poly tail
Definition: kutil.h:334
BOOLEAN sugarCrit
Definition: kutil.h:371
BOOLEAN interred_flag
Definition: kutil.h:378
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
ring tailRing
Definition: kutil.h:343
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
#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:141
#define pSetCoeff(p, n)
deletes old coeff before setting the new one
Definition: polys.h:31
int l
Definition: cfEzgcd.cc:94
void enterpairs ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR 
)

Definition at line 3671 of file kutil.cc.

3672 {
3673  int j=pos;
3674 
3675 #ifdef HAVE_RINGS
3677 #endif
3678 
3679  initenterpairs(h,k,ecart,0,strat, atR);
3680  if ( (!strat->fromT)
3681  && ((strat->syzComp==0)
3682  ||(pGetComp(h)<=strat->syzComp)))
3683  {
3684  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3685  unsigned long h_sev = pGetShortExpVector(h);
3686  loop
3687  {
3688  if (j > k) break;
3689  clearS(h,h_sev, &j,&k,strat);
3690  j++;
3691  }
3692  //Print("end clearS sl=%d\n",strat->sl);
3693  }
3694  // PrintS("end enterpairs\n");
3695 }
int syzComp
Definition: kutil.h:357
loop
Definition: myNF.cc:98
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2751
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:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void enterpairsShift ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 9571 of file kutil.cc.

9572 {
9573  /* h is strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
9574  /* Q: what is exactly the strat->fromT ? A: a local case trick; don't need it yet*/
9575  int j=pos;
9576 
9577 #ifdef HAVE_RINGS
9579 #endif
9580  initenterpairsShift(h,k,ecart,0,strat, atR,uptodeg,lV);
9581  if ( (!strat->fromT)
9582  && ((strat->syzComp==0)
9583  ||(pGetComp(h)<=strat->syzComp)))
9584  {
9585  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
9586  unsigned long h_sev = pGetShortExpVector(h);
9587  loop
9588  {
9589  if (j > k) break;
9590  clearS(h,h_sev, &j,&k,strat);
9591  j++;
9592  }
9593  //Print("end clearS sl=%d\n",strat->sl);
9594  }
9595  // PrintS("end enterpairs\n");
9596 }
int syzComp
Definition: kutil.h:357
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:9605
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void enterpairsSig ( poly  h,
poly  hSig,
int  hFrom,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR 
)

Definition at line 3703 of file kutil.cc.

3704 {
3705 int j=pos;
3706 
3707 #ifdef HAVE_RINGS
3709 #endif
3710 
3711 initenterpairsSig(h,hSig,hFrom,k,ecart,0,strat, atR);
3712 if ( (!strat->fromT)
3713 && ((strat->syzComp==0)
3714  ||(pGetComp(h)<=strat->syzComp)))
3715 {
3716  //Print("start clearS k=%d, pos=%d, sl=%d\n",k,pos,strat->sl);
3717  unsigned long h_sev = pGetShortExpVector(h);
3718  loop
3719  {
3720  if (j > k) break;
3721  clearS(h,h_sev, &j,&k,strat);
3722  j++;
3723  }
3724  //Print("end clearS sl=%d\n",strat->sl);
3725 }
3726 // PrintS("end enterpairs\n");
3727 }
int syzComp
Definition: kutil.h:357
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:2820
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:12
BOOLEAN fromT
Definition: kutil.h:373
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
static Poly * h
Definition: janet.cc:978
void enterpairsSpecial ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3733 of file kutil.cc.

3734 {
3735  int j;
3736  const int iCompH = pGetComp(h);
3737 
3738 #ifdef HAVE_RINGS
3739  if (rField_is_Ring(currRing))
3740  {
3741  for (j=0; j<=k; j++)
3742  {
3743  const int iCompSj = pGetComp(strat->S[j]);
3744  if ((iCompH==iCompSj)
3745  //|| (0==iCompH) // can only happen,if iCompSj==0
3746  || (0==iCompSj))
3747  {
3748  enterOnePairRing(j,h,ecart,FALSE,strat, atR);
3749  }
3750  }
3751  kMergeBintoL(strat);
3752  }
3753  else
3754 #endif
3755  for (j=0; j<=k; j++)
3756  {
3757  const int iCompSj = pGetComp(strat->S[j]);
3758  if ((iCompH==iCompSj)
3759  //|| (0==iCompH) // can only happen,if iCompSj==0
3760  || (0==iCompSj))
3761  {
3762  enterOnePairSpecial(j,h,ecart,strat, atR);
3763  }
3764  }
3765 
3766  if (strat->noClearS) return;
3767 
3768 // #ifdef HAVE_PLURAL
3769 /*
3770  if (rIsPluralRing(currRing))
3771  {
3772  j=pos;
3773  loop
3774  {
3775  if (j > k) break;
3776 
3777  if (pLmDivisibleBy(h, strat->S[j]))
3778  {
3779  deleteInS(j, strat);
3780  j--;
3781  k--;
3782  }
3783 
3784  j++;
3785  }
3786  }
3787  else
3788 */
3789 // #endif // ??? Why was the following cancelation disabled for non-commutative rings?
3790  {
3791  j=pos;
3792  loop
3793  {
3794  unsigned long h_sev = pGetShortExpVector(h);
3795  if (j > k) break;
3796  clearS(h,h_sev,&j,&k,strat);
3797  j++;
3798  }
3799  }
3800 }
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
char noClearS
Definition: kutil.h:397
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:12
int j
Definition: myNF.cc:70
void enterOnePairSpecial(int i, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:2055
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
polyset S
Definition: kutil.h:304
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1167
KINLINE void clearS(poly p, unsigned long p_sev, int *at, int *k, kStrategy strat)
Definition: kInline.h:1145
void kMergeBintoL(kStrategy strat)
Definition: kutil.cc:2140
static Poly * h
Definition: janet.cc:978
void enterSBba ( LObject  p,
int  atS,
kStrategy  strat,
int  atR 
)

Definition at line 6927 of file kutil.cc.

6928 {
6929  strat->news = TRUE;
6930  /*- puts p to the standardbasis s at position at -*/
6931  if (strat->sl == IDELEMS(strat->Shdl)-1)
6932  {
6933  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
6934  IDELEMS(strat->Shdl)*sizeof(unsigned long),
6935  (IDELEMS(strat->Shdl)+setmaxTinc)
6936  *sizeof(unsigned long));
6937  strat->ecartS = (intset)omReallocSize(strat->ecartS,
6938  IDELEMS(strat->Shdl)*sizeof(int),
6939  (IDELEMS(strat->Shdl)+setmaxTinc)
6940  *sizeof(int));
6941  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
6942  IDELEMS(strat->Shdl)*sizeof(int),
6943  (IDELEMS(strat->Shdl)+setmaxTinc)
6944  *sizeof(int));
6945  if (strat->lenS!=NULL)
6946  strat->lenS=(int*)omRealloc0Size(strat->lenS,
6947  IDELEMS(strat->Shdl)*sizeof(int),
6948  (IDELEMS(strat->Shdl)+setmaxTinc)
6949  *sizeof(int));
6950  if (strat->lenSw!=NULL)
6951  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
6952  IDELEMS(strat->Shdl)*sizeof(wlen_type),
6953  (IDELEMS(strat->Shdl)+setmaxTinc)
6954  *sizeof(wlen_type));
6955  if (strat->fromQ!=NULL)
6956  {
6957  strat->fromQ = (intset)omReallocSize(strat->fromQ,
6958  IDELEMS(strat->Shdl)*sizeof(int),
6959  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
6960  }
6961  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
6962  IDELEMS(strat->Shdl)+=setmaxTinc;
6963  strat->Shdl->m=strat->S;
6964  }
6965  if (atS <= strat->sl)
6966  {
6967 #ifdef ENTER_USE_MEMMOVE
6968 // #if 0
6969  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
6970  (strat->sl - atS + 1)*sizeof(poly));
6971  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
6972  (strat->sl - atS + 1)*sizeof(int));
6973  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
6974  (strat->sl - atS + 1)*sizeof(unsigned long));
6975  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
6976  (strat->sl - atS + 1)*sizeof(int));
6977  if (strat->lenS!=NULL)
6978  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
6979  (strat->sl - atS + 1)*sizeof(int));
6980  if (strat->lenSw!=NULL)
6981  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
6982  (strat->sl - atS + 1)*sizeof(wlen_type));
6983 #else
6984  for (i=strat->sl+1; i>=atS+1; i--)
6985  {
6986  strat->S[i] = strat->S[i-1];
6987  strat->ecartS[i] = strat->ecartS[i-1];
6988  strat->sevS[i] = strat->sevS[i-1];
6989  strat->S_2_R[i] = strat->S_2_R[i-1];
6990  }
6991  if (strat->lenS!=NULL)
6992  for (i=strat->sl+1; i>=atS+1; i--)
6993  strat->lenS[i] = strat->lenS[i-1];
6994  if (strat->lenSw!=NULL)
6995  for (i=strat->sl+1; i>=atS+1; i--)
6996  strat->lenSw[i] = strat->lenSw[i-1];
6997 #endif
6998  }
6999  if (strat->fromQ!=NULL)
7000  {
7001 #ifdef ENTER_USE_MEMMOVE
7002  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7003  (strat->sl - atS + 1)*sizeof(int));
7004 #else
7005  for (i=strat->sl+1; i>=atS+1; i--)
7006  {
7007  strat->fromQ[i] = strat->fromQ[i-1];
7008  }
7009 #endif
7010  strat->fromQ[atS]=0;
7011  }
7012 
7013  /*- save result -*/
7014  strat->S[atS] = p.p;
7015  if (strat->honey) strat->ecartS[atS] = p.ecart;
7016  if (p.sev == 0)
7017  p.sev = pGetShortExpVector(p.p);
7018  else
7019  assume(p.sev == pGetShortExpVector(p.p));
7020  strat->sevS[atS] = p.sev;
7021  strat->ecartS[atS] = p.ecart;
7022  strat->S_2_R[atS] = atR;
7023  strat->sl++;
7024 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:371
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:395
#define TRUE
Definition: auxiliary.h:144
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
int * intset
Definition: kutil.h:53
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void enterSMora ( LObject  p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1215 of file kstd1.cc.

1216 {
1217  enterSBba(p, atS, strat, atR);
1218  #ifdef KDEBUG
1219  if (TEST_OPT_DEBUG)
1220  {
1221  Print("new s%d:",atS);
1222  p_wrp(p.p,currRing,strat->tailRing);
1223  PrintLn();
1224  }
1225  #endif
1226  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1227  if (strat->kHEdgeFound)
1228  {
1229  if (newHEdge(strat))
1230  {
1231  firstUpdate(strat);
1232  if (TEST_OPT_FINDET)
1233  return;
1234 
1235  /*- cuts elements in L above noether and reorders L -*/
1236  updateLHC(strat);
1237  /*- reorders L with respect to posInL -*/
1238  reorderL(strat);
1239  }
1240  }
1241  else if (strat->kNoether!=NULL)
1242  strat->kHEdgeFound = TRUE;
1243  else if (TEST_OPT_FASTHC)
1244  {
1245  if (strat->posInLOldFlag)
1246  {
1247  missingAxis(&strat->lastAxis,strat);
1248  if (strat->lastAxis)
1249  {
1250  strat->posInLOld = strat->posInL;
1251  strat->posInLOldFlag = FALSE;
1252  strat->posInL = posInL10;
1253  strat->posInLDependsOnLength = TRUE;
1254  updateL(strat);
1255  reorderL(strat);
1256  }
1257  }
1258  else if (strat->lastAxis)
1259  updateL(strat);
1260  }
1261 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
poly kNoether
Definition: kutil.h:328
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_DEBUG
Definition: options.h:103
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:422
void updateL(kStrategy strat)
Definition: kstd1.cc:980
int lastAxis
Definition: kutil.h:359
#define TEST_OPT_FINDET
Definition: options.h:106
void missingAxis(int *last, kStrategy strat)
Definition: kstd1.cc:866
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void updateLHC(kStrategy strat)
Definition: kstd1.cc:1054
void reorderL(kStrategy strat)
Definition: kstd1.cc:808
int(* posInLOld)(const LSet Ls, const int Ll, LObject *Lo, const kStrategy strat)
Definition: kutil.h:287
BOOLEAN kHEdgeFound
Definition: kutil.h:370
#define NULL
Definition: omList.c:10
void firstUpdate(kStrategy strat)
Definition: kstd1.cc:1138
ring tailRing
Definition: kutil.h:343
BOOLEAN posInLOldFlag
Definition: kutil.h:376
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8113
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
#define TEST_OPT_FASTHC
Definition: options.h:104
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:947
void enterSMoraNF ( LObject  p,
int  atS,
kStrategy  strat,
int  atR = -1 
)

Definition at line 1269 of file kstd1.cc.

1270 {
1271  enterSBba(p, atS, strat, atR);
1272  if ((!strat->kHEdgeFound) || (strat->kNoether!=NULL)) HEckeTest(p.p,strat);
1273  if (strat->kHEdgeFound)
1274  newHEdge(strat);
1275  else if (strat->kNoether!=NULL)
1276  strat->kHEdgeFound = TRUE;
1277 }
return P p
Definition: myNF.cc:203
poly kNoether
Definition: kutil.h:328
#define TRUE
Definition: auxiliary.h:144
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:422
BOOLEAN kHEdgeFound
Definition: kutil.h:370
#define NULL
Definition: omList.c:10
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8113
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
void enterSSba ( LObject  p,
int  atS,
kStrategy  strat,
int  atR 
)

Definition at line 7030 of file kutil.cc.

7031 {
7032  strat->news = TRUE;
7033  /*- puts p to the standardbasis s at position at -*/
7034  if (strat->sl == IDELEMS(strat->Shdl)-1)
7035  {
7036  strat->sevS = (unsigned long*) omRealloc0Size(strat->sevS,
7037  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7038  (IDELEMS(strat->Shdl)+setmaxTinc)
7039  *sizeof(unsigned long));
7040  strat->sevSig = (unsigned long*) omRealloc0Size(strat->sevSig,
7041  IDELEMS(strat->Shdl)*sizeof(unsigned long),
7042  (IDELEMS(strat->Shdl)+setmaxTinc)
7043  *sizeof(unsigned long));
7044  strat->ecartS = (intset)omReallocSize(strat->ecartS,
7045  IDELEMS(strat->Shdl)*sizeof(int),
7046  (IDELEMS(strat->Shdl)+setmaxTinc)
7047  *sizeof(int));
7048  strat->S_2_R = (int*) omRealloc0Size(strat->S_2_R,
7049  IDELEMS(strat->Shdl)*sizeof(int),
7050  (IDELEMS(strat->Shdl)+setmaxTinc)
7051  *sizeof(int));
7052  if (strat->lenS!=NULL)
7053  strat->lenS=(int*)omRealloc0Size(strat->lenS,
7054  IDELEMS(strat->Shdl)*sizeof(int),
7055  (IDELEMS(strat->Shdl)+setmaxTinc)
7056  *sizeof(int));
7057  if (strat->lenSw!=NULL)
7058  strat->lenSw=(wlen_type*)omRealloc0Size(strat->lenSw,
7059  IDELEMS(strat->Shdl)*sizeof(wlen_type),
7060  (IDELEMS(strat->Shdl)+setmaxTinc)
7061  *sizeof(wlen_type));
7062  if (strat->fromQ!=NULL)
7063  {
7064  strat->fromQ = (intset)omReallocSize(strat->fromQ,
7065  IDELEMS(strat->Shdl)*sizeof(int),
7066  (IDELEMS(strat->Shdl)+setmaxTinc)*sizeof(int));
7067  }
7068  pEnlargeSet(&strat->S,IDELEMS(strat->Shdl),setmaxTinc);
7069  pEnlargeSet(&strat->sig,IDELEMS(strat->Shdl),setmaxTinc);
7070  IDELEMS(strat->Shdl)+=setmaxTinc;
7071  strat->Shdl->m=strat->S;
7072  }
7073  // in a signature-based algorithm the following situation will never
7074  // appear due to the fact that the critical pairs are already sorted
7075  // by increasing signature.
7076  if (atS <= strat->sl)
7077  {
7078 #ifdef ENTER_USE_MEMMOVE
7079 // #if 0
7080  memmove(&(strat->S[atS+1]), &(strat->S[atS]),
7081  (strat->sl - atS + 1)*sizeof(poly));
7082  memmove(&(strat->ecartS[atS+1]), &(strat->ecartS[atS]),
7083  (strat->sl - atS + 1)*sizeof(int));
7084  memmove(&(strat->sevS[atS+1]), &(strat->sevS[atS]),
7085  (strat->sl - atS + 1)*sizeof(unsigned long));
7086  memmove(&(strat->S_2_R[atS+1]), &(strat->S_2_R[atS]),
7087  (strat->sl - atS + 1)*sizeof(int));
7088  if (strat->lenS!=NULL)
7089  memmove(&(strat->lenS[atS+1]), &(strat->lenS[atS]),
7090  (strat->sl - atS + 1)*sizeof(int));
7091  if (strat->lenSw!=NULL)
7092  memmove(&(strat->lenSw[atS+1]), &(strat->lenSw[atS]),
7093  (strat->sl - atS + 1)*sizeof(wlen_type));
7094 #else
7095  for (i=strat->sl+1; i>=atS+1; i--)
7096  {
7097  strat->S[i] = strat->S[i-1];
7098  strat->ecartS[i] = strat->ecartS[i-1];
7099  strat->sevS[i] = strat->sevS[i-1];
7100  strat->S_2_R[i] = strat->S_2_R[i-1];
7101  }
7102  if (strat->lenS!=NULL)
7103  for (i=strat->sl+1; i>=atS+1; i--)
7104  strat->lenS[i] = strat->lenS[i-1];
7105  if (strat->lenSw!=NULL)
7106  for (i=strat->sl+1; i>=atS+1; i--)
7107  strat->lenSw[i] = strat->lenSw[i-1];
7108 #endif
7109  }
7110  if (strat->fromQ!=NULL)
7111  {
7112 #ifdef ENTER_USE_MEMMOVE
7113  memmove(&(strat->fromQ[atS+1]), &(strat->fromQ[atS]),
7114  (strat->sl - atS + 1)*sizeof(int));
7115 #else
7116  for (i=strat->sl+1; i>=atS+1; i--)
7117  {
7118  strat->fromQ[i] = strat->fromQ[i-1];
7119  }
7120 #endif
7121  strat->fromQ[atS]=0;
7122  }
7123 
7124  /*- save result -*/
7125  strat->S[atS] = p.p;
7126  strat->sig[atS] = p.sig; // TODO: get ths correct signature in here!
7127  if (strat->honey) strat->ecartS[atS] = p.ecart;
7128  if (p.sev == 0)
7129  p.sev = pGetShortExpVector(p.p);
7130  else
7131  assume(p.sev == pGetShortExpVector(p.p));
7132  strat->sevS[atS] = p.sev;
7133  // during the interreduction process of a signature-based algorithm we do not
7134  // compute the signature at this point, but when the whole interreduction
7135  // process finishes, i.e. f5c terminates!
7136  if (p.sig != NULL)
7137  {
7138  if (p.sevSig == 0)
7139  p.sevSig = pGetShortExpVector(p.sig);
7140  else
7141  assume(p.sevSig == pGetShortExpVector(p.sig));
7142  strat->sevSig[atS] = p.sevSig; // TODO: get the correct signature in here!
7143  }
7144  strat->ecartS[atS] = p.ecart;
7145  strat->S_2_R[atS] = atR;
7146  strat->sl++;
7147 #ifdef DEBUGF5
7148  int k;
7149  Print("--- LIST S: %d ---\n",strat->sl);
7150  for(k=0;k<=strat->sl;k++)
7151  {
7152  pWrite(strat->sig[k]);
7153  }
7154  Print("--- LIST S END ---\n");
7155 #endif
7156 }
unsigned long * sevSig
Definition: kutil.h:322
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
polyset sig
Definition: kutil.h:306
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
BOOLEAN honey
Definition: kutil.h:371
#define Print
Definition: emacs.cc:83
wlen_set lenSw
Definition: kutil.h:318
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
char news
Definition: kutil.h:395
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset lenS
Definition: kutil.h:317
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
int64 wlen_type
Definition: kutil.h:54
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
int * intset
Definition: kutil.h:53
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void enterSyz ( LObject  p,
kStrategy  strat,
int  atT 
)

Definition at line 7240 of file kutil.cc.

7241 {
7242  int i;
7243  strat->newt = TRUE;
7244  if (strat->syzl == strat->syzmax-1)
7245  {
7246  pEnlargeSet(&strat->syz,strat->syzmax,setmaxTinc);
7247  strat->sevSyz = (unsigned long*) omRealloc0Size(strat->sevSyz,
7248  (strat->syzmax)*sizeof(unsigned long),
7249  ((strat->syzmax)+setmaxTinc)
7250  *sizeof(unsigned long));
7251  strat->syzmax += setmaxTinc;
7252  }
7253  if (atT < strat->syzl)
7254  {
7255 #ifdef ENTER_USE_MEMMOVE
7256  memmove(&(strat->syz[atT+1]), &(strat->syz[atT]),
7257  (strat->syzl-atT+1)*sizeof(poly));
7258  memmove(&(strat->sevSyz[atT+1]), &(strat->sevSyz[atT]),
7259  (strat->syzl-atT+1)*sizeof(unsigned long));
7260 #endif
7261  for (i=strat->syzl; i>=atT+1; i--)
7262  {
7263 #ifndef ENTER_USE_MEMMOVE
7264  strat->syz[i] = strat->syz[i-1];
7265  strat->sevSyz[i] = strat->sevSyz[i-1];
7266 #endif
7267  }
7268  }
7269  //i = strat->syzl;
7270  i = atT;
7271  strat->syz[atT] = p.sig;
7272  strat->sevSyz[atT] = p.sevSig;
7273  strat->syzl++;
7274 #if F5DEBUG
7275  Print("element in strat->syz: %d--%d ",atT+1,strat->syzmax);
7276  pWrite(strat->syz[atT]);
7277 #endif
7278  // recheck pairs in strat->L with new rule and delete correspondingly
7279  int cc = strat->Ll;
7280  while (cc>-1)
7281  {
7282  if (p_LmShortDivisibleBy( strat->syz[atT], strat->sevSyz[atT],
7283  strat->L[cc].sig, ~strat->L[cc].sevSig, currRing))
7284  {
7285  deleteInL(strat->L,&strat->Ll,cc,strat);
7286  }
7287  cc--;
7288  }
7289 //#if 1
7290 #ifdef DEBUGF5
7291  PrintS("--- Syzygies ---\n");
7292  Print("syzl %d\n",strat->syzl);
7293  Print("syzmax %d\n",strat->syzmax);
7294  PrintS("--------------------------------\n");
7295  for(i=0;i<=strat->syzl-1;i++)
7296  {
7297  Print("%d - ",i);
7298  pWrite(strat->syz[i]);
7299  }
7300  PrintS("--------------------------------\n");
7301 #endif
7302 }
#define omRealloc0Size(addr, o_size, size)
Definition: omAllocDecl.h:221
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:352
int Ll
Definition: kutil.h:354
return P p
Definition: myNF.cc:203
char newt
Definition: kutil.h:396
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h: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:1707
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
void pEnlargeSet(poly **p, int l, int increment)
Definition: p_polys.cc:3511
unsigned long * sevSyz
Definition: kutil.h:321
#define setmaxTinc
Definition: kutil.h:31
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
void enterT ( LObject  p,
kStrategy  strat,
int  atT 
)

Definition at line 7161 of file kutil.cc.

7162 {
7163  int i;
7164 
7165  pp_Test(p.p, currRing, p.tailRing);
7166  assume(strat->tailRing == p.tailRing);
7167  // redMoraNF complains about this -- but, we don't really
7168  // neeed this so far
7169  assume(p.pLength == 0 || pLength(p.p) == p.pLength || rIsSyzIndexRing(currRing)); // modulo syzring
7170  assume(p.FDeg == p.pFDeg());
7171  assume(!p.is_normalized || nIsOne(pGetCoeff(p.p)));
7172 
7173 #ifdef KDEBUG
7174  // do not put an LObject twice into T:
7175  for(i=strat->tl;i>=0;i--)
7176  {
7177  if (p.p==strat->T[i].p)
7178  {
7179  printf("already in T at pos %d of %d, atT=%d\n",i,strat->tl,atT);
7180  return;
7181  }
7182  }
7183 #endif
7184 #ifdef HAVE_TAIL_RING
7185  if (currRing!=strat->tailRing)
7186  {
7187  p.t_p=p.GetLmTailRing();
7188  }
7189 #endif
7190  strat->newt = TRUE;
7191  if (atT < 0)
7192  atT = strat->posInT(strat->T, strat->tl, p);
7193  if (strat->tl == strat->tmax-1)
7194  enlargeT(strat->T,strat->R,strat->sevT,strat->tmax,setmaxTinc);
7195  if (atT <= strat->tl)
7196  {
7197 #ifdef ENTER_USE_MEMMOVE
7198  memmove(&(strat->T[atT+1]), &(strat->T[atT]),
7199  (strat->tl-atT+1)*sizeof(TObject));
7200  memmove(&(strat->sevT[atT+1]), &(strat->sevT[atT]),
7201  (strat->tl-atT+1)*sizeof(unsigned long));
7202 #endif
7203  for (i=strat->tl+1; i>=atT+1; i--)
7204  {
7205 #ifndef ENTER_USE_MEMMOVE
7206  strat->T[i] = strat->T[i-1];
7207  strat->sevT[i] = strat->sevT[i-1];
7208 #endif
7209  strat->R[strat->T[i].i_r] = &(strat->T[i]);
7210  }
7211  }
7212 
7213  if ((strat->tailBin != NULL) && (pNext(p.p) != NULL))
7214  {
7216  (strat->tailRing != NULL ?
7217  strat->tailRing : currRing),
7218  strat->tailBin);
7219  if (p.t_p != NULL) pNext(p.t_p) = pNext(p.p);
7220  }
7221  strat->T[atT] = (TObject) p;
7222 
7223  if (strat->tailRing != currRing && pNext(p.p) != NULL)
7224  strat->T[atT].max = p_GetMaxExpP(pNext(p.p), strat->tailRing);
7225  else
7226  strat->T[atT].max = NULL;
7227 
7228  strat->tl++;
7229  strat->R[strat->tl] = &(strat->T[atT]);
7230  strat->T[atT].i_r = strat->tl;
7231  assume(p.sev == 0 || pGetShortExpVector(p.p) == p.sev);
7232  strat->sevT[atT] = (p.sev == 0 ? pGetShortExpVector(p.p) : p.sev);
7233  kTest_T(&(strat->T[atT]));
7234 }
return P p
Definition: myNF.cc:203
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:705
char newt
Definition: kutil.h:396
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:280
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:12
static void enlargeT(TSet &T, TObject **&R, unsigned long *&sevT, int &length, const int incr)
Definition: kutil.cc:470
#define assume(x)
Definition: mod2.h:405
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#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:876
int i
Definition: cfEzgcd.cc:123
TObject ** R
Definition: kutil.h:340
int tmax
Definition: kutil.h:353
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
omBin tailBin
Definition: kutil.h:345
#define pNext(p)
Definition: monomials.h:43
#define setmaxTinc
Definition: kutil.h:31
TSet T
Definition: kutil.h:324
#define kTest_T(T)
Definition: kutil.h:617
class sTObject TObject
Definition: kutil.h:57
poly p_GetMaxExpP(poly p, const ring r)
return monomial r such that GetExp(r,i) is maximum of all monomials in p; coeff == 0...
Definition: p_polys.cc:1137
void enterTShift ( LObject  p,
kStrategy  strat,
int  atT,
int  uptodeg,
int  lV 
)

Definition at line 9678 of file kutil.cc.

9679 {
9680  /* determine how many elements we have to insert */
9681  /* x(0)y(1)z(2) : lastVblock-1=2, to add until lastVblock=uptodeg-1 */
9682  /* hence, a total number of elt's to add is: */
9683  /* int toInsert = 1 + (uptodeg-1) - (pLastVblock(p.p, lV) -1); */
9684 
9685  int toInsert = itoInsert(p.p, uptodeg, lV, strat->tailRing);
9686 
9687 #ifdef PDEBUG
9688  // Print("enterTShift uses toInsert: %d", toInsert); PrintLn();
9689 #endif
9690  int i;
9691 
9692  if (atT < 0)
9693  atT = strat->posInT(strat->T, strat->tl, p);
9694 
9695  /* can call enterT in a sequence, e.g. */
9696 
9697  /* shift0 = it's our model for further shifts */
9698  enterT(p,strat,atT);
9699  LObject qq;
9700  for (i=1; i<=toInsert; i++) // toIns - 1?
9701  {
9702  qq = p; //qq.Copy();
9703  qq.p = NULL;
9704  qq.max = NULL;
9705  qq.t_p = p_LPshift(p_Copy(p.t_p,strat->tailRing), i, uptodeg, lV, strat->tailRing); // direct shift
9706  qq.GetP();
9707  // update q.sev
9708  qq.sev = pGetShortExpVector(qq.p);
9709  /* enter it into T, first el't is with the shift 0 */
9710  // compute the position for qq
9711  atT = strat->posInT(strat->T, strat->tl, qq);
9712  enterT(qq,strat,atT);
9713  }
9714 /* Q: what to do with this one in the orig enterT ? */
9715 /* strat->R[strat->tl] = &(strat->T[atT]); */
9716 /* Solution: it is done by enterT each time separately */
9717 }
int itoInsert(poly p, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:460
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
poly p_LPshift(poly p, int sh, int uptodeg, int lV, const ring r)
Definition: shiftgb.cc:74
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
TSet T
Definition: kutil.h:324
void exitBuchMora ( kStrategy  strat)

Definition at line 7637 of file kutil.cc.

7638 {
7639  /*- release temp data -*/
7640  cleanT(strat);
7641  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
7642  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
7643  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
7644  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
7645  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
7646  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
7647  /*- set L: should be empty -*/
7648  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
7649  /*- set B: should be empty -*/
7650  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
7651  pLmDelete(&strat->tail);
7652  strat->syzComp=0;
7653 }
int syzComp
Definition: kutil.h:357
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
#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:323
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:355
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
void cleanT(kStrategy strat)
Definition: kutil.cc:491
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
unsigned long * sevS
Definition: kutil.h:320
TSet T
Definition: kutil.h:324
ideal Shdl
Definition: kutil.h:301
class sTObject TObject
Definition: kutil.h:57
void exitSba ( kStrategy  strat)

Definition at line 7830 of file kutil.cc.

7831 {
7832  /*- release temp data -*/
7833  cleanT(strat);
7834  omFreeSize(strat->T,(strat->tmax)*sizeof(TObject));
7835  omFreeSize(strat->R,(strat->tmax)*sizeof(TObject*));
7836  omFreeSize(strat->sevT, (strat->tmax)*sizeof(unsigned long));
7837  omFreeSize(strat->ecartS,IDELEMS(strat->Shdl)*sizeof(int));
7838  omFreeSize((ADDRESS)strat->sevS,IDELEMS(strat->Shdl)*sizeof(unsigned long));
7839  omFreeSize((ADDRESS)strat->sevSig,IDELEMS(strat->Shdl)*sizeof(unsigned long));
7840  omFreeSize((ADDRESS)strat->syz,(strat->syzmax)*sizeof(poly));
7841  omFreeSize((ADDRESS)strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
7842  if (strat->sbaOrder == 1)
7843  {
7844  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
7845  }
7846  omFreeSize(strat->S_2_R,IDELEMS(strat->Shdl)*sizeof(int));
7847  /*- set L: should be empty -*/
7848  omFreeSize(strat->L,(strat->Lmax)*sizeof(LObject));
7849  /*- set B: should be empty -*/
7850  omFreeSize(strat->B,(strat->Bmax)*sizeof(LObject));
7851  /*- set sig: no need for the signatures anymore -*/
7852  omFreeSize(strat->sig,IDELEMS(strat->Shdl)*sizeof(poly));
7853  pLmDelete(&strat->tail);
7854  strat->syzComp=0;
7855 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
int syzComp
Definition: kutil.h:357
int syzmax
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
#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:323
void * ADDRESS
Definition: auxiliary.h:161
int Bmax
Definition: kutil.h:355
polyrec * poly
Definition: hilb.h:10
unsigned sbaOrder
Definition: kutil.h:314
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
intset ecartS
Definition: kutil.h:307
LSet L
Definition: kutil.h:325
void cleanT(kStrategy strat)
Definition: kutil.cc:491
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
int syzidxmax
Definition: kutil.h:352
unsigned long * sevS
Definition: kutil.h:320
unsigned long * sevSyz
Definition: kutil.h:321
polyset syz
Definition: kutil.h:305
TSet T
Definition: kutil.h:324
ideal Shdl
Definition: kutil.h:301
class sTObject TObject
Definition: kutil.h:57
intset syzIdx
Definition: kutil.h:311
BOOLEAN faugereRewCriterion ( poly  sig,
unsigned long  not_sevSig,
poly  ,
kStrategy  strat,
int  start = 0 
)

Definition at line 5145 of file kutil.cc.

5146 {
5147  //printf("Faugere Rewritten Criterion\n");
5148 //#if 1
5149 #ifdef DEBUGF5
5150  PrintS("rewritten criterion checks: ");
5151  pWrite(sig);
5152 #endif
5153  for(int k = strat->sl; k>=start; k--)
5154  {
5155 //#if 1
5156 #ifdef DEBUGF5
5157  Print("checking with: ");
5158  pWrite(strat->sig[k]);
5159  pWrite(pHead(strat->S[k]));
5160 #endif
5161  if (p_LmShortDivisibleBy(strat->sig[k], strat->sevSig[k], sig, not_sevSig, currRing))
5162  {
5163 //#if 1
5164 #ifdef DEBUGF5
5165  PrintS("DELETE!\n");
5166 #endif
5167  return TRUE;
5168  }
5169  //k--;
5170  }
5171 #ifdef DEBUGF5
5172  Print("ALL ELEMENTS OF S\n----------------------------------------\n");
5173  for(int kk = 0; kk<strat->sl+1; kk++)
5174  {
5175  pWrite(pHead(strat->S[kk]));
5176  }
5177  Print("------------------------------\n");
5178 #endif
5179  return FALSE;
5180 }
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
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:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
void PrintS(const char *s)
Definition: reporter.cc:294
#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:304
int sl
Definition: kutil.h:351
int getIndexRng ( long  coeff)
inline

Definition at line 4721 of file kutil.cc.

4722 {
4723  if (coeff == 0) return -1;
4724  long tmp = coeff;
4725  int ind = 0;
4726  while (tmp % 2 == 0)
4727  {
4728  tmp = tmp / 2;
4729  ind++;
4730  }
4731  return ind;
4732 }
void HEckeTest ( poly  pp,
kStrategy  strat 
)

Definition at line 422 of file kutil.cc.

423 {
424  int j,/*k,*/p;
425 
426  strat->kHEdgeFound=FALSE;
427  if (currRing->pLexOrder || currRing->MixedOrder)
428  {
429  return;
430  }
431  if (strat->ak > 1) /*we are in the module case*/
432  {
433  return; // until ....
434  //if (!pVectorOut) /*pVectorOut <=> order = c,* */
435  // return FALSE;
436  //if (pGetComp(pp) < strat->ak) /* ak is the number of the last component */
437  // return FALSE;
438  }
439  // k = 0;
440  p=pIsPurePower(pp);
441  if (p!=0) strat->NotUsedAxis[p] = FALSE;
442  /*- the leading term of pp is a power of the p-th variable -*/
443  for (j=(currRing->N);j>0; j--)
444  {
445  if (strat->NotUsedAxis[j])
446  {
447  return;
448  }
449  }
450  strat->kHEdgeFound=TRUE;
451 }
#define pIsPurePower(p)
Definition: polys.h:219
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
BOOLEAN * NotUsedAxis
Definition: kutil.h:332
#define TRUE
Definition: auxiliary.h:144
int ak
Definition: kutil.h:356
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:12
int j
Definition: myNF.cc:70
BOOLEAN kHEdgeFound
Definition: kutil.h:370
long ind2 ( long  arg)

Definition at line 3036 of file kutil.cc.

3037 {
3038  long ind = 0;
3039  if (arg <= 0) return 0;
3040  while (arg%2 == 0)
3041  {
3042  arg = arg / 2;
3043  ind++;
3044  }
3045  return ind;
3046 }
long ind_fact_2 ( long  arg)

Definition at line 3048 of file kutil.cc.

3049 {
3050  long ind = 0;
3051  if (arg <= 0) return 0;
3052  if (arg%2 == 1) { arg--; }
3053  while (arg > 0)
3054  {
3055  ind += ind2(arg);
3056  arg = arg - 2;
3057  }
3058  return ind;
3059 }
long ind2(long arg)
Definition: kutil.cc:3036
void initBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 7558 of file kutil.cc.

7559 {
7560  strat->interpt = BTEST1(OPT_INTERRUPT);
7561  strat->kHEdge=NULL;
7563  /*- creating temp data structures------------------- -*/
7564  strat->cp = 0;
7565  strat->c3 = 0;
7566  strat->tail = pInit();
7567  /*- set s -*/
7568  strat->sl = -1;
7569  /*- set L -*/
7570  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
7571  strat->Ll = -1;
7572  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
7573  /*- set B -*/
7574  strat->Bmax = setmaxL;
7575  strat->Bl = -1;
7576  strat->B = initL();
7577  /*- set T -*/
7578  strat->tl = -1;
7579  strat->tmax = setmaxT;
7580  strat->T = initT();
7581  strat->R = initR();
7582  strat->sevT = initsevT();
7583  /*- init local data struct.---------------------------------------- -*/
7584  strat->P.ecart=0;
7585  strat->P.length=0;
7587  {
7588  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
7589  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
7590  }
7591  #ifdef HAVE_RINGS
7593  {
7594  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
7595  }
7596  else
7597  #endif
7598  {
7599  if(TEST_OPT_SB_1)
7600  {
7601  int i;
7602  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
7603  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7604  {
7605  P->m[i-strat->newIdeal] = F->m[i];
7606  F->m[i] = NULL;
7607  }
7608  initSSpecial(F,Q,P,strat);
7609  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7610  {
7611  F->m[i] = P->m[i-strat->newIdeal];
7612  P->m[i-strat->newIdeal] = NULL;
7613  }
7614  idDelete(&P);
7615  }
7616 
7617  else
7618  {
7619  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
7620  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
7621  }
7622  }
7623  strat->fromT = FALSE;
7625  if ((!TEST_OPT_SB_1)
7626  #ifdef HAVE_RINGS
7627  || (rField_is_Ring(currRing))
7628  #endif
7629  )
7630  {
7631  updateS(TRUE,strat);
7632  }
7633  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
7634  strat->fromQ=NULL;
7635 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:27
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:327
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5836
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
unsigned long * sevT
Definition: kutil.h:323
int ak
Definition: kutil.h:356
#define setmaxLinc
Definition: kutil.h:28
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:355
BOOLEAN interpt
Definition: kutil.h:365
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6236
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
int cp
Definition: kutil.h:349
BOOLEAN kHEdgeFound
Definition: kutil.h:370
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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:6695
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:416
int newIdeal
Definition: kutil.h:360
ideal Shdl
Definition: kutil.h:301
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
void initBuchMoraCrit ( kStrategy  strat)

Definition at line 7325 of file kutil.cc.

7326 {
7328  strat->chainCrit=chainCritNormal;
7329 #ifdef HAVE_RINGS
7330  if (rField_is_Ring(currRing))
7331  {
7333  strat->chainCrit=chainCritRing;
7334  }
7335 #endif
7336 #ifdef HAVE_RATGRING
7337  if (rIsRatGRing(currRing))
7338  {
7339  strat->chainCrit=chainCritPart;
7340  /* enterOnePairNormal get rational part in it */
7341  }
7342 #endif
7343 
7344  strat->sugarCrit = TEST_OPT_SUGARCRIT;
7345  strat->Gebauer = strat->homog || strat->sugarCrit;
7346  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
7347  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
7348  strat->pairtest = NULL;
7349  /* alway use tailreduction, except:
7350  * - in local rings, - in lex order case, -in ring over extensions */
7352 
7353 #ifdef HAVE_PLURAL
7354  // and r is plural_ring
7355  // hence this holds for r a rational_plural_ring
7356  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
7357  { //or it has non-quasi-comm type... later
7358  strat->sugarCrit = FALSE;
7359  strat->Gebauer = FALSE;
7360  strat->honey = FALSE;
7361  }
7362 #endif
7363 
7364 #ifdef HAVE_RINGS
7365  // Coefficient ring?
7366  if (rField_is_Ring(currRing))
7367  {
7368  strat->sugarCrit = FALSE;
7369  strat->Gebauer = FALSE ;
7370  strat->honey = FALSE;
7371  }
7372 #endif
7373  #ifdef KDEBUG
7374  if (TEST_OPT_DEBUG)
7375  {
7376  if (strat->homog) PrintS("ideal/module is homogeneous\n");
7377  else PrintS("ideal/module is not homogeneous\n");
7378  }
7379  #endif
7380 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
void chainCritNormal(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2186
BOOLEAN * pairtest
Definition: kutil.h:333
BOOLEAN z2homog
Definition: kutil.h:368
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1490
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:289
BOOLEAN homog
Definition: kutil.h:366
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:2885
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:372
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:371
#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:290
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1167
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2460
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
void initBuchMoraPos ( kStrategy  strat)

Definition at line 7466 of file kutil.cc.

7467 {
7469  {
7470  if (strat->honey)
7471  {
7472  strat->posInL = posInL15;
7473  // ok -- here is the deal: from my experiments for Singular-2-0
7474  // I conclude that that posInT_EcartpLength is the best of
7475  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
7476  // see the table at the end of this file
7477  if (TEST_OPT_OLDSTD)
7478  strat->posInT = posInT15;
7479  else
7480  strat->posInT = posInT_EcartpLength;
7481  }
7482  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
7483  {
7484  strat->posInL = posInL11;
7485  strat->posInT = posInT11;
7486  }
7487  else if (TEST_OPT_INTSTRATEGY)
7488  {
7489  strat->posInL = posInL11;
7490  strat->posInT = posInT11;
7491  }
7492  else
7493  {
7494  strat->posInL = posInL0;
7495  strat->posInT = posInT0;
7496  }
7497  //if (strat->minim>0) strat->posInL =posInLSpecial;
7498  if (strat->homog)
7499  {
7500  strat->posInL = posInL110;
7501  strat->posInT = posInT110;
7502  }
7503  }
7504  else
7505  {
7506  if (strat->homog)
7507  {
7508  strat->posInL = posInL11;
7509  strat->posInT = posInT11;
7510  }
7511  else
7512  {
7513  if ((currRing->order[0]==ringorder_c)
7514  ||(currRing->order[0]==ringorder_C))
7515  {
7516  strat->posInL = posInL17_c;
7517  strat->posInT = posInT17_c;
7518  }
7519  else
7520  {
7521  strat->posInL = posInL17;
7522  strat->posInT = posInT17;
7523  }
7524  }
7525  }
7526  if (strat->minim>0) strat->posInL =posInLSpecial;
7527  // for further tests only
7528  if ((BTEST1(11)) || (BTEST1(12)))
7529  strat->posInL = posInL11;
7530  else if ((BTEST1(13)) || (BTEST1(14)))
7531  strat->posInL = posInL13;
7532  else if ((BTEST1(15)) || (BTEST1(16)))
7533  strat->posInL = posInL15;
7534  else if ((BTEST1(17)) || (BTEST1(18)))
7535  strat->posInL = posInL17;
7536  if (BTEST1(11))
7537  strat->posInT = posInT11;
7538  else if (BTEST1(13))
7539  strat->posInT = posInT13;
7540  else if (BTEST1(15))
7541  strat->posInT = posInT15;
7542  else if ((BTEST1(17)))
7543  strat->posInT = posInT17;
7544  else if ((BTEST1(19)))
7545  strat->posInT = posInT19;
7546  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
7547  strat->posInT = posInT1;
7548 #ifdef HAVE_RINGS
7549  if (rField_is_Ring(currRing))
7550  {
7551  strat->posInL = posInL11;
7552  strat->posInT = posInT11;
7553  }
7554 #endif
7556 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
#define BTEST1(a)
Definition: options.h:32
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4281
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int minim
Definition: kutil.h:361
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
BOOLEAN kPosInLDependsOnLength(int(*pos_in_l)(const LSet set, const int length, LObject *L, const kStrategy strat))
Definition: kutil.cc:7455
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
BOOLEAN homog
Definition: kutil.h:366
#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:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4339
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
void initBuchMoraShift ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 9049 of file kutil.cc.

9050 {
9051  strat->interpt = BTEST1(OPT_INTERRUPT);
9052  strat->kHEdge=NULL;
9054  /*- creating temp data structures------------------- -*/
9055  strat->cp = 0;
9056  strat->c3 = 0;
9057  strat->cv = 0;
9058  strat->tail = pInit();
9059  /*- set s -*/
9060  strat->sl = -1;
9061  /*- set L -*/
9062  strat->Lmax = setmaxL;
9063  strat->Ll = -1;
9064  strat->L = initL();
9065  /*- set B -*/
9066  strat->Bmax = setmaxL;
9067  strat->Bl = -1;
9068  strat->B = initL();
9069  /*- set T -*/
9070  strat->tl = -1;
9071  strat->tmax = setmaxT;
9072  strat->T = initT();
9073  strat->R = initR();
9074  strat->sevT = initsevT();
9075  /*- init local data struct.---------------------------------------- -*/
9076  strat->P.ecart=0;
9077  strat->P.length=0;
9079  {
9080  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
9081  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
9082  }
9083  #ifdef HAVE_RINGS
9085  {
9086  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
9087  }
9088  #endif
9089  {
9090  if(TEST_OPT_SB_1)
9091  {
9092  int i;
9093  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
9094  for (i=strat->newIdeal;i<IDELEMS(F);i++)
9095  {
9096  P->m[i-strat->newIdeal] = F->m[i];
9097  F->m[i] = NULL;
9098  }
9099  initSSpecial(F,Q,P,strat);
9100  for (i=strat->newIdeal;i<IDELEMS(F);i++)
9101  {
9102  F->m[i] = P->m[i-strat->newIdeal];
9103  P->m[i-strat->newIdeal] = NULL;
9104  }
9105  idDelete(&P);
9106  }
9107  else
9108  {
9109  /*Shdl=*/initSL(F, Q,strat); /*sets also S, ecartS, fromQ */
9110  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
9111  }
9112  }
9113  strat->fromT = FALSE;
9115  if (!TEST_OPT_SB_1)
9116  {
9117  /* the only change: we do not fill the set T*/
9118  #ifdef HAVE_RINGS
9119  if(!rField_is_Ring(currRing))
9120  #endif
9121  updateS(FALSE,strat);
9122  }
9123  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
9124  strat->fromQ=NULL;
9125  /* more changes: fill the set T with all the shifts of elts of S*/
9126  /* is done by other procedure */
9127 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:27
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:327
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
int cv
Definition: kutil.h:350
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
void initSL(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5836
#define BTEST1(a)
Definition: options.h:32
unsigned long * sevT
Definition: kutil.h:323
int ak
Definition: kutil.h:356
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:355
BOOLEAN interpt
Definition: kutil.h:365
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
void initSSpecial(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6236
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
int cp
Definition: kutil.h:349
BOOLEAN kHEdgeFound
Definition: kutil.h:370
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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:6695
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:416
int newIdeal
Definition: kutil.h:360
ideal Shdl
Definition: kutil.h:301
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
static intset initec ( const int  maxnr)
inlinestatic

Definition at line 456 of file kutil.cc.

457 {
458  return (intset)omAlloc(maxnr*sizeof(int));
459 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
int * intset
Definition: kutil.h:53
void initEcartBBA ( TObject h)

Definition at line 1133 of file kutil.cc.

1134 {
1135  h->FDeg = h->pFDeg();
1136  (*h).ecart = 0;
1137  h->length=h->pLength=pLength(h->p);
1138 }
static int pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978
void initEcartNormal ( TObject h)

Definition at line 1125 of file kutil.cc.

1126 {
1127  h->FDeg = h->pFDeg();
1128  h->ecart = h->pLDeg() - h->FDeg;
1129  // h->length is set by h->pLDeg
1130  h->length=h->pLength=pLength(h->p);
1131 }
static int pLength(poly a)
Definition: p_polys.h:189
static Poly * h
Definition: janet.cc:978
void initEcartPairBba ( LObject Lp,
poly  ,
poly  ,
int  ,
int   
)

Definition at line 1140 of file kutil.cc.

1141 {
1142  Lp->FDeg = Lp->pFDeg();
1143  (*Lp).ecart = 0;
1144  (*Lp).length = 0;
1145 }
void initEcartPairMora ( LObject Lp,
poly  ,
poly  ,
int  ecartF,
int  ecartG 
)

Definition at line 1147 of file kutil.cc.

1148 {
1149  Lp->FDeg = Lp->pFDeg();
1150  (*Lp).ecart = si_max(ecartF,ecartG);
1151  (*Lp).ecart = (*Lp).ecart- (Lp->FDeg -p_FDeg((*Lp).lcm,currRing));
1152  (*Lp).length = 0;
1153 }
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:369
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
void initenterpairs ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 2751 of file kutil.cc.

2752 {
2753 
2754  if ((strat->syzComp==0)
2755  || (pGetComp(h)<=strat->syzComp))
2756  {
2757  int j;
2758  BOOLEAN new_pair=FALSE;
2759 
2760  if (pGetComp(h)==0)
2761  {
2762  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
2763  if ((isFromQ)&&(strat->fromQ!=NULL))
2764  {
2765  for (j=0; j<=k; j++)
2766  {
2767  if (!strat->fromQ[j])
2768  {
2769  new_pair=TRUE;
2770  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
2771  //Print("j:%d, Ll:%d\n",j,strat->Ll);
2772  }
2773  }
2774  }
2775  else
2776  {
2777  new_pair=TRUE;
2778  for (j=0; j<=k; j++)
2779  {
2780  #if ADIDEBUG
2781  PrintS("\n initenterpairs: \n");
2782  PrintS(" ");p_Write(h, strat->tailRing);
2783  PrintS(" ");p_Write(strat->S[j],strat->tailRing);
2784  #endif
2785  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
2786  //Print("j:%d, Ll:%d\n",j,strat->Ll);
2787  }
2788  }
2789  }
2790  else
2791  {
2792  for (j=0; j<=k; j++)
2793  {
2794  if ((pGetComp(h)==pGetComp(strat->S[j]))
2795  || (pGetComp(strat->S[j])==0))
2796  {
2797  new_pair=TRUE;
2798  strat->enterOnePair(j,h,ecart,isFromQ,strat, atR);
2799  //Print("j:%d, Ll:%d\n",j,strat->Ll);
2800  }
2801  }
2802  }
2803 
2804  if (new_pair)
2805  {
2806 #ifdef HAVE_RATGRING
2807  if (currRing->real_var_start>0)
2808  chainCritPart(h,ecart,strat);
2809  else
2810 #endif
2811  strat->chainCrit(h,ecart,strat);
2812  }
2813  }
2814 }
int syzComp
Definition: kutil.h:357
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
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:12
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:289
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:319
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:290
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2460
void initenterpairsShift ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR,
int  uptodeg,
int  lV 
)

Definition at line 9605 of file kutil.cc.

9606 {
9607  /* h comes from strat->P.p, that is LObject with LM in currRing and Tail in tailRing */
9608  // atR = -1;
9609  if ((strat->syzComp==0)
9610  || (pGetComp(h)<=strat->syzComp))
9611  {
9612  int j;
9613  BOOLEAN new_pair=FALSE;
9614 
9615  if (pGetComp(h)==0)
9616  {
9617  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
9618  if ((isFromQ)&&(strat->fromQ!=NULL))
9619  {
9620  for (j=0; j<=k; j++)
9621  {
9622  if (!strat->fromQ[j])
9623  {
9624  new_pair=TRUE;
9625  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
9626  // other side pairs:
9627  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
9628  //Print("j:%d, Ll:%d\n",j,strat->Ll);
9629  }
9630  }
9631  }
9632  else
9633  {
9634  new_pair=TRUE;
9635  for (j=0; j<=k; j++)
9636  {
9637  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR,uptodeg,lV);
9638  // other side pairs
9639  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
9640  }
9641  /* HERE we put (h, s*h) pairs */
9642  /* enterOnePairSelfShifts (poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int atR, int uptodeg, int lV); */
9643  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
9644  }
9645  }
9646  else
9647  {
9648  for (j=0; j<=k; j++)
9649  {
9650  if ((pGetComp(h)==pGetComp(strat->S[j]))
9651  || (pGetComp(strat->S[j])==0))
9652  {
9653  new_pair=TRUE;
9654  enterOnePairManyShifts(j,h,ecart,isFromQ,strat, atR, uptodeg, lV);
9655  // other side pairs
9656  enterOnePairSelfShifts(h,strat->S[j],ecart,isFromQ,strat, atR,uptodeg,lV);
9657  //Print("j:%d, Ll:%d\n",j,strat->Ll);
9658  }
9659  }
9660  /* HERE we put (h, s*h) pairs */
9661  enterOnePairSelfShifts (h, h, ecart, isFromQ, strat, atR, uptodeg, lV);
9662  }
9663 
9664  if (new_pair)
9665  {
9666  strat->chainCrit(h,ecart,strat);
9667  }
9668 
9669  }
9670 }
int syzComp
Definition: kutil.h:357
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
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:319
polyset S
Definition: kutil.h:304
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:290
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void enterOnePairManyShifts(int i, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:9134
void enterOnePairSelfShifts(poly qq, poly p, int ecart, int isFromQ, kStrategy strat, int, int uptodeg, int lV)
Definition: kutil.cc:9210
void initenterpairsSig ( poly  h,
poly  hSig,
int  hFrom,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 2820 of file kutil.cc.

2821 {
2822 
2823  if ((strat->syzComp==0)
2824  || (pGetComp(h)<=strat->syzComp))
2825  {
2826  int j;
2827  BOOLEAN new_pair=FALSE;
2828 
2829  if (pGetComp(h)==0)
2830  {
2831  /* for Q!=NULL: build pairs (f,q),(f1,f2), but not (q1,q2)*/
2832  if ((isFromQ)&&(strat->fromQ!=NULL))
2833  {
2834  for (j=0; j<=k; j++)
2835  {
2836  if (!strat->fromQ[j])
2837  {
2838  new_pair=TRUE;
2839  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
2840  //Print("j:%d, Ll:%d\n",j,strat->Ll);
2841  }
2842  }
2843  }
2844  else
2845  {
2846  new_pair=TRUE;
2847  for (j=0; j<=k; j++)
2848  {
2849  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
2850  //Print("j:%d, Ll:%d\n",j,strat->Ll);
2851  }
2852  }
2853  }
2854  else
2855  {
2856  for (j=0; j<=k; j++)
2857  {
2858  if ((pGetComp(h)==pGetComp(strat->S[j]))
2859  || (pGetComp(strat->S[j])==0))
2860  {
2861  new_pair=TRUE;
2862  enterOnePairSig(j,h,hSig,hFrom,ecart,isFromQ,strat, atR);
2863  //Print("j:%d, Ll:%d\n",j,strat->Ll);
2864  }
2865  }
2866  }
2867 
2868  if (new_pair)
2869  {
2870 #ifdef HAVE_RATGRING
2871  if (currRing->real_var_start>0)
2872  chainCritPart(h,ecart,strat);
2873  else
2874 #endif
2875  strat->chainCrit(h,ecart,strat);
2876  }
2877  }
2878 }
int syzComp
Definition: kutil.h:357
#define FALSE
Definition: auxiliary.h:140
void enterOnePairSig(int i, poly p, poly pSig, int, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1784
#define TRUE
Definition: auxiliary.h:144
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:12
int j
Definition: myNF.cc:70
intset fromQ
Definition: kutil.h:319
polyset S
Definition: kutil.h:304
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:290
#define NULL
Definition: omList.c:10
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2460
void initenterstrongPairs ( poly  h,
int  k,
int  ecart,
int  isFromQ,
kStrategy  strat,
int  atR = -1 
)

Definition at line 3451 of file kutil.cc.

3452 {
3453  const unsigned long iCompH = pGetComp(h);
3454  if (!nIsOne(pGetCoeff(h)))
3455  {
3456  int j;
3457 
3458  for (j=0; j<=k; j++)
3459  {
3460  // Print("j:%d, Ll:%d\n",j,strat->Ll);
3461 // if (((unsigned long) pGetCoeff(h) % (unsigned long) pGetCoeff(strat->S[j]) != 0) &&
3462 // ((unsigned long) pGetCoeff(strat->S[j]) % (unsigned long) pGetCoeff(h) != 0))
3463  if (((iCompH == pGetComp(strat->S[j]))
3464  || (0 == pGetComp(strat->S[j])))
3465  && ((iCompH<=strat->syzComp)||(strat->syzComp==0)))
3466  {
3467  enterOneStrongPoly(j,h,ecart,isFromQ,strat, atR);
3468  }
3469  }
3470  }
3471 /*
3472 ring r=256,(x,y,z),dp;
3473 ideal I=12xz-133y, 2xy-z;
3474 */
3475 
3476 }
int syzComp
Definition: kutil.h:357
#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 enterOneStrongPoly(int i, poly p, int, int, kStrategy strat, int atR=-1)
Definition: kutil.cc:1398
polyset S
Definition: kutil.h:304
static Poly * h
Definition: janet.cc:978
void initenterzeropairsRing ( poly  p,
int  ecart,
kStrategy  strat,
int  atR 
)

Definition at line 3319 of file kutil.cc.

3320 {
3321  // Initialize
3322  long exp[50]; // The exponent of \hat{X} (basepoint)
3323  long cexp[50]; // The current exponent for iterating over all
3324  long ind[50]; // The power of 2 in the i-th component of exp
3325  long cind[50]; // analog for cexp
3326  long mult[50]; // How to multiply the elements of G
3327  long cabsind = 0; // The abs. index of cexp, i.e. the sum of cind
3328  long habsind = 0; // The abs. index of the coefficient of h
3329  long step[50]; // The last increases
3330  for (int i = 1; i <= currRing->N; i++)
3331  {
3332  exp[i] = p_GetExp(p, i, currRing);
3333  if (exp[i] & 1 != 0)
3334  {
3335  exp[i] = exp[i] - 1;
3336  mult[i] = 1;
3337  }
3338  cexp[i] = exp[i];
3339  ind[i] = ind_fact_2(exp[i]);
3340  cabsind += ind[i];
3341  cind[i] = ind[i];
3342  step[i] = 500000;
3343  }
3344  step[1] = 500000;
3345  habsind = ind2(n_Int(pGetCoeff(p), currRing->cf);
3346  long bound = currRing->ch - habsind;
3347 #ifdef OLI_DEBUG
3348  PrintS("-------------\npoly :");
3349  wrp(p);
3350  Print("\nexp : (%d, %d)\n", exp[1] + mult[1], exp[2] + mult[1]);
3351  Print("cexp : (%d, %d)\n", cexp[1], cexp[2]);
3352  Print("cind : (%d, %d)\n", cind[1], cind[2]);
3353  Print("bound : %d\n", bound);
3354  Print("cind : %d\n", cabsind);
3355 #endif
3356  if (cabsind == 0)
3357  {
3358  if (!(nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N)))
3359  {
3360  return;
3361  }
3362  }
3363  // Now the whole simplex
3364  do
3365  {
3366  // Build s-polynomial
3367  // 2**ind-def * mult * g - exp-def * h
3368  poly t_p;
3369  poly zeroPoly = kCreateZeroPoly(cexp, cabsind, &t_p, currRing, strat->tailRing);
3370 #ifdef OLI_DEBUG
3371  Print("%d, (%d, %d), ind = (%d, %d)\n", cabsind, cexp[1], cexp[2], cind[1], cind[2]);
3372  Print("zPoly : ");
3373  wrp(zeroPoly);
3374  Print("\n");
3375 #endif
3376  enterOneZeroPairRing(zeroPoly, t_p, p, ecart, strat, atR);
3377  }
3378  while ( nextZeroSimplexExponent(exp, ind, cexp, cind, &cabsind, step, bound, currRing->N) );
3379 }
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:3256
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:3190
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
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:546
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:465
polyrec * poly
Definition: hilb.h:10
void enterOneZeroPairRing(poly f, poly t_p, poly p, int ecart, kStrategy strat, int atR=-1)
Definition: kutil.cc:3071
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
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:3048
ring tailRing
Definition: kutil.h:343
p exp[i]
Definition: DebugPrint.cc:39
long ind2(long arg)
Definition: kutil.cc:3036
void wrp(poly p)
Definition: polys.h:281
void initHilbCrit ( ideal  ,
ideal  ,
intvec **  hilb,
kStrategy  strat 
)

Definition at line 7305 of file kutil.cc.

7306 {
7307 
7308  //if the ordering is local, then hilb criterion
7309  //can be used also if tzhe ideal is not homogenous
7310  if((rHasLocalOrMixedOrdering(currRing)) && (currRing->MixedOrder == 0 ))
7311  #ifdef HAVE_RINGS
7312  {
7314  *hilb=NULL;
7315  else
7316  return;
7317  }
7318 #endif
7319  if (strat->homog!=isHomog)
7320  {
7321  *hilb=NULL;
7322  }
7323 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN homog
Definition: kutil.h:366
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void initPairtest ( kStrategy  strat)

Definition at line 558 of file kutil.cc.

559 {
560  strat->pairtest = (BOOLEAN *)omAlloc0((strat->sl+2)*sizeof(BOOLEAN));
561 }
BOOLEAN * pairtest
Definition: kutil.h:333
int sl
Definition: kutil.h:351
int BOOLEAN
Definition: auxiliary.h:131
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void initS ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 5733 of file kutil.cc.

5734 {
5735  int i,pos;
5736 
5737  if (Q!=NULL) i=((IDELEMS(F)+IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5738  else i=((IDELEMS(F)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5739  strat->ecartS=initec(i);
5740  strat->sevS=initsevS(i);
5741  strat->S_2_R=initS_2_R(i);
5742  strat->fromQ=NULL;
5743  strat->Shdl=idInit(i,F->rank);
5744  strat->S=strat->Shdl->m;
5745  /*- put polys into S -*/
5746  if (Q!=NULL)
5747  {
5748  strat->fromQ=initec(i);
5749  memset(strat->fromQ,0,i*sizeof(int));
5750  for (i=0; i<IDELEMS(Q); i++)
5751  {
5752  if (Q->m[i]!=NULL)
5753  {
5754  LObject h;
5755  h.p = pCopy(Q->m[i]);
5757  {
5758  //pContent(h.p);
5759  h.pCleardenom(); // also does a pContent
5760  }
5761  else
5762  {
5763  h.pNorm();
5764  }
5766  {
5767  deleteHC(&h, strat);
5768  }
5769  if (h.p!=NULL)
5770  {
5771  strat->initEcart(&h);
5772  if (strat->sl==-1)
5773  pos =0;
5774  else
5775  {
5776  pos = posInS(strat,strat->sl,h.p,h.ecart);
5777  }
5778  h.sev = pGetShortExpVector(h.p);
5779  strat->enterS(h,pos,strat,-1);
5780  strat->fromQ[pos]=1;
5781  }
5782  }
5783  }
5784  }
5785  for (i=0; i<IDELEMS(F); i++)
5786  {
5787  if (F->m[i]!=NULL)
5788  {
5789  LObject h;
5790  h.p = pCopy(F->m[i]);
5792  {
5793  /*#ifdef HAVE_RINGS
5794  if (rField_is_Ring(currRing))
5795  {
5796  h.pCleardenom();
5797  }
5798  else
5799  #endif*/
5800  cancelunit(&h); /*- tries to cancel a unit -*/
5801  deleteHC(&h, strat);
5802  }
5803  if (h.p!=NULL)
5804  // do not rely on the input being a SB!
5805  {
5807  {
5808  //pContent(h.p);
5809  h.pCleardenom(); // also does a pContent
5810  }
5811  else
5812  {
5813  h.pNorm();
5814  }
5815  strat->initEcart(&h);
5816  if (strat->sl==-1)
5817  pos =0;
5818  else
5819  pos = posInS(strat,strat->sl,h.p,h.ecart);
5820  h.sev = pGetShortExpVector(h.p);
5821  strat->enterS(h,pos,strat,-1);
5822  }
5823  }
5824  }
5825  /*- test, if a unit is in F -*/
5826  if ((strat->sl>=0)
5827 #ifdef HAVE_RINGS
5828  && n_IsUnit(pGetCoeff(strat->S[0]),currRing->cf)
5829 #endif
5830  && pIsConstant(strat->S[0]))
5831  {
5832  while (strat->sl>0) deleteInS(strat->sl,strat);
5833  }
5834 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
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:465
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
#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:461
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
static int* initS_2_R ( const int  maxnr)
inlinestatic

Definition at line 465 of file kutil.cc.

466 {
467  return (int*)omAlloc0(maxnr*sizeof(int));
468 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void initSbaBuchMora ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 7751 of file kutil.cc.

7752 {
7753  strat->interpt = BTEST1(OPT_INTERRUPT);
7754  strat->kHEdge=NULL;
7756  /*- creating temp data structures------------------- -*/
7757  strat->cp = 0;
7758  strat->c3 = 0;
7759  strat->tail = pInit();
7760  /*- set s -*/
7761  strat->sl = -1;
7762  /*- set ps -*/
7763  strat->syzl = -1;
7764  /*- set L -*/
7765  strat->Lmax = ((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
7766  strat->Ll = -1;
7767  strat->L = initL(((IDELEMS(F)+setmaxLinc-1)/setmaxLinc)*setmaxLinc);
7768  /*- set B -*/
7769  strat->Bmax = setmaxL;
7770  strat->Bl = -1;
7771  strat->B = initL();
7772  /*- set T -*/
7773  strat->tl = -1;
7774  strat->tmax = setmaxT;
7775  strat->T = initT();
7776  strat->R = initR();
7777  strat->sevT = initsevT();
7778  /*- init local data struct.---------------------------------------- -*/
7779  strat->P.ecart=0;
7780  strat->P.length=0;
7782  {
7783  if (strat->kHEdge!=NULL) pSetComp(strat->kHEdge, strat->ak);
7784  if (strat->kNoether!=NULL) pSetComp(strat->kNoetherTail(), strat->ak);
7785  }
7786  #ifdef HAVE_RINGS
7788  {
7789  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
7790  }
7791  else
7792  #endif
7793  {
7794  if(TEST_OPT_SB_1)
7795  {
7796  int i;
7797  ideal P=idInit(IDELEMS(F)-strat->newIdeal,F->rank);
7798  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7799  {
7800  P->m[i-strat->newIdeal] = F->m[i];
7801  F->m[i] = NULL;
7802  }
7803  initSSpecialSba(F,Q,P,strat);
7804  for (i=strat->newIdeal;i<IDELEMS(F);i++)
7805  {
7806  F->m[i] = P->m[i-strat->newIdeal];
7807  P->m[i-strat->newIdeal] = NULL;
7808  }
7809  idDelete(&P);
7810  }
7811  else
7812  {
7813  /*Shdl=*/initSLSba(F, Q,strat); /*sets also S, ecartS, fromQ */
7814  // /*Shdl=*/initS(F, Q,strat); /*sets also S, ecartS, fromQ */
7815  }
7816  }
7817  strat->fromT = FALSE;
7819  if (!TEST_OPT_SB_1)
7820  {
7821  #ifdef HAVE_RINGS
7822  if(!rField_is_Ring(currRing))
7823  #endif
7824  updateS(TRUE,strat);
7825  }
7826  if (strat->fromQ!=NULL) omFreeSize(strat->fromQ,IDELEMS(strat->Shdl)*sizeof(int));
7827  strat->fromQ=NULL;
7828 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
#define TEST_OPT_REDTAIL
Definition: options.h:111
KINLINE TObject ** initR()
Definition: kInline.h:92
#define setmaxL
Definition: kutil.h:27
KINLINE unsigned long * initsevT()
Definition: kInline.h:97
poly kHEdge
Definition: kutil.h:327
KINLINE TSet initT()
Definition: kInline.h:81
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
int c3
Definition: kutil.h:349
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
int Bl
Definition: kutil.h:355
#define BTEST1(a)
Definition: options.h:32
#define TRUE
Definition: auxiliary.h:144
void initSSpecialSba(ideal F, ideal Q, ideal P, kStrategy strat)
Definition: kutil.cc:6381
unsigned long * sevT
Definition: kutil.h:323
int ak
Definition: kutil.h:356
#define setmaxLinc
Definition: kutil.h:28
void initSLSba(ideal F, ideal Q, kStrategy strat)
Definition: kutil.cc:5935
#define Q
Definition: sirandom.c:25
int Bmax
Definition: kutil.h:355
BOOLEAN interpt
Definition: kutil.h:365
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN fromT
Definition: kutil.h:373
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pSetComp(p, v)
Definition: polys.h:38
void idDelete(ideal *h, ring r=currRing)
delete an ideal
Definition: ideals.h:31
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
#define IDELEMS(i)
Definition: simpleideals.h:19
int tmax
Definition: kutil.h:353
int cp
Definition: kutil.h:349
BOOLEAN kHEdgeFound
Definition: kutil.h:370
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
#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:6695
int sl
Definition: kutil.h:351
TSet T
Definition: kutil.h:324
kBucketDestroy & P
Definition: myNF.cc:191
static LSet initL(int nr=setmaxL)
Definition: kutil.h:416
int newIdeal
Definition: kutil.h:360
ideal Shdl
Definition: kutil.h:301
#define OPT_INTERRUPT
Definition: options.h:74
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int syzl
Definition: kutil.h:352
void initSbaCrit ( kStrategy  strat)

Definition at line 7382 of file kutil.cc.

7383 {
7384  //strat->enterOnePair=enterOnePairNormal;
7386  //strat->chainCrit=chainCritNormal;
7387  strat->chainCrit = chainCritSig;
7388  /******************************************
7389  * rewCrit1 and rewCrit2 are already set in
7390  * kSba() in kstd1.cc
7391  *****************************************/
7392  //strat->rewCrit1 = faugereRewCriterion;
7393  if (strat->sbaOrder == 1)
7394  {
7395  strat->syzCrit = syzCriterionInc;
7396  }
7397  else
7398  {
7399  strat->syzCrit = syzCriterion;
7400  }
7401 #ifdef HAVE_RINGS
7402  if (rField_is_Ring(currRing))
7403  {
7405  strat->chainCrit=chainCritRing;
7406  }
7407 #endif
7408 #ifdef HAVE_RATGRING
7409  if (rIsRatGRing(currRing))
7410  {
7411  strat->chainCrit=chainCritPart;
7412  /* enterOnePairNormal get rational part in it */
7413  }
7414 #endif
7415 
7416  strat->sugarCrit = TEST_OPT_SUGARCRIT;
7417  strat->Gebauer = strat->homog || strat->sugarCrit;
7418  strat->honey = !strat->homog || strat->sugarCrit || TEST_OPT_WEIGHTM;
7419  if (TEST_OPT_NOT_SUGAR) strat->honey = FALSE;
7420  strat->pairtest = NULL;
7421  /* alway use tailreduction, except:
7422  * - in local rings, - in lex order case, -in ring over extensions */
7424  //strat->noTailReduction = NULL;
7425 
7426 #ifdef HAVE_PLURAL
7427  // and r is plural_ring
7428  // hence this holds for r a rational_plural_ring
7429  if( rIsPluralRing(currRing) || (rIsSCA(currRing) && !strat->z2homog) )
7430  { //or it has non-quasi-comm type... later
7431  strat->sugarCrit = FALSE;
7432  strat->Gebauer = FALSE;
7433  strat->honey = FALSE;
7434  }
7435 #endif
7436 
7437 #ifdef HAVE_RINGS
7438  // Coefficient ring?
7439  if (rField_is_Ring(currRing))
7440  {
7441  strat->sugarCrit = FALSE;
7442  strat->Gebauer = FALSE ;
7443  strat->honey = FALSE;
7444  }
7445 #endif
7446  #ifdef KDEBUG
7447  if (TEST_OPT_DEBUG)
7448  {
7449  if (strat->homog) PrintS("ideal/module is homogeneous\n");
7450  else PrintS("ideal/module is not homogeneous\n");
7451  }
7452  #endif
7453 }
#define TEST_OPT_REDTAIL
Definition: options.h:111
BOOLEAN honey
Definition: kutil.h:371
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
BOOLEAN * pairtest
Definition: kutil.h:333
BOOLEAN z2homog
Definition: kutil.h:368
#define TEST_OPT_DEBUG
Definition: options.h:103
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void chainCritSig(poly p, int, kStrategy strat)
Definition: kutil.cc:2401
void enterOnePairNormal(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1490
BOOLEAN(* syzCrit)(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.h:291
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void(* enterOnePair)(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR)
Definition: kutil.h:289
BOOLEAN homog
Definition: kutil.h:366
void chainCritRing(poly p, int, kStrategy strat)
Definition: kutil.cc:2885
#define TEST_OPT_NOT_SUGAR
Definition: options.h:101
BOOLEAN Gebauer
Definition: kutil.h:372
unsigned sbaOrder
Definition: kutil.h:314
void PrintS(const char *s)
Definition: reporter.cc:294
BOOLEAN sugarCrit
Definition: kutil.h:371
BOOLEAN syzCriterion(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5071
#define TEST_OPT_SUGARCRIT
Definition: options.h:102
BOOLEAN syzCriterionInc(poly sig, unsigned long not_sevSig, kStrategy strat)
Definition: kutil.cc:5103
#define TEST_OPT_WEIGHTM
Definition: options.h:115
void(* chainCrit)(poly p, int ecart, kStrategy strat)
Definition: kutil.h:290
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
void enterOnePairRing(int i, poly p, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:1167
static bool rIsSCA(const ring r)
Definition: nc.h:206
void chainCritPart(poly p, int ecart, kStrategy strat)
Definition: kutil.cc:2460
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
void initSbaPos ( kStrategy  strat)

Definition at line 7655 of file kutil.cc.

7656 {
7658  {
7659  if (strat->honey)
7660  {
7661  strat->posInL = posInL15;
7662  // ok -- here is the deal: from my experiments for Singular-2-0
7663  // I conclude that that posInT_EcartpLength is the best of
7664  // posInT15, posInT_EcartFDegpLength, posInT_FDegLength, posInT_pLength
7665  // see the table at the end of this file
7666  if (TEST_OPT_OLDSTD)
7667  strat->posInT = posInT15;
7668  else
7669  strat->posInT = posInT_EcartpLength;
7670  }
7671  else if (currRing->pLexOrder && !TEST_OPT_INTSTRATEGY)
7672  {
7673  strat->posInL = posInL11;
7674  strat->posInT = posInT11;
7675  }
7676  else if (TEST_OPT_INTSTRATEGY)
7677  {
7678  strat->posInL = posInL11;
7679  strat->posInT = posInT11;
7680  }
7681  else
7682  {
7683  strat->posInL = posInL0;
7684  strat->posInT = posInT0;
7685  }
7686  //if (strat->minim>0) strat->posInL =posInLSpecial;
7687  if (strat->homog)
7688  {
7689  strat->posInL = posInL110;
7690  strat->posInT = posInT110;
7691  }
7692  }
7693  else
7694  {
7695  if (strat->homog)
7696  {
7697  strat->posInL = posInL11;
7698  strat->posInT = posInT11;
7699  }
7700  else
7701  {
7702  if ((currRing->order[0]==ringorder_c)
7703  ||(currRing->order[0]==ringorder_C))
7704  {
7705  strat->posInL = posInL17_c;
7706  strat->posInT = posInT17_c;
7707  }
7708  else
7709  {
7710  strat->posInL = posInL17;
7711  strat->posInT = posInT17;
7712  }
7713  }
7714  }
7715  if (strat->minim>0) strat->posInL =posInLSpecial;
7716  // for further tests only
7717  if ((BTEST1(11)) || (BTEST1(12)))
7718  strat->posInL = posInL11;
7719  else if ((BTEST1(13)) || (BTEST1(14)))
7720  strat->posInL = posInL13;
7721  else if ((BTEST1(15)) || (BTEST1(16)))
7722  strat->posInL = posInL15;
7723  else if ((BTEST1(17)) || (BTEST1(18)))
7724  strat->posInL = posInL17;
7725  if (BTEST1(11))
7726  strat->posInT = posInT11;
7727  else if (BTEST1(13))
7728  strat->posInT = posInT13;
7729  else if (BTEST1(15))
7730  strat->posInT = posInT15;
7731  else if ((BTEST1(17)))
7732  strat->posInT = posInT17;
7733  else if ((BTEST1(19)))
7734  strat->posInT = posInT19;
7735  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
7736  strat->posInT = posInT1;
7737 #ifdef HAVE_RINGS
7738  if (rField_is_Ring(currRing))
7739  {
7740  strat->posInL = posInL11;
7741  strat->posInT = posInT11;
7742  }
7743 #endif
7744  strat->posInLDependsOnLength = FALSE;
7745  strat->posInLSba = posInLSig;
7746  //strat->posInL = posInLSig;
7747  strat->posInL = posInLF5C;
7748  //strat->posInT = posInTSig;
7749 }
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
#define FALSE
Definition: auxiliary.h:140
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:281
#define BTEST1(a)
Definition: options.h:32
int posInLF5C(const LSet, const int, LObject *, const kStrategy strat)
Definition: kutil.cc:4652
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4281
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int minim
Definition: kutil.h:361
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
int posInLSig(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4599
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
BOOLEAN homog
Definition: kutil.h:366
#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:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4339
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
static unsigned long* initsevS ( const int  maxnr)
inlinestatic

Definition at line 461 of file kutil.cc.

462 {
463  return (unsigned long*)omAlloc0(maxnr*sizeof(unsigned long));
464 }
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void initSL ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 5836 of file kutil.cc.

5837 {
5838  int i,pos;
5839 
5840  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5841  else i=setmaxT;
5842  strat->ecartS=initec(i);
5843  strat->sevS=initsevS(i);
5844  strat->S_2_R=initS_2_R(i);
5845  strat->fromQ=NULL;
5846  strat->Shdl=idInit(i,F->rank);
5847  strat->S=strat->Shdl->m;
5848  /*- put polys into S -*/
5849  if (Q!=NULL)
5850  {
5851  strat->fromQ=initec(i);
5852  memset(strat->fromQ,0,i*sizeof(int));
5853  for (i=0; i<IDELEMS(Q); i++)
5854  {
5855  if (Q->m[i]!=NULL)
5856  {
5857  LObject h;
5858  h.p = pCopy(Q->m[i]);
5860  {
5861  deleteHC(&h,strat);
5862  }
5864  {
5865  //pContent(h.p);
5866  h.pCleardenom(); // also does a pContent
5867  }
5868  else
5869  {
5870  h.pNorm();
5871  }
5872  if (h.p!=NULL)
5873  {
5874  strat->initEcart(&h);
5875  if (strat->sl==-1)
5876  pos =0;
5877  else
5878  {
5879  pos = posInS(strat,strat->sl,h.p,h.ecart);
5880  }
5881  h.sev = pGetShortExpVector(h.p);
5882  strat->enterS(h,pos,strat,-1);
5883  strat->fromQ[pos]=1;
5884  }
5885  }
5886  }
5887  }
5888  for (i=0; i<IDELEMS(F); i++)
5889  {
5890  if (F->m[i]!=NULL)
5891  {
5892  LObject h;
5893  h.p = pCopy(F->m[i]);
5894  if (h.p!=NULL)
5895  {
5897  {
5898  cancelunit(&h); /*- tries to cancel a unit -*/
5899  deleteHC(&h, strat);
5900  }
5901  if (h.p!=NULL)
5902  {
5904  {
5905  //pContent(h.p);
5906  h.pCleardenom(); // also does a pContent
5907  }
5908  else
5909  {
5910  h.pNorm();
5911  }
5912  strat->initEcart(&h);
5913  if (strat->Ll==-1)
5914  pos =0;
5915  else
5916  pos = strat->posInL(strat->L,strat->Ll,&h,strat);
5917  h.sev = pGetShortExpVector(h.p);
5918  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
5919  }
5920  }
5921  }
5922  }
5923  /*- test, if a unit is in F -*/
5924 
5925  if ((strat->Ll>=0)
5926 #ifdef HAVE_RINGS
5927  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
5928 #endif
5929  && pIsConstant(strat->L[strat->Ll].p))
5930  {
5931  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
5932  }
5933 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
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:465
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int * S_2_R
Definition: kutil.h:342
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#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:461
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSLSba ( ideal  F,
ideal  Q,
kStrategy  strat 
)

Definition at line 5935 of file kutil.cc.

5936 {
5937  int i,pos;
5938  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
5939  else i=setmaxT;
5940  strat->ecartS = initec(i);
5941  strat->sevS = initsevS(i);
5942  strat->sevSig = initsevS(i);
5943  strat->S_2_R = initS_2_R(i);
5944  strat->fromQ = NULL;
5945  strat->Shdl = idInit(i,F->rank);
5946  strat->S = strat->Shdl->m;
5947  strat->sig = (poly *)omAlloc0(i*sizeof(poly));
5948  if (strat->sbaOrder != 1)
5949  {
5950  strat->syz = (poly *)omAlloc0(i*sizeof(poly));
5951  strat->sevSyz = initsevS(i);
5952  strat->syzmax = i;
5953  strat->syzl = 0;
5954  }
5955  /*- put polys into S -*/
5956  if (Q!=NULL)
5957  {
5958  strat->fromQ=initec(i);
5959  memset(strat->fromQ,0,i*sizeof(int));
5960  for (i=0; i<IDELEMS(Q); i++)
5961  {
5962  if (Q->m[i]!=NULL)
5963  {
5964  LObject h;
5965  h.p = pCopy(Q->m[i]);
5967  {
5968  deleteHC(&h,strat);
5969  }
5971  {
5972  //pContent(h.p);
5973  h.pCleardenom(); // also does a pContent
5974  }
5975  else
5976  {
5977  h.pNorm();
5978  }
5979  if (h.p!=NULL)
5980  {
5981  strat->initEcart(&h);
5982  if (strat->sl==-1)
5983  pos =0;
5984  else
5985  {
5986  pos = posInS(strat,strat->sl,h.p,h.ecart);
5987  }
5988  h.sev = pGetShortExpVector(h.p);
5989  strat->enterS(h,pos,strat,-1);
5990  strat->fromQ[pos]=1;
5991  }
5992  }
5993  }
5994  }
5995  for (i=0; i<IDELEMS(F); i++)
5996  {
5997  if (F->m[i]!=NULL)
5998  {
5999  LObject h;
6000  h.p = pCopy(F->m[i]);
6001  h.sig = pOne();
6002  //h.sig = pInit();
6003  //p_SetCoeff(h.sig,nInit(1),currRing);
6004  p_SetComp(h.sig,i+1,currRing);
6005  // if we are working with the Schreyer order we generate it
6006  // by multiplying the initial signatures with the leading monomial
6007  // of the corresponding initial polynomials generating the ideal
6008  // => we can keep the underlying monomial order and get a Schreyer
6009  // order without any bigger overhead
6010  if (strat->sbaOrder == 0 || strat->sbaOrder == 3)
6011  {
6012  p_ExpVectorAdd (h.sig,F->m[i],currRing);
6013  }
6014  h.sevSig = pGetShortExpVector(h.sig);
6015 #ifdef DEBUGF5
6016  pWrite(h.p);
6017  pWrite(h.sig);
6018 #endif
6019  if (h.p!=NULL)
6020  {
6022  {
6023  cancelunit(&h); /*- tries to cancel a unit -*/
6024  deleteHC(&h, strat);
6025  }
6026  if (h.p!=NULL)
6027  {
6029  {
6030  //pContent(h.p);
6031  h.pCleardenom(); // also does a pContent
6032  }
6033  else
6034  {
6035  h.pNorm();
6036  }
6037  strat->initEcart(&h);
6038  if (strat->Ll==-1)
6039  pos =0;
6040  else
6041  pos = strat->posInLSba(strat->L,strat->Ll,&h,strat);
6042  h.sev = pGetShortExpVector(h.p);
6043  enterL(&strat->L,&strat->Ll,&strat->Lmax,h,pos);
6044  }
6045  }
6046  /*
6047  if (strat->sbaOrder != 1)
6048  {
6049  for(j=0;j<i;j++)
6050  {
6051  strat->syz[ctr] = pCopy(F->m[j]);
6052  p_SetCompP(strat->syz[ctr],i+1,currRing);
6053  // add LM(F->m[i]) to the signature to get a Schreyer order
6054  // without changing the underlying polynomial ring at all
6055  p_ExpVectorAdd (strat->syz[ctr],F->m[i],currRing);
6056  // since p_Add_q() destroys all input
6057  // data we need to recreate help
6058  // each time
6059  poly help = pCopy(F->m[i]);
6060  p_SetCompP(help,j+1,currRing);
6061  pWrite(strat->syz[ctr]);
6062  pWrite(help);
6063  printf("%d\n",pLmCmp(strat->syz[ctr],help));
6064  strat->syz[ctr] = p_Add_q(strat->syz[ctr],help,currRing);
6065  printf("%d. SYZ ",ctr);
6066  pWrite(strat->syz[ctr]);
6067  strat->sevSyz[ctr] = p_GetShortExpVector(strat->syz[ctr],currRing);
6068  ctr++;
6069  }
6070  strat->syzl = ps;
6071  }
6072  */
6073  }
6074  }
6075  /*- test, if a unit is in F -*/
6076 
6077  if ((strat->Ll>=0)
6078 #ifdef HAVE_RINGS
6079  && n_IsUnit(pGetCoeff(strat->L[strat->Ll].p), currRing->cf)
6080 #endif
6081  && pIsConstant(strat->L[strat->Ll].p))
6082  {
6083  while (strat->Ll>0) deleteInL(strat->L,&strat->Ll,strat->Ll-1,strat);
6084  }
6085 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
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:352
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:465
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int * S_2_R
Definition: kutil.h:342
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:281
void pWrite(poly p)
Definition: polys.h:279
void cancelunit(LObject *L, BOOLEAN inNF)
Definition: kutil.cc:324
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#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:461
void deleteInL(LSet set, int *length, int j, kStrategy strat)
Definition: kutil.cc:1039
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:30
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
unsigned sbaOrder
Definition: kutil.h:314
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1339
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
LSet L
Definition: kutil.h:325
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
unsigned long * sevSyz
Definition: kutil.h:321
#define setmaxTinc
Definition: kutil.h:31
polyset syz
Definition: kutil.h:305
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
static Poly * h
Definition: janet.cc:978
int syzl
Definition: kutil.h:352
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSSpecial ( ideal  F,
ideal  Q,
ideal  P,
kStrategy  strat 
)

Definition at line 6236 of file kutil.cc.

6237 {
6238  int i,pos;
6239 
6240  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6241  else i=setmaxT;
6242  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
6243  strat->ecartS=initec(i);
6244  strat->sevS=initsevS(i);
6245  strat->S_2_R=initS_2_R(i);
6246  strat->fromQ=NULL;
6247  strat->Shdl=idInit(i,F->rank);
6248  strat->S=strat->Shdl->m;
6249 
6250  /*- put polys into S -*/
6251  if (Q!=NULL)
6252  {
6253  strat->fromQ=initec(i);
6254  memset(strat->fromQ,0,i*sizeof(int));
6255  for (i=0; i<IDELEMS(Q); i++)
6256  {
6257  if (Q->m[i]!=NULL)
6258  {
6259  LObject h;
6260  h.p = pCopy(Q->m[i]);
6261  //if (TEST_OPT_INTSTRATEGY)
6262  //{
6263  // //pContent(h.p);
6264  // h.pCleardenom(); // also does a pContent
6265  //}
6266  //else
6267  //{
6268  // h.pNorm();
6269  //}
6271  {
6272  deleteHC(&h,strat);
6273  }
6274  if (h.p!=NULL)
6275  {
6276  strat->initEcart(&h);
6277  if (strat->sl==-1)
6278  pos =0;
6279  else
6280  {
6281  pos = posInS(strat,strat->sl,h.p,h.ecart);
6282  }
6283  h.sev = pGetShortExpVector(h.p);
6284  strat->enterS(h,pos,strat, strat->tl+1);
6285  enterT(h, strat);
6286  strat->fromQ[pos]=1;
6287  }
6288  }
6289  }
6290  }
6291  /*- put polys into S -*/
6292  for (i=0; i<IDELEMS(F); i++)
6293  {
6294  if (F->m[i]!=NULL)
6295  {
6296  LObject h;
6297  h.p = pCopy(F->m[i]);
6299  {
6300  deleteHC(&h,strat);
6301  }
6302  else
6303  {
6304  h.p=redtailBba(h.p,strat->sl,strat);
6305  }
6306  if (h.p!=NULL)
6307  {
6308  strat->initEcart(&h);
6309  if (strat->sl==-1)
6310  pos =0;
6311  else
6312  pos = posInS(strat,strat->sl,h.p,h.ecart);
6313  h.sev = pGetShortExpVector(h.p);
6314  strat->enterS(h,pos,strat, strat->tl+1);
6315  enterT(h,strat);
6316  }
6317  }
6318  }
6319  for (i=0; i<IDELEMS(P); i++)
6320  {
6321  if (P->m[i]!=NULL)
6322  {
6323  LObject h;
6324  h.p=pCopy(P->m[i]);
6326  {
6327  h.pCleardenom();
6328  }
6329  else
6330  {
6331  h.pNorm();
6332  }
6333  if(strat->sl>=0)
6334  {
6336  {
6337  h.p=redBba(h.p,strat->sl,strat);
6338  if (h.p!=NULL)
6339  {
6340  h.p=redtailBba(h.p,strat->sl,strat);
6341  }
6342  }
6343  else
6344  {
6345  h.p=redMora(h.p,strat->sl,strat);
6346  }
6347  if(h.p!=NULL)
6348  {
6349  strat->initEcart(&h);
6351  {
6352  h.pCleardenom();
6353  }
6354  else
6355  {
6356  h.is_normalized = 0;
6357  h.pNorm();
6358  }
6359  h.sev = pGetShortExpVector(h.p);
6360  h.SetpFDeg();
6361  pos = posInS(strat,strat->sl,h.p,h.ecart);
6362  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
6363  strat->enterS(h,pos,strat, strat->tl+1);
6364  enterT(h,strat);
6365  }
6366  }
6367  else
6368  {
6369  h.sev = pGetShortExpVector(h.p);
6370  strat->initEcart(&h);
6371  strat->enterS(h,0,strat, strat->tl+1);
6372  enterT(h,strat);
6373  }
6374  }
6375  }
6376 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:465
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:3733
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:5412
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:461
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6631
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:30
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
intset ecartS
Definition: kutil.h:307
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6654
kBucketDestroy & P
Definition: myNF.cc:191
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
static Poly * h
Definition: janet.cc:978
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
void initSSpecialSba ( ideal  F,
ideal  Q,
ideal  P,
kStrategy  strat 
)

Definition at line 6381 of file kutil.cc.

6382 {
6383  int i,pos;
6384 
6385  if (Q!=NULL) i=((IDELEMS(Q)+(setmaxTinc-1))/setmaxTinc)*setmaxTinc;
6386  else i=setmaxT;
6387  i=((i+IDELEMS(F)+IDELEMS(P)+15)/16)*16;
6388  strat->sevS=initsevS(i);
6389  strat->sevSig=initsevS(i);
6390  strat->S_2_R=initS_2_R(i);
6391  strat->fromQ=NULL;
6392  strat->Shdl=idInit(i,F->rank);
6393  strat->S=strat->Shdl->m;
6394  strat->sig=(poly *)omAlloc0(i*sizeof(poly));
6395  /*- put polys into S -*/
6396  if (Q!=NULL)
6397  {
6398  strat->fromQ=initec(i);
6399  memset(strat->fromQ,0,i*sizeof(int));
6400  for (i=0; i<IDELEMS(Q); i++)
6401  {
6402  if (Q->m[i]!=NULL)
6403  {
6404  LObject h;
6405  h.p = pCopy(Q->m[i]);
6406  //if (TEST_OPT_INTSTRATEGY)
6407  //{
6408  // //pContent(h.p);
6409  // h.pCleardenom(); // also does a pContent
6410  //}
6411  //else
6412  //{
6413  // h.pNorm();
6414  //}
6416  {
6417  deleteHC(&h,strat);
6418  }
6419  if (h.p!=NULL)
6420  {
6421  strat->initEcart(&h);
6422  if (strat->sl==-1)
6423  pos =0;
6424  else
6425  {
6426  pos = posInS(strat,strat->sl,h.p,h.ecart);
6427  }
6428  h.sev = pGetShortExpVector(h.p);
6429  strat->enterS(h,pos,strat, strat->tl+1);
6430  enterT(h, strat);
6431  strat->fromQ[pos]=1;
6432  }
6433  }
6434  }
6435  }
6436  /*- put polys into S -*/
6437  for (i=0; i<IDELEMS(F); i++)
6438  {
6439  if (F->m[i]!=NULL)
6440  {
6441  LObject h;
6442  h.p = pCopy(F->m[i]);
6444  {
6445  deleteHC(&h,strat);
6446  }
6447  else
6448  {
6449  h.p=redtailBba(h.p,strat->sl,strat);
6450  }
6451  if (h.p!=NULL)
6452  {
6453  strat->initEcart(&h);
6454  if (strat->sl==-1)
6455  pos =0;
6456  else
6457  pos = posInS(strat,strat->sl,h.p,h.ecart);
6458  h.sev = pGetShortExpVector(h.p);
6459  strat->enterS(h,pos,strat, strat->tl+1);
6460  enterT(h,strat);
6461  }
6462  }
6463  }
6464  for (i=0; i<IDELEMS(P); i++)
6465  {
6466  if (P->m[i]!=NULL)
6467  {
6468  LObject h;
6469  h.p=pCopy(P->m[i]);
6471  {
6472  h.pCleardenom();
6473  }
6474  else
6475  {
6476  h.pNorm();
6477  }
6478  if(strat->sl>=0)
6479  {
6481  {
6482  h.p=redBba(h.p,strat->sl,strat);
6483  if (h.p!=NULL)
6484  {
6485  h.p=redtailBba(h.p,strat->sl,strat);
6486  }
6487  }
6488  else
6489  {
6490  h.p=redMora(h.p,strat->sl,strat);
6491  }
6492  if(h.p!=NULL)
6493  {
6494  strat->initEcart(&h);
6496  {
6497  h.pCleardenom();
6498  }
6499  else
6500  {
6501  h.is_normalized = 0;
6502  h.pNorm();
6503  }
6504  h.sev = pGetShortExpVector(h.p);
6505  h.SetpFDeg();
6506  pos = posInS(strat,strat->sl,h.p,h.ecart);
6507  enterpairsSpecial(h.p,strat->sl,h.ecart,pos,strat,strat->tl+1);
6508  strat->enterS(h,pos,strat, strat->tl+1);
6509  enterT(h,strat);
6510  }
6511  }
6512  else
6513  {
6514  h.sev = pGetShortExpVector(h.p);
6515  strat->initEcart(&h);
6516  strat->enterS(h,0,strat, strat->tl+1);
6517  enterT(h,strat);
6518  }
6519  }
6520  }
6521 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:742
unsigned long * sevSig
Definition: kutil.h:322
polyset sig
Definition: kutil.h:306
static int * initS_2_R(const int maxnr)
Definition: kutil.cc:465
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
int tl
Definition: kutil.h:353
void enterpairsSpecial(poly h, int k, int ecart, int pos, kStrategy strat, int atR=-1)
Definition: kutil.cc:3733
#define Q
Definition: sirandom.c:25
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:5412
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:461
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6631
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
#define setmaxT
Definition: kutil.h:30
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
void deleteHC(LObject *L, kStrategy strat, BOOLEAN fromNext)
Definition: kutil.cc:235
polyset S
Definition: kutil.h:304
#define IDELEMS(i)
Definition: simpleideals.h:19
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
#define setmaxTinc
Definition: kutil.h:31
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6654
kBucketDestroy & P
Definition: myNF.cc:191
ideal Shdl
Definition: kutil.h:301
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
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:156
void initSyzRules ( kStrategy  strat)

Definition at line 6087 of file kutil.cc.

6088 {
6089  if( strat->S[0] )
6090  {
6091  if( strat->S[1] )
6092  {
6093  omFreeSize(strat->syzIdx,(strat->syzidxmax)*sizeof(int));
6094  omFreeSize(strat->sevSyz,(strat->syzmax)*sizeof(unsigned long));
6095  omFreeSize(strat->syz,(strat->syzmax)*sizeof(poly));
6096  }
6097  int i, j, k, diff, comp, comp_old, ps=0, ctr=0;
6098  /************************************************************
6099  * computing the length of the syzygy array needed
6100  ***********************************************************/
6101  for(i=1; i<=strat->sl; i++)
6102  {
6103  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6104  {
6105  ps += i;
6106  }
6107  }
6108  ps += strat->sl+1;
6109  //comp = pGetComp (strat->P.sig);
6110  comp = strat->currIdx;
6111  strat->syzIdx = initec(comp);
6112  strat->sevSyz = initsevS(ps);
6113  strat->syz = (poly *)omAlloc(ps*sizeof(poly));
6114  strat->syzmax = ps;
6115  strat->syzl = 0;
6116  strat->syzidxmax = comp;
6117 #if defined(DEBUGF5) || defined(DEBUGF51)
6118  PrintS("------------- GENERATING SYZ RULES NEW ---------------\n");
6119 #endif
6120  i = 1;
6121  j = 0;
6122  /************************************************************
6123  * generating the leading terms of the principal syzygies
6124  ***********************************************************/
6125  while (i <= strat->sl)
6126  {
6127  /**********************************************************
6128  * principal syzygies start with component index 2
6129  * the array syzIdx starts with index 0
6130  * => the rules for a signature with component comp start
6131  * at strat->syz[strat->syzIdx[comp-2]] !
6132  *********************************************************/
6133  if (pGetComp(strat->sig[i-1]) != pGetComp(strat->sig[i]))
6134  {
6135  comp = pGetComp(strat->sig[i]);
6136  comp_old = pGetComp(strat->sig[i-1]);
6137  diff = comp - comp_old - 1;
6138  // diff should be zero, but sometimes also the initial generating
6139  // elements of the input ideal reduce to zero. then there is an
6140  // index-gap between the signatures. for these inbetween signatures we
6141  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6142  // in the following.
6143  // doing this, we keep the relation "j = comp - 2" alive, which makes
6144  // jumps way easier when checking criteria
6145  while (diff>0)
6146  {
6147  strat->syzIdx[j] = 0;
6148  diff--;
6149  j++;
6150  }
6151  strat->syzIdx[j] = ctr;
6152  j++;
6153  LObject Q;
6154  int pos;
6155  for (k = 0; k<i; k++)
6156  {
6157  Q.sig = pOne();
6158  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6159  p_SetCompP (Q.sig, comp, currRing);
6160  poly q = p_One(currRing);
6161  p_ExpVectorCopy(q,strat->S[i],currRing);
6162  q = p_Neg (q, currRing);
6163  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6164  Q.sig = p_Add_q (Q.sig, q, currRing);
6165  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6166  pos = posInSyz(strat, Q.sig);
6167  enterSyz(Q, strat, pos);
6168  ctr++;
6169  }
6170  }
6171  i++;
6172  }
6173  /**************************************************************
6174  * add syzygies for upcoming first element of new iteration step
6175  **************************************************************/
6176  comp = strat->currIdx;
6177  comp_old = pGetComp(strat->sig[i-1]);
6178  diff = comp - comp_old - 1;
6179  // diff should be zero, but sometimes also the initial generating
6180  // elements of the input ideal reduce to zero. then there is an
6181  // index-gap between the signatures. for these inbetween signatures we
6182  // can safely set syzIdx[j] = 0 as no such element will be ever computed
6183  // in the following.
6184  // doing this, we keep the relation "j = comp - 2" alive, which makes
6185  // jumps way easier when checking criteria
6186  while (diff>0)
6187  {
6188  strat->syzIdx[j] = 0;
6189  diff--;
6190  j++;
6191  }
6192  strat->syzIdx[j] = ctr;
6193  LObject Q;
6194  int pos;
6195  for (k = 0; k<strat->sl+1; k++)
6196  {
6197  Q.sig = pOne();
6198  p_ExpVectorCopy(Q.sig,strat->S[k],currRing);
6199  p_SetCompP (Q.sig, comp, currRing);
6200  poly q = p_One(currRing);
6201  p_ExpVectorCopy(q,strat->L[strat->Ll].p,currRing);
6202  q = p_Neg (q, currRing);
6203  p_SetCompP (q, p_GetComp(strat->sig[k], currRing), currRing);
6204  Q.sig = p_Add_q (Q.sig, q, currRing);
6205  Q.sevSig = p_GetShortExpVector(Q.sig,currRing);
6206  pos = posInSyz(strat, Q.sig);
6207  enterSyz(Q, strat, pos);
6208  ctr++;
6209  }
6210 //#if 1
6211 #ifdef DEBUGF5
6212  PrintS("Principal syzygies:\n");
6213  Print("syzl %d\n",strat->syzl);
6214  Print("syzmax %d\n",strat->syzmax);
6215  Print("ps %d\n",ps);
6216  PrintS("--------------------------------\n");
6217  for(i=0;i<=strat->syzl-1;i++)
6218  {
6219  Print("%d - ",i);
6220  pWrite(strat->syz[i]);
6221  }
6222  for(i=0;i<strat->currIdx;i++)
6223  {
6224  Print("%d - %d\n",i,strat->syzIdx[i]);
6225  }
6226  PrintS("--------------------------------\n");
6227 #endif
6228  }
6229 }
polyset sig
Definition: kutil.h:306
static gmp_float * diff
Definition: mpr_complex.cc:47
#define Print
Definition: emacs.cc:83
int syzmax
Definition: kutil.h:352
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
void enterSyz(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7240
#define p_GetComp(p, r)
Definition: monomials.h:72
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
#define Q
Definition: sirandom.c:25
static unsigned long * initsevS(const int maxnr)
Definition: kutil.cc:461
#define omAlloc(size)
Definition: omAllocDecl.h:210
unsigned long currIdx
Definition: kutil.h:315
#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:12
static void p_SetCompP(poly p, int i, ring r)
Definition: p_polys.h:243
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
static void p_ExpVectorCopy(poly d_p, poly s_p, const ring r)
Definition: p_polys.h:1241
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define pOne()
Definition: polys.h:286
polyset S
Definition: kutil.h:304
LSet L
Definition: kutil.h:325
int posInSyz(const kStrategy strat, poly sig)
Definition: kutil.cc:4624
int syzidxmax
Definition: kutil.h:352
unsigned long * sevSyz
Definition: kutil.h:321
polyset syz
Definition: kutil.h:305
static intset initec(const int maxnr)
Definition: kutil.cc:456
int sl
Definition: kutil.h:351
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1018
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
int syzl
Definition: kutil.h:352
intset syzIdx
Definition: kutil.h:311
BOOLEAN isInPairsetB ( poly  q,
int k,
kStrategy  strat 
)

Definition at line 588 of file kutil.cc.

589 {
590  LObject *p=&(strat->B[strat->Bl]);
591 
592  *k = strat->Bl;
593  loop
594  {
595  if ((*k) < 0) return FALSE;
596  if (q == (*p).p1)
597  return TRUE;
598  (*k)--;
599  p--;
600  }
601 }
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
int Bl
Definition: kutil.h:355
#define TRUE
Definition: auxiliary.h:144
int k
Definition: cfEzgcd.cc:93
LSet B
Definition: kutil.h:326
BOOLEAN isInPairsetL ( int  length,
poly  p1,
poly  p2,
int k,
kStrategy  strat 
)

Definition at line 567 of file kutil.cc.

568 {
569  LObject *p=&(strat->L[length]);
570 
571  *k = length;
572  loop
573  {
574  if ((*k) < 0) return FALSE;
575  if (((p1 == (*p).p1) && (p2 == (*p).p2))
576  || ((p1 == (*p).p2) && (p2 == (*p).p1)))
577  return TRUE;
578  (*k)--;
579  p--;
580  }
581 }
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
int k
Definition: cfEzgcd.cc:93
LSet L
Definition: kutil.h:325
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
BOOLEAN kCheckSpolyCreation ( LObject L,
kStrategy  strat,
poly m1,
poly m2 
)

Definition at line 8176 of file kutil.cc.

8177 {
8178  if (strat->overflow) return FALSE;
8179  assume(L->p1 != NULL && L->p2 != NULL);
8180  // shift changes: from 0 to -1
8181  assume(L->i_r1 >= -1 && L->i_r1 <= strat->tl);
8182  assume(L->i_r2 >= -1 && L->i_r2 <= strat->tl);
8183  assume(strat->tailRing != currRing);
8184 
8185  if (! k_GetLeadTerms(L->p1, L->p2, currRing, m1, m2, strat->tailRing))
8186  return FALSE;
8187  // shift changes: extra case inserted
8188  if ((L->i_r1 == -1) || (L->i_r2 == -1) )
8189  {
8190  return TRUE;
8191  }
8192  poly p1_max = (strat->R[L->i_r1])->max;
8193  poly p2_max = (strat->R[L->i_r2])->max;
8194 
8195  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
8196  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
8197  {
8198  p_LmFree(m1, strat->tailRing);
8199  p_LmFree(m2, strat->tailRing);
8200  m1 = NULL;
8201  m2 = NULL;
8202  return FALSE;
8203  }
8204  return TRUE;
8205 }
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:964
#define FALSE
Definition: auxiliary.h:140
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1818
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
static int max(int a, int b)
Definition: fast_mult.cc:264
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:340
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
char overflow
Definition: kutil.h:399
BOOLEAN kCheckStrongCreation ( int  atR,
poly  m1,
int  atS,
poly  m2,
kStrategy  strat 
)

Definition at line 8214 of file kutil.cc.

8215 {
8216  assume(strat->S_2_R[atS] >= -1 && strat->S_2_R[atS] <= strat->tl);
8217  //assume(strat->tailRing != currRing);
8218 
8219  poly p1_max = (strat->R[atR])->max;
8220  poly p2_max = (strat->R[strat->S_2_R[atS]])->max;
8221 
8222  if (((p1_max != NULL) && !p_LmExpVectorAddIsOk(m1, p1_max, strat->tailRing)) ||
8223  ((p2_max != NULL) && !p_LmExpVectorAddIsOk(m2, p2_max, strat->tailRing)))
8224  {
8225  return FALSE;
8226  }
8227  return TRUE;
8228 }
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
static BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2, const ring r)
Definition: p_polys.h:1818
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
static int max(int a, int b)
Definition: fast_mult.cc:264
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
TObject ** R
Definition: kutil.h:340
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
poly kCreateZeroPoly ( long  exp[],
long  cabsind,
poly t_p,
ring  leadRing,
ring  tailRing 
)

Definition at line 3256 of file kutil.cc.

3257 {
3258 
3259  poly zeroPoly = NULL;
3260 
3261  number tmp1;
3262  poly tmp2, tmp3;
3263 
3264  if (cabsind == -1)
3265  {
3266  cabsind = 0;
3267  for (int i = 1; i <= leadRing->N; i++)
3268  {
3269  cabsind += ind_fact_2(exp[i]);
3270  }
3271 // Print("cabsind: %d\n", cabsind);
3272  }
3273  if (cabsind < leadRing->ch)
3274  {
3275  zeroPoly = p_ISet(twoPow(leadRing->ch - cabsind), tailRing);
3276  }
3277  else
3278  {
3279  zeroPoly = p_ISet(1, tailRing);
3280  }
3281  for (int i = 1; i <= leadRing->N; i++)
3282  {
3283  for (long j = 1; j <= exp[i]; j++)
3284  {
3285  tmp1 = nInit(j);
3286  tmp2 = p_ISet(1, tailRing);
3287  p_SetExp(tmp2, i, 1, tailRing);
3288  p_Setm(tmp2, tailRing);
3289  if (nIsZero(tmp1))
3290  { // should nowbe obsolet, test ! TODO OLIVER
3291  zeroPoly = p_Mult_q(zeroPoly, tmp2, tailRing);
3292  }
3293  else
3294  {
3295  tmp3 = p_NSet(nCopy(tmp1), tailRing);
3296  zeroPoly = p_Mult_q(zeroPoly, p_Add_q(tmp3, tmp2, tailRing), tailRing);
3297  }
3298  }
3299  }
3300  tmp2 = p_NSet(nCopy(pGetCoeff(zeroPoly)), leadRing);
3301  for (int i = 1; i <= leadRing->N; i++)
3302  {
3303  pSetExp(tmp2, i, p_GetExp(zeroPoly, i, tailRing));
3304  }
3305  p_Setm(tmp2, leadRing);
3306  *t_p = zeroPoly;
3307  zeroPoly = pNext(zeroPoly);
3308  pNext(*t_p) = NULL;
3309  pNext(tmp2) = zeroPoly;
3310  return tmp2;
3311 }
#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:1448
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:3063
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:465
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
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:484
#define nIsZero(n)
Definition: numbers.h:19
#define NULL
Definition: omList.c:10
long ind_fact_2(long arg)
Definition: kutil.cc:3048
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:436
p exp[i]
Definition: DebugPrint.cc:39
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:884
#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:1302
static poly p_Mult_q(poly p, poly q, const ring r)
Definition: p_polys.h:1025
void kDebugPrint ( kStrategy  strat)

Output some debug info about a given strategy.

Definition at line 8780 of file kutil.cc.

8781 {
8782  PrintS("red: ");
8783  if (strat->red==redFirst) PrintS("redFirst\n");
8784  else if (strat->red==redHoney) PrintS("redHoney\n");
8785  else if (strat->red==redEcart) PrintS("redEcart\n");
8786  else if (strat->red==redHomog) PrintS("redHomog\n");
8787  else Print("%p\n",(void*)strat->red);
8788  PrintS("posInT: ");
8789  if (strat->posInT==posInT0) PrintS("posInT0\n");
8790  else if (strat->posInT==posInT1) PrintS("posInT1\n");
8791  else if (strat->posInT==posInT11) PrintS("posInT11\n");
8792  else if (strat->posInT==posInT110) PrintS("posInT110\n");
8793  else if (strat->posInT==posInT13) PrintS("posInT13\n");
8794  else if (strat->posInT==posInT15) PrintS("posInT15\n");
8795  else if (strat->posInT==posInT17) PrintS("posInT17\n");
8796  else if (strat->posInT==posInT17_c) PrintS("posInT17_c\n");
8797  else if (strat->posInT==posInT19) PrintS("posInT19\n");
8798  else if (strat->posInT==posInT2) PrintS("posInT2\n");
8799 #ifdef HAVE_MORE_POS_IN_T
8800  else if (strat->posInT==posInT_EcartFDegpLength) PrintS("posInT_EcartFDegpLength\n");
8801  else if (strat->posInT==posInT_FDegpLength) PrintS("posInT_FDegpLength\n");
8802  else if (strat->posInT==posInT_pLength) PrintS("posInT_pLength\n");
8803 #endif
8804  else if (strat->posInT==posInT_EcartpLength) PrintS("posInT_EcartpLength\n");
8805  else if (strat->posInT==posInTrg0) PrintS("posInTrg0\n");
8806  else Print("%p\n",(void*)strat->posInT);
8807  PrintS("posInL: ");
8808  if (strat->posInL==posInL0) PrintS("posInL0\n");
8809  else if (strat->posInL==posInL10) PrintS("posInL10\n");
8810  else if (strat->posInL==posInL11) PrintS("posInL11\n");
8811  else if (strat->posInL==posInL110) PrintS("posInL110\n");
8812  else if (strat->posInL==posInL13) PrintS("posInL13\n");
8813  else if (strat->posInL==posInL15) PrintS("posInL15\n");
8814  else if (strat->posInL==posInL17) PrintS("posInL17\n");
8815  else if (strat->posInL==posInL17_c) PrintS("posInL17_c\n");
8816  else if (strat->posInL==posInLSpecial) PrintS("posInLSpecial\n");
8817  else if (strat->posInL==posInLrg0) PrintS("posInLrg0\n");
8818  else Print("%p\n",(void*)strat->posInL);
8819  PrintS("enterS: ");
8820  if (strat->enterS==enterSBba) PrintS("enterSBba\n");
8821  else if (strat->enterS==enterSMora) PrintS("enterSMora\n");
8822  else if (strat->enterS==enterSMoraNF) PrintS("enterSMoraNF\n");
8823  else Print("%p\n",(void*)strat->enterS);
8824  PrintS("initEcart: ");
8825  if (strat->initEcart==initEcartBBA) PrintS("initEcartBBA\n");
8826  else if (strat->initEcart==initEcartNormal) PrintS("initEcartNormal\n");
8827  else Print("%p\n",(void*)strat->initEcart);
8828  PrintS("initEcartPair: ");
8829  if (strat->initEcartPair==initEcartPairBba) PrintS("initEcartPairBba\n");
8830  else if (strat->initEcartPair==initEcartPairMora) PrintS("initEcartPairMora\n");
8831  else Print("%p\n",(void*)strat->initEcartPair);
8832  Print("homog=%d, LazyDegree=%d, LazyPass=%d, ak=%d,\n",
8833  strat->homog, strat->LazyDegree,strat->LazyPass, strat->ak);
8834  Print("honey=%d, sugarCrit=%d, Gebauer=%d, noTailReduction=%d, use_buckets=%d\n",
8835  strat->honey,strat->sugarCrit,strat->Gebauer,strat->noTailReduction,strat->use_buckets);
8836  Print("posInLDependsOnLength=%d\n",
8837  strat->posInLDependsOnLength);
8838  PrintS(showOption());PrintLn();
8839  PrintS("LDeg: ");
8840  if (currRing->pLDeg==pLDeg0) PrintS("pLDeg0");
8841  else if (currRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
8842  else if (currRing->pLDeg==pLDegb) PrintS("pLDegb");
8843  else if (currRing->pLDeg==pLDeg1) PrintS("pLDeg1");
8844  else if (currRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
8845  else if (currRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
8846  else if (currRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
8847  else if (currRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
8848  else if (currRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
8849  else if (currRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
8850  else if (currRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
8851  else if (currRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
8852  else Print("? (%lx)", (long)currRing->pLDeg);
8853  PrintS(" / ");
8854  if (strat->tailRing->pLDeg==pLDeg0) PrintS("pLDeg0");
8855  else if (strat->tailRing->pLDeg==pLDeg0c) PrintS("pLDeg0c");
8856  else if (strat->tailRing->pLDeg==pLDegb) PrintS("pLDegb");
8857  else if (strat->tailRing->pLDeg==pLDeg1) PrintS("pLDeg1");
8858  else if (strat->tailRing->pLDeg==pLDeg1c) PrintS("pLDeg1c");
8859  else if (strat->tailRing->pLDeg==pLDeg1_Deg) PrintS("pLDeg1_Deg");
8860  else if (strat->tailRing->pLDeg==pLDeg1c_Deg) PrintS("pLDeg1c_Deg");
8861  else if (strat->tailRing->pLDeg==pLDeg1_Totaldegree) PrintS("pLDeg1_Totaldegree");
8862  else if (strat->tailRing->pLDeg==pLDeg1c_Totaldegree) PrintS("pLDeg1c_Totaldegree");
8863  else if (strat->tailRing->pLDeg==pLDeg1_WFirstTotalDegree) PrintS("pLDeg1_WFirstTotalDegree");
8864  else if (strat->tailRing->pLDeg==pLDeg1c_WFirstTotalDegree) PrintS("pLDeg1c_WFirstTotalDegree");
8865  else if (strat->tailRing->pLDeg==maxdegreeWecart) PrintS("maxdegreeWecart");
8866  else Print("? (%lx)", (long)strat->tailRing->pLDeg);
8867  PrintLn();
8868  PrintS("currRing->pFDeg: ");
8869  if (currRing->pFDeg==p_Totaldegree) PrintS("p_Totaldegree");
8870  else if (currRing->pFDeg==p_WFirstTotalDegree) PrintS("pWFirstTotalDegree");
8871  else if (currRing->pFDeg==p_Deg) PrintS("p_Deg");
8872  else if (currRing->pFDeg==kHomModDeg) PrintS("kHomModDeg");
8873  else if (currRing->pFDeg==totaldegreeWecart) PrintS("totaldegreeWecart");
8874  else if (currRing->pFDeg==p_WTotaldegree) PrintS("p_WTotaldegree");
8875  else Print("? (%lx)", (long)currRing->pFDeg);
8876  PrintLn();
8877  Print(" syzring:%d, syzComp(strat):%d limit:%d\n",rIsSyzIndexRing(currRing),strat->syzComp,rGetCurrSyzLimit(currRing));
8878  if(TEST_OPT_DEGBOUND)
8879  Print(" degBound: %d\n", Kstd1_deg);
8880 
8881  if( ecartWeights != NULL )
8882  {
8883  PrintS("ecartWeights: ");
8884  for (int i = rVar(currRing); i > 0; i--)
8885  Print("%hd ", ecartWeights[i]);
8886  PrintLn();
8888  }
8889 
8890 #ifndef SING_NDEBUG
8892 #endif
8893 }
void initEcartPairBba(LObject *Lp, poly, poly, int, int)
Definition: kutil.cc:1140
int posInL11(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4664
int posInT_pLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8746
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
int posInTrg0(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4091
BOOLEAN honey
Definition: kutil.h:371
int posInL17(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4957
void PrintLn()
Definition: reporter.cc:322
int posInT2(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4004
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:357
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
#define TEST_OPT_DEGBOUND
Definition: options.h:108
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
BOOLEAN noTailReduction
Definition: kutil.h:372
int posInT1(const TSet set, const int length, LObject &p)
Definition: kutil.cc:3976
long totaldegreeWecart(poly p, ring r)
Definition: weight.cc:225
int posInLrg0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4734
short * ecartWeights
Definition: weight0.c:32
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:705
int posInL15(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4899
static int rGetCurrSyzLimit(const ring r)
Definition: ring.h:708
void enterSMora(LObject p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1215
int posInL13(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4864
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void(* initEcartPair)(LObject *h, poly f, poly g, int ecartF, int ecartG)
Definition: kutil.h:286
int ak
Definition: kutil.h:356
char * showOption()
Definition: misc_ip.cc:726
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
int posInT15(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4281
int(* red)(LObject *L, kStrategy strat)
Definition: kutil.h:277
int redHomog(LObject *h, kStrategy strat)
Definition: kstd2.cc:406
int(* posInT)(const TSet T, const int tl, LObject &h)
Definition: kutil.h:280
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int posInT0(const TSet, const int length, LObject &)
Definition: kutil.cc:3965
void rDebugPrint(ring r)
Definition: ring.cc:3971
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
int redHoney(LObject *h, kStrategy strat)
Definition: kstd2.cc:1004
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int posInT11(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4034
int posInT17_c(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4403
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
BOOLEAN homog
Definition: kutil.h:366
void initEcartPairMora(LObject *Lp, poly, poly, int ecartF, int ecartG)
Definition: kutil.cc:1147
BOOLEAN Gebauer
Definition: kutil.h:372
#define assume(x)
Definition: mod2.h:405
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void initEcartBBA(TObject *h)
Definition: kutil.cc:1133
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
long kHomModDeg(poly p, ring r)
Definition: kstd1.cc:2054
int posInL0(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4568
int posInL17_c(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:5005
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
int posInT17(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4339
BOOLEAN sugarCrit
Definition: kutil.h:371
int Kstd1_deg
Definition: kutil.cc:228
int posInT_EcartFDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8655
#define TEST_OPT_WEIGHTM
Definition: options.h:115
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:810
#define NULL
Definition: omList.c:10
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
int redEcart(LObject *h, kStrategy strat)
Definition: kstd1.cc:176
ring tailRing
Definition: kutil.h:343
int posInT110(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4167
void enterSMoraNF(LObject p, int atS, kStrategy strat, int atR=-1)
Definition: kstd1.cc:1269
long maxdegreeWecart(poly p, int *l, ring r)
Definition: weight.cc:255
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1037
int redFirst(LObject *h, kStrategy strat)
Definition: kstd1.cc:574
int posInLSpecial(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4525
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
BOOLEAN use_buckets
Definition: kutil.h:377
int posInT19(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4468
void initEcartNormal(TObject *h)
Definition: kutil.cc:1125
void enterSBba(LObject p, int atS, kStrategy strat, int atR)
Definition: kutil.cc:6927
int LazyPass
Definition: kutil.h:356
int posInT_FDegpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:8709
void(* enterS)(LObject h, int pos, kStrategy strat, int atR)
Definition: kutil.h:285
int posInT_EcartpLength(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4242
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:947
int LazyDegree
Definition: kutil.h:356
int posInT13(const TSet set, const int length, LObject &p)
Definition: kutil.cc:4213
TObject* kFindDivisibleByInS ( kStrategy  strat,
int  pos,
LObject L,
TObject T,
long  ecart 
)

Definition at line 5267 of file kutil.cc.

5269 {
5270  int j = 0;
5271  const unsigned long not_sev = ~L->sev;
5272  const unsigned long* sev = strat->sevS;
5273  poly p;
5274  ring r;
5275  L->GetLm(p, r);
5276 
5277  assume(~not_sev == p_GetShortExpVector(p, r));
5278 
5279  if (r == currRing)
5280  {
5281  loop
5282  {
5283  if (j > pos) return NULL;
5284 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5285  if (p_LmShortDivisibleBy(strat->S[j], sev[j], p, not_sev, r) &&
5286  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5287  break;
5288 #else
5289  if (!(sev[j] & not_sev) &&
5290  (ecart== LONG_MAX || ecart>= strat->ecartS[j]) &&
5291  p_LmDivisibleBy(strat->S[j], p, r))
5292  break;
5293 
5294 #endif
5295  j++;
5296  }
5297  // if called from NF, T objects do not exist:
5298  if (strat->tl < 0 || strat->S_2_R[j] == -1)
5299  {
5300  T->Set(strat->S[j], r, strat->tailRing);
5301  return T;
5302  }
5303  else
5304  {
5305 ///// assume (j >= 0 && j <= strat->tl && strat->S_2_T(j) != NULL
5306 ///// && strat->S_2_T(j)->p == strat->S[j]); // wrong?
5307 // assume (j >= 0 && j <= strat->sl && strat->S_2_T(j) != NULL && strat->S_2_T(j)->p == strat->S[j]);
5308  return strat->S_2_T(j);
5309  }
5310  }
5311  else
5312  {
5313  TObject* t;
5314  loop
5315  {
5316  if (j > pos) return NULL;
5317  assume(strat->S_2_R[j] != -1);
5318 #if defined(PDEBUG) || defined(PDIV_DEBUG)
5319  t = strat->S_2_T(j);
5320  assume(t != NULL && t->t_p != NULL && t->tailRing == r);
5321  if (p_LmShortDivisibleBy(t->t_p, sev[j], p, not_sev, r) &&
5322  (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5323  return t;
5324 #else
5325  if (! (sev[j] & not_sev) && (ecart== LONG_MAX || ecart>= strat->ecartS[j]))
5326  {
5327  t = strat->S_2_T(j);
5328  assume(t != NULL && t->t_p != NULL && t->tailRing == r && t->p == strat->S[j]);
5329  if (p_LmDivisibleBy(t->t_p, p, r)) return t;
5330  }
5331 #endif
5332  j++;
5333  }
5334  }
5335 }
loop
Definition: myNF.cc:98
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int tl
Definition: kutil.h:353
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
const ring r
Definition: syzextra.cc:208
KINLINE TObject * S_2_T(int i)
Definition: kInline.h:35
int j
Definition: myNF.cc:70
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
polyset S
Definition: kutil.h:304
static BOOLEAN p_LmDivisibleBy(poly a, poly b, const ring r)
Definition: p_polys.h:1673
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
unsigned long * sevS
Definition: kutil.h:320
static jList * T
Definition: janet.cc:37
class sTObject TObject
Definition: kutil.h:57
int kFindInT ( poly  p,
TSet  T,
int  tlength 
)

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

Definition at line 603 of file kutil.cc.

604 {
605  int i;
606 
607  for (i=0; i<=tlength; i++)
608  {
609  if (T[i].p == p) return i;
610  }
611  return -1;
612 }
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
static jList * T
Definition: janet.cc:37
int kFindInT ( poly  p,
kStrategy  strat 
)

Definition at line 614 of file kutil.cc.

615 {
616  int i;
617  do
618  {
619  i = kFindInT(p, strat->T, strat->tl);
620  if (i >= 0) return i;
621  strat = strat->next;
622  }
623  while (strat != NULL);
624  return -1;
625 }
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:603
int tl
Definition: kutil.h:353
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
TSet T
Definition: kutil.h:324
kStrategy next
Definition: kutil.h:276
void kMergeBintoL ( kStrategy  strat)

Definition at line 2140 of file kutil.cc.

2141 {
2142  int j=strat->Ll+strat->Bl+1;
2143  if (j>strat->Lmax)
2144  {
2145  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
2146  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
2147  j*sizeof(LObject));
2148  strat->Lmax=j;
2149  }
2150  j = strat->Ll;
2151  int i;
2152  for (i=strat->Bl; i>=0; i--)
2153  {
2154  j = strat->posInL(strat->L,j,&(strat->B[i]),strat);
2155  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
2156  }
2157  strat->Bl = -1;
2158 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int Bl
Definition: kutil.h:355
#define setmaxLinc
Definition: kutil.h:28
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
int j
Definition: myNF.cc:70
LObject * LSet
Definition: kutil.h:60
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:325
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
void kMergeBintoLSba ( kStrategy  strat)

Definition at line 2163 of file kutil.cc.

2164 {
2165  int j=strat->Ll+strat->Bl+1;
2166  if (j>strat->Lmax)
2167  {
2168  j=((j+setmaxLinc-1)/setmaxLinc)*setmaxLinc;
2169  strat->L = (LSet)omReallocSize(strat->L,strat->Lmax*sizeof(LObject),
2170  j*sizeof(LObject));
2171  strat->Lmax=j;
2172  }
2173  j = strat->Ll;
2174  int i;
2175  for (i=strat->Bl; i>=0; i--)
2176  {
2177  j = strat->posInLSba(strat->L,j,&(strat->B[i]),strat);
2178  enterL(&strat->L,&strat->Ll,&strat->Lmax,strat->B[i],j);
2179  }
2180  strat->Bl = -1;
2181 }
class sLObject LObject
Definition: kutil.h:58
int Ll
Definition: kutil.h:354
int(* posInLSba)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:281
int Bl
Definition: kutil.h:355
#define setmaxLinc
Definition: kutil.h:28
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
int j
Definition: myNF.cc:70
LObject * LSet
Definition: kutil.h:60
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:325
LSet B
Definition: kutil.h:326
int Lmax
Definition: kutil.h:354
BOOLEAN kPosInLDependsOnLength ( int(*)(const LSet set, const int length, LObject *L, const kStrategy strat pos_in_l)

Definition at line 7455 of file kutil.cc.

7458 {
7459  if (pos_in_l == posInL110 ||
7460  pos_in_l == posInL10)
7461  return TRUE;
7462 
7463  return FALSE;
7464 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int posInL110(const LSet set, const int length, LObject *p, const kStrategy)
Definition: kutil.cc:4818
int posInL10(const LSet set, const int length, LObject *p, const kStrategy strat)
Definition: kstd1.cc:947
BOOLEAN kStratChangeTailRing ( kStrategy  strat,
LObject L,
TObject T,
unsigned long  expbound 
)

Definition at line 8231 of file kutil.cc.

8232 {
8233  assume((strat->tailRing == currRing) || (strat->tailRing->bitmask < currRing->bitmask));
8234  /* initial setup or extending */
8235 
8236  if (expbound == 0) expbound = strat->tailRing->bitmask << 1;
8237  if (expbound >= currRing->bitmask) return FALSE;
8238  strat->overflow=FALSE;
8239  ring new_tailRing = rModifyRing(currRing,
8240  // Hmmm .. the condition pFDeg == p_Deg
8241  // might be too strong
8242 #ifdef HAVE_RINGS
8243  (strat->homog && currRing->pFDeg == p_Deg && !(rField_is_Ring(currRing))), // TODO Oliver
8244 #else
8245  (strat->homog && currRing->pFDeg == p_Deg), // omit_degree
8246 #endif
8247  (strat->ak==0), // omit_comp if the input is an ideal
8248  expbound); // exp_limit
8249 
8250  if (new_tailRing == currRing) return TRUE;
8251 
8252  strat->pOrigFDeg_TailRing = new_tailRing->pFDeg;
8253  strat->pOrigLDeg_TailRing = new_tailRing->pLDeg;
8254 
8255  if (currRing->pFDeg != currRing->pFDegOrig)
8256  {
8257  new_tailRing->pFDeg = currRing->pFDeg;
8258  new_tailRing->pLDeg = currRing->pLDeg;
8259  }
8260 
8261  if (TEST_OPT_PROT)
8262  Print("[%lu:%d", (unsigned long) new_tailRing->bitmask, new_tailRing->ExpL_Size);
8263  kTest_TS(strat);
8264  assume(new_tailRing != strat->tailRing);
8265  pShallowCopyDeleteProc p_shallow_copy_delete
8266  = pGetShallowCopyDeleteProc(strat->tailRing, new_tailRing);
8267 
8268  omBin new_tailBin = omGetStickyBinOfBin(new_tailRing->PolyBin);
8269 
8270  int i;
8271  for (i=0; i<=strat->tl; i++)
8272  {
8273  strat->T[i].ShallowCopyDelete(new_tailRing, new_tailBin,
8274  p_shallow_copy_delete);
8275  }
8276  for (i=0; i<=strat->Ll; i++)
8277  {
8278  assume(strat->L[i].p != NULL);
8279  if (pNext(strat->L[i].p) != strat->tail)
8280  strat->L[i].ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8281  }
8282  if ((strat->P.t_p != NULL) ||
8283  ((strat->P.p != NULL) && pNext(strat->P.p) != strat->tail))
8284  strat->P.ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8285 
8286  if ((L != NULL) && (L->tailRing != new_tailRing))
8287  {
8288  if (L->i_r < 0)
8289  L->ShallowCopyDelete(new_tailRing, p_shallow_copy_delete);
8290  else
8291  {
8292  assume(L->i_r <= strat->tl);
8293  TObject* t_l = strat->R[L->i_r];
8294  assume(t_l != NULL);
8295  L->tailRing = new_tailRing;
8296  L->p = t_l->p;
8297  L->t_p = t_l->t_p;
8298  L->max = t_l->max;
8299  }
8300  }
8301 
8302  if ((T != NULL) && (T->tailRing != new_tailRing && T->i_r < 0))
8303  T->ShallowCopyDelete(new_tailRing, new_tailBin, p_shallow_copy_delete);
8304 
8305  omMergeStickyBinIntoBin(strat->tailBin, strat->tailRing->PolyBin);
8306  if (strat->tailRing != currRing)
8307  rKillModifiedRing(strat->tailRing);
8308 
8309  strat->tailRing = new_tailRing;
8310  strat->tailBin = new_tailBin;
8311  strat->p_shallow_copy_delete
8312  = pGetShallowCopyDeleteProc(currRing, new_tailRing);
8313 
8314  if (strat->kHEdge != NULL)
8315  {
8316  if (strat->t_kHEdge != NULL)
8317  p_LmFree(strat->t_kHEdge, strat->tailRing);
8318  strat->t_kHEdge=k_LmInit_currRing_2_tailRing(strat->kHEdge, new_tailRing);
8319  }
8320 
8321  if (strat->kNoether != NULL)
8322  {
8323  if (strat->t_kNoether != NULL)
8324  p_LmFree(strat->t_kNoether, strat->tailRing);
8326  new_tailRing);
8327  }
8328  kTest_TS(strat);
8329  if (TEST_OPT_PROT)
8330  PrintS("]");
8331  return TRUE;
8332 }
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:327
pLDegProc pOrigLDeg_TailRing
Definition: kutil.h:298
#define TEST_OPT_PROT
Definition: options.h:98
int Ll
Definition: kutil.h:354
#define FALSE
Definition: auxiliary.h:140
poly kNoether
Definition: kutil.h:328
int tl
Definition: kutil.h:353
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2557
#define TRUE
Definition: auxiliary.h:144
pShallowCopyDeleteProc p_shallow_copy_delete
Definition: kutil.h:338
int ak
Definition: kutil.h:356
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
pShallowCopyDeleteProc pGetShallowCopyDeleteProc(ring, ring)
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
KINLINE poly k_LmInit_currRing_2_tailRing(poly p, ring tailRing, omBin tailBin)
Definition: kInline.h:905
BOOLEAN homog
Definition: kutil.h:366
#define kTest_TS(A)
Definition: kutil.h:616
#define assume(x)
Definition: mod2.h:405
LObject P
Definition: kutil.h:300
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
poly tail
Definition: kutil.h:334
TObject ** R
Definition: kutil.h:340
omBin omGetStickyBinOfBin(omBin bin)
Definition: omBin.c:373
poly t_kHEdge
Definition: kutil.h:329
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:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
poly t_kNoether
Definition: kutil.h:331
omBin tailBin
Definition: kutil.h:345
char overflow
Definition: kutil.h:399
#define pNext(p)
Definition: monomials.h:43
void rKillModifiedRing(ring r)
Definition: ring.cc:2923
TSet T
Definition: kutil.h:324
static jList * T
Definition: janet.cc:37
pFDegProc pOrigFDeg_TailRing
Definition: kutil.h:297
class sTObject TObject
Definition: kutil.h:57
void kStratInitChangeTailRing ( kStrategy  strat)

Definition at line 8334 of file kutil.cc.

8335 {
8336  unsigned long l = 0;
8337  int i;
8338  long e;
8339 
8340  assume(strat->tailRing == currRing);
8341 
8342  for (i=0; i<= strat->Ll; i++)
8343  {
8344  l = p_GetMaxExpL(strat->L[i].p, currRing, l);
8345  }
8346  for (i=0; i<=strat->tl; i++)
8347  {
8348  // Hmm ... this we could do in one Step
8349  l = p_GetMaxExpL(strat->T[i].p, currRing, l);
8350  }
8351  if (rField_is_Ring(currRing))
8352  {
8353  l *= 2;
8354  }
8355  e = p_GetMaxExp(l, currRing);
8356  if (e <= 1) e = 2;
8357 
8358  kStratChangeTailRing(strat, NULL, NULL, e);
8359 }
unsigned long p_GetMaxExpL(poly p, const ring r, unsigned long l_max)
return the maximal exponent of p in form of the maximal long var
Definition: p_polys.cc:1174
int Ll
Definition: kutil.h:354
static unsigned long p_GetMaxExp(const unsigned long l, const ring r)
Definition: p_polys.h:743
int tl
Definition: kutil.h:353
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
int i
Definition: cfEzgcd.cc:123
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
TSet T
Definition: kutil.h:324
int l
Definition: cfEzgcd.cc:94
void message ( int  i,
int reduc,
int olddeg,
kStrategy  strat,
int  red_result 
)

Definition at line 5628 of file kutil.cc.

5629 {
5630  if (i != *olddeg)
5631  {
5632  Print("%d",i);
5633  *olddeg = i;
5634  }
5635  if (TEST_OPT_OLDSTD)
5636  {
5637  if (strat->Ll != *reduc)
5638  {
5639  if (strat->Ll != *reduc-1)
5640  Print("(%d)",strat->Ll+1);
5641  else
5642  PrintS("-");
5643  *reduc = strat->Ll;
5644  }
5645  else
5646  PrintS(".");
5647  mflush();
5648  }
5649  else
5650  {
5651  if (red_result == 0)
5652  PrintS("-");
5653  else if (red_result < 0)
5654  PrintS(".");
5655  if ((red_result > 0) || ((strat->Ll % 100)==99))
5656  {
5657  if (strat->Ll != *reduc && strat->Ll > 0)
5658  {
5659  Print("(%d)",strat->Ll+1);
5660  *reduc = strat->Ll;
5661  }
5662  }
5663  }
5664 }
#define Print
Definition: emacs.cc:83
int Ll
Definition: kutil.h:354
#define mflush()
Definition: reporter.h:42
#define TEST_OPT_OLDSTD
Definition: options.h:117
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
void messageStat ( int  hilbcount,
kStrategy  strat 
)

Definition at line 5669 of file kutil.cc.

5670 {
5671  //PrintS("\nUsage/Allocation of temporary storage:\n");
5672  //Print("%d/%d polynomials in standard base\n",srmax,IDELEMS(Shdl));
5673  //Print("%d/%d polynomials in set L (for lazy alg.)",lrmax+1,strat->Lmax);
5674  Print("product criterion:%d chain criterion:%d\n",strat->cp,strat->c3);
5675  if (hilbcount!=0) Print("hilbert series criterion:%d\n",hilbcount);
5676  /* in usual case strat->cv is 0, it gets changed only in shift routines */
5677  if (strat->cv!=0) Print("shift V criterion:%d\n",strat->cv);
5678  /*mflush();*/
5679 }
#define Print
Definition: emacs.cc:83
int c3
Definition: kutil.h:349
int cv
Definition: kutil.h:350
int cp
Definition: kutil.h:349
BOOLEAN newHEdge ( kStrategy  strat)

Definition at line 8113 of file kutil.cc.

8114 {
8115  int i,j;
8116  poly newNoether;
8117 
8118 #if 0
8119  if (currRing->weight_all_1)
8120  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8121  else
8122  scComputeHCw(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8123 #else
8124  scComputeHC(strat->Shdl,NULL,strat->ak,strat->kHEdge, strat->tailRing);
8125 #endif
8126  if (strat->t_kHEdge != NULL) p_LmFree(strat->t_kHEdge, strat->tailRing);
8127  if (strat->tailRing != currRing)
8128  strat->t_kHEdge = k_LmInit_currRing_2_tailRing(strat->kHEdge, strat->tailRing);
8129  /* compare old and new noether*/
8130  newNoether = pLmInit(strat->kHEdge);
8131  j = p_FDeg(newNoether,currRing);
8132 /* #ifdef HAVE_RINGS
8133  if (!rField_is_Ring(currRing))
8134  #endif */
8135  for (i=1; i<=(currRing->N); i++)
8136  {
8137  if (pGetExp(newNoether, i) > 0) pDecrExp(newNoether,i);
8138  }
8139  pSetm(newNoether);
8140  if (j < strat->HCord) /*- statistics -*/
8141  {
8142  if (TEST_OPT_PROT)
8143  {
8144  Print("H(%d)",j);
8145  mflush();
8146  }
8147  strat->HCord=j;
8148  #ifdef KDEBUG
8149  if (TEST_OPT_DEBUG)
8150  {
8151  Print("H(%d):",j);
8152  wrp(strat->kHEdge);
8153  PrintLn();
8154  }
8155  #endif
8156  }
8157  if (pCmp(strat->kNoether,newNoether)!=1)
8158  {
8159  pDelete(&strat->kNoether);
8160  strat->kNoether=newNoether;
8161  if (strat->t_kNoether != NULL) p_LmFree(strat->t_kNoether, strat->tailRing);
8162  if (strat->tailRing != currRing)
8163  strat->t_kNoether = k_LmInit_currRing_2_tailRing(strat->kNoether, strat->tailRing);
8164 
8165  return TRUE;
8166  }
8167  pLmFree(newNoether);
8168  return FALSE;
8169 }
#define pSetm(p)
Definition: polys.h:241
int HCord
Definition: kutil.cc:227
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
poly kHEdge
Definition: kutil.h:327
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
#define pDecrExp(p, i)
Definition: polys.h:44
poly kNoether
Definition: kutil.h:328
void scComputeHC(ideal S, ideal Q, int ak, poly &hEdge, ring tailRing)
Definition: hdegree.cc:999
#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:144
int ak
Definition: kutil.h:356
#define TEST_OPT_DEBUG
Definition: options.h:103
static void p_LmFree(poly p, ring)
Definition: p_polys.h:679
int HCord
Definition: kutil.h:358
#define mflush()
Definition: reporter.h:42
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#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:905
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#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:369
int i
Definition: cfEzgcd.cc:123
poly t_kHEdge
Definition: kutil.h:329
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
poly t_kNoether
Definition: kutil.h:331
#define pDelete(p_ptr)
Definition: polys.h:157
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:281
ideal Shdl
Definition: kutil.h:301
int nextZeroSimplexExponent ( long  exp[],
long  ind[],
long  cexp[],
long  cind[],
long *  cabsind,
long  step[],
long  bound,
long  N 
)

Definition at line 3190 of file kutil.cc.

3192 {
3193  long add = ind2(cexp[1] + 2);
3194  if ((*cabsind < bound) && (*cabsind - step[1] + add < bound))
3195  {
3196  cexp[1] += 2;
3197  cind[1] += add;
3198  *cabsind += add;
3199  }
3200  else
3201  {
3202  // cabsind >= habsind
3203  if (N == 1) return 0;
3204  int i = 1;
3205  while (exp[i] == cexp[i] && i <= N) i++;
3206  cexp[i] = exp[i];
3207  *cabsind -= cind[i];
3208  cind[i] = ind[i];
3209  step[i] = 500000;
3210  *cabsind += cind[i];
3211  // Print("in: %d\n", *cabsind);
3212  i += 1;
3213  if (i > N) return 0;
3214  do
3215  {
3216  step[1] = 500000;
3217  for (int j = i + 1; j <= N; j++)
3218  {
3219  if (step[1] > step[j]) step[1] = step[j];
3220  }
3221  add = ind2(cexp[i] + 2);
3222  if (*cabsind - step[1] + add >= bound)
3223  {
3224  cexp[i] = exp[i];
3225  *cabsind -= cind[i];
3226  cind[i] = ind[i];
3227  *cabsind += cind[i];
3228  step[i] = 500000;
3229  i += 1;
3230  if (i > N) return 0;
3231  }
3232  else step[1] = -1;
3233  } while (step[1] != -1);
3234  step[1] = 500000;
3235  cexp[i] += 2;
3236  cind[i] += add;
3237  *cabsind += add;
3238  if (add < step[i]) step[i] = add;
3239  for (i = 2; i <= N; i++)
3240  {
3241  if (step[1] > step[i]) step[1] = step[i];
3242  }
3243  }
3244  return 1;
3245 }
static CanonicalForm bound(const CFMatrix &M)
Definition: cf_linsys.cc:460
static unsigned add[]
Definition: misc_ip.cc:79
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:3036
poly pCopyL2p ( LObject  H,
kStrategy  strat 
)

Definition at line 8928 of file kutil.cc.

8929 {
8930  /* restores a poly in currRing from LObject */
8931  LObject h = H;
8932  h.Copy();
8933  poly p;
8934  if (h.p == NULL)
8935  {
8936  if (h.t_p != NULL)
8937  {
8938  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing, /* dest. ring: */ currRing);
8939  return(p);
8940  }
8941  else
8942  {
8943  /* h.tp == NULL -> the object is NULL */
8944  return(NULL);
8945  }
8946  }
8947  /* we're here if h.p != NULL */
8948  if (h.t_p == NULL)
8949  {
8950  /* then h.p is the whole poly in currRing */
8951  p = h.p;
8952  return(p);
8953  }
8954  /* we're here if h.p != NULL and h.t_p != NULL */
8955  // clean h.p, get poly from t_p
8956  pNext(h.p)=NULL;
8957  pDelete(&h.p);
8958  p = prMoveR(h.t_p, /* source ring: */ strat->tailRing,
8959  /* dest. ring: */ currRing);
8960  // no need to clean h: we re-used the polys
8961  return(p);
8962 }
class sLObject LObject
Definition: kutil.h:58
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
polyrec * poly
Definition: hilb.h:10
CanonicalForm H
Definition: facAbsFact.cc:64
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pDelete(p_ptr)
Definition: polys.h:157
#define pNext(p)
Definition: monomials.h:43
static Poly * h
Definition: janet.cc:978
static int pDivComp ( poly  p,
poly  q 
)
inlinestatic

Definition at line 179 of file kutil.cc.

180 {
181  if (pGetComp(p) == pGetComp(q))
182  {
183 #ifdef HAVE_RATGRING
184  if (rIsRatGRing(currRing))
185  {
187  q,currRing,
188  currRing->real_var_start, currRing->real_var_end))
189  return 0;
190  return pLmCmp(q,p); // ONLY FOR GLOBAL ORDER!
191  }
192 #endif
193  BOOLEAN a=FALSE, b=FALSE;
194  int i;
195  unsigned long la, lb;
196  unsigned long divmask = currRing->divmask;
197  for (i=0; i<currRing->VarL_Size; i++)
198  {
199  la = p->exp[currRing->VarL_Offset[i]];
200  lb = q->exp[currRing->VarL_Offset[i]];
201  if (la != lb)
202  {
203  if (la < lb)
204  {
205  if (b) return 0;
206  if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
207  return 0;
208  a = TRUE;
209  }
210  else
211  {
212  if (a) return 0;
213  if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
214  return 0;
215  b = TRUE;
216  }
217  }
218  }
219  if (a) { /*assume(pLmCmp(q,p)==1);*/ return 1; }
220  if (b) { /*assume(pLmCmp(q,p)==-1);*/return -1; }
221  /*assume(pLmCmp(q,p)==0);*/
222  }
223  return 0;
224 }
const poly a
Definition: syzextra.cc:212
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
#define TRUE
Definition: auxiliary.h:144
#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:12
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:1632
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
static bool rIsRatGRing(const ring r)
Definition: ring.h:366
static int pDivCompRing ( poly  p,
poly  q 
)
inlinestatic

Definition at line 141 of file kutil.cc.

142 {
143  if (pGetComp(p) == pGetComp(q))
144  {
145  BOOLEAN a=FALSE, b=FALSE;
146  int i;
147  unsigned long la, lb;
148  unsigned long divmask = currRing->divmask;
149  for (i=0; i<currRing->VarL_Size; i++)
150  {
151  la = p->exp[currRing->VarL_Offset[i]];
152  lb = q->exp[currRing->VarL_Offset[i]];
153  if (la != lb)
154  {
155  if (la < lb)
156  {
157  if (b) return pDivComp_INCOMP;
158  if (((la & divmask) ^ (lb & divmask)) != ((lb - la) & divmask))
159  return pDivComp_INCOMP;
160  a = TRUE;
161  }
162  else
163  {
164  if (a) return pDivComp_INCOMP;
165  if (((la & divmask) ^ (lb & divmask)) != ((la - lb) & divmask))
166  return pDivComp_INCOMP;
167  b = TRUE;
168  }
169  }
170  }
171  if (a) return pDivComp_LESS;
172  if (b) return pDivComp_GREATER;
173  if (!a & !b) return pDivComp_EQUAL;
174  }
175  return pDivComp_INCOMP;
176 }
#define pDivComp_LESS
Definition: kutil.cc:133
const poly a
Definition: syzextra.cc:212
#define pDivComp_EQUAL
Definition: kutil.cc:132
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#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:12
int i
Definition: cfEzgcd.cc:123
#define pDivComp_GREATER
Definition: kutil.cc:134
#define pDivComp_INCOMP
Definition: kutil.cc:135
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
poly pMove2CurrTail ( poly  p,
kStrategy  strat 
)

Definition at line 8897 of file kutil.cc.

8898 {
8899  /* assume: p is completely in currRing */
8900  /* produces an object with LM in curring
8901  and TAIL in tailring */
8902  if (pNext(p)!=NULL)
8903  {
8904  pNext(p) = prMoveR(pNext(p), /* src */ currRing, /* dest */ strat->tailRing);
8905  }
8906  return(p);
8907 }
return P p
Definition: myNF.cc:203
poly prMoveR(poly &p, ring src_r, ring dest_r)
Definition: prCopy.cc:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
poly pMoveCurrTail2poly ( poly  p,
kStrategy  strat 
)

Definition at line 8911 of file kutil.cc.

8912 {
8913  /* assume: p has LM in curring and TAIL in tailring */
8914  /* convert it to complete currRing */
8915 
8916  /* check that LM is in currRing */
8918 
8919  if (pNext(p)!=NULL)
8920  {
8921  pNext(p) = prMoveR(pNext(p), /* src */ strat->tailRing, /* dest */currRing);
8922  }
8923  return(p);
8924 }
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:90
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
int posInL0 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4568 of file kutil.cc.

4570 {
4571  if (length<0) return 0;
4572 
4573  if (pLmCmp(set[length].p,p->p)== currRing->OrdSgn)
4574  return length+1;
4575 
4576  int i;
4577  int an = 0;
4578  int en= length;
4579  loop
4580  {
4581  if (an >= en-1)
4582  {
4583  if (pLmCmp(set[an].p,p->p) == currRing->OrdSgn) return en;
4584  return an;
4585  }
4586  i=(an+en) / 2;
4587  if (pLmCmp(set[i].p,p->p) == currRing->OrdSgn) an=i;
4588  else en=i;
4589  /*aend. fuer lazy == in !=- machen */
4590  }
4591 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL11 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4664 of file kutil.cc.

4683 {
4684  if (length<0) return 0;
4685 
4686  int o = p->GetpFDeg();
4687  int op = set[length].GetpFDeg();
4688 
4689  if ((op > o)
4690  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4691  return length+1;
4692  int i;
4693  int an = 0;
4694  int en= length;
4695  loop
4696  {
4697  if (an >= en-1)
4698  {
4699  op = set[an].GetpFDeg();
4700  if ((op > o)
4701  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4702  return en;
4703  return an;
4704  }
4705  i=(an+en) / 2;
4706  op = set[i].GetpFDeg();
4707  if ((op > o)
4708  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4709  an=i;
4710  else
4711  en=i;
4712  }
4713 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL110 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4818 of file kutil.cc.

4820 {
4821  if (length<0) return 0;
4822 
4823  int o = p->GetpFDeg();
4824  int op = set[length].GetpFDeg();
4825 
4826  if ((op > o)
4827  || ((op == o) && (set[length].length >p->length))
4828  || ((op == o) && (set[length].length <= p->length)
4829  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4830  return length+1;
4831  int i;
4832  int an = 0;
4833  int en= length;
4834  loop
4835  {
4836  if (an >= en-1)
4837  {
4838  op = set[an].GetpFDeg();
4839  if ((op > o)
4840  || ((op == o) && (set[an].length >p->length))
4841  || ((op == o) && (set[an].length <=p->length)
4842  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4843  return en;
4844  return an;
4845  }
4846  i=(an+en) / 2;
4847  op = set[i].GetpFDeg();
4848  if ((op > o)
4849  || ((op == o) && (set[i].length > p->length))
4850  || ((op == o) && (set[i].length <= p->length)
4851  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4852  an=i;
4853  else
4854  en=i;
4855  }
4856 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL13 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4864 of file kutil.cc.

4866 {
4867  if (length<0) return 0;
4868 
4869  int o = p->GetpFDeg();
4870 
4871  if (set[length].GetpFDeg() > o)
4872  return length+1;
4873 
4874  int i;
4875  int an = 0;
4876  int en= length;
4877  loop
4878  {
4879  if (an >= en-1)
4880  {
4881  if (set[an].GetpFDeg() >= o)
4882  return en;
4883  return an;
4884  }
4885  i=(an+en) / 2;
4886  if (set[i].GetpFDeg() >= o)
4887  an=i;
4888  else
4889  en=i;
4890  }
4891 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInL15 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4899 of file kutil.cc.

4919 {
4920  if (length<0) return 0;
4921 
4922  int o = p->GetpFDeg() + p->ecart;
4923  int op = set[length].GetpFDeg() + set[length].ecart;
4924 
4925  if ((op > o)
4926  || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4927  return length+1;
4928  int i;
4929  int an = 0;
4930  int en= length;
4931  loop
4932  {
4933  if (an >= en-1)
4934  {
4935  op = set[an].GetpFDeg() + set[an].ecart;
4936  if ((op > o)
4937  || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4938  return en;
4939  return an;
4940  }
4941  i=(an+en) / 2;
4942  op = set[i].GetpFDeg() + set[i].ecart;
4943  if ((op > o)
4944  || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4945  an=i;
4946  else
4947  en=i;
4948  }
4949 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL17 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4957 of file kutil.cc.

4959 {
4960  if (length<0) return 0;
4961 
4962  int o = p->GetpFDeg() + p->ecart;
4963 
4964  if ((set[length].GetpFDeg() + set[length].ecart > o)
4965  || ((set[length].GetpFDeg() + set[length].ecart == o)
4966  && (set[length].ecart > p->ecart))
4967  || ((set[length].GetpFDeg() + set[length].ecart == o)
4968  && (set[length].ecart == p->ecart)
4969  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4970  return length+1;
4971  int i;
4972  int an = 0;
4973  int en= length;
4974  loop
4975  {
4976  if (an >= en-1)
4977  {
4978  if ((set[an].GetpFDeg() + set[an].ecart > o)
4979  || ((set[an].GetpFDeg() + set[an].ecart == o)
4980  && (set[an].ecart > p->ecart))
4981  || ((set[an].GetpFDeg() + set[an].ecart == o)
4982  && (set[an].ecart == p->ecart)
4983  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4984  return en;
4985  return an;
4986  }
4987  i=(an+en) / 2;
4988  if ((set[i].GetpFDeg() + set[i].ecart > o)
4989  || ((set[i].GetpFDeg() + set[i].ecart == o)
4990  && (set[i].ecart > p->ecart))
4991  || ((set[i].GetpFDeg() +set[i].ecart == o)
4992  && (set[i].ecart == p->ecart)
4993  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4994  an=i;
4995  else
4996  en=i;
4997  }
4998 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInL17_c ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 5005 of file kutil.cc.

5007 {
5008  if (length<0) return 0;
5009 
5010  int cc = (-1+2*currRing->order[0]==ringorder_c);
5011  /* cc==1 for (c,..), cc==-1 for (C,..) */
5012  unsigned long c = pGetComp(p->p)*cc;
5013  int o = p->GetpFDeg() + p->ecart;
5014 
5015  if (pGetComp(set[length].p)*cc > c)
5016  return length+1;
5017  if (pGetComp(set[length].p)*cc == c)
5018  {
5019  if ((set[length].GetpFDeg() + set[length].ecart > o)
5020  || ((set[length].GetpFDeg() + set[length].ecart == o)
5021  && (set[length].ecart > p->ecart))
5022  || ((set[length].GetpFDeg() + set[length].ecart == o)
5023  && (set[length].ecart == p->ecart)
5024  && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
5025  return length+1;
5026  }
5027  int i;
5028  int an = 0;
5029  int en= length;
5030  loop
5031  {
5032  if (an >= en-1)
5033  {
5034  if (pGetComp(set[an].p)*cc > c)
5035  return en;
5036  if (pGetComp(set[an].p)*cc == c)
5037  {
5038  if ((set[an].GetpFDeg() + set[an].ecart > o)
5039  || ((set[an].GetpFDeg() + set[an].ecart == o)
5040  && (set[an].ecart > p->ecart))
5041  || ((set[an].GetpFDeg() + set[an].ecart == o)
5042  && (set[an].ecart == p->ecart)
5043  && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
5044  return en;
5045  }
5046  return an;
5047  }
5048  i=(an+en) / 2;
5049  if (pGetComp(set[i].p)*cc > c)
5050  an=i;
5051  else if (pGetComp(set[i].p)*cc == c)
5052  {
5053  if ((set[i].GetpFDeg() + set[i].ecart > o)
5054  || ((set[i].GetpFDeg() + set[i].ecart == o)
5055  && (set[i].ecart > p->ecart))
5056  || ((set[i].GetpFDeg() +set[i].ecart == o)
5057  && (set[i].ecart == p->ecart)
5058  && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
5059  an=i;
5060  else
5061  en=i;
5062  }
5063  else
5064  en=i;
5065  }
5066 }
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
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:12
int i
Definition: cfEzgcd.cc:123
int posInLF5C ( const LSet  ,
const int  ,
LObject ,
const kStrategy  strat 
)

Definition at line 4652 of file kutil.cc.

4654 {
4655  return strat->Ll+1;
4656 }
int Ll
Definition: kutil.h:354
int posInLrg0 ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4734 of file kutil.cc.

4744 {
4745  if (length < 0) return 0;
4746 
4747  int o = p->GetpFDeg();
4748  int op = set[length].GetpFDeg();
4749 
4750  if ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -currRing->OrdSgn)))
4751  return length + 1;
4752  int i;
4753  int an = 0;
4754  int en = length;
4755  loop
4756  {
4757  if (an >= en - 1)
4758  {
4759  op = set[an].GetpFDeg();
4760  if ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -currRing->OrdSgn)))
4761  return en;
4762  return an;
4763  }
4764  i = (an+en) / 2;
4765  op = set[i].GetpFDeg();
4766  if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -currRing->OrdSgn)))
4767  an = i;
4768  else
4769  en = i;
4770  }
4771 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInLSig ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4599 of file kutil.cc.

4601 {
4602 if (length<0) return 0;
4603 if (pLmCmp(set[length].sig,p->sig)== currRing->OrdSgn)
4604  return length+1;
4605 
4606 int i;
4607 int an = 0;
4608 int en= length;
4609 loop
4610 {
4611  if (an >= en-1)
4612  {
4613  if (pLmCmp(set[an].sig,p->sig) == currRing->OrdSgn) return en;
4614  return an;
4615  }
4616  i=(an+en) / 2;
4617  if (pLmCmp(set[i].sig,p->sig) == currRing->OrdSgn) an=i;
4618  else en=i;
4619  /*aend. fuer lazy == in !=- machen */
4620 }
4621 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInLSpecial ( const LSet  set,
const int  length,
LObject p,
const kStrategy   
)

Definition at line 4525 of file kutil.cc.

4527 {
4528  if (length<0) return 0;
4529 
4530  int d=p->GetpFDeg();
4531  int op=set[length].GetpFDeg();
4532 
4533  if ((op > d)
4534  || ((op == d) && (p->p1!=NULL)&&(set[length].p1==NULL))
4535  || (pLmCmp(set[length].p,p->p)== currRing->OrdSgn))
4536  return length+1;
4537 
4538  int i;
4539  int an = 0;
4540  int en= length;
4541  loop
4542  {
4543  if (an >= en-1)
4544  {
4545  op=set[an].GetpFDeg();
4546  if ((op > d)
4547  || ((op == d) && (p->p1!=NULL) && (set[an].p1==NULL))
4548  || (pLmCmp(set[an].p,p->p)== currRing->OrdSgn))
4549  return en;
4550  return an;
4551  }
4552  i=(an+en) / 2;
4553  op=set[i].GetpFDeg();
4554  if ((op>d)
4555  || ((op==d) && (p->p1!=NULL) && (set[i].p1==NULL))
4556  || (pLmCmp(set[i].p,p->p) == currRing->OrdSgn))
4557  an=i;
4558  else
4559  en=i;
4560  }
4561 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int posInS ( const kStrategy  strat,
const int  length,
const poly  p,
const int  ecart_p 
)

Definition at line 3860 of file kutil.cc.

3862 {
3863  if(length==-1) return 0;
3864  polyset set=strat->S;
3865  int i;
3866  int an = 0;
3867  int en = length;
3868  int cmp_int = currRing->OrdSgn;
3869  if ((currRing->MixedOrder)
3870 #ifdef HAVE_PLURAL
3871  && (currRing->real_var_start==0)
3872 #endif
3873 #if 0
3874  || ((strat->ak>0) && ((currRing->order[0]==ringorder_c)||((currRing->order[0]==ringorder_C))))
3875 #endif
3876  )
3877  {
3878  int o=p_Deg(p,currRing);
3879  int oo=p_Deg(set[length],currRing);
3880 
3881  if ((oo<o)
3882  || ((o==oo) && (pLmCmp(set[length],p)!= cmp_int)))
3883  return length+1;
3884 
3885  loop
3886  {
3887  if (an >= en-1)
3888  {
3889  if ((p_Deg(set[an],currRing)>=o) && (pLmCmp(set[an],p) == cmp_int))
3890  {
3891  return an;
3892  }
3893  return en;
3894  }
3895  i=(an+en) / 2;
3896  if ((p_Deg(set[i],currRing)>=o) && (pLmCmp(set[i],p) == cmp_int)) en=i;
3897  else an=i;
3898  }
3899  }
3900  else
3901  {
3902 #ifdef HAVE_RINGS
3903  if (rField_is_Ring(currRing))
3904  {
3905  if (pLmCmp(set[length],p)== -cmp_int)
3906  return length+1;
3907  int cmp;
3908  loop
3909  {
3910  if (an >= en-1)
3911  {
3912  cmp = pLmCmp(set[an],p);
3913  if (cmp == cmp_int) return an;
3914  if (cmp == -cmp_int) return en;
3915  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[an]), currRing->cf)) return en;
3916  return an;
3917  }
3918  i = (an+en) / 2;
3919  cmp = pLmCmp(set[i],p);
3920  if (cmp == cmp_int) en = i;
3921  else if (cmp == -cmp_int) an = i;
3922  else
3923  {
3924  if (n_DivBy(pGetCoeff(p), pGetCoeff(set[i]), currRing->cf)) an = i;
3925  else en = i;
3926  }
3927  }
3928  }
3929  else
3930 #endif
3931  if (pLmCmp(set[length],p)== -cmp_int)
3932  return length+1;
3933 
3934  loop
3935  {
3936  if (an >= en-1)
3937  {
3938  if (pLmCmp(set[an],p) == cmp_int) return an;
3939  if (pLmCmp(set[an],p) == -cmp_int) return en;
3940  if ((cmp_int!=1)
3941  && ((strat->ecartS[an])>ecart_p))
3942  return an;
3943  return en;
3944  }
3945  i=(an+en) / 2;
3946  if (pLmCmp(set[i],p) == cmp_int) en=i;
3947  else if (pLmCmp(set[i],p) == -cmp_int) an=i;
3948  else
3949  {
3950  if ((cmp_int!=1)
3951  &&((strat->ecartS[i])<ecart_p))
3952  en=i;
3953  else
3954  an=i;
3955  }
3956  }
3957  }
3958 }
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
Definition: polys.h:105
int ak
Definition: kutil.h:356
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:12
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
static FORCE_INLINE BOOLEAN n_DivBy(number a, number b, const coeffs r)
test whether 'a' is divisible 'b'; for r encoding a field: TRUE iff 'b' does not represent zero in Z:...
Definition: coeffs.h:769
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset ecartS
Definition: kutil.h:307
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
poly * polyset
Definition: hutil.h:17
int posInSyz ( const kStrategy  strat,
poly  sig 
)

Definition at line 4624 of file kutil.cc.

4625 {
4626 if (strat->syzl==0) return 0;
4627 if (pLmCmp(strat->syz[strat->syzl-1],sig) != currRing->OrdSgn)
4628  return strat->syzl;
4629 int i;
4630 int an = 0;
4631 int en= strat->syzl-1;
4632 loop
4633 {
4634  if (an >= en-1)
4635  {
4636  if (pLmCmp(strat->syz[an],sig) != currRing->OrdSgn) return en;
4637  return an;
4638  }
4639  i=(an+en) / 2;
4640  if (pLmCmp(strat->syz[i],sig) != currRing->OrdSgn) an=i;
4641  else en=i;
4642  /*aend. fuer lazy == in !=- machen */
4643 }
4644 }
loop
Definition: myNF.cc:98
#define pLmCmp(p, q)
returns 0|1|-1 if p=q|p>q|p
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
int posInT0 ( const TSet  ,
const int  length,
LObject  
)

Definition at line 3965 of file kutil.cc.

3966 {
3967  return (length+1);
3968 }
int posInT1 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 3976 of file kutil.cc.

3977 {
3978  if (length==-1) return 0;
3979 
3980  if (pLmCmp(set[length].p,p.p)!= currRing->OrdSgn) return length+1;
3981 
3982  int i;
3983  int an = 0;
3984  int en= length;
3985 
3986  loop
3987  {
3988  if (an >= en-1)
3989  {
3990  if (pLmCmp(set[an].p,p.p) == currRing->OrdSgn) return an;
3991  return en;
3992  }
3993  i=(an+en) / 2;
3994  if (pLmCmp(set[i].p,p.p) == currRing->OrdSgn) en=i;
3995  else an=i;
3996  }
3997 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT11 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4034 of file kutil.cc.

4052 {
4053  if (length==-1) return 0;
4054 
4055  int o = p.GetpFDeg();
4056  int op = set[length].GetpFDeg();
4057 
4058  if ((op < o)
4059  || ((op == o) && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4060  return length+1;
4061 
4062  int i;
4063  int an = 0;
4064  int en= length;
4065 
4066  loop
4067  {
4068  if (an >= en-1)
4069  {
4070  op= set[an].GetpFDeg();
4071  if ((op > o)
4072  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4073  return an;
4074  return en;
4075  }
4076  i=(an+en) / 2;
4077  op = set[i].GetpFDeg();
4078  if (( op > o)
4079  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4080  en=i;
4081  else
4082  an=i;
4083  }
4084 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT110 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4167 of file kutil.cc.

4168 {
4169  p.GetpLength();
4170  if (length==-1) return 0;
4171 
4172  int o = p.GetpFDeg();
4173  int op = set[length].GetpFDeg();
4174 
4175  if (( op < o)
4176  || (( op == o) && (set[length].length<p.length))
4177  || (( op == o) && (set[length].length == p.length)
4178  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4179  return length+1;
4180 
4181  int i;
4182  int an = 0;
4183  int en= length;
4184  loop
4185  {
4186  if (an >= en-1)
4187  {
4188  op = set[an].GetpFDeg();
4189  if (( op > o)
4190  || (( op == o) && (set[an].length > p.length))
4191  || (( op == o) && (set[an].length == p.length)
4192  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4193  return an;
4194  return en;
4195  }
4196  i=(an+en) / 2;
4197  op = set[i].GetpFDeg();
4198  if (( op > o)
4199  || (( op == o) && (set[i].length > p.length))
4200  || (( op == o) && (set[i].length == p.length)
4201  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4202  en=i;
4203  else
4204  an=i;
4205  }
4206 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT13 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4213 of file kutil.cc.

4214 {
4215  if (length==-1) return 0;
4216 
4217  int o = p.GetpFDeg();
4218 
4219  if (set[length].GetpFDeg() <= o)
4220  return length+1;
4221 
4222  int i;
4223  int an = 0;
4224  int en= length;
4225  loop
4226  {
4227  if (an >= en-1)
4228  {
4229  if (set[an].GetpFDeg() > o)
4230  return an;
4231  return en;
4232  }
4233  i=(an+en) / 2;
4234  if (set[i].GetpFDeg() > o)
4235  en=i;
4236  else
4237  an=i;
4238  }
4239 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInT15 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4281 of file kutil.cc.

4300 {
4301  if (length==-1) return 0;
4302 
4303  int o = p.GetpFDeg() + p.ecart;
4304  int op = set[length].GetpFDeg()+set[length].ecart;
4305 
4306  if ((op < o)
4307  || ((op == o)
4308  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4309  return length+1;
4310 
4311  int i;
4312  int an = 0;
4313  int en= length;
4314  loop
4315  {
4316  if (an >= en-1)
4317  {
4318  op = set[an].GetpFDeg()+set[an].ecart;
4319  if (( op > o)
4320  || (( op == o) && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4321  return an;
4322  return en;
4323  }
4324  i=(an+en) / 2;
4325  op = set[i].GetpFDeg()+set[i].ecart;
4326  if (( op > o)
4327  || (( op == o) && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4328  en=i;
4329  else
4330  an=i;
4331  }
4332 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT17 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4339 of file kutil.cc.

4360 {
4361  if (length==-1) return 0;
4362 
4363  int o = p.GetpFDeg() + p.ecart;
4364  int op = set[length].GetpFDeg()+set[length].ecart;
4365 
4366  if ((op < o)
4367  || (( op == o) && (set[length].ecart > p.ecart))
4368  || (( op == o) && (set[length].ecart==p.ecart)
4369  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4370  return length+1;
4371 
4372  int i;
4373  int an = 0;
4374  int en= length;
4375  loop
4376  {
4377  if (an >= en-1)
4378  {
4379  op = set[an].GetpFDeg()+set[an].ecart;
4380  if (( op > o)
4381  || (( op == o) && (set[an].ecart < p.ecart))
4382  || (( op == o) && (set[an].ecart==p.ecart)
4383  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4384  return an;
4385  return en;
4386  }
4387  i=(an+en) / 2;
4388  op = set[i].GetpFDeg()+set[i].ecart;
4389  if ((op > o)
4390  || (( op == o) && (set[i].ecart < p.ecart))
4391  || (( op == o) && (set[i].ecart == p.ecart)
4392  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4393  en=i;
4394  else
4395  an=i;
4396  }
4397 }
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
Definition: polys.h:105
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
int i
Definition: cfEzgcd.cc:123
int posInT17_c ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4403 of file kutil.cc.

4404 {
4405  if (length==-1) return 0;
4406 
4407  int cc = (-1+2*currRing->order[0]==ringorder_c);
4408  /* cc==1 for (c,..), cc==-1 for (C,..) */
4409  int o = p.GetpFDeg() + p.ecart;
4410  unsigned long c = pGetComp(p.p)*cc;
4411 
4412  if (pGetComp(set[length].p)*cc < c)
4413  return length+1;
4414  if (pGetComp(set[length].p)*cc == c)
4415  {
4416  int op = set[length].GetpFDeg()+set[length].ecart;
4417  if ((op < o)
4418  || ((op == o) && (set[length].ecart > p.ecart))
4419  || ((op == o) && (set[length].ecart==p.ecart)
4420  && (pLmCmp(set[length].p,p.p) != currRing->OrdSgn)))
4421  return length+1;
4422  }
4423 
4424  int i;
4425  int an = 0;
4426  int en= length;
4427  loop
4428  {
4429  if (an >= en-1)
4430  {
4431  if (pGetComp(set[an].p)*cc < c)
4432  return en;
4433  if (pGetComp(set[an].p)*cc == c)
4434  {
4435  int op = set[an].GetpFDeg()+set[an].ecart;
4436  if ((op > o)
4437  || ((op == o) && (set[an].ecart < p.ecart))
4438  || ((op == o) && (set[an].ecart==p.ecart)
4439  && (pLmCmp(set[an].p,p.p) == currRing->OrdSgn)))
4440  return an;
4441  }
4442  return en;
4443  }
4444  i=(an+en) / 2;
4445  if (pGetComp(set[i].p)*cc > c)
4446  en=i;
4447  else if (pGetComp(set[i].p)*cc == c)
4448  {
4449  int op = set[i].GetpFDeg()+set[i].ecart;
4450  if ((op > o)
4451  || ((op == o) && (set[i].ecart < p.ecart))
4452  || ((op == o) && (set[i].ecart == p.ecart)
4453  && (pLmCmp(set[i].p,p.p) == currRing->OrdSgn)))
4454  en=i;
4455  else
4456  an=i;
4457  }
4458  else
4459  an=i;
4460  }
4461 }
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
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:12
int i
Definition: cfEzgcd.cc:123
int posInT19 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4468 of file kutil.cc.

4469 {
4470  p.GetpLength();
4471  if (length==-1) return 0;
4472 
4473  int o = p.ecart;
4474  int op=p.GetpFDeg();
4475 
4476  if (set[length].ecart < o)
4477  return length+1;
4478  if (set[length].ecart == o)
4479  {
4480  int oo=set[length].GetpFDeg();
4481  if ((oo < op) || ((oo==op) && (set[length].length < p.length)))
4482  return length+1;
4483  }
4484 
4485  int i;
4486  int an = 0;
4487  int en= length;
4488  loop
4489  {
4490  if (an >= en-1)
4491  {
4492  if (set[an].ecart > o)
4493  return an;
4494  if (set[an].ecart == o)
4495  {
4496  int oo=set[an].GetpFDeg();
4497  if((oo > op)
4498  || ((oo==op) && (set[an].length > p.length)))
4499  return an;
4500  }
4501  return en;
4502  }
4503  i=(an+en) / 2;
4504  if (set[i].ecart > o)
4505  en=i;
4506  else if (set[i].ecart == o)
4507  {
4508  int oo=set[i].GetpFDeg();
4509  if ((oo > op)
4510  || ((oo == op) && (set[i].length > p.length)))
4511  en=i;
4512  else
4513  an=i;
4514  }
4515  else
4516  an=i;
4517  }
4518 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInT2 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4004 of file kutil.cc.

4005 {
4006  p.GetpLength();
4007  if (length==-1)
4008  return 0;
4009  if (set[length].length<p.length)
4010  return length+1;
4011 
4012  int i;
4013  int an = 0;
4014  int en= length;
4015 
4016  loop
4017  {
4018  if (an >= en-1)
4019  {
4020  if (set[an].length>p.length) return an;
4021  return en;
4022  }
4023  i=(an+en) / 2;
4024  if (set[i].length>p.length) en=i;
4025  else an=i;
4026  }
4027 }
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
int i
Definition: cfEzgcd.cc:123
int posInT_EcartFDegpLength ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 8655 of file kutil.cc.

8656 {
8657 
8658  if (length==-1) return 0;
8659 
8660  int o = p.ecart;
8661  int op=p.GetpFDeg();
8662  int ol = p.GetpLength();
8663 
8664  if (set[length].ecart < o)
8665  return length+1;
8666  if (set[length].ecart == o)
8667  {
8668  int oo=set[length].GetpFDeg();
8669  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
8670  return length+1;
8671  }
8672 
8673  int i;
8674  int an = 0;
8675  int en= length;
8676  loop
8677  {
8678  if (an >= en-1)
8679  {
8680  if (set[an].ecart > o)
8681  return an;
8682  if (set[an].ecart == o)
8683  {
8684  int oo=set[an].GetpFDeg();
8685  if((oo > op)
8686  || ((oo==op) && (set[an].pLength > ol)))
8687  return an;
8688  }
8689  return en;
8690  }
8691  i=(an+en) / 2;
8692  if (set[i].ecart > o)
8693  en=i;
8694  else if (set[i].ecart == o)
8695  {
8696  int oo=set[i].GetpFDeg();
8697  if ((oo > op)
8698  || ((oo == op) && (set[i].pLength > ol)))
8699  en=i;
8700  else
8701  an=i;
8702  }
8703  else
8704  an=i;
8705  }
8706 }
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
int posInT_EcartpLength ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4242 of file kutil.cc.

4243 {
4244  int ol = p.GetpLength();
4245  if (length==-1) return 0;
4246 
4247  int op=p.ecart;
4248 
4249  int oo=set[length].ecart;
4250  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
4251  return length+1;
4252 
4253  int i;
4254  int an = 0;
4255  int en= length;
4256  loop
4257  {
4258  if (an >= en-1)
4259  {
4260  int oo=set[an].ecart;
4261  if((oo > op)
4262  || ((oo==op) && (set[an].pLength > ol)))
4263  return an;
4264  return en;
4265  }
4266  i=(an+en) / 2;
4267  int oo=set[i].ecart;
4268  if ((oo > op)
4269  || ((oo == op) && (set[i].pLength > ol)))
4270  en=i;
4271  else
4272  an=i;
4273  }
4274 }
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
int posInT_FDegpLength ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 8709 of file kutil.cc.

8710 {
8711 
8712  if (length==-1) return 0;
8713 
8714  int op=p.GetpFDeg();
8715  int ol = p.GetpLength();
8716 
8717  int oo=set[length].GetpFDeg();
8718  if ((oo < op) || ((oo==op) && (set[length].length < ol)))
8719  return length+1;
8720 
8721  int i;
8722  int an = 0;
8723  int en= length;
8724  loop
8725  {
8726  if (an >= en-1)
8727  {
8728  int oo=set[an].GetpFDeg();
8729  if((oo > op)
8730  || ((oo==op) && (set[an].pLength > ol)))
8731  return an;
8732  return en;
8733  }
8734  i=(an+en) / 2;
8735  int oo=set[i].GetpFDeg();
8736  if ((oo > op)
8737  || ((oo == op) && (set[i].pLength > ol)))
8738  en=i;
8739  else
8740  an=i;
8741  }
8742 }
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
int posInT_pLength ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 8746 of file kutil.cc.

8747 {
8748  int ol = p.GetpLength();
8749  if (length==-1)
8750  return 0;
8751  if (set[length].length<p.length)
8752  return length+1;
8753 
8754  int i;
8755  int an = 0;
8756  int en= length;
8757 
8758  loop
8759  {
8760  if (an >= en-1)
8761  {
8762  if (set[an].pLength>ol) return an;
8763  return en;
8764  }
8765  i=(an+en) / 2;
8766  if (set[i].pLength>ol) en=i;
8767  else an=i;
8768  }
8769 }
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
int posInTrg0 ( const TSet  set,
const int  length,
LObject p 
)

Definition at line 4091 of file kutil.cc.

4092 {
4093  if (length==-1) return 0;
4094  int o = p.GetpFDeg();
4095  int op = set[length].GetpFDeg();
4096  int i;
4097  int an = 0;
4098  int en = length;
4099  int cmp_int = currRing->OrdSgn;
4100  if ((op < o) || (pLmCmp(set[length].p,p.p)== -cmp_int))
4101  return length+1;
4102  int cmp;
4103  loop
4104  {
4105  if (an >= en-1)
4106  {
4107  op = set[an].GetpFDeg();
4108  if (op > o) return an;
4109  if (op < 0) return en;
4110  cmp = pLmCmp(set[an].p,p.p);
4111  if (cmp == cmp_int) return an;
4112  if (cmp == -cmp_int) return en;
4113  if (nGreater(pGetCoeff(p.p), pGetCoeff(set[an].p))) return en;
4114  return an;
4115  }
4116  i = (an + en) / 2;
4117  op = set[i].GetpFDeg();
4118  if (op > o) en = i;
4119  else if (op < o) an = i;
4120  else
4121  {
4122  cmp = pLmCmp(set[i].p,p.p);
4123  if (cmp == cmp_int) en = i;
4124  else if (cmp == -cmp_int) an = i;
4125  else if (nGreater(pGetCoeff(p.p), pGetCoeff(set[i].p))) an = i;
4126  else en = i;
4127  }
4128  }
4129 }
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
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:12
int i
Definition: cfEzgcd.cc:123
#define nGreater(a, b)
Definition: numbers.h:28
static poly redBba ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 6631 of file kutil.cc.

6632 {
6633  int j = 0;
6634  unsigned long not_sev = ~ pGetShortExpVector(h);
6635 
6636  while (j <= maxIndex)
6637  {
6638  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev))
6639  {
6640  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
6641  if (h==NULL) return NULL;
6642  j = 0;
6643  not_sev = ~ pGetShortExpVector(h); }
6644  else j++;
6645  }
6646  return h;
6647 }
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:140
#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:134
polyset S
Definition: kutil.h:304
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:320
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1082
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
static poly redBba1 ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 6526 of file kutil.cc.

6527 {
6528  int j = 0;
6529  unsigned long not_sev = ~ pGetShortExpVector(h);
6530 
6531  while (j <= maxIndex)
6532  {
6533  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j],h, not_sev))
6534  return ksOldSpolyRedNew(strat->S[j],h,strat->kNoetherTail());
6535  else j++;
6536  }
6537  return h;
6538 }
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:140
#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:134
polyset S
Definition: kutil.h:304
KINLINE poly ksOldSpolyRedNew(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1092
unsigned long * sevS
Definition: kutil.h:320
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int redEcart ( LObject h,
kStrategy  strat 
)

Definition at line 176 of file kstd1.cc.

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

Definition at line 574 of file kstd1.cc.

575 {
576  if (h->IsNull()) return 0;
577 
578  int at;
579  long reddeg,d;
580  int pass = 0;
581  int j = 0;
582 
583  if (! strat->homog)
584  {
585  d = h->GetpFDeg() + h->ecart;
586  reddeg = strat->LazyDegree+d;
587  }
588  h->SetShortExpVector();
589  loop
590  {
591  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, h);
592  if (j < 0)
593  {
594  h->SetDegStuffReturnLDeg(strat->LDegLast);
595  return 1;
596  }
597 
599  strat->T[j].pNorm();
600 #ifdef KDEBUG
601  if (TEST_OPT_DEBUG)
602  {
603  PrintS("reduce ");
604  h->wrp();
605  PrintS(" with ");
606  strat->T[j].wrp();
607  }
608 #endif
609  ksReducePoly(h, &(strat->T[j]), strat->kNoetherTail(), NULL, strat);
610 #ifdef KDEBUG
611  if (TEST_OPT_DEBUG)
612  {
613  PrintS(" to ");
614  wrp(h->p);
615  PrintLn();
616  }
617 #endif
618  if (h->IsNull())
619  {
621  if (h->lcm!=NULL) pLmFree(h->lcm);
622  h->Clear();
623  return 0;
624  }
625  h->SetShortExpVector();
626 
627 #if 0
628  if ((strat->syzComp!=0) && !strat->honey)
629  {
630  if ((strat->syzComp>0) &&
631  (h->Comp() > strat->syzComp))
632  {
633  assume(h->MinComp() > strat->syzComp);
634 #ifdef KDEBUG
635  if (TEST_OPT_DEBUG) PrintS(" > syzComp\n");
636 #endif
637  if (strat->homog)
638  h->SetDegStuffReturnLDeg(strat->LDegLast);
639  return -2;
640  }
641  }
642 #endif
643  if (!strat->homog)
644  {
645  if (!TEST_OPT_OLDSTD && strat->honey)
646  {
647  h->SetpFDeg();
648  if (strat->T[j].ecart <= h->ecart)
649  h->ecart = d - h->GetpFDeg();
650  else
651  h->ecart = d - h->GetpFDeg() + strat->T[j].ecart - h->ecart;
652 
653  d = h->GetpFDeg() + h->ecart;
654  }
655  else
656  d = h->SetDegStuffReturnLDeg(strat->LDegLast);
657  /*- try to reduce the s-polynomial -*/
658  pass++;
659  /*
660  *test whether the polynomial should go to the lazyset L
661  *-if the degree jumps
662  *-if the number of pre-defined reductions jumps
663  */
664  if (!TEST_OPT_REDTHROUGH && (strat->Ll >= 0)
665  && ((d >= reddeg) || (pass > strat->LazyPass)))
666  {
667  h->SetLmCurrRing();
668  if (strat->posInLDependsOnLength)
669  h->SetLength(strat->length_pLength);
670  at = strat->posInL(strat->L,strat->Ll,h,strat);
671  if (at <= strat->Ll)
672  {
673  int dummy=strat->sl;
674  if (kFindDivisibleByInS(strat,&dummy, h) < 0)
675  return 1;
676  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
677 #ifdef KDEBUG
678  if (TEST_OPT_DEBUG) Print(" degree jumped; ->L%d\n",at);
679 #endif
680  h->Clear();
681  return -1;
682  }
683  }
684  if ((TEST_OPT_PROT) && (strat->Ll < 0) && (d >= reddeg))
685  {
686  reddeg = d+1;
687  Print(".%ld",d);mflush();
688  if (h->pTotalDeg()+h->ecart >= strat->tailRing->bitmask)
689  {
690  strat->overflow=TRUE;
691  //Print("OVERFLOW in redFirst d=%ld, max=%ld",d,strat->tailRing->bitmask);
692  h->GetP();
693  at = strat->posInL(strat->L,strat->Ll,h,strat);
694  enterL(&strat->L,&strat->Ll,&strat->Lmax,*h,at);
695  h->Clear();
696  return -1;
697  }
698  }
699  }
700  }
701 }
int(* posInL)(const LSet set, const int length, LObject *L, const kStrategy strat)
Definition: kutil.h:283
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int syzComp
Definition: kutil.h:357
BOOLEAN length_pLength
Definition: kutil.h:382
#define TEST_OPT_PROT
Definition: options.h:98
loop
Definition: myNF.cc:98
int Ll
Definition: kutil.h:354
BOOLEAN posInLDependsOnLength
Definition: kutil.h:384
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
int ksReducePoly(LObject *PR, TObject *PW, poly spNoether, number *coef, kStrategy strat)
Definition: kspoly.cc:38
unsigned long * sevT
Definition: kutil.h:323
#define TEST_OPT_DEBUG
Definition: options.h:103
void enterL(LSet *set, int *length, int *LSetmax, LObject p, int at)
Definition: kutil.cc:1101
#define mflush()
Definition: reporter.h:42
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
BOOLEAN homog
Definition: kutil.h:366
#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:405
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:149
void PrintS(const char *s)
Definition: reporter.cc:294
kStrategy strat
Definition: myNF.cc:319
LSet L
Definition: kutil.h:325
BOOLEAN LDegLast
Definition: kutil.h:380
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
int Lmax
Definition: kutil.h:354
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
char overflow
Definition: kutil.h:399
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:351
TSet T
Definition: kutil.h:324
void wrp(poly p)
Definition: polys.h:281
int LazyPass
Definition: kutil.h:356
#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:356
static poly redMora ( poly  h,
int  maxIndex,
kStrategy  strat 
)
static

Definition at line 6654 of file kutil.cc.

6655 {
6656  int j=0;
6657  int e,l;
6658  unsigned long not_sev = ~ pGetShortExpVector(h);
6659 
6660  if (maxIndex >= 0)
6661  {
6662  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
6663  do
6664  {
6665  if (pLmShortDivisibleBy(strat->S[j],strat->sevS[j], h, not_sev)
6666  && ((e >= strat->ecartS[j]) || strat->kHEdgeFound))
6667  {
6668 #ifdef KDEBUG
6669  if (TEST_OPT_DEBUG)
6670  {PrintS("reduce ");wrp(h);Print(" with S[%d] (",j);wrp(strat->S[j]);}
6671 #endif
6672  h = ksOldSpolyRed(strat->S[j],h,strat->kNoetherTail());
6673 #ifdef KDEBUG
6674  if(TEST_OPT_DEBUG)
6675  {PrintS(")\nto "); wrp(h); PrintLn();}
6676 #endif
6677  // pDelete(&h);
6678  if (h == NULL) return NULL;
6679  e = currRing->pLDeg(h,&l,currRing)-p_FDeg(h,currRing);
6680  j = 0;
6681  not_sev = ~ pGetShortExpVector(h);
6682  }
6683  else j++;
6684  }
6685  while (j <= maxIndex);
6686  }
6687  return h;
6688 }
void PrintLn()
Definition: reporter.cc:322
#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:12
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:140
#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:134
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:369
void PrintS(const char *s)
Definition: reporter.cc:294
polyset S
Definition: kutil.h:304
BOOLEAN kHEdgeFound
Definition: kutil.h:370
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:320
KINLINE poly ksOldSpolyRed(poly p1, poly p2, poly spNoether)
Definition: kInline.h:1082
void wrp(poly p)
Definition: polys.h:281
static Poly * h
Definition: janet.cc:978
KINLINE poly kNoetherTail()
Definition: kInline.h:63
int l
Definition: cfEzgcd.cc:94
poly redtail ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 5337 of file kutil.cc.

5338 {
5339  poly h, hn;
5340  strat->redTailChange=FALSE;
5341 
5342  poly p = L->p;
5343  if (strat->noTailReduction || pNext(p) == NULL)
5344  return p;
5345 
5346  LObject Ln(strat->tailRing);
5347  TObject* With;
5348  // placeholder in case strat->tl < 0
5349  TObject With_s(strat->tailRing);
5350  h = p;
5351  hn = pNext(h);
5352  long op = strat->tailRing->pFDeg(hn, strat->tailRing);
5353  long e;
5354  int l;
5355  BOOLEAN save_HE=strat->kHEdgeFound;
5356  strat->kHEdgeFound |=
5357  ((Kstd1_deg>0) && (op<=Kstd1_deg)) || TEST_OPT_INFREDTAIL;
5358 
5359  while(hn != NULL)
5360  {
5361  op = strat->tailRing->pFDeg(hn, strat->tailRing);
5362  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
5363  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
5364  loop
5365  {
5366  Ln.Set(hn, strat->tailRing);
5367  Ln.sev = p_GetShortExpVector(hn, strat->tailRing);
5368  if (strat->kHEdgeFound)
5369  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
5370  else
5371  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s, e);
5372  if (With == NULL) break;
5373  With->length=0;
5374  With->pLength=0;
5375  strat->redTailChange=TRUE;
5376  if (ksReducePolyTail(L, With, h, strat->kNoetherTail()))
5377  {
5378  // reducing the tail would violate the exp bound
5379  if (kStratChangeTailRing(strat, L))
5380  {
5381  strat->kHEdgeFound = save_HE;
5382  return redtail(L, pos, strat);
5383  }
5384  else
5385  return NULL;
5386  }
5387  hn = pNext(h);
5388  if (hn == NULL) goto all_done;
5389  op = strat->tailRing->pFDeg(hn, strat->tailRing);
5390  if ((Kstd1_deg>0)&&(op>Kstd1_deg)) goto all_done;
5391  e = strat->tailRing->pLDeg(hn, &l, strat->tailRing) - op;
5392  }
5393  h = hn;
5394  hn = pNext(h);
5395  }
5396 
5397  all_done:
5398  if (strat->redTailChange)
5399  {
5400  L->pLength = 0;
5401  }
5402  strat->kHEdgeFound = save_HE;
5403  return p;
5404 }
#define TEST_OPT_INFREDTAIL
Definition: options.h:112
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define TRUE
Definition: auxiliary.h:144
unsigned long p_GetShortExpVector(poly p, const ring r)
Definition: p_polys.cc:4556
polyrec * poly
Definition: hilb.h:10
BOOLEAN kStratChangeTailRing(kStrategy strat, LObject *L, TObject *T, unsigned long expbound)
Definition: kutil.cc:8231
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
int Kstd1_deg
Definition: kutil.cc:228
BOOLEAN kHEdgeFound
Definition: kutil.h:370
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define pNext(p)
Definition: monomials.h:43
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
KINLINE poly kNoetherTail()
Definition: kInline.h:63
char redTailChange
Definition: kutil.h:394
int l
Definition: cfEzgcd.cc:94
class sTObject TObject
Definition: kutil.h:57
poly redtail ( poly  p,
int  pos,
kStrategy  strat 
)

Definition at line 5406 of file kutil.cc.

5407 {
5408  LObject L(p, currRing);
5409  return redtail(&L, pos, strat);
5410 }
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
class sLObject LObject
Definition: kutil.h:58
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:12
poly redtailBba ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 5412 of file kutil.cc.

5413 {
5414 #define REDTAIL_CANONICALIZE 100
5415  strat->redTailChange=FALSE;
5416  if (strat->noTailReduction) return L->GetLmCurrRing();
5417  poly h, p;
5418  p = h = L->GetLmTailRing();
5419  if ((h==NULL) || (pNext(h)==NULL))
5420  return L->GetLmCurrRing();
5421 
5422  TObject* With;
5423  // placeholder in case strat->tl < 0
5424  TObject With_s(strat->tailRing);
5425 
5426  LObject Ln(pNext(h), strat->tailRing);
5427  Ln.pLength = L->GetpLength() - 1;
5428 
5429  pNext(h) = NULL;
5430  if (L->p != NULL) pNext(L->p) = NULL;
5431  L->pLength = 1;
5432 
5433  Ln.PrepareRed(strat->use_buckets);
5434 
5435  int cnt=REDTAIL_CANONICALIZE;
5436  while(!Ln.IsNull())
5437  {
5438  loop
5439  {
5440  Ln.SetShortExpVector();
5441  if (withT)
5442  {
5443  int j;
5444  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
5445  if (j < 0) break;
5446  With = &(strat->T[j]);
5447  }
5448  else
5449  {
5450  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
5451  if (With == NULL) break;
5452  }
5453  cnt--;
5454  if (cnt==0)
5455  {
5457  /*poly tmp=*/Ln.CanonicalizeP();
5458  if (normalize)
5459  {
5460  Ln.Normalize();
5461  //pNormalize(tmp);
5462  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
5463  }
5464  }
5465  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
5466  {
5467  With->pNorm();
5468  }
5469  strat->redTailChange=TRUE;
5470  if (ksReducePolyTail(L, With, &Ln))
5471  {
5472  // reducing the tail would violate the exp bound
5473  // set a flag and hope for a retry (in bba)
5474  strat->completeReduce_retry=TRUE;
5475  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
5476  do
5477  {
5478  pNext(h) = Ln.LmExtractAndIter();
5479  pIter(h);
5480  L->pLength++;
5481  } while (!Ln.IsNull());
5482  goto all_done;
5483  }
5484  if (Ln.IsNull()) goto all_done;
5485  if (! withT) With_s.Init(currRing);
5486  }
5487  pNext(h) = Ln.LmExtractAndIter();
5488  pIter(h);
5489  pNormalize(h);
5490  L->pLength++;
5491  }
5492 
5493  all_done:
5494  Ln.Delete();
5495  if (L->p != NULL) pNext(L->p) = pNext(p);
5496 
5497  if (strat->redTailChange)
5498  {
5499  L->length = 0;
5500  L->pLength = 0;
5501  }
5502 
5503  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
5504  //L->Normalize(); // HANNES: should have a test
5505  kTest_L(L);
5506  return L->GetLmCurrRing();
5507 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:398
#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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:619
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
poly redtailBba_Z ( LObject L,
int  pos,
kStrategy  strat 
)

Definition at line 5510 of file kutil.cc.

5512 {
5513  strat->redTailChange=FALSE;
5514  if (strat->noTailReduction) return L->GetLmCurrRing();
5515  poly h, p;
5516  p = h = L->GetLmTailRing();
5517  if ((h==NULL) || (pNext(h)==NULL))
5518  return L->GetLmCurrRing();
5519 
5520  TObject* With;
5521  // placeholder in case strat->tl < 0
5522  TObject With_s(strat->tailRing);
5523 
5524  LObject Ln(pNext(h), strat->tailRing);
5525  Ln.pLength = L->GetpLength() - 1;
5526 
5527  pNext(h) = NULL;
5528  if (L->p != NULL) pNext(L->p) = NULL;
5529  L->pLength = 1;
5530 
5531  Ln.PrepareRed(strat->use_buckets);
5532 
5533  int cnt=REDTAIL_CANONICALIZE;
5534  while(!Ln.IsNull())
5535  {
5536  loop
5537  {
5538  Ln.SetShortExpVector();
5539  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
5540  if (With == NULL) break;
5541  cnt--;
5542  if (cnt==0)
5543  {
5545  /*poly tmp=*/Ln.CanonicalizeP();
5546  }
5547  // we are in Z, do not call pNorm
5548  strat->redTailChange=TRUE;
5549  // test divisibility of coefs:
5550  poly p_Ln=Ln.GetLmCurrRing();
5551  poly p_With=With->GetLmCurrRing();
5552  number z=n_IntMod(pGetCoeff(p_Ln),pGetCoeff(p_With), currRing->cf);
5553  if (!nIsZero(z))
5554  {
5555  // subtract z*Ln, add z.Ln to L
5556  poly m=pHead(p_Ln);
5557  pSetCoeff(m,z);
5558  poly mm=pHead(m);
5559  pNext(h) = m;
5560  pIter(h);
5561  L->pLength++;
5562  mm=pNeg(mm);
5563  if (Ln.bucket!=NULL)
5564  {
5565  int dummy=1;
5566  kBucket_Add_q(Ln.bucket,mm,&dummy);
5567  }
5568  else
5569  {
5570  if ((Ln.t_p!=NULL)&&(Ln.p==NULL))
5571  Ln.GetP();
5572  if (Ln.p!=NULL)
5573  {
5574  Ln.p=pAdd(Ln.p,mm);
5575  if (Ln.t_p!=NULL)
5576  {
5577  pNext(Ln.t_p)=NULL;
5578  p_LmDelete(Ln.t_p,strat->tailRing);
5579  }
5580  }
5581  }
5582  }
5583  else
5584  nDelete(&z);
5585 
5586  if (ksReducePolyTail(L, With, &Ln))
5587  {
5588  // reducing the tail would violate the exp bound
5589  // set a flag and hope for a retry (in bba)
5590  strat->completeReduce_retry=TRUE;
5591  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
5592  do
5593  {
5594  pNext(h) = Ln.LmExtractAndIter();
5595  pIter(h);
5596  L->pLength++;
5597  } while (!Ln.IsNull());
5598  goto all_done;
5599  }
5600  if (Ln.IsNull()) goto all_done;
5601  With_s.Init(currRing);
5602  }
5603  pNext(h) = Ln.LmExtractAndIter();
5604  pIter(h);
5605  pNormalize(h);
5606  L->pLength++;
5607  }
5608 
5609  all_done:
5610  Ln.Delete();
5611  if (L->p != NULL) pNext(L->p) = pNext(p);
5612 
5613  if (strat->redTailChange)
5614  {
5615  L->length = 0;
5616  }
5617 
5618  //if (TEST_OPT_PROT) { PrintS("N"); mflush(); }
5619  //L->Normalize(); // HANNES: should have a test
5620  kTest_L(L);
5621  return L->GetLmCurrRing();
5622 }
static FORCE_INLINE number n_IntMod(number a, number b, const coeffs r)
for r a field, return n_Init(0,r) otherwise: n_Div(a,b,r)*b+n_IntMod(a,b,r)==a
Definition: coeffs.h:625
#define pAdd(p, q)
Definition: polys.h:174
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
#define pNeg(p)
Definition: polys.h:169
#define TRUE
Definition: auxiliary.h:144
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:398
#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:12
polyrec * poly
Definition: hilb.h:10
pNormalize(P.p)
#define kTest_L(T)
Definition: kutil.h:619
int m
Definition: cfEzgcd.cc:119
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
#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:343
#define REDTAIL_CANONICALIZE
#define pNext(p)
Definition: monomials.h:43
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:707
BOOLEAN use_buckets
Definition: kutil.h:377
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:394
class sTObject TObject
Definition: kutil.h:57
void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
Add to Bucket a poly ,i.e. Bpoly == q+Bpoly.
Definition: kbuckets.cc:637
poly redtailBbaShift ( LObject L,
int  pos,
kStrategy  strat,
BOOLEAN  withT,
BOOLEAN  normalize 
)

Definition at line 9721 of file kutil.cc.

9722 {
9723  /* for the shift case need to run it with withT = TRUE */
9724  strat->redTailChange=FALSE;
9725  if (strat->noTailReduction) return L->GetLmCurrRing();
9726  poly h, p;
9727  p = h = L->GetLmTailRing();
9728  if ((h==NULL) || (pNext(h)==NULL))
9729  return L->GetLmCurrRing();
9730 
9731  TObject* With;
9732  // placeholder in case strat->tl < 0
9733  TObject With_s(strat->tailRing);
9734 
9735  LObject Ln(pNext(h), strat->tailRing);
9736  Ln.pLength = L->GetpLength() - 1;
9737 
9738  pNext(h) = NULL;
9739  if (L->p != NULL) pNext(L->p) = NULL;
9740  L->pLength = 1;
9741 
9742  Ln.PrepareRed(strat->use_buckets);
9743 
9744  while(!Ln.IsNull())
9745  {
9746  loop
9747  {
9748  Ln.SetShortExpVector();
9749  if (withT)
9750  {
9751  int j;
9752  j = kFindDivisibleByInT(strat->T, strat->sevT, strat->tl, &Ln);
9753  if (j < 0) break;
9754  With = &(strat->T[j]);
9755  }
9756  else
9757  {
9758  With = kFindDivisibleByInS(strat, pos, &Ln, &With_s);
9759  if (With == NULL) break;
9760  }
9761  if (normalize && (!TEST_OPT_INTSTRATEGY) && (!nIsOne(pGetCoeff(With->p))))
9762  {
9763  With->pNorm();
9764  //if (TEST_OPT_PROT) { PrintS("n"); mflush(); }
9765  }
9766  strat->redTailChange=TRUE;
9767  if (ksReducePolyTail(L, With, &Ln))
9768  {
9769  // reducing the tail would violate the exp bound
9770  // set a flag and hope for a retry (in bba)
9771  strat->completeReduce_retry=TRUE;
9772  if ((Ln.p != NULL) && (Ln.t_p != NULL)) Ln.p=NULL;
9773  do
9774  {
9775  pNext(h) = Ln.LmExtractAndIter();
9776  pIter(h);
9777  L->pLength++;
9778  } while (!Ln.IsNull());
9779  goto all_done;
9780  }
9781  if (Ln.IsNull()) goto all_done;
9782  if (! withT) With_s.Init(currRing);
9783  }
9784  pNext(h) = Ln.LmExtractAndIter();
9785  pIter(h);
9786  L->pLength++;
9787  }
9788 
9789  all_done:
9790  Ln.Delete();
9791  if (L->p != NULL) pNext(L->p) = pNext(p);
9792 
9793  if (strat->redTailChange)
9794  {
9795  L->length = 0;
9796  }
9797  L->Normalize(); // HANNES: should have a test
9798  kTest_L(L);
9799  return L->GetLmCurrRing();
9800 }
static poly normalize(poly next_p, ideal add_generators, syStrategy syzstr, int *g_l, int *p_l, int crit_comp)
Definition: syz3.cc:1028
class sLObject LObject
Definition: kutil.h:58
loop
Definition: myNF.cc:98
#define FALSE
Definition: auxiliary.h:140
BOOLEAN noTailReduction
Definition: kutil.h:372
return P p
Definition: myNF.cc:203
KINLINE int ksReducePolyTail(LObject *PR, TObject *PW, LObject *Red)
Definition: kInline.h:1055
int tl
Definition: kutil.h:353
#define TRUE
Definition: auxiliary.h:144
#define nIsOne(n)
Definition: numbers.h:25
unsigned long * sevT
Definition: kutil.h:323
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:398
#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:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define kTest_L(T)
Definition: kutil.h:619
TObject * kFindDivisibleByInS(kStrategy strat, int pos, LObject *L, TObject *T, long ecart)
Definition: kutil.cc:5267
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
int kFindDivisibleByInT(const TSet &T, const unsigned long *sevT, const int tl, const LObject *L, const int start)
return -1 if no divisor is found number of first divisor in T, otherwise
Definition: kstd2.cc:101
#define pNext(p)
Definition: monomials.h:43
TSet T
Definition: kutil.h:324
BOOLEAN use_buckets
Definition: kutil.h:377
static Poly * h
Definition: janet.cc:978
char redTailChange
Definition: kutil.h:394
class sTObject TObject
Definition: kutil.h:57
void reorderS ( int suc,
kStrategy  strat 
)

Definition at line 3807 of file kutil.cc.

3808 {
3809  int i,j,at,ecart, s2r;
3810  int fq=0;
3811  unsigned long sev;
3812  poly p;
3813  int new_suc=strat->sl+1;
3814  i= *suc;
3815  if (i<0) i=0;
3816 
3817  for (; i<=strat->sl; i++)
3818  {
3819  at = posInS(strat,i-1,strat->S[i],strat->ecartS[i]);
3820  if (at != i)
3821  {
3822  if (new_suc > at) new_suc = at;
3823  p = strat->S[i];
3824  ecart = strat->ecartS[i];
3825  sev = strat->sevS[i];
3826  s2r = strat->S_2_R[i];
3827  if (strat->fromQ!=NULL) fq=strat->fromQ[i];
3828  for (j=i; j>=at+1; j--)
3829  {
3830  strat->S[j] = strat->S[j-1];
3831  strat->ecartS[j] = strat->ecartS[j-1];
3832  strat->sevS[j] = strat->sevS[j-1];
3833  strat->S_2_R[j] = strat->S_2_R[j-1];
3834  }
3835  strat->S[at] = p;
3836  strat->ecartS[at] = ecart;
3837  strat->sevS[at] = sev;
3838  strat->S_2_R[at] = s2r;
3839  if (strat->fromQ!=NULL)
3840  {
3841  for (j=i; j>=at+1; j--)
3842  {
3843  strat->fromQ[j] = strat->fromQ[j-1];
3844  }
3845  strat->fromQ[at]=fq;
3846  }
3847  }
3848  }
3849  if (new_suc <= strat->sl) *suc=new_suc;
3850  else *suc=-1;
3851 }
int * S_2_R
Definition: kutil.h:342
return P p
Definition: myNF.cc:203
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
intset fromQ
Definition: kutil.h:319
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
intset ecartS
Definition: kutil.h:307
#define NULL
Definition: omList.c:10
int posInS(const kStrategy strat, const int length, const poly p, const int ecart_p)
Definition: kutil.cc:3860
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
ring sbaRing ( kStrategy  strat,
const ring  r,
BOOLEAN  ,
int   
)

Definition at line 8361 of file kutil.cc.

8362 {
8363  int n = rBlocks(r); // Including trailing zero!
8364  // if sbaOrder == 1 => use (C,monomial order from r)
8365  if (strat->sbaOrder == 1)
8366  {
8367  if (r->order[0] == ringorder_C || r->order[0] == ringorder_c)
8368  {
8369  return r;
8370  }
8371  ring res = rCopy0(r, TRUE, FALSE);
8372  res->order = (int *)omAlloc0((n+1)*sizeof(int));
8373  res->block0 = (int *)omAlloc0((n+1)*sizeof(int));
8374  res->block1 = (int *)omAlloc0((n+1)*sizeof(int));
8375  int **wvhdl = (int **)omAlloc0((n+1)*sizeof(int*));
8376  res->wvhdl = wvhdl;
8377  for (int i=1; i<n; i++)
8378  {
8379  res->order[i] = r->order[i-1];
8380  res->block0[i] = r->block0[i-1];
8381  res->block1[i] = r->block1[i-1];
8382  res->wvhdl[i] = r->wvhdl[i-1];
8383  }
8384 
8385  // new 1st block
8386  res->order[0] = ringorder_C; // Prefix
8387  // removes useless secondary component order if defined in old ring
8388  for (int i=rBlocks(res); i>0; --i) {
8389  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
8390  res->order[i] = 0;
8391  }
8392  }
8393  rComplete(res, 1);
8394 #ifdef HAVE_PLURAL
8395  if (rIsPluralRing(r))
8396  {
8397  if ( nc_rComplete(r, res, false) ) // no qideal!
8398  {
8399 #ifndef SING_NDEBUG
8400  WarnS("error in nc_rComplete");
8401 #endif
8402  // cleanup?
8403 
8404  // rDelete(res);
8405  // return r;
8406 
8407  // just go on..
8408  }
8409  }
8410 #endif
8411  strat->tailRing = res;
8412  return (res);
8413  }
8414  // if sbaOrder == 3 => degree - position - ring order
8415  if (strat->sbaOrder == 3)
8416  {
8417  ring res = rCopy0(r, TRUE, FALSE);
8418  res->order = (int *)omAlloc0((n+2)*sizeof(int));
8419  res->block0 = (int *)omAlloc0((n+2)*sizeof(int));
8420  res->block1 = (int *)omAlloc0((n+2)*sizeof(int));
8421  int **wvhdl = (int **)omAlloc0((n+2)*sizeof(int*));
8422  res->wvhdl = wvhdl;
8423  for (int i=2; i<n+2; i++)
8424  {
8425  res->order[i] = r->order[i-2];
8426  res->block0[i] = r->block0[i-2];
8427  res->block1[i] = r->block1[i-2];
8428  res->wvhdl[i] = r->wvhdl[i-2];
8429  }
8430 
8431  // new 1st block
8432  res->order[0] = ringorder_a; // Prefix
8433  res->block0[0] = 1;
8434  res->wvhdl[0] = (int *)omAlloc(res->N*sizeof(int));
8435  for (int i=0; i<res->N; ++i)
8436  res->wvhdl[0][i] = 1;
8437  res->block1[0] = si_min(res->N, rVar(res));
8438  // new 2nd block
8439  res->order[1] = ringorder_C; // Prefix
8440  res->wvhdl[1] = NULL;
8441  // removes useless secondary component order if defined in old ring
8442  for (int i=rBlocks(res); i>1; --i) {
8443  if (res->order[i] == ringorder_C || res->order[i] == ringorder_c) {
8444  res->order[i] = 0;
8445  }
8446  }
8447  rComplete(res, 1);
8448 #ifdef HAVE_PLURAL
8449  if (rIsPluralRing(r))
8450  {
8451  if ( nc_rComplete(r, res, false) ) // no qideal!
8452  {
8453 #ifndef SING_NDEBUG
8454  WarnS("error in nc_rComplete");
8455 #endif
8456  // cleanup?
8457 
8458  // rDelete(res);
8459  // return r;
8460 
8461  // just go on..
8462  }
8463  }
8464 #endif
8465  strat->tailRing = res;
8466  return (res);
8467  }
8468 
8469  // not sbaOrder == 1 => use Schreyer order
8470  // this is done by a trick when initializing the signatures
8471  // in initSLSba():
8472  // Instead of using the signature 1e_i for F->m[i], we start
8473  // with the signature LM(F->m[i])e_i for F->m[i]. Doing this we get a
8474  // Schreyer order w.r.t. the underlying monomial order.
8475  // => we do not need to change the underlying polynomial ring at all!
8476 
8477  // UPDATE/NOTE/TODO: use induced Schreyer ordering 'IS'!!!!????
8478 
8479  /*
8480  else
8481  {
8482  ring res = rCopy0(r, FALSE, FALSE);
8483  // Create 2 more blocks for prefix/suffix:
8484  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
8485  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
8486  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
8487  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
8488 
8489  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
8490  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
8491 
8492  // new 1st block
8493  int j = 0;
8494  res->order[j] = ringorder_IS; // Prefix
8495  res->block0[j] = res->block1[j] = 0;
8496  // wvhdl[j] = NULL;
8497  j++;
8498 
8499  for(int i = 0; (i < n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
8500  {
8501  res->order [j] = r->order [i];
8502  res->block0[j] = r->block0[i];
8503  res->block1[j] = r->block1[i];
8504 
8505  if (r->wvhdl[i] != NULL)
8506  {
8507  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
8508  } // else wvhdl[j] = NULL;
8509  }
8510 
8511  // new last block
8512  res->order [j] = ringorder_IS; // Suffix
8513  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
8514  // wvhdl[j] = NULL;
8515  j++;
8516 
8517  // res->order [j] = 0; // The End!
8518  res->wvhdl = wvhdl;
8519 
8520  // j == the last zero block now!
8521  assume(j == (n+1));
8522  assume(res->order[0]==ringorder_IS);
8523  assume(res->order[j-1]==ringorder_IS);
8524  assume(res->order[j]==0);
8525 
8526  if (complete)
8527  {
8528  rComplete(res, 1);
8529 
8530 #ifdef HAVE_PLURAL
8531  if (rIsPluralRing(r))
8532  {
8533  if ( nc_rComplete(r, res, false) ) // no qideal!
8534  {
8535  }
8536  }
8537  assume(rIsPluralRing(r) == rIsPluralRing(res));
8538 #endif
8539 
8540 
8541 #ifdef HAVE_PLURAL
8542  ring old_ring = r;
8543 
8544 #endif
8545 
8546  if (r->qideal!=NULL)
8547  {
8548  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
8549 
8550  assume(idRankFreeModule(res->qideal, res) == 0);
8551 
8552 #ifdef HAVE_PLURAL
8553  if( rIsPluralRing(res) )
8554  if( nc_SetupQuotient(res, r, true) )
8555  {
8556  // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
8557  }
8558 
8559 #endif
8560  assume(idRankFreeModule(res->qideal, res) == 0);
8561  }
8562 
8563 #ifdef HAVE_PLURAL
8564  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
8565  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
8566  assume(rIsSCA(res) == rIsSCA(old_ring));
8567  assume(ncRingType(res) == ncRingType(old_ring));
8568 #endif
8569  }
8570  strat->tailRing = res;
8571  return res;
8572  }
8573  */
8574 
8575  assume(FALSE);
8576  return(NULL);
8577 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
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:3371
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
unsigned sbaOrder
Definition: kutil.h:314
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring tailRing
Definition: kutil.h:343
#define omAlloc0(size)
Definition: omAllocDecl.h:211
char* showOption ( )

Definition at line 726 of file misc_ip.cc.

727 {
728  int i;
729  BITSET tmp;
730 
731  StringSetS("//options:");
732  if ((si_opt_1!=0)||(si_opt_2!=0))
733  {
734  tmp=si_opt_1;
735  if(tmp)
736  {
737  for (i=0; optionStruct[i].setval!=0; i++)
738  {
739  if (optionStruct[i].setval & tmp)
740  {
741  StringAppend(" %s",optionStruct[i].name);
742  tmp &=optionStruct[i].resetval;
743  }
744  }
745  for (i=0; i<32; i++)
746  {
747  if (tmp & Sy_bit(i)) StringAppend(" %d",i);
748  }
749  }
750  tmp=si_opt_2;
751  if (tmp)
752  {
753  for (i=0; verboseStruct[i].setval!=0; i++)
754  {
755  if (verboseStruct[i].setval & tmp)
756  {
757  StringAppend(" %s",verboseStruct[i].name);
758  tmp &=verboseStruct[i].resetval;
759  }
760  }
761  for (i=1; i<32; i++)
762  {
763  if (tmp & Sy_bit(i)) StringAppend(" %d",i+32);
764  }
765  }
766  return StringEndS();
767  }
768  StringAppendS(" none");
769  return StringEndS();
770 }
unsigned si_opt_1
Definition: options.c:5
char * StringEndS()
Definition: reporter.cc:151
#define BITSET
Definition: structs.h:17
#define Sy_bit(x)
Definition: options.h:30
unsigned setval
Definition: iplib.cc:305
unsigned resetval
Definition: iplib.cc:306
struct soptionStruct verboseStruct[]
Definition: misc_ip.cc:549
void StringSetS(const char *st)
Definition: reporter.cc:128
struct soptionStruct optionStruct[]
Definition: misc_ip.cc:519
void StringAppendS(const char *st)
Definition: reporter.cc:107
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
char name(const Variable &v)
Definition: variable.h:95
unsigned si_opt_2
Definition: options.c:6
static BOOLEAN sugarDivisibleBy ( int  ecart1,
int  ecart2 
)
inlinestatic

Definition at line 1158 of file kutil.cc.

1159 {
1160  return (ecart1 <= ecart2);
1161 }
void superenterpairs ( poly  h,
int  k,
int  ecart,
int  pos,
kStrategy  strat,
int  atR 
)

Definition at line 3597 of file kutil.cc.

3598 {
3599 #if ADIDEBUG
3600  PrintS("\nEnter superenterpairs\n");
3601  int iii = strat->Ll;
3602 #endif
3604  // enter also zero divisor * poly, if this is non zero and of smaller degree
3605  if (!(rField_is_Domain(currRing))) enterExtendedSpoly(h, strat);
3606 #if ADIDEBUG
3607  if(iii==strat->Ll)
3608  {
3609  PrintS("\n enterExtendedSpoly has not changed the list L.\n");
3610  }
3611  else
3612  {
3613  PrintLn();
3614  PrintS("\n enterExtendedSpoly changed the list L:\n");
3615  for(iii=0;iii<=strat->Ll;iii++)
3616  {
3617  Print("\n L[%d]:\n",iii);
3618  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3619  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3620  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3621  }
3622  }
3623  iii = strat->Ll;
3624 #endif
3625  initenterpairs(h, k, ecart, 0, strat, atR);
3626 #if ADIDEBUG
3627  if(iii==strat->Ll)
3628  {
3629  PrintS("\n initenterpairs has not changed the list L.\n");
3630  }
3631  else
3632  {
3633  PrintS("\n initenterpairs changed the list L:\n");
3634  for(iii=0;iii<=strat->Ll;iii++)
3635  {
3636  Print("\n L[%d]:\n",iii);
3637  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3638  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3639  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3640  }
3641  }
3642  iii = strat->Ll;
3643 #endif
3644  initenterstrongPairs(h, k, ecart, 0, strat, atR);
3645 #if ADIDEBUG
3646  if(iii==strat->Ll)
3647  {
3648  PrintS("\n initenterstrongPairs has not changed the list L.\n");
3649  }
3650  else
3651  {
3652  PrintS("\n initenterstrongPairs changed the list L:\n");
3653  for(iii=0;iii<=strat->Ll;iii++)
3654  {
3655  Print("\n L[%d]:\n",iii);
3656  PrintS(" ");p_Write(strat->L[iii].p1,strat->tailRing);
3657  PrintS(" ");p_Write(strat->L[iii].p2,strat->tailRing);
3658  PrintS(" ");p_Write(strat->L[iii].p,strat->tailRing);
3659  }
3660  }
3661  PrintS("\nEnd of superenterpairs\n");
3662 #endif
3663  clearSbatch(h, k, pos, strat);
3664 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
void clearSbatch(poly h, int k, int pos, kStrategy strat)
Definition: kutil.cc:3573
int Ll
Definition: kutil.h:354
void initenterpairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:2751
void initenterstrongPairs(poly h, int k, int ecart, int isFromQ, kStrategy strat, int atR=-1)
Definition: kutil.cc:3451
static BOOLEAN rField_is_Domain(const ring r)
Definition: ring.h:431
int k
Definition: cfEzgcd.cc:93
void enterExtendedSpoly(poly h, kStrategy strat)
Definition: kutil.cc:3481
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define assume(x)
Definition: mod2.h:405
void PrintS(const char *s)
Definition: reporter.cc:294
LSet L
Definition: kutil.h:325
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
ring tailRing
Definition: kutil.h:343
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
static Poly * h
Definition: janet.cc:978
BOOLEAN syzCriterion ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5071 of file kutil.cc.

5072 {
5073 //#if 1
5074 #ifdef DEBUGF5
5075  Print("syzygy criterion checks: ");
5076  pWrite(sig);
5077 #endif
5078  for (int k=0; k<strat->syzl; k++)
5079  {
5080  //printf("-%d",k);
5081 //#if 1
5082 #ifdef DEBUGF5
5083  Print("checking with: %d / %d -- \n",k,strat->syzl);
5084  pWrite(pHead(strat->syz[k]));
5085 #endif
5086  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5087  {
5088 //#if 1
5089 #ifdef DEBUGF5
5090  PrintS("DELETE!\n");
5091 #endif
5092  //printf("- T -\n\n");
5093  return TRUE;
5094  }
5095  }
5096  //printf("- F -\n\n");
5097  return FALSE;
5098 }
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
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:12
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
void PrintS(const char *s)
Definition: reporter.cc:294
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
unsigned long * sevSyz
Definition: kutil.h:321
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
BOOLEAN syzCriterionInc ( poly  sig,
unsigned long  not_sevSig,
kStrategy  strat 
)

Definition at line 5103 of file kutil.cc.

5104 {
5105 //#if 1
5106 #ifdef DEBUGF5
5107  Print("--- syzygy criterion checks: ");
5108  pWrite(sig);
5109 #endif
5110  int comp = p_GetComp(sig, currRing);
5111  int min, max;
5112  if (comp<=1)
5113  return FALSE;
5114  else
5115  {
5116  min = strat->syzIdx[comp-2];
5117  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-2],comp-2);
5118  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp-1],comp-1);
5119  //printf("SYZIDX %d/%d\n",strat->syzIdx[comp],comp);
5120  if (comp == strat->currIdx)
5121  {
5122  max = strat->syzl;
5123  }
5124  else
5125  {
5126  max = strat->syzIdx[comp-1];
5127  }
5128  for (int k=min; k<max; k++)
5129  {
5130 #ifdef F5DEBUG
5131  Print("COMP %d/%d - MIN %d - MAX %d - SYZL %ld\n",comp,strat->currIdx,min,max,strat->syzl);
5132  Print("checking with: %d -- ",k);
5133  pWrite(pHead(strat->syz[k]));
5134 #endif
5135  if (p_LmShortDivisibleBy(strat->syz[k], strat->sevSyz[k], sig, not_sevSig, currRing))
5136  return TRUE;
5137  }
5138  return FALSE;
5139  }
5140 }
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
#define FALSE
Definition: auxiliary.h:140
#define p_GetComp(p, r)
Definition: monomials.h:72
#define TRUE
Definition: auxiliary.h:144
void pWrite(poly p)
Definition: polys.h:279
int k
Definition: cfEzgcd.cc:93
unsigned long currIdx
Definition: kutil.h:315
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:12
static int max(int a, int b)
Definition: fast_mult.cc:264
static BOOLEAN p_LmShortDivisibleBy(poly a, unsigned long sev_a, poly b, unsigned long not_sev_b, const ring r)
Definition: p_polys.h:1707
#define pHead(p)
returns newly allocated copy of Lm(p), coef is copied, next=NULL, p might be NULL ...
Definition: polys.h:67
unsigned long * sevSyz
Definition: kutil.h:321
polyset syz
Definition: kutil.h:305
int syzl
Definition: kutil.h:352
intset syzIdx
Definition: kutil.h:311
long twoPow ( long  arg)

Definition at line 3063 of file kutil.cc.

3064 {
3065  return 1L << arg;
3066 }
void updateResult ( ideal  r,
ideal  Q,
kStrategy  strat 
)

Definition at line 7864 of file kutil.cc.

7865 {
7866  int l;
7867  if (strat->ak>0)
7868  {
7869  for (l=IDELEMS(r)-1;l>=0;l--)
7870  {
7871  if ((r->m[l]!=NULL) && (pGetComp(r->m[l])==0))
7872  {
7873  pDelete(&r->m[l]); // and set it to NULL
7874  }
7875  }
7876  int q;
7877  poly p;
7878  for (l=IDELEMS(r)-1;l>=0;l--)
7879  {
7880  if ((r->m[l]!=NULL)
7881  //&& (strat->syzComp>0)
7882  //&& (pGetComp(r->m[l])<=strat->syzComp)
7883  )
7884  {
7885  for(q=IDELEMS(Q)-1; q>=0;q--)
7886  {
7887  if ((Q->m[q]!=NULL)
7888  &&(pLmDivisibleBy(Q->m[q],r->m[l])))
7889  {
7890  if (TEST_OPT_REDSB)
7891  {
7892  p=r->m[l];
7893  r->m[l]=kNF(Q,NULL,p);
7894  pDelete(&p);
7895  }
7896  else
7897  {
7898  pDelete(&r->m[l]); // and set it to NULL
7899  }
7900  break;
7901  }
7902  }
7903  }
7904  }
7905  }
7906  else
7907  {
7908  int q;
7909  poly p;
7910  BOOLEAN reduction_found=FALSE;
7911  if (!rField_is_Ring(currRing))
7912  {
7913  for (l=IDELEMS(r)-1;l>=0;l--)
7914  {
7915  if (r->m[l]!=NULL)
7916  {
7917  for(q=IDELEMS(Q)-1; q>=0;q--)
7918  {
7919  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l])))
7920  {
7921  if (TEST_OPT_REDSB)
7922  {
7923  p=r->m[l];
7924  r->m[l]=kNF(Q,NULL,p);
7925  pDelete(&p);
7926  reduction_found=TRUE;
7927  }
7928  else
7929  {
7930  pDelete(&r->m[l]); // and set it to NULL
7931  }
7932  break;
7933  }
7934  }
7935  }
7936  }
7937  }
7938  #ifdef HAVE_RINGS
7939  //Also need divisibility of the leading coefficients
7940  else
7941  {
7942  for (l=IDELEMS(r)-1;l>=0;l--)
7943  {
7944  if (r->m[l]!=NULL)
7945  {
7946  for(q=IDELEMS(Q)-1; q>=0;q--)
7947  {
7948  if ((Q->m[q]!=NULL)&&(pLmEqual(Q->m[q],r->m[l]))
7949  && pDivisibleBy(Q->m[q],r->m[l]))
7950  {
7951  if (TEST_OPT_REDSB)
7952  {
7953  p=r->m[l];
7954  r->m[l]=kNF(Q,NULL,p);
7955  pDelete(&p);
7956  reduction_found=TRUE;
7957  }
7958  else
7959  {
7960  pDelete(&r->m[l]); // and set it to NULL
7961  }
7962  break;
7963  }
7964  }
7965  }
7966  }
7967  }
7968  #endif
7969  if (/*TEST_OPT_REDSB &&*/ reduction_found)
7970  {
7971  for (l=IDELEMS(r)-1;l>=0;l--)
7972  {
7973  if (r->m[l]!=NULL)
7974  {
7975  for(q=IDELEMS(r)-1;q>=0;q--)
7976  {
7977  if ((l!=q)
7978  && (r->m[q]!=NULL)
7979  &&(pLmDivisibleBy(r->m[l],r->m[q])))
7980  {
7981  pDelete(&r->m[q]);
7982  }
7983  }
7984  }
7985  }
7986  }
7987  }
7988  idSkipZeroes(r);
7989 }
poly kNF(ideal F, ideal Q, poly p, int syzComp, int lazyReduce)
Definition: kstd1.cc:2598
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
#define TEST_OPT_REDSB
Definition: options.h:99
int ak
Definition: kutil.h:356
#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:128
#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:12
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
#define IDELEMS(i)
Definition: simpleideals.h:19
void idSkipZeroes(ideal ide)
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#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:126
#define pDelete(p_ptr)
Definition: polys.h:157
int BOOLEAN
Definition: auxiliary.h:131
#define pLmEqual(p1, p2)
Definition: polys.h:111
int l
Definition: cfEzgcd.cc:94
void updateS ( BOOLEAN  toT,
kStrategy  strat 
)

Definition at line 6695 of file kutil.cc.

6696 {
6697  LObject h;
6698  int i, suc=0;
6699  poly redSi=NULL;
6700  BOOLEAN change,any_change;
6701 // Print("nach initS: updateS start mit sl=%d\n",(strat->sl));
6702 // for (i=0; i<=(strat->sl); i++)
6703 // {
6704 // Print("s%d:",i);
6705 // if (strat->fromQ!=NULL) Print("(Q:%d) ",strat->fromQ[i]);
6706 // pWrite(strat->S[i]);
6707 // }
6708 // Print("currRing->OrdSgn=%d\n", currRing->OrdSgn);
6709  any_change=FALSE;
6711  {
6712  while (suc != -1)
6713  {
6714  i=suc+1;
6715  while (i<=strat->sl)
6716  {
6717  change=FALSE;
6718  #ifdef HAVE_RINGS
6720  any_change = FALSE;
6721  #endif
6722  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
6723  {
6724  redSi = pHead(strat->S[i]);
6725  strat->S[i] = redBba(strat->S[i],i-1,strat);
6726  //if ((strat->ak!=0)&&(strat->S[i]!=NULL))
6727  // strat->S[i]=redQ(strat->S[i],i+1,strat); /*reduce S[i] mod Q*/
6728  if (pCmp(redSi,strat->S[i])!=0)
6729  {
6730  change=TRUE;
6731  any_change=TRUE;
6732  #ifdef KDEBUG
6733  if (TEST_OPT_DEBUG)
6734  {
6735  PrintS("reduce:");
6736  wrp(redSi);PrintS(" to ");p_wrp(strat->S[i], currRing, strat->tailRing);PrintLn();
6737  }
6738  #endif
6739  if (TEST_OPT_PROT)
6740  {
6741  if (strat->S[i]==NULL)
6742  PrintS("V");
6743  else
6744  PrintS("v");
6745  mflush();
6746  }
6747  }
6748  pLmDelete(&redSi);
6749  if (strat->S[i]==NULL)
6750  {
6751  deleteInS(i,strat);
6752  i--;
6753  }
6754  else if (change)
6755  {
6757  {
6758  if (TEST_OPT_CONTENTSB)
6759  {
6760  number n;
6761  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
6762  if (!nIsOne(n))
6763  {
6765  denom->n=nInvers(n);
6766  denom->next=DENOMINATOR_LIST;
6767  DENOMINATOR_LIST=denom;
6768  }
6769  nDelete(&n);
6770  }
6771  else
6772  {
6773  //pContent(strat->S[i]);
6774  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
6775  }
6776  }
6777  else
6778  {
6779  pNorm(strat->S[i]);
6780  }
6781  strat->sevS[i] = pGetShortExpVector(strat->S[i]);
6782  }
6783  }
6784  i++;
6785  }
6786  if (any_change) reorderS(&suc,strat);
6787  else break;
6788  }
6789  if (toT)
6790  {
6791  for (i=0; i<=strat->sl; i++)
6792  {
6793  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
6794  {
6795  h.p = redtailBba(strat->S[i],i-1,strat);
6797  {
6798  h.pCleardenom();// also does a pContent
6799  }
6800  }
6801  else
6802  {
6803  h.p = strat->S[i];
6804  }
6805  strat->initEcart(&h);
6806  if (strat->honey)
6807  {
6808  strat->ecartS[i] = h.ecart;
6809  }
6810  if (strat->sevS[i] == 0) {strat->sevS[i] = pGetShortExpVector(h.p);}
6811  else assume(strat->sevS[i] == pGetShortExpVector(h.p));
6812  h.sev = strat->sevS[i];
6813  /*puts the elements of S also to T*/
6814  strat->initEcart(&h);
6815  enterT(h,strat);
6816  strat->S_2_R[i] = strat->tl;
6817  }
6818  }
6819  }
6820  else
6821  {
6822  while (suc != -1)
6823  {
6824  i=suc;
6825  while (i<=strat->sl)
6826  {
6827  change=FALSE;
6828  if (((strat->fromQ==NULL) || (strat->fromQ[i]==0)) && (i>0))
6829  {
6830  redSi=pHead((strat->S)[i]);
6831  (strat->S)[i] = redMora((strat->S)[i],i-1,strat);
6832  if ((strat->S)[i]==NULL)
6833  {
6834  deleteInS(i,strat);
6835  i--;
6836  }
6837  else if (pCmp((strat->S)[i],redSi)!=0)
6838  {
6839  any_change=TRUE;
6840  h.p = strat->S[i];
6841  strat->initEcart(&h);
6842  strat->ecartS[i] = h.ecart;
6844  {
6845  if (TEST_OPT_CONTENTSB)
6846  {
6847  number n;
6848  p_Cleardenom_n(strat->S[i], currRing, n);// also does a pContent
6849  if (!nIsOne(n))
6850  {
6852  denom->n=nInvers(n);
6853  denom->next=DENOMINATOR_LIST;
6854  DENOMINATOR_LIST=denom;
6855  }
6856  nDelete(&n);
6857  }
6858  else
6859  {
6860  //pContent(strat->S[i]);
6861  strat->S[i]=p_Cleardenom(strat->S[i], currRing);// also does a pContent
6862  }
6863  }
6864  else
6865  {
6866  pNorm(strat->S[i]); // == h.p
6867  }
6868  h.sev = pGetShortExpVector(h.p);
6869  strat->sevS[i] = h.sev;
6870  }
6871  pLmDelete(&redSi);
6872  kTest(strat);
6873  }
6874  i++;
6875  }
6876 #ifdef KDEBUG
6877  kTest(strat);
6878 #endif
6879  if (any_change) reorderS(&suc,strat);
6880  else { suc=-1; break; }
6881  if (h.p!=NULL)
6882  {
6883  if (!strat->kHEdgeFound)
6884  {
6885  /*strat->kHEdgeFound =*/ HEckeTest(h.p,strat);
6886  }
6887  if (strat->kHEdgeFound)
6888  newHEdge(strat);
6889  }
6890  }
6891  for (i=0; i<=strat->sl; i++)
6892  {
6893  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
6894  {
6895  strat->S[i] = h.p = redtail(strat->S[i],strat->sl,strat);
6896  strat->initEcart(&h);
6897  strat->ecartS[i] = h.ecart;
6898  h.sev = pGetShortExpVector(h.p);
6899  strat->sevS[i] = h.sev;
6900  }
6901  else
6902  {
6903  h.p = strat->S[i];
6904  h.ecart=strat->ecartS[i];
6905  h.sev = strat->sevS[i];
6906  h.length = h.pLength = pLength(h.p);
6907  }
6908  if ((strat->fromQ==NULL) || (strat->fromQ[i]==0))
6909  cancelunit1(&h,&suc,strat->sl,strat);
6910  h.SetpFDeg();
6911  /*puts the elements of S also to T*/
6912  enterT(h,strat);
6913  strat->S_2_R[i] = strat->tl;
6914  }
6915  if (suc!= -1) updateS(toT,strat);
6916  }
6917 #ifdef KDEBUG
6918  kTest(strat);
6919 #endif
6920 }
denominator_list_s * denominator_list
Definition: kutil.h:63
poly redtail(LObject *L, int pos, kStrategy strat)
Definition: kutil.cc:5337
BOOLEAN honey
Definition: kutil.h:371
void PrintLn()
Definition: reporter.cc:322
class sLObject LObject
Definition: kutil.h:58
#define TEST_OPT_PROT
Definition: options.h:98
#define FALSE
Definition: auxiliary.h:140
int * S_2_R
Definition: kutil.h:342
void cancelunit1(LObject *p, int *suc, int index, kStrategy strat)
Definition: kutil.cc:6543
void reorderS(int *suc, kStrategy strat)
Definition: kutil.cc:3807
void enterT(LObject p, kStrategy strat, int atT)
Definition: kutil.cc:7161
#define TEST_OPT_CONTENTSB
Definition: options.h:121
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
int tl
Definition: kutil.h:353
#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:144
#define nIsOne(n)
Definition: numbers.h:25
denominator_list DENOMINATOR_LIST
Definition: kutil.cc:81
#define kTest(A)
Definition: kutil.h:615
void deleteInS(int i, kStrategy strat)
Definition: kutil.cc:932
#define TEST_OPT_DEBUG
Definition: options.h:103
poly redtailBba(LObject *L, int pos, kStrategy strat, BOOLEAN withT, BOOLEAN normalize)
Definition: kutil.cc:5412
#define omAlloc(size)
Definition: omAllocDecl.h:210
void HEckeTest(poly pp, kStrategy strat)
Definition: kutil.cc:422
static int pLength(poly a)
Definition: p_polys.h:189
static poly redBba(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6631
#define mflush()
Definition: reporter.h:42
void p_Cleardenom_n(poly ph, const ring r, number &c)
Definition: p_polys.cc:2799
void(* initEcart)(TObject *L)
Definition: kutil.h:279
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define TEST_OPT_INTSTRATEGY
Definition: options.h:105
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
intset fromQ
Definition: kutil.h:319
#define pGetShortExpVector(a)
returns the "Short Exponent Vector" – used to speed up divisibility tests (see polys-impl.cc )
Definition: polys.h:140
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#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:304
#define nDelete(n)
Definition: numbers.h:16
kStrategy strat
Definition: myNF.cc:319
#define nInvers(a)
Definition: numbers.h:33
BOOLEAN kHEdgeFound
Definition: kutil.h:370
intset ecartS
Definition: kutil.h:307
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
BOOLEAN rHasGlobalOrdering(const ring r)
Definition: ring.h:741
ring tailRing
Definition: kutil.h:343
void pNorm(poly p, const ring R=currRing)
Definition: polys.h:334
denominator_list next
Definition: kutil.h:65
void updateS(BOOLEAN toT, kStrategy strat)
Definition: kutil.cc:6695
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
static poly redMora(poly h, int maxIndex, kStrategy strat)
Definition: kutil.cc:6654
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:235
BOOLEAN newHEdge(kStrategy strat)
Definition: kutil.cc:8113
void wrp(poly p)
Definition: polys.h:281
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2655
void updateSShift ( kStrategy  strat,
int  uptodeg,
int  lV 
)

Definition at line 9021 of file kutil.cc.

9022 {
9023  /* to use after updateS(toT=FALSE,strat) */
9024  /* fills T with shifted elt's of S */
9025  int i;
9026  LObject h;
9027  int atT = -1; // or figure out smth better
9028  strat->tl = -1; // init
9029  for (i=0; i<=strat->sl; i++)
9030  {
9031  memset(&h,0,sizeof(h));
9032  h.p = strat->S[i]; // lm in currRing, tail in TR
9033  strat->initEcart(&h);
9034  h.sev = strat->sevS[i];
9035  h.t_p = NULL;
9036  h.GetTP(); // creates correct t_p
9037  /*puts the elements of S with their shifts to T*/
9038  // int atT, int uptodeg, int lV)
9039  strat->S_2_R[i] = strat->tl + 1; // the el't with shift 0 will be inserted first
9040  // need a small check for above; we insert >=1 elements
9041  // insert this check into kTest_TS ?
9042  enterTShift(h,strat,atT,uptodeg,lV);
9043  }
9044  /* what about setting strat->tl? */
9045 }
class sLObject LObject
Definition: kutil.h:58
int * S_2_R
Definition: kutil.h:342
int tl
Definition: kutil.h:353
void(* initEcart)(TObject *L)
Definition: kutil.h:279
void enterTShift(LObject p, kStrategy strat, int atT, int uptodeg, int lV)
Definition: kutil.cc:9678
int i
Definition: cfEzgcd.cc:123
polyset S
Definition: kutil.h:304
#define NULL
Definition: omList.c:10
unsigned long * sevS
Definition: kutil.h:320
int sl
Definition: kutil.h:351
static Poly * h
Definition: janet.cc:978

Variable Documentation

denominator_list DENOMINATOR_LIST =NULL

Definition at line 81 of file kutil.cc.

int HCord

Definition at line 227 of file kutil.cc.

int Kstd1_deg

Definition at line 228 of file kutil.cc.

int Kstd1_mu =32000

Definition at line 229 of file kutil.cc.